GetAccountStatementFile: 501 Not Implemented
jsanhc opened this issue · 2 comments
jsanhc commented
Description
- When
GetAccountStatementFile
is called the api respond with501 Not Implemented
. - A PDF has been provided by the customer and configured on the sandbox, this file is loaded from the classpath and the path to find the pdf file is defined by the spring configuration profile name.
See https://github.com/ForgeCloud/ob-deploy/issues/756
Old references
Analysis
Only file type PDF is implemented for that operation, see the below piece of source in the implementation StatementsApiController#getAccountStatementFile
in aspsp.
log.info("Received a statement file download request for account: {} (Accept: {}). Interaction Id: {}", accountId, accept, xFapiInteractionId);
if (!accept.contains(MediaType.APPLICATION_PDF_VALUE)) {
// Mo other file type is implemented apart from PDF
return new ResponseEntity<Resource>(HttpStatus.NOT_IMPLEMENTED);
}
The request must made for the media type PDF.
In other side if the statement requested doesn't exist the operation response with no implemented again and this is confuse for the consumer.
// Check if this cusotmer has a statement file
Optional<Resource> statement = statementPDFService.getPdfStatement();
if (statement.isPresent()) {
return ResponseEntity.ok()
.contentLength(getContentLength(statement.get()))
.contentType(MediaType.APPLICATION_PDF)
.body(statement.get());
}
return new ResponseEntity<Resource>(HttpStatus.NOT_IMPLEMENTED);
Tasks
- Change the responses with a clearer message instead of
not implemented
- Issue 28
jsanhc commented
- From documentation: https://openbankinguk.github.io/read-write-api-site3/v3.1.6/resources-and-data-models/aisp/Statements.html#data-model
The call to
GET /accounts/{AccountId}/statements/{StatementId}/file
will return unstructured data in binary (e.g., pdf, doc) or text (e.g., csv) formats.
This will be specified in the Accept header by the AISP.
jsanhc commented
Responses
{
"Code": "OBRI.Request.Invalid",
"Id": "041846bea13a820b",
"Message": "An error happened when parsing the request arguments",
"Errors": [
{
"ErrorCode": "UK.OBIE.Header.Invalid",
"Message": "Invalid header 'accept' the only supported value for this operation is application/pdf",
"Url": "https://docs.dev-ob.forgerock.financial:8074/errors#UK.OBIE.Header.Invalid"
}
]
}
- 404 Not found