use of uk.org.openbanking.datamodel.payment.OBWriteDomesticScheduledResponse5Data in project openbanking-aspsp by OpenBankingToolkit.
the class DomesticScheduledPaymentsApiController method responseEntity.
private OBWriteDomesticScheduledResponse5 responseEntity(FRDomesticScheduledPaymentSubmission frPaymentSubmission, FRDomesticScheduledConsent frDomesticScheduledConsent) {
FRReadRefundAccount readRefundAccount = frDomesticScheduledConsent.getDomesticScheduledConsent().getData().getReadRefundAccount();
FRWriteDomesticScheduledDataInitiation initiation = frPaymentSubmission.getDomesticScheduledPayment().getData().getInitiation();
Optional<FRDomesticResponseDataRefund> refund = frDomesticResponseDataRefund(readRefundAccount, initiation);
return new OBWriteDomesticScheduledResponse5().data(new OBWriteDomesticScheduledResponse5Data().domesticScheduledPaymentId(frPaymentSubmission.getId()).initiation(toOBWriteDomesticScheduled2DataInitiation(frDomesticScheduledConsent.getInitiation())).creationDateTime(frDomesticScheduledConsent.getCreated()).statusUpdateDateTime(frDomesticScheduledConsent.getStatusUpdate()).status(toOBWriteDomesticScheduledResponse5DataStatus(frDomesticScheduledConsent.getStatus())).debtor(toOBCashAccountDebtor4(frDomesticScheduledConsent.getInitiation().getDebtorAccount())).consentId(frDomesticScheduledConsent.getId()).refund(refund.map(FRResponseDataRefundConverter::toOBWriteDomesticResponse5DataRefund).orElse(null))).links(resourceLinkService.toSelfLink(frPaymentSubmission, discovery -> getVersion(discovery).getGetDomesticScheduledPayment())).meta(new Meta());
}
Aggregations