-
Notifications
You must be signed in to change notification settings - Fork 683
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
Add support for billing for apps #1455
Conversation
f4a0c13
to
ea320bd
Compare
@@ -75,7 +75,6 @@ class << self | |||
@initialized = false | |||
|
|||
def with_session(test_class, is_embedded: false, is_private: false, &block) | |||
WebMock.enable! |
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.
This was making some tests flaky - webmock is already blocking all requests so we don't need to do this here.
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.
Thanks for adding this! I was able to 🎩 and do a smoke test with the existing flow without encountering issues.
I did encounter an interesting flow, where if the app was initially installed without billing, but later introduced to the app. The billing screen won't show up until the next merchant log in/session, is this expected behaviour?
Yes - because we need to query Shopify for the billing status for a merchant, we need to have access to a token, which only happens on authenticated requests, or when coming back from OAuth. Those are the two points where we check for billing. I'm going to merge the PR but we can fix forward if there are any other scenarios we want to cover! |
What this PR does
Partners might want to charge for their apps, but this gem currently doesn't really add any specific support for that scenario.
This PR adds that support by appending a concern to
Authenticated
to check if there is an active payment for the merchant, or requesting one if there isn't, and redirecting the merchant to it.If the new
billing
configuration setting isn't present, this does nothing.Reviewer's guide to testing
This was mostly tested by unit tests, and by activating the configuration in a new app.
Things to focus on
Checklist
Before submitting the PR, please consider if any of the following are needed:
CHANGELOG.md
if the changes would impact users