app/models/order_import.rb
#
# Process each line of CSV file in #upload_file.
#
# if fail_on_error
#   If an error is encountered create the exact
#   same CSV with the error annotated in a new error column.
#   Save error file to #error_file.
# else
#   Save all valid orders and keep track of any failures.
#   At end of processing create a #error_file out of the failures.
#   Include each failed line with the error annotated in a new error column.
# end
#
# Be sure to honor #send_receipts
#
Process each line of CSV file in #upload_file.
if fail_on_error
If an error is encountered create the exact
same CSV with the error annotated in a new error column.
Save error file to #error_file.
else
Save all valid orders and keep track of any failures.
At end of processing create a #error_file out of the failures.
Include each failed line with the error annotated in a new error column.
end

Be sure to honor #send_receipts
Process each line of CSV file in #upload_file . if fail_on_error If an error is encountered create the exact same CSV with the error annotated in a new error column . Save error file to #error_file . else Save all valid orders and keep track of any failures . At end of processing create a #error_file out of the failures . Include each failed line with the error annotated in a new error column . end Be sure to honor #send_receipts
def process_upload!
    init_error_report
    if fail_on_error?
      handle_save_nothing_on_error
    else
      handle_save_clean_orders
    end
    store_error_report if result.failed?
    self.processed_at = Time.zone.now
    save!
  end
def process_upload! init_error_report if fail_on_error? handle_save_nothing_on_error else handle_save_clean_orders end store_error_report if result . failed? self . processed_at = Time . zone . now save! end
Process each line of CSV file in #upload_file.
Process each line of CSV file in #upload_file .