mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user