use of net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse in project styx by petafuel.
the class ConsentAuthorisationResource method getScaStatus.
@AcceptsPreStepAuth
@GET
@Path("/consents/{consentId}/authorisations/{authorisationId}")
public Response getScaStatus(@NotEmpty @NotBlank @PathParam("consentId") String consentId, @NotEmpty @NotBlank @PathParam("authorisationId") String authorisationId) throws BankRequestFailedException {
consentId = Sanitizer.replaceEscSeq(consentId);
authorisationId = Sanitizer.replaceEscSeq(authorisationId);
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setConsentId(consentId);
xs2AFactoryInput.setAuthorisationId(authorisationId);
IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
ioProcessor.modifyInput(xs2AFactoryInput);
SCARequest getAuthorisationStatusRequest = new SCARequestFactory().create(getXS2AStandard().getRequestClassProvider().scaStatus(), xs2AFactoryInput);
getAuthorisationStatusRequest.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(getAuthorisationStatusRequest, xs2AFactoryInput);
SCA.Status authorisationStatus = getXS2AStandard().getCs().getSCAStatus(getAuthorisationStatusRequest);
AuthorisationStatusResponse response = new AuthorisationStatusResponse();
response.setScaStatus(authorisationStatus.getValue());
LOG.info("Consent Authorisation Status requested for consentId={} authorisationId={} scaStatus={}", consentId, authorisationId, authorisationStatus.getValue());
return Response.status(ResponseConstant.OK).entity(response).build();
}
use of net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse in project styx by petafuel.
the class PaymentAuthorisationResource method getScaStatus.
/**
* PIS - Get authorisation SCA status
*
* @param paymentTypeBean
* @param paymentId
* @param authorisationId
* @return
* @throws BankRequestFailedException
*/
@AcceptsPreStepAuth
@GET
@Path("/{paymentService}/{paymentProduct}/{paymentId}/authorisations/{authorisationId}")
public Response getScaStatus(@BeanParam PaymentTypeBean paymentTypeBean, @NotEmpty @NotBlank @PathParam("paymentId") String paymentId, @NotEmpty @NotBlank @PathParam("authorisationId") String authorisationId) throws BankRequestFailedException {
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setPaymentService(paymentTypeBean.getPaymentService());
xs2AFactoryInput.setPaymentProduct(paymentTypeBean.getPaymentProduct());
xs2AFactoryInput.setPaymentId(paymentId);
xs2AFactoryInput.setAuthorisationId(authorisationId);
xs2AFactoryInput.setPsu(getPsu());
IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
ioProcessor.modifyInput(xs2AFactoryInput);
SCARequest getAuthorisationStatusRequest = new SCARequestFactory().create(getXS2AStandard().getRequestClassProvider().scaStatus(), xs2AFactoryInput);
getAuthorisationStatusRequest.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(getAuthorisationStatusRequest, xs2AFactoryInput);
SCA.Status authorisationStatus = getXS2AStandard().getPis().getSCAStatus(getAuthorisationStatusRequest);
AuthorisationStatusResponse response = new AuthorisationStatusResponse();
response.setScaStatus(authorisationStatus.getValue());
LOG.info("Successfully fetched Authorisation status for payment={}, authorisationId={}", paymentId, authorisationId);
return Response.status(ResponseConstant.OK).entity(response).build();
}
use of net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse in project styx by petafuel.
the class ConsentResourcesFiduciaTest method E_checkScaStatus.
/**
* SCA Status request for fiducia can only be made before the sca is finalised, afterwards this results in a 404 unknown resource
*
* @throws IOException
*/
@Test
@Category(IntegrationTest.class)
public void E_checkScaStatus() throws IOException {
AuthorisationStatusResponse response = getStatusAuthorisation();
Assertions.assertEquals(SCA.Status.PSUAUTHENTICATED.getValue(), response.getScaStatus());
}
use of net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse in project styx by petafuel.
the class ConsentResourcesTargoTest method H_checkScaStatus.
@Test
@Category(IntegrationTest.class)
public void H_checkScaStatus() throws IOException {
AuthorisationStatusResponse response = getStatusAuthorisation();
Assertions.assertEquals(SCA.Status.FINALISED.getValue(), response.getScaStatus());
}
use of net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse in project styx by petafuel.
the class SinglePaymentAuthorisationResourceTargoTest method F_getAuthorisationStatus_Targo.
@Test
@Category(IntegrationTest.class)
public void F_getAuthorisationStatus_Targo() {
Invocation.Builder invocationBuilder = target("/v1/payments/sepa-credit-transfers/" + paymentId + "/authorisations/" + authorisationId).request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", "PSD2TEST2");
invocationBuilder.header("PSU-BIC", "CMCIDEDD");
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
invocationBuilder.header("redirectPreferred", true);
invocationBuilder.header("X-STYX-X-bvpsd2-test-apikey", "tUfZ5KOHRTFrikZUsmSMUabKw09UIzGE");
Invocation invocation = invocationBuilder.buildGet();
AuthorisationStatusResponse response = invocation.invoke(AuthorisationStatusResponse.class);
Assertions.assertNotNull(response.getScaStatus());
Assertions.assertEquals(SCA.Status.FINALISED.getValue(), response.getScaStatus());
}
Aggregations