Skip to content

Commit

Permalink
chore: address follow up iso comments (#385)
Browse files Browse the repository at this point in the history
* chore: address follow up iso comments

* chore: bump deps for date validation
  • Loading branch information
kleyow authored Jan 20, 2025
1 parent d781c2a commit 012907e
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 119 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,7 @@ Event objects must have a type property, and an optional params property. There
```
## Additional Notes

N/A
- Since the first pass ISO20022 support doesn't cover all resources at this time
`api-swagger-iso20022-parties.yaml` still uses fspiop for resources that
weren't in the iso scope on the first pass example `/bulkQuotes`.
This is to ensure no regression for resources that aren't yet covered.
126 changes: 65 additions & 61 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@
"@hapi/inert": "7.1.0",
"@hapi/vision": "7.0.3",
"@mojaloop/central-services-error-handling": "13.0.3",
"@mojaloop/central-services-health": "15.0.0",
"@mojaloop/central-services-health": "15.0.1",
"@mojaloop/central-services-logger": "11.5.2",
"@mojaloop/central-services-metrics": "12.4.3",
"@mojaloop/central-services-shared": "18.15.1",
"@mojaloop/central-services-shared": "18.15.2",
"@mojaloop/central-services-stream": "11.4.2",
"@mojaloop/event-sdk": "14.1.2",
"@mojaloop/inter-scheme-proxy-cache-lib": "2.3.1",
Expand Down
10 changes: 8 additions & 2 deletions src/handlers/QuotingHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ class QuotingHandler {

try {
span = await this.createSpan(requestData)
await model.handleQuoteRequest(headers, payload, span, this.cache, originalPayload)
await model.handleQuoteRequest({
headers,
quoteRequest: payload,
span,
cache: this.cache,
originalPayload
})
this.logger.debug('handlePostQuotes is done')
} catch (err) {
this.logger.error(`error in handlePostQuotes partition:${requestData.partition}, offset:${requestData.offset}:`, err)
Expand All @@ -97,7 +103,7 @@ class QuotingHandler {
span = await this.createSpan(requestData)
const result = isError
? await model.handleQuoteError(headers, quoteId, payload.errorInformation, span, originalPayload)
: await model.handleQuoteUpdate(headers, quoteId, payload, span, originalPayload)
: await model.handleQuoteUpdate({ headers, quoteId, payload, span, originalPayload })
this.logger.debug('handlePutQuotes is done', { result })
} catch (err) {
this.logger.error(`error in handlePutQuotes partition:${requestData.partition}, offset:${requestData.offset}:`, err)
Expand Down
3 changes: 1 addition & 2 deletions src/model/fxQuotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ class FxQuotesModel {
*
* @returns {undefined}
*/
async handleFxQuoteRequest (headers, fxQuoteRequest, span, originalPayload = fxQuoteRequest, cache) {
// todo: remove default value for originalPayload (added just for passing tests)
async handleFxQuoteRequest (headers, fxQuoteRequest, span, originalPayload, cache) {
const histTimer = Metrics.getHistogram(
'model_fxquote',
'handleFxQuoteRequest - Metrics for fx quote model',
Expand Down
6 changes: 2 additions & 4 deletions src/model/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ class QuotesModel {
*
* @returns {object} - returns object containing keys for created database entities
*/
async handleQuoteRequest (headers, quoteRequest, span, cache, originalPayload) {
// todo: update method signature to use object destructuring
async handleQuoteRequest ({ headers, quoteRequest, span, cache, originalPayload }) {
const histTimer = Metrics.getHistogram(
'model_quote',
'handleQuoteRequest - Metrics for quote model',
Expand Down Expand Up @@ -542,8 +541,7 @@ class QuotesModel {
*
* @returns {object} - object containing updated entities
*/
async handleQuoteUpdate (headers, quoteId, payload, span, originalPayload) {
// todo: update method signature to use object destructuring
async handleQuoteUpdate ({ headers, quoteId, payload, span, originalPayload }) {
const histTimer = Metrics.getHistogram(
'model_quote',
'handleQuoteUpdate - Metrics for quote model',
Expand Down
2 changes: 1 addition & 1 deletion test/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ const headersDto = ({
} = {}) => Object.freeze({
accept: interoperabilityHeaderDto(resource, version, isIsoApi),
'content-type': interoperabilityHeaderDto(resource, version, isIsoApi),
date: new Date().toISOString(),
date: new Date().toUTCString(),
'fspiop-source': source,
'fspiop-destination': destination
})
Expand Down
Loading

0 comments on commit 012907e

Please sign in to comment.