Search in sources :

Example 1 with OBWriteInternationalResponse5Data

use of uk.org.openbanking.datamodel.payment.OBWriteInternationalResponse5Data in project openbanking-aspsp by OpenBankingToolkit.

the class InternationalPaymentsApiController method responseEntity.

private OBWriteInternationalResponse5 responseEntity(FRInternationalPaymentSubmission frPaymentSubmission, FRInternationalConsent frInternationalConsent) {
    FRReadRefundAccount readRefundAccount = frInternationalConsent.getInternationalConsent().getData().getReadRefundAccount();
    FRWriteInternationalDataInitiation initiation = frPaymentSubmission.getInternationalPayment().getData().getInitiation();
    Optional<FRInternationalResponseDataRefund> refund = frInternationalResponseDataRefund(readRefundAccount, initiation);
    return new OBWriteInternationalResponse5().data(new OBWriteInternationalResponse5Data().internationalPaymentId(frPaymentSubmission.getId()).initiation(toOBWriteInternational3DataInitiation(frPaymentSubmission.getInternationalPayment().getData().getInitiation())).creationDateTime(frInternationalConsent.getCreated()).statusUpdateDateTime(frInternationalConsent.getStatusUpdate()).status(toOBWriteInternationalResponse5DataStatus(frInternationalConsent.getStatus())).consentId(frInternationalConsent.getId()).debtor(toOBCashAccountDebtor4(frInternationalConsent.getInitiation().getDebtorAccount())).exchangeRateInformation(toOBWriteInternationalConsentResponse6DataExchangeRateInformation(frInternationalConsent.getCalculatedExchangeRate())).refund(refund.map(FRResponseDataRefundConverter::toOBWriteInternationalResponse5DataRefund).orElse(null))).links(resourceLinkService.toSelfLink(frPaymentSubmission, discovery -> getVersion(discovery).getGetInternationalPayment())).meta(new Meta());
}
Also used : Meta(uk.org.openbanking.datamodel.account.Meta) OBWriteInternationalResponse5(uk.org.openbanking.datamodel.payment.OBWriteInternationalResponse5) FRReadRefundAccount(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRReadRefundAccount) FRInternationalResponseDataRefund(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRInternationalResponseDataRefund) FRWriteInternationalDataInitiation(com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalDataInitiation) OBWriteInternationalResponse5Data(uk.org.openbanking.datamodel.payment.OBWriteInternationalResponse5Data)

Aggregations

FRWriteInternationalDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalDataInitiation)1 FRInternationalResponseDataRefund (com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRInternationalResponseDataRefund)1 FRReadRefundAccount (com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRReadRefundAccount)1 Meta (uk.org.openbanking.datamodel.account.Meta)1 OBWriteInternationalResponse5 (uk.org.openbanking.datamodel.payment.OBWriteInternationalResponse5)1 OBWriteInternationalResponse5Data (uk.org.openbanking.datamodel.payment.OBWriteInternationalResponse5Data)1