diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index 7f12b1d2..b6176f8a 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -436,16 +436,20 @@ "scripts": { "preRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", - "}" + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API on the postRequest instead until it can be resolved.", + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", + "// }" ] }, "postRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", - "}" + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API instead until it can be resolved.", + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }", + "", + "environment.payeeRequest = (await axios.get(environment.PAYEEFSP_SDK_TESTAPI_URL + '/requests/{$inputs.toIdValue}')).data" ] } } @@ -636,16 +640,20 @@ "scripts": { "preRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", - "}" + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API on the postRequest instead until it can be resolved.", + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", + "// }" ] }, "postRequest": { "exec": [ - "if (environment.ENABLE_WS_ASSERTIONS===true) {", - " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", - "}" + "// NOTE: This has been commented out due to the WS issue https://github.com/mojaloop/project/issues/3164, with a work-around to call the HTTP equivalent API instead until it can be resolved.", + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }", + "", + "environment.payeeRequest = (await axios.get(environment.PAYEEFSP_SDK_TESTAPI_URL + '/requests/{$request.body.quoteId}')).data" ] } } diff --git a/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json b/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json index 9c50abfd..7e35bf0e 100644 --- a/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json +++ b/collections/hub/golden_path/feature_tests/duplicate_handling/transfers/fulfill_commit.json @@ -343,7 +343,7 @@ "fulfilment": "{$inputs.validFulfillment}", "completedTimestamp": "{$environment.fulfillCompletedTimestamp}" }, - "ignoreCallbacks": true, + "ignoreCallbacks": false, "scriptingEngine": "javascript", "tests": { "assertions": [ @@ -382,7 +382,8 @@ "postRequest": { "exec": [ "requestVariables.payeeDuplicateCallback = await inboundEvent.getMessage('payeeDuplicateCallback')", - "console.log(requestVariables.payeeDuplicateCallback)" + "console.log(requestVariables.payeeDuplicateCallback)", + "" ] }, "preRequest": { diff --git a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json index d2f5d25c..1f2e2639 100644 --- a/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json +++ b/collections/hub/golden_path/feature_tests/transfer_negative_scenarios/fulfil-reserved-v1.0.json @@ -106,7 +106,8 @@ "console.log(requestVariables.payeePostQuotes)" ] } - } + }, + "disabled": false }, { "id": 2, @@ -183,7 +184,8 @@ "console.log(requestVariables.payerPutQuotes)" ] } - } + }, + "disabled": false }, { "id": 3, @@ -253,7 +255,8 @@ "console.log(requestVariables.payeePostTransfer)" ] } - } + }, + "disabled": false }, { "id": 4, @@ -309,7 +312,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 5, @@ -427,7 +431,8 @@ "// console.log(environment.newDateString)" ] } - } + }, + "disabled": false }, { "id": 6, @@ -456,28 +461,27 @@ "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(requestVariables.transferResponse.code).to.equal(202)" ] }, { "id": 2, "description": "Response statusText be Accepted", "exec": [ - "expect(response.statusText).to.equal('Accepted')" + "expect(requestVariables.transferResponse.status).to.equal('Accepted')" ] }, { "id": 12, "description": "Callback Header - fspiop-source is switch", "exec": [ - "expect(callback.headers['fspiop-source']).to.equal('switch')", + "expect(requestVariables.transferCallback.headers['fspiop-source']).to.equal('switch')", "" ] }, @@ -485,7 +489,7 @@ "id": 13, "description": "Callback Header - fspiop-desination is fspiop-source in request", "exec": [ - "expect(callback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')", + "expect(requestVariables.transferCallback.headers['fspiop-destination']).to.equal('{$inputs.fromFspId}')", "" ] }, @@ -493,7 +497,7 @@ "id": 14, "description": "Callback Header - content-type", "exec": [ - "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')", + "expect(requestVariables.transferCallback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')", "" ] }, @@ -501,7 +505,7 @@ "id": 15, "description": "Callback Header - accept is empty", "exec": [ - "expect(callback.headers['accept']).to.equal(undefined)", + "expect(requestVariables.transferCallback.headers['accept']).to.equal(undefined)", "" ] }, @@ -509,7 +513,7 @@ "id": 16, "description": "Callback Header - Date is not empty", "exec": [ - "expect(callback.headers['date']).to.not.equal(undefined)", + "expect(requestVariables.transferCallback.headers['date']).to.not.equal(undefined)", "" ] }, @@ -517,7 +521,7 @@ "id": 17, "description": "Callback Header - fspiop-uri is /transfers/transferId", "exec": [ - "expect(callback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)", + "expect(requestVariables.transferCallback.headers['fspiop-uri']).to.equal('/transfers/' + request.params.ID)", "" ] }, @@ -525,7 +529,7 @@ "id": 18, "description": "Callback Header - fspiop-http-method is PUT", "exec": [ - "expect(callback.headers['fspiop-http-method']).to.equal('PUT')", + "expect(requestVariables.transferCallback.headers['fspiop-http-method']).to.equal('PUT')", "" ] }, @@ -533,7 +537,7 @@ "id": 21, "description": "Callback Body - transferState is ABORTED", "exec": [ - "expect(callback.body.transferState).to.equal('ABORTED')", + "expect(requestVariables.transferCallback.body.transferState).to.equal('ABORTED')", "" ] }, @@ -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(requestVariables.transferCallback.body).to.have.property('extensionList')", + "expect(requestVariables.transferCallback.body.extensionList).to.have.property('extension')", "", - "const filteredExtensionListForCause = callback.body.extensionList.extension.filter(ext => ext.key === \"cause\")", + "const filteredExtensionListForCause = requestVariables.transferCallback.body.extensionList.extension.filter(ext => ext.key === \"cause\")", "", "expect(filteredExtensionListForCause.length).to.equal(1)", "", @@ -561,8 +565,69 @@ "exec": [ "" ] + }, + "postRequest": { + "exec": [ + "requestVariables.transferResponse = null", + "requestVariables.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`)", + " requestVariables.transferResponse = _response", + " requestVariables.transferCallback = _callback", + " 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" } ] } diff --git a/collections/hub/golden_path/settlement_cgs/newsetcgs.json b/collections/hub/golden_path/settlement_cgs/newsetcgs.json index b97822df..cd29f807 100644 --- a/collections/hub/golden_path/settlement_cgs/newsetcgs.json +++ b/collections/hub/golden_path/settlement_cgs/newsetcgs.json @@ -1902,7 +1902,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -1973,7 +1973,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -2042,7 +2042,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -2112,7 +2112,7 @@ "FSPIOP-Source": "{$inputs.fromFspId}" }, "scriptingEngine": "javascript", - "disabled": true, + "disabled": false, "scripts": { "preRequest": { "exec": [ @@ -5417,14 +5417,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.scenarioResponse.code).to.equal(200)" ] }, { "id": 55, "description": "Transfer state is 'COMMITTED'", "exec": [ - "expect(response.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" + "expect(requestVariables.scenarioResponse.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" ] } ] @@ -5438,10 +5438,62 @@ " await websocket.connect(environment.PAYERFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$inputs.SIMPAYEE_MSISDN}', 'payerCallback')", "}", "*/", - "requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", - "requestVariables.expectedPayeeLastName = \"PayeeLast\"", - "requestVariables.expectedPayeeDOB = \"2010-10-10\"", - "requestVariables.payerName = \"PayerFirst PayerLast\"" + "// requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", + "// requestVariables.expectedPayeeLastName = \"PayeeLast\"", + "// requestVariables.expectedPayeeDOB = \"2010-10-10\"", + "// requestVariables.payerName = \"PayerFirst PayerLast\"", + "", + "", + "", + "" + ] + }, + "postRequest": { + "exec": [ + "// requestVariables.scenarioResponse = {...response, status: response.code}", + "", + "// 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 expectedStatusCode = 200", + "requestVariables.scenarioResponse = null", + " ", + "async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode;", + " ", + " if (isOk) {", + " requestVariables.scenarioResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", + " ", + "function makeRequest() {", + " const reqParams = {", + " method: request.method, ", + " url: `${request.url}${request.path}`,", + " data: request.body,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", + " ", + " return axios(reqParams);", + "}", + " ", + "await main()" ] } } @@ -5544,7 +5596,8 @@ "requestVariables.payerName = \"PayerFirst PayerLast\"" ] } - } + }, + "disabled": false }, { "id": 5, @@ -5644,7 +5697,8 @@ "requestVariables.payerName = \"PayerFirst PayerLast\"" ] } - } + }, + "disabled": false }, { "id": 6, @@ -5744,7 +5798,8 @@ "requestVariables.payerName = \"PayerFirst PayerLast\"" ] } - } + }, + "disabled": false } ] }, @@ -6241,14 +6296,14 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.scenarioResponse.code).to.equal(200)" ] }, { "id": 55, "description": "Transfer state is 'COMMITTED'", "exec": [ - "expect(response.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" + "expect(requestVariables.scenarioResponse.body.scenario2.result.fulfil.body.transferState).to.equal('COMMITTED')" ] } ] @@ -6262,10 +6317,61 @@ " await websocket.connect(environment.PAYERFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$inputs.SIMPAYEE_MSISDN}', 'payerCallback')", "}", "*/", - "requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", - "requestVariables.expectedPayeeLastName = \"PayeeLast\"", - "requestVariables.expectedPayeeDOB = \"2010-10-10\"", - "requestVariables.payerName = \"PayerFirst PayerLast\"" + "// requestVariables.expectedPayeeFirstName = \"PayeeFirst\"", + "// requestVariables.expectedPayeeLastName = \"PayeeLast\"", + "// requestVariables.expectedPayeeDOB = \"2010-10-10\"", + "// requestVariables.payerName = \"PayerFirst PayerLast\"", + "", + "" + ] + }, + "postRequest": { + "exec": [ + "// requestVariables.scenarioResponse = {...response, status: response.code}", + "// console.log(requestVariables.scenarioResponse)", + "", + "// 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 expectedStatusCode = 200", + "requestVariables.scenarioResponse = null", + " ", + "async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode;", + " ", + " if (isOk) {", + " requestVariables.scenarioResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", + " ", + "function makeRequest() {", + " const reqParams = {", + " method: request.method, ", + " url: `${request.url}${request.path}`,", + " data: request.body,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", + " ", + " return axios(reqParams);", + "}", + " ", + "await main()" ] } } diff --git a/collections/hub/master.json b/collections/hub/master.json index 08f9a68a..2c806858 100644 --- a/collections/hub/master.json +++ b/collections/hub/master.json @@ -35,6 +35,10 @@ { "name": "thirdparty", "type": "folder" + }, + { + "name": "provisioning_dfsp", + "type": "folder" } ] } \ No newline at end of file diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json index c0366396..a0d848a2 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -47,7 +47,8 @@ "environment[\"payerfspPositionBeforePrepare\"] = response.body[0].value" ] } - } + }, + "disabled": false }, { "id": 2, @@ -85,7 +86,8 @@ "environment[\"payeefspPositionBeforePrepare\"] = response.body[0].value" ] } - } + }, + "disabled": false }, { "id": 3, @@ -184,7 +186,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 4, @@ -228,7 +231,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 9, @@ -303,7 +307,8 @@ "" ] } - } + }, + "disabled": false }, { "id": 6, @@ -338,61 +343,112 @@ "id": 1, "description": "Status code is 202", "exec": [ - "expect(response.status).to.equal(202)" + "expect(requestVariables.bulkTransferResponse.code).to.equal(202)" ] }, { "id": 2, "description": "payerfsp callback - date header should be set", "exec": [ - "expect(callback.headers).to.have.property('date')" + "expect(requestVariables.bulkTransferCallback.headers).to.have.property('date')" ] }, { "id": 3, "description": "payerfsp callback - fspiop-source should be switch", "exec": [ - "expect(callback.headers['fspiop-source']).to.equal('switch')" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-source']).to.equal('switch')" ] }, { "id": 4, "description": "payerfsp callback - fspiop-destination should be testingtoolkitdfsp", "exec": [ - "expect(callback.headers['fspiop-destination']).to.equal(environment.fromFspId)" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-destination']).to.equal(environment.fromFspId)" ] }, { "id": 5, "description": "payerfsp callback - fspiop-uri should be as expected", "exec": [ - "expect(callback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}`)" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}`)" ] }, { "id": 6, "description": "payerfsp callback - fspiop-http-method should be PUT", "exec": [ - "expect(callback.headers['fspiop-http-method']).to.equal('PUT')" + "expect(requestVariables.bulkTransferCallback.headers['fspiop-http-method']).to.equal('PUT')" ] }, { "id": 8, "description": "payerfsp callback - errorInformation should be set correctly", "exec": [ - "expect(callback.body).to.have.property(\"bulkTransferState\")", - "expect(callback.body.bulkTransferState).to.equal(\"REJECTED\")" + "expect(requestVariables.bulkTransferCallback.body).to.have.property(\"bulkTransferState\")", + "expect(requestVariables.bulkTransferCallback.body.bulkTransferState).to.equal(\"REJECTED\")" ] } ] }, "ignoreCallbacks": false, "scriptingEngine": "javascript", - "delay": "1000", "scripts": { "postRequest": { "exec": [ - "" + "requestVariables.bulkTransferResponse = null", + "requestVariables.bulkTransferCallback = null", + "const expectedBulkTransferState = 'REJECTED'", + "const callbackPath = `/bulkTransfers/{$environment.bulkTransferId}`", + "const callbackName = 'put-bulk-transfer'", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "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?.bulkTransferState === expectedBulkTransferState;", + " ", + " if (isOk) {", + " console.log(`Everything is OK, let's continue`)", + " requestVariables.bulkTransferResponse = _response", + " requestVariables.bulkTransferCallback = _callback", + " 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(callback_name) {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_BULK_ADAPTER}/bulkTransfers/{$environment.bulkTransferId}`,", + " headers: {", + " 'Content-Type': `{$inputs.contentBulkTransfers}`,", + " Accept: `{$inputs.acceptBulkTransfers}`,", + " Date: `{$environment.headerDate}`,", + " 'FSPIOP-Source': `{$inputs.fromFspId}`,", + " 'FSPIOP-Destination': 'switch'", + " }", + " };", + " ", + " return axios(reqParams)", + "}", + "", + "await main()" ] }, "preRequest": { @@ -400,7 +456,9 @@ "" ] } - } + }, + "disabled": false, + "delay": "1000" }, { "id": 7, @@ -427,18 +485,64 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payerfsp position after Payer ABORT should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" ] } ] - } + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "const expectedStatusCode = 200;", + "requestVariables.participantsPositionResponse = null", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let _response = response", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode;", + " ", + " if (isOk) {", + " requestVariables.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", + "", + "function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.fromFspId}/positions`", + " };", + " ", + " return axios(reqParams);", + "}", + "", + "await main()" + ] + } + }, + "disabled": false }, { "id": 8, @@ -464,17 +568,63 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payeefsp position after Payee ABORT should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" ] } ] + }, + "scriptingEngine": "javascript", + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "const expectedStatusCode = 200;", + "requestVariables.participantsPositionResponse = null", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let _response = response", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode;", + " ", + " if (isOk) {", + " requestVariables.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + "}", + "", + "function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.NORESPONSE_NAME}/positions`", + " };", + " ", + " return axios(reqParams);", + "}", + "", + "await main()" + ] + } } } ] diff --git a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json index d293536b..20c61446 100644 --- a/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json +++ b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json @@ -265,8 +265,8 @@ "scripts": { "postRequest": { "exec": [ - "var jsonData = pm.response.body;", - "pm.environment.set(\"payerfspPositionAfterPrepare\", jsonData[0].value)" + "var jsonData = response.body", + "environment.payerfspPositionAfterPrepare = jsonData[0].value" ] }, "preRequest": { @@ -274,7 +274,8 @@ "" ] } - } + }, + "scriptingEngine": "javascript" }, { "id": 7, @@ -301,18 +302,63 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payerfsp position after (bulk) timeout should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payerfspPositionBeforePrepare)" ] } ] - } + }, + "scripts": { + "postRequest": { + "exec": [ + " const expectedStatusCode = 200;", + " requestVariables.participantsPositionResponse = null", + " ", + " // lets get retry config", + " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + " ", + " async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode && _response.body[0].value === (+environment.payerfspPositionBeforePrepare)", + " ", + " if (isOk) {", + " requestVariables.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + " }", + " ", + " function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.fromFspId}/positions`", + " };", + " ", + " return axios(reqParams);", + " }", + " ", + " await main()" + ] + } + }, + "scriptingEngine": "javascript" }, { "id": 8, @@ -338,17 +384,62 @@ "id": 1, "description": "Status code is 200", "exec": [ - "expect(response.status).to.equal(200)" + "expect(requestVariables.participantsPositionResponse.code).to.equal(200)" ] }, { "id": 2, "description": "Payeefsp position after timeout should be same as position before prepare.", "exec": [ - "expect(response.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" + "expect(requestVariables.participantsPositionResponse.body[0].value).to.equal(+environment.payeefspPositionBeforePrepare)" ] } ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + " const expectedStatusCode = 200;", + " requestVariables.participantsPositionResponse = null", + " ", + " // lets get retry config", + " const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + " const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + " ", + " async function main() {", + " let _response = response", + " ", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = _response.code === expectedStatusCode && _response.body[0].value === (+environment.payeefspPositionBeforePrepare)", + " ", + " if (isOk) {", + " requestVariables.participantsPositionResponse = _response", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " const axiosRes = await makeRequest()", + " _response = { body: axiosRes.data, code: axiosRes.status }", + " }", + " }", + " }", + " ", + " function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/{$inputs.NORESPONSE_NAME}/positions`", + " };", + " ", + " return axios(reqParams);", + " }", + " ", + " await main()" + ] + } } } ] diff --git a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json index b4d3ac76..7cac5a30 100644 --- a/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json +++ b/collections/hub/provisioning/CGS_Specific/adjust-participants-limits.json @@ -32,12 +32,60 @@ "id": 1, "description": "response code 200", "exec": [ - "expect(response.status).to.equal(200)" + "const statusCode = requestVariables.participantLimitsResponseCode", + "expect(statusCode).to.equal(200)" ] } ] }, - "delay": "{$inputs.DELAY_CGS}" + "delay": "{$inputs.DELAY_CGS}", + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "const expectedStatusCode = 200;", + "requestVariables.participantLimitsResponseCode = null", + "", + "// lets get retry config", + "const maxRetryCount = Number.parseFloat(environment.RETRY_MAX_ATTEMPTS) || 20", + "const maxRetryWait = Number.parseFloat(environment.RETRY_MAX_WAIT_IN_MS) || 250", + "", + "async function main() {", + " let statusCode = response.code", + "", + " for (let retryCount = 0 ; retryCount < maxRetryCount; retryCount++) {", + " console.log(`retry-count=${retryCount+1}, max-count=${maxRetryCount}, max-wait=${maxRetryWait}`)", + " ", + " const isOk = statusCode === expectedStatusCode;", + " ", + " if (isOk) {", + " requestVariables.participantLimitsResponseCode = statusCode", + " console.log(`Everything is OK, let's continue`)", + " break;", + " } else {", + " console.log(`Everything is NOT OK, let's wait for ${maxRetryWait}ms, and try again...`)", + " await custom.sleep(maxRetryWait);", + " statusCode = (await makeRequest()).status", + " }", + " }", + "}", + "", + "function makeRequest() {", + " const reqParams = {", + " method: 'get', ", + " url: `{$inputs.HOST_CENTRAL_LEDGER}/participants/limits`,", + " headers: {", + " 'Content-Type': 'application/json',", + " }", + " };", + " ", + " return axios(reqParams);", + "}", + "", + "await main()" + ] + } + } }, { "id": 2, @@ -79,7 +127,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 3, @@ -121,7 +170,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 4, @@ -163,7 +213,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 5, @@ -205,7 +256,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 6, @@ -247,7 +299,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 7, @@ -289,7 +342,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" }, { "id": 8, @@ -319,7 +373,8 @@ ] } ] - } + }, + "scriptingEngine": "javascript" } ], "fileInfo": { diff --git a/collections/hub/provisioning_dfsp/newdfsp.json b/collections/hub/provisioning_dfsp/newdfsp.json index d6eddb68..ed95901f 100644 --- a/collections/hub/provisioning_dfsp/newdfsp.json +++ b/collections/hub/provisioning_dfsp/newdfsp.json @@ -260,7 +260,7 @@ } ], "fileInfo": { - "path": "provisioning_dfsp/newdfsp.json" + "path": "hub/provisioning_dfsp/newdfsp.json" } }, { @@ -1094,7 +1094,7 @@ } ], "fileInfo": { - "path": "provisioning_dfsp/newdfsp.json" + "path": "hub/provisioning_dfsp/newdfsp.json" } }, { @@ -1220,7 +1220,7 @@ } ], "fileInfo": { - "path": "provisioning_dfsp/newdfsp.json" + "path": "hub/provisioning_dfsp/newdfsp.json" } } ] diff --git a/collections/hub/provisioning_thirdparty/README.md b/collections/hub/provisioning_thirdparty/README.md deleted file mode 100644 index bdf154cc..00000000 --- a/collections/hub/provisioning_thirdparty/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# provisioning_thirdparty - -This collection configures the following participants: - -- `pispa` - a Payment Initiation Service Provider (PISP) -- `dfspa` - a DFSP that supports PISP account linking -- `dfpsb` - an ordinary DFSP that does not support account linking - -And the following parties: - -- dfpspa: `MSISDN/589408120` - Paolo Fernandez -- dfpspb: `MSISDN/329294234` - Daniel Rizal -- dfpspb: `MSISDN/32929124` - Alejandro Leon \ No newline at end of file