Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: context in position handler #1116

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 13 additions & 91 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mojaloop/central-ledger",
"version": "17.9.0-iso.1",
"version": "17.9.0-snapshot.1",
"description": "Central ledger hosted by a scheme to record and settle transfers",
"license": "Apache-2.0",
"author": "ModusBox",
Expand Down Expand Up @@ -88,11 +88,11 @@
"@hapi/inert": "7.1.0",
"@hapi/joi": "17.1.1",
"@hapi/vision": "7.0.3",
"@mojaloop/central-services-error-handling": "13.0.1",
"@mojaloop/central-services-error-handling": "13.0.2",
"@mojaloop/central-services-health": "15.0.0",
"@mojaloop/central-services-logger": "11.5.1",
"@mojaloop/central-services-metrics": "12.0.8",
"@mojaloop/central-services-shared": "18.10.0",
"@mojaloop/central-services-shared": "18.10.1-snapshot.3",
"@mojaloop/central-services-stream": "11.3.1",
"@mojaloop/database-lib": "11.0.6",
"@mojaloop/event-sdk": "14.1.1",
Expand Down
3 changes: 2 additions & 1 deletion src/domain/position/abort.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ const _constructAbortResultMessage = (binItem, id, from, notifyTo) => {
binItem.message.value.content.headers, // Headers don't really matter here. ml-api-adapter will ignore them and create their own.
fspiopError,
{ id },
'application/json'
'application/json',
binItem.message.value.content.context
)

return resultMessage
Expand Down
9 changes: 6 additions & 3 deletions src/domain/position/fulfil.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ const _handleIncorrectTransferState = (binItem, payeeFsp, transferId, accumulate
headers,
fspiopError,
{ id: transferId },
'application/json'
'application/json',
binItem.message.value.content.context
)
}

Expand Down Expand Up @@ -197,7 +198,8 @@ const _constructTransferFulfilResultMessage = (binItem, transferId, payerFsp, pa
headers,
transfer,
{ id: transferId },
'application/json'
'application/json',
binItem.message.value.content.context
)

if (binItem.message.value.metadata.event.action === Enum.Events.Event.Action.RESERVE) {
Expand Down Expand Up @@ -249,7 +251,8 @@ const _constructPatchNotificationResultMessage = (binItem, cyrilResult) => {
headers,
fulfil,
{ id: commitRequestId },
'application/json'
'application/json',
binItem.message.value.content.context
)

messages.push(resultMessage)
Expand Down
6 changes: 4 additions & 2 deletions src/domain/position/fx-fulfil.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ const processPositionFxFulfilBin = async (
headers,
fspiopError,
{ id: commitRequestId },
'application/json'
'application/json',
binItem.message.value.content.context
)
} else {
// forward same headers from the prepare message, except the content-length header
Expand All @@ -101,7 +102,8 @@ const processPositionFxFulfilBin = async (
headers,
fxTransfer,
{ id: commitRequestId },
'application/json'
'application/json',
binItem.message.value.content.context
)

// No need to change the transfer state here for success case.
Expand Down
12 changes: 8 additions & 4 deletions src/domain/position/fx-prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ const processFxPositionPrepareBin = async (
headers,
fspiopError,
{ id: fxTransfer.commitRequestId },
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: false }
Expand Down Expand Up @@ -146,7 +147,8 @@ const processFxPositionPrepareBin = async (
headers,
fspiopError,
{ id: fxTransfer.commitRequestId },
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: false }
Expand Down Expand Up @@ -188,7 +190,8 @@ const processFxPositionPrepareBin = async (
headers,
fspiopError,
{ id: fxTransfer.commitRequestId },
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: false }
Expand Down Expand Up @@ -236,7 +239,8 @@ const processFxPositionPrepareBin = async (
headers,
fxTransfer,
{},
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: true }
Expand Down
3 changes: 2 additions & 1 deletion src/domain/position/fx-timeout-reserved.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ const _constructFxTimeoutReservedResultMessage = (binItem, commitRequestId, coun
binItem.message.value.content.headers, // Headers don't really matter here. ml-api-adapter will ignore them and create their own.
fspiopError,
{ id: commitRequestId },
'application/json'
'application/json',
binItem.message.value.content.context
)

return resultMessage
Expand Down
12 changes: 8 additions & 4 deletions src/domain/position/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ const processPositionPrepareBin = async (
headers,
fspiopError,
{ id: transfer.transferId },
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: false }
Expand Down Expand Up @@ -147,7 +148,8 @@ const processPositionPrepareBin = async (
headers,
fspiopError,
{ id: transfer.transferId },
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: false }
Expand Down Expand Up @@ -189,7 +191,8 @@ const processPositionPrepareBin = async (
headers,
fspiopError,
{ id: transfer.transferId },
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: false }
Expand Down Expand Up @@ -238,7 +241,8 @@ const processPositionPrepareBin = async (
headers,
transfer,
{},
'application/json'
'application/json',
binItem.message.value.content.context
)

binItem.result = { success: true }
Expand Down
3 changes: 2 additions & 1 deletion src/domain/position/timeout-reserved.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ const _constructTimeoutReservedResultMessage = (binItem, transferId, payeeFsp, p
binItem.message.value.content.headers, // Headers don't really matter here. ml-api-adapter will ignore them and create their own.
fspiopError,
{ id: transferId },
'application/json'
'application/json',
binItem.message.value.content.context
)

return resultMessage
Expand Down