-
Notifications
You must be signed in to change notification settings - Fork 4
Use the Paddle sandbox environment for testing #6
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
Merged
Conversation
This file contains hidden or 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
… not return a 'plan' according to the Schema, this resulted in a KeyError. Please see documentation for the Schema https://developer.paddle.com/api-reference/subscription-api/payments/listpayments
…e amount. The assert is then used to compare the expected amount (new_quantity * amount) with the next_payment amount returned from preview_update_subscription.
…as is_one_off=False. Documentation shows is_one_off can be True or False https://developer.paddle.com/api-reference/product-api/transactions/listtransactions
…as the passthrough value can be null which raises an AssertionError. You may want to remove the check entirely instead of having an OR statement. https://developer.paddle.com/api-reference/product-api/transactions/listtransactions
…on checks on the passthrough value I found the list_transactions was not failing when a subscription was being passed (despite the passthrough returning null in postman). After investigating I found the plan_id (PADDLE_TEST_DEFAULT_PLAN_ID) was being passed as the subscription_id. In this instance the paddle API responds with {"success": true, "response": []} as the response is an empty list test never failed. Instead of passing a plan_id we should pass a subscription_id.
… avoid error "amount is less than allowed minimum transaction amount" (Paddle error 186). Also fix assertion check on the amount as paddle returns the value to three decimal places.
Add constructor parameter 'sandbox' to PaddleClient to enable sandbox mode If the parameter 'sandbox' is not passed in the constructor the option is loaded form the Environment variable 'PADDLE_SANDBOX' (default=False) Add get_environment_url(self, url) function to PaddleClient() which checks if sandbox has been enabled and if it had it prepends 'sandbox-' to the subdomain. Returns url Update PaddleClient request() to get the environment url after building and validating the url Update all tests to call paddle_client.get_environment_url()
This was referenced Mar 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Based on the work @Wolf-Byte started with the sandbox environment here - #4
Adds the following: