-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend): add local payment #2857
Open
BlairCurrey
wants to merge
77
commits into
main
Choose a base branch
from
bc/2834/non-ilp-local-payments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 49 commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
bb77152
feat(backend): add local payment quote migration
BlairCurrey fc06e24
feat(backend): WIP seperate ILPModels, LocalQuote, BaseQuote models
BlairCurrey 257fd01
refactor(backend): change model/services to reflect optional ilp quot…
BlairCurrey d9fa20e
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 2e76ee2
feat(backend): WIP local payment method with getQuote
BlairCurrey 4fab5d8
feat(backend): add local payment method to payment method handler
BlairCurrey b17db75
chore(backend): fix format
BlairCurrey 6e37420
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 9ef7f94
feat(backend): stub in control payment handler service with receiver …
BlairCurrey 320ee21
feat(backend): local payment .pay
BlairCurrey 07569a7
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey f3d5f5d
chore: rm comment
BlairCurrey d795ce2
chore: WIP debugging wrong sentAmount
BlairCurrey 251c60a
chore: rm comment
BlairCurrey 8f0bcb8
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey eca01f1
feat(backend): use receiver.isLocal to control payment method in quot…
BlairCurrey 770d7ea
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 3849db7
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 170bcc3
fix(backend): added source amount
BlairCurrey 88618ce
fix(backend): p2p case (cross currency, local, fixed send)
BlairCurrey 823c512
fix: lint error
BlairCurrey 2e9f043
chore: rm logs
BlairCurrey 3fb02e5
fix: quote service test
BlairCurrey 569f029
fix: lint errors
BlairCurrey dae1de1
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 2016469
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 3182944
refactor(backend): split migrations
BlairCurrey 3665188
refactor(backend): rm migration that was split into many
BlairCurrey 5b8bad3
WIP bruno requests for testing
BlairCurrey b49e08e
feat(backend): start rm ilpQuoteDetail join on op where not used
BlairCurrey eedacb5
fix(backend): rm unecessary ilpQuoteDetail join
BlairCurrey 27a64b2
chore(backend): format
BlairCurrey 26d0539
fix(backend): dont join op on quote.ilpQuoteDetails on get
BlairCurrey 2723961
fix(backend): rm ilpQuoteDetails join on op cancel
BlairCurrey 08126c5
fix(backend): rm unecessary join in op validate grant amount
BlairCurrey 205447d
fix(backend): rm join from fundPayment
BlairCurrey 0471d84
fix(backend): rm unecessary join, unused method
BlairCurrey 7b5142d
fix(backend): fetch ilpQuoteDetails where used instead of joining
BlairCurrey 773e4f2
chore(backend): move ilpquotedetails dir
BlairCurrey 0a3adf4
chore(backend): rm console.log
BlairCurrey 347f9b0
fix(backend): rm ilpQuoteDetails joins from quote service
BlairCurrey 37d399e
chore(backend): rm console.log
BlairCurrey 78d42b6
refactor(backend): rename sourceAmount to debitAmountMinusFees
BlairCurrey a96d654
chore(backend): cleanup, rm unused fee method
BlairCurrey 7941f05
test(backend): add local payment tests
BlairCurrey 753a57b
chore: format
BlairCurrey ed30066
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 8476615
fix(bruno): local open payments requests
BlairCurrey f8a979c
test(backend): add integration tests for local payments
BlairCurrey 5cee618
chore(backend): cleanup
BlairCurrey d41777e
chore: restore old version of date definition in test
BlairCurrey e0f988d
chore: cleanup
BlairCurrey 5d631bd
fix: rm unused import
BlairCurrey ececad2
test(integration): new case - p2p, fixed-send, local
BlairCurrey 63011ae
chore(integration): rename test for consistency
BlairCurrey bd12e30
fix(backend): throw error in pay if incoming payment is not pending
BlairCurrey b0eaf8d
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 0d69a3d
feat(backend): simplify migrations
BlairCurrey 31e6cc7
chore(backend): clarify comment
BlairCurrey bb9d334
chore(auth): format
BlairCurrey b0897d9
refactor(backend): use IlpQuoteDetails model directly in ilp payment …
BlairCurrey 2d8048a
refactor(backend): rm ilpQuoteDetails service
BlairCurrey 15d8929
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey c40db9e
fix(integration): wa typo
BlairCurrey 0dbb2d3
chore: rm bruno test examples
BlairCurrey 61b1010
refactor: mv debitAmountMinusFees to fee calc and clarify TODO
BlairCurrey 0dea97d
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey 6c995d9
Update bruno/collections/Rafiki/Examples/Admin API - only locally/Pe…
BlairCurrey 86f6db6
fix: make timeout required again
BlairCurrey 3fc6924
feat: error when post fails in local pay
BlairCurrey 6634b8f
refactor(backend): add optional quoteId to getQuote args
BlairCurrey 6706557
refactor: rm ilp quote details out of quote service
BlairCurrey 998ee25
refactor: insert ilp quote details in ilp getQuote
BlairCurrey a4cf57a
fix(backend): payment handler test
BlairCurrey 1835bc4
chore(bruno): rename request
BlairCurrey 7db833b
chore(integration): rm erroneous todo comment
BlairCurrey 4437438
Merge branch 'main' into bc/2834/non-ilp-local-payments
BlairCurrey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
...ly locally/Peer-to-Peer Cross Cur Payment (Local, Fixed Send)/Create Outgoing Payment.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
meta { | ||
name: Create Outgoing Payment | ||
type: graphql | ||
seq: 3 | ||
} | ||
|
||
post { | ||
url: {{RafikiGraphqlHost}}/graphql | ||
body: graphql | ||
auth: none | ||
} | ||
|
||
body:graphql { | ||
mutation CreateOutgoingPayment($input: CreateOutgoingPaymentInput!) { | ||
createOutgoingPayment(input: $input) { | ||
payment { | ||
createdAt | ||
error | ||
metadata | ||
id | ||
walletAddressId | ||
receiveAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
receiver | ||
debitAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
sentAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
state | ||
stateAttempts | ||
} | ||
} | ||
} | ||
} | ||
|
||
body:graphql:vars { | ||
{ | ||
"input": { | ||
"walletAddressId": "{{gfranklinWalletAddressId}}", | ||
"quoteId": "{{quoteId}}" | ||
} | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const scripts = require('./scripts'); | ||
|
||
scripts.addApiSignatureHeader(); | ||
} | ||
|
||
script:post-response { | ||
const body = res.getBody(); | ||
|
||
if (body?.data) { | ||
bru.setEnvVar("outgoingPaymentId", body.data.createOutgoingPayment.payment.id); | ||
} | ||
} | ||
|
||
tests { | ||
test("Outgoing Payment id is string", function() { | ||
expect(bru.getEnvVar("outgoingPaymentId")).to.be.a("string"); | ||
}) | ||
} |
71 changes: 71 additions & 0 deletions
71
...n API - only locally/Peer-to-Peer Cross Cur Payment (Local, Fixed Send)/Create Quote.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
meta { | ||
name: Create Quote | ||
type: graphql | ||
seq: 2 | ||
} | ||
|
||
post { | ||
url: {{RafikiGraphqlHost}}/graphql | ||
body: graphql | ||
auth: none | ||
} | ||
|
||
body:graphql { | ||
mutation CreateQuote($input: CreateQuoteInput!) { | ||
createQuote(input: $input) { | ||
quote { | ||
createdAt | ||
expiresAt | ||
id | ||
walletAddressId | ||
receiveAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
receiver | ||
debitAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
body:graphql:vars { | ||
{ | ||
"input": { | ||
"walletAddressId": "{{gfranklinWalletAddressId}}", | ||
"receiver": "{{receiverId}}", | ||
"debitAmount": { | ||
"assetCode": "USD", | ||
"assetScale": 2, | ||
"value": 500 | ||
} | ||
} | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const scripts = require('./scripts'); | ||
|
||
await scripts.loadWalletAddressIdsIntoVariables(); | ||
|
||
scripts.addApiSignatureHeader(); | ||
} | ||
|
||
script:post-response { | ||
const body = res.getBody(); | ||
|
||
if (body?.data) { | ||
bru.setEnvVar("quoteId", body.data.createQuote.quote.id); | ||
} | ||
} | ||
|
||
tests { | ||
test("Quote id is string", function() { | ||
expect(bru.getEnvVar("quoteId")).to.be.a("string"); | ||
}) | ||
} |
78 changes: 78 additions & 0 deletions
78
...-Peer Cross Cur Payment (Local, Fixed Send)/Create Receiver (remote Incoming Payment).bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
meta { | ||
name: Create Receiver (remote Incoming Payment) | ||
type: graphql | ||
seq: 1 | ||
} | ||
|
||
post { | ||
url: {{RafikiGraphqlHost}}/graphql | ||
body: graphql | ||
auth: none | ||
} | ||
|
||
body:graphql { | ||
mutation CreateReceiver($input: CreateReceiverInput!) { | ||
createReceiver(input: $input) { | ||
receiver { | ||
completed | ||
createdAt | ||
expiresAt | ||
metadata | ||
id | ||
incomingAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
walletAddressUrl | ||
receivedAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
updatedAt | ||
} | ||
} | ||
} | ||
} | ||
|
||
body:graphql:vars { | ||
{ | ||
"input": { | ||
"metadata": { | ||
"description": "cross-currency" | ||
}, | ||
// "incomingAmount": { | ||
// "assetCode": "EUR", | ||
// "assetScale": 2, | ||
// "value": 500 | ||
// }, | ||
"walletAddressUrl": "https://cloud-nine-wallet-backend/accounts/lrossi" | ||
} | ||
} | ||
} | ||
|
||
vars:pre-request { | ||
signatureVersion: {{apiSignatureVersion}} | ||
signatureSecret: {{apiSignatureSecret}} | ||
} | ||
|
||
script:pre-request { | ||
const scripts = require('./scripts'); | ||
|
||
scripts.addApiSignatureHeader(); | ||
} | ||
|
||
script:post-response { | ||
const body = res.getBody(); | ||
|
||
if (body?.data) { | ||
bru.setEnvVar("receiverId", body.data.createReceiver.receiver.id); | ||
} | ||
} | ||
|
||
tests { | ||
test("Receiver id is string", function() { | ||
expect(bru.getEnvVar("receiverId")).to.be.a("string"); | ||
}) | ||
} |
56 changes: 56 additions & 0 deletions
56
... only locally/Peer-to-Peer Cross Cur Payment (Local, Fixed Send)/Get Outgoing Payment.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
meta { | ||
name: Get Outgoing Payment | ||
type: graphql | ||
seq: 4 | ||
} | ||
|
||
post { | ||
url: {{RafikiGraphqlHost}}/graphql | ||
body: graphql | ||
auth: none | ||
} | ||
|
||
body:graphql { | ||
query GetOutgoingPayment($id: String!) { | ||
outgoingPayment(id: $id) { | ||
createdAt | ||
error | ||
metadata | ||
id | ||
walletAddressId | ||
quote { | ||
id | ||
} | ||
receiveAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
receiver | ||
debitAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
sentAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
state | ||
stateAttempts | ||
} | ||
} | ||
} | ||
|
||
body:graphql:vars { | ||
{ | ||
"id": "{{outgoingPaymentId}}" | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const scripts = require('./scripts'); | ||
|
||
scripts.addApiSignatureHeader(); | ||
} |
72 changes: 72 additions & 0 deletions
72
...only locally/Peer-to-Peer Cross Currency Payment (Fixed Send)/Create Outgoing Payment.bru
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
meta { | ||
name: Create Outgoing Payment | ||
type: graphql | ||
seq: 3 | ||
} | ||
|
||
post { | ||
url: {{RafikiGraphqlHost}}/graphql | ||
body: graphql | ||
auth: none | ||
} | ||
|
||
body:graphql { | ||
mutation CreateOutgoingPayment($input: CreateOutgoingPaymentInput!) { | ||
createOutgoingPayment(input: $input) { | ||
payment { | ||
createdAt | ||
error | ||
metadata | ||
id | ||
walletAddressId | ||
receiveAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
receiver | ||
debitAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
sentAmount { | ||
assetCode | ||
assetScale | ||
value | ||
} | ||
state | ||
stateAttempts | ||
} | ||
} | ||
} | ||
} | ||
|
||
body:graphql:vars { | ||
{ | ||
"input": { | ||
"walletAddressId": "{{gfranklinWalletAddressId}}", | ||
"quoteId": "{{quoteId}}" | ||
} | ||
} | ||
} | ||
|
||
script:pre-request { | ||
const scripts = require('./scripts'); | ||
|
||
scripts.addApiSignatureHeader(); | ||
} | ||
|
||
script:post-response { | ||
const body = res.getBody(); | ||
|
||
if (body?.data) { | ||
bru.setEnvVar("outgoingPaymentId", body.data.createOutgoingPayment.payment.id); | ||
} | ||
} | ||
|
||
tests { | ||
test("Outgoing Payment id is string", function() { | ||
expect(bru.getEnvVar("outgoingPaymentId")).to.be.a("string"); | ||
}) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In regards to all the new bruno requests (not just this specific file), I added them because they were useful for testing but not sure we want all these variants (every combination of local/remote, cross-currency/local, fixed-send/fixed-delivery). I left them for the time being though - maybe just include a basic one (p2p local)? There are unit tests and some integration tests.