{ "info": { "_postman_id": "476d15fe-5775-4ef8-a3d6-3f3b21afb9e9", "name": "Dev.portal: Consent sandbox", "description": "Postman test suite for testing Consent APIs.\n\n# Update token\nRemember to update data in the Environment variables.\n## Hint: requests are in logical order\nThe requests can be performed in the order given in the collection, as the variables/links often are based on the previous request.", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "6924963" }, "item": [ { "name": "Fetch token", "item": [ { "name": "Fetch sandbox sydbank token", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(200);", "});", "pm.collectionVariables.set(\"token\", pm.response.json().access_token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "console.log(\"Post for a token and setup environment variables\");", "", "var env = postman.getEnvironmentVariable(\"env\");", "", "console.log(env);", "", "if (env === \"local\"){", " pm.collectionVariables.set(\"auth-url\", \"https://test-auth.sydbank.dk\");", " pm.collectionVariables.set(\"api-url\", \"localhost:8097\");", " pm.collectionVariables.set(\"x-api-key\", \"HQFmo9N8OUVw5169fn1W4o2jMomXBjEg\");", " pm.collectionVariables.set(\"internal-api-url\", \"localhost:8097\");", " pm.collectionVariables.set(\"internal-x-api-key\", \"xLD64X9npYX62GA7PhuT8YTJRMgrB7py\");", "}", "", "if (env === \"dev\"){", " pm.collectionVariables.set(\"auth-url\", \"https://test-auth.sydbank.dk\");", " pm.collectionVariables.set(\"api-url\", \"https://test-api.sydbank.dk/dev/openbanking-consent\");", " pm.collectionVariables.set(\"x-api-key\", \"HQFmo9N8OUVw5169fn1W4o2jMomXBjEg\");", " pm.collectionVariables.set(\"internal-api-url\", \"https://api.bdunet.dk:9443/dev/consent\");", " pm.collectionVariables.set(\"internal-x-api-key\", \"xLD64X9npYX62GA7PhuT8YTJRMgrB7py\");", "}", "", "if (env === \"staging\"){", " pm.collectionVariables.set(\"auth-url\", \"https://test-auth.sydbank.dk\");", " pm.collectionVariables.set(\"api-url\", \"https://test-api.sydbank.dk/openbanking-consent\");", " pm.collectionVariables.set(\"x-api-key\", \"HQFmo9N8OUVw5169fn1W4o2jMomXBjEg\");", " pm.collectionVariables.set(\"internal-api-url\", \"https://api.bdunet.dk:9443/consent\");", " pm.collectionVariables.set(\"internal-x-api-key\", \"xLD64X9npYX62GA7PhuT8YTJRMgrB7py\");", "}", "" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/x-www-form-urlencoded", "disabled": true } ], "body": { "mode": "urlencoded", "urlencoded": [ { "key": "grant_type", "value": "client_credentials", "type": "text" }, { "key": "client_id", "value": "PSDDK-DFSA-BD-tst100", "type": "text" }, { "key": "scope", "value": "aisprepare", "type": "text" } ] }, "url": { "raw": "{{authUrl}}/oauth-token", "host": [ "{{authUrl}}" ], "path": [ "oauth-token" ] } }, "response": [] } ] }, { "name": "Consent", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(201);", "});", "", "pm.test(\"Not Null Post Response\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.not.eql(null);", "});", "", "pm.collectionVariables.set(\"self\", pm.response.json()._links.self.href);", "pm.collectionVariables.set(\"status\", pm.response.json()._links.status.href);", "pm.collectionVariables.set(\"startAuthorisation\", pm.response.json()._links.startAuthorisation.href);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "X-Request-ID", "type": "text", "value": "{{$guid}}" }, { "key": "PSU-IP-Address", "type": "text", "value": "{{PSU-IP-Address}}" }, { "key": "Accept", "type": "text", "value": "application/json" }, { "key": "Content-Type", "type": "text", "value": "application/json" }, { "key": "x-api-key", "type": "text", "value": "{{x-api-key}}" } ], "body": { "mode": "raw", "raw": "{\n \"access\": {\n \"allPsd2\": \"allAccounts\"\n },\n \"recurringIndicator\": true,\n \"validUntil\": \"9999-12-31\",\n \"frequencyPerDay\": 4,\n \"combinedServiceIndicator\": false\n}" }, "url": { "raw": "{{host}}/openbanking-consent/v1/consents", "host": [ "{{host}}" ], "path": [ "openbanking-consent", "v1", "consents" ] }, "description": "You POST a global (allAccounts) consent with details.\n\nIt is not possible to POST a consent with specific accountnumbers." }, "response": [] }, { "name": "Consent with owner name", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(201);", "});", "", "pm.test(\"Not Null Post Response\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.not.eql(null);", "});", "", "pm.collectionVariables.set(\"self\", pm.response.json()._links.self.href);", "pm.collectionVariables.set(\"status\", pm.response.json()._links.status.href);", "pm.collectionVariables.set(\"startAuthorisation\", pm.response.json()._links.startAuthorisation.href);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "X-Request-ID", "type": "text", "value": "{{$guid}}" }, { "key": "PSU-IP-Address", "type": "text", "value": "{{PSU-IP-Address}}" }, { "key": "Accept", "type": "text", "value": "application/json" }, { "key": "Content-Type", "type": "text", "value": "application/json" }, { "key": "x-api-key", "type": "text", "value": "{{x-api-key}}" } ], "body": { "mode": "raw", "raw": "{\n \"access\": {\n \"allPsd2\": \"allAccountsWithOwnerName\"\n },\n \"recurringIndicator\": true,\n \"validUntil\": \"9999-12-31\",\n \"frequencyPerDay\": 4,\n \"combinedServiceIndicator\": false\n}" }, "url": { "raw": "{{host}}/openbanking-consent/v1/consents", "host": [ "{{host}}" ], "path": [ "openbanking-consent", "v1", "consents" ] }, "description": "You POST a global (allAccounts) consent with details.\n\nIt is not possible to POST a consent with specific accountnumbers." }, "response": [] }, { "name": "Consents", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Attributes\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.not.eql(null);", "});", "", "", "pm.test(\"Consent status \", function () {", " var jsonData = pm.response.json();", " console.log(\"Value is : \"+jsonData.consentStatus)", " pm.expect(jsonData.consentStatus).to.eql(\"valid\");", "});" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [ { "key": "X-Request-ID", "value": "{{$guid}}", "type": "text" }, { "key": "PSU-IP-Address", "value": "{{PSU-IP-Address}}", "type": "text" }, { "key": "Accept", "value": "application/json", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" }, { "key": "x-api-key", "value": "{{x-api-key}}", "type": "text" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{host}}/openbanking-consent{{self}}", "host": [ "{{host}}" ], "path": [ "openbanking-consent{{self}}" ] }, "description": "GET consent details." }, "response": [] }, { "name": "Consent status", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Not Null\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.not.eql(null);", "});", "" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [ { "key": "X-Request-ID", "value": "{{$guid}}", "type": "text" }, { "key": "PSU-IP-Address", "value": "{{PSU-IP-Address}}", "type": "text" }, { "key": "Accept", "value": "application/json", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" }, { "key": "x-api-key", "value": "{{x-api-key}}", "type": "text" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{host}}/openbanking-consent{{status}}", "host": [ "{{host}}" ], "path": [ "openbanking-consent{{status}}" ] }, "description": "GET consent status for the consentId." }, "response": [] }, { "name": "Consent authorisations", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(201);", "});", "", "pm.test(\"Not Null Post Response\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.not.eql(null);", "});", "", "pm.collectionVariables.set(\"scaOAuth\", pm.response.json()._links.scaOAuth.href);", "pm.collectionVariables.set(\"scaStatus\", pm.response.json()._links.scaStatus.href);", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "X-Request-ID", "type": "text", "value": "{{$guid}}" }, { "key": "PSU-IP-Address", "type": "text", "value": "{{PSU-IP-Address}}" }, { "key": "Accept", "type": "text", "value": "application/json" }, { "key": "Content-Type", "type": "text", "value": "application/json" }, { "key": "x-api-key", "value": "{{x-api-key}}", "type": "text" } ], "body": { "mode": "raw", "raw": "{}" }, "url": { "raw": "{{host}}/openbanking-consent{{startAuthorisation}}", "host": [ "{{host}}" ], "path": [ "openbanking-consent{{startAuthorisation}}" ] }, "description": "POST authorisations for the consentId." }, "response": [] }, { "name": "Consent auth_status", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Attributes\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.not.eql(null);", "});", "", "", "pm.test(\"Consent status \", function () {", " var jsonData = pm.response.json();", " console.log(\"Value is : \"+jsonData.scaStatus)", " pm.expect(jsonData.scaStatus).to.eql(\"scaMethodSelected\");", "});" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [ { "key": "X-Request-ID", "type": "text", "value": "{{$guid}}" }, { "key": "PSU-IP-Address", "type": "text", "value": "{{PSU-IP-Address}}" }, { "key": "Accept", "type": "text", "value": "application/json" }, { "key": "Content-Type", "type": "text", "value": "application/json" }, { "key": "x-api-key", "value": "{{x-api-key}}", "type": "text" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{host}}/openbanking-consent{{scaStatus}}", "host": [ "{{host}}" ], "path": [ "openbanking-consent{{scaStatus}}" ] }, "description": "GET status for the consent authorisation." }, "response": [] }, { "name": "Consent with invalid consentId", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Response is OK\", function () {", " pm.response.to.have.status(404);", "});", "", "pm.test(\"Attributes\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.not.eql(null);", "});", "", "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "X-Request-ID", "value": "{{$guid}}", "type": "text" }, { "key": "PSU-IP-Address", "value": "{{PSU-IP-Address}}", "type": "text" }, { "key": "Accept", "value": "application/json", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" }, { "key": "x-api-key", "value": "{{x-api-key}}", "type": "text" } ], "url": { "raw": "{{host}}/openbanking-consent/v1/consents/1f588ed1-6c85-4736-9435-1234568515", "host": [ "{{host}}" ], "path": [ "openbanking-consent", "v1", "consents", "1f588ed1-6c85-4736-9435-1234568515" ] }, "description": "Example what happens when you use an invalid consentId." }, "response": [] } ], "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ], "variable": [ { "key": "token", "value": "" }, { "key": "PSU-IP-Address", "value": "127.0.0.1", "type": "string" }, { "key": "self", "value": "" }, { "key": "status", "value": "" }, { "key": "startAuthorisation", "value": "" }, { "key": "scaOAuth", "value": "" }, { "key": "scaStatus", "value": "" } ] }