Commit Graph

2898 Commits

Author SHA1 Message Date
Filipe
8114eb1c9f Merge pull request #8666 from openfoodfoundation/stripe-controller
Extract new StripeController
2022-01-17 20:21:40 +00:00
Filipe
62f0de75ee Merge pull request #8679 from Matt-Yorkley/drop-jquery-ujs
Drop jquery_ujs
2022-01-17 16:30:25 +00:00
Matt-Yorkley
c209be9c17 Clarify params
Spree::Order.to_param outputs the order *number* (not the id) when used to build URLs. This makes it a bit more explicit.
2022-01-14 19:41:08 +00:00
Matt-Yorkley
12f7fc98fa Move payment authorization to StripeController
This Stripe-payment-authorizing logic is used by backoffice and subscriptions orders (but not the checkout), and was previously being handled by the #show action in Spree::OrdersController. It involves the user being redirected back to OFN after visiting a Stripe URL.
2022-01-14 19:41:08 +00:00
Matt-Yorkley
6c2b623f8b Tidy up OrderController 2022-01-14 19:41:08 +00:00
Matt-Yorkley
c65beae869 Extract some methods and move to simpler callbacks with guard clauses 2022-01-14 19:41:08 +00:00
Matt-Yorkley
c4d55feac8 Extract #last_payment 2022-01-14 19:41:08 +00:00
Matt-Yorkley
ddf6e7eadd Use proper module/namespace 2022-01-14 19:41:08 +00:00
Matt-Yorkley
410485fbf4 Use #order_failed_route in #process_order_completion! 2022-01-14 19:41:08 +00:00
Matt-Yorkley
072f4f4c60 Use new stripe confirm path and remove dead code 2022-01-14 19:41:08 +00:00
Matt-Yorkley
3f3bfadb59 Simplify StripeScaPaymentAuthorize and clarify both return URL types (checkout and off-session) 2022-01-14 19:41:08 +00:00
Matt-Yorkley
789c29f678 Extract #load_checkout_order 2022-01-14 19:41:08 +00:00
Matt-Yorkley
daee5b49b5 Extract #process_payment_completion! 2022-01-14 19:41:08 +00:00
Matt-Yorkley
76647863e8 Add new Stripe controller 2022-01-14 19:41:08 +00:00
Matt-Yorkley
28d89103eb Extract #gateway_error 2022-01-14 19:41:08 +00:00
Matt-Yorkley
7633255bea Extract #order_failed_route 2022-01-14 19:41:08 +00:00
Matt-Yorkley
414e1eb299 Tidy up OrdersController#load_order 2022-01-14 19:41:08 +00:00
Matt-Yorkley
6385d9a782 Simplify interface of #order_completion_route 2022-01-14 19:41:08 +00:00
Matt-Yorkley
7cbdb7c1a2 Remove paypal-specific workaround from OrdersController
The previous commit means this is no longer needed here.
2022-01-14 19:41:08 +00:00
Matt-Yorkley
1b459b2491 Extract #processing_failed 2022-01-14 19:41:08 +00:00
Matt-Yorkley
c1defdb1ff Extract #order_processing_error 2022-01-14 19:41:08 +00:00
Matt-Yorkley
5c44614a8d Extract and standardise payment/checkout #processing_succeeded 2022-01-14 19:41:08 +00:00
Matt-Yorkley
96f30133a7 Don't reset order for split checkout
The various places where we "reset" an order to cart state if a checkout submission does not succeed are an artifact of the process-all-the-steps-at-once approach of the current checkout.
2022-01-14 19:41:08 +00:00
Matt-Yorkley
1e21a6a32f Extract and standardise use of #handle_insufficient_stock 2022-01-14 19:41:08 +00:00
Matt-Yorkley
b6cf6483f2 Extract and standardise use of order loading around checkout processing 2022-01-14 19:41:08 +00:00
Matt-Yorkley
4d6c4f850f Remove pointless callbacks in CheckoutController
These exact same checks are already made in #load_order (and #order_invalid_for_checkout?), which is called before these other two (later) callbacks.
2022-01-14 19:41:08 +00:00
Matt-Yorkley
77d89ec7d0 Extract and standardise use of #order_completion_route 2022-01-14 19:41:08 +00:00
Matt-Yorkley
4c1fc2b326 Standardise use of #order_completion_reset 2022-01-14 19:41:08 +00:00
Matt-Yorkley
124b63fad0 Remove unused flash assignment 2022-01-14 19:41:08 +00:00
Matt-Yorkley
01bd77e437 Remove duplicate translation key 2022-01-14 19:41:08 +00:00
Matt-Yorkley
e58b1b1094 Tidy up before and after callbacks 2022-01-14 19:41:08 +00:00
Matt-Yorkley
9b6d4da8d5 Pull related lines into OrderCompletion#order_completion_reset 2022-01-14 19:41:08 +00:00
Matt-Yorkley
02995530e2 Pull apart OrderCompletionReset service 2022-01-14 19:41:08 +00:00
Matt-Yorkley
67b8a55273 Separate OrderCompletionReset from Checkout::PostCheckoutActions and don't pass controller objects to Checkout::PostCheckoutActions
We need to separate some of these bits to make them easier to call in different contexts. Also there's some weird stuff happening here with the controller being passed in to the service, and it seems like a code smell to me...
2022-01-14 19:41:08 +00:00
Matt-Yorkley
ad60f2392a Delete unused return statement 2022-01-14 19:41:08 +00:00
Matt-Yorkley
06eb98bdf4 Extract #valid_order_line_items? 2022-01-14 19:41:08 +00:00
Jean-Baptiste Bellet
36db396fe5 Do not redirect if user is logged in 2022-01-10 10:02:08 +01:00
Jean-Baptiste Bellet
9a74934f79 Do not redirect to /guest if step is specified 2022-01-10 09:40:16 +01:00
Jean-Baptiste Bellet
b1524aa0bd Guard clause: redirect to /guest when POST
When there is no connected user, and when the distributor doesn't allow guest orders, redirect on POST method
2022-01-10 09:39:46 +01:00
Jean-Baptiste Bellet
f2c3a380ac Redirect to /guest if distributor doesn't allow guest order 2022-01-10 09:39:46 +01:00
Jean-Baptiste Bellet
2929b6278d Redirect to /guest if no step required and no current connected user 2022-01-10 09:39:45 +01:00
Matt-Yorkley
99b75c9a6a Adjust usage of remote-method links on credit card deletion 2022-01-08 16:54:23 +00:00
Matt-Yorkley
3ad17aedd4 Merge pull request #8634 from Matt-Yorkley/order-tokens
Clarify use of order tokens
2022-01-04 13:05:41 +00:00
Filipe
13d04c367d Merge pull request #8636 from Matt-Yorkley/stripe-auth-emails
Stripe auth email sending; quick tidy up
2022-01-04 11:01:47 +00:00
Filipe
750411fd15 Merge pull request #8592 from openfoodfoundation/gateway-redirects
Refactor payment gateway redirects handling
2021-12-23 21:35:45 +00:00
Filipe
20c0195584 Merge pull request #8017 from cillian/hide-variants-with-no-stock
When creating backoffice orders hide variants with no stock by default
2021-12-23 21:34:06 +00:00
Filipe
b256696544 Merge pull request #8549 from mkllnk/deprecate-stripe-connect
Hide old "Stripe" (StripeConnect) payment method type, keep new Stripe SCA
2021-12-23 21:33:42 +00:00
Matt-Yorkley
f0d54dd083 Tidy up #redirect_to_payment_gateway 2021-12-22 09:58:08 +00:00
Matt-Yorkley
8016e90e07 Ensure payment method is actually selected 2021-12-20 18:47:22 +00:00
Maikel Linke
6d1e984af7 Enable testers to activate StripeConnect
This will make it easier to test the removal of StripeConnect.
2021-12-20 17:16:39 +11:00