use of net.petafuel.styx.api.v1.payment.entity.PeriodicPaymentInitiation in project styx by petafuel.
the class SinglePaymentInitiationResourceTest method initiatePeriodicPayment_Consors.
@Test
@Category(IntegrationTest.class)
public void initiatePeriodicPayment_Consors() {
Jsonb jsonb = JsonbBuilder.create();
PeriodicPaymentInitiation periodicPaymentInitiation = jsonb.fromJson("{\"startDate\":\"" + currentDate + "\",\"dayOfExecution\":31,\"frequency\":\"MNTH\",\"executionRule\":\"following\",\"payments\":[{\"debtorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE60760300800500123456\"},\"instructedAmount\":{\"currency\":\"EUR\",\"amount\":\"520.00\"},\"creditorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE15500105172295759744\"},\"creditorName\":\"WBG\",\"remittanceInformationUnstructured\":\"Ref.NumberWBG-1222\",\"requestedExecutionDate\":\"" + currentDate + "\"}]}", PeriodicPaymentInitiation.class);
Invocation.Builder invocationBuilder = target("/v1/periodic-payments/sepa-credit-transfers").request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", "PSU-Successful");
invocationBuilder.header("PSU-BIC", "CSDBDE71");
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
invocationBuilder.header("redirectPreferred", true);
Invocation invocation = invocationBuilder.buildPost(Entity.entity(periodicPaymentInitiation, MediaType.APPLICATION_JSON));
Response response = invocation.invoke(Response.class);
Assert.assertEquals(201, response.getStatus());
}
use of net.petafuel.styx.api.v1.payment.entity.PeriodicPaymentInitiation in project styx by petafuel.
the class FetchSinglePaymentResourceTest method fetchPeriodicPayment.
@Test
@Category(IntegrationTest.class)
public void fetchPeriodicPayment() throws IOException {
Invocation.Builder invocationBuilder = target("/v1/periodic-payments/sepa-credit-transfers").request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", "PSU-Successful");
invocationBuilder.header("PSU-BIC", "CSDBDE71");
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
invocationBuilder.header("redirectPreferred", true);
Jsonb jsonb = JsonbBuilder.create();
PeriodicPaymentInitiation periodicPaymentInitiation = jsonb.fromJson("{\"startDate\":\"" + currentDate + "\",\"dayOfExecution\":31,\"frequency\":\"MNTH\",\"executionRule\":\"following\",\"payments\":[{\"debtorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE60760300800500123456\"},\"instructedAmount\":{\"currency\":\"EUR\",\"amount\":\"520.00\"},\"creditorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE15500105172295759744\"},\"creditorName\":\"WBG\",\"remittanceInformationUnstructured\":\"Ref.NumberWBG-1222\",\"requestedExecutionDate\":\"" + currentDate + "\"}]}", PeriodicPaymentInitiation.class);
Invocation invocation = invocationBuilder.buildPost(Entity.entity(periodicPaymentInitiation, MediaType.APPLICATION_JSON));
Response response = invocation.invoke(Response.class);
Assertions.assertEquals(201, response.getStatus());
PaymentResponse paymentResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), PaymentResponse.class);
Invocation getPayment = target("/v1/periodic-payments/sepa-credit-transfers/" + paymentResponse.getPaymentId()).request().header("token", pisAccessToken).header("PSU-ID", "PSU-Successful").header("PSU-BIC", "CSDBDE71").header("PSU-IP-Address", "192.168.8.78").header("redirectPreferred", true).buildGet();
response = getPayment.invoke(Response.class);
Assertions.assertEquals(200, response.getStatus());
}
use of net.petafuel.styx.api.v1.payment.entity.PeriodicPaymentInitiation in project styx by petafuel.
the class SinglePaymentStatusResourceTest method getSparkassePeriodicPaymentId.
private String getSparkassePeriodicPaymentId() {
if (sparkassePeriodicPaymentId == null) {
Jsonb jsonb = JsonbBuilder.create();
PeriodicPaymentInitiation periodicPaymentInitiation = jsonb.fromJson("{\"endToEndIdentification\": \"endToEndId\", \"startDate\":\"" + currentDate + "\",\"dayOfExecution\":31,\"frequency\":\"MNTH\",\"executionRule\":\"following\",\"payments\":[{\"debtorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE86999999990000001000\"},\"instructedAmount\":{\"currency\":\"EUR\",\"amount\":\"520.00\"},\"creditorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE75999999990000001004\"},\"creditorName\":\"WBG\",\"remittanceInformationUnstructured\":\"Ref.NumberWBG-1222\"}]}", PeriodicPaymentInitiation.class);
Invocation.Builder invocationBuilder = target("/v1/periodic-payments/sepa-credit-transfers").request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", "PSU-1234");
invocationBuilder.header("PSU-BIC", SPARKASSE_BIC);
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
invocationBuilder.header("redirectPreferred", true);
Invocation invocation = invocationBuilder.buildPost(Entity.entity(periodicPaymentInitiation, MediaType.APPLICATION_JSON));
Response response = invocation.invoke(Response.class);
try {
PaymentResponse paymentResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), PaymentResponse.class);
sparkassePeriodicPaymentId = paymentResponse.getPaymentId();
} catch (IOException e) {
return "";
}
}
return sparkassePeriodicPaymentId;
}
use of net.petafuel.styx.api.v1.payment.entity.PeriodicPaymentInitiation in project styx by petafuel.
the class PeriodicPaymentResourceRaiffeisenMSTest method A_initiatePeriodicPayment.
@Test
@Category(IntegrationTest.class)
public void A_initiatePeriodicPayment() {
Invocation.Builder invocationBuilder = target("/v1/periodic-payments/sepa-credit-transfers").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");
invocationBuilder.header("redirectPreferred", true);
Jsonb jsonb = JsonbBuilder.create();
String requestBody = "{\"startDate\":\"" + currentDate + "\",\"dayOfExecution\":31,\"frequency\":\"MNTH\",\"executionRule\":\"following\",\"payments\":[{\"debtorAccount\":{\"currency\":\"EUR\",\"iban\":\"" + debtorIBAN + "\"},\"instructedAmount\":{\"currency\":\"EUR\",\"amount\":\"1.00\"},\"creditorAccount\":{\"currency\":\"EUR\",\"iban\":\"" + creditorIBAN + "\"},\"creditorName\":\"" + creditorName + "\",\"remittanceInformationUnstructured\":\"Test\",\"requestedExecutionDate\":\"" + currentDate + "\"}]}";
PeriodicPaymentInitiation periodicPaymentInitiation = jsonb.fromJson(requestBody, PeriodicPaymentInitiation.class);
Invocation invocation = invocationBuilder.buildPost(Entity.entity(periodicPaymentInitiation, MediaType.APPLICATION_JSON));
PaymentResponse response = invocation.invoke(PaymentResponse.class);
Assertions.assertNotNull(response.getPaymentId());
paymentId = response.getPaymentId();
}
use of net.petafuel.styx.api.v1.payment.entity.PeriodicPaymentInitiation in project styx by petafuel.
the class SinglePaymentInitiationResourceTest method initiatePeriodicPayment_Targo.
@Test
@Category(IntegrationTest.class)
public void initiatePeriodicPayment_Targo() {
Jsonb jsonb = JsonbBuilder.create();
PeriodicPaymentInitiation periodicPaymentInitiation = jsonb.fromJson("{\"startDate\":\"" + currentDate + "\",\"dayOfExecution\":31,\"frequency\":\"MNTH\",\"payments\":[{\"debtorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE60760300800500123456\"},\"instructedAmount\":{\"currency\":\"EUR\",\"amount\":\"520.00\"},\"creditorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE15500105172295759744\"},\"creditorName\":\"WBG\",\"remittanceInformationUnstructured\":\"Ref.NumberWBG-1222\",\"requestedExecutionDate\":\"" + currentDate + "\"}]}", PeriodicPaymentInitiation.class);
Invocation.Builder invocationBuilder = target("/v1/periodic-payments/sepa-credit-transfers").request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", "PSD2TEST4");
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.buildPost(Entity.entity(periodicPaymentInitiation, MediaType.APPLICATION_JSON));
Response response = invocation.invoke(Response.class);
Assert.assertEquals(201, response.getStatus());
}
Aggregations