diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/DepositAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/DepositAccountsApiResource.java index 4e9616076..7aec2bb40 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/DepositAccountsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/DepositAccountsApiResource.java @@ -68,7 +68,8 @@ public class DepositAccountsApiResource { "deposit", "maturityInterestRate", "tenureInMonths", "interestCompoundedEvery", "interestCompoundedEveryPeriodType", "renewalAllowed", - "preClosureAllowed", "preClosureInterestRate", "statusEnum","withdrawnonDate","rejectedonDate","closedonDate")); + "preClosureAllowed", "preClosureInterestRate", + "withdrawnonDate","rejectedonDate","closedonDate")); @POST @@ -188,29 +189,21 @@ public class DepositAccountsApiResource { public Response SubmitDepositApplication(@PathParam("accountId") final Long accountId, @QueryParam("command") final String commandParam, final String jsonRequestBody) { - - Response response=null; if (is(commandParam, "approve")) { - DepositStateTransitionApprovalCommand command=apiDataConversionService.convertJsonToDepositStateTransitionApprovalCommand(accountId, jsonRequestBody); EntityIdentifier identifier = this.depositAccountWritePlatformService.approveDepositApplication(command); response = Response.ok().entity(identifier).build(); } - else if (is(commandParam, "reject")) { - DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody); EntityIdentifier identifier = this.depositAccountWritePlatformService.rejectDepositApplication(command); response = Response.ok().entity(identifier).build(); - } else if (is(commandParam, "withdrewbyclient")) { - DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody); EntityIdentifier identifier = this.depositAccountWritePlatformService.withdrawDepositApplication(command); response = Response.ok().entity(identifier).build(); - } UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(accountId); diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java index 73ac3590e..04825fa2c 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/api/infrastructure/ApiDataConversionServiceImpl.java @@ -62,7 +62,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService { } @Override - public ChargeCommand convertJsonToChargeCommand(Long resourceIdentifier, String json) { + public ChargeCommand convertJsonToChargeCommand(final Long resourceIdentifier, final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } @@ -1030,29 +1030,29 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService { } @Override - public DepositStateTransitionApprovalCommand convertJsonToDepositStateTransitionApprovalCommand( - Long resourceIdentifier, String json) { - - if (StringUtils.isBlank(json)) { - throw new InvalidJsonException(); - } - - Type typeOfMap = new TypeToken>(){}.getType(); - Map requestMap = gsonConverter.fromJson(json, typeOfMap); - - Set supportedParams = new HashSet( Arrays.asList("locale","eventDate", "dateFormat", "tenureInMonths", "depositAmount", "interestCompoundedEveryPeriodType", "productId","interestCompoundedEvery")); - - checkForUnsupportedParameters(requestMap, supportedParams); - - Set modifiedParameters = new HashSet(); - - LocalDate eventDate = extractLocalDateParameter("eventDate", requestMap, modifiedParameters); - BigDecimal depositAmount=extractBigDecimalParameter("depositAmount", requestMap, modifiedParameters); - Integer tenureInMonths = extractIntegerParameter("tenureInMonths", requestMap, modifiedParameters); - Integer interestCompoundedEveryPeriodType = extractIntegerParameter("interestCompoundedEveryPeriodType", requestMap, modifiedParameters); - Integer interestCompoundedEvery = extractIntegerParameter("interestCompoundedEvery", requestMap, modifiedParameters); - Long productId = extractLongParameter("productId", requestMap, modifiedParameters); - - return new DepositStateTransitionApprovalCommand(resourceIdentifier, productId, eventDate, tenureInMonths, depositAmount, interestCompoundedEveryPeriodType,interestCompoundedEvery); + public DepositStateTransitionApprovalCommand convertJsonToDepositStateTransitionApprovalCommand( + final Long resourceIdentifier, final String json) { + + if (StringUtils.isBlank(json)) { + throw new InvalidJsonException(); } + + Type typeOfMap = new TypeToken>(){}.getType(); + Map requestMap = gsonConverter.fromJson(json, typeOfMap); + + Set supportedParams = new HashSet(Arrays.asList("locale","eventDate", "dateFormat", "tenureInMonths", "depositAmount", "interestCompoundedEveryPeriodType", "productId","interestCompoundedEvery")); + + checkForUnsupportedParameters(requestMap, supportedParams); + + Set modifiedParameters = new HashSet(); + + LocalDate eventDate = extractLocalDateParameter("eventDate", requestMap, modifiedParameters); + BigDecimal depositAmount=extractBigDecimalParameter("depositAmount", requestMap, modifiedParameters); + Integer tenureInMonths = extractIntegerParameter("tenureInMonths", requestMap, modifiedParameters); + Integer interestCompoundedEveryPeriodType = extractIntegerParameter("interestCompoundedEveryPeriodType", requestMap, modifiedParameters); + Integer interestCompoundedEvery = extractIntegerParameter("interestCompoundedEvery", requestMap, modifiedParameters); + Long productId = extractLongParameter("productId", requestMap, modifiedParameters); + + return new DepositStateTransitionApprovalCommand(resourceIdentifier, productId, eventDate, tenureInMonths, depositAmount, interestCompoundedEveryPeriodType,interestCompoundedEvery); + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java b/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java index 71641579d..57c87df8a 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositAccount.java @@ -6,8 +6,6 @@ import java.util.Date; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @@ -30,10 +28,12 @@ import org.mifosng.platform.user.domain.AppUser; @Table(name = "m_deposit_account", uniqueConstraints = @UniqueConstraint(name="deposit_acc_external_id", columnNames = { "external_id" })) public class DepositAccount extends AbstractAuditableCustom { + @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "client_id", nullable = false) private Client client; + @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "product_id") private final DepositProduct product; @@ -41,24 +41,27 @@ public class DepositAccount extends AbstractAuditableCustom { @Column(name = "external_id") private String externalId; + @SuppressWarnings("unused") @Embedded private MonetaryCurrency currency; @Column(name = "deposit_amount", scale = 6, precision = 19, nullable = false) private BigDecimal depositAmount; + @SuppressWarnings("unused") @Column(name = "maturity_nominal_interest_rate", scale = 6, precision = 19, nullable = false) private BigDecimal interestRate; @Column(name = "tenure_months", nullable=false) private Integer tenureInMonths; + @SuppressWarnings("unused") @Column(name = "interest_compounded_every", nullable = false) private Integer interestCompoundedEvery; - @Enumerated(EnumType.ORDINAL) + @SuppressWarnings("unused") @Column(name = "interest_compounded_every_period_enum", nullable = false) - private PeriodFrequencyType interestCompoundedFrequencyType; + private Integer interestCompoundedFrequencyType; @Temporal(TemporalType.DATE) @Column(name = "projected_commencement_date") @@ -68,32 +71,41 @@ public class DepositAccount extends AbstractAuditableCustom { @Column(name = "actual_commencement_date") private Date actualCommencementDate; + @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "projected_maturity_date") private Date projectedMaturityDate; + @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "actual_maturity_date") private Date actualMaturityDate; + @SuppressWarnings("unused") @Column(name = "projected_interest_accrued_on_maturity", scale = 6, precision = 19, nullable = false) private BigDecimal projectedInterestAccruedOnMaturity; + @SuppressWarnings("unused") @Column(name = "actual_interest_accrued", scale = 6, precision = 19, nullable = false) private BigDecimal interestAccrued; + @SuppressWarnings("unused") @Column(name = "projected_total_maturity_amount", scale = 6, precision = 19, nullable = false) private BigDecimal projectedTotalOnMaturity; + @SuppressWarnings("unused") @Column(name = "actual_total_amount", scale = 6, precision = 19, nullable = false) private BigDecimal total; + @SuppressWarnings("unused") @Column(name = "pre_closure_interest_rate", scale = 6, precision = 19, nullable = false) private BigDecimal preClosureInterestRate; + @SuppressWarnings("unused") @Column(name = "is_renewal_allowed", nullable = false) private boolean renewalAllowed = false; + @SuppressWarnings("unused") @Column(name = "is_preclosure_allowed", nullable = false) private boolean preClosureAllowed = false; @@ -103,14 +115,17 @@ public class DepositAccount extends AbstractAuditableCustom { @Column(name = "status_enum", nullable = false) private Integer depositStatus; + @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "closedon_date") private Date closedOnDate; + @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "rejectedon_date") private Date rejectedOnDate; + @SuppressWarnings("unused") @Temporal(TemporalType.DATE) @Column(name = "withdrawnon_date") private Date withdrawnOnDate; @@ -167,7 +182,7 @@ public class DepositAccount extends AbstractAuditableCustom { this.tenureInMonths = termInMonths; this.interestCompoundedEvery = interestCompoundedEvery; - this.interestCompoundedFrequencyType = interestCompoundedFrequencyPeriodType; + this.interestCompoundedFrequencyType = interestCompoundedFrequencyPeriodType.getValue(); if (commencementDate != null) { this.projectedCommencementDate = commencementDate.toDate(); this.projectedMaturityDate = commencementDate.plusMonths(this.tenureInMonths).toDate(); @@ -202,14 +217,18 @@ public class DepositAccount extends AbstractAuditableCustom { } - public void approve(final LocalDate actualCommencementDate, DepositLifecycleStateMachine depositLifecycleStateMachine, DepositApprovalData depositApprovalData, BigDecimal depositAmount) { + public void approve( + final LocalDate actualCommencementDate, + final DepositLifecycleStateMachine depositLifecycleStateMachine, + final DepositApprovalData depositApprovalData, + final BigDecimal depositAmount) { DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_APPROVED, DepositStatus.fromInt(this.depositStatus)); this.depositStatus = statusEnum.getValue(); this.tenureInMonths = depositApprovalData.getTenureInMonths(); this.depositAmount = depositAmount; - this.interestCompoundedFrequencyType = depositApprovalData.getInterestCompoundedEveryPeriodType(); + this.interestCompoundedFrequencyType = depositApprovalData.getInterestCompoundedEveryPeriodType().getValue(); this.actualCommencementDate = actualCommencementDate.toDateTimeAtCurrentTime().toDate(); @@ -236,75 +255,88 @@ public class DepositAccount extends AbstractAuditableCustom { } } - public LocalDate getActualCommencementDate() { - LocalDate date=null; - if(this.actualCommencementDate!=null){ - date = new LocalDate(this.actualCommencementDate); - } - return date; + public LocalDate getActualCommencementDate() { + LocalDate date = null; + if (this.actualCommencementDate != null) { + date = new LocalDate(this.actualCommencementDate); + } + return date; + } + + public LocalDate getProjectedCommencementDate() { + LocalDate date = null; + if (this.projectedCommencementDate != null) { + date = new LocalDate(this.projectedCommencementDate); + } + return date; + } + + public void reject(final LocalDate rejectedOn, + final DepositLifecycleStateMachine depositLifecycleStateMachine) { + + DepositStatus statusEnum = depositLifecycleStateMachine.transition( + DepositEvent.DEPOSIT_REJECTED, + DepositStatus.fromInt(this.depositStatus)); + this.depositStatus = statusEnum.getValue(); + + this.rejectedOnDate = rejectedOn.toDateTimeAtCurrentTime().toDate(); + this.closedOnDate = rejectedOn.toDateTimeAtCurrentTime().toDate(); + + if (rejectedOn.isBefore(getProjectedCommencementDate())) { + + final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: " + + getProjectedCommencementDate().toString(); + throw new InvalidDepositStateTransitionException("reject", + "cannot.be.before.submittal.date", errorMessage, + rejectedOn, getProjectedCommencementDate()); + + } + if (rejectedOn.isAfter(new LocalDate())) { + + final String errorMessage = "The date on which a deposit is rejected cannot be in the future."; + throw new InvalidDepositStateTransitionException("reject", + "cannot.be.a.future.date", errorMessage, rejectedOn); + + } + + } + + public void withdrawnByApplicant(final LocalDate withdrawnOn, + final DepositLifecycleStateMachine depositLifecycleStateMachine) { + + DepositStatus statusEnum = depositLifecycleStateMachine.transition( + DepositEvent.DEPOSIT_WITHDRAWN, + DepositStatus.fromInt(this.depositStatus)); + this.depositStatus = statusEnum.getValue(); + + this.withdrawnOnDate = withdrawnOn.toDateTimeAtCurrentTime().toDate(); + this.closedOnDate = withdrawnOn.toDateTimeAtCurrentTime().toDate(); + + if (withdrawnOn.isBefore(getProjectedCommencementDate())) { + + final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: " + + getProjectedCommencementDate().toString(); + throw new InvalidDepositStateTransitionException("reject", + "cannot.be.before.submittal.date", errorMessage, + withdrawnOn, getProjectedCommencementDate()); + } - public LocalDate getProjectedCommencementDate() { - LocalDate date=null; - if(this.projectedCommencementDate!=null){ - date = new LocalDate(this.projectedCommencementDate); - } - return date; + if (withdrawnOn.isAfter(new LocalDate())) { + final String errorMessage = "The date on which a deposit is rejected cannot be in the future."; + throw new InvalidDepositStateTransitionException("reject", + "cannot.be.a.future.date", errorMessage, withdrawnOn); } + } - public void reject(LocalDate rejectedOn, DepositLifecycleStateMachine depositLifecycleStateMachine) { - - DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_REJECTED, DepositStatus.fromInt(this.depositStatus)); - this.depositStatus = statusEnum.getValue(); - - this.rejectedOnDate = rejectedOn.toDateTimeAtCurrentTime().toDate(); - this.closedOnDate = rejectedOn.toDateTimeAtCurrentTime().toDate(); - - if (rejectedOn.isBefore(getProjectedCommencementDate())) { - - final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: " + getProjectedCommencementDate().toString(); - throw new InvalidDepositStateTransitionException("reject", "cannot.be.before.submittal.date", errorMessage, rejectedOn, getProjectedCommencementDate()); - - } - if (rejectedOn.isAfter(new LocalDate())) { - - final String errorMessage = "The date on which a deposit is rejected cannot be in the future."; - throw new InvalidDepositStateTransitionException("reject", "cannot.be.a.future.date", errorMessage, rejectedOn); - - } + public void undoDepositApproval(final DepositLifecycleStateMachine depositLifecycleStateMachine) { - } + DepositStatus statusEnum = depositLifecycleStateMachine.transition( + DepositEvent.DEPOSIT_APPROVAL_UNDO, + DepositStatus.fromInt(this.depositStatus)); + this.depositStatus = statusEnum.getValue(); - public void withdraw(LocalDate withdrawnOn, DepositLifecycleStateMachine depositLifecycleStateMachine) { - - DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_WITHDRAWN, DepositStatus.fromInt(this.depositStatus)); - this.depositStatus = statusEnum.getValue(); - - this.withdrawnOnDate = withdrawnOn.toDateTimeAtCurrentTime().toDate(); - this.closedOnDate = withdrawnOn.toDateTimeAtCurrentTime().toDate(); - - if (withdrawnOn.isBefore(getProjectedCommencementDate())) { - - final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: " + getProjectedCommencementDate().toString(); - throw new InvalidDepositStateTransitionException("reject", "cannot.be.before.submittal.date", errorMessage, withdrawnOn, getProjectedCommencementDate()); - - } - if (withdrawnOn.isAfter(new LocalDate())) { - - final String errorMessage = "The date on which a deposit is rejected cannot be in the future."; - throw new InvalidDepositStateTransitionException("reject", "cannot.be.a.future.date", errorMessage, withdrawnOn); - - } - - } - - public void undoDepositApproval(DepositLifecycleStateMachine depositLifecycleStateMachine) { - - DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_APPROVAL_UNDO, DepositStatus.fromInt(this.depositStatus)); - this.depositStatus = statusEnum.getValue(); - - this.actualCommencementDate = null; - this.actualMaturityDate=null; - - } + this.actualCommencementDate = null; + this.actualMaturityDate = null; + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositApprovalData.java b/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositApprovalData.java index ba54f74fb..30fb7abc4 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositApprovalData.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/saving/domain/DepositApprovalData.java @@ -6,42 +6,50 @@ import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.loan.domain.PeriodFrequencyType; public class DepositApprovalData { - + private final Integer tenureInMonths; private final Money deposit; private final BigDecimal maturityInterestRate; private final Integer interestCompoundedEvery; private final PeriodFrequencyType interestCompoundedEveryPeriodType; private final FixedTermDepositInterestCalculator fixedTermDepositInterestCalculator; - - - public DepositApprovalData(final Integer tenureInMonths,final Money deposit,final BigDecimal maturityInterestRate,final Integer interestCompoundedEvery,final PeriodFrequencyType interestCompoundedEveryPeriodType,final FixedTermDepositInterestCalculator fixedTermDepositInterestCalculator) { - this.tenureInMonths=tenureInMonths; - this.deposit=deposit; - this.maturityInterestRate=maturityInterestRate; - this.interestCompoundedEvery=interestCompoundedEvery; - this.interestCompoundedEveryPeriodType=interestCompoundedEveryPeriodType; - this.fixedTermDepositInterestCalculator=fixedTermDepositInterestCalculator; + + public DepositApprovalData( + final Integer tenureInMonths, + final Money deposit, + final BigDecimal maturityInterestRate, + final Integer interestCompoundedEvery, + final PeriodFrequencyType interestCompoundedEveryPeriodType, + final FixedTermDepositInterestCalculator fixedTermDepositInterestCalculator) { + this.tenureInMonths = tenureInMonths; + this.deposit = deposit; + this.maturityInterestRate = maturityInterestRate; + this.interestCompoundedEvery = interestCompoundedEvery; + this.interestCompoundedEveryPeriodType = interestCompoundedEveryPeriodType; + this.fixedTermDepositInterestCalculator = fixedTermDepositInterestCalculator; } - - + public Integer getTenureInMonths() { return tenureInMonths; } + public Money getDeposit() { return deposit; } + public BigDecimal getMaturityInterestRate() { return maturityInterestRate; } + public Integer getInterestCompoundedEvery() { return interestCompoundedEvery; } + public PeriodFrequencyType getInterestCompoundedEveryPeriodType() { return interestCompoundedEveryPeriodType; } + public FixedTermDepositInterestCalculator getFixedTermDepositInterestCalculator() { return fixedTermDepositInterestCalculator; } - -} +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountAssembler.java b/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountAssembler.java index 19abfddd4..36636da55 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountAssembler.java @@ -4,7 +4,6 @@ import java.math.BigDecimal; import java.util.Arrays; import java.util.List; -import org.joda.time.LocalDate; import org.mifosng.platform.api.commands.DepositAccountCommand; import org.mifosng.platform.api.commands.DepositStateTransitionApprovalCommand; import org.mifosng.platform.client.domain.Client; @@ -12,7 +11,6 @@ import org.mifosng.platform.client.domain.ClientRepository; import org.mifosng.platform.currency.domain.Money; import org.mifosng.platform.exceptions.ClientNotFoundException; import org.mifosng.platform.exceptions.DepositProductNotFoundException; -import org.mifosng.platform.exceptions.NoAuthorizationException; import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.saving.domain.DepositAccount; import org.mifosng.platform.saving.domain.DepositApprovalData; diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java index ca56e78f3..82a4a0a0e 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/saving/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java @@ -129,7 +129,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo @Transactional @Override - public EntityIdentifier approveDepositApplication(DepositStateTransitionApprovalCommand command) { + public EntityIdentifier approveDepositApplication(final DepositStateTransitionApprovalCommand command) { AppUser currentUser = context.authenticatedUser(); @@ -144,6 +144,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo DepositApprovalData depositApprovalData=this.depositAccountAssembler.assembleFrom(command); + // FIXME - madhukar - you are checking for loan permission here instead of some specific deposit account permission. LocalDate eventDate = command.getEventDate(); if (this.isBeforeToday(eventDate) && currentUser.canNotApproveLoanInPast()) { throw new NoAuthorizationException("User has no authority to approve deposit with a date in the past."); @@ -151,7 +152,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo BigDecimal depositAmount = command.getDepositAmount(); - account.approve(eventDate, defaultDepositLifecycleStateMachine(), depositApprovalData,depositAmount); + account.approve(eventDate, defaultDepositLifecycleStateMachine(), depositApprovalData, depositAmount); this.depositAccountRepository.save(account); return new EntityIdentifier(account.getId()); @@ -210,7 +211,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo throw new NoAuthorizationException("User has no authority to approve deposit with a date in the past."); } - account.withdraw(eventDate, defaultDepositLifecycleStateMachine()); + account.withdrawnByApplicant(eventDate, defaultDepositLifecycleStateMachine()); return new EntityIdentifier(account.getId()); }