use of org.estatio.module.capex.dom.invoice.approval.IncomingInvoiceApprovalStateTransitionType in project estatio by estatio.
the class BankAccountVerificationStateSubscriber method toCheckIbanProof.
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void toCheckIbanProof(final IncomingInvoiceApprovalStateTransitionType.TransitionEvent ev) {
final StateTransitionEvent.Phase phase = ev.getPhase();
if (phase == StateTransitionEvent.Phase.TRANSITIONED) {
final IncomingInvoiceApprovalStateTransitionType transitionType = ev.getTransitionType();
final IncomingInvoice incomingInvoice = ev.getDomainObject();
switch(transitionType) {
// do so as early as possible so that verification can run in parallel with approval
case COMPLETE:
case // belt-n-braces, do late as well
CHECK_BANK_ACCOUNT:
if (bankAccountVerificationChecker.isBankAccountVerifiedFor(incomingInvoice) || Arrays.asList(PaymentMethod.MANUAL_PROCESS, PaymentMethod.CREDIT_CARD, PaymentMethod.REFUND_BY_SUPPLIER).contains(incomingInvoice.getPaymentMethod())) {
return;
}
triggerBankVerificationState(incomingInvoice);
attachDocumentAsPossibleIbanProofIfNone(incomingInvoice);
break;
default:
break;
}
}
}
Aggregations