use of net.petafuel.styx.core.xs2a.entities.InitializablePayment in project styx by petafuel.
the class FetchPaymentResource method fetchPayment.
/**
* Returns an previously initiated payment in its raw form, as json or xml pain001.003
*
* @param paymentTypeBean contains which payment product is used
* @param paymentId id of the payment that should be retrieved from the aspsp
* @return 200 if successful
* @throws BankRequestFailedException in case the communication between styx and aspsp was not successful
*/
@AcceptsPreStepAuth
@GET
@Path("/{paymentService}/{paymentProduct}/{paymentId}")
public Response fetchPayment(@BeanParam PaymentTypeBean paymentTypeBean, @NotEmpty @NotBlank @PathParam("paymentId") String paymentId) throws BankRequestFailedException {
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setPaymentService(paymentTypeBean.getPaymentService());
xs2AFactoryInput.setPaymentProduct(paymentTypeBean.getPaymentProduct());
xs2AFactoryInput.setPsu(getPsu());
xs2AFactoryInput.setPaymentId(paymentId);
IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
ioProcessor.modifyInput(xs2AFactoryInput);
PISRequest aspspRequest = new PISRequestFactory().create(getXS2AStandard().getRequestClassProvider().paymentRetrieval(), xs2AFactoryInput);
aspspRequest.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(aspspRequest, xs2AFactoryInput);
InitializablePayment fetchedPayment = getXS2AStandard().getPis().getPayment(aspspRequest);
LOG.info("Successfully fetched payment entity for bic={}, paymentId={}", getXS2AStandard().getAspsp().getBic(), paymentId);
return Response.status(ResponseConstant.OK).entity(fetchedPayment).build();
}
use of net.petafuel.styx.core.xs2a.entities.InitializablePayment in project styx by petafuel.
the class PeriodicPaymentResourceRaiffeisenMSTest method B_getPeriodicPayment.
@Test
@Category(IntegrationTest.class)
public void B_getPeriodicPayment() {
Invocation.Builder invocationBuilder = target("/v1/periodic-payments/sepa-credit-transfers/" + paymentId).request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", PSU_ID);
invocationBuilder.header("PSU-BIC", BIC);
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
Invocation invocation = invocationBuilder.buildGet();
InitializablePayment response = invocation.invoke(PeriodicPayment.class);
Assertions.assertNotNull(response);
}
use of net.petafuel.styx.core.xs2a.entities.InitializablePayment in project styx by petafuel.
the class PeriodicPaymentResourceSparkasseTest method B_getPeriodicPayment.
@Test
@Category(IntegrationTest.class)
public void B_getPeriodicPayment() {
Invocation.Builder invocationBuilder = target("/v1/periodic-payments/sepa-credit-transfers/" + paymentId).request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", PSU_ID);
invocationBuilder.header("PSU-BIC", BIC);
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
Invocation invocation = invocationBuilder.buildGet();
InitializablePayment response = invocation.invoke(PeriodicPayment.class);
Assertions.assertNotNull(response);
}
Aggregations