use of uk.org.openbanking.datamodel.account.OBReadDataAccount1 in project openbanking-aspsp by OpenBankingToolkit.
the class AccountsApiController method getAccounts.
@Override
public ResponseEntity<OBReadAccount1> getAccounts(@RequestParam(value = "page", defaultValue = "0") int page, @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @RequestHeader(value = "Authorization", required = true) String authorization, @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, @RequestHeader(value = "x-ob-account-ids", required = true) List<String> accountIds, @RequestHeader(value = "x-ob-permissions", required = true) List<OBExternalPermissions1Code> permissions, @RequestHeader(value = "x-ob-url", required = true) String httpUrl) {
LOGGER.info("Read all accounts {} with minimumPermissions {}", accountIds, permissions);
List<FRAccount> frAccounts = frAccountRepository.byAccountIds(accountIds, toFRExternalPermissionsCodeList(permissions));
List<OBAccount1> accounts = frAccounts.stream().map(a -> toOBAccount1(a.getAccount())).collect(toList());
return ResponseEntity.ok(new OBReadAccount1().data(new OBReadDataAccount1().account(accounts)).links(PaginationUtil.generateLinksOnePager(httpUrl)).meta(PaginationUtil.generateMetaData(1)));
}
Aggregations