use of uk.org.openbanking.datamodel.account.OBReadStandingOrder1 in project openbanking-aspsp by OpenBankingToolkit.
the class StandingOrdersApiController method getStandingOrders.
@Override
public ResponseEntity<OBReadStandingOrder2> getStandingOrders(@ApiParam(value = "The unique id of the ASPSP to which the request is issued. " + "The unique id will be issued by OB.", required = true) @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @ApiParam(value = "Page number.", required = false, defaultValue = "0") @RequestParam(value = "page", defaultValue = "0") String page, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "The time when the PSU last logged in with the TPP. All dates in the HTTP headers are " + "represented as RFC 7231 Full Dates. An example is below: Sun, 10 Sep 2017 19:43:31 UTC") @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @ApiParam(value = "The PSU's IP address if the PSU is currently logged in with the TPP.") @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @ApiParam(value = "Indicates the user-agent that the PSU is using.") @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
return RSEndpointWrapperService.<OBReadStandingOrder1>accountAndTransactionEndpoint().authorization(authorization).xFapiFinancialId(xFapiFinancialId).principal(principal).page(page).minimumPermissions(FRExternalPermissionsCode.READSTANDINGORDERSBASIC, FRExternalPermissionsCode.READSTANDINGORDERSDETAIL).execute((accountRequest, permissions, pageNumber) -> {
LOGGER.info("Reading standing orders with id {}", accountRequest.getAccountIds());
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.addAll("x-ob-account-ids", accountRequest.getAccountIds());
additionalHttpHeaders.addAll("x-ob-permissions", permissions.stream().map(FRExternalPermissionsCode::name).collect(Collectors.toList()));
additionalHttpHeaders.add("x-ob-url", new ServletServerHttpRequest(request).getURI().toString());
ParameterizedTypeReference<OBReadStandingOrder2> ptr = new ParameterizedTypeReference<OBReadStandingOrder2>() {
};
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, OBReadStandingOrder2.class);
});
}
use of uk.org.openbanking.datamodel.account.OBReadStandingOrder1 in project openbanking-aspsp by OpenBankingToolkit.
the class StatementsApiController method getStatements.
@Override
public ResponseEntity<OBReadStatement1> getStatements(@ApiParam(value = "The unique id of the ASPSP to which the request is issued. The unique id will be issued by OB.", required = true) @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @ApiParam(value = "Page number.", required = false, defaultValue = "0") @RequestParam(value = "page", defaultValue = "0") String page, @ApiParam(value = "The UTC ISO 8601 Date Time to filter statements FROM NB Time component is optional " + "- set to 00:00:00 for just Date. The parameter must NOT have a timezone set") @RequestParam(value = FROM_STATEMENT_DATE_TIME, required = false) DateTime fromStatementDateTime, @ApiParam(value = "The UTC ISO 8601 Date Time to filter statements TO NB Time component is optional " + "- set to 00:00:00 for just Date. The parameter must NOT have a timezone set") @RequestParam(value = TO_STATEMENT_DATE_TIME, required = false) DateTime toStatementDateTime, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "The time when the PSU last logged in with the TPP. " + "All dates in the HTTP headers are represented as RFC 7231 Full Dates. An example is below: " + "Sun, 10 Sep 2017 19:43:31 UTC") @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @ApiParam(value = "The PSU's IP address if the PSU is currently logged in with the TPP.") @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @ApiParam(value = "Indicates the user-agent that the PSU is using.") @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
return RSEndpointWrapperService.<OBReadStandingOrder1>accountAndTransactionEndpoint().authorization(authorization).xFapiFinancialId(xFapiFinancialId).principal(principal).page(page).minimumPermissions(FRExternalPermissionsCode.READSTATEMENTSBASIC, FRExternalPermissionsCode.READSTATEMENTSDETAIL).execute((accountRequest, permissions, pageNumber) -> {
LOGGER.info("Reading statements with id {}", accountRequest.getAccountIds());
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.addAll("x-ob-account-ids", accountRequest.getAccountIds());
additionalHttpHeaders.addAll("x-ob-permissions", permissions.stream().map(FRExternalPermissionsCode::name).collect(Collectors.toList()));
additionalHttpHeaders.add("x-ob-url", new ServletServerHttpRequest(request).getURI().toString());
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, OBReadStatement1.class);
});
}
use of uk.org.openbanking.datamodel.account.OBReadStandingOrder1 in project openbanking-aspsp by OpenBankingToolkit.
the class StandingOrdersApiController method getAccountStandingOrders.
@Override
public ResponseEntity<OBReadStandingOrder1> getAccountStandingOrders(@PathVariable("AccountId") String accountId, @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-permissions", required = true) List<OBExternalPermissions1Code> permissions, @RequestHeader(value = "x-ob-url", required = true) String httpUrl) {
LOGGER.info("Read standing orders for account {} with minimumPermissions {}", accountId, permissions);
Page<FRStandingOrder> standingOrdersResponse = frStandingOrderRepository.byAccountIdWithPermissions(accountId, toFRExternalPermissionsCodeList(permissions), PageRequest.of(page, PAGE_LIMIT_STANDING_ORDERS));
List<OBStandingOrder1> standingOrders = standingOrdersResponse.stream().map(so -> toOBStandingOrder1(so.getStandingOrder())).collect(Collectors.toList());
int totalPages = standingOrdersResponse.getTotalPages();
return ResponseEntity.ok(new OBReadStandingOrder1().data(new OBReadDataStandingOrder1().standingOrder(standingOrders)).links(PaginationUtil.generateLinks(httpUrl, page, totalPages)).meta(PaginationUtil.generateMetaData(totalPages)));
}
use of uk.org.openbanking.datamodel.account.OBReadStandingOrder1 in project openbanking-aspsp by OpenBankingToolkit.
the class StandingOrdersApiController method getStandingOrders.
@Override
public ResponseEntity<OBReadStandingOrder3> getStandingOrders(@ApiParam(value = "The unique id of the ASPSP to which the request is issued. " + "The unique id will be issued by OB.", required = true) @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @ApiParam(value = "Page number.", required = false, defaultValue = "0") @RequestParam(value = "page", defaultValue = "0") String page, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "The time when the PSU last logged in with the TPP. All dates in the HTTP headers are " + "represented as RFC 7231 Full Dates. An example is below: Sun, 10 Sep 2017 19:43:31 UTC") @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @ApiParam(value = "The PSU's IP address if the PSU is currently logged in with the TPP.") @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @ApiParam(value = "Indicates the user-agent that the PSU is using.") @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
return RSEndpointWrapperService.<OBReadStandingOrder1>accountAndTransactionEndpoint().authorization(authorization).xFapiFinancialId(xFapiFinancialId).principal(principal).page(page).minimumPermissions(FRExternalPermissionsCode.READSTANDINGORDERSBASIC, FRExternalPermissionsCode.READSTANDINGORDERSDETAIL).execute((accountRequest, permissions, pageNumber) -> {
LOGGER.info("Reading standing orders with id {}", accountRequest.getAccountIds());
HttpHeaders additionalHttpHeaders = new HttpHeaders();
additionalHttpHeaders.addAll("x-ob-account-ids", accountRequest.getAccountIds());
additionalHttpHeaders.addAll("x-ob-permissions", permissions.stream().map(FRExternalPermissionsCode::name).collect(Collectors.toList()));
additionalHttpHeaders.add("x-ob-url", new ServletServerHttpRequest(request).getURI().toString());
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, OBReadStandingOrder3.class);
});
}
use of uk.org.openbanking.datamodel.account.OBReadStandingOrder1 in project openbanking-aspsp by OpenBankingToolkit.
the class StatementsApiController method getAccountStatementFile.
@Override
public ResponseEntity<Resource> getAccountStatementFile(String statementId, String accountId, String page, String authorization, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
return rsEndpointWrapperService.<OBReadStandingOrder1>accountAndTransactionEndpoint().authorization(authorization).xFapiFinancialId(rsEndpointWrapperService.rsConfiguration.financialId).principal(principal).page(page).minimumPermissions(FRExternalPermissionsCode.READSTATEMENTSBASIC, FRExternalPermissionsCode.READSTATEMENTSDETAIL).execute((accountRequest, permissions, pageNumber) -> {
log.info("Reading statements file with id {}", accountRequest.getAccountIds());
HttpHeaders additionalHttpHeaders = new HttpHeaders();
return rsStoreGateway.toRsStore(request, additionalHttpHeaders, Resource.class);
});
}
Aggregations