Skip to content

Commit

Permalink
Added PUT /payeefsp/participants/{type}/{id} (#23)
Browse files Browse the repository at this point in the history
* documentation fix

* version update

* fix for incorrect cache getting deleted

* added PUT /payeefsp/participants/{type}/{id} to the simulator so that the payeefsp can add participants
  • Loading branch information
rmothilal authored May 22, 2019
1 parent 05f42bb commit 5c41861
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sims",
"version": "6.2.4",
"version": "6.2.5",
"description": "A super-simple fsp simulator",
"main": "src/index.js",
"author": "ModusBox",
Expand Down
26 changes: 26 additions & 0 deletions src/payee/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@ exports.metadata = function (request, h) {
}).code(200)
}

// Section about /participants
exports.putParticipantsByTypeId = function (request, h) {
const histTimerEnd = Metrics.getHistogram(
'sim_request',
'Histogram for Simulator http operations',
['success', 'fsp', 'operation', 'source', 'destination']
).startTimer()

// Logger.perf(`[cid=${request.payload.transferId}, fsp=${request.headers['fspiop-source']}, source=${request.headers['fspiop-source']}, dest=${request.headers['fspiop-destination']}] ~ Simulator::api::payer::putParticipantsByTypeId - START`)

Logger.info(`IN PAYEEFSP:: PUT /payeefsp/participants/${request.params.id}, PAYLOAD: [${JSON.stringify(request.payload)}]`)

// Saving Incoming request
let incomingRequest = {
headers: request.headers,
data: request.payload
}
callbacks.set(request.params.id, incomingRequest)

myCache.set(request.params.id, request.payload)

// Logger.perf(`[cid=${request.payload.transferId}, fsp=${request.headers['fspiop-source']}, source=${request.headers['fspiop-source']}, dest=${request.headers['fspiop-destination']}] ~ Simulator::api::payer::putParticipantsByTypeId - END`)
histTimerEnd({ success: true, fsp: 'payee', operation: 'putParticipantsByTypeId', source: request.headers['fspiop-source'], destination: request.headers['fspiop-destination'] })
return h.response().code(200)
}

exports.postPartiesByTypeAndId = function (request, h) {
const histTimerEnd = Metrics.getHistogram(
'sim_request',
Expand Down
9 changes: 9 additions & 0 deletions src/payee/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ module.exports = [
description: 'Metadata'
}
},
{
method: 'PUT',
path: '/payeefsp/participants/{type}/{id}',
handler: Handler.putParticipantsByTypeId,
options: {
tags: tags,
description: 'Callback for adding participant'
}
},
{
method: 'POST',
path: '/payeefsp/parties/{type}/{id}',
Expand Down

0 comments on commit 5c41861

Please sign in to comment.