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

Add PayPal buttons to frontend checkout flow #10

Merged
merged 3 commits into from
Jun 4, 2020

Conversation

seand7565
Copy link
Contributor

Adds paypal buttons and associated javascripts to allow customers to
checkout using PayPal.

Also: This is not a draft PR, it looks like draft PRs aren't available on this repo for some reason. This link seems to indicate that we need a Github Team account for it? https://github.community/t5/How-to-use-Git-and-GitHub/Draft-Pull-Requests-not-available/m-p/19212#M5733

@seand7565 seand7565 force-pushed the frontend_checkout branch 2 times, most recently from 4d787e3 to 0345788 Compare May 25, 2020 18:13
@elia
Copy link
Member

elia commented May 26, 2020

Also: This is not a draft PR, it looks like draft PRs aren't available on this repo for some reason. This link seems to indicate that we need a Github Team account for it? https://github.community/t5/How-to-use-Git-and-GitHub/Draft-Pull-Requests-not-available/m-p/19212#M5733

Gotcha, I guess we'll have to survive without this! 😄😅
Given this is the situation let's use the board to communicate the PR status then, we can move between the "in progress", "in review", and "review approved" columns plus explicitly requesting reviews and basically achieve the same result.

image

I'll update this PR right away 🚀

@elia elia changed the title [WIP] Add PayPal buttons to frontend checkout flow Add PayPal buttons to frontend checkout flow May 26, 2020
@elia elia added paypal checkout Related to PayPal Checkout Buttons solidus frontend Touches the Solidus frontend/storefront labels May 26, 2020
@seand7565
Copy link
Contributor Author

seand7565 commented May 26, 2020

Just as reference, still need to do the following:

  • Make it work using auto-capture: false (right now it only works if it's on)
  • Load the frontend code conditionally (not everyone is using frontend)
  • Add tests!

@seand7565 seand7565 force-pushed the frontend_checkout branch 4 times, most recently from 55444b8 to abcbf81 Compare May 27, 2020 16:32
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

just some nits about the indentation, I'll have another look after it's fixed to avoid having my eyes crossed after I finish 😅

spec/features/frontend/checkout_spec.rb Outdated Show resolved Hide resolved
spec/features/frontend/checkout_spec.rb Outdated Show resolved Hide resolved
spec/features/frontend/checkout_spec.rb Outdated Show resolved Hide resolved
@seand7565
Copy link
Contributor Author

@elia I've split this PR into 3 separate commits, I hope they make sense! The first commit is new models/helpers that the rest depend on, the second is adding functionality to the gateway, and the third creates the controllers and frontend view that use that added functionality.

@seand7565 seand7565 force-pushed the frontend_checkout branch from fd93284 to cc70de5 Compare June 1, 2020 17:33
seand7565 added 2 commits June 3, 2020 09:18
Payment source has paypal_order_id - to connect it to the order on
PayPals side - and an authorization_id - which is how you reference
the order when the store is set to not auto-capture.

Also adds a class to format the orders data to something usable by
PayPals API.
Adds basic purchase/authorize/refund/etc. ability to the gateway. Only
purchase, authorize, and capture have been implemented, the rest simply
returns false - we'll build that out when we handle the admin side.
Also adds methods that make it easier to trigger a request.
On the request file, I've added methods for triggering authorize, purchase,
and capture events on PayPal. I've also added "paypal_order_id" and
"authorization_id" to source attributes.
@seand7565 seand7565 force-pushed the frontend_checkout branch from cc70de5 to 4b8959c Compare June 3, 2020 14:23
Adds routes for orders_controller - which allows the creation of
orders on PayPals side. This is called when the paypal button is
first clicked, to send the order info to PayPal so they know how
to build the order and how much is going to be charged.
Also adds a route for payments_controller, which handles the creation
of the source/payment for the order.
en.yml was updated to display nothing for validation errors for
paypal_order_id - the reason is that when you try to proceed
without having created a payment on PayPal, the error message
"Payments Source #{en.yml entry} Can't Be Blank" appears, with
whatever you've set in the paypal_order_id entry appearing in the
middle of the string. We may want to adjust the entire error message,
but I think it's clearer with nothing in the middle - so just
"Payments Source Can't Be Blank", instead of "Payments Source
Paypal Order Id Can't Be Blank".
Also adds tests for the frontend! 🎉
@seand7565 seand7565 force-pushed the frontend_checkout branch from 4b8959c to ff692c0 Compare June 3, 2020 14:41
@seand7565
Copy link
Contributor Author

@elia I update the PR to reflect your suggestions, and I also moved the inline javascript from the checkout page to a javascript file, let me know how it looks!

@elia
Copy link
Member

elia commented Jun 4, 2020

🎉💯great job!

@elia elia merged commit ced2d77 into solidusio:master Jun 4, 2020
@elia elia deleted the frontend_checkout branch June 4, 2020 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paypal checkout Related to PayPal Checkout Buttons solidus frontend Touches the Solidus frontend/storefront
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants