Search in sources :

Example 1 with OBWriteInternationalConsent5

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

the class InternationalPaymentConsentsApiController method createInternationalPaymentConsents.

public ResponseEntity<OBWriteInternationalConsentResponse6> createInternationalPaymentConsents(OBWriteInternationalConsent5 obWriteInternationalConsent5, String authorization, String xIdempotencyKey, String xJwsSignature, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
    return rsEndpointWrapperService.paymentEndpoint().authorization(authorization).xFapiFinancialId(rsEndpointWrapperService.rsConfiguration.financialId).principal(principal).obVersion(getOBVersion(request.getRequestURI())).filters(f -> {
        f.verifyIdempotencyKeyLength(xIdempotencyKey);
        f.verifyJwsDetachedSignature(xJwsSignature, request);
        f.validateRisk(obWriteInternationalConsent5.getRisk());
    }).execute((String tppId) -> {
        exchangeRateVerifier.verify(obWriteInternationalConsent5.getData().getInitiation().getExchangeRateInformation());
        HttpHeaders additionalHttpHeaders = new HttpHeaders();
        additionalHttpHeaders.add("x-ob-client-id", tppId);
        return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Collections.emptyMap(), OBWriteInternationalConsentResponse6.class, obWriteInternationalConsent5);
    });
}
Also used : OBWriteFundsConfirmationResponse1(uk.org.openbanking.datamodel.payment.OBWriteFundsConfirmationResponse1) RsStoreGateway(com.forgerock.openbanking.common.services.store.RsStoreGateway) HttpHeaders(org.springframework.http.HttpHeaders) OBErrorResponseException(com.forgerock.openbanking.exceptions.OBErrorResponseException) DateTime(org.joda.time.DateTime) InternationalPaymentService(com.forgerock.openbanking.common.services.store.payment.InternationalPaymentService) Controller(org.springframework.stereotype.Controller) ExchangeRateVerifier(com.forgerock.openbanking.aspsp.rs.api.payment.verifier.ExchangeRateVerifier) FRInternationalConsent(com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent) OBWriteInternationalConsent5(uk.org.openbanking.datamodel.payment.OBWriteInternationalConsent5) HttpServletRequest(javax.servlet.http.HttpServletRequest) Principal(java.security.Principal) ServletServerHttpRequest(org.springframework.http.server.ServletServerHttpRequest) ApiVersionUtils.getOBVersion(com.forgerock.openbanking.common.utils.ApiVersionUtils.getOBVersion) RSEndpointWrapperService(com.forgerock.openbanking.aspsp.rs.wrappper.RSEndpointWrapperService) ResponseEntity(org.springframework.http.ResponseEntity) Collections(java.util.Collections) OBWriteInternationalConsentResponse6(uk.org.openbanking.datamodel.payment.OBWriteInternationalConsentResponse6) HttpHeaders(org.springframework.http.HttpHeaders)

Example 2 with OBWriteInternationalConsent5

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

the class InternationalPaymentConsentsApiController method createInternationalPaymentConsents.

@Override
public ResponseEntity<OBWriteInternationalConsentResponse5> createInternationalPaymentConsents(OBWriteInternationalConsent5 obWriteInternationalConsent5, String authorization, String xIdempotencyKey, String xJwsSignature, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
    return rsEndpointWrapperService.paymentEndpoint().authorization(authorization).xFapiFinancialId(rsEndpointWrapperService.rsConfiguration.financialId).principal(principal).obVersion(getOBVersion(request.getRequestURI())).filters(f -> {
        f.verifyIdempotencyKeyLength(xIdempotencyKey);
        f.verifyJwsDetachedSignature(xJwsSignature, request);
        f.validateRisk(obWriteInternationalConsent5.getRisk());
    }).execute((String tppId) -> {
        exchangeRateVerifier.verify(obWriteInternationalConsent5.getData().getInitiation().getExchangeRateInformation());
        HttpHeaders additionalHttpHeaders = new HttpHeaders();
        additionalHttpHeaders.add("x-ob-client-id", tppId);
        return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Collections.emptyMap(), OBWriteInternationalConsentResponse5.class, obWriteInternationalConsent5);
    });
}
Also used : OBWriteFundsConfirmationResponse1(uk.org.openbanking.datamodel.payment.OBWriteFundsConfirmationResponse1) RsStoreGateway(com.forgerock.openbanking.common.services.store.RsStoreGateway) HttpHeaders(org.springframework.http.HttpHeaders) OBErrorResponseException(com.forgerock.openbanking.exceptions.OBErrorResponseException) DateTime(org.joda.time.DateTime) InternationalPaymentService(com.forgerock.openbanking.common.services.store.payment.InternationalPaymentService) Controller(org.springframework.stereotype.Controller) ExchangeRateVerifier(com.forgerock.openbanking.aspsp.rs.api.payment.verifier.ExchangeRateVerifier) FRInternationalConsent(com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent) OBWriteInternationalConsent5(uk.org.openbanking.datamodel.payment.OBWriteInternationalConsent5) OBWriteInternationalConsentResponse5(uk.org.openbanking.datamodel.payment.OBWriteInternationalConsentResponse5) HttpServletRequest(javax.servlet.http.HttpServletRequest) Principal(java.security.Principal) ServletServerHttpRequest(org.springframework.http.server.ServletServerHttpRequest) ApiVersionUtils.getOBVersion(com.forgerock.openbanking.common.utils.ApiVersionUtils.getOBVersion) RSEndpointWrapperService(com.forgerock.openbanking.aspsp.rs.wrappper.RSEndpointWrapperService) ResponseEntity(org.springframework.http.ResponseEntity) Collections(java.util.Collections) HttpHeaders(org.springframework.http.HttpHeaders)

Aggregations

ExchangeRateVerifier (com.forgerock.openbanking.aspsp.rs.api.payment.verifier.ExchangeRateVerifier)2 RSEndpointWrapperService (com.forgerock.openbanking.aspsp.rs.wrappper.RSEndpointWrapperService)2 FRInternationalConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent)2 RsStoreGateway (com.forgerock.openbanking.common.services.store.RsStoreGateway)2 InternationalPaymentService (com.forgerock.openbanking.common.services.store.payment.InternationalPaymentService)2 ApiVersionUtils.getOBVersion (com.forgerock.openbanking.common.utils.ApiVersionUtils.getOBVersion)2 OBErrorResponseException (com.forgerock.openbanking.exceptions.OBErrorResponseException)2 Principal (java.security.Principal)2 Collections (java.util.Collections)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 DateTime (org.joda.time.DateTime)2 HttpHeaders (org.springframework.http.HttpHeaders)2 ResponseEntity (org.springframework.http.ResponseEntity)2 ServletServerHttpRequest (org.springframework.http.server.ServletServerHttpRequest)2 Controller (org.springframework.stereotype.Controller)2 OBWriteFundsConfirmationResponse1 (uk.org.openbanking.datamodel.payment.OBWriteFundsConfirmationResponse1)2 OBWriteInternationalConsent5 (uk.org.openbanking.datamodel.payment.OBWriteInternationalConsent5)2 OBWriteInternationalConsentResponse5 (uk.org.openbanking.datamodel.payment.OBWriteInternationalConsentResponse5)1 OBWriteInternationalConsentResponse6 (uk.org.openbanking.datamodel.payment.OBWriteInternationalConsentResponse6)1