use of net.petafuel.styx.core.xs2a.entities.TransactionContainer in project styx by petafuel.
the class AccountResource method fetchTransactions.
/**
* This yields the transactions for the specified account. The amount of data varies heavily between banks
*
* @param consentId consent which has access to the transactions of the specified account
* @param accountId account that containes the requested transactions
* @param transactionListRequestBean QueryParams bookingStatus, dateFrom and dateTo
* @return TransactionContainer which holds the transactions/revenues grouped by booking status
* @throws BankRequestFailedException in case the Request to the Bank failed
*/
@AcceptsPreStepAuth
@GET
@Path("/accounts/{resourceId}/transactions")
public Response fetchTransactions(@NotNull @NotBlank @HeaderParam("consentId") String consentId, @NotNull @NotBlank @PathParam("resourceId") String accountId, @BeanParam @Valid TransactionListRequestBean transactionListRequestBean) throws BankRequestFailedException {
xs2AFactoryInput.setConsentId(consentId);
xs2AFactoryInput.setAccountId(accountId);
xs2AFactoryInput.setBookingStatus(transactionListRequestBean.getBookingStatus());
xs2AFactoryInput.setDateFrom(transactionListRequestBean.getDateFrom());
xs2AFactoryInput.setDateTo(transactionListRequestBean.getDateTo());
IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
ioProcessor.modifyInput(xs2AFactoryInput);
AISRequest readTransactionsRequest = new AISRequestFactory().create(getXS2AStandard().getRequestClassProvider().accountTransactionList(), xs2AFactoryInput);
readTransactionsRequest.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(readTransactionsRequest, xs2AFactoryInput);
TransactionContainer transactionContainer = getXS2AStandard().getAis().getTransactionsByAccount(readTransactionsRequest);
LOG.info("Successfully fetched transactions bic={}", getXS2AStandard().getAspsp().getBic());
TransactionListResponseAdapter transactionListResponseAdapter = new TransactionListResponseAdapter(transactionContainer);
return Response.status(200).entity(transactionListResponseAdapter).build();
}
use of net.petafuel.styx.core.xs2a.entities.TransactionContainer in project styx by petafuel.
the class Camt052Converter method processReport.
public TransactionContainer processReport(String xmlData) throws SEPAParsingException {
BankToCustomerAccountReportV02 originalReport = parseReport(xmlData);
TransactionContainer transactionContainer = new TransactionContainer();
transactionContainer.setTransactions(new AccountReport());
transactionContainer.getTransactions().setBooked(new ArrayList<>());
transactionContainer.getTransactions().setPending(new ArrayList<>());
transactionContainer.getTransactions().setInformation(new ArrayList<>());
for (AccountReport11 generalInfoAndTXNs : originalReport.getRpt()) {
for (ReportEntry2 transactionInfo : generalInfoAndTXNs.getNtry()) {
convertTransaction(transactionContainer.getTransactions(), transactionInfo);
}
}
return transactionContainer;
}
use of net.petafuel.styx.core.xs2a.entities.TransactionContainer 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.entities.TransactionContainer in project styx by petafuel.
the class Camt052ParserUnitTest method test.
@Test
void test() throws SEPAParsingException, IOException {
String camt052Response = IOUtils.toString(getClass().getResourceAsStream("camt052.xml"), Charset.defaultCharset());
Camt052Converter converter = new Camt052Converter();
TransactionContainer transactionContainer = converter.processReport(camt052Response);
Assertions.assertNotNull(transactionContainer);
}
Aggregations