@mojaloop/sdk-scheme-adapter 24.0.7-snapshot.4 → 24.0.7-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/modules/api-svc/package.json +1 -1
- package/modules/api-svc/src/lib/dto.js +33 -16
- package/modules/api-svc/src/lib/model/OutboundTransfersModel.js +7 -1
- package/modules/outbound-command-event-handler/package.json +1 -1
- package/modules/outbound-domain-event-handler/package.json +1 -1
- package/modules/private-shared-lib/package-lock.json +2 -2
- package/modules/private-shared-lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/*eslint quote-props: ["error", "as-needed"]*/
|
|
28
28
|
const config = require('../config');
|
|
29
29
|
const randomUUID = require('@mojaloop/central-services-shared').Util.id(config.idGenerator);
|
|
30
|
-
const { Directions, SDKStateEnum} = require('./model/common');
|
|
30
|
+
const { Directions, SDKStateEnum, AmountTypes } = require('./model/common');
|
|
31
31
|
|
|
32
32
|
const quoteRequestStateDto = (request) => ({
|
|
33
33
|
// transferId: this follows the slightly dodgy assumption that transferId will be same as this transactionId.
|
|
@@ -56,24 +56,41 @@ const fxQuoteRequestStateDto = (request) => ({
|
|
|
56
56
|
* @param data {object} - "state" of inbound transaction request
|
|
57
57
|
* Supports only single FXP and currency for now
|
|
58
58
|
*/
|
|
59
|
-
const outboundPostFxQuotePayloadDto = (data) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
const outboundPostFxQuotePayloadDto = (data) => {
|
|
60
|
+
let sourceAmount, targetAmount;
|
|
61
|
+
|
|
62
|
+
sourceAmount = {
|
|
63
|
+
currency: data.currency,
|
|
64
|
+
amount: data.amount
|
|
65
|
+
};
|
|
66
|
+
targetAmount = {
|
|
67
|
+
currency: data.supportedCurrencies[0],
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (data.amountType === AmountTypes.RECEIVE && !config.supportedCurrencies.includes(data.currency)) {
|
|
71
|
+
sourceAmount = {
|
|
72
|
+
currency: config.supportedCurrencies[0],
|
|
73
|
+
};
|
|
74
|
+
targetAmount = {
|
|
68
75
|
currency: data.currency,
|
|
69
76
|
amount: data.amount
|
|
70
|
-
}
|
|
71
|
-
targetAmount: {
|
|
72
|
-
currency: data.supportedCurrencies[0],
|
|
73
|
-
},
|
|
74
|
-
expiration: data.fxQuoteExpiration,
|
|
77
|
+
};
|
|
75
78
|
}
|
|
76
|
-
|
|
79
|
+
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
conversionRequestId: randomUUID(),
|
|
82
|
+
conversionTerms: {
|
|
83
|
+
conversionId: randomUUID(), // should be the same as commitRequestId from fxTransfer
|
|
84
|
+
initiatingFsp: data.from.fspId,
|
|
85
|
+
determiningTransferId: data.transferId,
|
|
86
|
+
counterPartyFsp: data.fxProviders[0],
|
|
87
|
+
amountType: data.amountType,
|
|
88
|
+
sourceAmount,
|
|
89
|
+
targetAmount,
|
|
90
|
+
expiration: data.fxQuoteExpiration,
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
77
94
|
|
|
78
95
|
/**
|
|
79
96
|
* @param data {object} - "state" of inbound transaction request
|
|
@@ -398,8 +398,14 @@ class OutboundTransfersModel {
|
|
|
398
398
|
throw new Error(ErrorMessages.noSupportedCurrencies);
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
this.data.supportedCurrencies = payee.supportedCurrencies;
|
|
402
401
|
this.data.needFx = this._isFxNeeded(this._supportedCurrencies, payee.supportedCurrencies, this.data.currency, this.data.amountType);
|
|
402
|
+
this.data.supportedCurrencies = payee.supportedCurrencies;
|
|
403
|
+
|
|
404
|
+
// if (this.data.amountType == AmountTypes.RECEIVE) {
|
|
405
|
+
// if ( !this._supportedCurrencies.includes(this.data.currency) ) {
|
|
406
|
+
// this.data.supportedCurrencies = this._supportedCurrencies;
|
|
407
|
+
// }
|
|
408
|
+
// }
|
|
403
409
|
}
|
|
404
410
|
|
|
405
411
|
this._logger.isVerboseEnabled && this._logger.push({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.16",
|
|
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/",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
|
|
3
|
-
"version": "0.3.0-snapshot.
|
|
3
|
+
"version": "0.3.0-snapshot.16",
|
|
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/",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
|
|
3
|
-
"version": "0.4.0-snapshot.
|
|
3
|
+
"version": "0.4.0-snapshot.15",
|
|
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.
|
|
9
|
+
"version": "0.4.0-snapshot.15",
|
|
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.
|
|
3
|
+
"version": "0.4.0-snapshot.16",
|
|
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",
|
package/package.json
CHANGED