some formatting changes and cleanup of status for deposit accounts.

This commit is contained in:
Keith Woodlock
2012-08-30 10:01:08 +01:00
parent 2132a5dccb
commit f09d781005
6 changed files with 157 additions and 125 deletions
@@ -68,7 +68,8 @@ public class DepositAccountsApiResource {
"deposit", "maturityInterestRate", "tenureInMonths", "deposit", "maturityInterestRate", "tenureInMonths",
"interestCompoundedEvery", "interestCompoundedEvery",
"interestCompoundedEveryPeriodType", "renewalAllowed", "interestCompoundedEveryPeriodType", "renewalAllowed",
"preClosureAllowed", "preClosureInterestRate", "statusEnum","withdrawnonDate","rejectedonDate","closedonDate")); "preClosureAllowed", "preClosureInterestRate",
"withdrawnonDate","rejectedonDate","closedonDate"));
@POST @POST
@@ -188,29 +189,21 @@ public class DepositAccountsApiResource {
public Response SubmitDepositApplication(@PathParam("accountId") final Long accountId, public Response SubmitDepositApplication(@PathParam("accountId") final Long accountId,
@QueryParam("command") final String commandParam, final String jsonRequestBody) { @QueryParam("command") final String commandParam, final String jsonRequestBody) {
Response response=null; Response response=null;
if (is(commandParam, "approve")) { if (is(commandParam, "approve")) {
DepositStateTransitionApprovalCommand command=apiDataConversionService.convertJsonToDepositStateTransitionApprovalCommand(accountId, jsonRequestBody); DepositStateTransitionApprovalCommand command=apiDataConversionService.convertJsonToDepositStateTransitionApprovalCommand(accountId, jsonRequestBody);
EntityIdentifier identifier = this.depositAccountWritePlatformService.approveDepositApplication(command); EntityIdentifier identifier = this.depositAccountWritePlatformService.approveDepositApplication(command);
response = Response.ok().entity(identifier).build(); response = Response.ok().entity(identifier).build();
} }
else if (is(commandParam, "reject")) { else if (is(commandParam, "reject")) {
DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody); DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody);
EntityIdentifier identifier = this.depositAccountWritePlatformService.rejectDepositApplication(command); EntityIdentifier identifier = this.depositAccountWritePlatformService.rejectDepositApplication(command);
response = Response.ok().entity(identifier).build(); response = Response.ok().entity(identifier).build();
} else if (is(commandParam, "withdrewbyclient")) { } else if (is(commandParam, "withdrewbyclient")) {
DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody); DepositStateTransitionCommand command=apiDataConversionService.convertJsonToDepositStateTransitionCommand(accountId, jsonRequestBody);
EntityIdentifier identifier = this.depositAccountWritePlatformService.withdrawDepositApplication(command); EntityIdentifier identifier = this.depositAccountWritePlatformService.withdrawDepositApplication(command);
response = Response.ok().entity(identifier).build(); response = Response.ok().entity(identifier).build();
} }
UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(accountId); UndoStateTransitionCommand undoCommand = new UndoStateTransitionCommand(accountId);
@@ -62,7 +62,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
} }
@Override @Override
public ChargeCommand convertJsonToChargeCommand(Long resourceIdentifier, String json) { public ChargeCommand convertJsonToChargeCommand(final Long resourceIdentifier, final String json) {
if (StringUtils.isBlank(json)) { if (StringUtils.isBlank(json)) {
throw new InvalidJsonException(); throw new InvalidJsonException();
} }
@@ -1031,14 +1031,14 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
@Override @Override
public DepositStateTransitionApprovalCommand convertJsonToDepositStateTransitionApprovalCommand( public DepositStateTransitionApprovalCommand convertJsonToDepositStateTransitionApprovalCommand(
Long resourceIdentifier, String json) { final Long resourceIdentifier, final String json) {
if (StringUtils.isBlank(json)) { if (StringUtils.isBlank(json)) {
throw new InvalidJsonException(); throw new InvalidJsonException();
} }
Type typeOfMap = new TypeToken<Map<String, Object>>(){}.getType(); Type typeOfMap = new TypeToken<Map<String, String>>(){}.getType();
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap); Map<String, String> requestMap = gsonConverter.fromJson(json, typeOfMap);
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale","eventDate", "dateFormat", "tenureInMonths", "depositAmount", "interestCompoundedEveryPeriodType", "productId","interestCompoundedEvery")); Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale","eventDate", "dateFormat", "tenureInMonths", "depositAmount", "interestCompoundedEveryPeriodType", "productId","interestCompoundedEvery"));
@@ -6,8 +6,6 @@ import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Embedded; import javax.persistence.Embedded;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; 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" })) @Table(name = "m_deposit_account", uniqueConstraints = @UniqueConstraint(name="deposit_acc_external_id", columnNames = { "external_id" }))
public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> { public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "client_id", nullable = false) @JoinColumn(name = "client_id", nullable = false)
private Client client; private Client client;
@SuppressWarnings("unused")
@ManyToOne @ManyToOne
@JoinColumn(name = "product_id") @JoinColumn(name = "product_id")
private final DepositProduct product; private final DepositProduct product;
@@ -41,24 +41,27 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "external_id") @Column(name = "external_id")
private String externalId; private String externalId;
@SuppressWarnings("unused")
@Embedded @Embedded
private MonetaryCurrency currency; private MonetaryCurrency currency;
@Column(name = "deposit_amount", scale = 6, precision = 19, nullable = false) @Column(name = "deposit_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal depositAmount; private BigDecimal depositAmount;
@SuppressWarnings("unused")
@Column(name = "maturity_nominal_interest_rate", scale = 6, precision = 19, nullable = false) @Column(name = "maturity_nominal_interest_rate", scale = 6, precision = 19, nullable = false)
private BigDecimal interestRate; private BigDecimal interestRate;
@Column(name = "tenure_months", nullable=false) @Column(name = "tenure_months", nullable=false)
private Integer tenureInMonths; private Integer tenureInMonths;
@SuppressWarnings("unused")
@Column(name = "interest_compounded_every", nullable = false) @Column(name = "interest_compounded_every", nullable = false)
private Integer interestCompoundedEvery; private Integer interestCompoundedEvery;
@Enumerated(EnumType.ORDINAL) @SuppressWarnings("unused")
@Column(name = "interest_compounded_every_period_enum", nullable = false) @Column(name = "interest_compounded_every_period_enum", nullable = false)
private PeriodFrequencyType interestCompoundedFrequencyType; private Integer interestCompoundedFrequencyType;
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "projected_commencement_date") @Column(name = "projected_commencement_date")
@@ -68,32 +71,41 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "actual_commencement_date") @Column(name = "actual_commencement_date")
private Date actualCommencementDate; private Date actualCommencementDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "projected_maturity_date") @Column(name = "projected_maturity_date")
private Date projectedMaturityDate; private Date projectedMaturityDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "actual_maturity_date") @Column(name = "actual_maturity_date")
private Date actualMaturityDate; private Date actualMaturityDate;
@SuppressWarnings("unused")
@Column(name = "projected_interest_accrued_on_maturity", scale = 6, precision = 19, nullable = false) @Column(name = "projected_interest_accrued_on_maturity", scale = 6, precision = 19, nullable = false)
private BigDecimal projectedInterestAccruedOnMaturity; private BigDecimal projectedInterestAccruedOnMaturity;
@SuppressWarnings("unused")
@Column(name = "actual_interest_accrued", scale = 6, precision = 19, nullable = false) @Column(name = "actual_interest_accrued", scale = 6, precision = 19, nullable = false)
private BigDecimal interestAccrued; private BigDecimal interestAccrued;
@SuppressWarnings("unused")
@Column(name = "projected_total_maturity_amount", scale = 6, precision = 19, nullable = false) @Column(name = "projected_total_maturity_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal projectedTotalOnMaturity; private BigDecimal projectedTotalOnMaturity;
@SuppressWarnings("unused")
@Column(name = "actual_total_amount", scale = 6, precision = 19, nullable = false) @Column(name = "actual_total_amount", scale = 6, precision = 19, nullable = false)
private BigDecimal total; private BigDecimal total;
@SuppressWarnings("unused")
@Column(name = "pre_closure_interest_rate", scale = 6, precision = 19, nullable = false) @Column(name = "pre_closure_interest_rate", scale = 6, precision = 19, nullable = false)
private BigDecimal preClosureInterestRate; private BigDecimal preClosureInterestRate;
@SuppressWarnings("unused")
@Column(name = "is_renewal_allowed", nullable = false) @Column(name = "is_renewal_allowed", nullable = false)
private boolean renewalAllowed = false; private boolean renewalAllowed = false;
@SuppressWarnings("unused")
@Column(name = "is_preclosure_allowed", nullable = false) @Column(name = "is_preclosure_allowed", nullable = false)
private boolean preClosureAllowed = false; private boolean preClosureAllowed = false;
@@ -103,14 +115,17 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@Column(name = "status_enum", nullable = false) @Column(name = "status_enum", nullable = false)
private Integer depositStatus; private Integer depositStatus;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "closedon_date") @Column(name = "closedon_date")
private Date closedOnDate; private Date closedOnDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "rejectedon_date") @Column(name = "rejectedon_date")
private Date rejectedOnDate; private Date rejectedOnDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "withdrawnon_date") @Column(name = "withdrawnon_date")
private Date withdrawnOnDate; private Date withdrawnOnDate;
@@ -167,7 +182,7 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
this.tenureInMonths = termInMonths; this.tenureInMonths = termInMonths;
this.interestCompoundedEvery = interestCompoundedEvery; this.interestCompoundedEvery = interestCompoundedEvery;
this.interestCompoundedFrequencyType = interestCompoundedFrequencyPeriodType; this.interestCompoundedFrequencyType = interestCompoundedFrequencyPeriodType.getValue();
if (commencementDate != null) { if (commencementDate != null) {
this.projectedCommencementDate = commencementDate.toDate(); this.projectedCommencementDate = commencementDate.toDate();
this.projectedMaturityDate = commencementDate.plusMonths(this.tenureInMonths).toDate(); this.projectedMaturityDate = commencementDate.plusMonths(this.tenureInMonths).toDate();
@@ -202,14 +217,18 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
} }
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)); DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_APPROVED, DepositStatus.fromInt(this.depositStatus));
this.depositStatus = statusEnum.getValue(); this.depositStatus = statusEnum.getValue();
this.tenureInMonths = depositApprovalData.getTenureInMonths(); this.tenureInMonths = depositApprovalData.getTenureInMonths();
this.depositAmount = depositAmount; this.depositAmount = depositAmount;
this.interestCompoundedFrequencyType = depositApprovalData.getInterestCompoundedEveryPeriodType(); this.interestCompoundedFrequencyType = depositApprovalData.getInterestCompoundedEveryPeriodType().getValue();
this.actualCommencementDate = actualCommencementDate.toDateTimeAtCurrentTime().toDate(); this.actualCommencementDate = actualCommencementDate.toDateTimeAtCurrentTime().toDate();
@@ -252,9 +271,12 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
return date; return date;
} }
public void reject(LocalDate rejectedOn, DepositLifecycleStateMachine depositLifecycleStateMachine) { public void reject(final LocalDate rejectedOn,
final DepositLifecycleStateMachine depositLifecycleStateMachine) {
DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_REJECTED, DepositStatus.fromInt(this.depositStatus)); DepositStatus statusEnum = depositLifecycleStateMachine.transition(
DepositEvent.DEPOSIT_REJECTED,
DepositStatus.fromInt(this.depositStatus));
this.depositStatus = statusEnum.getValue(); this.depositStatus = statusEnum.getValue();
this.rejectedOnDate = rejectedOn.toDateTimeAtCurrentTime().toDate(); this.rejectedOnDate = rejectedOn.toDateTimeAtCurrentTime().toDate();
@@ -262,22 +284,29 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
if (rejectedOn.isBefore(getProjectedCommencementDate())) { if (rejectedOn.isBefore(getProjectedCommencementDate())) {
final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: " + getProjectedCommencementDate().toString(); final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: "
throw new InvalidDepositStateTransitionException("reject", "cannot.be.before.submittal.date", errorMessage, rejectedOn, getProjectedCommencementDate()); + getProjectedCommencementDate().toString();
throw new InvalidDepositStateTransitionException("reject",
"cannot.be.before.submittal.date", errorMessage,
rejectedOn, getProjectedCommencementDate());
} }
if (rejectedOn.isAfter(new LocalDate())) { if (rejectedOn.isAfter(new LocalDate())) {
final String errorMessage = "The date on which a deposit is rejected cannot be in the future."; 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); throw new InvalidDepositStateTransitionException("reject",
"cannot.be.a.future.date", errorMessage, rejectedOn);
} }
} }
public void withdraw(LocalDate withdrawnOn, DepositLifecycleStateMachine depositLifecycleStateMachine) { public void withdrawnByApplicant(final LocalDate withdrawnOn,
final DepositLifecycleStateMachine depositLifecycleStateMachine) {
DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_WITHDRAWN, DepositStatus.fromInt(this.depositStatus)); DepositStatus statusEnum = depositLifecycleStateMachine.transition(
DepositEvent.DEPOSIT_WITHDRAWN,
DepositStatus.fromInt(this.depositStatus));
this.depositStatus = statusEnum.getValue(); this.depositStatus = statusEnum.getValue();
this.withdrawnOnDate = withdrawnOn.toDateTimeAtCurrentTime().toDate(); this.withdrawnOnDate = withdrawnOn.toDateTimeAtCurrentTime().toDate();
@@ -285,26 +314,29 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
if (withdrawnOn.isBefore(getProjectedCommencementDate())) { if (withdrawnOn.isBefore(getProjectedCommencementDate())) {
final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: " + getProjectedCommencementDate().toString(); final String errorMessage = "The date on which a deposit is rejected cannot be before its submittal date: "
throw new InvalidDepositStateTransitionException("reject", "cannot.be.before.submittal.date", errorMessage, withdrawnOn, getProjectedCommencementDate()); + getProjectedCommencementDate().toString();
throw new InvalidDepositStateTransitionException("reject",
"cannot.be.before.submittal.date", errorMessage,
withdrawnOn, getProjectedCommencementDate());
} }
if (withdrawnOn.isAfter(new LocalDate())) { if (withdrawnOn.isAfter(new LocalDate())) {
final String errorMessage = "The date on which a deposit is rejected cannot be in the future."; 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); throw new InvalidDepositStateTransitionException("reject",
"cannot.be.a.future.date", errorMessage, withdrawnOn);
}
} }
} public void undoDepositApproval(final DepositLifecycleStateMachine depositLifecycleStateMachine) {
public void undoDepositApproval(DepositLifecycleStateMachine depositLifecycleStateMachine) { DepositStatus statusEnum = depositLifecycleStateMachine.transition(
DepositEvent.DEPOSIT_APPROVAL_UNDO,
DepositStatus statusEnum = depositLifecycleStateMachine.transition(DepositEvent.DEPOSIT_APPROVAL_UNDO, DepositStatus.fromInt(this.depositStatus)); DepositStatus.fromInt(this.depositStatus));
this.depositStatus = statusEnum.getValue(); this.depositStatus = statusEnum.getValue();
this.actualCommencementDate = null; this.actualCommencementDate = null;
this.actualMaturityDate = null; this.actualMaturityDate = null;
} }
} }
@@ -14,8 +14,13 @@ public class DepositApprovalData {
private final PeriodFrequencyType interestCompoundedEveryPeriodType; private final PeriodFrequencyType interestCompoundedEveryPeriodType;
private final FixedTermDepositInterestCalculator fixedTermDepositInterestCalculator; private final FixedTermDepositInterestCalculator fixedTermDepositInterestCalculator;
public DepositApprovalData(
public DepositApprovalData(final Integer tenureInMonths,final Money deposit,final BigDecimal maturityInterestRate,final Integer interestCompoundedEvery,final PeriodFrequencyType interestCompoundedEveryPeriodType,final FixedTermDepositInterestCalculator fixedTermDepositInterestCalculator) { final Integer tenureInMonths,
final Money deposit,
final BigDecimal maturityInterestRate,
final Integer interestCompoundedEvery,
final PeriodFrequencyType interestCompoundedEveryPeriodType,
final FixedTermDepositInterestCalculator fixedTermDepositInterestCalculator) {
this.tenureInMonths = tenureInMonths; this.tenureInMonths = tenureInMonths;
this.deposit = deposit; this.deposit = deposit;
this.maturityInterestRate = maturityInterestRate; this.maturityInterestRate = maturityInterestRate;
@@ -24,24 +29,27 @@ public class DepositApprovalData {
this.fixedTermDepositInterestCalculator = fixedTermDepositInterestCalculator; this.fixedTermDepositInterestCalculator = fixedTermDepositInterestCalculator;
} }
public Integer getTenureInMonths() { public Integer getTenureInMonths() {
return tenureInMonths; return tenureInMonths;
} }
public Money getDeposit() { public Money getDeposit() {
return deposit; return deposit;
} }
public BigDecimal getMaturityInterestRate() { public BigDecimal getMaturityInterestRate() {
return maturityInterestRate; return maturityInterestRate;
} }
public Integer getInterestCompoundedEvery() { public Integer getInterestCompoundedEvery() {
return interestCompoundedEvery; return interestCompoundedEvery;
} }
public PeriodFrequencyType getInterestCompoundedEveryPeriodType() { public PeriodFrequencyType getInterestCompoundedEveryPeriodType() {
return interestCompoundedEveryPeriodType; return interestCompoundedEveryPeriodType;
} }
public FixedTermDepositInterestCalculator getFixedTermDepositInterestCalculator() { public FixedTermDepositInterestCalculator getFixedTermDepositInterestCalculator() {
return fixedTermDepositInterestCalculator; return fixedTermDepositInterestCalculator;
} }
} }
@@ -4,7 +4,6 @@ import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.joda.time.LocalDate;
import org.mifosng.platform.api.commands.DepositAccountCommand; import org.mifosng.platform.api.commands.DepositAccountCommand;
import org.mifosng.platform.api.commands.DepositStateTransitionApprovalCommand; import org.mifosng.platform.api.commands.DepositStateTransitionApprovalCommand;
import org.mifosng.platform.client.domain.Client; 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.currency.domain.Money;
import org.mifosng.platform.exceptions.ClientNotFoundException; import org.mifosng.platform.exceptions.ClientNotFoundException;
import org.mifosng.platform.exceptions.DepositProductNotFoundException; import org.mifosng.platform.exceptions.DepositProductNotFoundException;
import org.mifosng.platform.exceptions.NoAuthorizationException;
import org.mifosng.platform.loan.domain.PeriodFrequencyType; import org.mifosng.platform.loan.domain.PeriodFrequencyType;
import org.mifosng.platform.saving.domain.DepositAccount; import org.mifosng.platform.saving.domain.DepositAccount;
import org.mifosng.platform.saving.domain.DepositApprovalData; import org.mifosng.platform.saving.domain.DepositApprovalData;
@@ -129,7 +129,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
@Transactional @Transactional
@Override @Override
public EntityIdentifier approveDepositApplication(DepositStateTransitionApprovalCommand command) { public EntityIdentifier approveDepositApplication(final DepositStateTransitionApprovalCommand command) {
AppUser currentUser = context.authenticatedUser(); AppUser currentUser = context.authenticatedUser();
@@ -144,6 +144,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo
DepositApprovalData depositApprovalData=this.depositAccountAssembler.assembleFrom(command); 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(); LocalDate eventDate = command.getEventDate();
if (this.isBeforeToday(eventDate) && currentUser.canNotApproveLoanInPast()) { if (this.isBeforeToday(eventDate) && currentUser.canNotApproveLoanInPast()) {
throw new NoAuthorizationException("User has no authority to approve deposit with a date in the past."); throw new NoAuthorizationException("User has no authority to approve deposit with a date in the past.");
@@ -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."); 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()); return new EntityIdentifier(account.getId());
} }