Add Bugsnag notice when an OC closes during checkout completion

This info could be useful to know whilst debugging order completion issues.
This commit is contained in:
Matt-Yorkley
2021-11-14 12:34:49 +00:00
parent 00862844d5
commit 48acc0ecd0
2 changed files with 3 additions and 1 deletions

View File

@@ -153,9 +153,11 @@ class ApplicationController < ActionController::Base
def check_order_cycle_expiry
if current_order_cycle&.closed?
Bugsnag.notify("Notice: order cycle closed during checkout completion", order: current_order)
current_order.empty!
current_order.set_order_cycle! nil
flash[:info] = I18n.t('order_cycle_closed')
redirect_to main_app.shop_path
end
end

View File

@@ -102,7 +102,7 @@ describe BaseController, type: :controller do
it "redirects to shopfront with message if order cycle is expired" do
expect(controller).to receive(:current_order_cycle).and_return(oc)
expect(controller).to receive(:current_order).and_return(order).twice
expect(controller).to receive(:current_order).and_return(order).at_least(:twice)
expect(oc).to receive(:closed?).and_return(true)
expect(order).to receive(:empty!)
expect(order).to receive(:set_order_cycle!).with(nil)