Search in sources :

Example 1 with FRTransactionData

use of com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData in project openbanking-aspsp by OpenBankingToolkit.

the class AcceptDueScheduledPaymentTask method createTransaction.

private FRTransaction createTransaction(Account account, FRScheduledPayment 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.getScheduledPayment().getReference() != null) {
        transactionData.setTransactionReference(payment.getScheduledPayment().getReference());
    }
    FRTransaction transaction = FRTransaction.builder().id(transactionId).bookingDateTime(bookingDate).accountId(account.getId()).transaction(transactionData).build();
    log.info("Transaction created {}", transaction);
    return transaction;
}
Also used : FRTransactionData(com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData) FRTransaction(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRTransaction) DateTime(org.joda.time.DateTime)

Example 2 with FRTransactionData

use of com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData in project openbanking-aspsp by OpenBankingToolkit.

the class AcceptFilePaymentTask method createTransaction.

private FRTransaction createTransaction(Account account, FRFilePayment 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();
    transactionData.setTransactionReference(payment.getRemittanceReference());
    transactionData.setTransactionInformation(payment.getRemittanceUnstructured());
    FRTransaction transaction = FRTransaction.builder().id(transactionId).bookingDateTime(bookingDate).accountId(account.getId()).transaction(transactionData).build();
    log.info("Transaction created {}", transaction);
    return transaction;
}
Also used : FRTransactionData(com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData) FRTransaction(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRTransaction) DateTime(org.joda.time.DateTime)

Example 3 with FRTransactionData

use of com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData in project openbanking-aspsp by OpenBankingToolkit.

the class AcceptSinglePaymentTask method createTransaction.

private FRTransaction createTransaction(Account account, FRPaymentSetup paymentSetup, FRCreditDebitIndicator creditDebitCode, Balance balance, FRAmount amount) {
    log.info("Create transaction");
    String transactionId = UUID.randomUUID().toString();
    DateTime bookingDate = new DateTime(paymentSetup.getCreated());
    FRTransactionData transactionData = FRTransactionData.builder().accountId(account.getId()).transactionId(transactionId).amount(amount).creditDebitIndicator(creditDebitCode).status(FRTransactionData.FREntryStatus.BOOKED).bookingDateTime(bookingDate).valueDateTime(DateTime.now()).balance(FRTransactionData.FRTransactionCashBalance.builder().amount(balance.getCurrencyAndAmount()).creditDebitIndicator(balance.getCreditDebitIndicator()).type(FRBalanceType.INTERIMBOOKED).build()).build();
    if (paymentSetup.getInitiation().getRemittanceInformation() != null) {
        transactionData.setTransactionReference(paymentSetup.getInitiation().getRemittanceInformation().getReference());
        transactionData.setTransactionInformation(paymentSetup.getInitiation().getRemittanceInformation().getUnstructured());
    }
    FRTransaction transaction = FRTransaction.builder().id(transactionId).bookingDateTime(bookingDate).accountId(account.getId()).transaction(transactionData).statementIds(// Need a mutable list to be set here so don't use Lombok.singular to init list
    new ArrayList<>()).build();
    log.info("Transaction created {}", transaction);
    return transaction;
}
Also used : FRTransactionData(com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData) FRTransaction(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRTransaction) ArrayList(java.util.ArrayList) DateTime(org.joda.time.DateTime)

Example 4 with FRTransactionData

use of com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData in project openbanking-aspsp by OpenBankingToolkit.

the class AcceptDomesticPaymentTask method createTransaction.

private FRTransaction createTransaction(Account account, FRDomesticConsent payment, FRCreditDebitIndicator creditDebitIndicator, 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(creditDebitIndicator).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;
}
Also used : FRTransactionData(com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData) FRTransaction(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRTransaction) DateTime(org.joda.time.DateTime)

Example 5 with FRTransactionData

use of com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData in project openbanking-aspsp by OpenBankingToolkit.

the class AcceptDueStandingOrderTask method createTransaction.

private FRTransaction createTransaction(Account account, FRStandingOrder payment, FRCreditDebitIndicator creditDebitCode, Balance balance, FRAmount amount) {
    log.debug("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.getStandingOrder().getReference() != null) {
        transactionData.setTransactionReference(payment.getStandingOrder().getReference());
    }
    FRTransaction transaction = FRTransaction.builder().id(transactionId).bookingDateTime(bookingDate).accountId(account.getId()).transaction(transactionData).build();
    log.info("Transaction created {}", transaction);
    return transaction;
}
Also used : FRTransactionData(com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData) FRTransaction(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRTransaction) DateTime(org.joda.time.DateTime)

Aggregations

FRTransactionData (com.forgerock.openbanking.common.model.openbanking.domain.account.FRTransactionData)6 FRTransaction (com.forgerock.openbanking.common.model.openbanking.persistence.account.FRTransaction)6 DateTime (org.joda.time.DateTime)6 ArrayList (java.util.ArrayList)1