use of net.petafuel.styx.api.v1.payment.entity.AuthorisationIdsResponse in project styx by petafuel.
the class PaymentAuthorisationResource method getAuthorisationIds.
/**
* PIS - Fetch multiple SCAs for a payment
*
* @param paymentTypeBean
* @param paymentId
* @return
* @throws BankRequestFailedException
*/
@AcceptsPreStepAuth
@GET
@Path("/{paymentService}/{paymentProduct}/{paymentId}/authorisations")
public Response getAuthorisationIds(@BeanParam PaymentTypeBean paymentTypeBean, @NotEmpty @NotBlank @PathParam("paymentId") String paymentId) throws BankRequestFailedException {
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setPaymentService(paymentTypeBean.getPaymentService());
xs2AFactoryInput.setPaymentProduct(paymentTypeBean.getPaymentProduct());
xs2AFactoryInput.setPaymentId(paymentId);
xs2AFactoryInput.setPsu(getPsu());
IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
ioProcessor.modifyInput(xs2AFactoryInput);
SCARequest getAuthorisationRequest = new SCARequestFactory().create(getXS2AStandard().getRequestClassProvider().scaRetrieval(), xs2AFactoryInput);
getAuthorisationRequest.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(getAuthorisationRequest, xs2AFactoryInput);
List<String> authorisationIds = getXS2AStandard().getPis().getAuthorisations(getAuthorisationRequest);
AuthorisationIdsResponse response = new AuthorisationIdsResponse();
response.setAuthorisationIds(authorisationIds);
LOG.info("Successfully fetched Authorisation ids for payment={}", paymentId);
return Response.status(ResponseConstant.OK).entity(response).build();
}
use of net.petafuel.styx.api.v1.payment.entity.AuthorisationIdsResponse in project styx by petafuel.
the class SinglePaymentAuthorisationResourceTargoTest method E_getAuthorisationIds_Targo.
@Test
@Category(IntegrationTest.class)
public void E_getAuthorisationIds_Targo() {
Invocation.Builder invocationBuilder = target("/v1/payments/sepa-credit-transfers/" + paymentId + "/authorisations").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();
AuthorisationIdsResponse response = invocation.invoke(AuthorisationIdsResponse.class);
Assertions.assertNotNull(response.getAuthorisationIds());
Assertions.assertTrue(response.getAuthorisationIds().size() > 0);
authorisationId = response.getAuthorisationIds().get(0);
}
Aggregations