ml-testing-toolkit 18.17.0-snapshot.4 → 18.17.0-snapshot.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ml-testing-toolkit",
|
|
3
3
|
"description": "Testing Toolkit for Mojaloop implementations",
|
|
4
|
-
"version": "18.17.0-snapshot.
|
|
4
|
+
"version": "18.17.0-snapshot.7",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Vijaya Kumar Guthi, ModusBox Inc. ",
|
|
7
7
|
"contributors": [
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"adm-zip": "0.5.16",
|
|
89
89
|
"ajv-formats": "3.0.1",
|
|
90
90
|
"atob": "2.1.2",
|
|
91
|
-
"axios": "1.13.
|
|
91
|
+
"axios": "1.13.3",
|
|
92
92
|
"chai": "4.4.1",
|
|
93
93
|
"connection-string": "^5.0.0",
|
|
94
94
|
"cookie-parser": "1.4.7",
|
|
@@ -141,19 +141,27 @@ const handleTransferIlp = (context, response) => {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
customLogger.logMessage('debug', 'Generated callback body', { additionalData: { context, response }
|
|
144
|
+
customLogger.logMessage('debug', 'Generated callback body', { additionalData: { context, response } })
|
|
145
145
|
if (context.request.method === 'get' && response.method === 'put' && pathMatch.test(response.path)) {
|
|
146
|
+
customLogger.logMessage('debug', 'Returning stored fulfilment if exists for transfer GET')
|
|
146
147
|
const transferId = response.path.match(pathMatch)[1]
|
|
148
|
+
customLogger.logMessage('debug', 'Fetching stored transfer for fulfilment', { additionalData: { transferId } })
|
|
147
149
|
const storedTransfer = context.storedTransfers?.[transferId]
|
|
148
|
-
|
|
150
|
+
customLogger.logMessage('debug', 'Stored transfer fetched for fulfilment', { additionalData: { storedTransfer } })
|
|
149
151
|
// Check if stored request exists and is within 30 seconds
|
|
150
152
|
if (storedTransfer) {
|
|
151
153
|
if (storedTransfer.request.ilpPacket) {
|
|
154
|
+
customLogger.logMessage('debug', 'Stored transfer has ilpPacket. Generating fulfilment.', { additionalData: { transferId, ilpPacket: storedTransfer.request.ilpPacket } })
|
|
152
155
|
const generatedFulfilment = ilpObj.calculateFulfil(storedTransfer.request.ilpPacket).replace('"', '')
|
|
153
156
|
response.body.fulfilment = generatedFulfilment
|
|
157
|
+
customLogger.logMessage('debug', 'Fulfilment set in response body', { additionalData: { transferId, fulfilment: generatedFulfilment } })
|
|
154
158
|
} else if (storedTransfer.request.CdtTrfTxInf?.VrfctnOfTerms?.IlpV4PrepPacket) {
|
|
159
|
+
customLogger.logMessage('debug', 'Stored transfer has IlpV4PrepPacket. Generating fulfilment.', { additionalData: { transferId, IlpV4PrepPacket: storedTransfer.request.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket } })
|
|
155
160
|
const generatedFulfilment = ilpV4Obj.calculateFulfil(storedTransfer.request.CdtTrfTxInf.VrfctnOfTerms.IlpV4PrepPacket).replace('"', '')
|
|
156
161
|
response.body.TxInfAndSts.ExctnConf = generatedFulfilment
|
|
162
|
+
customLogger.logMessage('debug', 'ExctnConf set in response body', { additionalData: { transferId, ExctnConf: generatedFulfilment } })
|
|
163
|
+
} else {
|
|
164
|
+
customLogger.logMessage('warn', 'No ILP packet or IlpV4PrepPacket found in stored transfer request', { additionalData: { transferId, storedTransfer } })
|
|
157
165
|
}
|
|
158
166
|
delete context.storedTransfers[transferId]
|
|
159
167
|
} else {
|
|
@@ -319,15 +319,15 @@ const generateAsyncCallback = async (item, context, req) => {
|
|
|
319
319
|
}
|
|
320
320
|
} else {
|
|
321
321
|
// Store transfers early - right after validation
|
|
322
|
-
const transferPathMatch = /\/transfers
|
|
323
|
-
const fxTransferPathMatch = /\/fxTransfers
|
|
322
|
+
const transferPathMatch = /\/transfers(?:\/([^/]+))?$/
|
|
323
|
+
const fxTransferPathMatch = /\/fxTransfers(?:\/([^/]+))?$/
|
|
324
324
|
customLogger.logMessage('debug', 'Processing transfer request', { additionalData: { method: req.method, path: req.path }, request: req })
|
|
325
325
|
if (req.method === 'post' && (transferPathMatch.test(req.path) || fxTransferPathMatch.test(req.path))) {
|
|
326
326
|
if (!context.storedTransfers) {
|
|
327
327
|
context.storedTransfers = {}
|
|
328
328
|
}
|
|
329
329
|
const isFxTransfer = fxTransferPathMatch.test(req.path)
|
|
330
|
-
const transferId = req.
|
|
330
|
+
const transferId = (req.payload && req.payload.transferId) || (req.payload && req.payload.commitRequestId)
|
|
331
331
|
customLogger.logMessage('debug', 'Storing transfer for validation', { additionalData: { transferId }, request: req })
|
|
332
332
|
|
|
333
333
|
context.storedTransfers[transferId] = {
|