Skip to content
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

Payment driver: ValidateAllocation #791

Merged
merged 1 commit into from
Nov 16, 2020
Merged

Conversation

Wiezzel
Copy link

@Wiezzel Wiezzel commented Nov 16, 2020

Added a new GSB endpoint to the payment driver API to validate whether an allocation could be created (check available funds).


Testing:
a) Regression: Just run payment_api --driver=zksync + invoice_flow
b) Insufficient funds: change line 39 in invoice_flow to make an allocation for 1000000 GNT. Run payment_api --driver=zksync + invoice_flow. Should fail with an error like this:

[2020-11-16T14:36:02Z INFO  invoice_flow] Issuing invoice...
[2020-11-16T14:36:02Z INFO  invoice_flow] Invoice issued.
[2020-11-16T14:36:02Z INFO  invoice_flow] Sending invoice...
[2020-11-16T14:36:02Z INFO  invoice_flow] Invoice sent.
[2020-11-16T14:36:02Z INFO  invoice_flow] Creating allocation...
Error: request for http://127.0.0.1:7465/payment-api/v1/requestor/allocations resulted in HTTP status code: 400 Bad Request: Insufficient funds to make allocation

c) Invalid account: change line 37 in invoice_flow and put there some bogus address. Run payment_api --driver=zksync + invoice_flow. Should fail with an error like this:

[2020-11-16T14:35:23Z INFO  invoice_flow] Issuing invoice...
[2020-11-16T14:35:23Z INFO  invoice_flow] Invoice issued.
[2020-11-16T14:35:23Z INFO  invoice_flow] Sending invoice...
[2020-11-16T14:35:23Z INFO  invoice_flow] Invoice sent.
[2020-11-16T14:35:23Z INFO  invoice_flow] Creating allocation...
Error: request for http://127.0.0.1:7465/payment-api/v1/requestor/allocations resulted in HTTP status code: 400 Bad Request: Account not registered

@Wiezzel Wiezzel requested review from maaktweluit and a team November 16, 2020 14:42
@Wiezzel Wiezzel force-pushed the wiezzel/validate_allocation branch from 22baf3a to 2a7b92b Compare November 16, 2020 14:49
Added a new GSB endpoint to the payment driver API to validate whether
an allocation could be created (check available funds).

Signed-off-by: Adam Wierzbicki <[email protected]>
@Wiezzel Wiezzel force-pushed the wiezzel/validate_allocation branch from 2a7b92b to a637ad1 Compare November 16, 2020 15:26
Copy link
Contributor

@maaktweluit maaktweluit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Tested all 3 scenario's

@Wiezzel Wiezzel merged commit a6c2a5d into master Nov 16, 2020
@Wiezzel Wiezzel deleted the wiezzel/validate_allocation branch November 16, 2020 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants