Search in sources :

Example 1 with InitializablePayment

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();
}
Also used : PISRequest(net.petafuel.styx.core.xs2a.contracts.PISRequest) PISRequestFactory(net.petafuel.styx.core.xs2a.factory.PISRequestFactory) XS2AFactoryInput(net.petafuel.styx.core.xs2a.factory.XS2AFactoryInput) IOProcessor(net.petafuel.styx.core.ioprocessing.IOProcessor) InitializablePayment(net.petafuel.styx.core.xs2a.entities.InitializablePayment) AcceptsPreStepAuth(net.petafuel.styx.api.filter.authentication.boundary.AcceptsPreStepAuth) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 2 with InitializablePayment

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);
}
Also used : Invocation(javax.ws.rs.client.Invocation) InitializablePayment(net.petafuel.styx.core.xs2a.entities.InitializablePayment) Category(org.junit.experimental.categories.Category) IntegrationTest(net.petafuel.styx.api.IntegrationTest) Test(org.junit.Test) StyxRESTTest(net.petafuel.styx.api.StyxRESTTest)

Example 3 with InitializablePayment

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);
}
Also used : Invocation(javax.ws.rs.client.Invocation) InitializablePayment(net.petafuel.styx.core.xs2a.entities.InitializablePayment) Category(org.junit.experimental.categories.Category) IntegrationTest(net.petafuel.styx.api.IntegrationTest) Test(org.junit.Test) StyxRESTTest(net.petafuel.styx.api.StyxRESTTest)

Aggregations

InitializablePayment (net.petafuel.styx.core.xs2a.entities.InitializablePayment)3 Invocation (javax.ws.rs.client.Invocation)2 IntegrationTest (net.petafuel.styx.api.IntegrationTest)2 StyxRESTTest (net.petafuel.styx.api.StyxRESTTest)2 Test (org.junit.Test)2 Category (org.junit.experimental.categories.Category)2 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 AcceptsPreStepAuth (net.petafuel.styx.api.filter.authentication.boundary.AcceptsPreStepAuth)1 IOProcessor (net.petafuel.styx.core.ioprocessing.IOProcessor)1 PISRequest (net.petafuel.styx.core.xs2a.contracts.PISRequest)1 PISRequestFactory (net.petafuel.styx.core.xs2a.factory.PISRequestFactory)1 XS2AFactoryInput (net.petafuel.styx.core.xs2a.factory.XS2AFactoryInput)1