use of net.petafuel.styx.api.v1.account.control.AccountListResponseAdapter 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.api.v1.account.control.AccountListResponseAdapter in project styx by petafuel.
the class AccountResourceConsorsTest method A_testAccountList.
@Test
@Category(IntegrationTest.class)
public void A_testAccountList() {
Invocation.Builder invocationBuilder = target("/v1/accounts").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());
AccountListResponseAdapter accountListResponseAdapter = response.readEntity(AccountListResponseAdapter.class);
Assertions.assertNotNull(accountListResponseAdapter.getAccounts());
Assertions.assertNotNull(accountListResponseAdapter.getAccounts().get(0).getIban());
accountId = accountListResponseAdapter.getAccounts().get(0).getResourceId();
}
use of net.petafuel.styx.api.v1.account.control.AccountListResponseAdapter in project styx by petafuel.
the class AccountResourceFiduciaTest method A_testAccountList.
@Test
@Category(IntegrationTest.class)
public void A_testAccountList() {
Invocation.Builder invocationBuilder = target("/v1/accounts").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());
AccountListResponseAdapter accountListResponseAdapter = response.readEntity(AccountListResponseAdapter.class);
Assertions.assertNotNull(accountListResponseAdapter.getAccounts());
Assertions.assertNotNull(accountListResponseAdapter.getAccounts().get(0).getIban());
accountId = accountListResponseAdapter.getAccounts().get(0).getResourceId();
}
use of net.petafuel.styx.api.v1.account.control.AccountListResponseAdapter in project styx by petafuel.
the class AccountResourceTragoTest method A_testAccountList.
@Test
@Category(IntegrationTest.class)
public void A_testAccountList() {
Invocation.Builder invocationBuilder = target("/v1/accounts").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());
AccountListResponseAdapter accountListResponseAdapter = response.readEntity(AccountListResponseAdapter.class);
Assertions.assertNotNull(accountListResponseAdapter.getAccounts());
Assertions.assertNotNull(accountListResponseAdapter.getAccounts().get(0).getIban());
accountId = accountListResponseAdapter.getAccounts().get(0).getResourceId();
}
Aggregations