Class: EPlat::Mapping::Bigcommerce::V3::Order

Inherits:
EPlat::Mapping::Base show all
Defined in:
lib/e_plat/mapping/bigcommerce/v_3/order.rb,
lib/e_plat/mapping/bigcommerce/v_3/order/billing_address.rb

Defined Under Namespace

Classes: BillingAddress, LineItem, ShippingAddress

Constant Summary

Constants inherited from EPlat::Mapping::Base

EPlat::Mapping::Base::DEFAULT_VALUES

Instance Attribute Summary

Attributes inherited from EPlat::Mapping::Base

#resource, #virtual_collection

Instance Method Summary collapse

Methods inherited from EPlat::Mapping::Base

#aliases, #e_plat_key_to, #initialize, #inspect, #keys_aliased_to_native_keys, #mappable_keys, #mappings, #native_key_to, #native_setter, #to_e_plat_keys, #to_native_keys, #via_native_attributes_where_possible, virtual_collection

Methods included from RequestBodyRoot

#include_root_in_request_body?

Constructor Details

This class inherits a constructor from EPlat::Mapping::Base

Instance Method Details

#native_attribute_aliasesObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/e_plat/mapping/bigcommerce/v_3/order.rb', line 88

def native_attribute_aliases
  super.concat([
	{
		alias_attribute: {native_key: "date_created", e_plat_key: "created_at"}
	  },
	  {
		alias_attribute: {native_key: "date_modified", e_plat_key: "updated_at"}
	  },
	  {
		alias_attribute: {native_key: "status_id", e_plat_key: "financial_status",
			custom_e_plat_getter: "-> (status_id) { 
				case status_id.to_i
				when 1 then 'pending'
				when 4 then 'refunded'
				when 5 then 'cancelled' # not a valid status for Shopify. just used in this BG specific mapping
				when 7 then 'unpaid'
				when 11 then 'paid'
				else nil
				end
			}",
			custom_native_setter: "-> (financial_status) { 
				case financial_status
				when 'pending' then 1
				when 'refunded' then 4
				when 'cancelled' then 5
				when 'unpaid' then 7
				when 'paid' then 11
				else nil
				end
			}"
		}
	  },
	  {
		existing_entry: {native_key: "billing_address", e_plat_key: "billing_address"}
	  },
	  {
		alias_attribute: {native_key: "currency_code", e_plat_key: "currency"}
	  },
	  {
		alias_attribute: {native_key: 'subtotal_ex_tax', e_plat_key: 'subtotal_price'} #poundage string. eg "5.31"
	  },
	  {
		existing_entry: {native_key: 'total_tax', e_plat_key: 'total_tax'} #poundage string. eg "5.31"
	  },
	  {
		alias_attribute: {native_key: 'total_inc_tax', e_plat_key: 'total_price'} #poundage string. eg "5.31"
	  },
	  {
		existing_entry: {native_key: 'id', e_plat_key: 'id'}
	  },
	  {
		existing_entry: {native_key: 'customer_locale', e_plat_key: 'customer_locale'} #e.g. "en-{optional_country_code}"
	  },
	  {
		alias_attribute: {native_key: "total_inc_tax", e_plat_key: "current_total_price"}
	  },
	  {
		alias_attribute: {native_key: "discount_amount", e_plat_key: "current_total_discounts"} #poundage string. eg "9.99"
	  },
	  {
		alias_attribute: {native_key: "id", e_plat_key: "order_number"}
	  },
	  {
		alias_attribute: {native_key: "staff_notes", e_plat_key: "note"}
	  },
	  {
		alias_attribute: {native_key: "billing_address[email]", e_plat_key: "email"}
	  }
  ])
end

#native_attributesObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/e_plat/mapping/bigcommerce/v_3/order.rb', line 12

def native_attributes
  super.concat([
	"id",
	"customer_id",
	"date_created",
	"date_modified",
	"date_shipped",
	"status_id",
	"status",
	"subtotal_ex_tax",
	"subtotal_inc_tax",
	"subtotal_tax",
	"base_shipping_cost",
	"shipping_cost_ex_tax",
	"shipping_cost_inc_tax",
	"shipping_cost_tax",
	"shipping_cost_tax_class_id",
	"base_handling_cost",
	"handling_cost_ex_tax",
	"handling_cost_inc_tax",
	"handling_cost_tax",
	"handling_cost_tax_class_id",
	"base_wrapping_cost",
	"wrapping_cost_ex_tax",
	"wrapping_cost_inc_tax",
	"wrapping_cost_tax",
	"wrapping_cost_tax_class_id",
	"total_ex_tax",
	"total_inc_tax",
	"total_tax",
	"items_total",
	"items_shipped",
	"payment_method",
	"payment_provider_id",
	"payment_status",
	"refunded_amount",
	"order_is_digital",
	"store_credit_amount",
	"gift_certificate_amount",
	"ip_address",
	"ip_address_v6",
	"geoip_country",
	"geoip_country_iso2",
	"currency_id",
	"currency_code",
	"currency_exchange_rate",
	"default_currency_id",
	"default_currency_code",
	"staff_notes",
	"customer_message",
	"discount_amount",
	"coupon_discount",
	"shipping_address_count",
	"is_deleted",
	"ebay_order_id",
	"cart_id",
	"billing_address",
	"is_email_opt_in",
	"credit_card_type",
	"order_source",
	"channel_id",
	"external_source",
	"products",
	"shipping_addresses",
	"coupons",
	"external_id",
	"external_merchant_id",
	"tax_provider_id",
	"store_default_currency_code",
	"store_default_to_transactional_exchange_rate",
	"custom_status",
	"customer_locale",
	"external_order_id"
  ])
end

#native_top_keyObject



8
9
10
# File 'lib/e_plat/mapping/bigcommerce/v_3/order.rb', line 8

def native_top_key
	"data"
end