Commit Graph

110 Commits

Author SHA1 Message Date
Jean-Baptiste Bellet
6f8ab56d2e Replace deprecated call render operations:
```
DEPRECATED: CableReady's `render operations:` call has been renamed to `render cable_ready:`. Please update your render call.
```
2023-04-05 14:19:34 +10:00
Jean-Baptiste Bellet
4ad2a1a723 Prefer a concern that set a variable instead of a global helper
Therefor, for the right controllers, simply implements:

```
include WhiteLabel

before_action :hide_ofn_navigation, only: [:show, :edit]
```

This is mort robust, since we're working in a controller level, not parsing URLs...
2023-03-30 09:17:57 +11:00
David Cook
788457618f Check ship address required based on all available methods
This check was implemented based on 'allowed' shipping methods, but we need to revert that logic. So for now, we can check all 'available' shipping methods.

This could potentially result in the same query being run twice, because load_shipping_methods also loads it. I opted to keep things simple and not try to optimise here.
2023-03-17 13:06:45 +11:00
David Cook
ef607da2c1 Revert "Fix: Customers can checkout with non-matching shipping and product categories" 2023-03-17 10:40:53 +11:00
Gaetan Craig-Riou
23c4298519 Fix bug when in specific scenario user couldn't proceed to payment step
When using a "pick up" shipping method, with a user who doesn't have a shipping address it was impossible to proceed to the payment step because shipping address was invalid.

To fix this, we ensure that "ship_address_same_as_billing" parameter is set to true when using a "pick up" shipping method.

use distributor address when shipping method doesn't require a ship address ; in doing this we follow the same logic as the legacy checkout
2023-03-08 10:49:37 +01:00
Mohamed ABDELLANI
348f806bbe remove load_shipping_methods 2023-03-01 10:53:03 +01:00
Mohamed ABDELLANI
eab8e2be6c load exclusively the shipping methods that support all the shipping categories of the line items 2023-03-01 10:51:27 +01:00
Jean-Baptiste Bellet
08fb496f55 Don't need to show any ship_address errors if no ship selected nor
if the ship_address is the same than the billing one
2023-02-15 09:52:24 +01:00
Jean-Baptiste Bellet
a39598d049 Reorder error messages to improve readability
tbs;
2023-02-15 09:52:10 +01:00
Jean-Baptiste Bellet
9a03023b6b Replace bill_address phone by Customer phone to improve readability
TBS;
2023-02-15 09:44:26 +01:00
Jean-Baptiste Bellet
32fc1eae61 Remove ship_address errors if shipping method isn't selected 2023-02-13 21:06:41 +01:00
Maikel Linke
882d7a1215 Simplify method according to style rules 2023-01-25 15:49:44 +11:00
Maikel Linke
ab7e1ac39f Display error messages to user for convencience
It will also help us to debug the application if the error is not
obvious.
2023-01-25 14:50:28 +11:00
Mohamed ABDELLANI
84aedaa1a1 run process_payments before order confirmation 2022-12-08 11:13:54 +01:00
Jean-Baptiste Bellet
86cb86e8b5 Add a flash error where no available shipping methods to the customer
+ update specs as well
2022-09-12 09:42:26 +02:00
Maikel Linke
1d04510365 Update totals on summary step 2022-09-05 15:54:33 +10:00
Maikel Linke
6c7a089527 Recalculate tax on summary step 2022-09-05 15:14:08 +10:00
Jean-Baptiste Bellet
77eec6e6f3 Check step params and redirect if step is inconsistent to order state 2022-08-15 16:13:37 +10:00
Jean-Baptiste Bellet
61f8dfd809 Add order_token params to the redirect URL after checkout 2022-05-09 17:45:52 +02:00
Jean-Baptiste Bellet
8bbb80ef55 Catch GatewayError exception and handle by updating flash[:error] 2022-04-27 15:43:05 +02:00
Maikel Linke
742ae761a3 Move helper statement to controller
It's not available in concerns.
2022-03-28 11:34:37 +11:00
Filipe
1522263cfc Merge pull request #8893 from jibees/8889-handle-redirect-to-next-step-for-the-split-checkout
SplitCheckout: handle navigation between steps
2022-03-10 16:07:58 +00:00
Jean-Baptiste Bellet
f47de45346 Reference splitcheckout as a checkout redirect
This stored in session value is used to redirect after login

Update tests as well, thanks @filipefurtad0 ! 🙏
2022-03-01 15:12:18 +01:00
Jean-Baptiste Bellet
e47198f1e5 Handle both types of redirection
One is based on the order step itself, the other is based on the current step passed through the params
2022-02-28 15:23:37 +01:00
Filipe
e403fc171d Merge pull request #8808 from Matt-Yorkley/login-modal
Remove all Angular code from Login/Signup process
2022-02-03 19:36:44 +00:00
Matt-Yorkley
f3792acf55 Drop workaround previously required to avoid a bug caused by the stringex gem 2022-01-29 14:49:23 +00:00
Matt-Yorkley
6c6e5ca316 Ensure fees are applied during checkout 2022-01-28 11:38:23 +00:00
Matt-Yorkley
b5a1d9ebef Allow using saved cards at checkout 2022-01-24 23:06:43 +00:00
Matt-Yorkley
8552da2377 Extract and stub PaymentMethodFetcher 2022-01-24 20:28:59 +00:00
Matt-Yorkley
167adb3ddc Memoize selected_payment_method 2022-01-24 20:28:59 +00:00
Matt-Yorkley
50b82d347b Redirect to payment gateway during order confirmation 2022-01-24 20:28:59 +00:00
Matt-Yorkley
0f154de235 Use OrderCompletion in split checkout for #order_completion_reset 2022-01-19 17:51:03 +00:00
Filipe
7444e2d2f3 Merge pull request #8741 from Matt-Yorkley/guest-checkout-login
Fix split checkout guest user login
2022-01-19 16:43:24 +00:00
Matt-Yorkley
fb00a51ae8 Merge pull request #8653 from Matt-Yorkley/split-checkout-t-and-c
Split checkout T&Cs
2022-01-19 13:39:15 +00:00
Matt-Yorkley
8ce27bed86 Move guest checkout handling to the frontend 2022-01-19 13:14:10 +00:00
Matt-Yorkley
7c2b3cdf51 Fix param whitelisting
Co-authored-by: Maikel <maikel@email.org.au>
2022-01-18 09:14:55 +00:00
Matt-Yorkley
1d4803c31a Whitelist valid step param values 2022-01-13 13:55:33 +00:00
Matt-Yorkley
18cdf98aa1 Set terms and conditions accepted when completing checkout 2022-01-12 22:17:22 +00:00
Matt-Yorkley
f2c506a292 Update and extract summary_step? check 2022-01-12 22:17:22 +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
8016e90e07 Ensure payment method is actually selected 2021-12-20 18:47:22 +00:00
Luis Azcuaga
e8fd89a6d2 Run rubocop over existing todo 2021-10-25 21:28:28 -05:00
Matt-Yorkley
8bf3f72ad3 Extract CableCar responses code to a concern 2021-09-08 10:34:34 +01:00
Matt-Yorkley
5ef34347a3 Implement optional non-Angular flash messages 2021-09-08 10:34:34 +01:00
Matt-Yorkley
e48b9d84e5 Extract boilerplate code 2021-09-08 10:34:34 +01:00
Matt-Yorkley
03abc395f2 Update responses to use cable_ready 2021-09-08 10:34:34 +01:00