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(mojaloop/#3636): v15.3.0 RC changes #133

Merged
merged 16 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 13 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
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,18 @@
"scripts": {
"preRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')",
"}"
"// if (environment.ENABLE_WS_ASSERTIONS===true) {",
"// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')",
"// }"
oderayi marked this conversation as resolved.
Show resolved Hide resolved
]
},
"postRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
"}"
"// if (environment.ENABLE_WS_ASSERTIONS===true) {",
"// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
"// }",
"",
oderayi marked this conversation as resolved.
Show resolved Hide resolved
"environment.payeeRequest = (await axios.get(environment.PAYEEFSP_SDK_TESTAPI_URL + '/requests/{$inputs.toIdValue}')).data"
]
}
}
Expand Down Expand Up @@ -636,16 +638,18 @@
"scripts": {
"preRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')",
"}"
"// if (environment.ENABLE_WS_ASSERTIONS===true) {",
"// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')",
"// }"
oderayi marked this conversation as resolved.
Show resolved Hide resolved
]
},
"postRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
"}"
"// if (environment.ENABLE_WS_ASSERTIONS===true) {",
"// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
"// }",
oderayi marked this conversation as resolved.
Show resolved Hide resolved
"",
"environment.payeeRequest = (await axios.get(environment.PAYEEFSP_SDK_TESTAPI_URL + '/requests/{$request.body.quoteId}')).data"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
"fulfilment": "{$inputs.validFulfillment}",
"completedTimestamp": "{$environment.fulfillCompletedTimestamp}"
},
"ignoreCallbacks": true,
"ignoreCallbacks": false,
"scriptingEngine": "javascript",
"tests": {
"assertions": [
Expand Down Expand Up @@ -382,7 +382,8 @@
"postRequest": {
"exec": [
"requestVariables.payeeDuplicateCallback = await inboundEvent.getMessage('payeeDuplicateCallback')",
"console.log(requestVariables.payeeDuplicateCallback)"
"console.log(requestVariables.payeeDuplicateCallback)",
""
]
},
"preRequest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"console.log(requestVariables.payeePostQuotes)"
]
}
}
},
"disabled": false
},
{
"id": 2,
Expand Down Expand Up @@ -183,7 +184,8 @@
"console.log(requestVariables.payerPutQuotes)"
]
}
}
},
"disabled": false
},
{
"id": 3,
Expand Down Expand Up @@ -253,7 +255,8 @@
"console.log(requestVariables.payeePostTransfer)"
]
}
}
},
"disabled": false
},
{
"id": 4,
Expand Down Expand Up @@ -309,7 +312,8 @@
""
]
}
}
},
"disabled": false
},
{
"id": 5,
Expand Down Expand Up @@ -427,7 +431,8 @@
"// console.log(environment.newDateString)"
]
}
}
},
"disabled": false
},
{
"id": 6,
Expand Down Expand Up @@ -456,84 +461,83 @@
"Content-Type": "{$inputs.contentTypeTransfers}"
},
"scriptingEngine": "javascript",
"delay": "16000",
"tests": {
"assertions": [
{
"id": 1,
"description": "Response status to be 202",
"exec": [
"expect(response.status).to.equal(202)"
"expect(environment.transferResponse.code).to.equal(202)"
]
},
{
"id": 2,
"description": "Response statusText be Accepted",
"exec": [
"expect(response.statusText).to.equal('Accepted')"
"expect(environment.transferResponse.status).to.equal('Accepted')"
]
},
{
"id": 12,
"description": "Callback Header - fspiop-source is switch",
"exec": [
"expect(callback.headers['fspiop-source']).to.equal('switch')",
"expect(environment.transferCallback.headers['fspiop-source']).to.equal('switch')",
""
]
},
{
"id": 13,
"description": "Callback Header - fspiop-desination is fspiop-source in request",
"exec": [
"expect(callback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')",
"expect(environment.transferCallback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')",
""
]
},
{
"id": 14,
"description": "Callback Header - content-type",
"exec": [
"expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')",
"expect(environment.transferCallback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')",
""
]
},
{
"id": 15,
"description": "Callback Header - accept is empty",
"exec": [
"expect(callback.headers['accept']).to.equal(undefined)",
"expect(environment.transferCallback.headers['accept']).to.equal(undefined)",
""
]
},
{
"id": 16,
"description": "Callback Header - Date is not empty",
"exec": [
"expect(callback.headers['date']).to.not.equal(undefined)",
"expect(environment.transferCallback.headers['date']).to.not.equal(undefined)",
""
]
},
{
"id": 17,
"description": "Callback Header - fspiop-uri is /transfers/transferId",
"exec": [
"expect(callback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)",
"expect(environment.transferCallback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)",
""
]
},
{
"id": 18,
"description": "Callback Header - fspiop-http-method is PUT",
"exec": [
"expect(callback.headers['fspiop-http-method']).to.equal('PUT')",
"expect(environment.transferCallback.headers['fspiop-http-method']).to.equal('PUT')",
""
]
},
{
"id": 21,
"description": "Callback Body - transferState is ABORTED",
"exec": [
"expect(callback.body.transferState).to.equal('ABORTED')",
"expect(environment.transferCallback.body.transferState).to.equal('ABORTED')",
""
]
},
Expand All @@ -542,10 +546,10 @@
"description": "Callback Body - error cause in extensionList",
"exec": [
"",
"expect(callback.body).to.have.property('extensionList')",
"expect(callback.body.extensionList).to.have.property('extension')",
"expect(environment.transferCallback.body).to.have.property('extensionList')",
"expect(environment.transferCallback.body.extensionList).to.have.property('extension')",
"",
"const filteredExtensionListForCause = callback.body.extensionList.extension.filter(ext => ext.key === \"cause\")",
"const filteredExtensionListForCause = environment.transferCallback.body.extensionList.extension.filter(ext => ext.key === \"cause\")",
"",
"expect(filteredExtensionListForCause.length).to.equal(1)",
"",
Expand All @@ -561,8 +565,69 @@
"exec": [
""
]
},
"postRequest": {
"exec": [
"environment.transferResponse = null",
"environment.transferCallback = null",
"const expectedTransferState = 'ABORTED'",
"",
"// lets get retry config",
"const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20",
"const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250",
"",
"const callbackName = 'put-transfer'",
"const callbackPath = `/transfers/{$prev.3.request.body.transferId}`",
"",
"async function main() {",
" let _response = response",
" let _callback = callback",
"",
" for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {",
" console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)",
" ",
" const isOk = _callback?.body?.transferState === expectedTransferState;",
" ",
" if (isOk) {",
" console.log(`Everything is OK, let's continue`)",
" environment.transferResponse = _response",
" environment.transferCallback = _callback",
oderayi marked this conversation as resolved.
Show resolved Hide resolved
" break;",
" } else {",
" console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)",
" await custom.sleep(maxRetryWait)",
" await inboundEvent.addListener(callbackName, 'put', callbackPath)",
" const axiosRes = await makeRequest()",
" _response = { code: axiosRes.status, status: axiosRes.statusText }",
" _callback = await inboundEvent.getMessage(callbackName)",
" console.log(`retryCount: ${retryCount+1} - ${callbackName} callback: `, _callback)",
" ",
" }",
" }",
"}",
"",
"async function makeRequest() {",
" const reqParams = {",
" method: 'get', ",
" url: `{$inputs.HOST_ML_API_ADAPTER}/transfers/{$prev.3.request.body.transferId}`,",
" headers: {",
" 'Content-Type': `{$inputs.contentTypeTransfers}`,",
" Accept: `{$inputs.acceptTransfers}`,",
" Date: `{$function.generic.curDate}`,",
" 'FSPIOP-Source': `{$inputs.fromFspId}`,",
" Authorization: `{$inputs.TTK_BEARER_TOKEN}`",
" }",
" };",
" ",
" return axios(reqParams);",
"}",
"",
"await main()"
]
}
}
},
"ignoreCallbacks": false,
"delay": "1000"
}
]
}
Expand Down
Loading