diff --git a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Complete Incoming Payment.bru b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Complete Incoming Payment.bru index 4db9c28700..0debce0d02 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Complete Incoming Payment.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Complete Incoming Payment.bru @@ -12,12 +12,18 @@ post { headers { Authorization: GNAP {{accessToken}} - ~Host: happy-life-bank-backend } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); +} + +tests { + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Create Incoming Payment.bru b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Create Incoming Payment.bru index 6cef2d19f6..c72e3cd91f 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Create Incoming Payment.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Create Incoming Payment.bru @@ -31,20 +31,22 @@ body:json { } script:pre-request { - // pm.environment.set("tomorrow", (new Date(new Date().setDate(new Date().getDate() + 1))).toISOString()); - // - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) + const scripts = require('./scripts'); + + bru.setEnvVar("tomorrow", (new Date(new Date().setDate(new Date().getDate() + 1))).toISOString()); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); +} + +script:post-response { + const body = res.getBody(); + bru.setEnvVar("incomingPaymentId", body.id.split("/").pop()); } tests { - // pm.test("Status code is 201", function () { - // pm.response.to.have.status(201); - // }); - // - // const body = pm.response.json(); - // pm.environment.set("incomingPaymentId", body.id.split("/").pop()); - // + test("Status code is 201", function() { + expect(res.getStatus()).to.equal(201); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment -Unauthenticated-.bru b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment -Unauthenticated-.bru index 89496daf6d..d282f8123d 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment -Unauthenticated-.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment -Unauthenticated-.bru @@ -12,16 +12,10 @@ get { headers { Host: happy-life-bank-backend - ~Authorization: GNAP {{accessToken}} -} - -script:pre-request { - // } tests { - // pm.test("Status code is 200", function () { - // pm.response.to.have.status(200); - // }); - // + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment.bru b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment.bru index d8433085df..797cf9ae66 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/Get Incoming Payment.bru @@ -15,15 +15,15 @@ headers { } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); } tests { - // pm.test("Status code is 200", function () { - // pm.response.to.have.status(200); - // }); - // + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/List Incoming Payments.bru b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/List Incoming Payments.bru index 6669c06902..9fd7a87872 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/List Incoming Payments.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Incoming Payments/List Incoming Payments.bru @@ -21,33 +21,15 @@ headers { } script:pre-request { - // request.url = request.url - // .replace(/{{(receiverWalletAddress)}}/g, (_, key) => pm.environment.get(key)) - // .replace(/http:\/\/localhost:([3,4])000/g, (_, key) => - // key === '3' - // ? 'https://' + pm.environment.get('host3000') - // : 'https://' + pm.environment.get('host4000') - // ) - // console.log(request.url) - // - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) - // - // pm.request.url.query.idx(2).value = pm.request.url.query.idx(2).value - // .replace(/{{([A-Za-z]\w+)}}/g, (_, key) => pm.environment.get(key)) - // .replace(/http:\/\/localhost:([3,4])000/g, (_, key) => - // key === '3' - // ? 'https://' + pm.environment.get('host3000') - // : 'https://' + pm.environment.get('host4000') - // ) - // + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); } tests { - // pm.test("Status code is 200", function () { - // pm.response.to.have.status(200); - // }); - // + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Create Outgoing Payment.bru b/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Create Outgoing Payment.bru index e69a8c9211..c0e404ad13 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Create Outgoing Payment.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Create Outgoing Payment.bru @@ -26,18 +26,20 @@ body:json { } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); +} + +script:post-response { + const body = res.getBody(); + bru.setEnvVar("outgoingPaymentId", body.id.split("/").pop()); } tests { - // pm.test("Status code is 201", function () { - // pm.response.to.have.status(201); - // }); - // - // const body = pm.response.json(); - // pm.environment.set("outgoingPaymentId", body.id.split("/").pop()); - // + test("Status code is 201", function() { + expect(res.getStatus()).to.equal(201); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Get Outgoing Payment.bru b/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Get Outgoing Payment.bru index 58c1272b9b..a434aa6bfa 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Get Outgoing Payment.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/Get Outgoing Payment.bru @@ -15,15 +15,15 @@ headers { } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); } tests { - // pm.test("Status code is 200", function () { - // pm.response.to.have.status(200); - // }); - // + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/List Outgoing Payments.bru b/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/List Outgoing Payments.bru index 8c412c96c5..d85bd35fa5 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/List Outgoing Payments.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Outgoing Payments/List Outgoing Payments.bru @@ -21,33 +21,15 @@ headers { } script:pre-request { - // request.url = request.url - // .replace(/{{(senderWalletAddress)}}/g, (_, key) => pm.environment.get(key)) - // .replace(/http:\/\/localhost:([3,4])000/g, (_, key) => - // key === '3' - // ? 'https://' + pm.environment.get('host3000') - // : 'https://' + pm.environment.get('host4000') - // ) - // console.log(request.url) - // - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) - // - // pm.request.url.query.idx(2).value = pm.request.url.query.idx(2).value - // .replace(/{{([A-Za-z]\w+)}}/g, (_, key) => pm.environment.get(key)) - // .replace(/http:\/\/localhost:([3,4])000/g, (_, key) => - // key === '3' - // ? 'https://' + pm.environment.get('host3000') - // : 'https://' + pm.environment.get('host4000') - // ) - // + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); } tests { - // pm.test("Status code is 200", function () { - // pm.response.to.have.status(200); - // }); - // + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Quotes/Create Quote.bru b/bruno/collections/Rafiki/Open Payments APIs/Quotes/Create Quote.bru index 92e55ba577..9059ff40f9 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Quotes/Create Quote.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Quotes/Create Quote.bru @@ -28,18 +28,23 @@ body:json { } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); +} + +script:post-response { + const body = res.getBody(); + bru.setEnvVar("quoteId", body.id.split("/").pop()); + bru.setEnvVar("quoteDebitAmount", JSON.stringify(body.debitAmount)) + bru.setEnvVar("quoteReceiveAmount", JSON.stringify(body.receiveAmount)) + } tests { - // pm.test("Status code is 201", function () { - // pm.response.to.have.status(201); - // }); - // - // const body = pm.response.json(); - // pm.environment.set("quoteId", body.id.split("/").pop()); - // + test("Status code is 201", function() { + expect(res.getStatus()).to.equal(201); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Quotes/Get Quote.bru b/bruno/collections/Rafiki/Open Payments APIs/Quotes/Get Quote.bru index 9abe2724e9..008c63222f 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Quotes/Get Quote.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Quotes/Get Quote.bru @@ -16,15 +16,15 @@ headers { } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } - // eval(pm.environment.get('preRequestSignatures')) + const scripts = require('./scripts'); + + scripts.addHostHeader(); + + await scripts.addSignatureHeaders(); } tests { - // pm.test("Status code is 200", function () { - // pm.response.to.have.status(200); - // }); - // + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get Wallet Address Keys.bru b/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get Wallet Address Keys.bru index 8910b303fe..4017845c18 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get Wallet Address Keys.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get Wallet Address Keys.bru @@ -11,7 +11,13 @@ get { } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } + const scripts = require('./scripts'); + + scripts.addHostHeader("senderOpenPaymentsHost"); +} + +tests { + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get a Wallet Address.bru b/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get a Wallet Address.bru index 95995c8320..8fa2d788d1 100644 --- a/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get a Wallet Address.bru +++ b/bruno/collections/Rafiki/Open Payments APIs/Wallet Address/Get a Wallet Address.bru @@ -15,30 +15,13 @@ headers { } script:pre-request { - // if(pm.environment.get('preRequestHost')){ - // eval(pm.environment.get('preRequestHost')) - // } + const scripts = require('./scripts'); + + scripts.addHostHeader("senderOpenPaymentsHost"); } tests { - // pm.test("Status code is 200", function () { - // pm.response.to.have.status(200); - // }); - // - // const body = pm.response.json(); - // pm.environment.set("receiverAssetCode", body?.assetCode) - // pm.environment.set("receiverAssetScale", body?.assetScale) - // - // const authUrl = url.parse(body?.authServer) - // if ( - // authUrl.hostname.includes('cloud-nine-wallet') || - // authUrl.hostname.includes('happy-life-bank') - // ){ - // const port = authUrl.hostname.includes('cloud-nine-wallet') - // ? authUrl.port - // : Number(authUrl.port) + 1000 - // pm.environment.set("receiverOpenPaymentsAuthHost", authUrl.protocol + '//localhost:' + port ); - // } else { - // pm.environment.set("receiverOpenPaymentsAuthHost", body?.authServer); - // } + test("Status code is 200", function() { + expect(res.getStatus()).to.equal(200); + }); } diff --git a/bruno/collections/Rafiki/Open Payments Auth APIs/Grants/Continuation Request.bru b/bruno/collections/Rafiki/Open Payments Auth APIs/Grants/Continuation Request.bru index 7d0c63b95b..fa870054d0 100644 --- a/bruno/collections/Rafiki/Open Payments Auth APIs/Grants/Continuation Request.bru +++ b/bruno/collections/Rafiki/Open Payments Auth APIs/Grants/Continuation Request.bru @@ -31,9 +31,3 @@ script:post-response { scripts.storeTokenDetails(); } - -tests { - // const body = pm.response.json(); - // pm.environment.set("accessToken", body.access_token.value); - // pm.environment.set("tokenId", body.access_token.manage.split('/').pop()) -} diff --git a/bruno/collections/Rafiki/Rafiki Admin APIs/Create Peer.bru b/bruno/collections/Rafiki/Rafiki Admin APIs/Create Peer.bru index 042c9f2dae..96eec58d01 100644 --- a/bruno/collections/Rafiki/Rafiki Admin APIs/Create Peer.bru +++ b/bruno/collections/Rafiki/Rafiki Admin APIs/Create Peer.bru @@ -54,9 +54,3 @@ script:post-response { bru.setEnvVar("peerId", body.data.createPeer.peer.id); } - -tests { - // const body = pm.response.json(); - // - // pm.environment.set("peerId", body.data.createPeer.peer.id); -}