@mojaloop/sdk-scheme-adapter 24.0.5 → 24.0.7-snapshot.4

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.
Files changed (25) hide show
  1. package/.circleci/config.yml +2 -2
  2. package/.yarn/cache/@mojaloop-central-services-error-handling-npm-13.0.5-8f87cae1ef-504635a52b.zip +0 -0
  3. package/.yarn/cache/{@types-node-npm-22.13.0-ce5ef5ab7c-934122ad4c.zip → @types-node-npm-22.13.1-f9de886009-a0759e4bed.zip} +0 -0
  4. package/.yarn/cache/{@typescript-eslint-eslint-plugin-npm-8.22.0-3ffeac3a34-f5e2fdea36.zip → @typescript-eslint-eslint-plugin-npm-8.23.0-b3e7a7136e-b7dd9cbba9.zip} +0 -0
  5. package/.yarn/cache/{@typescript-eslint-parser-npm-8.22.0-024bd80eca-1c5923d76e.zip → @typescript-eslint-parser-npm-8.23.0-798a01aba9-3a17e8c4f1.zip} +0 -0
  6. package/.yarn/cache/@typescript-eslint-scope-manager-npm-8.23.0-437414802f-cb2772a1f4.zip +0 -0
  7. package/.yarn/cache/{@typescript-eslint-type-utils-npm-8.22.0-318d6614d2-1edc3bffc2.zip → @typescript-eslint-type-utils-npm-8.23.0-3e68bceaa0-523e333dd1.zip} +0 -0
  8. package/.yarn/cache/@typescript-eslint-types-npm-8.23.0-972ca6e315-6f3b0f5718.zip +0 -0
  9. package/.yarn/cache/@typescript-eslint-typescript-estree-npm-8.23.0-1907506b84-16ccabac25.zip +0 -0
  10. package/.yarn/cache/@typescript-eslint-utils-npm-8.23.0-ab8e41bb24-fba721abac.zip +0 -0
  11. package/.yarn/cache/@typescript-eslint-visitor-keys-npm-8.23.0-7428536446-20196da5f2.zip +0 -0
  12. package/.yarn/cache/ts-api-utils-npm-2.0.1-03c1d3773a-ca31f4dc3c.zip +0 -0
  13. package/.yarn/install-state.gz +0 -0
  14. package/CHANGELOG.md +7 -0
  15. package/docker-compose.pm4ml.yml +0 -2
  16. package/docker-compose.yml +0 -1
  17. package/modules/api-svc/package.json +2 -2
  18. package/modules/api-svc/src/lib/model/OutboundTransfersModel.js +31 -2
  19. package/modules/api-svc/src/lib/model/common/Enums.js +1 -1
  20. package/modules/api-svc/test/unit/lib/model/data/defaultConfig.json +2 -1
  21. package/modules/outbound-command-event-handler/package.json +4 -4
  22. package/modules/outbound-domain-event-handler/package.json +4 -4
  23. package/modules/private-shared-lib/package-lock.json +2 -2
  24. package/modules/private-shared-lib/package.json +4 -4
  25. package/package.json +4 -4
@@ -1,12 +1,12 @@
1
1
  version: 2.1
2
2
  setup: true
3
3
  orbs:
4
- build: mojaloop/build@1.0.37
4
+ build: mojaloop/build@1.0.53
5
5
  workflows:
6
6
  setup:
7
7
  jobs:
8
8
  - build/workflow:
9
+ context: org-global
9
10
  filters:
10
11
  tags:
11
12
  only: /v\d+(\.\d+){2}(-[a-zA-Z-][0-9a-zA-Z-]*\.\d+)?/
12
-
Binary file
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  # Changelog: [mojaloop/sdk-scheme-adapter](https://github.com/mojaloop/sdk-scheme-adapter)
2
+ ### [24.0.6](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.0.5...v24.0.6) (2025-02-04)
3
+
4
+
5
+ ### Chore
6
+
7
+ * update build orb version to 1.0.50 ([#541](https://github.com/mojaloop/sdk-scheme-adapter/issues/541)) ([78a78c9](https://github.com/mojaloop/sdk-scheme-adapter/commit/78a78c98e392ba0dd932ab192c4b4a4f0e9fc1ae))
8
+
2
9
  ### [24.0.5](https://github.com/mojaloop/sdk-scheme-adapter/compare/v24.0.4...v24.0.5) (2025-02-03)
3
10
 
4
11
 
@@ -1,5 +1,3 @@
1
- version: '3.7'
2
-
3
1
  services:
4
2
 
5
3
  sdk-scheme-adapter-api-svc:
@@ -1,4 +1,3 @@
1
- version: '3.7'
2
1
  networks:
3
2
  mojaloop-net:
4
3
  name: mojaloop-net
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-api-svc",
3
- "version": "21.0.0-snapshot.1",
3
+ "version": "21.0.0-snapshot.8",
4
4
  "description": "An adapter for connecting to Mojaloop API enabled switches.",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -65,7 +65,7 @@
65
65
  "dependencies": {
66
66
  "@koa/cors": "^5.0.0",
67
67
  "@mojaloop/api-snippets": "17.7.11",
68
- "@mojaloop/central-services-error-handling": "^13.0.4",
68
+ "@mojaloop/central-services-error-handling": "^13.0.5",
69
69
  "@mojaloop/central-services-logger": "^11.5.4",
70
70
  "@mojaloop/central-services-metrics": "^12.4.4",
71
71
  "@mojaloop/central-services-shared": "^18.17.0",
@@ -70,6 +70,7 @@ class OutboundTransfersModel {
70
70
  this._multiplePartiesResponseSeconds = config.multiplePartiesResponseSeconds;
71
71
  this._sendFinalNotificationIfRequested = config.sendFinalNotificationIfRequested;
72
72
  this._apiType = config.apiType;
73
+ this._supportedCurrencies = config.supportedCurrencies;
73
74
 
74
75
  if (this._autoAcceptParty && this._multiplePartiesResponse) {
75
76
  throw new Error('Conflicting config options provided: autoAcceptParty and multiplePartiesResponse');
@@ -391,14 +392,14 @@ class OutboundTransfersModel {
391
392
  }
392
393
  this.data.to.dateOfBirth = payee.personalInfo.dateOfBirth;
393
394
  }
394
-
395
+
395
396
  if (Array.isArray(payee.supportedCurrencies)) {
396
397
  if (!payee.supportedCurrencies.length) {
397
398
  throw new Error(ErrorMessages.noSupportedCurrencies);
398
399
  }
399
400
 
400
- this.data.needFx = !payee.supportedCurrencies.includes(this.data.currency);
401
401
  this.data.supportedCurrencies = payee.supportedCurrencies;
402
+ this.data.needFx = this._isFxNeeded(this._supportedCurrencies, payee.supportedCurrencies, this.data.currency, this.data.amountType);
402
403
  }
403
404
 
404
405
  this._logger.isVerboseEnabled && this._logger.push({
@@ -1210,6 +1211,34 @@ class OutboundTransfersModel {
1210
1211
  return modifiedData;
1211
1212
  }
1212
1213
 
1214
+ /**
1215
+ * Determines if FX is needed for the transfer
1216
+ *
1217
+ * @param {Array} payerCurrencies - Array of supported currencies for the payer
1218
+ * @param {Array} payeeCurrencies - Array of supported currencies for the payee
1219
+ * @param {string} amountCurrency - Currency of the amount being transferred
1220
+ * @param {string} amountType - Type of the amount being transferred (SEND/RECEIVE)
1221
+ * @returns {boolean} - true if FX is needed, false if not
1222
+ */
1223
+ _isFxNeeded(payerCurrencies, payeeCurrencies, amountCurrency, amountType) {
1224
+ if (payerCurrencies.includes(amountCurrency) && payeeCurrencies.includes(amountCurrency)) {
1225
+ return false;
1226
+ }
1227
+ const intersection = payerCurrencies.filter(currency => payeeCurrencies.includes(currency));
1228
+ if(intersection.length > 0 && !intersection.includes(amountCurrency)) {
1229
+ return true;
1230
+ }
1231
+ if (amountType === AmountTypes.RECEIVE) {
1232
+ if (!payerCurrencies.includes(amountCurrency)) {
1233
+ return true;
1234
+ }
1235
+ }
1236
+ if (!payeeCurrencies.includes(amountCurrency)) {
1237
+ return true;
1238
+ }
1239
+
1240
+ return false;
1241
+ }
1213
1242
 
1214
1243
  /**
1215
1244
  * Loads a transfer model from cache for resumption of the transfer process
@@ -112,7 +112,7 @@ const ErrorMessages = Object.freeze({
112
112
  noSupportedCurrencies: 'No payee supportedCurrencies received',
113
113
  responseMissedExpiryDeadline: 'Response missed expiry deadline',
114
114
  quoteRejectedByBackend: 'Quote rejected by backend',
115
- fxQuoteRejectedByBackend: 'FX quote rejected by backend',
115
+ fxQuoteRejectedByBackend: 'FX quote rejected by backend'
116
116
  });
117
117
 
118
118
  const AmountTypes = Object.freeze({
@@ -57,5 +57,6 @@
57
57
  "port": 4004
58
58
  },
59
59
  "getServicesFxpResponse": ["fxp_id"],
60
- "apiType": "fspiop"
60
+ "apiType": "fspiop",
61
+ "supportedCurrencies": ["XXX"]
61
62
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
3
- "version": "0.3.0-snapshot.1",
3
+ "version": "0.3.0-snapshot.7",
4
4
  "description": "Mojaloop sdk scheme adapter command event handler",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
@@ -59,13 +59,13 @@
59
59
  "@types/convict": "^6.1.6",
60
60
  "@types/express": "^5.0.0",
61
61
  "@types/jest": "^29.5.14",
62
- "@types/node": "^22.13.0",
62
+ "@types/node": "^22.13.1",
63
63
  "@types/node-cache": "^4.2.5",
64
64
  "@types/supertest": "^6.0.2",
65
65
  "@types/swagger-ui-express": "4.1.7",
66
66
  "@types/yamljs": "^0.2.34",
67
- "@typescript-eslint/eslint-plugin": "^8.22.0",
68
- "@typescript-eslint/parser": "^8.22.0",
67
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
68
+ "@typescript-eslint/parser": "^8.23.0",
69
69
  "copyfiles": "^2.4.1",
70
70
  "eslint": "^9.15.0",
71
71
  "jest": "^29.7.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
3
- "version": "0.3.0-snapshot.1",
3
+ "version": "0.3.0-snapshot.7",
4
4
  "description": "mojaloop sdk scheme adapter outbound domain event handler",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
@@ -56,13 +56,13 @@
56
56
  "@types/convict": "^6.1.6",
57
57
  "@types/express": "^5.0.0",
58
58
  "@types/jest": "^29.5.14",
59
- "@types/node": "^22.13.0",
59
+ "@types/node": "^22.13.1",
60
60
  "@types/node-cache": "^4.2.5",
61
61
  "@types/supertest": "^6.0.2",
62
62
  "@types/swagger-ui-express": "^4.1.7",
63
63
  "@types/yamljs": "^0.2.34",
64
- "@typescript-eslint/eslint-plugin": "^8.22.0",
65
- "@typescript-eslint/parser": "^8.22.0",
64
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
65
+ "@typescript-eslint/parser": "^8.23.0",
66
66
  "copyfiles": "^2.4.1",
67
67
  "eslint": "^9.15.0",
68
68
  "jest": "^29.7.0",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
3
- "version": "0.4.0-snapshot.1",
3
+ "version": "0.4.0-snapshot.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
9
- "version": "0.4.0-snapshot.1",
9
+ "version": "0.4.0-snapshot.6",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@mojaloop/api-snippets": "17.7.9",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
3
- "version": "0.4.0-snapshot.1",
3
+ "version": "0.4.0-snapshot.7",
4
4
  "description": "SDK Scheme Adapter private shared library.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/accounts-and-balances-bc/tree/main/modules/private-types",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "devDependencies": {
42
42
  "@eslint/compat": "^1.2.6",
43
- "@types/node": "^22.13.0",
43
+ "@types/node": "^22.13.1",
44
44
  "@types/uuid": "^10.0.0",
45
- "@typescript-eslint/eslint-plugin": "^8.22.0",
46
- "@typescript-eslint/parser": "^8.22.0",
45
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
46
+ "@typescript-eslint/parser": "^8.23.0",
47
47
  "eslint": "^9.15.0",
48
48
  "jest": "^29.7.0",
49
49
  "npm-check-updates": "^16.7.10",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mojaloop/sdk-scheme-adapter",
3
- "version": "24.0.5",
3
+ "version": "24.0.7-snapshot.4",
4
4
  "description": "mojaloop sdk-scheme-adapter",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
@@ -82,10 +82,10 @@
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/jest": "^29.5.14",
85
- "@types/node": "^22.13.0",
85
+ "@types/node": "^22.13.1",
86
86
  "@types/node-cache": "^4.2.5",
87
- "@typescript-eslint/eslint-plugin": "^8.22.0",
88
- "@typescript-eslint/parser": "^8.22.0",
87
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
88
+ "@typescript-eslint/parser": "^8.23.0",
89
89
  "audit-ci": "^7.1.0",
90
90
  "eslint": "^9.15.0",
91
91
  "eslint-config-airbnb-typescript": "^18.0.0",