Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
meta {
name: Continuation Request
type: http
seq: 8
}

post {
url: {{senderOpenPaymentsContinuationUri}}
body: json
auth: none
}

headers {
Authorization: GNAP {{continueToken}}
}

script:pre-request {
const scripts = require('./scripts');

await scripts.addSignatureHeaders();
}

script:post-response {
const scripts = require('./scripts');

scripts.storeTokenDetails();
}

tests {
test("Status code is 200", function() {
expect(res.getStatus()).to.equal(200);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
meta {
name: Create Incoming Payment
type: http
seq: 4
}

post {
url: {{receiverOpenPaymentsHost}}/incoming-payments
body: json
auth: none
}

headers {
Authorization: GNAP {{accessToken}}
}

body:json {
{
"walletAddress": "{{receiverWalletAddress}}",
"incomingAmount": {
"value": "100",
"assetCode": "{{receiverAssetCode}}",
"assetScale": {{receiverAssetScale}}
},
"expiresAt": "{{tomorrow}}",
"metadata": {
"description": "Free Money!"
}
}
}

script:pre-request {
const scripts = require('./scripts');

bru.setEnvVar("tomorrow", (new Date(new Date().setDate(new Date().getDate() + 1))).toISOString());

scripts.addHostHeader();

await scripts.addDirectedIdentitySignatureHeaders();
}

script:post-response {
const body = res.getBody();

if (body?.id) {
bru.setEnvVar("incomingPaymentId", body.id.split("/").pop());
}

}

tests {
test("Status code is 201", function() {
expect(res.getStatus()).to.equal(201);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
meta {
name: Create Outgoing Payment
type: http
seq: 9
}

post {
url: {{senderOpenPaymentsHost}}/outgoing-payments
body: json
auth: none
}

headers {
Authorization: GNAP {{accessToken}}
}

body:json {
{
"walletAddress": "{{senderWalletAddress}}",
"quoteId": "{{senderWalletAddress}}/quotes/{{quoteId}}",
"metadata": {
"description": "Free Money!"
}
}
}

script:pre-request {
const scripts = require('./scripts');

scripts.addHostHeader();

await scripts.addSignatureHeaders();
}

script:post-response {
const body = res.getBody();

if (body?.id) {
bru.setEnvVar("outgoingPaymentId", body.id.split("/").pop());
}

}

tests {
test("Status code is 201", function() {
expect(res.getStatus()).to.equal(201);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
meta {
name: Create Quote
type: http
seq: 6
}

post {
url: {{senderOpenPaymentsHost}}/quotes
body: json
auth: none
}

headers {
Authorization: GNAP {{accessToken}}
}

body:json {
{
"walletAddress": "{{senderWalletAddress}}",
"receiver": "{{receiverOpenPaymentsHost}}/incoming-payments/{{incomingPaymentId}}",
"method": "ilp"
}
}

script:pre-request {
const scripts = require('./scripts');

scripts.addHostHeader();

await scripts.addDirectedIdentitySignatureHeaders();
}

script:post-response {
const body = res.getBody();
if (body?.id) {
bru.setEnvVar("quoteId", body.id.split("/").pop());
bru.setEnvVar("quoteDebitAmount", JSON.stringify(body.debitAmount))
bru.setEnvVar("quoteReceiveAmount", JSON.stringify(body.receiveAmount))
}

}

tests {
test("Status code is 201", function() {
expect(res.getStatus()).to.equal(201);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
meta {
name: Get Outgoing Payment
type: http
seq: 10
}

get {
url: {{senderOpenPaymentsHost}}/outgoing-payments/{{outgoingPaymentId}}
body: none
auth: none
}

headers {
Authorization: GNAP {{accessToken}}
}

script:pre-request {
const scripts = require('./scripts');

scripts.addHostHeader();

await scripts.addSignatureHeaders();
}

tests {
test("Status code is 200", function() {
expect(res.getStatus()).to.equal(200);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
meta {
name: Get receiver wallet address
type: http
seq: 2
}

get {
url: {{receiverWalletAddress}}
body: none
auth: none
}

headers {
Accept: application/json
}

script:pre-request {
const scripts = require('./scripts');

scripts.addHostHeader("receiverOpenPaymentsHost");
}

script:post-response {
const url = require('url')

if (res.getStatus() !== 200) {
return
}

const body = res.getBody()
bru.setEnvVar("receiverAssetCode", body?.assetCode)
bru.setEnvVar("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
bru.setEnvVar("receiverOpenPaymentsAuthHost", authUrl.protocol + '//localhost:' + port + authUrl.path);
} else {
bru.setEnvVar("receiverOpenPaymentsAuthHost", body?.authServer);
}

const resourceUrl = url.parse(body?.resourceServer)
if (
resourceUrl.hostname.includes('cloud-nine-wallet') ||
resourceUrl.hostname.includes('happy-life-bank')
){
const port = resourceUrl.hostname.includes('cloud-nine-wallet') ? bru.getEnvVar('cloudNineOpenPaymentsPort') : bru.getEnvVar('happyLifeOpenPaymentsPort')
bru.setEnvVar("receiverOpenPaymentsHost", 'http://localhost:' + port + resourceUrl.path);
} else {
bru.setEnvVar("receiverOpenPaymentsHost", body?.resourceServer);
}
}

tests {
test("Status code is 200", function() {
expect(res.getStatus()).to.equal(200);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
meta {
name: Get sender wallet address
type: http
seq: 1
}

get {
url: {{senderWalletAddress}}
body: none
auth: none
}

headers {
Accept: application/json
}

script:pre-request {
const scripts = require('./scripts');

scripts.addHostHeader("senderOpenPaymentsHost");
}

script:post-response {
const url = require('url')

if (res.getStatus() !== 200) {
return
}

const body = res.getBody()
bru.setEnvVar("senderAssetCode", body?.assetCode)
bru.setEnvVar("senderAssetScale", 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
bru.setEnvVar("senderOpenPaymentsAuthHost", authUrl.protocol + '//localhost:' + port + authUrl.path);
} else {
bru.setEnvVar("senderOpenPaymentsAuthHost", body?.authServer);
}

const resourceUrl = url.parse(body?.resourceServer)
if (resourceUrl.hostname.includes('cloud-nine-wallet') || resourceUrl.hostname.includes('happy-life-bank')) {
const port = resourceUrl.hostname.includes('happy-life-bank') ? bru.getEnvVar('happyLifeOpenPaymentsPort') : bru.getEnvVar('cloudNineOpenPaymentsPort')
bru.setEnvVar("senderOpenPaymentsHost", 'http://localhost:' + port + resourceUrl.path);
} else {
bru.setEnvVar("senderOpenPaymentsHost", body?.resourceServer);
}
}

tests {
test("Status code is 200", function() {
expect(res.getStatus()).to.equal(200);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
meta {
name: Grant Request Incoming Payment
type: http
seq: 3
}

post {
url: {{receiverOpenPaymentsAuthHost}}
body: json
auth: none
}

body:json {
{
"access_token": {
"access": [
{
"type": "incoming-payment",
"actions": [
"create", "read", "list", "complete"
]
}
]
},
"client": {
"jwk": {{directedIdentityPublicKey}}
}
}
}

script:pre-request {
const scripts = require('./scripts');

scripts.generateDirectedIdentityKeys();

await scripts.addDirectedIdentitySignatureHeaders();
}

script:post-response {
const scripts = require('./scripts');

scripts.storeTokenDetails();
}

tests {
test("Status code is 200", function() {
expect(res.getStatus()).to.equal(200);
});
}
Loading
Loading