diff --git a/collections/hub/golden_path/fx/feature_tests/settlement_fx/happy_path.json b/collections/hub/golden_path/fx/feature_tests/settlement_fx/happy_path.json new file mode 100644 index 00000000..ffd9ae64 --- /dev/null +++ b/collections/hub/golden_path/fx/feature_tests/settlement_fx/happy_path.json @@ -0,0 +1,3166 @@ +{ + "options": {}, + "name": "happy_path", + "saveReport": true, + "test_cases": [ + { + "id": 1, + "name": "Store settlement and position balances before fx transfer and normal transfer", + "meta": { + "info": "Store settlement and position balances before fx transfer and normal transfer" + }, + "fileInfo": { + "path": "happy_path.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "store balances for fxp" + }, + "description": "store balances for fxp", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "" + ] + }, + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer= curAccount.value;", + " environment.fxpSourceCurrencyPositionAccountBalanceBeforeTransfer= curAccount.value;", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer= curAccount.value;", + " environment.fxpSourceCurrencySettlementAccountBalanceBeforeTransfer= curAccount.value;", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxpTargetCurrencyPositionAccountBalanceBeforeTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceBeforeTransfer= curAccount.value", + " environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer= curAccount.value", + " }", + "})", + "", + "", + "console.log(`environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer: ${environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer: ${environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer: ${environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer: ${environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpSourceCurrencySettlementAccountBalanceBeforeTransfer: ${environment.fxpSourceCurrencySettlementAccountBalanceBeforeTransfer}`);", + "console.log(`environment.fxpSourceCurrencyPositionAccountBalanceBeforeTransfer: ${environment.fxpSourceCurrencyPositionAccountBalanceBeforeTransfer}`);", + "console.log(`environment.fxpTargetCurrencySettlementAccountBalanceBeforeTransfer: ${environment.fxpTargetCurrencySettlementAccountBalanceBeforeTransfer}`);", + "console.log(`environment.fxpTargetCurrencyPositionAccountBalanceBeforeTransfer: ${environment.fxpTargetCurrencyPositionAccountBalanceBeforeTransfer}`);" + ] + } + } + }, + { + "id": 2, + "meta": { + "info": "store balances for fx payer" + }, + "description": "store balances for fx payer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "" + ] + }, + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "", + " res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " ", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayerSettlementAccountBalanceBeforeTransfer= curAccount.value", + " }", + " ", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayerPositionAccountBalanceBeforeTransfer= curAccount.value", + " } ", + "", + "", + "})", + "//})", + "", + "", + "console.log(environment.fxPayerSettlementAccountBalanceBeforeTransfer);", + "console.log(environment.fxPayerPositionAccountBalanceBeforeTransfer);" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "store balances for fx payee" + }, + "description": "store balances for fx payee", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "" + ] + }, + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "", + " res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " ", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayeeSettlementAccountBalanceBeforeTransfer= curAccount.value", + " }", + " ", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayeePositionAccountBalanceBeforeTransfer= curAccount.value", + " } ", + "", + "", + "})", + "//})", + "", + " ", + "console.log(environment.fxPayeeSettlementAccountBalanceBeforeTransfer);", + "console.log(environment.fxPayeePositionAccountBalanceBeforeTransfer);" + ] + } + } + } + ] + }, + { + "id": 2, + "name": "Happy Path FX E2E", + "fileInfo": { + "path": "happy_path.json" + }, + "meta": { + "info": "FX Transfer" + }, + "breakOnError": false, + "requests": [ + { + "id": 1, + "description": "Add Participant to ALS", + "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": "/participants/{Type}/{ID}", + "path": "/participants/{$inputs.toIdType}/{$inputs.FX_MSISDN_1}", + "method": "post", + "params": { + "Type": "{$inputs.toIdType}", + "ID": "{$inputs.FX_MSISDN_1}" + }, + "body": { + "fspId": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "headers": { + "FSPIOP-Source": "{$inputs.FX_PAYEE_DFSP_ID}", + "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", + "Accept": "{$inputs.acceptParticipants}", + "Content-Type": "{$inputs.contentTypeParticipants}", + "Date": "{$function.generic.curDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + } + ] + }, + "disabled": false + }, + { + "id": 2, + "description": "Get party info", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "additionalApi": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/parties/{Type}/{ID}", + "path": "/parties/MSISDN/{$inputs.FX_MSISDN_1}", + "method": "get", + "params": { + "Type": "MSISDN", + "ID": "{$inputs.FX_MSISDN_1}" + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "headers": { + "Content-Type": "{$inputs.contentTypeParties}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "Accept": "{$inputs.acceptParties}" + }, + "disabled": false, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "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": 6, + "description": "Callback FSPIOP-Destination same as request FSPIOP-Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "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.FX_MSISDN_1}')" + ] + } + ] + } + }, + { + "id": 4, + "description": "POST /fxQuotes", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxQuotes", + "path": "/fxQuotes", + "method": "post", + "body": { + "conversionRequestId": "{$function.generic.generateUUID}", + "conversionTerms": { + "conversionId": "{$function.generic.generateUUID}", + "determiningTransferId": "{$function.generic.generateUUID}", + "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", + "amountType": "SEND", + "sourceAmount": { + "currency": "{$inputs.FX_SOURCE_CURRENCY}", + "amount": "{$inputs.FX_SOURCE_AMOUNT}" + }, + "targetAmount": { + "currency": "{$inputs.FX_TARGET_CURRENCY}" + }, + "expiration": "{$inputs.FX_EXPIRATION}" + } + }, + "headers": { + "Accept": "{$inputs.acceptFxQuotes}", + "Content-Type": "{$inputs.contentTypeFxQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "disabled": false, + "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 conversionTerms", + "exec": [ + "expect(callback.body).to.have.property('conversionTerms')" + ] + }, + { + "id": 6, + "description": "Callback sourceAmount (amount & currency) to match the request", + "exec": [ + "expect(callback.body.conversionTerms.sourceAmount.currency).to.equal('{$request.body.conversionTerms.sourceAmount.currency}')", + "request.body.conversionTerms.sourceAmount.amount && expect(callback.body.conversionTerms.sourceAmount.amount).to.equal('{$request.body.conversionTerms.sourceAmount.amount}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be fxQuotes", + "exec": [ + "expect(callback.headers['content-type']).to.have.string('application/vnd.interoperability.fxQuotes+json')" + ] + }, + { + "id": 16, + "description": "Callback body should contain condition", + "exec": [ + "expect(callback.body).to.have.property('condition')" + ] + }, + { + "id": 17, + "description": "Callback body should contain target amount", + "exec": [ + "expect(callback.body.conversionTerms.targetAmount).to.have.property('amount')" + ] + }, + { + "id": 18, + "description": "Callback transferAmount (amount & currency)to match the request Copy", + "exec": [ + "expect(callback.body.conversionTerms.sourceAmount.currency).to.equal('{$request.body.conversionTerms.sourceAmount.currency}')", + "expect(callback.body.conversionTerms.targetAmount.currency).to.equal('{$request.body.conversionTerms.targetAmount.currency}')" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "var res = callback.body;", + "", + "console.log('targetAmount:',res.conversionTerms.targetAmount.amount);", + "environment.FX_TARGET_AMOUNT= res.conversionTerms.targetAmount.amount;" + ] + } + } + }, + { + "id": 5, + "description": "POST /quotes", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/quotes", + "path": "/quotes", + "method": "post", + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "headers": { + "Accept": "{$inputs.acceptQuotes}", + "Content-Type": "{$inputs.contentTypeQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "body": { + "quoteId": "{$function.generic.generateUUID}", + "transactionId": "{$prev.4.request.body.conversionTerms.determiningTransferId}", + "payer": { + "partyIdInfo": { + "partyIdType": "{$inputs.fromIdType}", + "partyIdentifier": "{$inputs.fromIdValue}", + "fspId": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "personalInfo": { + "complexName": { + "firstName": "{$inputs.fromFirstName}", + "lastName": "{$inputs.fromLastName}" + }, + "dateOfBirth": "{$inputs.fromDOB}" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "{$prev.2.callback.body.party.partyIdInfo.partyIdType}", + "partyIdentifier": "{$prev.2.callback.body.party.partyIdInfo.partyIdentifier}", + "fspId": "{$prev.2.callback.body.party.partyIdInfo.fspId}" + } + }, + "amountType": "SEND", + "amount": { + "amount": "{$prev.4.callback.body.conversionTerms.targetAmount.amount}", + "currency": "{$prev.4.callback.body.conversionTerms.targetAmount.currency}" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "{$inputs.note}" + }, + "disabled": false, + "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": 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": 9, + "description": "POST /fxTransfers", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxTransfers", + "path": "/fxTransfers", + "method": "post", + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptFxTransfers}", + "Content-Type": "{$inputs.contentTypeFxTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_TESTFXP1_ID}" + }, + "body": { + "commitRequestId": "{$prev.4.callback.body.conversionTerms.conversionId}", + "determiningTransferId": "{$prev.4.request.body.conversionTerms.determiningTransferId}", + "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", + "amountType": "SEND", + "sourceAmount": { + "amount": "{$prev.4.callback.body.conversionTerms.sourceAmount.amount}", + "currency": "{$prev.4.callback.body.conversionTerms.sourceAmount.currency}" + }, + "targetAmount": { + "amount": "{$prev.4.callback.body.conversionTerms.targetAmount.amount}", + "currency": "{$prev.4.callback.body.conversionTerms.targetAmount.currency}" + }, + "condition": "{$prev.4.callback.body.condition}", + "expiration": "{$requestVariables.expiration}" + }, + "scriptingEngine": "javascript", + "disabled": false, + "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 length not zero", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" + ] + } + } + }, + { + "id": 10, + "description": "Check balances for Payer AFTER fx transfer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "disabled": false, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payer position account value should be changed by the amount of the transfer", + "exec": [ + "expect(Number(environment.fxPayerPositionAccountBalanceAfterFxTransfer)).to.equal(Number(environment.fxPayerPositionAccountBalanceBeforeFxTransfer)+Number(environment.FX_SOURCE_AMOUNT))" + ] + }, + { + "id": 2, + "description": "Payer settlement account value should not be changed", + "exec": [ + "expect(Number(environment.fxPayerSettlementAccountBalanceAfterFxTransfer)).to.equal(Number(environment.fxPayerSettlementAccountBalanceBeforeFxTransfer))" + ] + } + ] + }, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceAfterFxTransfer = curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceAfterFxTransfer = curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after FX Transfer=${environment.fxPayerPositionAccountBalanceAfterFxTransfer}`);", + "console.log(`Payer Settlement Balance after FX Transfer=${environment.fxPayerSettlementAccountBalanceAfterFxTransfer}`);" + ] + } + } + }, + { + "id": 11, + "description": "Check balances for FXP AFTER fx transfer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "FXP Source currency position account value should not be changed", + "exec": [ + "expect(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterFxTransfer)).to.equal(Number(environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer))" + ] + }, + { + "id": 2, + "description": "FXP Source currency settlement account value should not be changed", + "exec": [ + "expect(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterFxTransfer)).to.equal(Number(environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer))" + ] + }, + { + "id": 3, + "description": "FXP Target currency position account value should not be changed", + "exec": [ + "expect(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterFxTransfer)).to.equal(Number(environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer))" + ] + }, + { + "id": 4, + "description": "FXP Target currency settlement account value should not be changed", + "exec": [ + "expect(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterFxTransfer)).to.equal(Number(environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceAfterFxTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceAfterFxTransfer = curAccount.value", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceAfterFxTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceAfterFxTransfer = curAccount.value", + " }", + "})", + "", + "", + "console.log(`environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer: ${environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer: ${environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer: ${environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer: ${environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer}`);", + "console.log(`FXP Source Currency Position Balance after FX Transfer=${environment.fxpSourceCurrencyPositionAccountBalanceAfterFxTransfer}`);", + "console.log(`FXP Source Currency Settlement Balance after FX Transfer=${environment.fxpSourceCurrencySettlementAccountBalanceAfterFxTransfer}`);", + "console.log(`FXP Target Currency Position Balance after FX Transfer=${environment.fxpTargetCurrencyPositionAccountBalanceAfterFxTransfer}`);", + "console.log(`FXP Target Currency Settlement Balance after FX Transfer=${environment.fxpTargetCurrencySettlementAccountBalanceAfterFxTransfer}`);" + ] + } + } + }, + { + "id": 12, + "description": "Check balances for Payee AFTER fx transfer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "disabled": false, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payee position account value should not be changed", + "exec": [ + "expect(environment.fxPayeePositionAccountBalanceAfterFxTransfer).to.equal(environment.fxPayeePositionAccountBalanceBeforeFxTransfer)" + ] + }, + { + "id": 2, + "description": "Payee settlement account value should not be changed", + "exec": [ + "expect(environment.fxPayeeSettlementAccountBalanceAfterFxTransfer).to.equal(environment.fxPayeeSettlementAccountBalanceBeforeFxTransfer)" + ] + } + ] + }, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceAfterFxTransfer = curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceAfterFxTransfer = curAccount.value", + " }", + "})", + "", + "console.log(`Payee Position Balance after Fx Transfer=${environment.fxPayeePositionAccountBalanceAfterFxTransfer}`);" + ] + } + } + }, + { + "id": 13, + "description": "Check that State of Fx Transfer is RESERVED", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxTransfers/{ID}", + "path": "/fxTransfers/{$prev.9.request.body.commitRequestId}", + "method": "get", + "params": { + "ID": "{$prev.9.request.body.commitRequestId}" + }, + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptFxTransfers}", + "Content-Type": "{$inputs.contentTypeFxTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "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 conversionState to be RESERVED", + "exec": [ + "expect(callback.body.conversionState).to.equal('RESERVED')" + ] + }, + { + "id": 6, + "description": "Callback content-type to be fxTransfers", + "exec": [ + "expect(callback.headers['content-type']).to.have.string('application/vnd.interoperability.fxTransfers+json')" + ] + }, + { + "id": 8, + "description": "Callback body should contain fulfilment", + "exec": [ + "expect(callback.body).to.have.property('fulfilment')" + ] + } + ] + } + }, + { + "id": 14, + "description": "POST /transfer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/transfers", + "path": "/transfers", + "method": "post", + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "body": { + "transferId": "{$prev.4.request.body.conversionTerms.determiningTransferId}", + "payeeFsp": "{$inputs.FX_PAYEE_DFSP_ID}", + "payerFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "amount": { + "currency": "{$prev.5.callback.body.transferAmount.currency}", + "amount": "{$prev.5.callback.body.transferAmount.amount}" + }, + "ilpPacket": "{$prev.5.callback.body.ilpPacket}", + "condition": "{$prev.5.callback.body.condition}", + "expiration": "{$prev.5.callback.body.expiration}" + }, + "headers": { + "Accept": "{$inputs.acceptTransfers}", + "Content-Type": "{$inputs.contentTypeTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "disabled": false, + "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": 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}')" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" + ] + } + } + }, + { + "id": 15, + "description": "Check balances for Payer AFTER transfer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payeer position account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerPositionAccountBalanceAfterTransfer)).to.equal(Number(environment.fxPayerPositionAccountBalanceAfterFxTransfer))" + ] + }, + { + "id": 2, + "description": "Payeer settlement account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerSettlementAccountBalanceAfterTransfer)).to.equal(Number(environment.fxPayerSettlementAccountBalanceAfterFxTransfer))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceAfterTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceAfterTransfer= curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after Transfer=${environment.fxPayerPositionAccountBalanceAfterTransfer}`);", + "", + "" + ] + } + } + }, + { + "id": 16, + "description": "Check balances for FXP after transfer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "FXP Source currency position account value should decrease by the source amount of the transfer", + "exec": [ + "expect(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterTransfer)).to.equal(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterFxTransfer)-Number(environment.FX_SOURCE_AMOUNT))" + ] + }, + { + "id": 2, + "description": "FXP Source currency settlement account value should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterTransfer)).to.equal(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterFxTransfer))" + ] + }, + { + "id": 3, + "description": "FXP Target currency position account value should increase by the target amount of the transfer", + "exec": [ + "expect(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterTransfer)).to.equal(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterFxTransfer)+Number(environment.FX_TARGET_AMOUNT))" + ] + }, + { + "id": 4, + "description": "FXP Target currency settlement account value should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterTransfer)).to.equal(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterFxTransfer))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceAfterTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceAfterTransfer= curAccount.value", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceAfterTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceAfterTransfer= curAccount.value", + " }", + "})", + "", + "" + ] + } + } + }, + { + "id": 17, + "description": "Check balances for Payee after transfer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payee position account balance should decrease by the target amount of the transfer", + "exec": [ + "expect(Number(environment.fxPayeePositionAccountBalanceAfterTransfer)).to.equal(Number(environment.fxPayeePositionAccountBalanceAfterFxTransfer)-Number(environment.FX_TARGET_AMOUNT))" + ] + }, + { + "id": 2, + "description": "Payee settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxPayeeSettlementAccountBalanceAfterTransfer)).to.equal(Number(environment.fxPayeeSettlementAccountBalanceAfterFxTransfer))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceAfterTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceAfterTransfer= curAccount.value", + " }", + "})", + "", + "console.log(`Payee Position Balance after Transfer=${environment.fxPayeePositionAccountBalanceAfterTransfer}`);", + "", + "" + ] + } + } + }, + { + "id": 18, + "description": "Check that State of Fx Transfer is COMMITTED", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxTransfers/{ID}", + "path": "/fxTransfers/{$prev.9.request.body.commitRequestId}", + "method": "get", + "params": { + "ID": "{$prev.9.request.body.commitRequestId}" + }, + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptFxTransfers}", + "Content-Type": "{$inputs.contentTypeFxTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "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 conversionState to be COMMITTED", + "exec": [ + "expect(callback.body.conversionState).to.equal('COMMITTED')" + ] + }, + { + "id": 6, + "description": "Callback content-type to be fxTransfers", + "exec": [ + "expect(callback.headers['content-type']).to.have.string('application/vnd.interoperability.fxTransfers+json')" + ] + }, + { + "id": 8, + "description": "Callback body should contain fulfilment", + "exec": [ + "expect(callback.body).to.have.property('fulfilment')" + ] + } + ] + } + } + ] + }, + { + "id": 3, + "name": "Create Settlement and check balances at different stages", + "meta": { + "info": "Create Settlement and check balances at different stages" + }, + "fileInfo": { + "path": "happy_path.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "Get Existing Open Window" + }, + "description": "Get Existing Open Window", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlementWindows", + "path": "/settlementWindows", + "method": "get", + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "queryParams": { + "state": "OPEN" + }, + "headers": { + "Content-Type": "application/json", + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + }, + { + "id": 2, + "description": "State should be OPEN", + "exec": [ + "expect(environment.openWindowstate).to.equal(\"OPEN\")" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = response.body;", + "//console.log(jsonData.state);", + "", + "environment.openWindowID=jsonData[0].settlementWindowId;", + "environment.openWindowstate=jsonData[0].state;", + "", + "console.log(environment.openWindowID);" + ] + } + } + }, + { + "id": 2, + "meta": { + "info": "Close current open window" + }, + "description": "Close existent window", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlementWindows/{id}", + "path": "/settlementWindows/{$environment.openWindowID}", + "method": "post", + "params": { + "id": "{$environment.openWindowID}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "state": "CLOSED", + "reason": "string" + }, + "headers": { + "Content-Type": "application/json", + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200 or 400", + "exec": [ + "if(response.status === 400){", + " expect(response.status).to.equal(400)", + "}", + "else{", + " expect(response.status).to.equal(200)", + "}", + "", + "" + ] + }, + { + "id": 2, + "description": "New window State should be OPEN", + "exec": [ + "", + " if (response.status === 400) {", + " ", + "expect(response.body.errorInformation.errorCode).to.eql('3100');", + "expect(response.body.errorInformation.errorDescription).to.eql('Generic validation error - Window ' + environment.openWindowID + ' is empty');", + "}else{", + " ", + " ", + " expect(environment.openWindowstate).to.equal(\"OPEN\");", + "}", + "", + "", + "" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = response.body;", + "var rcode = Number(response.status);", + "//console.log(rcode);", + "", + "//if (rcode == 200){", + "environment.closedWindowID= Number(environment.openWindowID);", + "environment.openWindowstate=jsonData.state;", + "", + "console.log(environment.openWindowstate);", + "console.log(environment.closedWindowID);", + "//}" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "Create Settlement for Closed Window" + }, + "description": "Create Settlement for Closed Window", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements", + "path": "/settlements", + "method": "post", + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "headers": { + "Content-Type": "application/json", + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "body": { + "settlementModel": "DEFAULTDEFERREDNET", + "reason": "TESTING", + "settlementWindows": [ + { + "id": "{$requestVariables.closedWindowID}" + } + ] + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Settlement State should be PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(environment.winstate).to.equal(\"PENDING_SETTLEMENT\")", + "}" + ] + }, + { + "id": 3, + "description": "Number of associated windows should be 1", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows.length).to.equal(1)", + "}" + ] + }, + { + "id": 4, + "description": "Associated Settlement Window ID is the correct one", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].id).to.equal(environment.closedWindowID)", + "}" + ] + }, + { + "id": 5, + "description": "Associated Settlement Window state should be PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal(\"PENDING_SETTLEMENT\")", + "}" + ] + }, + { + "id": 6, + "description": "Total source currency net settlement amount in the Settlement should be 0", + "exec": [ + "expect(environment.totalSourceCurrencyNetSettlementAmount).to.equal(0)" + ] + }, + { + "id": 7, + "description": "Total target currency net settlement amount in the Settlement should be 0", + "exec": [ + "expect(environment.totalTargetCurrencyNetSettlementAmount).to.equal(0)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = response.body;", + "environment.settlementData = jsonData", + "environment.settlementId = jsonData.id;", + "environment.winstate = jsonData.state;", + "", + "if (response.body.errorInformation?.errorCode === \"3100\"){", + " ", + " environment.WINDOWISEMPTY = true;", + " console.log(\"Window is empty\");", + "}else{", + " environment.WINDOWISEMPTY = false;", + "}", + "", + "var totalSourceCurrencyNetSettlementAmount = 0;", + "var totalTargetCurrencyNetSettlementAmount = 0;", + "jsonData.participants.forEach(participant => {", + " participant.accounts.forEach( account => {", + " if(account.netSettlementAmount.currency == environment.FX_SOURCE_CURRENCY) {", + " totalSourceCurrencyNetSettlementAmount += Number(account.netSettlementAmount.amount)", + " console.log('totalSourceCurrencyNetSettlementAmount: ',totalSourceCurrencyNetSettlementAmount)", + " } else if(account.netSettlementAmount.currency == environment.FX_TARGET_CURRENCY) {", + " totalTargetCurrencyNetSettlementAmount += Number(account.netSettlementAmount.amount)", + " console.log('totalTargetCurrencyNetSettlementAmount: ',totalTargetCurrencyNetSettlementAmount)", + " }", + " })", + "})", + "", + "", + "environment.totalSourceCurrencyNetSettlementAmount = totalSourceCurrencyNetSettlementAmount", + "environment.totalTargetCurrencyNetSettlementAmount = totalTargetCurrencyNetSettlementAmount", + "" + ] + }, + "preRequest": { + "exec": [ + "//environment.closedWindowID = 6;", + "requestVariables.closedWindowID = Number(environment.closedWindowID);", + "", + "/*requestVariables.closedWindowID = Number(environment.closedWindowID);", + "*/", + "", + "" + ] + } + } + }, + { + "id": 4, + "description": "Check balances for Payer AFTER creating settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payeer position account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerPositionAccountBalanceAfterCreateSettlement)).to.equal(Number(environment.fxPayerPositionAccountBalanceAfterTransfer))" + ] + }, + { + "id": 2, + "description": "Payeer settlement account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerSettlementAccountBalanceAfterCreateSettlement)).to.equal(Number(environment.fxPayerSettlementAccountBalanceAfterTransfer))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerPositionAccountBalanceAfterCreateSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerSettlementAccountBalanceAfterCreateSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 5, + "description": "Check balances for FXP after create settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "FXP Source currency position account value should increase by the source amount of the transfer", + "exec": [ + "expect(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterTransfer)).to.equal(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterTransfer))" + ] + }, + { + "id": 2, + "description": "FXP Source currency settlement account value should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterCreateSettlement)).to.equal(environment.fxpSourceCurrencySettlementAccountBalanceAfterTransfer)" + ] + }, + { + "id": 3, + "description": "FXP Target currency position account value should not change", + "exec": [ + "expect(environment.fxpTargetCurrencyPositionAccountBalanceAfterCreateSettlement).to.equal(environment.fxpTargetCurrencyPositionAccountBalanceAfterTransfer)" + ] + }, + { + "id": 4, + "description": "FXP Target currency settlement account value should not change", + "exec": [ + "expect(environment.fxpTargetCurrencySettlementAccountBalanceAfterCreateSettlement).to.equal(environment.fxpTargetCurrencySettlementAccountBalanceAfterTransfer)" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + "})", + "", + "", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxpSourceCurrencyPositionAccountBalanceAfterCreateSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxpSourceCurrencySettlementAccountBalanceAfterCreateSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxpTargetCurrencyPositionAccountBalanceAfterCreateSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxpTargetCurrencySettlementAccountBalanceAfterCreateSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 6, + "description": "Check balances for Payee after create settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payee position account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayeePositionAccountBalanceAfterCreateSettlement)).to.equal(Number(environment.fxPayeePositionAccountBalanceAfterTransfer))" + ] + }, + { + "id": 2, + "description": "Payee settlement account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayeeSettlementAccountBalanceAfterCreateSettlement)).to.equal(Number(environment.fxPayeeSettlementAccountBalanceAfterTransfer))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceAfterCreateSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payee Position Balance after Transfer=${environment.fxPayeePositionAccountBalanceAfterCreateSettlement}`);", + "console.log(`Payee Position Balance after Transfer=${environment.fxPayeeSettlementAccountBalanceAfterCreateSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 7, + "meta": { + "info": "Prepare Settlement" + }, + "description": "Prepare Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is PS_TRANSFERS_RECORDED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('PS_TRANSFERS_RECORDED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('PENDING_SETTLEMENT')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is PS_TRANSFERS_RECORDED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('PS_TRANSFERS_RECORDED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.settlementData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PENDING_SETTLEMENT\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'PS_TRANSFERS_RECORDED',", + " reason: \"Transfers recorded for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + }, + "postRequest": { + "exec": [ + "environment.preparedData = response.body;" + ] + } + } + }, + { + "id": 8, + "description": "Check balances for Payer account after preparing settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payer position account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerPositionAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxPayerPositionAccountBalanceAfterCreateSettlement))" + ] + }, + { + "id": 2, + "description": "Payer settlement account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerSettlementAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxPayerSettlementAccountBalanceAfterCreateSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerPositionAccountBalanceAfterPrepareSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerSettlementAccountBalanceAfterPrepareSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 9, + "description": "Check balances for FXP after prepare settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "FXP Source currency position balance should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterCreateSettlement))" + ] + }, + { + "id": 2, + "description": "FXP Source currency settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterCreateSettlement))" + ] + }, + { + "id": 3, + "description": "FXP Target currency position account balance should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterCreateSettlement))" + ] + }, + { + "id": 4, + "description": "FXP Target currency settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterCreateSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after Prepare Settlement=${environment.fxpSourceCurrencyPositionAccountBalanceAfterPrepareSettlement}`);", + "console.log(`Payer Position Balance after Prepare Settlement=${environment.fxpSourceCurrencySettlementAccountBalanceAfterPrepareSettlement}`);", + "console.log(`Payer Position Balance after Prepare Settlement=${environment.fxpTargetCurrencyPositionAccountBalanceAfterPrepareSettlement}`);", + "console.log(`Payer Position Balance after Prepare Settlement=${environment.fxpTargetCurrencySettlementAccountBalanceAfterPrepareSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 10, + "description": "Check balances for Payee after prepare settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payee position account balance should not change", + "exec": [ + "expect(Number(environment.fxPayeePositionAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxPayeePositionAccountBalanceAfterCreateSettlement))" + ] + }, + { + "id": 2, + "description": "Payee settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxPayeeSettlementAccountBalanceAfterPrepareSettlement)).to.equal(Number(environment.fxPayeeSettlementAccountBalanceAfterCreateSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceAfterPrepareSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeePositionAccountBalanceAfterPrepareSettlement}`);", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeeSettlementAccountBalanceAfterPrepareSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 11, + "meta": { + "info": "Reserve Settlement" + }, + "description": "Reserve Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is PS_TRANSFERS_RESERVED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('PS_TRANSFERS_RESERVED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('PENDING_SETTLEMENT')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is PS_TRANSFERS_RESERVED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('PS_TRANSFERS_RESERVED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "disabled": false, + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.preparedData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PS_TRANSFERS_RECORDED\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'PS_TRANSFERS_RESERVED',", + " reason: \"Transfers reserved for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + }, + "postRequest": { + "exec": [ + "environment.reservedData = response.body;" + ] + } + } + }, + { + "id": 12, + "description": "Check balances for Payer account after reserve settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payer position account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerPositionAccountBalanceAfterReserveSettlement)).to.equal(Number(environment.fxPayerPositionAccountBalanceAfterPrepareSettlement))" + ] + }, + { + "id": 2, + "description": "Payer settlement account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerSettlementAccountBalanceAfterReserveSettlement)).to.equal(Number(environment.fxPayerSettlementAccountBalanceAfterPrepareSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerPositionAccountBalanceAfterReserveSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerSettlementAccountBalanceAfterReserveSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 13, + "description": "Check balances for FXP after reserve settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "FXP Source currency position account balance should reset to value before transfer", + "exec": [ + "expect(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterReserveSettlement)).to.equal(Number(environment.fxpSourceCurrencyPositionAccountBalanceBeforeTransfer))" + ] + }, + { + "id": 2, + "description": "FXP Source currency settlement account value should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterReserveSettlement)).to.equal(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterPrepareSettlement))" + ] + }, + { + "id": 3, + "description": "FXP Target currency position account balance should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterReserveSettlement)).to.equal(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterPrepareSettlement))" + ] + }, + { + "id": 4, + "description": "FXP Target currency settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterReserveSettlement)).to.equal(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterPrepareSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + "})", + "", + "" + ] + } + } + }, + { + "id": 14, + "description": "Check balances for Payee after reserve settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payee position account balance should reset to valaue before transfer", + "exec": [ + "expect(environment.fxPayeePositionAccountBalanceAfterReserveSettlement).to.equal(environment.fxPayeePositionAccountBalanceBeforeTransfer)" + ] + }, + { + "id": 2, + "description": "Payee settlement account balance should not change", + "exec": [ + "expect(environment.fxPayeeSettlementAccountBalanceAfterReserveSettlement).to.equal(environment.fxPayeeSettlementAccountBalanceAfterPrepareSettlement)" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceAfterReserveSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeePositionAccountBalanceAfterReserveSettlement}`);", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeeSettlementAccountBalanceAfterReserveSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 15, + "meta": { + "info": "Commit Settlement" + }, + "description": "Commit Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is PS_TRANSFERS_COMMITTED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('PS_TRANSFERS_COMMITTED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('PENDING_SETTLEMENT')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is PS_TRANSFERS_COMMITTED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('PS_TRANSFERS_COMMITTED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "disabled": false, + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.reservedData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PS_TRANSFERS_RESERVED\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'PS_TRANSFERS_COMMITTED',", + " reason: \"Transfers committed for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + }, + "postRequest": { + "exec": [ + "environment.committedData = response.body;" + ] + } + } + }, + { + "id": 16, + "description": "Check balances for Payer account after commit settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payer position account balance should reset to value before transfer", + "exec": [ + "expect(Number(environment.fxPayerPositionAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxPayerPositionAccountBalanceBeforeTransfer))" + ] + }, + { + "id": 2, + "description": "Payer settlement account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerSettlementAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxPayerSettlementAccountBalanceAfterReserveSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerPositionAccountBalanceAfterCommitSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerSettlementAccountBalanceAfterCommitSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 17, + "description": "Check balances for FXP after commit settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "FXP Source currency position account balance should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterReserveSettlement))" + ] + }, + { + "id": 2, + "description": "FXP Source currency settlement account value should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterReserveSettlement))" + ] + }, + { + "id": 3, + "description": "FXP Target currency position account value should be reset to value before transfer", + "exec": [ + "expect(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxpTargetCurrencyPositionAccountBalanceBeforeTransfer))" + ] + }, + { + "id": 4, + "description": "FXP Target currency settlement account value should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterReserveSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + "})", + "", + "" + ] + } + } + }, + { + "id": 18, + "description": "Check balances for Payee after commit settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payee position account balance should not change", + "exec": [ + "expect(Number(environment.fxPayeePositionAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxPayeePositionAccountBalanceAfterReserveSettlement))" + ] + }, + { + "id": 2, + "description": "Payee settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxPayeeSettlementAccountBalanceAfterCommitSettlement)).to.equal(Number(environment.fxPayeeSettlementAccountBalanceAfterReserveSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceAfterCommitSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeePositionAccountBalanceAfterCommitSettlement}`);", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeeSettlementAccountBalanceAfterCommitSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 19, + "meta": { + "info": "Settle Settlement" + }, + "description": "Settle Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is SETTLED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('SETTLED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is SETTLED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('SETTLED')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is SETTLED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('SETTLED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.committedData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PS_TRANSFERS_COMMITTED\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'SETTLED',", + " reason: \"Transfers settled for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + } + } + }, + { + "id": 20, + "description": "Check balances for Payer account after settle settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payer position account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerPositionAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxPayerPositionAccountBalanceAfterCommitSettlement))" + ] + }, + { + "id": 2, + "description": "Payer settlement account balance should not be changed", + "exec": [ + "expect(Number(environment.fxPayerSettlementAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxPayerSettlementAccountBalanceAfterCommitSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerPositionAccountBalanceAfterSettleSettlement}`);", + "console.log(`Payer Position Balance after Create Settlement=${environment.fxPayerSettlementAccountBalanceAfterSettleSettlement}`);", + "", + "" + ] + } + } + }, + { + "id": 21, + "description": "Check balances for FXP after commit settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "FXP Source currency position account balance should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxpSourceCurrencyPositionAccountBalanceAfterCommitSettlement))" + ] + }, + { + "id": 2, + "description": "FXP Source currency settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxpSourceCurrencySettlementAccountBalanceAfterCommitSettlement))" + ] + }, + { + "id": 3, + "description": "FXP Target currency position account balance should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxpTargetCurrencyPositionAccountBalanceAfterCommitSettlement))" + ] + }, + { + "id": 4, + "description": "FXP Target currency settlement account balance should not change", + "exec": [ + "expect(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxpTargetCurrencySettlementAccountBalanceAfterCommitSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + "})", + "", + "" + ] + } + } + }, + { + "id": 22, + "description": "Check balances for Payee after commit settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin", + "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "scriptingEngine": "javascript", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Payee position account balance should not change", + "exec": [ + "expect(Number(environment.fxPayeePositionAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxPayeePositionAccountBalanceAfterCommitSettlement))" + ] + }, + { + "id": 2, + "description": "Payee position should be changed", + "exec": [ + "expect(Number(environment.fxPayeeSettlementAccountBalanceAfterSettleSettlement)).to.equal(Number(environment.fxPayeeSettlementAccountBalanceAfterCommitSettlement))" + ] + } + ] + }, + "disabled": false, + "scripts": { + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceAfterSettleSettlement= curAccount.value", + " }", + "})", + "", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeePositionAccountBalanceAfterSettleSettlement}`);", + "console.log(`Payee Position Balance after prepare settlement=${environment.fxPayeeSettlementAccountBalanceAfterSettleSettlement}`);", + "", + "" + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/collections/hub/golden_path/fx/feature_tests/settlement_fx/negative_scenarios.json b/collections/hub/golden_path/fx/feature_tests/settlement_fx/negative_scenarios.json new file mode 100644 index 00000000..ffa5dbd2 --- /dev/null +++ b/collections/hub/golden_path/fx/feature_tests/settlement_fx/negative_scenarios.json @@ -0,0 +1,1976 @@ +{ + "options": {}, + "name": "negative_scenarios", + "saveReport": true, + "test_cases": [ + { + "id": 1, + "name": "Store settlement and position balances before fx transfer and normal transfer", + "meta": { + "info": "Store settlement and position balances before fx transfer and normal transfer" + }, + "fileInfo": { + "path": "negatice_scenarios.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "store balances for fxp" + }, + "description": "store balances for fxp", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "" + ] + }, + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "", + "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer= curAccount.value;", + " environment.fxpSourceCurrencyPositionAccountBalanceBeforeTransfer= curAccount.value;", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer= curAccount.value;", + " environment.fxpSourceCurrencySettlementAccountBalanceBeforeTransfer= curAccount.value;", + " }", + "})", + "", + "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxpTargetCurrencyPositionAccountBalanceBeforeTransfer= curAccount.value", + " }", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxpTargetCurrencySettlementAccountBalanceBeforeTransfer= curAccount.value", + " environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer= curAccount.value", + " }", + "})", + "", + "", + "console.log(`environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer: ${environment.fxpSourceCurrencySettlementAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer: ${environment.fxpSourceCurrencyPositionAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer: ${environment.fxpTargetCurrencySettlementAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer: ${environment.fxpTargetCurrencyPositionAccountBalanceBeforeFxTransfer}`);", + "console.log(`environment.fxpSourceCurrencySettlementAccountBalanceBeforeTransfer: ${environment.fxpSourceCurrencySettlementAccountBalanceBeforeTransfer}`);", + "console.log(`environment.fxpSourceCurrencyPositionAccountBalanceBeforeTransfer: ${environment.fxpSourceCurrencyPositionAccountBalanceBeforeTransfer}`);", + "console.log(`environment.fxpTargetCurrencySettlementAccountBalanceBeforeTransfer: ${environment.fxpTargetCurrencySettlementAccountBalanceBeforeTransfer}`);", + "console.log(`environment.fxpTargetCurrencyPositionAccountBalanceBeforeTransfer: ${environment.fxpTargetCurrencyPositionAccountBalanceBeforeTransfer}`);" + ] + } + } + }, + { + "id": 2, + "meta": { + "info": "store balances for fx payer" + }, + "description": "store balances for fx payer", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYER_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "" + ] + }, + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "", + " res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", + " ", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayerSettlementAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayerSettlementAccountBalanceBeforeTransfer= curAccount.value", + " }", + " ", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayerPositionAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayerPositionAccountBalanceBeforeTransfer= curAccount.value", + " } ", + "", + "", + "})", + "//})", + "", + "", + "console.log(environment.fxPayerSettlementAccountBalanceBeforeTransfer);", + "console.log(environment.fxPayerPositionAccountBalanceBeforeTransfer);" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "store balances for fx payee" + }, + "description": "store balances for fx payee", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 1, + "type": "central_admin" + }, + "operationPath": "/participants/{name}/accounts", + "path": "/participants/{$inputs.FX_PAYEE_DFSP_ID}/accounts", + "method": "get", + "params": { + "name": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_CENTRAL_LEDGER}", + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code is 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + } + ] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "scriptingEngine": "javascript", + "scripts": { + "preRequest": { + "exec": [ + "" + ] + }, + "postRequest": { + "exec": [ + "var res = response.body;", + "", + "", + " res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", + " ", + " if(curAccount.ledgerAccountType === \"SETTLEMENT\") {", + " environment.fxPayeeSettlementAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayeeSettlementAccountBalanceBeforeTransfer= curAccount.value", + " }", + " ", + " if(curAccount.ledgerAccountType === \"POSITION\") {", + " environment.fxPayeePositionAccountBalanceBeforeFxTransfer= curAccount.value", + " environment.fxPayeePositionAccountBalanceBeforeTransfer= curAccount.value", + " } ", + "", + "", + "})", + "//})", + "", + " ", + "console.log(environment.fxPayeeSettlementAccountBalanceBeforeTransfer);", + "console.log(environment.fxPayeePositionAccountBalanceBeforeTransfer);" + ] + } + } + } + ] + }, + { + "id": 2, + "name": "FX E2E with 2 sets of transfers", + "fileInfo": { + "path": "negative_scenarios.json" + }, + "meta": { + "info": "FX Transfer" + }, + "breakOnError": false, + "requests": [ + { + "id": 1, + "description": "Add Participant to ALS", + "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": "/participants/{Type}/{ID}", + "path": "/participants/{$inputs.toIdType}/{$inputs.FX_MSISDN_1}", + "method": "post", + "params": { + "Type": "{$inputs.toIdType}", + "ID": "{$inputs.FX_MSISDN_1}" + }, + "body": { + "fspId": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "headers": { + "FSPIOP-Source": "{$inputs.FX_PAYEE_DFSP_ID}", + "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", + "Accept": "{$inputs.acceptParticipants}", + "Content-Type": "{$inputs.contentTypeParticipants}", + "Date": "{$function.generic.curDate}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + } + ] + }, + "disabled": false + }, + { + "id": 2, + "description": "Get party info", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "additionalApi": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/parties/{Type}/{ID}", + "path": "/parties/MSISDN/{$inputs.FX_MSISDN_1}", + "method": "get", + "params": { + "Type": "MSISDN", + "ID": "{$inputs.FX_MSISDN_1}" + }, + "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", + "headers": { + "Content-Type": "{$inputs.contentTypeParties}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "Accept": "{$inputs.acceptParties}" + }, + "disabled": false, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 202", + "exec": [ + "expect(response.status).to.equal(202)" + ] + }, + { + "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": 6, + "description": "Callback FSPIOP-Destination same as request FSPIOP-Source", + "exec": [ + "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" + ] + }, + { + "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.FX_MSISDN_1}')" + ] + } + ] + } + }, + { + "id": 3, + "description": "First POST /fxQuotes", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxQuotes", + "path": "/fxQuotes", + "method": "post", + "body": { + "conversionRequestId": "{$function.generic.generateUUID}", + "conversionTerms": { + "conversionId": "{$function.generic.generateUUID}", + "determiningTransferId": "{$function.generic.generateUUID}", + "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", + "amountType": "SEND", + "sourceAmount": { + "currency": "{$inputs.FX_SOURCE_CURRENCY}", + "amount": "{$inputs.FX_SOURCE_AMOUNT}" + }, + "targetAmount": { + "currency": "{$inputs.FX_TARGET_CURRENCY}" + }, + "expiration": "{$inputs.FX_EXPIRATION}" + } + }, + "headers": { + "Accept": "{$inputs.acceptFxQuotes}", + "Content-Type": "{$inputs.contentTypeFxQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "disabled": false, + "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 conversionTerms", + "exec": [ + "expect(callback.body).to.have.property('conversionTerms')" + ] + }, + { + "id": 6, + "description": "Callback sourceAmount (amount & currency) to match the request", + "exec": [ + "expect(callback.body.conversionTerms.sourceAmount.currency).to.equal('{$request.body.conversionTerms.sourceAmount.currency}')", + "request.body.conversionTerms.sourceAmount.amount && expect(callback.body.conversionTerms.sourceAmount.amount).to.equal('{$request.body.conversionTerms.sourceAmount.amount}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be fxQuotes", + "exec": [ + "expect(callback.headers['content-type']).to.have.string('application/vnd.interoperability.fxQuotes+json')" + ] + }, + { + "id": 16, + "description": "Callback body should contain condition", + "exec": [ + "expect(callback.body).to.have.property('condition')" + ] + }, + { + "id": 17, + "description": "Callback body should contain target amount", + "exec": [ + "expect(callback.body.conversionTerms.targetAmount).to.have.property('amount')" + ] + }, + { + "id": 18, + "description": "Callback transferAmount (amount & currency)to match the request Copy", + "exec": [ + "expect(callback.body.conversionTerms.sourceAmount.currency).to.equal('{$request.body.conversionTerms.sourceAmount.currency}')", + "expect(callback.body.conversionTerms.targetAmount.currency).to.equal('{$request.body.conversionTerms.targetAmount.currency}')" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "var res = callback.body;", + "", + "console.log('targetAmount:',res.conversionTerms.targetAmount.amount);", + "environment.FX_TARGET_AMOUNT= res.conversionTerms.targetAmount.amount;" + ] + } + } + }, + { + "id": 4, + "description": "First POST /quotes", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/quotes", + "path": "/quotes", + "method": "post", + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "headers": { + "Accept": "{$inputs.acceptQuotes}", + "Content-Type": "{$inputs.contentTypeQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "body": { + "quoteId": "{$function.generic.generateUUID}", + "transactionId": "{$prev.3.request.body.conversionTerms.determiningTransferId}", + "payer": { + "partyIdInfo": { + "partyIdType": "{$inputs.fromIdType}", + "partyIdentifier": "{$inputs.fromIdValue}", + "fspId": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "personalInfo": { + "complexName": { + "firstName": "{$inputs.fromFirstName}", + "lastName": "{$inputs.fromLastName}" + }, + "dateOfBirth": "{$inputs.fromDOB}" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "{$prev.2.callback.body.party.partyIdInfo.partyIdType}", + "partyIdentifier": "{$prev.2.callback.body.party.partyIdInfo.partyIdentifier}", + "fspId": "{$prev.2.callback.body.party.partyIdInfo.fspId}" + } + }, + "amountType": "SEND", + "amount": { + "amount": "{$prev.3.callback.body.conversionTerms.targetAmount.amount}", + "currency": "{$prev.3.callback.body.conversionTerms.targetAmount.currency}" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "{$inputs.note}" + }, + "disabled": false, + "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": 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": 5, + "description": "First POST /fxTransfers", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxTransfers", + "path": "/fxTransfers", + "method": "post", + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptFxTransfers}", + "Content-Type": "{$inputs.contentTypeFxTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_TESTFXP1_ID}" + }, + "body": { + "commitRequestId": "{$prev.3.callback.body.conversionTerms.conversionId}", + "determiningTransferId": "{$prev.3.request.body.conversionTerms.determiningTransferId}", + "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", + "amountType": "SEND", + "sourceAmount": { + "amount": "{$prev.3.callback.body.conversionTerms.sourceAmount.amount}", + "currency": "{$prev.3.callback.body.conversionTerms.sourceAmount.currency}" + }, + "targetAmount": { + "amount": "{$prev.3.callback.body.conversionTerms.targetAmount.amount}", + "currency": "{$prev.3.callback.body.conversionTerms.targetAmount.currency}" + }, + "condition": "{$prev.3.callback.body.condition}", + "expiration": "{$requestVariables.expiration}" + }, + "scriptingEngine": "javascript", + "disabled": false, + "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 length not zero", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" + ] + } + } + }, + { + "id": 6, + "description": "First POST /transfer that should pass", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/transfers", + "path": "/transfers", + "method": "post", + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "body": { + "transferId": "{$prev.3.request.body.conversionTerms.determiningTransferId}", + "payeeFsp": "{$inputs.FX_PAYEE_DFSP_ID}", + "payerFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "amount": { + "currency": "{$prev.4.callback.body.transferAmount.currency}", + "amount": "{$prev.4.callback.body.transferAmount.amount}" + }, + "ilpPacket": "{$prev.4.callback.body.ilpPacket}", + "condition": "{$prev.4.callback.body.condition}", + "expiration": "{$prev.4.callback.body.expiration}" + }, + "headers": { + "Accept": "{$inputs.acceptTransfers}", + "Content-Type": "{$inputs.contentTypeTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "disabled": false, + "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": 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}')" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" + ] + } + } + }, + { + "id": 7, + "description": "Second POST /fxQuotes", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxQuotes", + "path": "/fxQuotes", + "method": "post", + "body": { + "conversionRequestId": "{$function.generic.generateUUID}", + "conversionTerms": { + "conversionId": "{$function.generic.generateUUID}", + "determiningTransferId": "{$function.generic.generateUUID}", + "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", + "amountType": "SEND", + "sourceAmount": { + "currency": "{$inputs.FX_SOURCE_CURRENCY}", + "amount": "5255" + }, + "targetAmount": { + "currency": "{$inputs.FX_TARGET_CURRENCY}" + }, + "expiration": "{$inputs.FX_EXPIRATION}" + } + }, + "headers": { + "Accept": "{$inputs.acceptFxQuotes}", + "Content-Type": "{$inputs.contentTypeFxQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_TESTFXP1_ID}" + }, + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "disabled": false, + "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 conversionTerms", + "exec": [ + "expect(callback.body).to.have.property('conversionTerms')" + ] + }, + { + "id": 6, + "description": "Callback sourceAmount (amount & currency) to match the request", + "exec": [ + "expect(callback.body.conversionTerms.sourceAmount.currency).to.equal('{$request.body.conversionTerms.sourceAmount.currency}')", + "request.body.conversionTerms.sourceAmount.amount && expect(callback.body.conversionTerms.sourceAmount.amount).to.equal('{$request.body.conversionTerms.sourceAmount.amount}')" + ] + }, + { + "id": 7, + "description": "Callback content-type to be fxQuotes", + "exec": [ + "expect(callback.headers['content-type']).to.have.string('application/vnd.interoperability.fxQuotes+json')" + ] + }, + { + "id": 16, + "description": "Callback body should contain condition", + "exec": [ + "expect(callback.body).to.have.property('condition')" + ] + }, + { + "id": 17, + "description": "Callback body should contain target amount", + "exec": [ + "expect(callback.body.conversionTerms.targetAmount).to.have.property('amount')" + ] + }, + { + "id": 18, + "description": "Callback transferAmount (amount & currency)to match the request Copy", + "exec": [ + "expect(callback.body.conversionTerms.sourceAmount.currency).to.equal('{$request.body.conversionTerms.sourceAmount.currency}')", + "expect(callback.body.conversionTerms.targetAmount.currency).to.equal('{$request.body.conversionTerms.targetAmount.currency}')" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "var res = callback.body;", + "", + "console.log('targetAmount:',res.conversionTerms.targetAmount.amount);", + "environment.FX_TARGET_AMOUNT= res.conversionTerms.targetAmount.amount;" + ] + } + } + }, + { + "id": 8, + "description": "Second POST /quotes", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/quotes", + "path": "/quotes", + "method": "post", + "url": "{$inputs.HOST_QUOTING_SERVICE}", + "headers": { + "Accept": "{$inputs.acceptQuotes}", + "Content-Type": "{$inputs.contentTypeQuotes}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "body": { + "quoteId": "{$function.generic.generateUUID}", + "transactionId": "{$prev.7.request.body.conversionTerms.determiningTransferId}", + "payer": { + "partyIdInfo": { + "partyIdType": "{$inputs.fromIdType}", + "partyIdentifier": "{$inputs.fromIdValue}", + "fspId": "{$inputs.FX_PAYER_DFSP_ID}" + }, + "personalInfo": { + "complexName": { + "firstName": "{$inputs.fromFirstName}", + "lastName": "{$inputs.fromLastName}" + }, + "dateOfBirth": "{$inputs.fromDOB}" + } + }, + "payee": { + "partyIdInfo": { + "partyIdType": "{$prev.2.callback.body.party.partyIdInfo.partyIdType}", + "partyIdentifier": "{$prev.2.callback.body.party.partyIdInfo.partyIdentifier}", + "fspId": "{$prev.2.callback.body.party.partyIdInfo.fspId}" + } + }, + "amountType": "SEND", + "amount": { + "amount": "{$prev.7.callback.body.conversionTerms.targetAmount.amount}", + "currency": "{$prev.7.callback.body.conversionTerms.targetAmount.currency}" + }, + "transactionType": { + "scenario": "TRANSFER", + "initiator": "PAYER", + "initiatorType": "CONSUMER" + }, + "note": "{$inputs.note}" + }, + "disabled": false, + "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": 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": 9, + "description": "Second POST /fxTransfers", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/fxTransfers", + "path": "/fxTransfers", + "method": "post", + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "headers": { + "Accept": "{$inputs.acceptFxTransfers}", + "Content-Type": "{$inputs.contentTypeFxTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_TESTFXP1_ID}" + }, + "body": { + "commitRequestId": "{$prev.7.callback.body.conversionTerms.conversionId}", + "determiningTransferId": "{$prev.7.request.body.conversionTerms.determiningTransferId}", + "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", + "amountType": "SEND", + "sourceAmount": { + "amount": "{$prev.7.callback.body.conversionTerms.sourceAmount.amount}", + "currency": "{$prev.7.callback.body.conversionTerms.sourceAmount.currency}" + }, + "targetAmount": { + "amount": "{$prev.7.callback.body.conversionTerms.targetAmount.amount}", + "currency": "{$prev.7.callback.body.conversionTerms.targetAmount.currency}" + }, + "condition": "{$prev.7.callback.body.condition}", + "expiration": "{$requestVariables.expiration}" + }, + "scriptingEngine": "javascript", + "disabled": false, + "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 length not zero", + "exec": [ + "expect(callback.headers['Content-Length']).to.not.equal('0')" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" + ] + } + } + }, + { + "id": 10, + "description": "Second POST /transfer that should fail", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "operationPath": "/transfers", + "path": "/transfers", + "method": "post", + "url": "{$inputs.HOST_ML_API_ADAPTER}", + "body": { + "transferId": "{$prev.7.request.body.conversionTerms.determiningTransferId}", + "payeeFsp": "{$inputs.FX_PAYEE_DFSP_ID}", + "payerFsp": "{$inputs.FX_PAYER_DFSP_ID}", + "amount": { + "currency": "{$prev.8.callback.body.transferAmount.currency}", + "amount": "{$prev.8.callback.body.transferAmount.amount}" + }, + "ilpPacket": "{$prev.8.callback.body.ilpPacket}", + "condition": "{$prev.8.callback.body.condition}", + "expiration": "{$prev.8.callback.body.expiration}" + }, + "headers": { + "Accept": "{$inputs.acceptTransfers}", + "Content-Type": "{$inputs.contentTypeTransfers}", + "Date": "{$function.generic.curDate}", + "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", + "FSPIOP-Destination": "{$inputs.FX_PAYEE_DFSP_ID}" + }, + "disabled": false, + "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 transfer errorCode should be 3100", + "exec": [ + "expect(callback.body.errorInformation.errorCode).to.equal('3100')" + ] + } + ] + }, + "scripts": { + "preRequest": { + "exec": [ + "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" + ] + } + } + } + ] + }, + { + "id": 3, + "name": "Create Settlement and check balances at different stages", + "meta": { + "info": "Create Settlement and check balances at different stages" + }, + "fileInfo": { + "path": "happy_path.json" + }, + "requests": [ + { + "id": 1, + "meta": { + "info": "Get Existing Open Window" + }, + "description": "Get Existing Open Window", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlementWindows", + "path": "/settlementWindows", + "method": "get", + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "queryParams": { + "state": "OPEN" + }, + "headers": { + "Content-Type": "application/json", + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response status to be 200", + "exec": [ + "expect(response.status).to.equal(200)" + ] + }, + { + "id": 2, + "description": "State should be OPEN", + "exec": [ + "expect(environment.openWindowstate).to.equal(\"OPEN\")" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = response.body;", + "//console.log(jsonData.state);", + "", + "environment.openWindowID=jsonData[0].settlementWindowId;", + "environment.openWindowstate=jsonData[0].state;", + "", + "console.log(environment.openWindowID);" + ] + } + } + }, + { + "id": 2, + "meta": { + "info": "Close current open window" + }, + "description": "Close existent window", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlementWindows/{id}", + "path": "/settlementWindows/{$environment.openWindowID}", + "method": "post", + "params": { + "id": "{$environment.openWindowID}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "state": "CLOSED", + "reason": "string" + }, + "headers": { + "Content-Type": "application/json", + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200 or 400", + "exec": [ + "if(response.status === 400){", + " expect(response.status).to.equal(400)", + "}", + "else{", + " expect(response.status).to.equal(200)", + "}", + "", + "" + ] + }, + { + "id": 2, + "description": "New window State should be OPEN", + "exec": [ + "", + " if (response.status === 400) {", + " ", + "expect(response.body.errorInformation.errorCode).to.eql('3100');", + "expect(response.body.errorInformation.errorDescription).to.eql('Generic validation error - Window ' + environment.openWindowID + ' is empty');", + "}else{", + " ", + " ", + " expect(environment.openWindowstate).to.equal(\"OPEN\");", + "}", + "", + "", + "" + ] + } + ] + }, + "scriptingEngine": "javascript", + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = response.body;", + "var rcode = Number(response.status);", + "//console.log(rcode);", + "", + "//if (rcode == 200){", + "environment.closedWindowID= Number(environment.openWindowID);", + "environment.openWindowstate=jsonData.state;", + "", + "console.log(environment.openWindowstate);", + "console.log(environment.closedWindowID);", + "//}" + ] + } + } + }, + { + "id": 3, + "meta": { + "info": "Create Settlement for Closed Window" + }, + "description": "Create Settlement for Closed Window", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements", + "path": "/settlements", + "method": "post", + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "headers": { + "Content-Type": "application/json", + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "body": { + "settlementModel": "DEFAULTDEFERREDNET", + "reason": "TESTING", + "settlementWindows": [ + { + "id": "{$requestVariables.closedWindowID}" + } + ] + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Status code is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Settlement State should be PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(environment.winstate).to.equal(\"PENDING_SETTLEMENT\")", + "}" + ] + }, + { + "id": 3, + "description": "Number of associated windows should be 1", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows.length).to.equal(1)", + "}" + ] + }, + { + "id": 4, + "description": "Associated Settlement Window ID is the correct one", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].id).to.equal(environment.closedWindowID)", + "}" + ] + }, + { + "id": 5, + "description": "Associated Settlement Window state should be PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal(\"PENDING_SETTLEMENT\")", + "}" + ] + }, + { + "id": 6, + "description": "Total source currency net settlement amount in the Settlement should be 0", + "exec": [ + "expect(environment.totalSourceCurrencyNetSettlementAmount).to.equal(0)" + ] + }, + { + "id": 7, + "description": "Total target currency net settlement amount in the Settlement should be 0", + "exec": [ + "expect(environment.totalTargetCurrencyNetSettlementAmount).to.equal(0)" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "scripts": { + "postRequest": { + "exec": [ + "var jsonData = response.body;", + "environment.settlementData = jsonData", + "environment.settlementId = jsonData.id;", + "environment.winstate = jsonData.state;", + "", + "if (response.body.errorInformation?.errorCode === \"3100\"){", + " ", + " environment.WINDOWISEMPTY = true;", + " console.log(\"Window is empty\");", + "}else{", + " environment.WINDOWISEMPTY = false;", + "}", + "", + "var totalSourceCurrencyNetSettlementAmount = 0;", + "var totalTargetCurrencyNetSettlementAmount = 0;", + "jsonData.participants.forEach(participant => {", + " participant.accounts.forEach( account => {", + " if(account.netSettlementAmount.currency == environment.FX_SOURCE_CURRENCY) {", + " totalSourceCurrencyNetSettlementAmount += Number(account.netSettlementAmount.amount)", + " console.log('totalSourceCurrencyNetSettlementAmount: ',totalSourceCurrencyNetSettlementAmount)", + " } else if(account.netSettlementAmount.currency == environment.FX_TARGET_CURRENCY) {", + " totalTargetCurrencyNetSettlementAmount += Number(account.netSettlementAmount.amount)", + " console.log('totalTargetCurrencyNetSettlementAmount: ',totalTargetCurrencyNetSettlementAmount)", + " }", + " })", + "})", + "", + "", + "environment.totalSourceCurrencyNetSettlementAmount = totalSourceCurrencyNetSettlementAmount", + "environment.totalTargetCurrencyNetSettlementAmount = totalTargetCurrencyNetSettlementAmount", + "" + ] + }, + "preRequest": { + "exec": [ + "//environment.closedWindowID = 6;", + "requestVariables.closedWindowID = Number(environment.closedWindowID);", + "", + "/*requestVariables.closedWindowID = Number(environment.closedWindowID);", + "*/", + "", + "" + ] + } + } + }, + { + "id": 4, + "meta": { + "info": "Prepare Settlement" + }, + "description": "Prepare Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is PS_TRANSFERS_RECORDED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('PS_TRANSFERS_RECORDED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('PENDING_SETTLEMENT')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is PS_TRANSFERS_RECORDED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('PS_TRANSFERS_RECORDED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.settlementData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PENDING_SETTLEMENT\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'PS_TRANSFERS_RECORDED',", + " reason: \"Transfers recorded for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + }, + "postRequest": { + "exec": [ + "environment.preparedData = response.body;" + ] + } + } + }, + { + "id": 5, + "meta": { + "info": "Reserve Settlement" + }, + "description": "Reserve Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is PS_TRANSFERS_RESERVED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('PS_TRANSFERS_RESERVED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('PENDING_SETTLEMENT')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is PS_TRANSFERS_RESERVED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('PS_TRANSFERS_RESERVED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "disabled": false, + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.preparedData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PS_TRANSFERS_RECORDED\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'PS_TRANSFERS_RESERVED',", + " reason: \"Transfers reserved for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + }, + "postRequest": { + "exec": [ + "environment.reservedData = response.body;" + ] + } + } + }, + { + "id": 6, + "meta": { + "info": "Commit Settlement" + }, + "description": "Commit Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is PS_TRANSFERS_COMMITTED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('PS_TRANSFERS_COMMITTED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is PENDING_SETTLEMENT", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('PENDING_SETTLEMENT')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is PS_TRANSFERS_COMMITTED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('PS_TRANSFERS_COMMITTED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "disabled": false, + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.reservedData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PS_TRANSFERS_RESERVED\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'PS_TRANSFERS_COMMITTED',", + " reason: \"Transfers committed for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + }, + "postRequest": { + "exec": [ + "environment.committedData = response.body;" + ] + } + } + }, + { + "id": 7, + "meta": { + "info": "Settle Settlement" + }, + "description": "Settle Settlement", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "settlements" + }, + "operationPath": "/settlements/{id}", + "path": "/settlements/{$environment.settlementId}", + "method": "put", + "params": { + "id": "{$environment.settlementId}" + }, + "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", + "body": { + "participants": [] + }, + "headers": { + "FSPIOP-Source": "{$inputs.fromFspId}", + "Authorization": "{$inputs.TTK_BEARER_TOKEN}" + }, + "tests": { + "assertions": [ + { + "id": 1, + "description": "Response code status is 200", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.status).to.equal(200)", + "}" + ] + }, + { + "id": 2, + "description": "Overall state is SETTLED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.state).to.equal('SETTLED')", + "}" + ] + }, + { + "id": 3, + "description": "Settlement Window state is SETTLED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + "expect(response.body.settlementWindows[0].state).to.equal('SETTLED')", + "}" + ] + }, + { + "id": 4, + "description": "Participants state is SETTLED", + "exec": [ + "if(environment.WINDOWISEMPTY === false){", + " response.body.participants.forEach(participant => {", + " participant.accounts.forEach(account => {", + " expect(account.state).to.equal('SETTLED')", + " });", + " });", + "}" + ] + } + ] + }, + "scriptingEngine": "javascript", + "delay": "4000", + "scripts": { + "preRequest": { + "exec": [ + "var res = environment.committedData;", + "console.log('settlementId:',environment.settlementId);", + "var i=0;", + "var dfspsacc = [];", + "var callbackpayer;", + "", + "environment.winstate = res.state;", + "if(environment.winstate===\"PS_TRANSFERS_COMMITTED\"){", + "", + "var participants = []", + "res.participants.forEach(function (participant) {", + " let newParticipant = { ", + " id: participant.id,", + " accounts: []", + " }", + " participant.accounts.forEach(curAccount => {", + " newParticipant.accounts.push({", + " id: curAccount.id,", + " state: 'SETTLED',", + " reason: \"Transfers settled for payer\"", + " })", + " i++;", + " })", + " participants.push(newParticipant)", + " })", + " ", + "", + "custom.appendRequestBody({", + " participants: participants", + "})", + "", + "}else{", + " console.log(\"Window is empty\")", + "}" + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/collections/hub/other_tests/settlement_fx/settlement_tests.json b/collections/hub/other_tests/settlement_fx/settlement_tests.json deleted file mode 100644 index e3cb436c..00000000 --- a/collections/hub/other_tests/settlement_fx/settlement_tests.json +++ /dev/null @@ -1,1397 +0,0 @@ -{ - "options": {}, - "name": "collections_tests_fx_fx_tests", - "test_cases": [ - { - "id": 1, - "name": "Settlement FX Transfer tests", - "fileInfo": { - "path": "hub/golden_path/fx/feature_tests/settlement/settlement_tests.json", - "labels": [ - "fx" - ] - }, - "meta": { - "info": "FX Transfer" - }, - "requests": [ - { - "id": 1, - "description": "Add Participant to ALS", - "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": "/participants/{Type}/{ID}", - "path": "/participants/{$inputs.toIdType}/{$inputs.toIdValue}", - "method": "post", - "params": { - "Type": "{$inputs.toIdType}", - "ID": "{$inputs.toIdValue}" - }, - "body": { - "fspId": "{$inputs.payeefsp}" - }, - "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", - "headers": { - "FSPIOP-Source": "{$inputs.toFspId}", - "Authorization": "{$inputs.PAYEE_BEARER_TOKEN}", - "Accept": "{$inputs.acceptParticipants}", - "Content-Type": "{$inputs.contentTypeParticipants}", - "Date": "{$function.generic.curDate}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response status to be 202", - "exec": [ - "expect(response.status).to.equal(202)" - ] - } - ] - } - }, - { - "id": 2, - "description": "Get party info Copy", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "fspiop", - "asynchronous": true, - "additionalApi": true, - "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" - }, - "operationPath": "/parties/{Type}/{ID}", - "path": "/parties/MSISDN/{$inputs.toIdValue}", - "method": "get", - "params": { - "Type": "MSISDN", - "ID": "{$inputs.toIdValue}" - }, - "url": "{$inputs.HOST_ACCOUNT_LOOKUP_SERVICE}", - "headers": { - "Content-Type": "{$inputs.contentType}", - "Date": "{$function.generic.curDate}", - "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", - "Accept": "{$inputs.accept}" - }, - "disabled": false, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response status to be 202", - "exec": [ - "expect(response.status).to.equal(202)" - ] - }, - { - "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": 6, - "description": "Callback FSPIOP-Destination same as request FSPIOP-Source", - "exec": [ - "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" - ] - }, - { - "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": 3, - "description": "GET /services/FXP", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "fspiop", - "asynchronous": true, - "prefix": "/v2", - "additionalApi": true, - "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" - }, - "operationPath": "/services/FXP", - "path": "/services/FXP", - "method": "get", - "url": "{$inputs.HOST_FXP_SERVICES}", - "disabled": false, - "headers": { - "Content-Type": "{$inputs.contentTypeServicesFxp}", - "Date": "{$function.generic.curDate}", - "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", - "Accept": "{$inputs.acceptServicesFxp}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response status to be 202", - "exec": [ - "expect(response.status).to.equal(202)" - ] - }, - { - "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 providers", - "exec": [ - "expect(callback.body).to.have.property('providers')", - "expect(callback.body.providers.length).to.be.at.least(1)" - ] - }, - { - "id": 6, - "description": "Callback FSPIOP-Destination same as request FSPIOP-Source", - "exec": [ - "expect(callback.headers['fspiop-destination']).to.equal('{$request.headers['FSPIOP-Source']}')" - ] - } - ] - } - }, - { - "id": 4, - "description": "POST /fxQuotes", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "fspiop", - "asynchronous": true, - "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" - }, - "operationPath": "/fxQuotes", - "path": "/fxQuotes", - "method": "post", - "body": { - "conversionRequestId": "{$function.generic.generateID}", - "conversionTerms": { - "conversionId": "{$function.generic.generateID}", - "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", - "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", - "amountType": "SEND", - "sourceAmount": { - "currency": "{$inputs.FX_SOURCE_CURRENCY}", - "amount": "{$inputs.FX_SOURCE_AMOUNT}" - }, - "targetAmount": { - "currency": "{$inputs.FX_TARGET_CURRENCY}" - }, - "expiration": "{$inputs.FX_EXPIRATION}" - } - }, - "headers": { - "Accept": "{$inputs.acceptFxQuotes}", - "Content-Type": "{$inputs.contentTypeFxQuotes}", - "Date": "{$function.generic.curDate}", - "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", - "FSPIOP-Destination": "{$inputs.FX_TESTFXP1_ID}" - }, - "url": "{$inputs.HOST_QUOTING_SERVICE}", - "disabled": false, - "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 conversionTerms", - "exec": [ - "expect(callback.body).to.have.property('conversionTerms')" - ] - }, - { - "id": 6, - "description": "Callback transferAmount (amount & currency)to match the request", - "exec": [ - "expect(callback.body.conversionTerms.sourceAmount.currency).to.equal('{$request.body.conversionTerms.sourceAmount.currency}')", - "expect(callback.body.conversionTerms.targetAmount.currency).to.equal('{$request.body.conversionTerms.targetAmount.currency}')" - ] - }, - { - "id": 7, - "description": "Callback content-type to be fxQuotes", - "exec": [ - "expect(callback.headers['content-type']).to.have.string('application/vnd.interoperability.fxQuotes+json')" - ] - }, - { - "id": 16, - "description": "Callback body should contain condition", - "exec": [ - "expect(callback.body).to.have.property('condition')" - ] - }, - { - "id": 17, - "description": "Callback body should contain target amount", - "exec": [ - "expect(callback.body.conversionTerms.targetAmount).to.have.property('amount')" - ] - } - ] - } - }, - { - "id": 5, - "description": "POST /quotes", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "fspiop", - "asynchronous": true, - "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" - }, - "operationPath": "/quotes", - "path": "/quotes", - "method": "post", - "url": "{$inputs.HOST_QUOTING_SERVICE}", - "headers": { - "Accept": "{$inputs.acceptQuotes}", - "Content-Type": "{$inputs.contentTypeQuotes}", - "Date": "{$function.generic.curDate}", - "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}", - "FSPIOP-Destination": "{$inputs.FXP_PAYEE_DFSP_ID}" - }, - "body": { - "quoteId": "{$function.generic.generateID}", - "transactionId": "{$function.generic.generateID}", - "transactionRequestId": "{$function.generic.generateID}", - "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.2.callback.body.party.partyIdInfo.partyIdType}", - "partyIdentifier": "{$prev.2.callback.body.party.partyIdInfo.partyIdentifier}", - "fspId": "{$prev.2.callback.body.party.partyIdInfo.fspId}" - } - }, - "amountType": "SEND", - "amount": { - "amount": "{$inputs.amount}", - "currency": "{$inputs.FX_TARGET_CURRENCY}" - }, - "transactionType": { - "scenario": "TRANSFER", - "initiator": "PAYER", - "initiatorType": "CONSUMER" - }, - "note": "{$inputs.note}" - }, - "disabled": false, - "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": 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": 6, - "description": "Get Accounts for FXP BEFORE fxTransfer", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 1, - "type": "central_admin", - "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" - }, - "operationPath": "/participants/{name}/accounts", - "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", - "method": "get", - "params": { - "name": "{$inputs.FX_TESTFXP1_ID}" - }, - "url": "{$inputs.HOST_CENTRAL_LEDGER}", - "scriptingEngine": "javascript", - "tests": { - "assertions": [] - }, - "disabled": false, - "scripts": { - "postRequest": { - "exec": [ - "var res = response.body;", - "", - "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", - " if(curAccount.ledgerAccountType === \"POSITION\") {", - " environment.fxpSourceCurrencyPositionBalanceBeforeFxTransfer= curAccount.value", - " }", - "})", - "", - "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", - " if(curAccount.ledgerAccountType === \"POSITION\") {", - " environment.fxpTargetCurrencyPositionBalanceBeforeFxTransfer= curAccount.value", - " }", - "})", - "", - "console.log(`FXP Source Currency Position Balance before FxTransfer=${environment.fxpSourceCurrencyPositionBalanceBeforeFxTransfer}`);", - "", - "console.log(`FXP Target Currency Position Balance before FxTransfer=${environment.fxpTargetCurrencyPositionBalanceBeforeFxTransfer}`);" - ] - } - } - }, - { - "id": 7, - "description": "POST /fxTransfers", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "fspiop", - "asynchronous": true, - "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" - }, - "operationPath": "/fxTransfers", - "path": "/fxTransfers", - "method": "post", - "url": "{$inputs.HOST_ML_API_ADAPTER}", - "headers": { - "Accept": "{$inputs.acceptFxTransfers}", - "Content-Type": "{$inputs.contentTypeFxTransfers}", - "Date": "{$function.generic.curDate}", - "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}" - }, - "body": { - "commitRequestId": "{$prev.4.callback.body.conversionTerms.conversionId}", - "determiningTransferId": "{$function.generic.generateID}", - "initiatingFsp": "{$inputs.FX_PAYER_DFSP_ID}", - "counterPartyFsp": "{$inputs.FX_TESTFXP1_ID}", - "amountType": "SEND", - "sourceAmount": { - "currency": "{$inputs.FX_SOURCE_CURRENCY}", - "amount": "{$inputs.FX_SOURCE_AMOUNT}" - }, - "targetAmount": { - "currency": "{$inputs.FX_TARGET_CURRENCY}", - "amount": "{$inputs.FX_TARGET_AMOUNT}" - }, - "condition": "{$prev.4.callback.body.condition}", - "expiration": "{$requestVariables.expiration}" - }, - "scriptingEngine": "javascript", - "disabled": false, - "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 conversionState to be RESERVED", - "exec": [ - "expect(callback.body.conversionState).to.equal('RESERVED')" - ] - }, - { - "id": 6, - "description": "Callback content-type to be fxTransfers", - "exec": [ - "expect(callback.headers['content-type']).to.have.string('application/vnd.interoperability.fxTransfers+json')" - ] - }, - { - "id": 8, - "description": "Callback body should contain fulfilment", - "exec": [ - "expect(callback.body).to.have.property('fulfilment')" - ] - }, - { - "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}')" - ] - } - ] - }, - "scripts": { - "preRequest": { - "exec": [ - "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" - ] - } - } - }, - { - "id": 8, - "description": "POST /transfer", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "fspiop", - "asynchronous": true, - "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" - }, - "operationPath": "/transfers", - "path": "/transfers", - "method": "post", - "url": "{$inputs.HOST_ML_API_ADAPTER}", - "body": { - "transferId": "{$prev.6.request.body.determiningTransferId}", - "payeeFsp": "{$inputs.FXP_PAYEE_DFSP_ID}", - "payerFsp": "{$inputs.FX_PAYER_DFSP_ID}", - "amount": { - "currency": "{$inputs.FX_TARGET_CURRENCY}", - "amount": "{$inputs.amount}" - }, - "ilpPacket": "{$prev.5.callback.body.ilpPacket}", - "condition": "{$prev.5.callback.body.condition}", - "expiration": "{$requestVariables.expiration}" - }, - "headers": { - "Accept": "{$inputs.acceptTransfers}", - "Content-Type": "{$inputs.contentTypeTransfers}", - "Date": "{$function.generic.curDate}", - "FSPIOP-Source": "{$inputs.FX_PAYER_DFSP_ID}" - }, - "disabled": false, - "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": 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}')" - ] - } - ] - }, - "scripts": { - "preRequest": { - "exec": [ - "requestVariables.expiration =new Date(new Date().getTime() + 24 * 60 * 60 * 1000).toISOString()" - ] - } - } - }, - { - "id": 9, - "description": "Get Accounts for FXP AFTER Transfer", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 1, - "type": "central_admin", - "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" - }, - "operationPath": "/participants/{name}/accounts", - "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", - "method": "get", - "params": { - "name": "{$inputs.FX_TESTFXP1_ID}" - }, - "url": "{$inputs.HOST_CENTRAL_LEDGER}", - "scriptingEngine": "javascript", - "tests": { - "assertions": [] - }, - "disabled": false, - "scripts": { - "postRequest": { - "exec": [ - "var res = response.body;", - "", - "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", - " if(curAccount.ledgerAccountType === \"POSITION\") {", - " environment.fxpSourceCurrencyPositionBalanceAfterTransfer= curAccount.value", - " }", - "})", - "", - "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", - " if(curAccount.ledgerAccountType === \"POSITION\") {", - " environment.fxpTargetCurrencyPositionBalanceAfterTransfer= curAccount.value", - " }", - "})", - "", - "console.log(`FXP Source Currency Position Balance after Transfer=${environment.fxpSourceCurrencyPositionBalanceAfterTransfer}`);", - "", - "console.log(`FXP Target Currency Position Balance after Transfer=${environment.fxpTargetCurrencyPositionBalanceAfterTransfer}`);" - ] - } - } - } - ] - }, - { - "id": 2, - "name": "Create Settlement on the current open window", - "meta": { - "info": "Get current open window and close it" - }, - "requests": [ - { - "id": 1, - "meta": { - "info": "Get Existing Open Window" - }, - "description": "Get Existing Open Window", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlementWindows", - "path": "/settlementWindows", - "method": "get", - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "queryParams": { - "state": "OPEN" - }, - "headers": { - "Content-Type": "application/json", - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response status to be 200", - "exec": [ - "expect(response.status).to.equal(200)" - ] - }, - { - "id": 2, - "description": "State should be OPEN", - "exec": [ - "expect(environment.openWindowstate).to.equal(\"OPEN\")" - ] - } - ] - }, - "scriptingEngine": "javascript", - "scripts": { - "postRequest": { - "exec": [ - "var jsonData = response.body;", - "//console.log(jsonData.state);", - "", - "environment.openWindowID=jsonData[0].settlementWindowId;", - "environment.openWindowstate=jsonData[0].state;", - "", - "console.log(environment.openWindowID);" - ] - } - } - }, - { - "id": 2, - "meta": { - "info": "Close existent window" - }, - "description": "Close existent window", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlementWindows/{id}", - "path": "/settlementWindows/{$environment.openWindowID}", - "method": "post", - "params": { - "id": "{$environment.openWindowID}" - }, - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "body": { - "state": "CLOSED", - "reason": "string" - }, - "headers": { - "Content-Type": "application/json", - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Status code is 200 or 400", - "exec": [ - "if(response.status === 400){", - " expect(response.status).to.equal(400)", - "}", - "else{", - " expect(response.status).to.equal(200)", - "}", - "", - "" - ] - }, - { - "id": 2, - "description": "New window State should be OPEN", - "exec": [ - "", - " if (response.status === 400) {", - " ", - "expect(response.body.errorInformation.errorCode).to.eql('3100');", - "expect(response.body.errorInformation.errorDescription).to.eql('Generic validation error - Window ' + environment.openWindowID + ' is empty');", - "}else{", - " ", - " ", - " expect(environment.openWindowstate).to.equal(\"OPEN\");", - "}", - "", - "", - "" - ] - } - ] - }, - "scriptingEngine": "javascript", - "scripts": { - "postRequest": { - "exec": [ - "var jsonData = response.body;", - "var rcode = Number(response.status);", - "//console.log(rcode);", - "", - "//if (rcode == 200){", - "environment.closedWindowID= Number(environment.openWindowID);", - "environment.openWindowstate=jsonData.state;", - "", - "console.log(environment.openWindowstate);", - "console.log(environment.closedWindowID);", - "//}" - ] - } - } - }, - { - "id": 3, - "meta": { - "info": "Create Settlement for Closed Window" - }, - "description": "Create Settlement for Closed Window", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlements", - "path": "/settlements", - "method": "post", - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "headers": { - "Content-Type": "application/json", - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Status code is 200", - "exec": [ - "expect(response.status).to.equal(200)" - ] - }, - { - "id": 2, - "description": "Settlement State should be PENDING_SETTLEMENT", - "exec": [ - "expect(environment.winstate).to.equal(\"PENDING_SETTLEMENT\")" - ] - }, - { - "id": 3, - "description": "Number of associated windows should be 1", - "exec": [ - "expect(response.body.settlementWindows.length).to.equal(1)" - ] - }, - { - "id": 4, - "description": "Associated Settlement Window ID is the correct one", - "exec": [ - "expect(response.body.settlementWindows[0].id).to.equal(environment.closedWindowID)" - ] - }, - { - "id": 5, - "description": "Associated Settlement Window state should be PENDING_SETTLEMENT", - "exec": [ - "expect(response.body.settlementWindows[0].state).to.equal(\"PENDING_SETTLEMENT\")" - ] - } - ] - }, - "scriptingEngine": "javascript", - "body": { - "settlementModel": "DEFERREDNET{$inputs.currency}", - "reason": "TESTING", - "settlementWindows": [ - { - "id": "{$environment.closedWindowID}" - } - ] - }, - "delay": "3000", - "scripts": { - "postRequest": { - "exec": [ - "var jsonData = response.body;", - "environment.settlementId = jsonData.id;", - "environment.winstate = jsonData.state;", - "", - "" - ] - }, - "preRequest": { - "exec": [ - "//environment.closedWindowID = 6;", - "environment.closedWindowID = Number(environment.closedWindowID);", - "", - "/*requestVariables.closedWindowID = Number(environment.closedWindowID);", - "*/" - ] - } - } - } - ], - "fileInfo": { - "path": "hub/golden_path/fx/feature_tests/settlement/settlement_tests.json", - "labels": [ - "fx" - ] - } - }, - { - "id": 11, - "name": "Prepare-settlement", - "meta": { - "info": "Prepare-settlement" - }, - "requests": [ - { - "id": 4, - "meta": { - "info": "Prepare Settlement" - }, - "description": "Prepare Settlement", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlements/{id}", - "path": "/settlements/{$environment.settlementId}", - "method": "get", - "params": { - "id": "{$environment.settlementId}" - }, - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "headers": { - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response code status is 200", - "exec": [ - "expect(response.status).to.equal(200)" - ] - } - ] - }, - "scriptingEngine": "javascript", - "delay": "2500", - "scripts": { - "postRequest": { - "exec": [ - "" - ] - }, - "preRequest": { - "exec": [ - "" - ] - } - } - } - ], - "fileInfo": { - "path": "hub/golden_path/fx/feature_tests/settlement/settlement_tests.json", - "labels": [ - "fx" - ] - } - }, - { - "id": 12, - "name": "reserve-settlement", - "meta": { - "info": "reserve-settlement" - }, - "requests": [ - { - "id": 4, - "meta": { - "info": "reserve Settlement" - }, - "description": "reserve Settlement", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlements/{id}", - "path": "/settlements/{$environment.settlementId}", - "method": "get", - "params": { - "id": "{$environment.settlementId}" - }, - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "headers": { - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response code status is 200", - "exec": [ - "//if(environment.WINDOWISEMPTY === false){", - "expect(response.status).to.equal(200)", - "//}" - ] - } - ] - }, - "scriptingEngine": "javascript", - "delay": "2500", - "scripts": { - "postRequest": { - "exec": [ - "" - ] - }, - "preRequest": { - "exec": [ - "" - ] - } - } - }, - { - "id": 5, - "meta": { - "info": "check state for participants after prepare" - }, - "description": "check state for participants after prepare", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlements/{id}", - "path": "/settlements/{$environment.settlementId}", - "method": "get", - "params": { - "id": "{$environment.settlementId}" - }, - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "headers": { - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "scriptingEngine": "javascript", - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response code status is 200", - "exec": [ - "expect(response.status).to.equal(200)" - ] - }, - { - "id": 2, - "description": "Check status PS_TRANSFERS_RESERVED", - "exec": [ - "expect(response.body.state).to.eql(\"PS_TRANSFERS_RESERVED\");" - ] - }, - { - "id": 3, - "description": "Check status for window is PENDING SETTLEMENT", - "exec": [ - " expect(response.body.settlementWindows[0].state).to.eql(\"PENDING_SETTLEMENT\");" - ] - }, - { - "id": 4, - "description": "Account state is PS_TRANSFERS_RESERVEDfor all accounts", - "exec": [ - "expect(environment.controlvar).to.equal(true)" - ] - } - ] - }, - "scripts": { - "postRequest": { - "exec": [ - "//Boolean isok = false;\r", - "var res = response.body;\r", - "var isok = true;\r", - "\r", - "try{\r", - "res.participants.map(function (participant) {\r", - " participant.accounts.filter(account => account.netSettlementAmount.currency === environment.currency).every(curAccount => {\r", - " if(isok === true){ \r", - " if(curAccount.state === \"PS_TRANSFERS_RESERVED\"){\r", - " isok= true;\r", - " \r", - " \r", - " \r", - " }else{\r", - " isok= false;\r", - " // console.log(isok);\r", - " \r", - " }\r", - " } \r", - " })\r", - "})\r", - "\r", - "}catch(exception){\r", - " console.log(exception);\r", - "}\r", - "\r", - "environment.controlvar = isok;" - ] - } - } - } - ], - "fileInfo": { - "path": "hub/golden_path/fx/feature_tests/settlement/settlement_tests.json", - "labels": [ - "fx" - ] - } - }, - { - "id": 13, - "name": "commit-settlement", - "meta": { - "info": "commit-settlement" - }, - "requests": [ - { - "id": 4, - "meta": { - "info": "commit Settlement" - }, - "description": "commit Settlement", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlements/{id}", - "path": "/settlements/{$environment.settlementId}", - "method": "get", - "params": { - "id": "{$environment.settlementId}" - }, - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "headers": { - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response code status is 200", - "exec": [ - "//if(environment.WINDOWISEMPTY === false){", - "expect(response.status).to.equal(200)", - "//}" - ] - } - ] - }, - "scriptingEngine": "javascript", - "delay": "2500", - "scripts": { - "postRequest": { - "exec": [ - "" - ] - }, - "preRequest": { - "exec": [ - "" - ] - } - } - } - ], - "fileInfo": { - "path": "hub/golden_path/fx/feature_tests/settlement/settlement_tests.json", - "labels": [ - "fx" - ] - } - }, - { - "id": 14, - "name": "settle-settlement", - "meta": { - "info": "settle-settlement" - }, - "requests": [ - { - "id": 4, - "meta": { - "info": "settle Settlement" - }, - "description": "settle Settlement", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 2, - "type": "settlements" - }, - "operationPath": "/settlements/{id}", - "path": "/settlements/{$environment.settlementId}", - "method": "get", - "params": { - "id": "{$environment.settlementId}" - }, - "url": "{$inputs.HOST_CENTRAL_SETTLEMENT}", - "headers": { - "FSPIOP-Source": "{$inputs.fromFspId}", - "Authorization": "{$inputs.TTK_BEARER_TOKEN}" - }, - "tests": { - "assertions": [ - { - "id": 1, - "description": "Response code status is 200", - "exec": [ - "//if(environment.WINDOWISEMPTY === false){", - "expect(response.status).to.equal(200)", - "//}" - ] - } - ] - }, - "scriptingEngine": "javascript", - "delay": "2500", - "scripts": { - "postRequest": { - "exec": [ - "" - ] - }, - "preRequest": { - "exec": [ - "" - ] - } - } - }, - { - "id": 15, - "description": "Get Accounts for FXP AFTER Settlement", - "apiVersion": { - "minorVersion": 0, - "majorVersion": 1, - "type": "central_admin", - "specFile": "spec_files/api_definitions/central_admin_1.0/api_spec.yaml", - "callbackMapFile": "spec_files/api_definitions/central_admin_1.0/callback_map.json", - "responseMapFile": "spec_files/api_definitions/central_admin_1.0/response_map.json", - "jsfRefFile": "spec_files/api_definitions/central_admin_1.0/mockRef.json", - "triggerTemplatesFolder": "spec_files/api_definitions/central_admin_1.0/trigger_templates" - }, - "operationPath": "/participants/{name}/accounts", - "path": "/participants/{$inputs.FX_TESTFXP1_ID}/accounts", - "method": "get", - "params": { - "name": "{$inputs.FX_TESTFXP1_ID}" - }, - "url": "{$inputs.HOST_CENTRAL_LEDGER}", - "scriptingEngine": "javascript", - "tests": { - "assertions": [] - }, - "disabled": false, - "scripts": { - "postRequest": { - "exec": [ - "var res = response.body;", - "", - "res.filter(account => account.currency === environment.FX_SOURCE_CURRENCY).forEach(curAccount => {", - " if(curAccount.ledgerAccountType === \"POSITION\") {", - " environment.fxpSourceCurrencyPositionBalanceAfterSettlement= curAccount.value", - " }", - "})", - "", - "res.filter(account => account.currency === environment.FX_TARGET_CURRENCY).forEach(curAccount => {", - " if(curAccount.ledgerAccountType === \"POSITION\") {", - " environment.fxpTargetCurrencyPositionBalanceAfterSettlement= curAccount.value", - " }", - "})", - "", - "console.log(`FXP Source Currency Position Balance after Settlement=${environment.fxpSourceCurrencyPositionBalanceAfterSettlement}`);", - "", - "console.log(`FXP Target Currency Position Balance after Settlement=${environment.fxpTargetCurrencyPositionBalanceAfterSettlement}`);" - ] - } - } - } - ], - "fileInfo": { - "path": "hub/golden_path/fx/feature_tests/settlement/settlement_tests.json", - "labels": [ - "fx" - ] - } - } - ] -} \ No newline at end of file diff --git a/environments/hub/forex/fxp-env.json b/environments/hub/forex/fxp-env.json index 2c738372..89c69407 100644 --- a/environments/hub/forex/fxp-env.json +++ b/environments/hub/forex/fxp-env.json @@ -1,10 +1,12 @@ { "inputValues": { - "FX_PAYER_DFSP_ID": "testingtoolkitdfsp", - "FX_TESTFXP1_ID": "test-fxp", - "FX_SOURCE_CURRENCY": "EUR", + "FX_PAYER_DFSP_ID": "ttkfxpayer", + "FX_TESTFXP1_ID": "ttkfxp1", + "FX_PAYEE_DFSP_ID": "ttkfxpayee", + "FX_SOURCE_CURRENCY": "XXX", "FX_SOURCE_AMOUNT": "10", - "FX_TARGET_CURRENCY": "EUR", + "FX_TARGET_CURRENCY": "XTS", + "FX_MSISDN_1": "123456789", "FX_EXPIRATION": "2024-08-22T12:33:23.819Z", "acceptFxParties": "application/vnd.interoperability.parties+json;version=1.0", "acceptFxQuotes": "application/vnd.interoperability.fxQuotes+json;version=2.0", @@ -16,12 +18,12 @@ "currency": "USD", "fxpCurrency": "USD", "hub_operator": "NOT_APPLICABLE", - "HOST_CENTRAL_LEDGER": "http://moja1-centralledger-service", - "HOST_ACCOUNT_LOOKUP_SERVICE": "http://moja1-account-lookup-service", - "HOST_ORACLE": "http://moja1-simulator/oracle", - "HOST_QUOTING_SERVICE": "http://moja1-quoting-service", + "HOST_CENTRAL_LEDGER": "http://moja2-centralledger-service", + "HOST_ACCOUNT_LOOKUP_SERVICE": "http://moja2-account-lookup-service", + "HOST_ORACLE": "http://moja2-simulator/oracle", + "HOST_QUOTING_SERVICE": "http://moja2-quoting-service", "dfspEmail": "test@infitx.com", - "CALLBACK_ENDPOINT_BASE_URL": "http://moja1-ml-testing-toolkit-backend:4040", + "CALLBACK_ENDPOINT_BASE_URL": "http://moja2-ml-testing-toolkit-backend:4040", "condition": "GRzLaTP7DJ9t4P-a_BA0WA9wzzlsugf00-Tn6kESAfM", "fulfillment": "UNlJ98hZTY_dsw0cAqw4i_UN3v4utt7CZFB4yfLbVFA", "expiration": "2024-07-26T11:12:15.158Z", diff --git a/rules/hub/rules_validation/default.json b/rules/hub/rules_validation/default.json index 4569af05..00dd30fd 100644 --- a/rules/hub/rules_validation/default.json +++ b/rules/hub/rules_validation/default.json @@ -1079,6 +1079,66 @@ "type": "validation", "version": 1 }, + { + "ruleId": 22, + "priority": 1, + "description": "post /transfers - Test Case for FX Settlements - Payee ABORT when amount is 5255", + "apiVersion": { + "minorVersion": 0, + "majorVersion": 2, + "type": "fspiop", + "asynchronous": true, + "specFile": "spec_files/api_definitions/fspiop_2.0/api_spec.yaml", + "callbackMapFile": "spec_files/api_definitions/fspiop_2.0/callback_map.json", + "responseMapFile": "spec_files/api_definitions/fspiop_2.0/response_map.json", + "jsfRefFile": "spec_files/api_definitions/fspiop_2.0/mockRef.json", + "triggerTemplatesFolder": "spec_files/api_definitions/fspiop_2.0/trigger_templates" + }, + "conditions": { + "all": [ + { + "fact": "body", + "operator": "numericEqual", + "value": "5255", + "path": "amount.amount" + }, + { + "fact": "operationPath", + "operator": "equal", + "value": "/transfers" + }, + { + "fact": "method", + "operator": "equal", + "value": "post" + } + ] + }, + "event": { + "method": "put", + "path": "/transfers/{ID}/error", + "params": { + "scripts": { + "scriptingEngine": "postman" + }, + "body": { + "errorInformation": { + "errorCode": "5201", + "errorDescription": "Payee FSP ABORT" + } + }, + "headers": { + "Content-Type": "application/vnd.interoperability.transfers+json;version=1.0", + "Date": "Tue, 23 Jul 2024 02:05:53 GMT", + "FSPIOP-Source": "ttkfxpayee", + "FSPIOP-Destination": "ttkfxpayer" + } + }, + "type": "FIXED_ERROR_CALLBACK" + }, + "type": "validation", + "version": 1 + }, { "ruleId": 19, "priority": 1,