use of com.forgerock.openbanking.exceptions.OBErrorResponseException in project openbanking-aspsp by OpenBankingToolkit.
the class CallbackUrlApiController method updateCallbackUrl.
@Override
public ResponseEntity updateCallbackUrl(@ApiParam(value = "CallbackUrlId", required = true) @PathVariable("CallbackUrlId") String callbackUrlId, @ApiParam(value = "Default", required = true) @Valid @RequestBody OBCallbackUrl1 obCallbackUrl1Param, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "Header containing a detached JWS signature of the body of the payload.", required = true) @RequestHeader(value = "x-jws-signature", required = false) String xJwsSignature, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
return rsEndpointWrapperService.eventNotificationEndpoint().authorization(authorization).principal(principal).obVersion(getOBVersion(request.getRequestURI())).filters(f -> {
f.verifyJwsDetachedSignature(xJwsSignature, request);
f.verifyMatcherVersion(obCallbackUrl1Param.getData().getUrl(), obCallbackUrl1Param.getData().getVersion());
}).execute((String tppId) -> {
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.add(OpenBankingHttpHeaders.X_OB_CLIENT_ID, tppId);
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Collections.emptyMap(), OBCallbackUrlResponse1.class, obCallbackUrl1Param);
});
}
use of com.forgerock.openbanking.exceptions.OBErrorResponseException in project openbanking-aspsp by OpenBankingToolkit.
the class EventSubscriptionApiController method updateEventSubscription.
@Override
public ResponseEntity<OBEventSubscriptionResponse1> updateEventSubscription(@ApiParam(value = "EventSubscriptionId", required = true) @PathVariable("EventSubscriptionId") String eventSubscriptionId, @ApiParam(value = "Default", required = true) @Valid @RequestBody OBEventSubscriptionResponse1 obEventSubscriptionsParam, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "Header containing a detached JWS signature of the body of the payload.", required = true) @RequestHeader(value = "x-jws-signature", required = false) String xJwsSignature, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
return rsEndpointWrapperService.eventNotificationEndpoint().authorization(authorization).principal(principal).obVersion(getOBVersion(request.getRequestURI())).filters(f -> {
f.verifyJwsDetachedSignature(xJwsSignature, request);
EventValidationService.verifyValidCallbackUrl(obEventSubscriptionsParam);
}).execute((String tppId) -> {
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.add(OpenBankingHttpHeaders.X_OB_CLIENT_ID, tppId);
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Collections.emptyMap(), OBEventSubscriptionResponse1.class, obEventSubscriptionsParam);
});
}
use of com.forgerock.openbanking.exceptions.OBErrorResponseException in project openbanking-aspsp by OpenBankingToolkit.
the class EventSubscriptionApiController method createEventSubscription.
@Override
public ResponseEntity<OBEventSubscriptionResponse1> createEventSubscription(@ApiParam(value = "Default", required = true) @Valid @RequestBody OBEventSubscription1 obEventSubscription1, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "Header containing a detached JWS signature of the body of the payload.", required = true) @RequestHeader(value = "x-jws-signature", required = false) String xJwsSignature, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
return rsEndpointWrapperService.eventNotificationEndpoint().authorization(authorization).principal(principal).obVersion(getOBVersion(request.getRequestURI())).filters(f -> {
f.verifyJwsDetachedSignature(xJwsSignature, request);
EventValidationService.verifyValidCallbackUrl(obEventSubscription1);
}).execute((String tppId) -> {
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.add(OpenBankingHttpHeaders.X_OB_CLIENT_ID, tppId);
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Collections.emptyMap(), OBEventSubscriptionResponse1.class, obEventSubscription1);
});
}
use of com.forgerock.openbanking.exceptions.OBErrorResponseException in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalScheduledPaymentConsentsApiController method createInternationalScheduledPaymentConsents.
@Override
public ResponseEntity<OBWriteInternationalScheduledConsentResponse5> createInternationalScheduledPaymentConsents(OBWriteInternationalScheduledConsent5 obWriteInternationalScheduledConsent5, 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(obWriteInternationalScheduledConsent5.getRisk());
}).execute((String tppId) -> {
exchangeRateVerifier.verify(obWriteInternationalScheduledConsent5.getData().getInitiation().getExchangeRateInformation());
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.add("x-ob-client-id", tppId);
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Collections.emptyMap(), OBWriteInternationalScheduledConsentResponse5.class, obWriteInternationalScheduledConsent5);
});
}
use of com.forgerock.openbanking.exceptions.OBErrorResponseException in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalScheduledPaymentsApiController method createInternationalScheduledPayments.
@Override
public ResponseEntity<OBWriteInternationalScheduledResponse5> createInternationalScheduledPayments(OBWriteInternationalScheduled3 obWriteInternationalScheduled3, String authorization, String xIdempotencyKey, String xJwsSignature, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
String consentId = obWriteInternationalScheduled3.getData().getConsentId();
FRInternationalScheduledConsent payment = paymentsService.getPayment(consentId);
return rsEndpointWrapperService.paymentSubmissionEndpoint().authorization(authorization).xFapiFinancialId(rsEndpointWrapperService.rsConfiguration.financialId).payment(payment).principal(principal).obVersion(getOBVersion(request.getRequestURI())).filters(f -> {
f.verifyPaymentIdWithAccessToken();
f.verifyIdempotencyKeyLength(xIdempotencyKey);
f.verifyPaymentStatus();
f.verifyRiskAndInitiation(toFRWriteInternationalScheduledDataInitiation(obWriteInternationalScheduled3.getData().getInitiation()), toFRRisk(obWriteInternationalScheduled3.getRisk()));
f.verifyJwsDetachedSignature(xJwsSignature, request);
}).execute((String tppId) -> {
// Modify the status of the payment
log.info("Switch status of payment {} to 'accepted settlement in process'.", consentId);
FRWriteInternationalScheduledDataInitiation initiation = payment.getInitiation();
FRScheduledPaymentData scheduledPayment = FRScheduledPaymentData.builder().accountId(payment.getAccountId()).creditorAccount(initiation.getCreditorAccount()).instructedAmount(initiation.getInstructedAmount()).scheduledType(FRScheduledPaymentData.FRScheduleType.EXECUTION).scheduledPaymentDateTime(initiation.getRequestedExecutionDateTime()).scheduledPaymentId(payment.getId()).build();
String pispId = tppStoreService.findByClientId(tppId).map(tpp -> tpp.getId()).orElse(null);
scheduledPaymentService.createSchedulePayment(scheduledPayment, pispId);
payment.setStatus(ConsentStatusCode.ACCEPTEDSETTLEMENTCOMPLETED);
log.info("Updating payment");
paymentsService.updatePayment(payment);
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.add("x-ob-payment-id", consentId);
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Collections.emptyMap(), OBWriteInternationalScheduledResponse5.class, obWriteInternationalScheduled3);
});
}
Aggregations