diff --git a/collections/hub/other_tests/bulk_transfers/bulk-duplicated-transfers.json b/collections/hub/other_tests/bulk_transfers/bulk-duplicated-transfers.json new file mode 100644 index 00000000..b99b424e --- /dev/null +++ b/collections/hub/other_tests/bulk_transfers/bulk-duplicated-transfers.json @@ -0,0 +1,1089 @@ +{ + "name": "multi", + "test_cases": [ + { + "id": 1, + "name": "negative scenario - duplicate repeat bulk transfer", + "meta": { + "info": "negative scenario - duplicate repeat bulk transfer" + }, + "fileInfo": { + "path": "bulk_transfers/bulk-duplicated-transfers.json" + }, + "requests": [ + { + "id": 3, + "meta": { + "info": "POST Bulk Transfer" + }, + "description": "POST Bulk Transfer", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$environment.transid}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "{$inputs.toFspId}", + "payerFsp": "{$inputs.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency2}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "payerfsp callback - date header should be set", + "exec": [ + "expect(callback.headers).to.have.property('date')" + ] + }, + { + "id": 3, + "description": "payerfsp callback - fspiop-source should be payeefsp", + "exec": [ + "expect(callback.headers['fspiop-source']).to.equal(environment.toFspId)" + ] + }, + { + "id": 4, + "description": "payerfsp callback - fspiop-destination should be testingtoolkitdfsp", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal(environment.fromFspId)" + ] + }, + { + "id": 5, + "description": "payerfsp callback - fspiop-http-method should be PUT", + "exec": [ + "expect(callback.headers['fspiop-http-method']).to.equal('PUT')" + ] + }, + { + "id": 6, + "description": "payerfsp callback - fspiop-uri should be /payerfsp/bulkTransfers/", + "exec": [ + "expect(callback.headers['fspiop-uri']).to.equal(`/${environment.fromFspId}/bulkTransfers/${environment.bulkTransferId}`)" + ] + }, + { + "id": 7, + "description": "payerfsp callback - Bulk Transfer state should be COMPLETED on Payer side", + "exec": [ + "expect(callback.body.bulkTransferState).to.equal('COMPLETED')" + ] + }, + { + "id": 8, + "description": "payerfsp callback - Completed timestamp should be set", + "exec": [ + "expect(callback.body).to.have.property('completedTimestamp')" + ] + }, + { + "id": 9, + "description": "payerfsp callback - All individual transfer results (failed & successful) should be returned", + "exec": [ + "expect(callback.body.individualTransferResults.length).to.equal(2)" + ] + }, + { + "id": 10, + "description": "payerfsp callback - 1st individual transfer should have fulfilment", + "exec": [ + "const transfer1 = callback.body.individualTransferResults.find(t => t.transferId === environment.transferId);", + "expect(transfer1).to.have.property('fulfilment')" + ] + }, + { + "id": 11, + "description": "payerfsp callback - 2nd individual transfer should have fulfilment", + "exec": [ + "const transfer2 = callback.body.individualTransferResults.find(t => t.transferId === environment.transferId2);", + "expect(transfer2).to.have.property('fulfilment')" + ] + }, + { + "id": 12, + "description": "payeefsp callback - date header should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers).to.have.property('date')" + ] + }, + { + "id": 13, + "description": "payeefsp callback - fspiop-source should be switch", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-source']).to.equal('switch')" + ] + }, + { + "id": 14, + "description": "payeefsp callback - fspiop-destination should be payeefsp", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-destination']).to.equal(environment.toFspId)" + ] + }, + { + "id": 15, + "description": "payeefsp callback - fspiop-http-method should be PUT", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-http-method']).to.equal('PUT')" + ] + }, + { + "id": 16, + "description": "payeefsp callback - fspiop-uri should be as expected", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-uri']).to.equal(`/${environment.toFspId}/bulkTransfers/${environment.bulkTransferId}`)" + ] + }, + { + "id": 17, + "description": "payeefsp callback - Bulk Transfer state should be COMPLETED on Payee side", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.data.bulkTransferState).to.equal('COMPLETED')" + ] + }, + { + "id": 18, + "description": "payeefsp callback - Completed timestamp should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.data).to.have.property('completedTimestamp')" + ] + }, + { + "id": 19, + "description": "payeefsp callback - All individual transfer results (fulfilments) should be returned", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.data.individualTransferResults.length).to.equal(2)" + ] + }, + { + "id": 20, + "description": "payeefsp callback - 1st individual transfer should have fulfilment", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeCallback.data.individualTransferResults.find(t => t.transferId === environment.transferId);", + "expect(transfer1).to.have.property('fulfilment')" + ] + }, + { + "id": 21, + "description": "payeefsp callback - 2nd individual transfer should have fulfilment", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeCallback.data.individualTransferResults.find(t => t.transferId === environment.transferId2);", + "expect(transfer2).to.have.property('fulfilment')" + ] + }, + { + "id": 22, + "description": "payeefsp request - date header should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers).to.have.property('date')" + ] + }, + { + "id": 23, + "description": "payeefsp request - fspiop-source should be testingtoolkitdfsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-source']).to.equal(environment.fromFspId)" + ] + }, + { + "id": 24, + "description": "payeefsp request - fspiop-destination should be payeefsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-destination']).to.equal(environment.toFspId)" + ] + }, + { + "id": 25, + "description": "payeefsp request - fspiop-http-method should be POST", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-http-method']).to.equal('POST')" + ] + }, + { + "id": 26, + "description": "payeefsp request - fspiop-uri should be as expected", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-uri']).to.equal('/bulkTransfers')" + ] + }, + { + "id": 27, + "description": "payeefsp request - Bulk transfer Id should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.bulkTransferId).to.equal(environment.bulkTransferId)" + ] + }, + { + "id": 28, + "description": "payeefsp request - Bulk quote Id should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.bulkQuoteId).to.equal(environment.bulkQuoteId)" + ] + }, + { + "id": 29, + "description": "payeefsp request - PayerFsp should be testingtoolkitdfsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.payerFsp).to.equal(environment.fromFspId)" + ] + }, + { + "id": 30, + "description": "payeefsp request - PayeeFsp should be payeefsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.payeeFsp).to.equal(environment.toFspId)" + ] + }, + { + "id": 31, + "description": "payeefsp request - expiration should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data).to.have.property('expiration')" + ] + }, + { + "id": 32, + "description": "payeefsp request - All individual transfers (prepare) should be sent", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.individualTransfers.length).to.equal(2)" + ] + }, + { + "id": 33, + "description": "payeefsp request - 1st individual transfer should have valid ilpPacket", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer1.ilpPacket).to.equal(environment.validIlpPacket2)" + ] + }, + { + "id": 34, + "description": "payeefsp request - 1st individual transfer should have valid condition", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer1.condition).to.equal(environment.validCondition2)" + ] + }, + { + "id": 35, + "description": "payeefsp request - 1st individual transfer should have valid transferAmount", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "", + "expect(transfer1.transferAmount.amount).to.equal(\"1\") && expect(transfer1.transferAmount.currency).to.equal(\"{$inputs.currency}\")" + ] + }, + { + "id": 36, + "description": "payeefsp request - 1st individual transfer should have valid extensionList", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(JSON.stringify(transfer1.extensionList)).to.equal(JSON.stringify({ extension: [{key: \"extKey1\", value: \"extValue1\"}, { key: \"extKey2\", value: \"extValue2\" }]}))" + ] + }, + { + "id": 37, + "description": "payeefsp request - 2nd individual transfer should have valid ilpPacket", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer2.ilpPacket).to.equal(environment.validIlpPacket2)" + ] + }, + { + "id": 38, + "description": "payeefsp request - 2nd individual transfer should have valid condition", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer2.condition).to.equal(environment.validCondition2)" + ] + }, + { + "id": 39, + "description": "payeefsp request - 2nd individual transfer should have valid transferAmount", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId2)", + "", + "expect(transfer2.transferAmount.amount).to.equal(\"1\") && expect(transfer2.transferAmount.currency).to.equal(\"{$inputs.currency2}\")" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = 1000 * 3600 * 24", + "environment.transid =\"{$function.generic.generateUUID}\"", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = environment.transid", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "console.log(\"this is the value of transfer id: \"+requestVariables.transid)", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/'+environment.transid, 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/'+environment.transid, 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}", + "" + ] + } + } + }, + { + "id": 7, + "description": "POST Bulk Transfer duplicated", + "meta": { + "info": "POST Duplicate Bulk Transfer" + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$prev.3.request.headers.Date}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$environment.transid}", + "bulkQuoteId": "{$environment.bulkQuoteId}", + "payeeFsp": "{$inputs.toFspId}", + "payerFsp": "{$inputs.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$environment.transferId}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$environment.transferId2}", + "transferAmount": { + "currency": "{$inputs.currency2}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "payerfsp callback - date header should be set", + "exec": [ + "expect(callback.headers).to.have.property('date')" + ] + }, + { + "id": 4, + "description": "payerfsp callback - fspiop-destination should be testingtoolkitdfsp", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal(environment.fromFspId)" + ] + }, + { + "id": 5, + "description": "payerfsp callback - fspiop-http-method should be PUT", + "exec": [ + "expect(callback.headers['fspiop-http-method']).to.equal('PUT')" + ] + }, + { + "id": 7, + "description": "payerfsp callback - compare callback against previous callback", + "exec": [ + "expect(callback.body.bulkTransferState).to.equal('{$prev.3.callback.body.bulkTransferState}')", + "", + "expect(callback.body.completedTimestamp).to.equal('{$prev.3.callback.body.completedTimestamp}')", + "", + "expect(callback.body.individualTransferResults[0].transferId).to.equal('{$prev.3.callback.body.individualTransferResults[0].transferId}')", + "", + "expect(callback.body.individualTransferResults[0].fulfilment).to.equal('{$prev.3.callback.body.individualTransferResults[0].fulfilment}')", + "", + "expect(callback.body.individualTransferResults[1].transferId).to.equal('{$prev.3.callback.body.individualTransferResults[1].transferId}')", + "", + "expect(callback.body.individualTransferResults[1].fulfilment).to.equal('{$prev.3.callback.body.individualTransferResults[1].fulfilment}')", + "" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "disabled": false, + "scripts": { + "preRequest": { + "exec": [ + "const delay = 1000 * 3600 * 24", + "//environment.transid =\"{$function.generic.generateUUID}\"", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "", + "", + "console.log(\"this is the value of transfer id: \"+requestVariables.transid)", + "" + ] + }, + "postRequest": { + "exec": [ + "" + ] + } + } + } + ] + }, + { + "id": 2, + "name": "negative scenario - duplicate modified bulk transfer", + "meta": { + "info": "negative scenario - duplicate modified bulk transfer" + }, + "fileInfo": { + "path": "bulk_transfers/bulk-duplicated-transfers.json" + }, + "requests": [ + { + "id": 3, + "meta": { + "info": "POST Bulk Transfer" + }, + "description": "POST Bulk Transfer", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$environment.transid}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "{$inputs.toFspId}", + "payerFsp": "{$inputs.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency2}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "payerfsp callback - date header should be set", + "exec": [ + "expect(callback.headers).to.have.property('date')" + ] + }, + { + "id": 3, + "description": "payerfsp callback - fspiop-source should be payeefsp", + "exec": [ + "expect(callback.headers['fspiop-source']).to.equal(environment.toFspId)" + ] + }, + { + "id": 4, + "description": "payerfsp callback - fspiop-destination should be testingtoolkitdfsp", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal(environment.fromFspId)" + ] + }, + { + "id": 5, + "description": "payerfsp callback - fspiop-http-method should be PUT", + "exec": [ + "expect(callback.headers['fspiop-http-method']).to.equal('PUT')" + ] + }, + { + "id": 6, + "description": "payerfsp callback - fspiop-uri should be /payerfsp/bulkTransfers/", + "exec": [ + "expect(callback.headers['fspiop-uri']).to.equal(`/${environment.fromFspId}/bulkTransfers/${environment.bulkTransferId}`)" + ] + }, + { + "id": 7, + "description": "payerfsp callback - Bulk Transfer state should be COMPLETED on Payer side", + "exec": [ + "expect(callback.body.bulkTransferState).to.equal('COMPLETED')" + ] + }, + { + "id": 8, + "description": "payerfsp callback - Completed timestamp should be set", + "exec": [ + "expect(callback.body).to.have.property('completedTimestamp')" + ] + }, + { + "id": 9, + "description": "payerfsp callback - All individual transfer results (failed & successful) should be returned", + "exec": [ + "expect(callback.body.individualTransferResults.length).to.equal(2)" + ] + }, + { + "id": 10, + "description": "payerfsp callback - 1st individual transfer should have fulfilment", + "exec": [ + "const transfer1 = callback.body.individualTransferResults.find(t => t.transferId === environment.transferId);", + "expect(transfer1).to.have.property('fulfilment')" + ] + }, + { + "id": 11, + "description": "payerfsp callback - 2nd individual transfer should have fulfilment", + "exec": [ + "const transfer2 = callback.body.individualTransferResults.find(t => t.transferId === environment.transferId2);", + "expect(transfer2).to.have.property('fulfilment')" + ] + }, + { + "id": 12, + "description": "payeefsp callback - date header should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers).to.have.property('date')" + ] + }, + { + "id": 13, + "description": "payeefsp callback - fspiop-source should be switch", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-source']).to.equal('switch')" + ] + }, + { + "id": 14, + "description": "payeefsp callback - fspiop-destination should be payeefsp", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-destination']).to.equal(environment.toFspId)" + ] + }, + { + "id": 15, + "description": "payeefsp callback - fspiop-http-method should be PUT", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-http-method']).to.equal('PUT')" + ] + }, + { + "id": 16, + "description": "payeefsp callback - fspiop-uri should be as expected", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.headers['fspiop-uri']).to.equal(`/${environment.toFspId}/bulkTransfers/${environment.bulkTransferId}`)" + ] + }, + { + "id": 17, + "description": "payeefsp callback - Bulk Transfer state should be COMPLETED on Payee side", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.data.bulkTransferState).to.equal('COMPLETED')" + ] + }, + { + "id": 18, + "description": "payeefsp callback - Completed timestamp should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.data).to.have.property('completedTimestamp')" + ] + }, + { + "id": 19, + "description": "payeefsp callback - All individual transfer results (fulfilments) should be returned", + "exec": [ + "expect(environment.bulkTransfersNegativeCallback.data.individualTransferResults.length).to.equal(2)" + ] + }, + { + "id": 20, + "description": "payeefsp callback - 1st individual transfer should have fulfilment", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeCallback.data.individualTransferResults.find(t => t.transferId === environment.transferId);", + "expect(transfer1).to.have.property('fulfilment')" + ] + }, + { + "id": 21, + "description": "payeefsp callback - 2nd individual transfer should have fulfilment", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeCallback.data.individualTransferResults.find(t => t.transferId === environment.transferId2);", + "expect(transfer2).to.have.property('fulfilment')" + ] + }, + { + "id": 22, + "description": "payeefsp request - date header should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers).to.have.property('date')" + ] + }, + { + "id": 23, + "description": "payeefsp request - fspiop-source should be testingtoolkitdfsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-source']).to.equal(environment.fromFspId)" + ] + }, + { + "id": 24, + "description": "payeefsp request - fspiop-destination should be payeefsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-destination']).to.equal(environment.toFspId)" + ] + }, + { + "id": 25, + "description": "payeefsp request - fspiop-http-method should be POST", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-http-method']).to.equal('POST')" + ] + }, + { + "id": 26, + "description": "payeefsp request - fspiop-uri should be as expected", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.headers['fspiop-uri']).to.equal('/bulkTransfers')" + ] + }, + { + "id": 27, + "description": "payeefsp request - Bulk transfer Id should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.bulkTransferId).to.equal(environment.bulkTransferId)" + ] + }, + { + "id": 28, + "description": "payeefsp request - Bulk quote Id should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.bulkQuoteId).to.equal(environment.bulkQuoteId)" + ] + }, + { + "id": 29, + "description": "payeefsp request - PayerFsp should be testingtoolkitdfsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.payerFsp).to.equal(environment.fromFspId)" + ] + }, + { + "id": 30, + "description": "payeefsp request - PayeeFsp should be payeefsp", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.payeeFsp).to.equal(environment.toFspId)" + ] + }, + { + "id": 31, + "description": "payeefsp request - expiration should be set", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data).to.have.property('expiration')" + ] + }, + { + "id": 32, + "description": "payeefsp request - All individual transfers (prepare) should be sent", + "exec": [ + "expect(environment.bulkTransfersNegativeRequest.data.individualTransfers.length).to.equal(2)" + ] + }, + { + "id": 33, + "description": "payeefsp request - 1st individual transfer should have valid ilpPacket", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer1.ilpPacket).to.equal(environment.validIlpPacket2)" + ] + }, + { + "id": 34, + "description": "payeefsp request - 1st individual transfer should have valid condition", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer1.condition).to.equal(environment.validCondition2)" + ] + }, + { + "id": 35, + "description": "payeefsp request - 1st individual transfer should have valid transferAmount", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "", + "expect(transfer1.transferAmount.amount).to.equal(\"1\") && expect(transfer1.transferAmount.currency).to.equal(\"{$inputs.currency}\")" + ] + }, + { + "id": 36, + "description": "payeefsp request - 1st individual transfer should have valid extensionList", + "exec": [ + "const transfer1 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(JSON.stringify(transfer1.extensionList)).to.equal(JSON.stringify({ extension: [{key: \"extKey1\", value: \"extValue1\"}, { key: \"extKey2\", value: \"extValue2\" }]}))" + ] + }, + { + "id": 37, + "description": "payeefsp request - 2nd individual transfer should have valid ilpPacket", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer2.ilpPacket).to.equal(environment.validIlpPacket2)" + ] + }, + { + "id": 38, + "description": "payeefsp request - 2nd individual transfer should have valid condition", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId);", + "expect(transfer2.condition).to.equal(environment.validCondition2)" + ] + }, + { + "id": 39, + "description": "payeefsp request - 2nd individual transfer should have valid transferAmount", + "exec": [ + "const transfer2 = environment.bulkTransfersNegativeRequest.data.individualTransfers.find(t => t.transferId === environment.transferId2)", + "", + "expect(transfer2.transferAmount.amount).to.equal(\"1\") && expect(transfer2.transferAmount.currency).to.equal(\"{$inputs.currency2}\")" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = 1000 * 3600 * 24", + "environment.transid =\"{$function.generic.generateUUID}\"", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = environment.transid", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "console.log(\"this is the value of transfer id: \"+requestVariables.transid)", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/'+environment.transid, 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/'+environment.transid, 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}", + "" + ] + } + } + }, + { + "id": 7, + "description": "POST Bulk Transfer duplicated", + "meta": { + "info": "POST Duplicate Bulk Transfer" + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$prev.3.request.headers.Date}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$environment.transid}", + "bulkQuoteId": "{$environment.bulkQuoteId}", + "payeeFsp": "{$inputs.toFspId}", + "payerFsp": "{$inputs.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency2}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "payerfsp callback - date header should be set", + "exec": [ + "expect(callback.headers).to.have.property('date')" + ] + }, + { + "id": 4, + "description": "payerfsp callback - fspiop-destination should be testingtoolkitdfsp", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal(environment.fromFspId)" + ] + }, + { + "id": 5, + "description": "payerfsp callback - fspiop-http-method should be PUT", + "exec": [ + "expect(callback.headers['fspiop-http-method']).to.equal('PUT')" + ] + }, + { + "id": 7, + "description": "payerfsp callback - Bulk Transfer error is 3106", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3106')" + ] + }, + { + "id": 8, + "description": "payerfsp callback - Bulkerror description is modified request", + "exec": [ + "expect(callback.body.errorInformation.errorDescription).to.equal('Modified request')" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "disabled": false, + "scripts": { + "preRequest": { + "exec": [ + "const delay = 1000 * 3600 * 24", + "//environment.transid =\"{$function.generic.generateUUID}\"", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "", + "", + "console.log(\"this is the value of transfer id: \"+requestVariables.transid)", + "" + ] + }, + "postRequest": { + "exec": [ + "" + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json new file mode 100644 index 00000000..d7dd1fa2 --- /dev/null +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json @@ -0,0 +1,911 @@ +{ + "name": "multi", + "test_cases": [ + { + "id": 1, + "name": "negative scenario - invalid Payee FSP ID in request", + "meta": { + "info": "negative scenario - invalid Payee FSP ID" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json" + }, + "requests": [ + { + "id": 3, + "meta": { + "info": "Send Bulk Prepare. Invalid Payer FSP ID should return error." + }, + "description": "Send Prepare invalid Payer FSP ID body only", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$function.generic.generateUUID}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "DUMMY", + "payerFsp": "{$environment.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "GBP", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 17, + "description": "payer callback - should be error 3203. request.body participant not found.", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3203')", + "expect(callback.body.errorInformation.errorDescription).to.equal(`Payee FSP ID not found - Participant {$request.body.payeeFsp} not found`)" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = request.body.bulkTransferId", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 7, + "description": "Send Prepare Invalid Payee FSP ID header only", + "meta": { + "info": "Send Bulk Prepare. Invalid Payer FSP ID should return error." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "DUMMY" + }, + "body": { + "bulkTransferId": "{$function.generic.generateUUID}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "{$environment.toFspId}", + "payerFsp": "{$environment.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "GBP", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 7, + "description": "payer callback - should be error 3203. request.headers['FSPIOP-Destination'] participant not found.", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3203')", + "expect(callback.body.errorInformation.errorDescription).to.equal(`Payee FSP ID not found - Participant {$request.headers['FSPIOP-Destination']} not found`)" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp", + "ID": "" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = request.body.bulkTransferId", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 8, + "description": "Send Prepare Invalid Payee FSP ID header and body", + "meta": { + "info": "Send Bulk Prepare. Invalid Payer FSP ID should return error." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "DUMMY" + }, + "body": { + "bulkTransferId": "{$function.generic.generateUUID}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "DUMMY", + "payerFsp": "{$environment.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "GBP", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 7, + "description": "payer callback - should be error 3203. request.headers['FSPIOP-Destination'] participant not found.", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3203')", + "expect(callback.body.errorInformation.errorDescription).to.equal(`Payee FSP ID not found - Participant {$request.headers['FSPIOP-Destination']} not found`)" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp", + "ID": "" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = request.body.bulkTransferId", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + } + ] + }, + { + "id": 2, + "name": "negative scenario - invalid Payer FSP ID in request", + "meta": { + "info": "negative scenario - invalid Payer FSP ID" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json" + }, + "requests": [ + { + "id": 3, + "meta": { + "info": "Send Bulk Prepare. Mismatching Payer FSP ID in header and body should return error." + }, + "description": "Send Prepare invalid Payer FSP ID body only", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$function.generic.generateUUID}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "{$inputs.toFspId}", + "payerFsp": "DUMMY", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "GBP", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 7, + "description": "payer callback - should be error 3100. FSPIOP-Source header should match Payer FSP ID.", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3100')", + "expect(callback.body.errorInformation.errorDescription).to.equal(`Generic validation error - FSPIOP-Source header should match Payer FSP`)" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = request.body.bulkTransferId", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + } + ] + }, + { + "id": 3, + "name": "negative scenario - inactive Payer FSP ID in request", + "meta": { + "info": "negative scenario - inactive Payer FSP ID" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "Update participant ({$inputs.fromFspId} to inactive)" + }, + "description": "Update participant ({$inputs.fromFspId} to inactive)", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}", + "path": "/participants/{$inputs.fromFspId}", + "method": "put", + "params": { + "name": "{$inputs.fromFspId}" + }, + "body": { + "isActive": false + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Source": "{$inputs.fromFspId}" + } + }, + { + "id": 2, + "meta": { + "info": "Send Bulk Prepare. Inactive Payer FSP ID should return error." + }, + "description": "Send Prepare inactive Payer FSP ID", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$function.generic.generateUUID}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "{$inputs.toFspId}", + "payerFsp": "{$inputs.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "GBP", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 7, + "description": "payer callback - should be error 3202. Inactive participant error.", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3202')", + "expect(callback.body.errorInformation.errorDescription).to.equal(`Payer FSP ID not found - Participant {$inputs.fromFspId} is inactive`)" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = request.body.bulkTransferId", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "Update participant ({$inputs.fromFspId} to active)" + }, + "description": "Update participant ({$inputs.fromFspId} to active)", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}", + "path": "/participants/{$inputs.fromFspId}", + "method": "put", + "params": { + "name": "{$inputs.fromFspId}" + }, + "body": { + "isActive": true + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Source": "{$inputs.fromFspId}" + } + } + ] + }, + { + "id": 4, + "name": "negative scenario - inactive Payee FSP ID in request", + "meta": { + "info": "negative scenario - inactive Payee FSP ID" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "Update participant ({$inputs.toFspId} to inactive)" + }, + "description": "Update participant ({$inputs.toFspId} to inactive)", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}", + "path": "/participants/{$inputs.toFspId}", + "method": "put", + "params": { + "name": "{$inputs.toFspId}" + }, + "body": { + "isActive": false + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Source": "{$inputs.toFspId}" + } + }, + { + "id": 2, + "meta": { + "info": "Send Bulk Prepare. Inactive Payee FSP ID should return error." + }, + "description": "Send Prepare inactive Payee FSP ID", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "bulkTransferId": "{$function.generic.generateUUID}", + "bulkQuoteId": "{$function.generic.generateUUID}", + "payeeFsp": "{$inputs.toFspId}", + "payerFsp": "{$inputs.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "GBP", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 7, + "description": "payer callback - should be error 3203. Inactive participant error.", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3203')", + "expect(callback.body.errorInformation.errorDescription).to.equal(`Payee FSP ID not found - Participant {$inputs.toFspId} is inactive`)" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", + "const now = new Date()", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "", + "environment[\"bulkTransferId\"] = request.body.bulkTransferId", + "environment[\"bulkQuoteId\"] = request.body.bulkQuoteId", + "environment[\"transferId\"] = request.body.individualTransfers[0].transferId", + "environment[\"transferId2\"] = request.body.individualTransfers[1].transferId", + "environment[\"expirationDate\"] = expirationDate", + "environment[\"completedTimestamp\"] = completedTimestamp", + "", + "", + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + " environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "Update participant ({$inputs.toFspId} to active)" + }, + "description": "Update participant ({$inputs.toFspId} to active)", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}", + "path": "/participants/{$inputs.toFspId}", + "method": "put", + "params": { + "name": "{$inputs.toFspId}" + }, + "body": { + "isActive": true + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Source": "{$inputs.toFspId}" + } + } + ] + } + ] +} diff --git a/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json new file mode 100644 index 00000000..82bda76b --- /dev/null +++ b/collections/hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json @@ -0,0 +1,483 @@ +{ + "name": "multi", + "test_cases": [ + { + "id": 1, + "name": "negative scenario - invalid timestamp", + "meta": { + "info": "negative scenario - invalid timestamp" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/bulk-invalid-timestamp.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "Store Payerfsp position before prepare" + }, + "description": "Store Payerfsp position before prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/testingtoolkitdfsp/positions", + "method": "get", + "params": { + "name": "testingtoolkitdfsp" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "environment[\"payerfspPositionBeforePrepare\"] = response.body[0].value" + ] + } + } + }, + { + "id": 2, + "meta": { + "info": "Store Payeefsp position before prepare" + }, + "description": "Store Payeefsp position before prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.NORESPONSE_NAME}/positions", + "method": "get", + "params": { + "name": "{$inputs.NORESPONSE_NAME}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "environment[\"payeefspPositionBeforePrepare\"] = response.body[0].value" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "Send Prepare" + }, + "description": "Send Prepare", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$environment.headerDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.NORESPONSE_NAME}" + }, + "body": { + "bulkTransferId": "{$environment.bulkTransferId}", + "bulkQuoteId": "{$environment.bulkQuoteId}", + "payeeFsp": "{$environment.NORESPONSE_NAME}", + "payerFsp": "{$environment.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$environment.transferId}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$environment.transferId2}", + "transferAmount": { + "currency": "{$inputs.currency2}", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + } + ] + }, + "ignoreCallbacks": true, + "scripts": { + "preRequest": { + "exec": [ + "var uuid = require('uuid');", + "", + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", + "const bulkTransferId = uuid.v4();", + "const bulkQuoteId = uuid.v4();", + "const transferId = uuid.v4();", + "const transferId2 = uuid.v4();", + "const now = new Date();", + "const headerDate = now.toUTCString();", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "pm.environment.set('bulkTransferId', bulkTransferId);", + "pm.environment.set('bulkQuoteId', bulkQuoteId);", + "pm.environment.set('transferId', transferId);", + "pm.environment.set('transferId2', transferId2);", + "pm.environment.set('headerDate', headerDate);", + "pm.environment.set('expirationDate', expirationDate);", + "pm.environment.set('completedTimestamp', completedTimestamp);", + "" + ] + } + } + }, + { + "id": 4, + "meta": { + "info": "Store Payerfsp position after Prepare" + }, + "description": "Store Payerfsp position after Prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.fromFspId}/positions", + "method": "get", + "params": { + "name": "{$inputs.fromFspId}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "ignoreCallbacks": false, + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = pm.response.body;", + "pm.environment.set(\"payerfspPositionAfterPrepare\", jsonData[0].value)" + ] + }, + "preRequest": { + "exec": [ + "" + ] + } + } + }, + { + "id": 9, + "description": "Bulk transfer invalid timestamp", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers/{ID}", + "path": "/bulkTransfers/{$environment.bulkTransferId}", + "method": "put", + "params": { + "ID": "{$environment.bulkTransferId}" + }, + "url": "{$inputs.HOST_BULK_ADAPTER}", + "ignoreCallbacks": true, + "headers": { + "Content-Type": "application/vnd.interoperability.bulkTransfers+json;version=1.0", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.NORESPONSE_NAME}", + "FSPIOP-Destination": "{$inputs.fromFspId}" + }, + "scriptingEngine": "javascript", + "body": { + "bulkTransferState": "COMPLETED", + "completedTimestamp": "{$requestVariables.completedTimestamp}", + "individualTransferResults": [ + { + "transferId": "{$environment.transferId}", + "fulfilment": "{$environment.validFulfillment}" + }, + { + "transferId": "{$environment.transferId2}", + "fulfilment": "{$environment.validFulfillment}" + } + ] + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + }, + { + "id": 2, + "description": "payerfsp callback - payer should be informed of payee invalid fulfilment", + "exec": [ + "expect(environment.payerCallbackNotification.body).to.have.property(\"errorInformation\")", + "expect(environment.payerCallbackNotification.body.errorInformation.errorCode).to.equal(\"3100\")" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "requestVariables.completedTimestamp = new Date(new Date().getTime() + 10000).toISOString()", + "// Retrieve the payer fsp callback that is expected to be recieved after the payee fsp ", + "// sends a fulfil request", + "await inboundEvent.addListener('payer-callback', 'put', '/bulkTransfers/{$environment.bulkTransferId}/error')" + ] + }, + "postRequest": { + "exec": [ + "environment.payerCallbackNotification = await inboundEvent.getMessage('payer-callback')", + "console.log(environment.payerCallbackNotification)", + "" + ] + } + } + }, + { + "id": 6, + "meta": { + "info": "GET Bulk Transfer - PayerFSP" + }, + "description": "GET Bulk Transfer - PayerFSP", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers/{ID}", + "path": "/bulkTransfers/{$environment.bulkTransferId}", + "method": "get", + "params": { + "ID": "{$environment.bulkTransferId}", + "name": "" + }, + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$environment.headerDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "switch" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "payerfsp callback - date header should be set", + "exec": [ + "expect(callback.headers).to.have.property('date')" + ] + }, + { + "id": 3, + "description": "payerfsp callback - fspiop-source should be switch", + "exec": [ + "expect(callback.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)" + ] + }, + { + "id": 5, + "description": "payerfsp callback - fspiop-uri should be as expected", + "exec": [ + "expect(callback.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')" + ] + }, + { + "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\")" + ] + } + ] + }, + "ignoreCallbacks": false, + "scriptingEngine": "javascript", + "delay": "1000", + "scripts": { + "postRequest": { + "exec": [ + "" + ] + }, + "preRequest": { + "exec": [ + "" + ] + } + } + }, + { + "id": 7, + "meta": { + "info": "Check Payerfsp position after Abort" + }, + "description": "Check Payerfsp position after Abort", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.fromFspId}/positions", + "method": "get", + "params": { + "name": "{$inputs.fromFspId}", + "ID": "" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + }, + { + "id": 8, + "meta": { + "info": "Check Payeefsp position after Abort" + }, + "description": "Check Payeefsp position after Abort", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.NORESPONSE_NAME}/positions", + "method": "get", + "params": { + "name": "{$inputs.NORESPONSE_NAME}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + } + ] + } + ] +} 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 new file mode 100644 index 00000000..6ca89bcd --- /dev/null +++ b/collections/hub/other_tests/bulk_transfers/bulk-transfer-timeout-scenario.json @@ -0,0 +1,838 @@ +{ + "name": "multi", + "test_cases": [ + { + "id": 1, + "name": "negative scenario - transfer prepare timeout and no payee fsp fulfil response", + "meta": { + "info": "negative scenario - transfer prepare timeout" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/bulk-prepare-timeout.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "Store Payerfsp position before prepare" + }, + "description": "Store Payerfsp position before prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/testingtoolkitdfsp/positions", + "method": "get", + "params": { + "name": "testingtoolkitdfsp" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "environment[\"payerfspPositionBeforePrepare\"] = response.body[0].value" + ] + } + } + }, + { + "id": 2, + "meta": { + "info": "Store Payeefsp position before prepare" + }, + "description": "Store Payeefsp position before prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.NORESPONSE_NAME}/positions", + "method": "get", + "params": { + "name": "{$inputs.NORESPONSE_NAME}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "environment[\"payeefspPositionBeforePrepare\"] = response.body[0].value" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "Send Prepare" + }, + "description": "Send Prepare", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$environment.headerDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.NORESPONSE_NAME}" + }, + "body": { + "bulkTransferId": "{$environment.bulkTransferId}", + "bulkQuoteId": "{$environment.bulkQuoteId}", + "payeeFsp": "{$environment.NORESPONSE_NAME}", + "payerFsp": "{$environment.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$environment.transferId}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$environment.transferId2}", + "transferAmount": { + "currency": "{$inputs.currency2}", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)", + "" + ] + }, + { + "id": 2, + "description": "payer callback bulkTransferState to be COMPLETED", + "exec": [ + "expect(callback.body.bulkTransferState).to.equal(\"COMPLETED\")", + "" + ] + }, + { + "id": 3, + "description": "payer callback individualTransferResults[0].errorInformation.errorCode to be 3303", + "exec": [ + "expect(callback.body.individualTransferResults[0].errorInformation.errorCode).to.equal(\"3303\")", + "" + ] + }, + { + "id": 4, + "description": "payer callback individualTransferResults[0].errorInformation.errorDescription to be \"Transfer expired\"", + "exec": [ + "expect(callback.body.individualTransferResults[0].errorInformation.errorDescription).to.equal(\"Transfer expired\")", + "" + ] + }, + { + "id": 5, + "description": "payer callback individualTransferResults[1].errorInformation.errorCode to be 3303", + "exec": [ + "expect(callback.body.individualTransferResults[1].errorInformation.errorCode).to.equal(\"3303\")", + "" + ] + }, + { + "id": 6, + "description": "payer callback individualTransferResults[0].errorInformation.errorDescription to be \"Transfer expired\"", + "exec": [ + "expect(callback.body.individualTransferResults[1].errorInformation.errorDescription).to.equal(\"Transfer expired\")" + ] + } + ] + }, + "ignoreCallbacks": false, + "delay": "10000", + "scripts": { + "preRequest": { + "exec": [ + "var uuid = require('uuid');", + "", + "const delay = 2 * 1000", + "const bulkTransferId = uuid.v4();", + "const bulkQuoteId = uuid.v4();", + "const transferId = uuid.v4();", + "const transferId2 = uuid.v4();", + "const now = new Date();", + "const headerDate = now.toUTCString();", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "pm.environment.set('bulkTransferId', bulkTransferId);", + "pm.environment.set('bulkQuoteId', bulkQuoteId);", + "pm.environment.set('transferId', transferId);", + "pm.environment.set('transferId2', transferId2);", + "pm.environment.set('headerDate', headerDate);", + "pm.environment.set('expirationDate', expirationDate);", + "pm.environment.set('completedTimestamp', completedTimestamp);", + "" + ] + }, + "postRequest": { + "exec": [ + "console.log(response.body)" + ] + } + } + }, + { + "id": 4, + "meta": { + "info": "Store Payerfsp position after Prepare" + }, + "description": "Store Payerfsp position after Prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.fromFspId}/positions", + "method": "get", + "params": { + "name": "{$inputs.fromFspId}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "ignoreCallbacks": false, + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = pm.response.body;", + "pm.environment.set(\"payerfspPositionAfterPrepare\", jsonData[0].value)" + ] + }, + "preRequest": { + "exec": [ + "" + ] + } + } + }, + { + "id": 7, + "meta": { + "info": "Check Payerfsp position after timeout" + }, + "description": "Check Payerfsp position after timeout", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.fromFspId}/positions", + "method": "get", + "params": { + "name": "{$inputs.fromFspId}", + "ID": "" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + }, + { + "id": 8, + "meta": { + "info": "Check Payeefsp position after timeout" + }, + "description": "Check Payeefsp position after timeout", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.NORESPONSE_NAME}/positions", + "method": "get", + "params": { + "name": "{$inputs.NORESPONSE_NAME}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + } + ] + }, + { + "id": 2, + "name": "negative scenario - transfer prepare timeout and late payee fsp fulfil response", + "meta": { + "info": "negative scenario - transfer prepare timeout" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/bulk-prepare-timeout.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "Store Payerfsp position before prepare" + }, + "description": "Store Payerfsp position before prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/testingtoolkitdfsp/positions", + "method": "get", + "params": { + "name": "testingtoolkitdfsp" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "environment[\"payerfspPositionBeforePrepare\"] = response.body[0].value" + ] + } + } + }, + { + "id": 2, + "meta": { + "info": "Store Payeefsp position before prepare" + }, + "description": "Store Payeefsp position before prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.NORESPONSE_NAME}/positions", + "method": "get", + "params": { + "name": "{$inputs.NORESPONSE_NAME}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "environment[\"payeefspPositionBeforePrepare\"] = response.body[0].value" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "Send Prepare" + }, + "description": "Send Prepare", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfers}", + "Content-Type": "{$inputs.contentBulkTransfers}", + "Date": "{$environment.headerDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "FSPIOP-Destination": "{$inputs.NORESPONSE_NAME}" + }, + "body": { + "bulkTransferId": "{$environment.bulkTransferId}", + "bulkQuoteId": "{$environment.bulkQuoteId}", + "payeeFsp": "{$environment.NORESPONSE_NAME}", + "payerFsp": "{$environment.fromFspId}", + "individualTransfers": [ + { + "transferId": "{$environment.transferId}", + "transferAmount": { + "currency": "{$inputs.currency}", + "amount": "1" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$environment.transferId2}", + "transferAmount": { + "currency": "{$inputs.currency2}", + "amount": "2" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)", + "" + ] + }, + { + "id": 2, + "description": "payer callback bulkTransferState to be COMPLETED", + "exec": [ + "expect(callback.body.bulkTransferState).to.equal(\"COMPLETED\")", + "" + ] + }, + { + "id": 3, + "description": "payer callback individualTransferResults[0].errorInformation.errorCode to be 3303", + "exec": [ + "expect(callback.body.individualTransferResults[0].errorInformation.errorCode).to.equal(\"3303\")", + "" + ] + }, + { + "id": 4, + "description": "payer callback individualTransferResults[0].errorInformation.errorDescription to be \"Transfer expired\"", + "exec": [ + "expect(callback.body.individualTransferResults[0].errorInformation.errorDescription).to.equal(\"Transfer expired\")", + "" + ] + }, + { + "id": 5, + "description": "payer callback individualTransferResults[1].errorInformation.errorCode to be 3303", + "exec": [ + "expect(callback.body.individualTransferResults[1].errorInformation.errorCode).to.equal(\"3303\")", + "" + ] + }, + { + "id": 6, + "description": "payer callback individualTransferResults[0].errorInformation.errorDescription to be \"Transfer expired\"", + "exec": [ + "expect(callback.body.individualTransferResults[1].errorInformation.errorDescription).to.equal(\"Transfer expired\")" + ] + } + ] + }, + "ignoreCallbacks": false, + "delay": "10000", + "scripts": { + "preRequest": { + "exec": [ + "var uuid = require('uuid');", + "", + "const delay = 2 * 1000", + "const bulkTransferId = uuid.v4();", + "const bulkQuoteId = uuid.v4();", + "const transferId = uuid.v4();", + "const transferId2 = uuid.v4();", + "const now = new Date();", + "const headerDate = now.toUTCString();", + "const expirationDate = new Date(now.getTime() + delay).toISOString();", + "const completedTimestamp = now.toISOString();", + "pm.environment.set('bulkTransferId', bulkTransferId);", + "pm.environment.set('bulkQuoteId', bulkQuoteId);", + "pm.environment.set('transferId', transferId);", + "pm.environment.set('transferId2', transferId2);", + "pm.environment.set('headerDate', headerDate);", + "pm.environment.set('expirationDate', expirationDate);", + "pm.environment.set('completedTimestamp', completedTimestamp);", + "" + ] + }, + "postRequest": { + "exec": [ + "console.log(response.body)" + ] + } + } + }, + { + "id": 4, + "meta": { + "info": "Store Payerfsp position after Prepare" + }, + "description": "Store Payerfsp position after Prepare", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.fromFspId}/positions", + "method": "get", + "params": { + "name": "{$inputs.fromFspId}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "ignoreCallbacks": false, + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = pm.response.body;", + "pm.environment.set(\"payerfspPositionAfterPrepare\", jsonData[0].value)" + ] + }, + "preRequest": { + "exec": [ + "" + ] + } + } + }, + { + "id": 7, + "meta": { + "info": "Check Payerfsp position after Abort" + }, + "description": "Check Payerfsp position after timeout", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.fromFspId}/positions", + "method": "get", + "params": { + "name": "{$inputs.fromFspId}", + "ID": "" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + }, + { + "id": 8, + "meta": { + "info": "Check Payeefsp position after Abort" + }, + "description": "Check Payeefsp position after timeout", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.NORESPONSE_NAME}/positions", + "method": "get", + "params": { + "name": "{$inputs.NORESPONSE_NAME}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + }, + { + "id": 9, + "description": "Late Payeefsp fulfil request", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_1.1/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_1.1/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_1.1/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_1.1/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_1.1/trigger_templates" + }, + "operationPath": "/bulkTransfers/{ID}", + "path": "/bulkTransfers/{$environment.bulkTransferId}", + "method": "put", + "params": { + "ID": "{$environment.bulkTransferId}" + }, + "body": { + "bulkTransferState": "COMPLETED", + "completedTimestamp": "{$requestVariables.completedTimestamp}", + "individualTransferResults": [ + { + "transferId": "{$environment.transferId}", + "fulfilment": "{$environment.validFulfillment}" + }, + { + "transferId": "{$environment.transferId2}", + "fulfilment": "{$environment.validFulfillment}" + } + ] + }, + "url": "{$inputs.HOST_BULK_ADAPTER}", + "ignoreCallbacks": true, + "headers": { + "Content-Type": "application/vnd.interoperability.bulkTransfers+json;version=1.0", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.NORESPONSE_NAME}", + "FSPIOP-Destination": "{$inputs.fromFspId}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response to be 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + } + }, + { + "id": 10, + "description": "Check Payerfsp position after timeout and late fulfil", + "meta": { + "info": "Check Payerfsp position after Abort" + }, + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.fromFspId}/positions", + "method": "get", + "params": { + "name": "{$inputs.fromFspId}", + "ID": "" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + }, + { + "id": 11, + "description": "Check Payeefsp position after timeout and late fulfil", + "meta": { + "info": "Check Payeefsp position after Abort" + }, + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/positions", + "path": "/participants/{$inputs.NORESPONSE_NAME}/positions", + "method": "get", + "params": { + "name": "{$inputs.NORESPONSE_NAME}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "expect(response.status).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)" + ] + } + ] + } + } + ] + } + ] +} diff --git a/collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json b/collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json index 8e19e3e7..be24e2ff 100644 --- a/collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json +++ b/collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json @@ -687,4 +687,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/collections/hub/other_tests/bulk_transfers/negative_scenarios.json b/collections/hub/other_tests/bulk_transfers/negative_scenarios.json index 4243bf72..9e504d38 100644 --- a/collections/hub/other_tests/bulk_transfers/negative_scenarios.json +++ b/collections/hub/other_tests/bulk_transfers/negative_scenarios.json @@ -165,7 +165,7 @@ "exec": [ "var uuid = require('uuid');", "", - "const delay = 1000 * 3600 * 24", + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", "const bulkTransferId = uuid.v4();", "const bulkQuoteId = uuid.v4();", "const transferId = uuid.v4();", @@ -261,6 +261,36 @@ "errorCode": "5100", "errorDescription": "An error occured" } + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "payerfsp callback - payer should be informed of payee abort", + "exec": [ + "expect(environment.payerCallbackNotification.body).to.have.property(\"errorInformation\")", + "expect(JSON.stringify(environment.payerCallbackNotification.body.errorInformation)).to.equal(JSON.stringify(request.body.errorInformation))" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "// Retrieve the payer fsp callback that is expected to be recieved after the payee fsp ", + "// sends a fulfil request", + "await inboundEvent.addListener('payer-callback', 'put', '/bulkTransfers/{$environment.bulkTransferId}/error')" + ] + }, + "postRequest": { + "exec": [ + "environment.payerCallbackNotification = await inboundEvent.getMessage('payer-callback')", + "console.log(environment.payerCallbackNotification)", + "console.log(request.body.errorInformation)", + "" + ] + } } }, { @@ -324,7 +354,7 @@ "id": 5, "description": "payerfsp callback - fspiop-uri should be as expected", "exec": [ - "expect(callback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}/error`)" + "expect(callback.headers['fspiop-uri']).to.equal(`/testingtoolkitdfsp/bulkTransfers/${environment.bulkTransferId}`)" ] }, { @@ -336,19 +366,17 @@ }, { "id": 8, - "description": "payerfsp callback - errorInformation should be set correctly", + "description": "payerfsp callback - bulkTransfer should be REJECTED", "exec": [ - "expect(callback.body).to.have.property(\"errorInformation\")", - "expect(JSON.stringify(callback.body.errorInformation)).to.equal(JSON.stringify({", - " errorCode: \"5100\",", - " errorDescription: \"An error occured\"", - "}))" + "expect(callback.body).to.have.property(\"bulkTransferState\")", + "expect(callback.body.bulkTransferState).to.equal(\"REJECTED\")" ] } ] }, "ignoreCallbacks": false, "scriptingEngine": "javascript", + "delay": "1000", "scripts": { "postRequest": { "exec": [ @@ -360,8 +388,7 @@ "" ] } - }, - "delay": "1000" + } }, { "id": 7, @@ -773,7 +800,7 @@ "scripts": { "preRequest": { "exec": [ - "const delay = 1000 * 3600 * 24", + "const delay = environment.EXPIRATION_DELAY_MS || 1000 * 3600 * 24", "const now = new Date()", "const expirationDate = new Date(now.getTime() + delay).toISOString();", "const completedTimestamp = now.toISOString();", @@ -1065,4 +1092,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/collections/hub/other_tests/bulk_transfers/positive_scenarios.json b/collections/hub/other_tests/bulk_transfers/positive_scenarios.json index 864350af..431fed4d 100644 --- a/collections/hub/other_tests/bulk_transfers/positive_scenarios.json +++ b/collections/hub/other_tests/bulk_transfers/positive_scenarios.json @@ -657,4 +657,4 @@ ] } ] -} \ No newline at end of file +}