@mojaloop/sdk-scheme-adapter 24.10.2 → 24.10.3

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/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  # Changelog: [mojaloop/sdk-scheme-adapter](https://github.com/mojaloop/sdk-scheme-adapter)
2
+ ### [24.10.3](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.10.2...v24.10.3) (2025-06-26)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * add logic to transform iso to fspiop for payee notif ([#569](https://github.com/mojaloop/sdk-scheme-adapter/issues/569)) ([019a652](https://github.com/mojaloop/sdk-scheme-adapter/commit/019a652390569fc8d3ce6bd9237c27bd4fa2e81f))
8
+
2
9
  ### [24.10.2](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.10.1...v24.10.2) (2025-06-17)
3
10
 
4
11
 
@@ -714,6 +714,12 @@ const putTransfersById = async (ctx) => {
714
714
  * Handles a PATCH /transfers/{ID} from the Switch to Payee for successful transfer
715
715
  */
716
716
  const patchTransfersById = async (ctx) => {
717
+ if (ctx.state.conf.isIsoApi) {
718
+ ctx.state.logger.isDebugEnabled && ctx.state.logger.push(ctx.request.body).debug('Transforming incoming ISO20022 patch transfers body to FSPIOP');
719
+ const target = await TransformFacades.FSPIOPISO20022.transfers.patch({ body: ctx.request.body }, { rollUpUnmappedAsExtensions: true });
720
+ ctx.request.body = target.body;
721
+ }
722
+
717
723
  const req = {
718
724
  headers: { ...ctx.request.headers },
719
725
  data: { ...ctx.request.body }
@@ -443,5 +443,36 @@
443
443
  "Ustrd": "Payment for invoice 12345"
444
444
  }
445
445
  }
446
+ },
447
+ "patchTransfersRequest": {
448
+ "GrpHdr": {
449
+ "MsgId": "01JB251SPSN3NERYQ78MREHP9X",
450
+ "CreDtTm": "2024-10-25T15:34:49.305Z"
451
+ },
452
+ "TxInfAndSts": {
453
+ "StsId": "01JB251SPTD685SBNWGG9KVH58",
454
+ "OrgnlInstrId": "undefined",
455
+ "OrgnlEndToEndId": "undefined",
456
+ "OrgnlTxId": "01JB251RGPWJ31SEWCZQCQCSHE",
457
+ "OrgnlUETR": "123e4567-e89b-12d3-a456-426614174000",
458
+ "TxSts": "COMM",
459
+ "StsRsnInf": {
460
+ "Rsn": {
461
+ "Prtry": "COMM"
462
+ },
463
+ "AddtlInf": "ADDITIONAL"
464
+ },
465
+ "AccptncDtTm": "2024-10-25T15:34:49.305Z",
466
+ "PrcgDt": {
467
+ "DtTm": "2024-10-25T15:34:49.305Z"
468
+ },
469
+ "AcctSvcrRef": "ACCTSVCRREF",
470
+ "ClrSysRef": "CLRSYSREF",
471
+ "ExctnConf": "yc8z3j2C5RQofE0XEP5acBylI-hzWK7Zo6KMw2cxElk",
472
+ "SplmtryData": {
473
+ "PlcAndNm": "PLACE",
474
+ "Envlp": {}
475
+ }
476
+ }
446
477
  }
447
478
  }
@@ -284,6 +284,49 @@ describe('Inbound API handlers transforming incoming ISO20022 message bodies', (
284
284
  });
285
285
  });
286
286
 
287
+ describe('PATCH /transfers/{ID}', () => {
288
+ let mockContext;
289
+
290
+ beforeEach(() => {
291
+ mockContext = {
292
+ request: {
293
+ body: isoBodies.patchTransfersRequest,
294
+ headers: {
295
+ 'fspiop-source': 'foo',
296
+ 'content-type': createIsoHeader('transfers')
297
+ }
298
+ },
299
+ response: {},
300
+ state: {
301
+ conf: {
302
+ isIsoApi: true,
303
+ },
304
+ path: {
305
+ params: {
306
+ 'ID': '1234567890'
307
+ }
308
+ },
309
+ logger,
310
+ cache: {
311
+ publish: jest.fn(() => Promise.resolve(true))
312
+ }
313
+ }
314
+ };
315
+
316
+ });
317
+
318
+ test('calls `prepareTransfer` with the expected arguments.', async () => {
319
+ const transferRequestSpy = jest.spyOn(Model.prototype, 'sendNotificationToPayee');
320
+
321
+ await expect(handlers['/transfers/{ID}'].patch(mockContext)).resolves.toBe(undefined);
322
+
323
+ expect(transferRequestSpy).toHaveBeenCalledTimes(1);
324
+ expect(transferRequestSpy.mock.calls[0][0]).not.toBeUndefined();
325
+ expect(transferRequestSpy.mock.calls[0][0]).not.toEqual(isoBodies.patchTransfersRequest);
326
+ expect(transferRequestSpy.mock.calls[0][0].transferState).toBe('COMMITTED');
327
+ });
328
+ });
329
+
287
330
  describe('POST /fxQuotes Tests', () => {
288
331
  let mockContext;
289
332
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "24.10.2",
3
+ "version": "24.10.3",
4
4
  "description": "mojaloop sdk-scheme-adapter",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter",