use of com.forgerock.openbanking.common.model.version.OBVersion in project openbanking-aspsp by OpenBankingToolkit.
the class ApiVersionMatcherTest method shouldGetVersionGiven3_1_4.
@Test
public void shouldGetVersionGiven3_1_4() {
// Given
String requestUri = "v3.1.4/pisp";
// When
OBVersion version = ApiVersionUtils.getOBVersion(requestUri);
// Then
assertThat(version).isEqualTo(OBVersion.v3_1_4);
}
use of com.forgerock.openbanking.common.model.version.OBVersion in project openbanking-aspsp by OpenBankingToolkit.
the class DomesticVrpConsentsApiController method domesticVrpConsentsFundsConfirmation.
@Override
public ResponseEntity domesticVrpConsentsFundsConfirmation(String consentId, String authorization, String xJwsSignature, OBVRPFundsConfirmationRequest obVRPFundsConfirmationRequest, String xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
log.debug("Request to get a VRP funds confirmation, consentId '{}'", consentId);
if (!consentId.equals(obVRPFundsConfirmationRequest.getData().getConsentId())) {
log.error("The consent ID '{}' path parameter does not match with the consent ID '{}' requested to confirm the funds.", consentId, obVRPFundsConfirmationRequest.getData().getConsentId());
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("The consent ID '" + consentId + "' path parameter does not match with the consent ID '" + obVRPFundsConfirmationRequest.getData().getConsentId() + "' requested to confirm the funds.");
}
log.debug("(domesticVrpConsentsFundsConfirmation) Request mode test: '{}'", StringUtils.hasLength(request.getHeader(OpenBankingHttpHeaders.X_OB_MODE_TEST)));
return rsEndpointWrapperService.vrpPaymentEndpoint().authorization(authorization).xFapiFinancialId(xFapiInteractionId).principal(principal).isAuthorizationCodeGrantType(true).obVersion(OBVersion.v3_1_8).filters(f -> {
f.verifyJwsDetachedSignature(xJwsSignature, request);
}).execute((String tppId) -> {
HttpHeaders additionalHeaders = new HttpHeaders();
return rsStoreGateway.toRsStore(request, additionalHeaders, Collections.emptyMap(), OBVRPFundsConfirmationResponse.class, obVRPFundsConfirmationRequest);
});
}
use of com.forgerock.openbanking.common.model.version.OBVersion in project openbanking-aspsp by OpenBankingToolkit.
the class ApiVersionUtils method getOBVersion.
/**
* Find and Provides the version of the API supported by this instance if it contained in the passed parameter.
* @param s
* parameter passed to find the version supported.
* @return The {@link OBVersion} matching.
*/
public static OBVersion getOBVersion(String s) {
Matcher matcher = VERSION_PATTERN.matcher(format(s));
if (!matcher.find()) {
throw new IllegalArgumentException("Unable to determine version from passed parameter: " + s);
}
OBVersion version = OBVersion.fromString(matcher.group());
if (version == null) {
log.debug("Unknown version value from: {}", s);
throw new IllegalArgumentException("Unknown version value from: " + s);
}
return version;
}
use of com.forgerock.openbanking.common.model.version.OBVersion in project openbanking-aspsp by OpenBankingToolkit.
the class DomesticVrpConsentsApiController method domesticVrpConsentsPost.
@Override
public ResponseEntity domesticVrpConsentsPost(String authorization, String xIdempotencyKey, String xJwsSignature, OBDomesticVRPConsentRequest obDomesticVRPConsentRequest, String xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
log.debug("Request to create a VRP consent received, interactionId '{}'", xFapiInteractionId);
return rsEndpointWrapperService.vrpPaymentEndpoint().authorization(authorization).xFapiFinancialId(xFapiInteractionId).principal(principal).obVersion(OBVersion.v3_1_8).filters(f -> {
f.verifyIdempotencyKeyLength(xIdempotencyKey);
f.verifyJwsDetachedSignature(xJwsSignature, request);
}).execute((String tppId) -> {
HttpHeaders additionalHeaders = new HttpHeaders();
additionalHeaders.add("x-ob-client-id", tppId);
return rsStoreGateway.toRsStore(request, additionalHeaders, Collections.emptyMap(), OBDomesticVRPConsentResponse.class, obDomesticVRPConsentRequest);
});
}
use of com.forgerock.openbanking.common.model.version.OBVersion in project openbanking-aspsp by OpenBankingToolkit.
the class ApiVersionMatcherTest method shouldGetVersionGiven3_1_3.
@Test
public void shouldGetVersionGiven3_1_3() {
// Given
String requestUri = "/open-banking/v3.1.3";
// When
OBVersion version = ApiVersionUtils.getOBVersion(requestUri);
// Then
assertThat(version).isEqualTo(OBVersion.v3_1_3);
}
Aggregations