use of net.petafuel.styx.core.xs2a.factory.AISRequestFactory in project styx by petafuel.
the class AccountResource method processAccountList.
/**
* Returns a List of Accounts
*
* @param consentId consentId with access to the requested account list
* @return returns an account list
* @see AccountListResponseAdapter
*/
@AcceptsPreStepAuth
@GET
@Path("/accounts")
public Response processAccountList(@NotNull @NotBlank @HeaderParam("consentId") String consentId) throws BankRequestFailedException {
xs2AFactoryInput.setConsentId(consentId);
IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
ioProcessor.modifyInput(xs2AFactoryInput);
AISRequest accountListRequest = new AISRequestFactory().create(getXS2AStandard().getRequestClassProvider().accountList(), xs2AFactoryInput);
accountListRequest.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(accountListRequest, xs2AFactoryInput);
List<AccountDetails> accountList = getXS2AStandard().getAis().getAccountList(accountListRequest);
accountList.forEach(accountDetails -> accountDetails.setLinks(new AspspUrlMapper(accountDetails.getResourceId()).map(accountDetails.getLinks())));
LOG.info("Successfully fetched account list for bic={}", getXS2AStandard().getAspsp().getBic());
return Response.status(200).entity(new AccountListResponseAdapter(accountList)).build();
}
use of net.petafuel.styx.core.xs2a.factory.AISRequestFactory 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.xs2a.factory.AISRequestFactory 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.xs2a.factory.AISRequestFactory 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.xs2a.factory.AISRequestFactory 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