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

feat(ime-306): fix experience api crashing issue #525

Merged
merged 5 commits into from
Jan 14, 2025
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
3 changes: 2 additions & 1 deletion audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"GHSA-rv95-896h-c2vc",
"GHSA-3xgq-45jj-v275", // https://github.com/advisories/GHSA-3xgq-45jj-v275
"GHSA-7q7g-4xm8-89cq", // https://github.com/advisories/GHSA-7q7g-4xm8-89cq
"GHSA-rhx6-c78j-4q9w" // https://github.com/advisories/GHSA-rhx6-c78j-4q9w
"GHSA-mwcw-c2x4-8c55",
"GHSA-rhx6-c78j-4q9w"
]
}
2 changes: 1 addition & 1 deletion modules/api-svc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@redocly/openapi-cli": "^1.0.0-beta.94",
"@redocly/openapi-cli": "^1.0.0-beta.95",
"@types/jest": "^29.5.14",
"axios-mock-adapter": "^2.1.0",
"babel-jest": "^29.7.0",
Expand Down
11 changes: 7 additions & 4 deletions modules/api-svc/src/lib/model/InboundTransfersModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class InboundTransfersModel {
}
this.data.quoteResponse = {
headers: res.originalRequest.headers,
body: res.originalRequest.body,
body: mojaloopResponse,
};
this.data.currentState = SDKStateEnum.WAITING_FOR_QUOTE_ACCEPTANCE;
await this._save();
Expand Down Expand Up @@ -466,9 +466,10 @@ class InboundTransfersModel {
// make a callback to the source fsp with the transfer fulfilment
const res = await this._mojaloopRequests.putTransfers(prepareRequest.transferId, mojaloopResponse,
sourceFspId);

this.data.fulfil = {
headers: res.originalRequest.headers,
body: res.originalRequest.body,
body: mojaloopResponse,
};
this.data.currentState = response.transferState || (this._reserveNotification ? SDKStateEnum.RESERVED : SDKStateEnum.COMPLETED);
await this._save();
Expand Down Expand Up @@ -573,8 +574,9 @@ class InboundTransfersModel {

this.data.fxQuoteResponse = {
headers: res.originalRequest.headers,
body: res.originalRequest.body,
body: mojaloopResponse,
};

this.data.currentState = SDKStateEnum.FX_QUOTE_WAITING_FOR_ACCEPTANCE;
await this.saveFxState();

Expand Down Expand Up @@ -640,8 +642,9 @@ class InboundTransfersModel {

this.data.fulfil = {
headers: res.originalRequest.headers,
body: res.originalRequest.body,
body: mojaloopResponse,
};

this.data.currentState = beResponse.conversionState;
await this.saveFxState();

Expand Down
24 changes: 19 additions & 5 deletions modules/api-svc/src/lib/model/OutboundTransfersModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,14 @@ class OutboundTransfersModel {
const subscribing = this._cache.subscribeToOneMessageWithTimer(channel);

const resp = await this._requests.postFxQuotes(payload, payload.conversionTerms.counterPartyFsp);

const { originalRequest } = resp;
this.data.fxQuoteRequest = originalRequest;
// Setting the fxQuoteRequest to have the fspiop payload
// If ISO20022 is required then use originalRequest
this.data.fxQuoteRequest = {
body: payload,
headers: originalRequest.headers
};
this._logger.debug('fxQuote request is sent to hub');

const message = await subscribing;
Expand All @@ -575,7 +581,7 @@ class OutboundTransfersModel {
throw error;
}

this._logger.push({ body, originalRequest }).verbose('fxQuote callback response received');
// this._logger.push({ body, originalRequest }).verbose('fxQuote callback response received');

if (this._rejectExpiredQuoteResponses) {
const now = new Date().toISOString();
Expand Down Expand Up @@ -658,6 +664,8 @@ class OutboundTransfersModel {
if (error) {
return reject(error);
}
// originalIso20022QuoteResponse is being sent as post transfers payload to hub
// Can't remove this at the moment
this.data.quoteResponse = {
headers: message.data.headers,
body: message.data.body,
Expand Down Expand Up @@ -696,7 +704,10 @@ class OutboundTransfersModel {
latencyTimerDone = this.metrics.quoteRequestLatency.startTimer();
const res = await this._requests.postQuotes(quote, this.data.to.fspId);

this.data.quoteRequest = res.originalRequest;
this.data.quoteRequest = {
body: quote,
headers: res.originalRequest.headers
};

this.metrics.quoteRequests.inc();
this._logger.isDebugEnabled && this._logger.push({ res }).debug('Quote request sent to peer');
Expand Down Expand Up @@ -788,7 +799,7 @@ class OutboundTransfersModel {
const subscribing = this._cache.subscribeToOneMessageWithTimer(channel);

const { originalRequest } = await this._requests.postFxTransfers(payload, payload.counterPartyFsp);
this.data.fxTransferRequest = originalRequest;
this.data.fxTransferRequest = { body: payload , headers: originalRequest.headers };
this._logger.push({ originalRequest }).verbose('fxTransfers request is sent to hub');

const message = await subscribing;
Expand Down Expand Up @@ -945,7 +956,10 @@ class OutboundTransfersModel {
res = await this._requests.postTransfers(prepare, this.data.quoteResponseSource, {});
}

this.data.prepare = res.originalRequest;
this.data.prepare = {
body: prepare,
headers: res.originalRequest.headers
};

this.metrics.transferPrepares.inc();
this._logger.isDebugEnabled && this._logger.push({ res }).debug('Transfer prepare sent to peer');
Expand Down
6 changes: 3 additions & 3 deletions modules/outbound-command-event-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@
"@types/convict": "^6.1.6",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@types/node": "^22.10.6",
"@types/node-cache": "^4.2.5",
"@types/supertest": "^6.0.2",
"@types/swagger-ui-express": "4.1.7",
"@types/yamljs": "^0.2.34",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"copyfiles": "^2.4.1",
"eslint": "^9.15.0",
"jest": "^29.7.0",
Expand Down
6 changes: 3 additions & 3 deletions modules/outbound-domain-event-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
"@types/convict": "^6.1.6",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@types/node": "^22.10.6",
"@types/node-cache": "^4.2.5",
"@types/supertest": "^6.0.2",
"@types/swagger-ui-express": "^4.1.7",
"@types/yamljs": "^0.2.34",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"copyfiles": "^2.4.1",
"eslint": "^9.15.0",
"jest": "^29.7.0",
Expand Down
6 changes: 3 additions & 3 deletions modules/private-shared-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@types/node": "^22.10.5",
"@types/node": "^22.10.6",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"eslint": "^9.15.0",
"jest": "^29.7.0",
"npm-check-updates": "^16.7.10",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.10.5",
"@types/node": "^22.10.6",
"@types/node-cache": "^4.2.5",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"audit-ci": "^7.1.0",
"eslint": "^9.15.0",
"eslint-config-airbnb-typescript": "^18.0.0",
Expand Down
Loading