Merge pull request #3539 from Matt-Yorkley/subs/confirmation_email

Don't process proxy_order if the order has been cancelled
This commit is contained in:
Pau Pérez Fabregat
2019-03-05 17:38:29 +01:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ class SubscriptionConfirmJob
def proxy_orders
ProxyOrder.not_canceled.where('confirmed_at IS NULL AND placed_at IS NOT NULL')
.joins(:order_cycle).merge(recently_closed_order_cycles)
.joins(:order).merge(Spree::Order.complete)
.joins(:order).merge(Spree::Order.complete.not_state('canceled'))
end
def recently_closed_order_cycles

View File

@@ -58,6 +58,12 @@ describe SubscriptionConfirmJob do
proxy_order.update_attributes!(confirmed_at: 1.second.ago)
expect(proxy_orders).to_not include proxy_order
end
it "ignores orders that have been cancelled" do
setup_email
proxy_order.order.cancel!
expect(proxy_orders).to_not include proxy_order
end
end
describe "performing the job" do