Search in sources :

Example 1 with Meta

use of uk.org.openbanking.datamodel.account.Meta in project openbanking-aspsp by OpenBankingToolkit.

the class InternationalScheduledPaymentConsentsApiController method getInternationalScheduledPaymentConsentsConsentIdFundsConfirmation.

@Override
public ResponseEntity getInternationalScheduledPaymentConsentsConsentIdFundsConfirmation(String consentId, String authorization, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, String httpUrl, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
    Optional<FRInternationalScheduledConsent> isScheduledConsent = internationalScheduledConsentRepository.findById(consentId);
    if (!isScheduledConsent.isPresent()) {
        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("International scheduled consent '" + consentId + "' can't be found");
    }
    FRInternationalScheduledConsent internationalScheduledConsent = isScheduledConsent.get();
    // Check if funds are available on the account selected in consent
    boolean areFundsAvailable = fundsAvailabilityService.isFundsAvailable(internationalScheduledConsent.getAccountId(), internationalScheduledConsent.getInitiation().getInstructedAmount().getAmount());
    return ResponseEntity.status(HttpStatus.OK).body(new OBWriteFundsConfirmationResponse1().data(new OBWriteFundsConfirmationResponse1Data().fundsAvailableResult(new OBWriteFundsConfirmationResponse1DataFundsAvailableResult().fundsAvailable(areFundsAvailable).fundsAvailableDateTime(DateTime.now()))).links(PaginationUtil.generateLinksOnePager(httpUrl)).meta(new Meta()));
}
Also used : Meta(uk.org.openbanking.datamodel.account.Meta) FRInternationalScheduledConsent(com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalScheduledConsent)

Example 2 with Meta

use of uk.org.openbanking.datamodel.account.Meta in project openbanking-aspsp by OpenBankingToolkit.

the class InternationalScheduledPaymentConsentsApiController method getInternationalScheduledPaymentConsentsConsentIdFundsConfirmation.

public ResponseEntity getInternationalScheduledPaymentConsentsConsentIdFundsConfirmation(String consentId, String authorization, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, String httpUrl, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
    Optional<FRInternationalScheduledConsent> isScheduledConsent = internationalScheduledConsentRepository.findById(consentId);
    if (!isScheduledConsent.isPresent()) {
        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("International scheduled consent '" + consentId + "' can't be found");
    }
    FRInternationalScheduledConsent internationalScheduledConsent = isScheduledConsent.get();
    // Check if funds are available on the account selected in consent
    boolean areFundsAvailable = fundsAvailabilityService.isFundsAvailable(internationalScheduledConsent.getAccountId(), internationalScheduledConsent.getInitiation().getInstructedAmount().getAmount());
    return ResponseEntity.status(HttpStatus.OK).body(new OBWriteFundsConfirmationResponse1().data(new OBWriteFundsConfirmationResponse1Data().fundsAvailableResult(new OBWriteFundsConfirmationResponse1DataFundsAvailableResult().fundsAvailable(areFundsAvailable).fundsAvailableDateTime(DateTime.now()))).links(PaginationUtil.generateLinksOnePager(httpUrl)).meta(new Meta()));
}
Also used : Meta(uk.org.openbanking.datamodel.account.Meta) FRInternationalScheduledConsent(com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalScheduledConsent)

Example 3 with Meta

use of uk.org.openbanking.datamodel.account.Meta in project openbanking-aspsp by OpenBankingToolkit.

the class DomesticScheduledPaymentsApiController method responseEntity.

private OBWriteDomesticScheduledResponse4 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 OBWriteDomesticScheduledResponse4().data(new OBWriteDomesticScheduledResponse4Data().domesticScheduledPaymentId(frPaymentSubmission.getId()).initiation(toOBWriteDomesticScheduled2DataInitiation(frDomesticScheduledConsent.getInitiation())).creationDateTime(frDomesticScheduledConsent.getCreated()).statusUpdateDateTime(frDomesticScheduledConsent.getStatusUpdate()).status(toOBWriteDomesticScheduledResponse4DataStatus(frDomesticScheduledConsent.getStatus())).consentId(frDomesticScheduledConsent.getId()).refund(refund.map(FRResponseDataRefundConverter::toOBWriteDomesticResponse4DataRefund).orElse(null))).links(resourceLinkService.toSelfLink(frPaymentSubmission, discovery -> getVersion(discovery).getGetDomesticScheduledPayment())).meta(new Meta());
}
Also used : OBWriteDomesticScheduledResponse4Data(uk.org.openbanking.datamodel.payment.OBWriteDomesticScheduledResponse4Data) Meta(uk.org.openbanking.datamodel.account.Meta) FRWriteDomesticScheduledDataInitiation(com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticScheduledDataInitiation) FRReadRefundAccount(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRReadRefundAccount) OBWriteDomesticScheduledResponse4(uk.org.openbanking.datamodel.payment.OBWriteDomesticScheduledResponse4) FRDomesticResponseDataRefund(com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRDomesticResponseDataRefund)

Example 4 with Meta

use of uk.org.openbanking.datamodel.account.Meta in project openbanking-aspsp by OpenBankingToolkit.

the class InternationalPaymentConsentsApiController method getInternationalPaymentConsentsConsentIdFundsConfirmation.

public ResponseEntity getInternationalPaymentConsentsConsentIdFundsConfirmation(String consentId, String authorization, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, String httpUrl, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
    Optional<FRInternationalConsent> isInternationalConsent = internationalConsentRepository.findById(consentId);
    if (!isInternationalConsent.isPresent()) {
        return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("International consent '" + consentId + "' can't be found");
    }
    FRInternationalConsent internationalConsent = isInternationalConsent.get();
    // Check if funds are available on the account selected in consent
    boolean areFundsAvailable = fundsAvailabilityService.isFundsAvailable(internationalConsent.getAccountId(), internationalConsent.getInitiation().getInstructedAmount().getAmount());
    return ResponseEntity.status(HttpStatus.OK).body(new OBWriteFundsConfirmationResponse1().data(new OBWriteFundsConfirmationResponse1Data().fundsAvailableResult(new OBWriteFundsConfirmationResponse1DataFundsAvailableResult().fundsAvailable(areFundsAvailable).fundsAvailableDateTime(DateTime.now()))).links(PaginationUtil.generateLinksOnePager(httpUrl)).meta(new Meta()));
}
Also used : Meta(uk.org.openbanking.datamodel.account.Meta) FRInternationalConsent(com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent)

Example 5 with Meta

use of uk.org.openbanking.datamodel.account.Meta 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

Meta (uk.org.openbanking.datamodel.account.Meta)25 FRReadRefundAccount (com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRReadRefundAccount)12 FRDomesticResponseDataRefund (com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRDomesticResponseDataRefund)6 FRInternationalResponseDataRefund (com.forgerock.openbanking.common.model.openbanking.domain.payment.common.FRInternationalResponseDataRefund)6 FRDomesticConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRDomesticConsent)4 FRInternationalConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent)4 FRInternationalScheduledConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalScheduledConsent)4 FRWriteDomesticDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticDataInitiation)2 FRWriteDomesticScheduledDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticScheduledDataInitiation)2 FRWriteDomesticStandingOrderDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticStandingOrderDataInitiation)2 FRWriteInternationalDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalDataInitiation)2 FRWriteInternationalScheduledDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalScheduledDataInitiation)2 FRWriteInternationalStandingOrderDataInitiation (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalStandingOrderDataInitiation)2 OBWriteDomesticResponse4 (uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse4)1 OBWriteDomesticResponse4Data (uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse4Data)1 OBWriteDomesticResponse5 (uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse5)1 OBWriteDomesticResponse5Data (uk.org.openbanking.datamodel.payment.OBWriteDomesticResponse5Data)1 OBWriteDomesticScheduledResponse4 (uk.org.openbanking.datamodel.payment.OBWriteDomesticScheduledResponse4)1 OBWriteDomesticScheduledResponse4Data (uk.org.openbanking.datamodel.payment.OBWriteDomesticScheduledResponse4Data)1 OBWriteDomesticScheduledResponse5 (uk.org.openbanking.datamodel.payment.OBWriteDomesticScheduledResponse5)1