Skip to content

Commit

Permalink
Merge pull request #43 from prachetasp/fix/set_shipment_state
Browse files Browse the repository at this point in the history
Sets order.shipment_state and cleans up shipments block
  • Loading branch information
tom statter committed Apr 23, 2015
2 parents e98930c + d18d17e commit 37f79a7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/loaders/spree/shopify_order_migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,15 @@ def finish

load_object.create_proposed_shipments

if(load_object.shipments.first)
load_object.shipments.first.state = 'shipped'
load_object.shipments.first.shipped_at = load_object.completed_at
# Spree::Order.shipments is a CollectionProxy (empty if no shipments)
# so each is safe to use
load_object.shipments.each do |s|
s.state = 'shipped'
s.shipped_at = load_object.completed_at
end

load_object.payment_state = "paid"

load_object.payment_state = 'paid'
load_object.shipment_state = 'shipped'
load_object.state = 'complete'

logger.info("Order #{load_object.id}(#{load_object.number}) state set to 'complete' - Final Save")
Expand Down

0 comments on commit 37f79a7

Please sign in to comment.