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

fix: fix quote last error missing on batch failure response #421

Merged
merged 8 commits into from
Nov 11, 2022
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
6 changes: 3 additions & 3 deletions modules/api-svc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mojaloop/sdk-scheme-adapter-api-svc",
"version": "20.3.3",
"version": "20.3.4-snapshot.2",
"description": "An adapter for connecting to Mojaloop API enabled switches.",
"main": "src/index.js",
"types": "src/index.d.ts",
Expand Down Expand Up @@ -100,13 +100,13 @@
"eslint": "^8.27.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.4",
"eslint-plugin-jest": "^27.1.5",
"jest": "^29.3.1",
"jest-junit": "^14.0.1",
"nock": "^13.2.9",
"npm-check-updates": "^16.3.18",
"openapi-response-validator": "^12.0.2",
"openapi-typescript": "^6.0.2",
"openapi-typescript": "^6.0.3",
"redis-mock": "^0.56.3",
"replace": "^1.2.2",
"standard-version": "^9.5.0",
Expand Down
2 changes: 1 addition & 1 deletion modules/outbound-command-event-handler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mojaloop/sdk-scheme-adapter-outbound-command-event-handler",
"version": "0.2.8",
"version": "0.2.9-snapshot.2",
"description": "mojaloop sdk scheme adapter command event handler",
"license": "Apache-2.0",
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,16 @@ export async function handleProcessBulkQuotesCallbackCmdEvt(
const allIndividualTransferIds = await bulkTransactionAgg.getAllIndividualTransferIds();
for await (const individualTransferId of allIndividualTransferIds) {
const individualTransfer = await bulkTransactionAgg.getIndividualTransferById(individualTransferId);
if(individualTransfer.quoteResponse) {
individualTransferResults.push({
homeTransactionId: individualTransfer.request.homeTransactionId,
transactionId: individualTransfer.transactionId,
quoteResponse: individualTransfer.quoteResponse,
});
}

individualTransferResults.push({
homeTransactionId: individualTransfer.request.homeTransactionId,
transactionId: individualTransfer.transactionId,
quoteResponse: individualTransfer.quoteResponse,
lastError: individualTransfer.lastError && {
httpStatusCode: individualTransfer.lastError.httpStatusCode,
mojaloopError: individualTransfer.lastError.mojaloopError,
},
});
}

if(individualTransferResults.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
import { ILogger } from '@mojaloop/logging-bc-public-types-lib';
import {
CommandEvent,
IndividualTransferEntity,
IndividualTransferInternalState,
ProcessPartyInfoCallbackCmdEvt,
PartyInfoCallbackProcessedDmEvt,
SDKOutboundTransferState,
BulkTransactionInternalState,
SDKOutboundBulkPartyInfoRequestProcessedDmEvt,
SDKOutboundBulkAutoAcceptPartyInfoRequestedDmEvt,
SDKOutboundBulkAcceptPartyInfoRequestedDmEvt, PrepareSDKOutboundBulkResponseCmdEvt,
SDKOutboundBulkAcceptPartyInfoRequestedDmEvt, PrepareSDKOutboundBulkResponseCmdEvt, CoreConnectorBulkAcceptPartyInfoRequestIndividualTransferResult, IndividualTransferState,
} from '@mojaloop/sdk-scheme-adapter-private-shared-lib';
import { BulkTransactionAgg } from '..';
import { ICommandEventHandlerOptions } from '@module-types';
Expand Down Expand Up @@ -104,7 +105,7 @@ export async function handleProcessPartyInfoCallbackCmdEvt(
await bulkTransactionAgg.incrementFailedCount();
partyLookupSuccessCount = await bulkTransactionAgg.getPartyLookupSuccessCount();
}

if(partyLookupTotalCount === (partyLookupSuccessCount + partyLookupFailedCount)) {
// Update global state "DISCOVERY_COMPLETED"
await bulkTransactionAgg.setGlobalState(BulkTransactionInternalState.DISCOVERY_COMPLETED);
Expand All @@ -129,7 +130,7 @@ export async function handleProcessPartyInfoCallbackCmdEvt(
});
await options.domainProducer.sendDomainEvent(autoAcceptPartyMsg);
} else {
const individualTransferResults = [];
const individualTransferResults: CoreConnectorBulkAcceptPartyInfoRequestIndividualTransferResult[] = [];
const allIndividualTransferIds = await bulkTransactionAgg.getAllIndividualTransferIds();
for await (const individualTransferId of allIndividualTransferIds) {
const individualTransferData = await bulkTransactionAgg
Expand All @@ -140,6 +141,7 @@ export async function handleProcessPartyInfoCallbackCmdEvt(
mojaloopError: individualTransferData.partyResponse?.errorInformation,
}) || (
individualTransferData.lastError && {
httpStatusCode: individualTransferData.lastError.httpStatusCode,
mojaloopError: individualTransferData.lastError.mojaloopError,
});

Expand Down
2 changes: 1 addition & 1 deletion modules/outbound-domain-event-handler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mojaloop/sdk-scheme-adapter-outbound-domain-event-handler",
"version": "0.2.8",
"version": "0.2.9-snapshot.2",
"description": "mojaloop sdk scheme adapter outbound domain event handler",
"license": "Apache-2.0",
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
Expand Down
2 changes: 1 addition & 1 deletion modules/private-shared-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mojaloop/sdk-scheme-adapter-private-shared-lib",
"version": "0.3.8",
"version": "0.3.9-snapshot.2",
"description": "SDK Scheme Adapter private shared library.",
"license": "Apache-2.0",
"homepage": "https://github.com/mojaloop/accounts-and-balances-bc/tree/main/modules/private-types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
import { DomainEvent } from '../domain_event';
import { IMessageHeader } from '@module-types';
import { SDKSchemeAdapter } from '@mojaloop/api-snippets';
import { IndividualTransferError } from '@module-domain';

export type CoreConnectorBulkAcceptPartyInfoRequestIndividualTransferResult = {
homeTransactionId: SDKSchemeAdapter.V2_0_0.Outbound.Types.bulkTransactionIndividualTransfer['homeTransactionId'];
transactionId: string;
to: SDKSchemeAdapter.V2_0_0.Outbound.Types.Party;
to?: SDKSchemeAdapter.V2_0_0.Outbound.Types.Party;
lastError: IndividualTransferError
};

export type CoreConnectorBulkAcceptPartyInfoRequest = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
import { DomainEvent } from '../domain_event';
import { IMessageHeader } from '@module-types';
import { SDKSchemeAdapter } from '@mojaloop/api-snippets';
import { IndividualTransferError } from '@module-domain';

// TODO: Current dfspInboundAPI is outdated and its better to add the core connector API to the API snippets library as single source of truth.
// For now we are defining these types here.
export type CoreConnectorBulkAcceptQuoteRequestIndividualTransferResult = {
homeTransactionId: SDKSchemeAdapter.V2_0_0.Outbound.Types.bulkTransactionIndividualTransfer['homeTransactionId'];
transactionId: string;
quoteResponse: SDKSchemeAdapter.V2_0_0.Outbound.Types.individualQuoteResult;
quoteResponse?: SDKSchemeAdapter.V2_0_0.Outbound.Types.individualQuoteResult;
lastError: IndividualTransferError
};

export type CoreConnectorBulkAcceptQuoteRequest = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mojaloop/sdk-scheme-adapter",
"version": "21.3.3",
"version": "21.3.4-snapshot.2",
"description": "mojaloop sdk-scheme-adapter",
"license": "Apache-2.0",
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter",
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ __metadata:
eslint: ^8.27.0
eslint-config-airbnb-base: ^15.0.0
eslint-plugin-import: ^2.26.0
eslint-plugin-jest: ^27.1.4
eslint-plugin-jest: ^27.1.5
express: ^4.18.2
fast-json-patch: ^3.1.1
javascript-state-machine: ^3.1.0
Expand All @@ -2250,7 +2250,7 @@ __metadata:
oauth2-server: ^4.0.0-dev.2
openapi-jsonschema-parameters: ^12.0.2
openapi-response-validator: ^12.0.2
openapi-typescript: ^6.0.2
openapi-typescript: ^6.0.3
prom-client: ^14.1.0
promise-timeout: ^1.3.0
random-word-slugs: ^0.1.6
Expand Down Expand Up @@ -6241,9 +6241,9 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-jest@npm:^27.1.4":
version: 27.1.4
resolution: "eslint-plugin-jest@npm:27.1.4"
"eslint-plugin-jest@npm:^27.1.5":
version: 27.1.5
resolution: "eslint-plugin-jest@npm:27.1.5"
dependencies:
"@typescript-eslint/utils": ^5.10.0
peerDependencies:
Expand All @@ -6254,7 +6254,7 @@ __metadata:
optional: true
jest:
optional: true
checksum: b7e3bf0dc092d9936ac1c10a0aceda411935c411c9323def109c2429ccf8486b3faead80fb769119add578c200352729ff96523bffec083f421e1b151404f642
checksum: 7c9de765793f7161afa0bdcdce67f4d072944152880fa638b25d228188dcee47a4b4aada26c57db72bc10193c96a1979e17afb8a7c3e400e961d8adfbf23ddbe
languageName: node
linkType: hard

Expand Down Expand Up @@ -10899,9 +10899,9 @@ __metadata:
languageName: node
linkType: hard

"openapi-typescript@npm:^6.0.2":
version: 6.0.2
resolution: "openapi-typescript@npm:6.0.2"
"openapi-typescript@npm:^6.0.3":
version: 6.0.3
resolution: "openapi-typescript@npm:6.0.3"
dependencies:
ansi-colors: ^4.1.3
fast-glob: ^3.2.12
Expand All @@ -10911,7 +10911,7 @@ __metadata:
yargs-parser: ^21.1.1
bin:
openapi-typescript: bin/cli.js
checksum: 17900e6590d47efb2d49df149c90d9bea082340805b33d2b939a46c2d5675e21dbd9ede2ca2439365ba98e41e014ac29f9c0b4a81842d43daa081e1992c4f5e2
checksum: c16b187737dc44f07975861e318d53ea0172a6205bbc41b9454f3c9670fc5e7bf43867c27b2e8e38ae330727d464b1839cc48ebbec7c7b415b25ffdcf992a6d9
languageName: node
linkType: hard

Expand Down