use of net.petafuel.styx.api.v1.account.control.TransactionListResponseAdapter 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.api.v1.account.control.TransactionListResponseAdapter in project styx by petafuel.
the class AccountResourceConsorsTest method testAccountTransactions.
@Test
@Category(IntegrationTest.class)
public void testAccountTransactions() {
Invocation.Builder invocationBuilder = target("/v1/accounts/" + accountId + "/transactions").queryParam("dateFrom", "2019-01-01").queryParam("bookingStatus", "booked").request();
invocationBuilder.header("token", aisAccessToken);
invocationBuilder.header("PSU-BIC", BIC);
invocationBuilder.header("consentId", consentId);
Invocation invocation = invocationBuilder.buildGet();
Response response = invocation.invoke(Response.class);
Assertions.assertEquals(200, response.getStatus());
TransactionListResponseAdapter accountDetails = response.readEntity(TransactionListResponseAdapter.class);
if (accountDetails.getTransactions() != null) {
accountDetails.getTransactions().forEach(transactionAdapted -> {
Assertions.assertNotNull(transactionAdapted.getBookingStatus());
Assertions.assertNotNull(transactionAdapted.getTransactionAmount());
Assertions.assertNotNull(transactionAdapted.getTransactionAmount().getAmount());
Assertions.assertNotNull(transactionAdapted.getBookingDate());
Assertions.assertNotNull(transactionAdapted.getValueDate());
Assertions.assertNotNull(transactionAdapted.getPurpose());
});
}
}
use of net.petafuel.styx.api.v1.account.control.TransactionListResponseAdapter in project styx by petafuel.
the class AccountResourceTragoTest method testAccountTransactions.
@Test
@Category(IntegrationTest.class)
public void testAccountTransactions() {
Invocation.Builder invocationBuilder = target("/v1/accounts/" + accountId + "/transactions").queryParam("dateFrom", "2019-01-01").queryParam("bookingStatus", "booked").request();
invocationBuilder.header("token", aisAccessToken);
invocationBuilder.header("PSU-BIC", BIC);
invocationBuilder.header("consentId", consentId);
invocationBuilder.header("X-STYX-X-bvpsd2-test-apikey", targobankToken);
Invocation invocation = invocationBuilder.buildGet();
Response response = invocation.invoke(Response.class);
Assertions.assertEquals(200, response.getStatus());
TransactionListResponseAdapter accountDetails = response.readEntity(TransactionListResponseAdapter.class);
if (accountDetails.getTransactions() != null) {
accountDetails.getTransactions().forEach(transactionAdapted -> {
Assertions.assertNotNull(transactionAdapted.getBookingStatus());
Assertions.assertNotNull(transactionAdapted.getTransactionAmount());
Assertions.assertNotNull(transactionAdapted.getTransactionAmount().getAmount());
Assertions.assertNotNull(transactionAdapted.getBookingDate());
Assertions.assertNotNull(transactionAdapted.getValueDate());
Assertions.assertNotNull(transactionAdapted.getPurpose());
});
}
}
use of net.petafuel.styx.api.v1.account.control.TransactionListResponseAdapter in project styx by petafuel.
the class AccountResourceFiduciaTest method testAccountTransactions.
@Test
@Category(IntegrationTest.class)
public void testAccountTransactions() {
Invocation.Builder invocationBuilder = target("/v1/accounts/" + accountId + "/transactions").queryParam("dateFrom", "2019-01-01").queryParam("bookingStatus", "booked").request();
invocationBuilder.header("token", aisAccessToken);
invocationBuilder.header("PSU-BIC", BIC);
invocationBuilder.header("consentId", consentId);
Invocation invocation = invocationBuilder.buildGet();
Response response = invocation.invoke(Response.class);
Assertions.assertEquals(200, response.getStatus());
TransactionListResponseAdapter accountDetails = response.readEntity(TransactionListResponseAdapter.class);
if (accountDetails.getTransactions() != null) {
accountDetails.getTransactions().forEach(transactionAdapted -> {
Assertions.assertNotNull(transactionAdapted.getBookingStatus());
Assertions.assertNotNull(transactionAdapted.getTransactionAmount());
Assertions.assertNotNull(transactionAdapted.getTransactionAmount().getAmount());
Assertions.assertNotNull(transactionAdapted.getBookingDate());
Assertions.assertNotNull(transactionAdapted.getValueDate());
Assertions.assertNotNull(transactionAdapted.getPurpose());
});
}
}
Aggregations