-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Refactor payments-stripe to only use getStripeInstanceForShop #4951
Refactor payments-stripe to only use getStripeInstanceForShop #4951
Conversation
ffe0888
to
bc5bb2c
Compare
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.
@rattrayalex-stripe Thanks! Can you merge latest develop
branch into this branch? It will delete the checkout client files that you modified because they were for the old checkout UI, which is gone in the next release. The recommendation now is to build your own or start with the example storefront.
To answer your questions:
getStripeInstance
andgetStripePackage
may at some point be needed in other files (we plan to add a stored card method, for example). So I'd keep them separated.- Constant name and location is fine
- Yes
Packages.findOne()
returns a Promise.
bc5bb2c
to
8347d01
Compare
Interesting! Will that use the new checkout (currently in beta)? Should make things much easier for users. In any case, rebased! |
@rattrayalex-stripe There is a test failing on CI: https://circleci.com/gh/reactioncommerce/reaction/37940?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-checks-link Looks like one of the import paths for the constant needs to be fixed. I wasn't aware of the new full-page checkout and the example storefront does not currently use it, but we may want to implement that as an alternative example. Reaction will not be shipping with a storefront anymore, but there will be example storefronts and docs with storefront development instructions. So it is up to individual installations whether they want to migrate to the new checkout page, but we can ensure that it works on the server API side. |
…d pull out a STRIPE_PACKAGE_NAME constant Signed-off-by: Alex Rattray <[email protected]>
8347d01
to
461832f
Compare
Oops, thanks for catching that - maybe caused by the rebase. Should be good now! And interesting re; storefronts... Let me know if you need help adding checkout compatibility! |
Whoops, just noticed this is still open 😅 ping @aldeed |
@rattrayalex-stripe Thanks. Last thing I remember was pulling this down to test but I'm not sure I ever completed that testing before getting busy with other things. I'll prioritize for this week. And I'll send you an email. |
Awesome, thanks! |
Signed-off-by: Eric Dobbertin <[email protected]>
Finally got this tested and merged! Thanks @rattrayalex-stripe |
Resolves #4942 (review)
Impact: minor
Type: refactor
Issue
This is a followup to #4942
"reaction-stripe"
) being duplicated in many places.paymentMethod.paymentPluginName
, but should have instead referenced the above constant.connectAuth.access_token
should probably be deprecated frompayments-stripe
, as it should only be set in themarketplace
plugin.Solution
STRIPE_PACKAGE_NAME
.getStripeApiKey
, move its connectAuth functionality intogetStripeInstanceForShop
with a warning log.getStripePackageForShop
since I thought it would be needed elsewhere, but I'm not sure this is the case.I have a few questions for the reviewer (presumably @aldeed ):
getStripeInstance
andgetStripePackage
are now only called from one file. Should they be moved into that file?Packages.findOne()
actually asynchronous? If not, I can removeawait
from calls to instantiate Stripe, which would be nice.Breaking changes
Previously, certain calls to instantiate stripe would throw an error if you did not have an api_key set. Now, those same calls will succeed, but use
connectAuth.access_token
if it is set. This is a breaking change, though my intuition is that no users would have relied on this behavior while also havingconnectAuth.access_token
set 🤞.Testing
I ran the unit tests locally.