use of net.petafuel.styx.api.v1.account.entity.AccountDetailResponse in project styx by petafuel.
the class AccountResource method getAccountDetails.
/**
* Returns AccountDetails for a single account
*
* @param accountId the xs2a account id
* @return returns an account object
* @see AccountDetails
*/
@AcceptsPreStepAuth
@GET
@Path("/accounts/{resourceId}")
public Response getAccountDetails(@NotNull @NotBlank @HeaderParam("consentId") String consentId, @NotNull @NotBlank @PathParam("resourceId") String accountId) throws BankRequestFailedException {
xs2AFactoryInput.setConsentId(consentId);
xs2AFactoryInput.setAccountId(accountId);
IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
ioProcessor.modifyInput(xs2AFactoryInput);
AISRequest accountDetailsRequest = new AISRequestFactory().create(getXS2AStandard().getRequestClassProvider().accountDetails(), xs2AFactoryInput);
accountDetailsRequest.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(accountDetailsRequest, xs2AFactoryInput);
AccountDetails account = getXS2AStandard().getAis().getAccount(accountDetailsRequest);
account.setLinks(new AspspUrlMapper(account.getResourceId()).map(account.getLinks()));
LOG.info("Successfully fetched account details bic={}", getXS2AStandard().getAspsp().getBic());
return Response.status(200).entity(new AccountDetailResponse(account)).build();
}
Aggregations