From c62e2228a149d42eeefa817ff5ca2b4882f6df5c Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Fri, 4 Mar 2022 18:39:00 +0200 Subject: [PATCH 1/7] feat(mojaloop/#2704): core-services support for non-breaking backward api compatibility - added new feature_test: backward_compatability/fspiop_protocol_validation.json which asserts validations against correct current, old and not-supported versions --- .../fspiop_protocol_validation.json | 1696 +++++++++++++++++ .../backward_compatibility/master.json | 8 + .../hub/golden_path/feature_tests/master.json | 4 + 3 files changed, 1708 insertions(+) create mode 100644 collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json create mode 100644 collections/hub/golden_path/feature_tests/backward_compatibility/master.json diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json new file mode 100644 index 00000000..16122231 --- /dev/null +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -0,0 +1,1696 @@ +{ + "name": "multi", + "test_cases": [ + { + "id": 1, + "name": "fspiop_protocol_validation - Account-lookup-Service", + "meta": { + "info": "This is a test to validate that ACCEPT and CONTENT-TYPE headers are correctly validated for both legacy (Old) and not\n-supported (NotSupported)" + }, + "fileInfo": { + "path": "hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "This request allows us to add a new participant to Account Lookup Service." + }, + "description": "Add Participant to ALS", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/participants/{Type}/{ID}", + "path": "/participants/{$inputs.toIdType}/{$inputs.toIdValue}", + "method": "post", + "params": { + "Type": "{$inputs.toIdType}", + "ID": "{$inputs.toIdValue}" + }, + "headers": { + "FSPIOP-Source": "{$inputs.toFspId}", + "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", + "Accept": "{$inputs.acceptParticipantsOld}", + "Content-Type": "{$inputs.contentTypeParticipantsOld}", + "Date": "{$function.generic.curDate}" + }, + "body": { + "fspId": "{$inputs.toFspId}", + "currency": "{$inputs.currency}" + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "ignoreCallbacks": true, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "Response statusText to be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Accepted')" + ] + } + ] + } + }, + { + "id": 2, + "description": "Add Participant to ALS", + "meta": { + "info": "This request allows us to add a new participant to Account Lookup Service." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/participants/{Type}/{ID}", + "path": "/participants/{$inputs.toIdType}/{$inputs.toIdValue}", + "method": "post", + "params": { + "Type": "{$inputs.toIdType}", + "ID": "{$inputs.toIdValue}" + }, + "headers": { + "FSPIOP-Source": "{$inputs.toFspId}", + "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", + "Accept": "{$inputs.acceptParticipantsNotSupported}", + "Content-Type": "{$inputs.contentTypeParticipants}", + "Date": "{$function.generic.curDate}" + }, + "body": { + "fspId": "{$inputs.toFspId}", + "currency": "{$inputs.currency}" + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "ignoreCallbacks": true, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText to be 'Not Acceptable'", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - The Client requested an unsupported version')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "scripts": { + "postRequest": { + "exec": [ + "console.log('test')", + "var res = pm.response.body;", + "console.log(JSON.stringify(res))" + ] + } + } + }, + { + "id": 3, + "description": "Add Participant to ALS", + "meta": { + "info": "This request allows us to add a new participant to Account Lookup Service." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/participants/{Type}/{ID}", + "path": "/participants/{$inputs.toIdType}/{$inputs.toIdValue}", + "method": "post", + "params": { + "Type": "{$inputs.toIdType}", + "ID": "{$inputs.toIdValue}" + }, + "headers": { + "FSPIOP-Source": "{$inputs.toFspId}", + "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", + "Accept": "{$inputs.acceptParticipants}", + "Content-Type": "{$inputs.contentTypeParticipantsNotSupported}", + "Date": "{$function.generic.curDate}" + }, + "body": { + "fspId": "{$inputs.toFspId}", + "currency": "{$inputs.currency}" + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "ignoreCallbacks": true, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText to be 'Not Acceptable'", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - Client supplied a protocol version which is not supported by the server')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "" + ] + } + } + } + ] + }, + { + "id": 2, + "name": "fspiop_protocol_validation - Quoting-Service", + "meta": { + "info": "This is a test to validate that ACCEPT and CONTENT-TYPE headers are correctly validated for both legacy (Old) and not\n-supported (NotSupported)" + }, + "fileInfo": { + "path": "hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json" + }, + "requests": [ + { + "id": 3, + "meta": { + "info": "This request allows us to get the personal information associated with a MSISDN and the FSP associated to it." + }, + "description": "Get party information", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/parties/{Type}/{ID}", + "method": "get", + "headers": { + "Accept": "{$inputs.acceptParties}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "Content-Type": "{$inputs.contentTypeParties}" + }, + "params": { + "Type": "{$inputs.toIdType}", + "ID": "{$inputs.toIdValue}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Accepted')" + ] + }, + { + "id": 3, + "description": "Callback Content Length not 0", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + }, + { + "id": 4, + "description": "Callback body should contain party", + "exec": [ + "expect(callback.body).to.have.property('party')" + ] + }, + { + "id": 5, + "description": "Request FSPIOP-Source same as inputs fromFspId", + "exec": [ + "expect('{$request.headers['FSPIOP-Source']}').to.equal('{$inputs.fromFspId}')" + ] + }, + { + "id": 6, + "description": "Callback FSPIOP-Destination same as request FSPIOP-Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be parties", + "exec": [ + "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.parties+json;version={$inputs.expectedPartiesVersion}')" + ] + }, + { + "id": 8, + "description": "Callback partyIdInfo (partyIdType, partyIdentifier)", + "exec": [ + "expect(callback.body.party.partyIdInfo.partyIdType).to.equal('{$inputs.toIdType}')", + "expect(callback.body.party.partyIdInfo.partyIdentifier).to.equal('{$inputs.toIdValue}')" + ] + }, + { + "id": 9, + "description": "Payee FSPIOP-Source", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " expect(environment.payeeRequest.headers['fspiop-source']).to.equal('{$inputs.fromFspId}')", + "}" + ] + }, + { + "id": 10, + "description": "Payee Content-Type", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " expect(environment.payeeRequest.headers['content-type']).to.equal('application/vnd.interoperability.parties+json;version={$inputs.expectedPartiesVersion}')", + "}" + ] + } + ] + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "path": "/parties/{$inputs.toIdType}/{$inputs.toIdValue}", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 4, + "meta": { + "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction." + }, + "description": "Send quote", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/quotes", + "method": "post", + "headers": { + "Accept": "{$inputs.acceptQuotesOld}", + "Content-Type": "{$inputs.contentTypeQuotesOld}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "quoteId": "{$function.generic.generateUUID}", + "transactionId": "{$function.generic.generateUUID}", + "payer": { + "partyIdInfo": { + "partyIdType": "{$inputs.fromIdType}", + "partyIdentifier": "{$inputs.fromIdValue}", + "fspId": "{$inputs.fromFspId}" + }, + "personalInfo": { + "complexName": { + "firstName": "{$inputs.fromFirstName}", + "lastName": "{$inputs.fromLastName}" + }, + "dateOfBirth": "{$inputs.fromDOB}" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "{$prev.3.callback.body.party.partyIdInfo.partyIdType}", + "partyIdentifier": "{$prev.3.callback.body.party.partyIdInfo.partyIdentifier}", + "fspId": "{$prev.3.callback.body.party.partyIdInfo.fspId}" + } + }, + "amountType": "RECEIVE", + "amount": { + "amount": "{$inputs.amount}", + "currency": "{$inputs.currency}" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "{$inputs.note}" + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Accepted')" + ] + }, + { + "id": 3, + "description": "Callback Content Length not 0", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + }, + { + "id": 4, + "description": "Callback FSP Destination equal to request FSP Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "id": 5, + "description": "Callback body should contain transferAmount", + "exec": [ + "expect(callback.body).to.have.property('transferAmount')" + ] + }, + { + "id": 6, + "description": "Callback transferAmount (amount & currency)to match the request", + "exec": [ + "expect(callback.body.transferAmount.amount).to.equal('{$request.body.amount.amount}')", + "expect(callback.body.transferAmount.currency).to.equal('{$request.body.amount.currency}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be quotes", + "exec": [ + "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.quotes+json;version={$inputs.expectedQuotesVersion}')" + ] + }, + { + "id": 8, + "description": "Request amountType to be RECEIVE", + "exec": [ + "expect('{$request.body.amountType}').to.equal('RECEIVE')" + ] + }, + { + "id": 9, + "description": "Request transactionType scenario to be TRANSFER", + "exec": [ + "expect('{$request.body.transactionType.scenario}').to.equal('TRANSFER')" + ] + }, + { + "id": 10, + "description": "Request transactionType initiator to be PAYER", + "exec": [ + "expect('{$request.body.transactionType.initiator}').to.equal('PAYER')" + ] + }, + { + "id": 11, + "description": "Request transactionType initiatorType to be CONSUMER", + "exec": [ + "expect('{$request.body.transactionType.initiatorType}').to.equal('CONSUMER')" + ] + }, + { + "id": 12, + "description": "Payee FSPIOP-Source", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.headers['fspiop-source']).to.equal('{$inputs.fromFspId}')", + "}" + ] + }, + { + "id": 13, + "description": "Payee Content-Type", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.headers['content-type']).to.equal(request.headers['Content-Type'])", + "}" + ] + }, + { + "id": 14, + "description": "Payee Body QuoteId", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.data['quoteId']).to.equal('{$request.body.quoteId}')", + "}" + ] + }, + { + "id": 15, + "description": "Payee Body TransactionId", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.data['transactionId']).to.equal('{$request.body.transactionId}')", + "}" + ] + } + ] + }, + "params": { + "Type": "MSISDN", + "ID": "{$inputs.toIdValue}" + }, + "path": "/quotes", + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 5, + "description": "Send quote", + "meta": { + "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/quotes", + "method": "post", + "headers": { + "Accept": "{$inputs.acceptQuotesNotSupported}", + "Content-Type": "{$inputs.contentTypeQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "quoteId": "{$function.generic.generateUUID}", + "transactionId": "{$function.generic.generateUUID}", + "payer": { + "partyIdInfo": { + "partyIdType": "{$inputs.fromIdType}", + "partyIdentifier": "{$inputs.fromIdValue}", + "fspId": "{$inputs.fromFspId}" + }, + "personalInfo": { + "complexName": { + "firstName": "{$inputs.fromFirstName}", + "lastName": "{$inputs.fromLastName}" + }, + "dateOfBirth": "{$inputs.fromDOB}" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "{$prev.3.callback.body.party.partyIdInfo.partyIdType}", + "partyIdentifier": "{$prev.3.callback.body.party.partyIdInfo.partyIdentifier}", + "fspId": "{$prev.3.callback.body.party.partyIdInfo.fspId}" + } + }, + "amountType": "RECEIVE", + "amount": { + "amount": "{$inputs.amount}", + "currency": "{$inputs.currency}" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "{$inputs.note}" + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - The Client requested an unsupported version')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "params": { + "Type": "MSISDN", + "ID": "{$inputs.toIdValue}" + }, + "path": "/quotes", + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "ignoreCallbacks": true, + "scripts": { + "preRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", + "// }" + ] + }, + "postRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }" + ] + } + } + }, + { + "id": 6, + "description": "Send quote", + "meta": { + "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/quotes", + "method": "post", + "headers": { + "Accept": "{$inputs.acceptQuotes}", + "Content-Type": "{$inputs.contentTypeQuotesNotSupported}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "quoteId": "{$function.generic.generateUUID}", + "transactionId": "{$function.generic.generateUUID}", + "payer": { + "partyIdInfo": { + "partyIdType": "{$inputs.fromIdType}", + "partyIdentifier": "{$inputs.fromIdValue}", + "fspId": "{$inputs.fromFspId}" + }, + "personalInfo": { + "complexName": { + "firstName": "{$inputs.fromFirstName}", + "lastName": "{$inputs.fromLastName}" + }, + "dateOfBirth": "{$inputs.fromDOB}" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "{$prev.3.callback.body.party.partyIdInfo.partyIdType}", + "partyIdentifier": "{$prev.3.callback.body.party.partyIdInfo.partyIdentifier}", + "fspId": "{$prev.3.callback.body.party.partyIdInfo.fspId}" + } + }, + "amountType": "RECEIVE", + "amount": { + "amount": "{$inputs.amount}", + "currency": "{$inputs.currency}" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "{$inputs.note}" + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - Client supplied a protocol version which is not supported by the server')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "params": { + "Type": "MSISDN", + "ID": "{$inputs.toIdValue}" + }, + "path": "/quotes", + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "ignoreCallbacks": true, + "scripts": { + "preRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", + "// }" + ] + }, + "postRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }" + ] + } + } + } + ] + }, + { + "id": 3, + "name": "fspiop_protocol_validation - Transfers", + "meta": { + "info": "This is a test to validate that ACCEPT and CONTENT-TYPE headers are correctly validated for both legacy (Old) and not\n-supported (NotSupported)" + }, + "fileInfo": { + "path": "hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json" + }, + "requests": [ + { + "id": 3, + "meta": { + "info": "This request allows us to get the personal information associated with a MSISDN and the FSP associated to it." + }, + "description": "Get party information", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/parties/{Type}/{ID}", + "method": "get", + "headers": { + "Accept": "{$inputs.acceptParties}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "Content-Type": "{$inputs.contentTypeParties}" + }, + "params": { + "Type": "{$inputs.toIdType}", + "ID": "{$inputs.toIdValue}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Accepted')" + ] + }, + { + "id": 3, + "description": "Callback Content Length not 0", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + }, + { + "id": 4, + "description": "Callback body should contain party", + "exec": [ + "expect(callback.body).to.have.property('party')" + ] + }, + { + "id": 5, + "description": "Request FSPIOP-Source same as inputs fromFspId", + "exec": [ + "expect('{$request.headers['FSPIOP-Source']}').to.equal('{$inputs.fromFspId}')" + ] + }, + { + "id": 6, + "description": "Callback FSPIOP-Destination same as request FSPIOP-Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be parties", + "exec": [ + "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.parties+json;version={$inputs.expectedPartiesVersion}')" + ] + }, + { + "id": 8, + "description": "Callback partyIdInfo (partyIdType, partyIdentifier)", + "exec": [ + "expect(callback.body.party.partyIdInfo.partyIdType).to.equal('{$inputs.toIdType}')", + "expect(callback.body.party.partyIdInfo.partyIdentifier).to.equal('{$inputs.toIdValue}')" + ] + }, + { + "id": 9, + "description": "Payee FSPIOP-Source", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " expect(environment.payeeRequest.headers['fspiop-source']).to.equal('{$inputs.fromFspId}')", + "}" + ] + }, + { + "id": 10, + "description": "Payee Content-Type", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " expect(environment.payeeRequest.headers['content-type']).to.equal('application/vnd.interoperability.parties+json;version={$inputs.expectedPartiesVersion}')", + "}" + ] + } + ] + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "path": "/parties/{$inputs.toIdType}/{$inputs.toIdValue}", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 4, + "meta": { + "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction." + }, + "description": "Send quote", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/quotes", + "method": "post", + "headers": { + "Accept": "{$inputs.acceptQuotes}", + "Content-Type": "{$inputs.contentTypeQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "FSPIOP-Destination": "{$inputs.toFspId}" + }, + "body": { + "quoteId": "{$function.generic.generateUUID}", + "transactionId": "{$function.generic.generateUUID}", + "payer": { + "partyIdInfo": { + "partyIdType": "{$inputs.fromIdType}", + "partyIdentifier": "{$inputs.fromIdValue}", + "fspId": "{$inputs.fromFspId}" + }, + "personalInfo": { + "complexName": { + "firstName": "{$inputs.fromFirstName}", + "lastName": "{$inputs.fromLastName}" + }, + "dateOfBirth": "{$inputs.fromDOB}" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "{$prev.3.callback.body.party.partyIdInfo.partyIdType}", + "partyIdentifier": "{$prev.3.callback.body.party.partyIdInfo.partyIdentifier}", + "fspId": "{$prev.3.callback.body.party.partyIdInfo.fspId}" + } + }, + "amountType": "RECEIVE", + "amount": { + "amount": "{$inputs.amount}", + "currency": "{$inputs.currency}" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "{$inputs.note}" + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Accepted')" + ] + }, + { + "id": 3, + "description": "Callback Content Length not 0", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + }, + { + "id": 4, + "description": "Callback FSP Destination equal to request FSP Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "id": 5, + "description": "Callback body should contain transferAmount", + "exec": [ + "expect(callback.body).to.have.property('transferAmount')" + ] + }, + { + "id": 6, + "description": "Callback transferAmount (amount & currency)to match the request", + "exec": [ + "expect(callback.body.transferAmount.amount).to.equal('{$request.body.amount.amount}')", + "expect(callback.body.transferAmount.currency).to.equal('{$request.body.amount.currency}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be quotes", + "exec": [ + "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.quotes+json;version={$inputs.expectedQuotesVersion}')" + ] + }, + { + "id": 8, + "description": "Request amountType to be RECEIVE", + "exec": [ + "expect('{$request.body.amountType}').to.equal('RECEIVE')" + ] + }, + { + "id": 9, + "description": "Request transactionType scenario to be TRANSFER", + "exec": [ + "expect('{$request.body.transactionType.scenario}').to.equal('TRANSFER')" + ] + }, + { + "id": 10, + "description": "Request transactionType initiator to be PAYER", + "exec": [ + "expect('{$request.body.transactionType.initiator}').to.equal('PAYER')" + ] + }, + { + "id": 11, + "description": "Request transactionType initiatorType to be CONSUMER", + "exec": [ + "expect('{$request.body.transactionType.initiatorType}').to.equal('CONSUMER')" + ] + }, + { + "id": 12, + "description": "Payee FSPIOP-Source", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.headers['fspiop-source']).to.equal('{$inputs.fromFspId}')", + "}" + ] + }, + { + "id": 13, + "description": "Payee Content-Type", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.headers['content-type']).to.equal(request.headers['Content-Type'])", + "}" + ] + }, + { + "id": 14, + "description": "Payee Body QuoteId", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.data['quoteId']).to.equal('{$request.body.quoteId}')", + "}" + ] + }, + { + "id": 15, + "description": "Payee Body TransactionId", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.data['transactionId']).to.equal('{$request.body.transactionId}')", + "}" + ] + } + ] + }, + "params": { + "Type": "MSISDN", + "ID": "{$inputs.toIdValue}" + }, + "path": "/quotes", + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.quoteId}', 'payeeRequest')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 5, + "meta": { + "info": "This request allows us to send a Transfer (payerfsp to payeefsp), resulting in an ILP transfer exchanged between two account holders on either side of a common ledger." + }, + "description": "Send transfer", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/transfers", + "method": "post", + "headers": { + "Accept": "{$inputs.acceptTransfersOld}", + "Content-Type": "{$inputs.contentTypeTransfersOld}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "body": { + "transferId": "{$prev.4.request.body.transactionId}", + "payerFsp": "{$inputs.fromFspId}", + "payeeFsp": "{$prev.3.callback.body.party.partyIdInfo.fspId}", + "amount": { + "amount": "{$inputs.amount}", + "currency": "{$inputs.currency}" + }, + "expiration": "{$prev.4.callback.body.expiration}", + "ilpPacket": "{$prev.4.callback.body.ilpPacket}", + "condition": "{$prev.4.callback.body.condition}" + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Accepted')" + ] + }, + { + "id": 3, + "description": "Callback Content Length not 0", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + }, + { + "id": 4, + "description": "Callback FSP Destination equal to request FSP Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "id": 5, + "description": "Callback transferState to be COMMITTED", + "exec": [ + "expect(callback.body.transferState).to.equal('COMMITTED')" + ] + }, + { + "id": 6, + "description": "Callback content-type to be transfers", + "exec": [ + "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.transfers+json;version={$inputs.expectedTransfersVersion}')" + ] + }, + { + "id": 7, + "description": "Request transferId same as quote request transferId", + "exec": [ + "expect('{$request.body.transferId}').to.equal('{$prev.4.request.body.transactionId}')" + ] + }, + { + "id": 8, + "description": "Request transferAmount (amount & currency) to match quote request", + "exec": [ + "expect('{$prev.4.callback.body.transferAmount.amount}').to.equal('{$request.body.amount.amount}')", + "expect('{$prev.4.callback.body.transferAmount.currency}').to.equal('{$request.body.amount.currency}')" + ] + }, + { + "id": 9, + "description": "Request FSP source the same as quote callback FSP destination", + "exec": [ + "expect('{$request.headers['FSPIOP-Source']}').to.equal('{$prev.4.callback.headers.fspiop-destination}')" + ] + }, + { + "id": 10, + "description": "Payee FSPIOP-Source", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.headers['fspiop-source']).to.equal('{$inputs.fromFspId}')", + "}" + ] + }, + { + "id": 11, + "description": "Payee Content-Type", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.headers['content-type']).to.equal(request.headers['Content-Type'])", + "}" + ] + }, + { + "id": 12, + "description": "Payee Body TransferId", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.data['transferId']).to.equal('{$request.body.transferId}')", + "}" + ] + }, + { + "id": 13, + "description": "Payee Body Amount", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + "expect(environment.payeeRequest.data.amount.amount).to.equal('{$request.body.amount.amount}')", + "}" + ] + } + ] + }, + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.transferId}', 'payeeRequest')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } + } + }, + { + "id": 6, + "description": "Send transfer", + "meta": { + "info": "This request allows us to send a Transfer (payerfsp to payeefsp), resulting in an ILP transfer exchanged between two account holders on either side of a common ledger." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/transfers", + "method": "post", + "headers": { + "Accept": "{$inputs.acceptTransfersNotSupported}", + "Content-Type": "{$inputs.contentTypeTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "body": { + "transferId": "{$prev.4.request.body.transactionId}", + "payerFsp": "{$inputs.fromFspId}", + "payeeFsp": "{$prev.3.callback.body.party.partyIdInfo.fspId}", + "amount": { + "amount": "{$inputs.amount}", + "currency": "{$inputs.currency}" + }, + "expiration": "{$prev.4.callback.body.expiration}", + "ilpPacket": "{$prev.4.callback.body.ilpPacket}", + "condition": "{$prev.4.callback.body.condition}" + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - The Client requested an unsupported version')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "ignoreCallbacks": true, + "scripts": { + "preRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.transferId}', 'payeeRequest')", + "// }" + ] + }, + "postRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }" + ] + } + } + }, + { + "id": 7, + "description": "Send transfer", + "meta": { + "info": "This request allows us to send a Transfer (payerfsp to payeefsp), resulting in an ILP transfer exchanged between two account holders on either side of a common ledger." + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/transfers", + "method": "post", + "headers": { + "Accept": "{$inputs.acceptTransfers}", + "Content-Type": "{$inputs.contentTypeTransfersNotSupported}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "body": { + "transferId": "{$prev.4.request.body.transactionId}", + "payerFsp": "{$inputs.fromFspId}", + "payeeFsp": "{$prev.3.callback.body.party.partyIdInfo.fspId}", + "amount": { + "amount": "{$inputs.amount}", + "currency": "{$inputs.currency}" + }, + "expiration": "{$prev.4.callback.body.expiration}", + "ilpPacket": "{$prev.4.callback.body.ilpPacket}", + "condition": "{$prev.4.callback.body.condition}" + }, + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText be Accepted", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - Client supplied a protocol version which is not supported by the server')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "ignoreCallbacks": true, + "scripts": { + "preRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.transferId}', 'payeeRequest')", + "// }" + ] + }, + "postRequest": { + "exec": [ + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "// }" + ] + } + } + } + ] + }, + { + "id": 4, + "name": "fspiop_protocol_validation - transactionRequests", + "fileInfo": { + "path": "hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json" + }, + "requests": [ + { + "id": 1, + "description": "Get transactionRequests by transactionId", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/transactionRequests/{ID}", + "path": "/transactionRequests/{$environment.tranid}", + "method": "get", + "params": { + "ID": "{$environment.tranid}" + }, + "url": "{$inputs.HOST_TRANSACTION_REQUESTS_SERVICE}", + "ignoreCallbacks": true, + "headers": { + "FSPIOP-Source": "{$inputs.SIMPAYER_NAME}", + "FSPIOP-Destination": "{$inputs.payeefsp}", + "Date": "{$function.generic.curDate}", + "Accept": "{$inputs.acceptTransactionRequestsOld}", + "Content-Type": "{$inputs.contentTypeTransactionRequestsOld}", + "FSPIOP-HTTP-Method": "GET", + "FSPIOP-URI": "/transactionRequests" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + } + ] + } + }, + { + "id": 2, + "description": "Get transactionRequests by transactionId", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/transactionRequests/{ID}", + "path": "/transactionRequests/{$environment.tranid}", + "method": "get", + "params": { + "ID": "{$environment.tranid}" + }, + "url": "{$inputs.HOST_TRANSACTION_REQUESTS_SERVICE}", + "ignoreCallbacks": true, + "headers": { + "FSPIOP-Source": "{$inputs.SIMPAYER_NAME}", + "FSPIOP-Destination": "{$inputs.payeefsp}", + "Date": "{$function.generic.curDate}", + "Accept": "{$inputs.acceptTransactionRequestsNotSupported}", + "Content-Type": "{$inputs.contentTypeTransactionRequests}", + "FSPIOP-HTTP-Method": "GET", + "FSPIOP-URI": "/transactionRequests" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText to be 'Not Acceptable'", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - The Client requested an unsupported version')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + } + }, + { + "id": 3, + "description": "Get transactionRequests by transactionId", + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/transactionRequests/{ID}", + "path": "/transactionRequests/{$environment.tranid}", + "method": "get", + "params": { + "ID": "{$environment.tranid}" + }, + "url": "{$inputs.HOST_TRANSACTION_REQUESTS_SERVICE}", + "ignoreCallbacks": true, + "headers": { + "FSPIOP-Source": "{$inputs.SIMPAYER_NAME}", + "FSPIOP-Destination": "{$inputs.payeefsp}", + "Date": "{$function.generic.curDate}", + "Accept": "{$inputs.acceptTransactionRequests}", + "Content-Type": "{$inputs.contentTypeTransactionRequestsNotSupported}", + "FSPIOP-HTTP-Method": "GET", + "FSPIOP-URI": "/transactionRequests" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText to be 'Not Acceptable'", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - Client supplied a protocol version which is not supported by the server')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/master.json b/collections/hub/golden_path/feature_tests/backward_compatibility/master.json new file mode 100644 index 00000000..3c74e7a9 --- /dev/null +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/master.json @@ -0,0 +1,8 @@ +{ + "order": [ + { + "name": "fspiop_protocol_validation.json", + "type": "file" + } + ] +} \ No newline at end of file diff --git a/collections/hub/golden_path/feature_tests/master.json b/collections/hub/golden_path/feature_tests/master.json index 28be3be9..140ea605 100644 --- a/collections/hub/golden_path/feature_tests/master.json +++ b/collections/hub/golden_path/feature_tests/master.json @@ -42,6 +42,10 @@ { "name": "patch_notifications", "type": "folder" + }, + { + "name": "backward_compatibility", + "type": "folder" } ] } \ No newline at end of file From 69198dbce2d6215a47d069d9e45c735914a8b08a Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Fri, 4 Mar 2022 19:26:49 +0200 Subject: [PATCH 2/7] fixed naming typos --- .../backward_compatibility/fspiop_protocol_validation.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index 16122231..bb33fa16 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -823,7 +823,7 @@ }, { "id": 3, - "name": "fspiop_protocol_validation - Transfers", + "name": "fspiop_protocol_validation - Transfers-Service", "meta": { "info": "This is a test to validate that ACCEPT and CONTENT-TYPE headers are correctly validated for both legacy (Old) and not\n-supported (NotSupported)" }, @@ -1507,7 +1507,7 @@ }, { "id": 4, - "name": "fspiop_protocol_validation - transactionRequests", + "name": "fspiop_protocol_validation - Transaction-Requests-Service", "fileInfo": { "path": "hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json" }, From b2487dae980ce7b93b3f75ea888995cac9353bad Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Fri, 4 Mar 2022 19:30:41 +0200 Subject: [PATCH 3/7] added some detail description info --- .../fspiop_protocol_validation.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index bb33fa16..f63b0b56 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -66,7 +66,7 @@ "id": 2, "description": "Add Participant to ALS", "meta": { - "info": "This request allows us to add a new participant to Account Lookup Service." + "info": "This request allows us to add a new participant to Account Lookup Service.\n\nValidate Not Support Accept header." }, "apiVersion": { "minorVersion": 1, @@ -151,7 +151,7 @@ "id": 3, "description": "Add Participant to ALS", "meta": { - "info": "This request allows us to add a new participant to Account Lookup Service." + "info": "This request allows us to add a new participant to Account Lookup Service. Validate Not Support Content-Type header." }, "apiVersion": { "minorVersion": 1, @@ -571,7 +571,7 @@ "id": 5, "description": "Send quote", "meta": { - "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction." + "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction. Validate Not Support Accept header." }, "apiVersion": { "minorVersion": 1, @@ -697,7 +697,7 @@ "id": 6, "description": "Send quote", "meta": { - "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction." + "info": "This request allows us to send a request for Quote (payerfsp to payeefsp), for the calculation of possible fees and FSP commission involved in performing an interoperable financial transaction. Validate Not Support Content-Type header." }, "apiVersion": { "minorVersion": 1, @@ -1315,7 +1315,7 @@ "id": 6, "description": "Send transfer", "meta": { - "info": "This request allows us to send a Transfer (payerfsp to payeefsp), resulting in an ILP transfer exchanged between two account holders on either side of a common ledger." + "info": "This request allows us to send a Transfer (payerfsp to payeefsp), resulting in an ILP transfer exchanged between two account holders on either side of a common ledger. Validate Not Support Accept header." }, "apiVersion": { "minorVersion": 1, @@ -1411,7 +1411,7 @@ "id": 7, "description": "Send transfer", "meta": { - "info": "This request allows us to send a Transfer (payerfsp to payeefsp), resulting in an ILP transfer exchanged between two account holders on either side of a common ledger." + "info": "This request allows us to send a Transfer (payerfsp to payeefsp), resulting in an ILP transfer exchanged between two account holders on either side of a common ledger. Validate Not Support Content-Type header." }, "apiVersion": { "minorVersion": 1, From 6b62e86ee8b236ed7ded629632ec05572f10b0ab Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Mon, 7 Mar 2022 11:46:48 +0200 Subject: [PATCH 4/7] updated backward compatibility tests to rather use get parties instead of post parties. --- .../fspiop_protocol_validation.json | 209 ++++++++++++------ 1 file changed, 146 insertions(+), 63 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index f63b0b56..c6519fa1 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -3,7 +3,7 @@ "test_cases": [ { "id": 1, - "name": "fspiop_protocol_validation - Account-lookup-Service", + "name": "fspiop_protocol_validation - Quoting-Service Copy", "meta": { "info": "This is a test to validate that ACCEPT and CONTENT-TYPE headers are correctly validated for both legacy (Old) and not\n-supported (NotSupported)" }, @@ -12,37 +12,30 @@ }, "requests": [ { - "id": 1, + "id": 3, "meta": { - "info": "This request allows us to add a new participant to Account Lookup Service." + "info": "This request allows us to get the personal information associated with a MSISDN and the FSP associated to it." }, - "description": "Add Participant to ALS", + "description": "Get party information", "apiVersion": { "minorVersion": 1, "majorVersion": 1, "type": "fspiop", "asynchronous": true }, - "operationPath": "/participants/{Type}/{ID}", - "path": "/participants/{$inputs.toIdType}/{$inputs.toIdValue}", - "method": "post", + "operationPath": "/parties/{Type}/{ID}", + "method": "get", + "headers": { + "Accept": "{$inputs.acceptPartiesOld}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "Content-Type": "{$inputs.contentTypePartiesOld}" + }, "params": { "Type": "{$inputs.toIdType}", "ID": "{$inputs.toIdValue}" }, - "headers": { - "FSPIOP-Source": "{$inputs.toFspId}", - "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", - "Accept": "{$inputs.acceptParticipantsOld}", - "Content-Type": "{$inputs.contentTypeParticipantsOld}", - "Date": "{$function.generic.curDate}" - }, - "body": { - "fspId": "{$inputs.toFspId}", - "currency": "{$inputs.currency}" - }, - "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", - "ignoreCallbacks": true, "tests": { "assertions": [ { @@ -54,19 +47,100 @@ }, { "id": 2, - "description": "Response statusText to be Accepted", + "description": "Response statusText be Accepted", "exec": [ "expect(response.statusText).to.equal('Accepted')" ] + }, + { + "id": 3, + "description": "Callback Content Length not 0", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + }, + { + "id": 4, + "description": "Callback body should contain party", + "exec": [ + "expect(callback.body).to.have.property('party')" + ] + }, + { + "id": 5, + "description": "Request FSPIOP-Source same as inputs fromFspId", + "exec": [ + "expect('{$request.headers['FSPIOP-Source']}').to.equal('{$inputs.fromFspId}')" + ] + }, + { + "id": 6, + "description": "Callback FSPIOP-Destination same as request FSPIOP-Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be parties", + "exec": [ + "expect(callback.headers['content-type']).to.equal('application/vnd.interoperability.parties+json;version={$inputs.expectedPartiesVersion}')" + ] + }, + { + "id": 8, + "description": "Callback partyIdInfo (partyIdType, partyIdentifier)", + "exec": [ + "expect(callback.body.party.partyIdInfo.partyIdType).to.equal('{$inputs.toIdType}')", + "expect(callback.body.party.partyIdInfo.partyIdentifier).to.equal('{$inputs.toIdValue}')" + ] + }, + { + "id": 9, + "description": "Payee FSPIOP-Source", + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " expect(environment.payeeRequest.headers['fspiop-source']).to.equal('{$inputs.fromFspId}')", + "}" + ] + }, + { + "id": 10, + "description": "Payee Content-Type", + "exec": [ + "// TODO investigate how to properly test this as it requires SIMs to be configured for 1.0", + "// if (environment.ENABLE_WS_ASSERTIONS===true) {", + "// expect(environment.payeeRequest.headers['content-type']).to.equal('application/vnd.interoperability.parties+json;version={$inputs.expectedPartiesVersion}')", + "// }" + ] } ] + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "path": "/parties/{$inputs.toIdType}/{$inputs.toIdValue}", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", + "}" + ] + }, + "postRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" + ] + } } }, { - "id": 2, - "description": "Add Participant to ALS", + "id": 4, + "description": "Get party information", "meta": { - "info": "This request allows us to add a new participant to Account Lookup Service.\n\nValidate Not Support Accept header." + "info": "This request allows us to get the personal information associated with a MSISDN and the FSP associated to it." }, "apiVersion": { "minorVersion": 1, @@ -74,26 +148,19 @@ "type": "fspiop", "asynchronous": true }, - "operationPath": "/participants/{Type}/{ID}", - "path": "/participants/{$inputs.toIdType}/{$inputs.toIdValue}", - "method": "post", + "operationPath": "/parties/{Type}/{ID}", + "method": "get", + "headers": { + "Accept": "{$inputs.acceptPartiesNotSupported}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "Content-Type": "{$inputs.contentTypeParties}" + }, "params": { "Type": "{$inputs.toIdType}", "ID": "{$inputs.toIdValue}" }, - "headers": { - "FSPIOP-Source": "{$inputs.toFspId}", - "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", - "Accept": "{$inputs.acceptParticipantsNotSupported}", - "Content-Type": "{$inputs.contentTypeParticipants}", - "Date": "{$function.generic.curDate}" - }, - "body": { - "fspId": "{$inputs.toFspId}", - "currency": "{$inputs.currency}" - }, - "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", - "ignoreCallbacks": true, "tests": { "assertions": [ { @@ -137,21 +204,32 @@ } ] }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "path": "/parties/{$inputs.toIdType}/{$inputs.toIdValue}", + "scriptingEngine": "javascript", + "ignoreCallbacks": true, "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", + "}" + ] + }, "postRequest": { "exec": [ - "console.log('test')", - "var res = pm.response.body;", - "console.log(JSON.stringify(res))" + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" ] } } }, { - "id": 3, - "description": "Add Participant to ALS", + "id": 5, + "description": "Get party information", "meta": { - "info": "This request allows us to add a new participant to Account Lookup Service. Validate Not Support Content-Type header." + "info": "This request allows us to get the personal information associated with a MSISDN and the FSP associated to it." }, "apiVersion": { "minorVersion": 1, @@ -159,26 +237,19 @@ "type": "fspiop", "asynchronous": true }, - "operationPath": "/participants/{Type}/{ID}", - "path": "/participants/{$inputs.toIdType}/{$inputs.toIdValue}", - "method": "post", + "operationPath": "/parties/{Type}/{ID}", + "method": "get", + "headers": { + "Accept": "{$inputs.acceptPartiesNotSupported}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}", + "Content-Type": "{$inputs.contentTypeParties}" + }, "params": { "Type": "{$inputs.toIdType}", "ID": "{$inputs.toIdValue}" }, - "headers": { - "FSPIOP-Source": "{$inputs.toFspId}", - "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", - "Accept": "{$inputs.acceptParticipants}", - "Content-Type": "{$inputs.contentTypeParticipantsNotSupported}", - "Date": "{$function.generic.curDate}" - }, - "body": { - "fspId": "{$inputs.toFspId}", - "currency": "{$inputs.currency}" - }, - "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", - "ignoreCallbacks": true, "tests": { "assertions": [ { @@ -222,11 +293,23 @@ } ] }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "path": "/parties/{$inputs.toIdType}/{$inputs.toIdValue}", "scriptingEngine": "javascript", + "ignoreCallbacks": true, "scripts": { + "preRequest": { + "exec": [ + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$inputs.toIdValue}', 'payeeRequest')", + "}" + ] + }, "postRequest": { "exec": [ - "" + "if (environment.ENABLE_WS_ASSERTIONS===true) {", + " environment.payeeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)", + "}" ] } } From 437c758693d806c82730e7d36aa78adb5c84d489 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Mon, 7 Mar 2022 11:56:57 +0200 Subject: [PATCH 5/7] fixed typo --- .../backward_compatibility/fspiop_protocol_validation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index c6519fa1..29103dfb 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -3,7 +3,7 @@ "test_cases": [ { "id": 1, - "name": "fspiop_protocol_validation - Quoting-Service Copy", + "name": "fspiop_protocol_validation - Account-Lookup-Service", "meta": { "info": "This is a test to validate that ACCEPT and CONTENT-TYPE headers are correctly validated for both legacy (Old) and not\n-supported (NotSupported)" }, From 75635f57a365691b0ff3c60e4111b4d5487754b5 Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Mon, 7 Mar 2022 12:07:43 +0200 Subject: [PATCH 6/7] fixes for backward compatibility tests --- .../backward_compatibility/fspiop_protocol_validation.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json index 29103dfb..7f12b1d2 100644 --- a/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json +++ b/collections/hub/golden_path/feature_tests/backward_compatibility/fspiop_protocol_validation.json @@ -240,11 +240,11 @@ "operationPath": "/parties/{Type}/{ID}", "method": "get", "headers": { - "Accept": "{$inputs.acceptPartiesNotSupported}", + "Accept": "{$inputs.acceptParties}", "Date": "{$function.generic.curDate}", "FSPIOP-Source": "{$inputs.fromFspId}", "Authorization": "{$inputs.TTK_BEARER_TOKEN}", - "Content-Type": "{$inputs.contentTypeParties}" + "Content-Type": "{$inputs.contentTypePartiesNotSupported}" }, "params": { "Type": "{$inputs.toIdType}", From e2d73eb85861061987337f5a999c542faa3a452d Mon Sep 17 00:00:00 2001 From: Miguel de Barros Date: Mon, 7 Mar 2022 15:09:58 +0200 Subject: [PATCH 7/7] feat(mojaloop/#2704): core-services support for non-breaking backward api compatibility - Added bulkTransfers tests for protocol validations --- .../fspiop_protocol_validation.json | 699 ++++++++++++++++++ .../other_tests/bulk_transfers/master.json | 4 + 2 files changed, 703 insertions(+) create mode 100644 collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json diff --git a/collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json b/collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json new file mode 100644 index 00000000..97378ebd --- /dev/null +++ b/collections/hub/other_tests/bulk_transfers/fspiop_protocol_validation.json @@ -0,0 +1,699 @@ +{ + "name": "multi", + "test_cases": [ + { + "id": 1, + "name": "fspiop_protocol_validation - Bulk-Transfers", + "meta": { + "info": "This is a test to validate that ACCEPT and CONTENT-TYPE headers are correctly validated for both legacy (Old) and not\n-supported (NotSupported)" + }, + "fileInfo": { + "path": "hub/other_tests/bulk_transfers/fspiop_protocol_validation.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.acceptBulkTransfersOld}", + "Content-Type": "{$inputs.contentBulkTransfersOld}", + "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": "{$environment.currency}", + "amount": "{$environment.amount}" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$environment.currency2}", + "amount": "{$environment.amount2}" + }, + "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(\"USD\")" + ] + }, + { + "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(\"USD\")" + ] + } + ] + }, + "ignoreCallbacks": false, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = 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", + "environment[\"amount\"] = 1", + "environment[\"amount2\"] = 1", + "environment[\"currency2\"] = \"USD\"", + "", + "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": 4, + "description": "POST Bulk Transfer", + "meta": { + "info": "POST Bulk Transfer" + }, + "apiVersion": { + "minorVersion": 1, + "majorVersion": 1, + "type": "fspiop", + "asynchronous": true + }, + "operationPath": "/bulkTransfers", + "method": "post", + "url": "{$inputs.HOST_BULK_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptBulkTransfersNotSupported}", + "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": "{$environment.currency}", + "amount": "{$environment.amount}" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$environment.currency2}", + "amount": "{$environment.amount2}" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText to be 'Not Acceptable'", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - The Client requested an unsupported version')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "ignoreCallbacks": true, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = 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", + "environment[\"amount\"] = 1", + "environment[\"amount2\"] = 1", + "environment[\"currency2\"] = \"USD\"", + "", + "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": 5, + "description": "POST Bulk Transfer", + "meta": { + "info": "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.contentBulkTransfersNotSupported}", + "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": "{$environment.currency}", + "amount": "{$environment.amount}" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}", + "extensionList": { + "extension": [ + { + "key": "extKey1", + "value": "extValue1" + }, + { + "key": "extKey2", + "value": "extValue2" + } + ] + } + }, + { + "transferId": "{$function.generic.generateUUID}", + "transferAmount": { + "currency": "{$environment.currency2}", + "amount": "{$environment.amount2}" + }, + "ilpPacket": "{$environment.validIlpPacket2}", + "condition": "{$environment.validCondition2}" + } + ], + "expiration": "{$environment.expirationDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 406", + "exec": [ + "expect(response.status).to.equal(406)" + ] + }, + { + "id": 2, + "description": "Response statusText to be 'Not Acceptable'", + "exec": [ + "expect(response.statusText).to.equal('Not Acceptable')" + ] + }, + { + "id": 3, + "description": "Response errorCode to be 3001", + "exec": [ + "expect(response.body.errorInformation.errorCode).to.equal('3001')", + "" + ] + }, + { + "id": 4, + "description": "Response errorDescription to contain`Unacceptable version requested`", + "exec": [ + "expect(response.body.errorInformation.errorDescription).to.contain('Unacceptable version requested - Client supplied a protocol version which is not supported by the server')", + "" + ] + }, + { + "id": 5, + "description": "Response header content-type to be correct", + "exec": [ + "// Currently this is not working", + "// expect(response.headers['content-type']).to.equal(environment.contentTypeParticipants)", + "" + ] + } + ] + }, + "ignoreCallbacks": true, + "params": { + "name": "testingtoolkitdfsp" + }, + "path": "/bulkTransfers", + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "const delay = 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", + "environment[\"amount\"] = 1", + "environment[\"amount2\"] = 1", + "environment[\"currency2\"] = \"USD\"", + "", + "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)", + "}", + "" + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/collections/hub/other_tests/bulk_transfers/master.json b/collections/hub/other_tests/bulk_transfers/master.json index 725175ad..784e2b2e 100644 --- a/collections/hub/other_tests/bulk_transfers/master.json +++ b/collections/hub/other_tests/bulk_transfers/master.json @@ -7,6 +7,10 @@ { "name": "negative_scenarios.json", "type": "file" + }, + { + "name": "fspiop_protocol_validation.json", + "type": "file" } ] } \ No newline at end of file