mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-08 07:46:59 +00:00
Clear adjustments on subs orders when no items are able to be fulfilled
This prevents shipping and payment fees from being displayed in the notification email
This commit is contained in:
committed by
Maikel Linke
parent
514ad5d898
commit
50ffd7ca01
@@ -34,6 +34,7 @@ class SubscriptionPlacementJob
|
||||
|
||||
changes = cap_quantity_and_store_changes(order)
|
||||
if order.line_items.where('quantity > 0').empty?
|
||||
order.adjustments.destroy_all
|
||||
return send_empty_email(order, changes)
|
||||
end
|
||||
|
||||
|
||||
@@ -147,8 +147,9 @@ describe SubscriptionPlacementJob do
|
||||
allow(job).to receive(:unavailable_stock_lines_for) { order.line_items }
|
||||
end
|
||||
|
||||
it "does not place the order, sends an empty_order email" do
|
||||
it "does not place the order, clears, all adjustments, and sends an empty_order email" do
|
||||
expect{ job.send(:process, order) }.to_not change{ order.reload.completed_at }.from(nil)
|
||||
expect(order.reload.adjustments).to be_empty
|
||||
expect(job).to_not have_received(:send_placement_email)
|
||||
expect(job).to have_received(:send_empty_email)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user