lib/loaders/spree/shopify_order_migrator.rb
def finish

        return unless(load_object && load_object.id)    # Ok we have added all Line Items - now complete existing order

        load_object.create_proposed_shipments

        # 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.shipment_state = 'shipped'
        load_object.state = 'complete'

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

        load_object.id = nil if(load_object.id == 0)   # why the hell is this 0 happening !?

        begin
          load_object.save!    # ok this Order done
        rescue => x
          logger.error("Final Spree Order save failed : #{load_object.errors.full_messages.inspect}")
          puts x.inspect
        end

      end
# Options
#
#  :reload           : Force load of the method dictionary for object_class even if already loaded
#  :verbose          : Verbose logging and to STDOUT
#
Options
:reload           : Force load of the method dictionary for object_class even if already loaded
:verbose          : Verbose logging and to STDOUT
Options : reload : Force load of the method dictionary for object_class even if already loaded : verbose : Verbose logging and to STDOUT
def finish
        return unless(load_object && load_object.id)    
        load_object.create_proposed_shipments
        load_object.shipments.each do |s|
          s.state = 'shipped'
          s.shipped_at = load_object.completed_at
        end
        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")
        load_object.id = nil if(load_object.id == 0)   
        begin
          load_object.save!    
        rescue => x
          logger.error("Final Spree Order save failed : #{load_object.errors.full_messages.inspect}")
          puts x.inspect
        end
      end
def finish return unless ( load_object && load_object . id ) load_object . create_proposed_shipments load_object . shipments . each do | s | s . state = 'shipped' s . shipped_at = load_object . completed_at end 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" ) load_object . id = nil if ( load_object . id == 0 ) begin load_object . save! rescue => x logger . error ( "Final Spree Order save failed : #{load_object.errors.full_messages.inspect}" ) puts x . inspect end end
Options
:reload           : Force load of the method dictionary for object_class even if already loaded
:verbose          : Verbose logging and to STDOUT
Options : reload : Force load of the method dictionary for object_class even if already loaded : verbose : Verbose logging and to STDOUT
# Ok we have added all Line Items - now complete existing order # Spree::Order.shipments is a CollectionProxy (empty if no shipments) # so each is safe to use # why the hell is this 0 happening !? # ok this Order done