Skip to content

Commit

Permalink
fix(mojaloop/3285): request to pay scenario field format (#442)
Browse files Browse the repository at this point in the history
* chore: added sample tests

* fix: transaction type object format in request-to-pay-model

* chore: updated deps

* chore(snapshot): 22.0.2-snapshot.0

* fix: license issue with dependencies with these commands
* yarn set resolution glob@npm:^9.2.0 8.1.0
* yarn set resolution glob@npm:^9.3.0 8.1.0
* yarn set resolution glob@npm:^9.3.1 8.1.0
Note: Glob v9.x introducing a dependency Package "[email protected]" which is licensed under "BlueOak-1.0.0" which is not permitted by the Mojaloop License Policy

* fix: changed the ubuntu version to specific in executor

* fix: added KAFKA_ENABLE_KRAFT on docker compose to disable KRAFT

* chore: updated circleci default-machine ubuntu image

* chore: updated circleci default-machine ubuntu image

* fix: downgraded kafka docker version in func tests

* chore: updated fun docker-compose

- removed dependency on zookeeper
- updated kafka to use "kraft"
- updated ports to reflect this change

* fix: revert some updates

* fix: revert some updates fixed lock file

* fix: reverted package.json files

* fix: reverted package.json files yarn.lock

* fix: reverted yarn.lock

* fix: kafka port in api-svc

* fix: reverted kafka config changes

* chore: update dependencies

* chore(snapshot): 22.0.2-snapshot.1

* chore(snapshot): 22.0.2-snapshot.2

* chore: dep update yarn.lock

* chore(snapshot): 22.0.2-snapshot.3

* chore: update deps

---------

Co-authored-by: Miguel de Barros <[email protected]>
  • Loading branch information
vijayg10 and mdebarros authored Apr 27, 2023
1 parent 35a211f commit 7121e12
Show file tree
Hide file tree
Showing 15 changed files with 1,332 additions and 847 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ executors:
default-machine:
working_directory: *WORKING_DIR
machine:
image: ubuntu-2204:current # Ref: https://circleci.com/developer/machine/image/ubuntu-2204
image: ubuntu-2204:2023.04.2 # Ref: https://circleci.com/developer/machine/image/ubuntu-2204

##
# Jobs
Expand Down
4 changes: 3 additions & 1 deletion .ncurc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ reject: [
## TODO: Investigate.
'@mojaloop/platform-shared-lib-nodejs-kafka-client-lib',
## TODO: The kafka connectivity is not working properly and the following update is causing service crash.
'@mojaloop/logging-bc-client-lib'
'@mojaloop/logging-bc-client-lib',
## TODO: The new version of npm-check-updates uses new Glob v9.x and it is introducing a dependency Package "[email protected]" which is licensed under "BlueOak-1.0.0" which is not permitted by the Mojaloop License Policy
npm-check-updates
]
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ services:
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CFG_MESSAGE_MAX_BYTES: 200000000
KAFKA_ENABLE_KRAFT: "no"
depends_on:
- zookeeper
healthcheck:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"test_cases": [
{
"id": 1,
"name": "FSPIOP Post Transaction Requests",
"requests": [
{
"id": 1,
"description": "POST /transactionRequests",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "fspiop",
"asynchronous": true,
"specFile": "spec_files/api_definitions/fspiop_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/fspiop_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/fspiop_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/fspiop_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/fspiop_1.0/trigger_templates"
},
"operationPath": "/transactionRequests",
"path": "/transactionRequests",
"method": "post",
"url": "http://host.docker.internal:4000",
"body": {
"transactionRequestId": "{$function.generic.generateUUID}",
"payer": {
"partyIdType": "MSISDN",
"partyIdentifier": "25644444444",
"fspId": "mojaloop-sdk"
},
"payee": {
"partyIdInfo": {
"partyIdType": "MSISDN",
"partyIdentifier": "1234567890",
"fspId": "switch"
},
"personalInfo": {
"complexName": {
"firstName": "Justin",
"middleName": "Pierre",
"lastName": "Trudeau"
},
"dateOfBirth": "1980-01-01"
}
},
"amount": {
"currency": "USD",
"amount": "10"
},
"transactionType": {
"scenario": "TRANSFER",
"initiator": "PAYEE",
"initiatorType": "CONSUMER"
}
},
"headers": {
"Accept": "application/vnd.interoperability.transactionRequests+json;version=1",
"Content-Type": "application/vnd.interoperability.transactionRequests+json;version=1.0",
"Date": "{$function.generic.curDate}",
"FSPIOP-Source": ""
}
}
],
"fileInfo": {
"path": "sample-tests/inbound-transaction-requests.json"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"test_cases": [
{
"id": 1,
"name": "Post Request To Pay",
"requests": [
{
"id": 1,
"description": "Post /requestToPay",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/requestToPay",
"path": "/requestToPay",
"method": "post",
"url": "http://host.docker.internal:4001",
"body": {
"homeTransactionId": "abc123",
"from": {
"idType": "MSISDN",
"idValue": "25644444444"
},
"to": {
"idType": "MSISDN",
"idValue": "1234567890"
},
"amountType": "SEND",
"currency": "USD",
"amount": "10",
"transactionType": "TRANSFER"
}
}
],
"fileInfo": {
"path": "sample-tests/outbound-request-to-pay.json"
}
}
]
}
49 changes: 49 additions & 0 deletions docker/ml-testing-toolkit/sample-tests/outbound-transfer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"test_cases": [
{
"id": 1,
"name": "Post Transfer",
"requests": [
{
"id": 1,
"description": "Post Transfer",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "scheme_adapter_outbound",
"prefix": "/sdk-out",
"hostnames": [],
"specFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/trigger_templates"
},
"operationPath": "/transfers",
"path": "/transfers",
"method": "post",
"url": "http://host.docker.internal:4001",
"body": {
"homeTransactionId": "abc123",
"from": {
"idType": "MSISDN",
"idValue": "25644444444"
},
"to": {
"idType": "MSISDN",
"idValue": "1234567890"
},
"amountType": "SEND",
"currency": "USD",
"amount": "10",
"transactionType": "TRANSFER",
"note": "string"
}
}
],
"fileInfo": {
"path": "sample-tests/outbound-transfer.json"
}
}
]
}
42 changes: 42 additions & 0 deletions docker/ml-testing-toolkit/spec_files/rules_callback/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,5 +588,47 @@
},
"type": "callback",
"version": 1
},
{
"ruleId": 9,
"priority": 1,
"description": "post /transactionRequests",
"apiVersion": {
"minorVersion": 0,
"majorVersion": 1,
"type": "fspiop",
"asynchronous": true,
"specFile": "spec_files/api_definitions/fspiop_1.0/api_spec.yaml",
"callbackMapFile": "spec_files/api_definitions/fspiop_1.0/callback_map.json",
"responseMapFile": "spec_files/api_definitions/fspiop_1.0/response_map.json",
"jsfRefFile": "spec_files/api_definitions/fspiop_1.0/mockRef.json",
"triggerTemplatesFolder": "spec_files/api_definitions/fspiop_1.0/trigger_templates"
},
"conditions": {
"all": [
{
"fact": "operationPath",
"operator": "equal",
"value": "/transactionRequests"
},
{
"fact": "method",
"operator": "equal",
"value": "post"
}
]
},
"event": {
"method": "put",
"path": "/transactionRequests/{ID}",
"params": {
"scripts": {
"scriptingEngine": "postman"
}
},
"type": "MOCK_CALLBACK"
},
"type": "callback",
"version": 1
}
]
32 changes: 16 additions & 16 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.6.3",
"version": "20.6.4-snapshot.3",
"description": "An adapter for connecting to Mojaloop API enabled switches.",
"main": "src/index.js",
"types": "src/index.d.ts",
Expand Down Expand Up @@ -61,7 +61,7 @@
},
"dependencies": {
"@koa/cors": "^4.0.0",
"@mojaloop/api-snippets": "17.0.3",
"@mojaloop/api-snippets": "17.0.4",
"@mojaloop/central-services-error-handling": "^12.0.5",
"@mojaloop/central-services-logger": "^11.2.0",
"@mojaloop/central-services-metrics": "^12.0.5",
Expand All @@ -70,44 +70,44 @@
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
"@mojaloop/sdk-standard-components": "^17.1.1",
"ajv": "8.12.0",
"axios": "^1.3.4",
"axios": "^1.3.6",
"co-body": "^6.1.0",
"dotenv": "^16.0.3",
"env-var": "^7.3.0",
"env-var": "^7.3.1",
"express": "^4.18.2",
"fast-json-patch": "^3.1.1",
"javascript-state-machine": "^3.1.0",
"js-yaml": "^4.1.0",
"json-schema-ref-parser": "^9.0.9",
"koa": "^2.14.1",
"koa": "^2.14.2",
"koa-body": "^6.0.1",
"lodash": "^4.17.21",
"module-alias": "^2.2.2",
"oauth2-server": "^4.0.0-dev.2",
"openapi-jsonschema-parameters": "^12.1.0",
"prom-client": "^14.1.1",
"prom-client": "^14.2.0",
"promise-timeout": "^1.3.0",
"random-word-slugs": "^0.1.6",
"random-word-slugs": "^0.1.7",
"redis": "^4.6.5",
"uuidv4": "^6.2.13",
"ws": "^8.12.1"
"ws": "^8.13.0"
},
"devDependencies": {
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"@babel/core": "^7.21.4",
"@babel/preset-env": "^7.21.4",
"@redocly/openapi-cli": "^1.0.0-beta.94",
"@types/jest": "^29.4.0",
"babel-jest": "^29.4.3",
"eslint": "^8.35.0",
"@types/jest": "^29.5.1",
"babel-jest": "^29.5.0",
"eslint": "^8.39.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"jest": "^29.4.3",
"jest-junit": "^15.0.0",
"jest": "^29.5.0",
"jest-junit": "^16.0.0",
"nock": "^13.3.0",
"npm-check-updates": "^16.7.10",
"openapi-response-validator": "^12.1.0",
"openapi-typescript": "^6.1.1",
"openapi-typescript": "^6.2.3",
"redis-mock": "^0.56.3",
"replace": "^1.2.2",
"standard-version": "^9.5.0",
Expand Down
6 changes: 3 additions & 3 deletions modules/api-svc/src/lib/model/OutboundRequestToPayModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ class OutboundRequestToPayModel {
amount: this.data.amount
},
transactionType: {
scenario: this.data.scenario,
scenario: this.data.transactionType,
subScenario: this.data.subScenario,
initiator: this.data.initiator,
initiatorType: this.data.initiatorType
initiator: 'PAYEE',
initiatorType: this.data.from.type || 'CONSUMER'
}
};

Expand Down
26 changes: 13 additions & 13 deletions 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.18",
"version": "0.2.19-snapshot.3",
"description": "mojaloop sdk scheme adapter command event handler",
"license": "Apache-2.0",
"homepage": "https://github.com/mojaloop/sdk-scheme-adapter/",
Expand Down Expand Up @@ -41,40 +41,40 @@
"snapshot": "standard-version --no-verify --skip.changelog --prerelease snapshot --releaseCommitMessageFormat 'chore(snapshot): {{currentTag}}'"
},
"dependencies": {
"@mojaloop/api-snippets": "17.0.3",
"@mojaloop/api-snippets": "17.0.4",
"@mojaloop/central-services-shared": "^17.5.1",
"@mojaloop/logging-bc-client-lib": "^0.1.17",
"@mojaloop/logging-bc-public-types-lib": "^0.1.15",
"@mojaloop/logging-bc-public-types-lib": "^0.1.19",
"@mojaloop/sdk-scheme-adapter-private-shared-lib": "workspace:^",
"ajv": "^8.12.0",
"convict": "^6.2.4",
"express": "^4.18.2",
"openapi-backend": "^5.6.2",
"openapi-backend": "^5.9.1",
"redis": "^4.6.5",
"swagger-ui-express": "^4.6.2",
"yamljs": "^0.3.0"
},
"devDependencies": {
"@types/convict": "^6.1.1",
"@types/express": "^4.17.17",
"@types/jest": "^29.4.0",
"@types/node": "^18.14.2",
"@types/jest": "^29.5.1",
"@types/node": "^18.16.1",
"@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.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"copyfiles": "^2.4.1",
"eslint": "^8.35.0",
"jest": "^29.4.3",
"nodemon": "^2.0.20",
"eslint": "^8.39.0",
"jest": "^29.5.0",
"nodemon": "^2.0.22",
"npm-check-updates": "^16.7.10",
"replace": "^1.2.2",
"standard-version": "^9.5.0",
"ts-jest": "^29.0.5",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"typescript": "^5.0.4"
},
"nodemonConfig": {
"watch": [
Expand Down
Loading

0 comments on commit 7121e12

Please sign in to comment.