@EventHandlerMethod public void updateCreditTransactionState(DispatchedEvent<CreditRecordedEvent> de) { String transactionId = de.getEntityId(); String fromAccountId = de.getEvent().getDetails().getFromAccountId(); String toAccountId = de.getEvent().getDetails().getToAccountId(); accountInfoUpdateService.updateTransactionStatus( fromAccountId, transactionId, TransferState.COMPLETED); accountInfoUpdateService.updateTransactionStatus( toAccountId, transactionId, TransferState.COMPLETED); }
@EventHandlerMethod public void recordFailed(DispatchedEvent<FailedDebitRecordedEvent> de) { String transactionId = de.getEntityId(); String fromAccountId = de.getEvent().getDetails().getFromAccountId(); String toAccountId = de.getEvent().getDetails().getToAccountId(); accountInfoUpdateService.updateTransactionStatus( fromAccountId, transactionId, TransferState.FAILED_DUE_TO_INSUFFICIENT_FUNDS); accountInfoUpdateService.updateTransactionStatus( toAccountId, transactionId, TransferState.FAILED_DUE_TO_INSUFFICIENT_FUNDS); }