use of com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalScheduled in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalScheduledPaymentsApiControllerIT method savePaymentSubmission.
private FRInternationalScheduledPaymentSubmission savePaymentSubmission(FRInternationalScheduledConsent consent) {
FRWriteInternationalScheduled submissionRequest = JMockData.mock(FRWriteInternationalScheduled.class);
submissionRequest.getData().setInitiation(consent.getInitiation());
FRInternationalScheduledPaymentSubmission submission = FRInternationalScheduledPaymentSubmission.builder().id(consent.getId()).internationalScheduledPayment(submissionRequest).build();
submissionRepository.save(submission);
return submission;
}
use of com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalScheduled in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalScheduledPaymentsApiController method createInternationalScheduledPayments.
@Override
public ResponseEntity createInternationalScheduledPayments(@ApiParam(value = "Default", required = true) @Valid @RequestBody OBWriteInternationalScheduled1 obWriteInternationalScheduled1, @ApiParam(value = "The unique id of the ASPSP to which the request is issued. The unique id will be issued by OB.", required = true) @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "Every request will be processed only once per x-idempotency-key. The Idempotency Key will be valid for 24 hours.", required = true) @RequestHeader(value = "x-idempotency-key", required = true) String xIdempotencyKey, @ApiParam(value = "A detached JWS signature of the body of the payload.", required = true) @RequestHeader(value = "x-jws-signature", required = true) String xJwsSignature, @ApiParam(value = "The time when the PSU last logged in with the TPP. All dates in the HTTP headers are represented as RFC 7231 Full Dates. An example is below: Sun, 10 Sep 2017 19:43:31 UTC") @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @ApiParam(value = "The PSU's IP address if the PSU is currently logged in with the TPP.") @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @ApiParam(value = "Indicates the user-agent that the PSU is using.") @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
log.debug("Received payment submission: '{}'", obWriteInternationalScheduled1);
FRWriteInternationalScheduled frScheduledPayment = toFRWriteInternationalScheduled(obWriteInternationalScheduled1);
log.trace("Converted to: '{}'", frScheduledPayment);
String paymentId = frScheduledPayment.getData().getConsentId();
FRInternationalScheduledConsent paymentConsent = internationalScheduledConsentRepository.findById(paymentId).orElseThrow(() -> new OBErrorResponseException(HttpStatus.BAD_REQUEST, OBRIErrorResponseCategory.REQUEST_INVALID, OBRIErrorType.PAYMENT_CONSENT_BEHIND_SUBMISSION_NOT_FOUND.toOBError1(paymentId)));
log.debug("Found consent '{}' to match this payment id: {} ", paymentConsent, paymentId);
FRInternationalScheduledPaymentSubmission frPaymentSubmission = FRInternationalScheduledPaymentSubmission.builder().id(paymentId).internationalScheduledPayment(frScheduledPayment).created(new Date()).updated(new Date()).idempotencyKey(xIdempotencyKey).obVersion(VersionPathExtractor.getVersionFromPath(request)).build();
frPaymentSubmission = new IdempotentRepositoryAdapter<>(internationalScheduledPaymentSubmissionRepository).idempotentSave(frPaymentSubmission);
return ResponseEntity.status(HttpStatus.CREATED).body(responseEntity(frPaymentSubmission, paymentConsent));
}
use of com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalScheduled in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalScheduledPaymentsApiController method createInternationalScheduledPayments.
@Override
public ResponseEntity createInternationalScheduledPayments(@ApiParam(value = "Default", required = true) @Valid @RequestBody OBWriteInternationalScheduled2 obWriteInternationalScheduled2, @ApiParam(value = "The unique id of the ASPSP to which the request is issued. The unique id will be issued by OB.", required = true) @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "Every request will be processed only once per x-idempotency-key. The Idempotency Key will be valid for 24 hours.", required = true) @RequestHeader(value = "x-idempotency-key", required = true) String xIdempotencyKey, @ApiParam(value = "A detached JWS signature of the body of the payload.", required = true) @RequestHeader(value = "x-jws-signature", required = true) String xJwsSignature, @ApiParam(value = "The time when the PSU last logged in with the TPP. All dates in the HTTP headers are represented as RFC 7231 Full Dates. An example is below: Sun, 10 Sep 2017 19:43:31 UTC") @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @ApiParam(value = "The PSU's IP address if the PSU is currently logged in with the TPP.") @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @ApiParam(value = "Indicates the user-agent that the PSU is using.") @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
log.debug("Received payment submission: '{}'", obWriteInternationalScheduled2);
FRWriteInternationalScheduled frInternationalScheduled = toFRWriteInternationalScheduled(obWriteInternationalScheduled2);
log.trace("Converted to: '{}'", frInternationalScheduled);
String paymentId = obWriteInternationalScheduled2.getData().getConsentId();
FRInternationalScheduledConsent paymentConsent = internationalScheduledConsentRepository.findById(paymentId).orElseThrow(() -> new OBErrorResponseException(HttpStatus.BAD_REQUEST, OBRIErrorResponseCategory.REQUEST_INVALID, OBRIErrorType.PAYMENT_CONSENT_BEHIND_SUBMISSION_NOT_FOUND.toOBError1(paymentId)));
log.debug("Found consent '{}' to match this payment id: {} ", paymentConsent, paymentId);
FRInternationalScheduledPaymentSubmission frPaymentSubmission = FRInternationalScheduledPaymentSubmission.builder().id(paymentId).internationalScheduledPayment(frInternationalScheduled).created(new Date()).updated(new Date()).idempotencyKey(xIdempotencyKey).obVersion(VersionPathExtractor.getVersionFromPath(request)).build();
frPaymentSubmission = new IdempotentRepositoryAdapter<>(internationalScheduledPaymentSubmissionRepository).idempotentSave(frPaymentSubmission);
return ResponseEntity.status(HttpStatus.CREATED).body(responseEntity(frPaymentSubmission, paymentConsent));
}
use of com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalScheduled in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalScheduledPaymentsApiController method createInternationalScheduledPayments.
public ResponseEntity<OBWriteInternationalScheduledResponse6> createInternationalScheduledPayments(OBWriteInternationalScheduled3 obWriteInternationalScheduled3, String authorization, String xIdempotencyKey, String xJwsSignature, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
log.debug("Received payment submission: '{}'", obWriteInternationalScheduled3);
FRWriteInternationalScheduled frInternationalScheduled = toFRWriteInternationalScheduled(obWriteInternationalScheduled3);
log.trace("Converted to: '{}'", frInternationalScheduled);
String paymentId = obWriteInternationalScheduled3.getData().getConsentId();
FRInternationalScheduledConsent paymentConsent = internationalScheduledConsentRepository.findById(paymentId).orElseThrow(() -> new OBErrorResponseException(HttpStatus.BAD_REQUEST, OBRIErrorResponseCategory.REQUEST_INVALID, OBRIErrorType.PAYMENT_CONSENT_BEHIND_SUBMISSION_NOT_FOUND.toOBError1(paymentId)));
log.debug("Found consent '{}' to match this payment id: {} ", paymentConsent, paymentId);
FRInternationalScheduledPaymentSubmission frPaymentSubmission = FRInternationalScheduledPaymentSubmission.builder().id(paymentId).internationalScheduledPayment(frInternationalScheduled).created(new Date()).updated(new Date()).idempotencyKey(xIdempotencyKey).obVersion(VersionPathExtractor.getVersionFromPath(request)).build();
frPaymentSubmission = new IdempotentRepositoryAdapter<>(internationalScheduledPaymentSubmissionRepository).idempotentSave(frPaymentSubmission);
return ResponseEntity.status(HttpStatus.CREATED).body(responseEntity(frPaymentSubmission, paymentConsent));
}
use of com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalScheduled 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 {
log.debug("Received payment submission: '{}'", obWriteInternationalScheduled3);
FRWriteInternationalScheduled frInternationalScheduled = toFRWriteInternationalScheduled(obWriteInternationalScheduled3);
log.trace("Converted to: '{}'", frInternationalScheduled);
String paymentId = obWriteInternationalScheduled3.getData().getConsentId();
FRInternationalScheduledConsent paymentConsent = internationalScheduledConsentRepository.findById(paymentId).orElseThrow(() -> new OBErrorResponseException(HttpStatus.BAD_REQUEST, OBRIErrorResponseCategory.REQUEST_INVALID, OBRIErrorType.PAYMENT_CONSENT_BEHIND_SUBMISSION_NOT_FOUND.toOBError1(paymentId)));
log.debug("Found consent '{}' to match this payment id: {} ", paymentConsent, paymentId);
FRInternationalScheduledPaymentSubmission frPaymentSubmission = FRInternationalScheduledPaymentSubmission.builder().id(paymentId).internationalScheduledPayment(frInternationalScheduled).created(new Date()).updated(new Date()).idempotencyKey(xIdempotencyKey).obVersion(VersionPathExtractor.getVersionFromPath(request)).build();
frPaymentSubmission = new IdempotentRepositoryAdapter<>(internationalScheduledPaymentSubmissionRepository).idempotentSave(frPaymentSubmission);
return ResponseEntity.status(HttpStatus.CREATED).body(responseEntity(frPaymentSubmission, paymentConsent));
}
Aggregations