Skip to content

Commit

Permalink
bugfix/1085 Quote to Inactive Fsp (#91)
Browse files Browse the repository at this point in the history
- Proper generate request headers when from switch
  • Loading branch information
ggrg authored Dec 2, 2019
1 parent 8025f5f commit 8261ee3
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 59 deletions.
4 changes: 4 additions & 0 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"reject": [
]
}
2 changes: 1 addition & 1 deletion config/rules.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[]
[]
86 changes: 41 additions & 45 deletions package-lock.json

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

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "quoting-service",
"description": "Quoting Service hosted by a scheme",
"license": "Apache-2.0",
"version": "8.6.0-snapshot",
"version": "8.6.1-snapshot",
"author": "Modusbox",
"contributors": [
"James Bush <james.bush@modusbox.com>",
Expand Down Expand Up @@ -49,29 +49,29 @@
"@hapi/good": "8.2.4",
"@hapi/hapi": "18.4.0",
"@mojaloop/central-services-error-handling": "8.6.2",
"@mojaloop/central-services-logger": "8.1.2",
"@mojaloop/central-services-shared": "8.6.1",
"@mojaloop/central-services-logger": "8.5.2",
"@mojaloop/central-services-shared": "8.6.2",
"@mojaloop/event-sdk": "8.3.0",
"@mojaloop/ml-number": "8.2.0",
"axios": "0.19.0",
"blipp": "4.0.1",
"eslint-config-standard": "14.1.0",
"good-console": "8.0.0",
"good-squeeze": "5.1.0",
"hapi-openapi": "1.2.4",
"hapi-openapi": "1.2.6",
"json-rules-engine": "4.1.0",
"jsonpath": "1.0.2",
"knex": "0.20.2",
"knex": "0.20.3",
"memory-cache": "0.2.0",
"mysql": "2.17.1",
"node-fetch": "2.6.0",
"parse-strings-in-object": "1.2.0",
"rc": "1.2.8"
},
"devDependencies": {
"eslint": "6.7.1",
"eslint": "6.7.2",
"jest": "24.9.0",
"jest-junit": "9.0.0",
"jest-junit": "10.0.0",
"npm-audit-resolver": "2.1.0",
"npm-check-updates": "3.2.2",
"pre-commit": "1.2.2",
Expand Down
15 changes: 9 additions & 6 deletions src/model/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,23 +897,26 @@ class QuotesModel {
throw ErrorHandler.CreateFSPIOPError(ErrorHandler.Enums.FSPIOPErrorCodes.PARTY_NOT_FOUND, `No FSPIOP_CALLBACK_URL_QUOTES found for ${fspiopSource} unable to make error callback`, null, fspiopSource)
}

const fullCallbackUrl = `${endpoint}/quotes/${quoteId}/error`
const fspiopUri = `/quotes/${quoteId}/error`
const fullCallbackUrl = `${endpoint}${fspiopUri}`

// log the original error
this.writeLog(`Making error callback to participant '${fspiopSource}' for quoteId '${quoteId}' to ${fullCallbackUrl} for error: ${util.inspect(fspiopError.toFullErrorObject())}`)

// make an error callback
const fromSwitchHeaders = Object.assign({}, headers, {
'fspiop-destination': fspiopSource,
'fspiop-source': ENUM.Http.Headers.FSPIOP.SWITCH.value,
'fspiop-http-method': ENUM.Http.RestMethods.PUT,
'fspiop-uri': fspiopUri
})
let opts = {
method: ENUM.Http.RestMethods.PUT,
url: fullCallbackUrl,
data: JSON.stringify(fspiopError.toApiErrorObject(envConfig.errorHandling), LibUtil.getCircularReplacer()),
// use headers of the error object if they are there...
// otherwise use sensible defaults
headers: this.generateRequestHeaders(headers || {
'fspiop-destination': fspiopSource,
'fspiop-source': ENUM.Http.Headers.FSPIOP.SWITCH.value,
'fspiop-http-method': ENUM.Http.RestMethods.PUT
}, true)
headers: this.generateRequestHeaders(fromSwitchHeaders, true)
}

if (span) {
Expand Down

0 comments on commit 8261ee3

Please sign in to comment.