Class: ShopifyTransporter::Pipeline::Magento::Order::TopLevelAttributes

Inherits:
Stage
  • Object
show all
Defined in:
lib/shopify_transporter/pipeline/magento/order/top_level_attributes.rb

Instance Attribute Summary

Attributes inherited from Stage

#params

Instance Method Summary collapse

Methods inherited from Stage

#initialize

Constructor Details

This class inherits a constructor from ShopifyTransporter::Pipeline::Stage

Instance Method Details

#convert(hash, record) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/shopify_transporter/pipeline/magento/order/top_level_attributes.rb', line 10

def convert(hash, record)
  record.merge!(
    {
      name: hash['increment_id'],
      email: hash['customer_email'],
      currency: hash['order_currency_code'],
      cancelled_at: cancelled_at(hash),
      closed_at: closed_at(hash),
      processed_at: hash['created_at'],
      subtotal_price: hash['subtotal'],
      total_tax: hash['tax_amount'],
      total_price: hash['grand_total'],
      source_name: ORDER_ORIGINATED_FROM,
      total_weight: hash['weight'],
      financial_status: financial_status(hash),
      fulfillment_status: fulfillment_status(hash),
    }.stringify_keys
  )
  customer = build_customer(hash)
  record['customer'] = customer unless customer.empty?
  record
end