use of com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData in project openbanking-aspsp by OpenBankingToolkit.
the class AcceptInternationalPaymentTask method createTransaction.
private FRTransaction createTransaction(Account account, FRInternationalConsent payment, FRCreditDebitIndicator creditDebitCode, Balance balance, FRAmount amount) {
log.info("Create transaction");
String transactionId = UUID.randomUUID().toString();
DateTime bookingDate = new DateTime(payment.getCreated());
FRTransactionData transactionData = FRTransactionData.builder().transactionId(transactionId).status(FRTransactionData.FREntryStatus.BOOKED).valueDateTime(DateTime.now()).accountId(account.getId()).amount(amount).creditDebitIndicator(creditDebitCode).bookingDateTime(bookingDate).statementReferences(new ArrayList<>()).balance(FRTransactionData.FRTransactionCashBalance.builder().amount(balance.getCurrencyAndAmount()).creditDebitIndicator(balance.getCreditDebitIndicator()).type(FRBalanceType.INTERIMBOOKED).build()).build();
if (payment.getInitiation().getRemittanceInformation() != null) {
transactionData.setTransactionReference(payment.getInitiation().getRemittanceInformation().getReference());
transactionData.setTransactionInformation(payment.getInitiation().getRemittanceInformation().getUnstructured());
}
FRTransaction transaction = FRTransaction.builder().id(transactionId).bookingDateTime(bookingDate).accountId(account.getId()).transaction(transactionData).build();
log.info("Transaction created {}", transaction);
return transaction;
}
Aggregations