mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
Merge pull request #3250 from coopdevs/open-adjustments-for-update
[Spree Upgrade] Open adjustments to enable update
This commit is contained in:
@@ -398,9 +398,11 @@ Spree::Order.class_eval do
|
||||
|
||||
def update_adjustment!(adjustment)
|
||||
return if adjustment.finalized?
|
||||
|
||||
state = adjustment.state
|
||||
adjustment.state = 'open'
|
||||
adjustment.update!
|
||||
update!
|
||||
adjustment.state = state
|
||||
end
|
||||
|
||||
|
||||
@@ -677,11 +677,9 @@ describe Spree::Order do
|
||||
|
||||
context "removing line_items" do
|
||||
it "updates shipping and transaction fees" do
|
||||
# Setting quantity of an item to zero
|
||||
order.update_attributes(line_items_attributes: [{id: order.line_items.first.id, quantity: 0}])
|
||||
order.line_items.first.update_attribute(:quantity, 0)
|
||||
order.save
|
||||
|
||||
# Check if fees got updated
|
||||
order.reload
|
||||
expect(order.adjustment_total).to eq expected_fees - shipping_fee - payment_fee
|
||||
expect(order.shipment.adjustment.included_tax).to eq 0.6
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user