Search in sources :

Example 1 with OBWriteDomesticStandingOrderResponse6Data

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

the class DomesticStandingOrdersApiController method responseEntity.

private OBWriteDomesticStandingOrderResponse6 responseEntity(FRDomesticStandingOrderPaymentSubmission frPaymentSubmission, FRDomesticStandingOrderConsent frDomesticStandingOrderConsent) {
    FRReadRefundAccount readRefundAccount = frDomesticStandingOrderConsent.getDomesticStandingOrderConsent().getData().getReadRefundAccount();
    FRWriteDomesticStandingOrderDataInitiation initiation = frPaymentSubmission.getDomesticStandingOrder().getData().getInitiation();
    Optional<FRDomesticResponseDataRefund> refund = frDomesticResponseDataRefund(readRefundAccount, initiation);
    return new OBWriteDomesticStandingOrderResponse6().data(new OBWriteDomesticStandingOrderResponse6Data().domesticStandingOrderId(frPaymentSubmission.getId()).initiation(toOBWriteDomesticStandingOrderConsentResponse6DataInitiation(initiation)).creationDateTime(frDomesticStandingOrderConsent.getCreated()).statusUpdateDateTime(frDomesticStandingOrderConsent.getStatusUpdate()).status(toOBWriteDomesticStandingOrderResponse6DataStatus(frDomesticStandingOrderConsent.getStatus())).debtor(toOBCashAccountDebtor4(frDomesticStandingOrderConsent.getInitiation().getDebtorAccount())).consentId(frDomesticStandingOrderConsent.getId()).refund(refund.map(FRResponseDataRefundConverter::toOBWriteDomesticResponse5DataRefund).orElse(null))).links(resourceLinkService.toSelfLink(frPaymentSubmission, discovery -> getVersion(discovery).getGetDomesticStandingOrder())).meta(new Meta());
}
Also used : Meta(uk.org.openbanking.datamodel.account.Meta) FRWriteDomesticStandingOrderDataInitiation(com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticStandingOrderDataInitiation) FRReadRefundAccount(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRReadRefundAccount) FRDomesticResponseDataRefund(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRDomesticResponseDataRefund) OBWriteDomesticStandingOrderResponse6Data(uk.org.openbanking.datamodel.payment.OBWriteDomesticStandingOrderResponse6Data) OBWriteDomesticStandingOrderResponse6(uk.org.openbanking.datamodel.payment.OBWriteDomesticStandingOrderResponse6)

Aggregations

FRWriteDomesticStandingOrderDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticStandingOrderDataInitiation)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 OBWriteDomesticStandingOrderResponse6 (uk.org.openbanking.datamodel.payment.OBWriteDomesticStandingOrderResponse6)1 OBWriteDomesticStandingOrderResponse6Data (uk.org.openbanking.datamodel.payment.OBWriteDomesticStandingOrderResponse6Data)1