Search in sources :

Example 1 with BankAccountVerificationStateTransitionType

use of org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransitionType in project estatio by estatio.

the class IncomingInvoiceApprovalStateSubscriber method on.

@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(BankAccountVerificationStateTransitionType.TransitionEvent ev) {
    final StateTransitionEvent.Phase phase = ev.getPhase();
    if (phase == StateTransitionEvent.Phase.TRANSITIONED) {
        final BankAccountVerificationStateTransitionType transitionType = ev.getTransitionType();
        final BankAccount bankAccount = ev.getDomainObject();
        switch(transitionType) {
            case INSTANTIATE:
                break;
            case VERIFY_BANK_ACCOUNT:
                final List<IncomingInvoice> incomingInvoices = findIncomingInvoicesUsing(bankAccount);
                for (IncomingInvoice incomingInvoice : incomingInvoices) {
                    stateTransitionService.trigger(incomingInvoice, CONFIRM_BANK_ACCOUNT_VERIFIED, null, null);
                }
                break;
            case REJECT_PROOF:
                break;
            case PROOF_UPDATED:
                break;
            case RESET:
                break;
        }
    }
}
Also used : IncomingInvoice(org.estatio.module.capex.dom.invoice.IncomingInvoice) BankAccountVerificationStateTransitionType(org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransitionType) BankAccount(org.estatio.module.financial.dom.BankAccount) StateTransitionEvent(org.estatio.module.capex.dom.state.StateTransitionEvent) Programmatic(org.apache.isis.applib.annotation.Programmatic)

Aggregations

Programmatic (org.apache.isis.applib.annotation.Programmatic)1 BankAccountVerificationStateTransitionType (org.estatio.module.capex.dom.bankaccount.verification.BankAccountVerificationStateTransitionType)1 IncomingInvoice (org.estatio.module.capex.dom.invoice.IncomingInvoice)1 StateTransitionEvent (org.estatio.module.capex.dom.state.StateTransitionEvent)1 BankAccount (org.estatio.module.financial.dom.BankAccount)1