use of net.petafuel.styx.core.ioprocessing.IOParser in project styx by petafuel.
the class STYX10UnitTest method test_STYX10_with_austrian_bank.
@Test
void test_STYX10_with_austrian_bank() throws ImplementerOptionException {
uniCredit.setBic(TEST_BIC_AT);
Assume.assumeNotNull(uniCredit);
Assume.assumeNotNull(styx10Option);
styx10Option.setOptions(Collections.singletonMap("required", true));
uniCredit.getConfig().setImplementerOptions(Collections.singletonMap("STYX10", styx10Option));
IOParser ioParser = new IOParser(uniCredit);
STYX10 styx10 = new STYX10(ioParser);
Assertions.assertEquals(IOOrder.POST_CREATION, styx10.order());
Assertions.assertFalse(styx10.apply(null, null, null));
XS2ARequest xs2ARequest = new XS2ARequest() {
@Override
public Optional<String> getRawBody() {
return Optional.empty();
}
@Override
public BasicService.RequestType getHttpMethod() {
return BasicService.RequestType.GET;
}
@Override
public String getServicePath() {
return "";
}
};
PSU psu = new PSU("bgdemo");
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setPsu(psu);
Assertions.assertTrue(styx10.apply(xs2AFactoryInput, xs2ARequest, null));
Assertions.assertNotNull(xs2ARequest.getHeaders().get(XS2AHeader.PSU_ID_TYPE));
Assertions.assertEquals("24YOU", xs2ARequest.getHeaders().get(XS2AHeader.PSU_ID_TYPE));
}
use of net.petafuel.styx.core.ioprocessing.IOParser in project styx by petafuel.
the class IO2UnitTest method testApplyJsonWithValidData.
@Test
void testApplyJsonWithValidData() throws ImplementerOptionException {
io2Option.setOptions(Collections.singletonMap(PaymentProduct.SEPA_CREDIT_TRANSFERS.getValue(), true));
aspsp.getConfig().setImplementerOptions(Collections.singletonMap("IO2", io2Option));
IOParser ioParser = new IOParser(aspsp);
IO2 io2 = new IO2(ioParser);
Assertions.assertEquals(IOOrder.PRE_CREATION, io2.order());
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setPaymentService(PaymentService.PERIODIC_PAYMENTS);
Assertions.assertFalse(io2.apply(xs2AFactoryInput, null, null));
xs2AFactoryInput.setPaymentService(PaymentService.PAYMENTS);
xs2AFactoryInput.setPaymentProduct(PaymentProduct.SEPA_CREDIT_TRANSFERS);
Assertions.assertTrue(io2.apply(xs2AFactoryInput, null, null));
Assertions.assertEquals(PaymentProduct.SEPA_CREDIT_TRANSFERS, xs2AFactoryInput.getPaymentProduct());
}
use of net.petafuel.styx.core.ioprocessing.IOParser in project styx by petafuel.
the class STYX04UnitTest method test_STYX04_config_is_false.
@Test
void test_STYX04_config_is_false() throws ImplementerOptionException {
Assume.assumeNotNull(sparda);
Assume.assumeNotNull(styx04Option);
styx04Option.setOptions(Collections.singletonMap("required", false));
sparda.getConfig().setImplementerOptions(Collections.singletonMap("STYX04", styx04Option));
IOParser ioParser = new IOParser(sparda);
STYX04 styx04 = new STYX04(ioParser);
Assertions.assertEquals(IOOrder.POST_CREATION, styx04.order());
XS2ARequest anonymouseRequest = new XS2ARequest() {
@Override
public Optional<String> getRawBody() {
return Optional.empty();
}
@Override
public BasicService.RequestType getHttpMethod() {
return BasicService.RequestType.GET;
}
@Override
public String getServicePath() {
return "";
}
};
styx04.apply(null, anonymouseRequest, null);
Assertions.assertNull(anonymouseRequest.getHeaders().get("X-BIC"));
}
Aggregations