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

Pay with Apple Pay from cart page #40

Closed
spaghetticode opened this issue Jan 31, 2020 · 5 comments
Closed

Pay with Apple Pay from cart page #40

spaghetticode opened this issue Jan 31, 2020 · 5 comments
Assignees

Comments

@spaghetticode
Copy link
Member

Ref solidusio/solidus_stripe#23

User's shipping information can be collected directly on Apple Pay, and passed back to Solidus in order to have all the information needed to complete the order bypassing the checkout entirely.

We don't have available shipping rates yet on the cart and we need to pass shipping option to Apple Pay, since users will pick on option directly in there. We could, by default, just pass all the available shipping method to Apple Pay and use a configuration class to allow devs to override the default behavior with their custom logic.

@spaghetticode
Copy link
Member Author

I need to figure out how to pick the available shipping methods and their cost, as this does not seem to be very straightforward.

@spaghetticode spaghetticode self-assigned this Feb 14, 2020
@spaghetticode
Copy link
Member Author

PR is now ready for review: solidusio/solidus_stripe#29

@spaghetticode
Copy link
Member Author

After some round of PR reviews and code changes (special thank you goes to @kennyadsl), the code from the PR has been successfully mounted inside a real Solidus store, but still in testing mode.

The functionality seems to work properly there as well, and the integration was rather simple.

Currently, we're still not merging the new functionality because we think that the JS code would benefit from some serious refactoring, not limited only to this new feature, but also to the Elements and Payment Intents functionalities, which are somehow related. The most significant issues are:

  • much JS code is still present in ERB partials, as the gem original code was structured that way and the new functionalities are evolutions of the previous deprecated v2 implementation;
  • JS code is not properly modularized and needs to be loaded only when necessary, as otherwise it would pollute the window namespace and always run in every situation, so it cannot be added to a generic assets manifest always included in the app frontend.

@spaghetticode
Copy link
Member Author

Refactoring was completed. The new structure leverages JS prototypal inheritance and adds extra shared behavior with modularity. It's now under review, we're thinking to move the heavy refactoring commit to a separate PR.

@spaghetticode
Copy link
Member Author

The feature was merged, without the JS refactoring commit that was moved to a separate PR.

After using the gem in the Bookshop store we noticed that moving the code under Sprokets was definitely a good idea. It would remove all JS code from the views, giving the option for example to load all the app JS code at the bottom of the body tag. So, I opened another PR that moves the JS under Sprockets and initializes conditionally the proper Stripe payment API (Elements, Payment Intents or cart checkout button) when needed.

@elia elia closed this as completed Sep 6, 2022
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

No branches or pull requests

2 participants