Skip to content

Commit

Permalink
feat: bruno updates
Browse files Browse the repository at this point in the history
  • Loading branch information
njlie committed Sep 24, 2024
1 parent d35a352 commit d7f2883
Show file tree
Hide file tree
Showing 37 changed files with 69 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{receiverOpenPaymentsHost}}/incoming-payments
url: {{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsHost}}/outgoing-payments
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments
body: json
auth: none
}
Expand Down Expand Up @@ -35,7 +35,7 @@ script:pre-request {

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

if (body?.id) {
bru.setEnvVar("outgoingPaymentId", body.id.split("/").pop());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{senderOpenPaymentsHost}}/outgoing-payments/{{outgoingPaymentId}}
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments/{{outgoingPaymentId}}
body: none
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ script:post-response {
bru.setEnvVar("receiverAssetScale", body?.assetScale)

const authUrl = url.parse(body?.authServer)
const receiverTenantId = authUrl.pathname.split('/')[1]
bru.setEnvVar('receiverTenantId', receiverTenantId)
if (
authUrl.hostname.includes('cloud-nine-wallet') ||
authUrl.hostname.includes('happy-life-bank')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ script:post-response {
}

const body = res.getBody()

bru.setEnvVar("senderAssetCode", body?.assetCode)
bru.setEnvVar("senderAssetScale", body?.assetScale)

const authUrl = url.parse(body?.authServer)
const senderTenantId = authUrl.pathname.split('/')[1]
bru.setEnvVar('senderTenantId', senderTenantId)
if (
authUrl.hostname.includes('cloud-nine-wallet') ||
authUrl.hostname.includes('happy-life-bank')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{receiverOpenPaymentsAuthHost}}/
url: {{receiverOpenPaymentsAuthHost}}/{{receiverTenantId}}
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsAuthHost}}/
url: {{senderOpenPaymentsAuthHost}}/{{senderTenantId}}
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ meta {
}

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

headers {
Authorization: GNAP {{accessToken}}
x-operator-secret: {{operatorApiSecret}}
}

body:json {
Expand Down Expand Up @@ -41,7 +42,7 @@ script:pre-request {

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

if (body?.id) {
bru.setEnvVar("incomingPaymentId", body.id.split("/").pop());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsHost}}/outgoing-payments
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments
body: json
auth: none
}
Expand Down Expand Up @@ -34,7 +34,7 @@ script:pre-request {

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

if (body?.id) {
bru.setEnvVar("outgoingPaymentId", body.id.split("/").pop());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsHost}}/quotes
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/quotes
body: json
auth: none
}
Expand All @@ -17,7 +17,7 @@ headers {
body:json {
{
"walletAddress": "{{senderWalletAddress}}",
"receiver": "{{receiverOpenPaymentsHost}}/incoming-payments/{{incomingPaymentId}}",
"receiver": "{{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments/{{incomingPaymentId}}",
"method": "ilp"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{senderOpenPaymentsHost}}/outgoing-payments/{{outgoingPaymentId}}
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments/{{outgoingPaymentId}}
body: none
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,24 @@ script:pre-request {

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)
const receiverTenantId = authUrl.pathname.split('/')[1]
bru.setEnvVar("receiverTenantId", receiverTenantId)
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 );
bru.setEnvVar("receiverOpenPaymentsAuthHost", authUrl.protocol + '//localhost:' + port);
} else {
bru.setEnvVar("receiverOpenPaymentsAuthHost", body?.authServer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ script:post-response {
bru.setEnvVar("senderAssetScale", body?.assetScale)

const authUrl = url.parse(body?.authServer)
const senderTenantId = authUrl.pathname.split('/')[1]
bru.setEnvVar("senderTenantId", senderTenantId)
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 );
bru.setEnvVar("senderOpenPaymentsAuthHost", authUrl.protocol + '//localhost:' + port);
} else {
bru.setEnvVar("senderOpenPaymentsAuthHost", body?.authServer);
}

}

tests {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{receiverOpenPaymentsAuthHost}}/
url: {{receiverOpenPaymentsAuthHost}}/{{receiverTenantId}}
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsAuthHost}}/
url: {{senderOpenPaymentsAuthHost}}/{{senderTenantId}}
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ meta {
}

post {
url: {{senderOpenPaymentsAuthHost}}/
url: {{senderOpenPaymentsAuthHost}}/{{senderTenantId}}
body: json
auth: none
}

headers {
x-operator-secret: {{operatorApiSecret}}
}

body:json {
{
"access_token": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{receiverOpenPaymentsHost}}/incoming-payments
url: {{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments
body: json
auth: none
}
Expand Down Expand Up @@ -36,7 +36,7 @@ script:pre-request {

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

if (body?.id) {
bru.setEnvVar("incomingPaymentId", body.id.split("/").pop());
bru.setEnvVar("quoteDebitAmount", JSON.stringify({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsHost}}/outgoing-payments
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments
body: json
auth: none
}
Expand All @@ -17,7 +17,7 @@ headers {
body:json {
{
"walletAddress": "{{senderWalletAddress}}",
"incomingPayment": "{{receiverOpenPaymentsHost}}/incoming-payments/{{incomingPaymentId}}",
"incomingPayment": "{{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments/{{incomingPaymentId}}",
"debitAmount": {
"value": "300",
"assetCode": "USD",
Expand All @@ -40,7 +40,7 @@ script:pre-request {

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

if (body?.id) {
bru.setEnvVar("outgoingPaymentId", body.id.split("/").pop());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsHost}}/outgoing-payments
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments
body: json
auth: none
}
Expand All @@ -17,7 +17,7 @@ headers {
body:json {
{
"walletAddress": "{{senderWalletAddress}}",
"incomingPayment": "{{receiverOpenPaymentsHost}}/incoming-payments/{{incomingPaymentId}}",
"incomingPayment": "{{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments/{{incomingPaymentId}}",
"debitAmount": {
"value": "300",
"assetCode": "USD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsHost}}/outgoing-payments
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments
body: json
auth: none
}
Expand All @@ -17,7 +17,7 @@ headers {
body:json {
{
"walletAddress": "{{senderWalletAddress}}",
"incomingPayment": "{{receiverOpenPaymentsHost}}/incoming-payments/{{incomingPaymentId}}",
"incomingPayment": "{{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments/{{incomingPaymentId}}",
"debitAmount": {
"value": "300",
"assetCode": "USD",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{senderOpenPaymentsHost}}/outgoing-payments/{{outgoingPaymentId}}
url: {{senderOpenPaymentsHost}}/{{senderTenantId}}/outgoing-payments/{{outgoingPaymentId}}
body: none
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ script:post-response {
}

const body = res.getBody()

bru.setEnvVar("receiverAssetCode", body?.assetCode)
bru.setEnvVar("receiverAssetScale", body?.assetScale)

const authUrl = url.parse(body?.authServer)
const receiverTenantId = authUrl.pathname.split('/')[1]
bru.setEnvVar('receiverTenantId', receiverTenantId)
if (
authUrl.hostname.includes('cloud-nine-wallet') ||
authUrl.hostname.includes('happy-life-bank')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ script:post-response {
bru.setEnvVar("senderAssetScale", body?.assetScale)

const authUrl = url.parse(body?.authServer)
const senderTenantId = authUrl.pathname.split('/')[1]
bru.setEnvVar('senderTenantId', senderTenantId)
if (
authUrl.hostname.includes('cloud-nine-wallet') ||
authUrl.hostname.includes('happy-life-bank')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{receiverOpenPaymentsAuthHost}}/
url: {{receiverOpenPaymentsAuthHost}}/{{receiverTenantId}}
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{senderOpenPaymentsAuthHost}}/
url: {{senderOpenPaymentsAuthHost}}/{{senderTenantId}}
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{receiverOpenPaymentsHost}}/incoming-payments/{{incomingPaymentId}}/complete
url: {{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments/{{incomingPaymentId}}/complete
body: json
auth: none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

post {
url: {{receiverOpenPaymentsHost}}/incoming-payments
url: {{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments
body: json
auth: none
}
Expand Down Expand Up @@ -42,7 +42,7 @@ script:pre-request {

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

if (body?.id) {
bru.setEnvVar("incomingPaymentId", body.id.split("/").pop());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ meta {
}

get {
url: {{receiverOpenPaymentsHost}}/incoming-payments/{{incomingPaymentId}}
url: {{receiverOpenPaymentsHost}}/{{receiverTenantId}}/incoming-payments/{{incomingPaymentId}}
body: none
auth: none
}
Expand Down
Loading

0 comments on commit d7f2883

Please sign in to comment.