use of net.petafuel.styx.api.v1.payment.entity.SinglePaymentInitiation in project styx by petafuel.
the class SinglePaymentInitiationResourceTest method initiateSinglePayment_Fiducia.
@Test
@Category(IntegrationTest.class)
@DisplayName("initiateSinglePayment_Fiducia -> Test json to XML conversion of payment initation request within styx to aspsp interface")
public void initiateSinglePayment_Fiducia() {
Invocation.Builder invocationBuilder = target("/v1/payments/sepa-credit-transfers").request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", "PSU-1234");
invocationBuilder.header("PSU-BIC", "GENODEF1M03");
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
invocationBuilder.header("redirectPreferred", true);
Jsonb jsonb = JsonbBuilder.create();
SinglePaymentInitiation singlePaymentInitiation = jsonb.fromJson("{\"payments\":[{\"debtorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE87200500001234567890\"},\"instructedAmount\":{\"currency\":\"EUR\",\"amount\":\"520.00\"},\"creditorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE23100120020123456789\"},\"creditorName\":\"WBG\",\"remittanceInformationUnstructured\":\"Ref.NumberWBG-1222\"}]}", SinglePaymentInitiation.class);
Invocation invocation = invocationBuilder.buildPost(Entity.entity(singlePaymentInitiation, MediaType.APPLICATION_JSON));
Response response = invocation.invoke(Response.class);
Assert.assertEquals(201, response.getStatus());
}
use of net.petafuel.styx.api.v1.payment.entity.SinglePaymentInitiation in project styx by petafuel.
the class SinglePaymentStatusResourceTest method getSparkasseSinglePaymentId.
private String getSparkasseSinglePaymentId() {
if (sparkasseSinglePaymentId == null) {
Invocation.Builder invocationBuilder = target("/v1/payments/sepa-credit-transfers").request();
invocationBuilder.header("token", pisAccessToken);
invocationBuilder.header("PSU-ID", "PSU-Successful");
invocationBuilder.header("PSU-BIC", SPARKASSE_BIC);
invocationBuilder.header("PSU-IP-Address", "192.168.8.78");
invocationBuilder.header("redirectPreferred", true);
Jsonb jsonb = JsonbBuilder.create();
SinglePaymentInitiation singlePaymentInitiation = jsonb.fromJson("{\"payments\":[{\"debtorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE86999999990000001000\"},\"instructedAmount\":{\"currency\":\"EUR\",\"amount\":\"520.00\"},\"creditorAccount\":{\"currency\":\"EUR\",\"iban\":\"DE75999999990000001004\"},\"creditorName\":\"WBG\",\"remittanceInformationUnstructured\":\"Ref.NumberWBG-1222\"}]}", SinglePaymentInitiation.class);
Invocation invocation = invocationBuilder.buildPost(Entity.entity(singlePaymentInitiation, MediaType.APPLICATION_JSON));
Response response = invocation.invoke(Response.class);
try {
PaymentResponse paymentResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), PaymentResponse.class);
sparkasseSinglePaymentId = paymentResponse.getPaymentId();
} catch (IOException e) {
return "";
}
}
return sparkasseSinglePaymentId;
}
use of net.petafuel.styx.api.v1.payment.entity.SinglePaymentInitiation in project styx by petafuel.
the class SparkassePISIntegrationTest method test_INIT_SCTSinglePayment_SCA_OAUTH.
@Category(IntegrationTest.class)
@ParameterizedTest
@ArgumentsSource(SparkassePSUProvider.class)
void test_INIT_SCTSinglePayment_SCA_OAUTH(String psuBic, String psuId, String creditorIban, String debtorIban) {
Assume.assumeNotNull(PIS_TOKEN);
SinglePayment singlePayment = new SinglePayment();
singlePayment.setDebtorAccount(new AccountReference(debtorIban, AccountReference.Type.IBAN));
singlePayment.setCreditorAccount(new AccountReference(creditorIban, AccountReference.Type.IBAN));
singlePayment.setInstructedAmount(new Amount("0.01"));
singlePayment.setCreditorName(psuId);
singlePayment.setRemittanceInformationUnstructured("Styx PIS Test unixstamp: " + new Date().getTime());
SinglePaymentInitiation singlePaymentInitiation = new SinglePaymentInitiation();
singlePaymentInitiation.setPayments(Collections.singletonList(singlePayment));
given().contentType(ContentType.JSON).header("token", PIS_TOKEN).header("psu-id", psuId).header("psu-bic", psuBic).header("redirectPreferred", "true").body(singlePaymentInitiation).post("/v1/payments/sepa-credit-transfers").then().assertThat().header("content-type", Matchers.containsString("application/json")).statusCode(201).body("transactionStatus", Matchers.is(TransactionStatus.RCVD.name())).body("paymentId", Matchers.notNullValue()).body("links.scaOAuth.href", Matchers.notNullValue());
}
use of net.petafuel.styx.api.v1.payment.entity.SinglePaymentInitiation in project styx by petafuel.
the class SparkassePISIntegrationTest method test_INIT_SCTSinglePayment_SCA_EMBEDDED.
@Category(IntegrationTest.class)
@ParameterizedTest
@ArgumentsSource(SparkassePSUProvider.class)
void test_INIT_SCTSinglePayment_SCA_EMBEDDED(String psuBic, String psuId, String creditorIban, String debtorIban) {
Assume.assumeNotNull(PIS_TOKEN);
SinglePayment singlePayment = new SinglePayment();
singlePayment.setDebtorAccount(new AccountReference(debtorIban, AccountReference.Type.IBAN));
singlePayment.setCreditorAccount(new AccountReference(creditorIban, AccountReference.Type.IBAN));
singlePayment.setInstructedAmount(new Amount("0.01"));
singlePayment.setCreditorName(psuId);
singlePayment.setRemittanceInformationUnstructured("Styx PIS Test unixstamp: " + new Date().getTime());
SinglePaymentInitiation singlePaymentInitiation = new SinglePaymentInitiation();
singlePaymentInitiation.setPayments(Collections.singletonList(singlePayment));
given().contentType(ContentType.JSON).header("token", PIS_TOKEN).header("psu-id", psuId).header("psu-bic", psuBic).header("redirectPreferred", "false").body(singlePaymentInitiation).post("/v1/payments/sepa-credit-transfers").then().assertThat().header("content-type", Matchers.containsString("application/json")).statusCode(201).body("transactionStatus", Matchers.is(TransactionStatus.RCVD.name())).body("paymentId", Matchers.notNullValue()).body("links.startAuthorisationWithPsuAuthentication.href", Matchers.notNullValue());
}
Aggregations