use of org.estatio.module.capex.dom.invoice.IncomingInvoice 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;
}
}
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class IncomingInvoiceApprovalStateSubscriber method on.
@Programmatic
@com.google.common.eventbus.Subscribe
@org.axonframework.eventhandling.annotation.EventHandler
public void on(IncomingInvoice.ObjectPersistedEvent ev) {
// nb: note that the incoming invoice at this stage has no items attached to it,
// so there is a limit as to what we can safely do.
// however, it *is* ok to just create the state chart for the invoice.
final IncomingInvoice incomingInvoice = ev.getSource();
IncomingInvoiceApprovalState approvalState = incomingInvoice.getApprovalState();
if (approvalState == IncomingInvoiceApprovalStateTransitionType.INSTANTIATE.getToState()) {
// ie was set in the persisting callback
stateTransitionService.trigger(incomingInvoice, IncomingInvoiceApprovalStateTransitionType.INSTANTIATE, null, null);
}
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice 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;
}
}
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class IncomingInvoice_approveAsCountryDirector method act.
@Action(domainEvent = ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(cssClassFa = "fa-thumbs-up")
public Object act(@Nullable final String comment, final boolean goToNext) {
final IncomingInvoice next = nextAfterPendingIfRequested(goToNext);
trigger(comment, null);
return objectToReturn(next);
}
use of org.estatio.module.capex.dom.invoice.IncomingInvoice in project estatio by estatio.
the class IncomingInvoice_checkPayment method act.
@Action(domainEvent = ActionDomainEvent.class, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout(cssClassFa = "fa-thumbs-o-up")
public Object act(@Nullable final String comment, final boolean goToNext) {
final IncomingInvoice next = nextAfterPendingIfRequested(goToNext);
trigger(comment, null);
return objectToReturn(next);
}
Aggregations