Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions core/app/models/spree/order_shipping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def ship(inventory_units:, stock_location:, address:, shipping_method:,

send_shipment_email(carton) if stock_location.fulfillable? && !suppress_mailer # e.g. digital gift cards that aren't actually shipped
fulfill_order_stock_locations(stock_location)
update_order_state
@order.update!

carton
end
Expand All @@ -85,14 +85,6 @@ def fulfill_order_stock_locations(stock_location)
Spree::OrderStockLocation.fulfill_for_order_with_stock_location(@order, stock_location)
end

def update_order_state
new_state = Spree::OrderUpdater.new(@order).update_shipment_state
@order.update_columns(
shipment_state: new_state,
updated_at: Time.now,
)
end

def send_shipment_email(carton)
Spree::CartonMailer.shipped_email(carton.id).deliver_later
end
Expand Down
14 changes: 2 additions & 12 deletions core/app/models/spree/payment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,8 @@ def invalidate_old_payments
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.persist_totals
if order.completed? || completed? || void?
order.update!
end
end

Expand Down