Skip to content

Commit

Permalink
feat(mojaloop/#2809): merge local end to end func tests (#398)
Browse files Browse the repository at this point in the history
* updated deps

* docker compose for end-end testing

* updated dependencies

* updates to end-end docker compose

* added docker compose for local testing

* added local-testing folder

* test case for bulk quote accept event

* Refactored the func test files and p2p is working

* running tests to check they are working

* chore: added sample ttk env file

* chore: updated sdk-out api in TTK func test framework

* fix

* fix

* added kafka related env vars

* removed duplicate env vars

* fix: func-tests-kafka-consumer-group-config

* chore: maintenance

- removed build from git commit hooks
- added updated api.yaml which was generated from yarn run build (no idea why this was not updated?)

* re-aligned bulkTransaction states to match sequence diagram

* chore: maintenance

- changed redis default config to localhost

* feat(mojaloop/#2803): sdk scheme adapter - add bulk transfers calls (Steps 62-85)

- added the following Events:
   - ProcessSDKOutboundBulkTransfersRequestCmdEvt
   - BulkTransfersRequestedDmEvt
- added processing logic on the Command Handler for
   - processing ProcessSDKOutboundBulkTransfersRequestCmdEvt
   - sending BulkTransfersRequestedDmEvt

* fix: ttk-func-config

* fixes for docker-compose

- moved redisinsight to debug profile
- rename insight to redisinsight
- removed unnecessary mongodb dependency (no idea why that was there)

* TTK test cases for bulk - initial commit

* feat: added put bulktransactions to mojaloop sim api in TTK

* chore: added some sample code

* chore: some ttk rules changes

* removed ttk for bulk

* updated repos to include bulkTransfersCount* methods and keys

* updates for story

- added ProcessSDKOutboundBulkTransfersRequestHandler to handler/index
- added get counts for transfers to bulkAggregate

* refactored aggregate for createBatches  logic

- refactored createBatches to a private _generateBatchMapArray method which separates out the logic to create the BatchMapArray to a re-usable function that supports filters
- added a new method generateBulkQuoteBatches which calls the _generateBatchMapArray and implements the previous logic to adds the individual Quotes

* clean up

* added bulkTransactionAgg.generateBulkTransferBatches method and did some cleanups

* typo fixes

* added redis insights to docker compose

* initial commit for bulk transfers intg tests

* feat(mojaloop/#2802): rework ProcessBulkQuotesCallback logic and add int tests for bulk quotes (#366)

* feat: add tests for bulk quotes

* chore: more

* chore: format

* chore: lock

* chore: cleanup

* chore: dep test

* chore: file dep test

* chore: dep and bug fix

* chore: address comments

* chore: address more comments

* chore: add assert

* chore: changes

* chore: add assertion

* chore: revert

* chore: shorthand

* chore: remove unnecessary asserts

* chore: update logic

* chore: update tests

* chore: time

* chore: timeout

* chore: update logic

* end-end testing diagram

* fixes for generators for bulk Quotes and Transfers

- cleaned up code
- made the generateBatch methods for Quotes/Transfers to be cleaner with some additional debug methods
- added sample event generator for integrationTests for processSDKOutboundBulkTransfersRequestCmdEvt

* added todo comment

* fixes for transfers/quotes counts and added todo

* lint fixes

* updates to code headers

* folder restructure for tests

* refactor folders for discovery integration tests

* updated bulk ttk test case

* changed mvp bulk testcase

* fixed ttk rule

* fix for mvp branch merges

* aligned transferId to bulkTransferRequests to use the individualTransfers.id

* chore: add bulk transfer lib event boiler plate code

* renamed files

* fix for mvp branch merges

- fixed paths to be more generic
- updated jest confit to dynamically pull in the path information to properly resolve imported alias's in test files
- added utilities to command handler tests for Timeout async awaits
- added SETUP / ACT / ASSERT comments to process_bulk_quotes_callback.test.ts

* feat(mojaloop/#2803): sdk scheme adapter added quote accept (Steps 68)

- added ProcessSDKOutboundBulkAcceptQuoteHandler
- added 'AGREEMENT_ACCEPTED' & 'AGREEMENT_REJECTED' to IndividualTransferInternalState
- added ProcessSDKOutboundBulkAcceptPartyInfoCmdEvt
- added SDKOutboundBulkAcceptQuoteProcessedDmEvt

TODO:
- Logic for 'Calculate bulk expiry based on both expirySeconds config and bulkExpiration'

* fixed header

* updates to docs for auto-numbering

* docs: added updated for `AGREEMENT_ACCEPTANCE_COMPLETED` state

* Added new states to bulkTransactionEntity

- AGREEMENT_ACCEPTANCE_COMPLETED
- TRANSFERS_COMPLETED
- TRANSFERS_FAILED
- RESPONSE_PROCESSING
- RESPONSE_SENT

* updated handleProcessSDKOutboundBulkAcceptQuoteCmdEvt to set AGREEMENT_ACCEPTANCE_COMPLETED

* fix typos

* renamed SDKOutboundBulkAutoAcceptQuoteCompleted --> SDKOutboundBulkAutoAcceptQuoteProcessed

This aligns with the auto-accept= false use-case

* feat(mojaloop/#2803): sdk scheme adapter added quote accept (Steps 68)

- added handleSDKOutboundBulkAcceptQuoteProcessed to the Domain Event Handler

* feat(mojaloop/#2803): sdk scheme adapter added quote accept (Steps 68)

- fixes for SDKOutboundBulkAcceptQuoteReceivedDmEvt
- added handleSDKOutboundBulkAcceptQuoteReceived handler to the Domain Handler

* chore: updated process_bulk_quotes_callback int-test option params

* added more test assertions

* renamed test files

* feat: added parties error response rule

* fix for process_bulk_quotes_callback.test

* fix: reworked process_bulk_quotes_callback.test

- updated the initial test to meet the correct test conditions
- updated the initial test asserts to validate the outcome of the test conditions
- added todo comment on original test
- re-factored asserts to use Class.name instead of hard-coded name string values

* refactored happy path test case and added error test case

* typo fixes

* fixed typos in process_bulk_quotes_callback.test

- fixed test description, added missing 'global BulkTransaction state should be AGREEMENT_ACCEPTANCE_PENDING' to test description

* updates to process_bulk_quotes_callback.test

- added SETUP, ACT, ASSERT comments

* updated header

* fixed indentation and moved the //act comment to the correct location

* feat(mojaloop/#2803): add event handlers (#380)

* feat(mojaloop/#2803): add BulkTransfersRequestedDmEvt implementation and handling

* add BulkTransfersCallbackReceived domain handler

* chore: key

* Update modules/outbound-domain-event-handler/src/application/handlers/bulk_transfers_callback_received.ts

Co-authored-by: Miguel de Barros <[email protected]>

Co-authored-by: Miguel de Barros <[email protected]>

* added timeout error case

* Add readme

* Added support for ProcessSDKOutboundBulkAcceptQuoteCmdEvt and SDKOutboundBulkAcceptQuoteReceivedDmEvt

- Updates to outbound-command-event-handler
   - added/expanded on some additional logging
   - added ProcessSDKOutboundBulkAcceptQuoteCmdEvt processing support
- Updates to outbound-domain-event-handler
   - added SDKOutboundBulkAcceptQuoteReceivedDmEvt routing support
   -

* Added initial version of process_sdk_outbound_bulk_accept_quote.test

- added first integration test to process_sdk_outbound_bulk_accept_quote.test
- added initial impl of generator util helper (this needs allot of work)
- updated handleProcessSDKOutboundBulkAcceptQuoteCmdEvt to not update stage if the individualTransfer is already in AGREEMENT_FAILED state

* added more error test cases

* added more error test cases for bulk quotes

* feat: add ProcessBulkTransfersCallback handler

* added more error test cases for bulk quotes

* working  process_sdk_outbound_bulk_accept_quotes.test (but process not finished)

* added some additional comments

* fixes for outbound-domain-event-handler

- fixes to missing imports
- fixed formatting issue with application handler

* added fetchBulkBatches to generator to help fetch the right bulkBatches

* updates for outbound-command-event-handler

- added createChild support for loggers to include component name
- added new agg handler for handleProcessBulkTransfersCallbackCmdEvt PLACEHOLDER (i.e. impl is missing) with application routing
- updated process_sdk_outbound_bulk_accept_quote.test and generator to kick-off the ProcessBulkTransfersCallbackCmdEvt event

* added comment to be addressed by Kevin's PR

* added more error test cases for bulk quotes that has timeout

* fixes for merge issues

* added a child Logger for OutboundCommandEventHandlerAPIServer

* updated process_sdk_outbound_bulk_accept_quote.test description

* cleanup to loggers

* updates to outbound-command-event-handler integration tests

- refactored generator helper by removing the bulkTransactionRequest, and rather adding a subset of the config options only
- re-worked process_sdk_outbound_bulk_accept_quote.test
- completed impl the process_bulk_transfers_request.test

* added process_bulk_transfers_request.test

* removed unused variables

* added TODOs to address

* adding correct state for individualTransfer that has a failed Quote

* updated bulk_transaction_agg with types, and fixed issue with batch generator functions to pass unit tests

- added types to getBulk*Count() methods
- added validation checks on the generateBulk*Batches() methods to throw an error if batches were already generated
- fixed unit tests to match the earlier re-factor for the `createBatches` -> `generateBulk*Batches` methods

* updated end-end tests

* build and unit test fixes

* updated rules for bulk quotes

* fixes for integration tests

* fixes for build

* fixes for missing outbound-domain-event-handler to handler to route SDKOutboundBulkAcceptQuoteProcessedDmEvt events

* added bulkQuoteId to bulkTransfersRequest when creating an empty batch by the BulkBatchEntity

* updated test scripts for ID not found scenarios

* made updates to test scripts

* chore: clean up integration tests (#387)

* chore: fix discovery int tests

* chore: agreement tests

* chore: clean up transfers int tests

* chore: increment

* dep:update for api-snippets

- bumped api-snippets
- also changed dep:* package.json root scripts to use "static" output to correctly show info on console

* added missing ilpPacket and condition to bulkBatch IndividualTransfer

* fixes for func-tests

- fixed lint issues with test/fun/README.md
- added ignore for **/*.env to dockerignore file

* same as previous commit

* added missing outbound-domain-event-handler routing

- BulkTransfersCallbackReceivedDmEvt
- SDKOutboundBulkTransfersRequestProcessedDmEvt

* feat(mojaloop/#2803): add more event handlers (#383)

* feat(mojaloop/#2803): add PrepareSDKOutboundBulkResponse and PrepareSDKOutboundBulkResponseSent handler

* chore: fix

* chore: header

* chore: fix some unit tests

* chore: update bulk response

* chore: remove unneeded file

* added missing routes/implementation to the outbound-domain-event-handler

- added routing for SDKOutboundBulkResponseSentDmEvt
- added implementation for
  - handleSDKOutboundBulkTransfersRequestProcessed
  - handleSDKOutboundBulkResponseSent

* added missing routes to outbound-command-event-handler

- added route handling for PrepareSDKOutboundBulkResponseCmdEvt
- added route handling for ProcessSDKOutboundBulkResponseSentCmdEvt

* outbound-command-handler updates to handlePrepareSDKOutboundBulkResponseCmdEvt

- added central-services-shared for transferState enums
- added missing field mappings on SDKOutboundBulkResponsePreparedDmEvt for quoteResponse, fulfil, and extensions
- fixed mapping from bulkTransactionIndividualTransferResult.to to use the partyResponse.party

* Updated handleProcessSDKOutboundBulkResponseSentCmdEvt to produce SDKOutboundBulkResponseSentProcessedDmtEvt

- Added new domain event SDKOutboundBulkResponseSentProcessed
- Added logic to handleProcessSDKOutboundBulkResponseSentCmdEvt to publish event
- Updated documentation to include final SDKOutboundBulkResponseSentProcessed Domain event

* added comments and skipped an integration test

* test: updated mvp-bulk ttk-testcases

- updated happy path to validate final state "COMPLETED"

* made updates to test scripts

* Updated generator help util for integration tests on outbound-command-handler

- Added support for :
  - PrepareSDKOutboundBulkResponseCmdEvt
  - ProcessSDKOutboundBulkResponseSentCmdEvt

* added more tests for transfers

* fix: party lookup flow if party info exists (#388)

send PartyInfoCallbackReceivedDmEvt if party info exists

* fix: party lookup (#389)

party lookup fix

* updated bulk quotes error test cases

* added TC with 50 bulk transfer requests

* fix(mojaloop/#2803): adjust transfer creation logic and int tests (#390)

* chore: fix discovery int tests

* chore: agreement tests

* chore: clean up transfers int tests

* chore: increment

* fix: adjust transfer creation logic and int tests

* chore: cleanup

* Update modules/outbound-command-event-handler/src/domain/bulk_transaction_agg/index.ts

Co-authored-by: Miguel de Barros <[email protected]>

* chore: dep update

* chore: revert

* chore: update ncurc

* chore: yaml file

Co-authored-by: Miguel de Barros <[email protected]>

* updated TC with 50 bulk transfer requests

* updated TC with 50 bulk transfer requests

* added negative test case for transfers

* updated negative test case for transfers

* new file for transfer errors

* new file for quotes error cases

* added new error test case for transfers

* restructuring of files

* added an error test case for transfers

* added more test cases for quotes error cases

* updated test cases for quotes

* adding happy path

* updated rule for quotes error

* updated test case numbers

* re-arranged test cases

* updated dependencies

* fix: bugs 2946, 2951 (#391)

* fix: bugs 2946, 2951
* fix #2946
* fix #2951

* handle errors

* bump deps

* fix enums

* fix enums

* update deps

* fix tests

* fix tests

* fix: ci build order (#393)

* new file for transfer errors

* new file for quotes error cases

* added new error test case for transfers

* restructuring of files

* added an error test case for transfers

* added more test cases for quotes error cases

* updated test cases for quotes

* fix: ci build order seems to be an issue

* deps updated

* rebuild yarn.lock

* fix for unit tests

* added private-shared-lib to api-svc

Co-authored-by: Sridevi Miriyala <[email protected]>

* fix party resolution.

* update e2e tests

* fix audit issues

* update circleci machine image

* update circleci machine image

* clear event listener in redis mock

* fix tests

Co-authored-by: Miguel de Barros <[email protected]>
Co-authored-by: Sridevi Miriyala <[email protected]>

* fix: unit tests (#397)

close active event emitters

* fix handling quote error response

* updated happy path test case

* fix handling quote error response

* updated test cases

* updated quotes test cases

* fix assigning transactionId

* added test cases markdown

* updated test cases markdown

* updated test cases markdown

* updated test cases markdown

* updated test cases markdown

* chore: fix int tests (#399)

* chore: try fix tests

* chore: regen lock

* chore: dep update

Co-authored-by: Vijay Kumar <[email protected]>
Co-authored-by: Miguel de Barros <[email protected]>
Co-authored-by: Kevin Leyow <[email protected]>
Co-authored-by: Yevhen Kyriukha <[email protected]>
  • Loading branch information
5 people authored Oct 10, 2022
1 parent da5c0ad commit b0b3617
Show file tree
Hide file tree
Showing 65 changed files with 10,459 additions and 2,529 deletions.
1 change: 0 additions & 1 deletion audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"GHSA-3cvr-822r-rqcc",
"GHSA-8qr4-xgw6-wmr3",
"GHSA-f772-66g8-q5h3",
"GHSA-cph5-m8f7-6c5x",
"GHSA-cph5-m8f7-6c5x"
]
}
27 changes: 15 additions & 12 deletions docs/design-bulk-transfers/outbound-sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ sequenceDiagram
loop Party Lookup per transfer
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Read individual attributes, if the party info already exists then change the individual state to DISCOVERY_SUCCESS else publish the individual event and update the state to DISCOVERY_RECEIVED
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Update the party request
SDKOutboundCommandEventHandler->>SDKFspiopApi: PartyInfoRequested (includes info for SDK for making a party call)
Note left of SDKFspiopApi: topic-sdk-outbound-domain-events
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Set individual state: DISCOVERY_PROCESSING
SDKFspiopApi->>SDKFspiopApi: Process outbound Trace Headers
SDKFspiopApi->>MojaloopSwitch: GET /parties
MojaloopSwitch->>SDKFspiopApi: PUT /parties
SDKFspiopApi->>SDKFspiopApi: Process Inbound Trace Headers
SDKFspiopApi->>SDKOutboundDomainEventHandler: PartyInfoCallbackReceived
Note right of SDKOutboundDomainEventHandler: topic-sdk-outbound-domain-events
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Update the global state to DISCOVERY_RECEIVED
alt party info already exists
SDKOutboundCommandEventHandler->>SDKOutboundDomainEventHandler: PartyInfoCallbackReceived
else party info doesn't exist
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Update the party request
SDKOutboundCommandEventHandler->>SDKFspiopApi: PartyInfoRequested (includes info for SDK for making a party call)
Note left of SDKFspiopApi: topic-sdk-outbound-domain-events
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Set individual state: DISCOVERY_PROCESSING
SDKFspiopApi->>SDKFspiopApi: Process outbound Trace Headers
SDKFspiopApi->>MojaloopSwitch: GET /parties
MojaloopSwitch->>SDKFspiopApi: PUT /parties
SDKFspiopApi->>SDKFspiopApi: Process Inbound Trace Headers
SDKFspiopApi->>SDKOutboundDomainEventHandler: PartyInfoCallbackReceived
Note right of SDKOutboundDomainEventHandler: topic-sdk-outbound-domain-events
end
SDKOutboundDomainEventHandler->>SDKOutboundCommandEventHandler: ProcessPartyInfoCallback
Note left of SDKOutboundCommandEventHandler: topic-sdk-outbound-command-events
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Update the individual state: DISCOVERY_SUCCESS / DISCOVERY_FAILED
Expand Down Expand Up @@ -206,5 +210,4 @@ sequenceDiagram
Note left of SDKOutboundCommandEventHandler: topic-sdk-outbound-command-events
SDKOutboundCommandEventHandler->>SDKOutboundCommandEventHandler: Update global state "RESPONSE_SENT"
SDKOutboundCommandEventHandler->>SDKOutboundDomainEventHandler: SDKOutboundBulkResponseSentProcessed
```
14 changes: 7 additions & 7 deletions modules/api-svc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"url": "[email protected]:mojaloop/sdk-scheme-adapter.git"
},
"dependencies": {
"@koa/cors": "^3.4.2",
"@mojaloop/api-snippets": "16.0.3",
"@koa/cors": "^4.0.0",
"@mojaloop/api-snippets": "^16.0.4",
"@mojaloop/central-services-error-handling": "^12.0.4",
"@mojaloop/central-services-logger": "^11.0.1",
"@mojaloop/central-services-metrics": "^12.0.5",
Expand All @@ -69,11 +69,11 @@
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
"@mojaloop/sdk-standard-components": "^17.1.1",
"ajv": "8.11.0",
"axios": "^1.0.0",
"axios": "^1.1.2",
"co-body": "^6.1.0",
"dotenv": "^16.0.3",
"env-var": "^7.3.0",
"express": "^4.18.1",
"express": "^4.18.2",
"fast-json-patch": "^3.1.1",
"javascript-state-machine": "^3.1.0",
"js-yaml": "^4.1.0",
Expand All @@ -93,18 +93,18 @@
},
"devDependencies": {
"@babel/core": "^7.19.3",
"@babel/preset-env": "^7.19.3",
"@babel/preset-env": "^7.19.4",
"@redocly/openapi-cli": "^1.0.0-beta.94",
"@types/jest": "^29.1.2",
"babel-jest": "^29.1.2",
"eslint": "^8.24.0",
"eslint": "^8.25.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.1",
"jest": "^29.1.2",
"jest-junit": "^14.0.1",
"nock": "^13.2.9",
"npm-check-updates": "^16.3.8",
"npm-check-updates": "^16.3.11",
"openapi-response-validator": "^12.0.2",
"openapi-typescript": "^5.4.1",
"redis-mock": "^0.56.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports.handleBulkQuotesRequestedDmEvt = async (
bulkId: event.getKey(),
content: {
batchId: event.batchId,
bulkQuoteId: response.bulkQuoteId,
bulkQuoteId: event.request.bulkQuoteId,
bulkQuotesResult: response,
},
timestamp: Date.now(),
Expand All @@ -59,5 +59,19 @@ module.exports.handleBulkQuotesRequestedDmEvt = async (
}
catch (err) {
logger.push({ err }).log('Error in handleBulkQuotesRequestedDmEvt');
const bulkQuotesCallbackReceivedDmEvt = new BulkQuotesCallbackReceivedDmEvt({
bulkId: event.getKey(),
content: {
batchId: event.batchId,
bulkQuoteId: event.request.bulkQuoteId,
bulkQuotesErrorResult: {
httpStatusCode: err.httpStatusCode,
mojaloopError: err.mojaloopError,
},
},
timestamp: Date.now(),
headers: [],
});
await options.producer.sendDomainEvent(bulkQuotesCallbackReceivedDmEvt);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ module.exports.handleBulkTransfersRequestedDmEvt = async (
bulkId: event.getKey(),
content: {
batchId: event.batchId,
bulkTransferId: response.bulkTransferId,
bulkTransfersResult: response,
},
timestamp: Date.now(),
Expand All @@ -59,5 +58,18 @@ module.exports.handleBulkTransfersRequestedDmEvt = async (
await options.producer.sendDomainEvent(bulkTransfersCallbackReceivedDmEvt);
} catch (err) {
logger.push({ err }).log('Error in handleBulkTransfersRequestedDmEvt');
const bulkTransfersCallbackReceivedDmEvt = new BulkTransfersCallbackReceivedDmEvt({
bulkId: event.getKey(),
content: {
batchId: event.batchId,
bulkTransfersErrorResult: {
httpStatusCode: err.httpStatusCode,
mojaloopError: err.mojaloopError,
},
},
timestamp: Date.now(),
headers: [],
});
await options.producer.sendDomainEvent(bulkTransfersCallbackReceivedDmEvt);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

const { PartyInfoRequestedDmEvt } = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
const { PartiesModel } = require('../../lib/model');
const { SDKStateEnum } = require('../../lib/model/common');
const { PartyInfoCallbackReceivedDmEvt } = require('@mojaloop/sdk-scheme-adapter-private-shared-lib');
const { Errors } = require('@mojaloop/sdk-standard-components');

Expand All @@ -34,7 +33,7 @@ module.exports.handlePartyInfoRequestedDmEvt = async (
logger,
) => {
const event = PartyInfoRequestedDmEvt.CreateFromDomainEvent(message);
const request = event.getPartyRequest();
const request = event.partyRequest;
const args = { type: request.partyIdType, id: request.partyIdentifier, subId: request.partySubIdOrType || undefined };

try {
Expand All @@ -57,7 +56,7 @@ module.exports.handlePartyInfoRequestedDmEvt = async (
const partyInfoCallbackReceivedDmEvt = new PartyInfoCallbackReceivedDmEvt({
bulkId: event.getKey(),
content: {
transferId: event.getTransferId(),
transferId: event.transferId,
partyResult: {
party: response.party?.body,
currentState: response.currentState,
Expand All @@ -76,13 +75,15 @@ module.exports.handlePartyInfoRequestedDmEvt = async (
const partyInfoCallbackReceivedDmEvt = new PartyInfoCallbackReceivedDmEvt({
bulkId: event.getKey(),
content: {
transferId: event.getTransferId(),
partyResult: {
currentState: SDKStateEnum.ERROR_OCCURRED,
errorInformation: {
errorCode: code,
errorDescription: message
}
transferId: event.transferId,
partyErrorResult: {
httpStatusCode: err.httpStatusCode,
mojaloopError: {
errorInformation: {
errorCode: code,
errorDescription: message
},
},
},
},
timestamp: Date.now(),
Expand Down
1 change: 0 additions & 1 deletion modules/api-svc/src/index.d.ts

This file was deleted.

2 changes: 2 additions & 0 deletions modules/api-svc/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const OutboundServerMiddleware = require('./OutboundServer/middlewares.js');
const Router = require('./lib/router');
const Validate = require('./lib/validate');
const Cache = require('./lib/cache');
const { SDKStateEnum } = require('./lib/model/common');
const { Logger, WSO2Auth } = require('@mojaloop/sdk-standard-components');

const LOG_ID = {
Expand Down Expand Up @@ -377,4 +378,5 @@ module.exports = {
Router,
Server,
Validate,
SDKStateEnum,
};
5 changes: 3 additions & 2 deletions modules/api-svc/src/lib/model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const OutboundRequestToPayTransferModel = require('./OutboundRequestToPayTransfe
const AccountsModel = require('./AccountsModel');
const ProxyModel = require('./ProxyModel');
const OutboundRequestToPayModel = require('./OutboundRequestToPayModel');
const { BackendError, PersistentStateMachine } = require('./common');
const { SDKStateEnum, BackendError, PersistentStateMachine } = require('./common');
const PartiesModel = require('./PartiesModel');
const QuotesModel = require('./QuotesModel');
const TransfersModel = require('./TransfersModel');
Expand All @@ -37,5 +37,6 @@ module.exports = {
PersistentStateMachine,
PartiesModel,
QuotesModel,
TransfersModel
TransfersModel,
SDKStateEnum
};
3 changes: 2 additions & 1 deletion modules/api-svc/test/unit/BackendEventHandler.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { BackendEventHandler } = require('../../src/BackendEventHandler');
const { BackendRequests } = require('../../src/lib/model/lib/requests');
const { SDKStateEnum } = require('../../src/lib/model/common');
const { Logger } = require('@mojaloop/sdk-standard-components');
const config = require('./data/defaultConfig.json');
const bulkTransactionResponse = require('./lib/model/data/bulkTransactionResponse.json');
Expand Down Expand Up @@ -110,7 +111,7 @@ describe('BackendEventHandler', () => {

expect(putBulkTransactions).toBeCalledWith(bulkId, {
...bulkTransactionResponse,
currentState: 'COMPLETED',
currentState: SDKStateEnum.COMPLETED,
});

const sent = KafkaDomainEventProducer.mock.sendDomainEvent.mock.calls[0][0];
Expand Down
9 changes: 4 additions & 5 deletions modules/api-svc/test/unit/FSPIOPEventHandler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
OutboundBulkQuotesModel,
PartiesModel,
OutboundBulkTransfersModel,
SDKStateEnum
} = require('~/lib/model');

const logger = new Logger.Logger({ context: { app: 'FSPIOPEventHandler' }, stringify: () => '' });
Expand Down Expand Up @@ -71,7 +72,7 @@ describe('FSPIOPEventHandler', () => {
party: {
body: partyResult,
},
currentState: 'COMPLETED',
currentState: SDKStateEnum.COMPLETED,
}))
};

Expand Down Expand Up @@ -104,7 +105,7 @@ describe('FSPIOPEventHandler', () => {
transferId: 'faaaea55-da85-4818-8b16-f720f9737889',
partyResult: {
party: partyResult,
currentState: 'COMPLETED',
currentState: SDKStateEnum.COMPLETED,
}
});
});
Expand Down Expand Up @@ -242,7 +243,6 @@ describe('FSPIOPEventHandler', () => {
expect(sent._data.name).toEqual('BulkQuotesCallbackReceivedDmEvt');
expect(sent._data.content).toEqual({
batchId: '61c35bae-77d0-4f7d-b894-be375b838ff6',
bulkQuoteId: bulkQuoteResponse.bulkQuoteId,
bulkQuotesResult: bulkQuoteResponse,
});
});
Expand Down Expand Up @@ -281,7 +281,7 @@ describe('FSPIOPEventHandler', () => {

const bulkTransfersResult = {
bulkTransferId: '81c35bae-77d0-4f7d-b894-be375b838ff6',
currentState: 'COMPLETED',
currentState: SDKStateEnum.COMPLETED,
individualTransferResults: [
{
transferId: 'individual-transfer-id',
Expand Down Expand Up @@ -317,7 +317,6 @@ describe('FSPIOPEventHandler', () => {
expect(sent._data.name).toEqual('BulkTransfersCallbackReceivedDmEvt');
expect(sent._data.content).toEqual({
batchId: '61c35bae-77d0-4f7d-b894-be375b838ff6',
bulkTransferId: '81c35bae-77d0-4f7d-b894-be375b838ff6',
bulkTransfersResult
});
});
Expand Down
14 changes: 7 additions & 7 deletions modules/outbound-command-event-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"snapshot": "standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
},
"dependencies": {
"@mojaloop/api-snippets": "16.0.3",
"@mojaloop/api-snippets": "^16.0.4",
"@mojaloop/central-services-shared": "^17.3.1",
"@mojaloop/logging-bc-client-lib": "^0.1.15",
"@mojaloop/logging-bc-public-types-lib": "^0.1.12",
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
"ajv": "^8.11.0",
"convict": "^6.2.3",
"express": "^4.18.1",
"express": "^4.18.2",
"openapi-backend": "^5.5.0",
"redis": "^4.3.1",
"swagger-ui-express": "^4.5.0",
Expand All @@ -56,18 +56,18 @@
"@types/convict": "^6.1.1",
"@types/express": "^4.17.14",
"@types/jest": "^29.1.2",
"@types/node": "^18.8.2",
"@types/node": "^18.8.3",
"@types/node-cache": "^4.2.5",
"@types/supertest": "^2.0.12",
"@types/swagger-ui-express": "^4.1.3",
"@types/yamljs": "^0.2.31",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"copyfiles": "^2.4.1",
"eslint": "^8.24.0",
"eslint": "^8.25.0",
"jest": "^29.1.2",
"nodemon": "^2.0.20",
"npm-check-updates": "^16.3.8",
"npm-check-updates": "^16.3.11",
"replace": "^1.2.1",
"standard-version": "^9.5.0",
"ts-jest": "^29.0.3",
Expand Down
Loading

0 comments on commit b0b3617

Please sign in to comment.