Search in sources :

Example 1 with OBWriteDomesticResponse5Data

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

the class DomesticPaymentsApiController method responseEntity.

private OBWriteDomesticResponse5 responseEntity(FRDomesticPaymentSubmission frPaymentSubmission, FRDomesticConsent frDomesticConsent) {
    FRReadRefundAccount readRefundAccount = frDomesticConsent.getDomesticConsent().getData().getReadRefundAccount();
    FRWriteDomesticDataInitiation initiation = frPaymentSubmission.getDomesticPayment().getData().getInitiation();
    Optional<FRDomesticResponseDataRefund> refund = frDomesticResponseDataRefund(readRefundAccount, initiation);
    return new OBWriteDomesticResponse5().data(new OBWriteDomesticResponse5Data().domesticPaymentId(frPaymentSubmission.getId()).initiation(toOBWriteDomestic2DataInitiation(frDomesticConsent.getDomesticConsent().getData().getInitiation())).creationDateTime(frDomesticConsent.getCreated()).statusUpdateDateTime(frDomesticConsent.getStatusUpdate()).status(toOBWriteDomesticResponse5DataStatus(frDomesticConsent.getStatus())).consentId(frDomesticConsent.getId()).debtor(toOBCashAccountDebtor4(frDomesticConsent.getDomesticConsent().getData().getInitiation().getDebtorAccount())).refund(refund.map(FRResponseDataRefundConverter::toOBWriteDomesticResponse5DataRefund).orElse(null))).links(resourceLinkService.toSelfLink(frPaymentSubmission, discovery -> getVersion(discovery).getGetDomesticPayment())).meta(new Meta());
}
Also used : Meta(uk.org.openbanking.datamodel.account.Meta) FRWriteDomesticDataInitiation(com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticDataInitiation) OBWriteDomesticResponse5(uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse5) OBWriteDomesticResponse5Data(uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse5Data) FRReadRefundAccount(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRReadRefundAccount) FRDomesticResponseDataRefund(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRDomesticResponseDataRefund)

Aggregations

FRWriteDomesticDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticDataInitiation)1 FRDomesticResponseDataRefund (com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRDomesticResponseDataRefund)1 FRReadRefundAccount (com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRReadRefundAccount)1 Meta (uk.org.openbanking.datamodel.account.Meta)1 OBWriteDomesticResponse5 (uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse5)1 OBWriteDomesticResponse5Data (uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse5Data)1