use of net.petafuel.styx.core.banklookup.sad.SAD in project styx by petafuel.
the class SADTest method testXS2AStandardInitialisationProduction.
@ParameterizedTest
@MethodSource("BICProvider")
@DisplayName("testXS2AStandardInitialisationProduction() -> Check if PRODUCTION XS2AStandards can be created for all available BICs in SAD")
public void testXS2AStandardInitialisationProduction(String bic) throws BankNotFoundException, BankLookupFailedException {
SAD sad = new SAD();
Aspsp bank = PersistentSAD.getByBIC(bic);
XS2AStandard xs2AStandard = sad.getBankByBIC(bic);
try {
Assertions.assertAll(() -> {
if (bank.getProductionUrl().getCommonUrl() == null) {
if (bank.getProductionUrl().getAisUrl() != null) {
Assert.assertTrue("AIS Url was specified but no Consent Service was initialized", xs2AStandard.isCSImplemented());
Assert.assertTrue("AIS Url was specified but no related Service was initialized", xs2AStandard.isAISImplemented());
}
if (bank.getProductionUrl().getPisUrl() != null) {
Assert.assertTrue("PIS Url was specified but no related Service was initialized", xs2AStandard.isPISImplemented());
}
if (bank.getProductionUrl().getPiisUrl() != null) {
Assert.assertTrue("PIIS Url was specified but no related Service was initialized", xs2AStandard.isPIISImplemented());
}
} else {
boolean atLeastOneServiceImplemented = false;
if ((xs2AStandard.isAISImplemented() && xs2AStandard.isCSImplemented()) || xs2AStandard.isPIISImplemented() || xs2AStandard.isPISImplemented()) {
atLeastOneServiceImplemented = true;
}
Assert.assertTrue("General Url was specified but no related Service was initialized", atLeastOneServiceImplemented);
}
});
} catch (MultipleFailuresError e) {
if (!bank.isActive()) {
System.err.println("Test failed for bic=" + bic + " but bank is deactivated in styx: ");
e.getFailures().forEach(throwable -> System.err.println(throwable.getMessage()));
Assert.assertTrue(true);
} else {
System.err.println("Test failed for bic=" + bic + ": " + e.getMessage());
e.getFailures().forEach(throwable -> System.err.println(throwable.getMessage()));
Assert.fail();
}
}
}
use of net.petafuel.styx.core.banklookup.sad.SAD in project styx by petafuel.
the class ConsorsAISTest method testTransactions.
@Test
@Order(4)
public void testTransactions() throws BankLookupFailedException, BankNotFoundException, ParseException, BankRequestFailedException {
XS2AStandard standard = (new SAD()).getBankByBIC(BIC, true);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date from = format.parse("2019-03-03");
Date to = new Date();
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setAccountId(ACCOUNT_ID);
xs2AFactoryInput.setConsentId(CONSENT);
xs2AFactoryInput.setBookingStatus("booked");
xs2AFactoryInput.setDateFrom(from);
xs2AFactoryInput.setDateTo(to);
AISRequest aisRequest = new AISRequestFactory().create(standard.getRequestClassProvider().accountTransactionList(), xs2AFactoryInput);
TransactionContainer result = standard.getAis().getTransactionsByAccount(aisRequest);
Assertions.assertNotNull(result);
Assertions.assertNotNull(result.getTransactions());
}
use of net.petafuel.styx.core.banklookup.sad.SAD in project styx by petafuel.
the class ConsorsAISTest method testBalances.
@Test
@Order(3)
public void testBalances() throws BankRequestFailedException, BankLookupFailedException, BankNotFoundException {
XS2AStandard standard = (new SAD()).getBankByBIC(BIC, true);
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setAccountId(ACCOUNT_ID);
xs2AFactoryInput.setConsentId(CONSENT);
AISRequest aisRequest = new AISRequestFactory().create(standard.getRequestClassProvider().accountBalances(), xs2AFactoryInput);
BalanceContainer result = standard.getAis().getBalancesByAccount(aisRequest);
Assertions.assertNotNull(result);
Assertions.assertTrue(result.getBalances().size() >= 1);
}
use of net.petafuel.styx.core.banklookup.sad.SAD in project styx by petafuel.
the class ConsorsAISTest method testAccountList.
@Test
@Order(1)
public void testAccountList() throws BankRequestFailedException, BankLookupFailedException, BankNotFoundException {
XS2AStandard standard = (new SAD()).getBankByBIC(BIC, true);
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setConsentId(CONSENT);
AISRequest aisRequest = new AISRequestFactory().create(standard.getRequestClassProvider().accountList(), xs2AFactoryInput);
aisRequest.setWithBalance(true);
List<AccountDetails> list = standard.getAis().getAccountList(aisRequest);
Assertions.assertTrue(list.size() >= 1);
}
use of net.petafuel.styx.core.banklookup.sad.SAD in project styx by petafuel.
the class ConsorsAISTest method testTransactionDetails.
@Test
@Order(5)
public void testTransactionDetails() throws BankRequestFailedException, BankLookupFailedException, BankNotFoundException {
XS2AStandard standard = (new SAD()).getBankByBIC(BIC, true);
XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
xs2AFactoryInput.setAccountId(ACCOUNT_ID);
xs2AFactoryInput.setTransactionId(TRANSACTION_ID);
xs2AFactoryInput.setConsentId(CONSENT);
AISRequest aisRequest = new AISRequestFactory().create(standard.getRequestClassProvider().accountTransactionDetails(), xs2AFactoryInput);
Transaction result = standard.getAis().getTransaction(aisRequest);
Assertions.assertNotNull(result);
Assertions.assertNotNull(result.getDebtorAccount());
}
Aggregations