Commit Graph

18 Commits

Author SHA1 Message Date
Rob Harrington
82072c8970 Explicitly specifying 'type: :controller' for all controller specs 2017-11-10 08:47:12 +11:00
Rob Harrington
1fcbf6b44d Clear shipping_method_id from order when restarting checkout
If the order is allowed to retain a shipping_method_id, then subsequent
saves of the order will cause a new shipment to be initialised. Seems to
only happen for delivery shipping methods. This is undesirable because
fees for the new shipment will appear in the checkout summary, which is
not smart enough to recognise existing shipment fees and adjust the order
total accordingly.
2017-10-13 12:53:35 +11:00
Rob Harrington
f96502c369 Add unit specs for CheckoutController#restart_checkout 2017-10-13 12:53:35 +11:00
Rob Harrington
64009a2c9e CheckoutController can render payment gateway error messages as json 2017-09-23 14:58:32 +10:00
Pau Perez
e087a008c2 Reduce coupling from controller 2017-09-08 23:55:50 +10:00
Pau Perez
4c4969e86b Do not couple with controller's ivar and session 2017-09-08 23:55:50 +10:00
Pau Perez
1ef4bf5da0 Refactor tests and remove duplicated ones 2017-09-08 23:55:50 +10:00
Pau Perez
bdfd718c51 Use service object directly from controller 2017-09-08 23:55:50 +10:00
Pau Perez
3c73282d57 Manually reset the order once completed
Spree does not call after_<order.state> methods any more as of
https://github.com/spree/spree/pull/2557, so our #after_complete method
is never triggered and thus the order never reset.

This makes the condition:

```ruby
if current_order.andand.distributor == @order.distributor
```

in app/views/spree/orders/form/_update_buttons.html.haml return false
and as a result the "Back To Cart" button is not shown.

This commit resets the order (emptying the session[:order_id] and
creating a new order, aka. cart) right from the
CheckoutController#update rather than relying on infernal callbacks (of
what the Spree core team itself was unhappy about since long ago
https://github.com/spree/spree/issues/2488). There is the first place
where we know the order has been successfully completed.
2017-09-08 23:55:50 +10:00
Rohan Mitchell
dac90c8003 Fix specs 2016-04-21 09:36:23 +10:00
Rohan Mitchell
a3874d42af Spec moved to OpenFoodNetwork::LastUsedAddress 2015-12-11 13:25:40 +11:00
Rohan Mitchell
8deb4ef9d4 When encountering StaleObjectError when checking out, retry 2015-07-10 09:42:09 +10:00
Maikel Linke
082a3cd9ab Creating simple_order_cycle instead of order_cycle
Speedup on my machine:
 1 minute 44.52 seconds
 21.9 seconds
2014-11-28 12:29:47 +11:00
Rohan Mitchell
fdbb274667 Allow browsing products (but not cart/checkout) for hubs that are not ready for checkout 2014-11-05 14:29:36 +11:00
Rohan Mitchell
3b28981400 Adapt cancel redirect for better spree paypal express 2014-07-25 12:44:14 +10:00
Rohan Mitchell
ba964d54d9 Update spree and spree_auth_devise 2014-07-04 17:07:58 +10:00
Will Marshall
23fa1c7b7b Patching a couple more issues 2014-05-02 15:17:44 +10:00
Will Marshall
b907616749 Renaming our partials 2014-05-02 14:47:12 +10:00