Extract order-updating logic to Order::Updater

This commit is contained in:
Matt-Yorkley
2021-04-26 08:55:14 +01:00
parent 8e10f7af0e
commit 00c4a28d22
3 changed files with 27 additions and 15 deletions

View File

@@ -201,19 +201,7 @@ module Spree
end
def update_order
if completed? || void?
order.updater.update_payment_total
end
if order.completed?
order.updater.update_payment_state
order.updater.update_shipments
order.updater.update_shipment_state
end
if self.completed? || order.completed?
order.updater.persist_totals
end
OrderManagement::Order::Updater.new(order).after_payment_update(self)
end
# Necessary because some payment gateways will refuse payments with