Class: Workarea::GlobalE::Merchant::Order

Inherits:
Object
  • Object
show all
Defined in:
app/services/workarea/global_e/merchant/order.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Order

Returns a new instance of Order.



7
8
9
# File 'app/services/workarea/global_e/merchant/order.rb', line 7

def initialize(hash)
  @hash = hash
end

Instance Attribute Details

#hashObject (readonly)

Returns the value of attribute hash.



5
6
7
# File 'app/services/workarea/global_e/merchant/order.rb', line 5

def hash
  @hash
end

Instance Method Details

#allow_mails_from_merchantBoolean

Indicates if the end customer has opted on Global-e checkout to receive emails from the Merchant.

Returns:

  • (Boolean)


133
134
# File 'app/services/workarea/global_e/merchant/order.rb', line 133

def allow_mails_from_merchant
end

#cart_hashString

Cart hash originally specified in merchantCartHash argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (String)


61
62
# File 'app/services/workarea/global_e/merchant/order.rb', line 61

def cart_hash
end

#cart_idString

Identifier of the cart on the Merchant’s site originally specified in merchantCartToken argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (String)


52
53
54
# File 'app/services/workarea/global_e/merchant/order.rb', line 52

def cart_id
  hash["CartId"]
end

#clear_cartBoolean

Indicates if the end customer’s cart must be cleared before this method finishes execution on the Merchant’s site.

Returns:

  • (Boolean)


124
125
126
# File 'app/services/workarea/global_e/merchant/order.rb', line 124

def clear_cart
  hash["ClearCart"]
end

#contains_clearance_fees_priceFloat

Contains clearance Fees (CCF), in the merchant currency. This amount is included in the TotalDutiesAndTaxesPrice but provided separately as well so it can be displayed independently or as part of the shipping cost, on the invoice.

Returns:

  • (Float)


419
420
421
# File 'app/services/workarea/global_e/merchant/order.rb', line 419

def contains_clearance_fees_price
  hash["CCFPrice"]
end

#culture_codeString

Returns:

  • (String)


17
18
19
# File 'app/services/workarea/global_e/merchant/order.rb', line 17

def culture_code
  hash["CultureCode"]
end

#currency_codeString

3-char ISO currency code for the order being posted. By default this is set to the original Merchant’s currency.

Returns:

  • (String)


77
78
79
# File 'app/services/workarea/global_e/merchant/order.rb', line 77

def currency_code
  hash["CurrencyCode"]
end

#customerWorkarea::GlobalE::Merchant::Customer

The paying customer’s preferences (Global-e acts as a paying customer).



299
300
301
# File 'app/services/workarea/global_e/merchant/order.rb', line 299

def customer
  @customer ||= Merchant::Customer.new hash["Customer"]
end

#customer_commentsString

Comments text entered by the end customer in Global-e checkout.

Returns:

  • (String)


220
221
# File 'app/services/workarea/global_e/merchant/order.rb', line 220

def customer_comments
end

#discounted_shipping_priceFloat

The shipping price paid by the customer converted to the merchant’s currency. Total Shipping price reducing Order Discounts (InternationalDetails.DiscountedShippingPrice price converted to the merchant currency).

Returns:

  • (Float)


380
381
382
# File 'app/services/workarea/global_e/merchant/order.rb', line 380

def discounted_shipping_price
  hash["DiscountedShippingPrice"]
end

#discountsArray<Workarea::GlobalE::Merchant::Discount>

The list of discounts being applied to the order, according to the original list of discounts received in SendCart for this order, and to the Merchant shipping configuration on Global-e.



274
275
276
# File 'app/services/workarea/global_e/merchant/order.rb', line 274

def discounts
  @discounts ||= hash["Discounts"].map { |d| Merchant::Discount.new d }
end

#do_not_charge_vatBoolean

Indicates if the end customer hasn’t been charged VAT in Global-e checkout, as specified in doNotChargeVAT argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (Boolean)


187
188
# File 'app/services/workarea/global_e/merchant/order.rb', line 187

def do_not_charge_vat
end

#free_shipping_coupon_codeString

Merchant’s free shipping coupon code applied by the end customer, as specified in FreeShippingCouponCode argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (String)


205
206
# File 'app/services/workarea/global_e/merchant/order.rb', line 205

def free_shipping_coupon_code
end

#international_detailsWorkarea::GlobalE::Merchant::InternationalDetails

Details referring to the end customer’s order placed on Global-e side. These details are applicable only to the Merchants dealing with international customers’ support themselves.



369
370
371
# File 'app/services/workarea/global_e/merchant/order.rb', line 369

def international_details
  @international_details ||= Merchant::InternationalDetails.new hash["InternationalDetails"]
end

#is_free_shippingBoolean

Indicates if the Merchant offers free international shipping to the end customer, as specified in IsFreeShipping argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (Boolean)


196
197
# File 'app/services/workarea/global_e/merchant/order.rb', line 196

def is_free_shipping
end

#is_replacement_orderBoolean

Indicates if the order is replacement.

Returns:

  • (Boolean)


396
397
# File 'app/services/workarea/global_e/merchant/order.rb', line 396

def is_replacement_order
end

#is_split_orderBoolean

Indicates if the order should be handled as split order (i.e. without consolidation)

Returns:

  • (Boolean)


227
228
# File 'app/services/workarea/global_e/merchant/order.rb', line 227

def is_split_order
end

#loyalty_codeString

Loyalty code applicable to the Merchant’s site entered by the end customer in Global-e checkout.

Returns:

  • (String)


162
163
# File 'app/services/workarea/global_e/merchant/order.rb', line 162

def loyalty_code
end

#loyalty_points_earnedFloat

Number of loyalty points to be earned for this purchase by the end customer on the Merchant’s site, as specified in loyaltyPointsEarned argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (Float)


154
155
# File 'app/services/workarea/global_e/merchant/order.rb', line 154

def loyalty_points_earned
end

#loyalty_points_spendFloat

Number of loyalty points spent for this purchase. The existing loyalty points handling procedure must be applied to the end customer’s user account. Therefore, “Loyalty points” type discount must not be applied to the order directly, but can be used for the display purposes elsewhere in the system (i.e in end user’s My Account page).

Returns:

  • (Float)


144
145
# File 'app/services/workarea/global_e/merchant/order.rb', line 144

def loyalty_points_spend
end

#markupsArray<Workarea::GlobalE::Merchant::Discount>

The list of markups being applied to the order, according to the Merchant shipping configuration on Global-e. Effectively Markup is a “negative Discount”. The main use case for Markups is when end customer is charged in Global-e checkout, a flat shipping rate, which is higher than the shipping rate, calculated for the respective order. In this case, Global-e pays the difference to the merchant in the form of Markups applied to the order.

Unlike Discounts, Markups may be only passed to the Merchant’s back-end ERP system for reconciliation purposes, and may not be displayed to the end customer.



292
293
# File 'app/services/workarea/global_e/merchant/order.rb', line 292

def markups
end

#merchant_guidString

Unique identifier of the Merchant on Global-e.

Returns:

  • (String)


25
26
27
# File 'app/services/workarea/global_e/merchant/order.rb', line 25

def merchant_guid
  hash["MerchantGUID"]
end

#merchant_order_idString

Order unique identifier on the Merchant’s site returned from a previous call to SendOrderToMerchant method for this order.

Returns:

  • (String)


42
43
44
# File 'app/services/workarea/global_e/merchant/order.rb', line 42

def merchant_order_id
  hash["MerchantOrderId"]
end

#order_idString

Global-e order unique identifier.

Returns:

  • (String)


33
34
35
# File 'app/services/workarea/global_e/merchant/order.rb', line 33

def order_id
  hash["OrderId"]
end

#original_orderWorkarea::GlobalE::Merchant::OriginalOrder

Details reffering to the original order if the current order is replacement.



403
404
# File 'app/services/workarea/global_e/merchant/order.rb', line 403

def original_order
end

#ot_currency_codeString

Currency of the onetime voucher code used to place the order

Returns:

  • (String)


241
242
# File 'app/services/workarea/global_e/merchant/order.rb', line 241

def ot_currency_code
end

#ot_voucher_amountFloat

Amount taken off the voucher when applicable

Returns:

  • (Float)


248
249
# File 'app/services/workarea/global_e/merchant/order.rb', line 248

def ot_voucher_amount
end

#ot_voucher_codeString

Onetime voucher code used to place the order

Returns:

  • (String)


234
235
# File 'app/services/workarea/global_e/merchant/order.rb', line 234

def ot_voucher_code
end

#payment_detailsWorkarea::GlobalE::Merchant::PaymentDetails

The paying customer’s payment details.



333
334
335
# File 'app/services/workarea/global_e/merchant/order.rb', line 333

def payment_details
  @payment_details ||= Merchant::PaymentDetails.new hash["PaymentDetails"]
end

#pre_pay_offeredBoolean

Indicates if the prepayment option for duties and taxes was offered to the customer.

Returns:

  • (Boolean)


389
390
# File 'app/services/workarea/global_e/merchant/order.rb', line 389

def pre_pay_offered
end

#price_coefficient_rateFloat

CountryCoefficient rate applied to the prices in this order.

Returns:

  • (Float)


85
86
87
# File 'app/services/workarea/global_e/merchant/order.rb', line 85

def price_coefficient_rate
  hash["PriceCoefficientRate"]
end

#primary_billingWorkarea::GlobalE::Merchant::CustomerDetails

Primary customer’s billing details. Primary customer denotes the paying (Global-e) customer unless Customer.IsEndCustomerPrimary is not set to TRUE. Note that all string attributes of end customer’s details are indicated in URL encoded form. Therefore, if Customer.IsEndCustomerPrimary is TRUE then all string attributes in PrimaryBilling are URL encoded.



312
313
314
# File 'app/services/workarea/global_e/merchant/order.rb', line 312

def primary_billing
  @primary_billing ||= Merchant::CustomerDetails.new hash["PrimaryBilling"], url_encoded: customer.is_end_customer_primary
end

#primary_shippingWorkarea::GlobalE::Merchant::CustomerDetails

Primary customer’s shipping details. Primary customer denotes the paying (Global-e) customer unless Customer.IsEndCustomerPrimary is not set to TRUE. Note that all string attributes of end customer’s details are indicated in URL encoded form. Therefore, if Customer.IsEndCustomerPrimary is TRUE then all string attributes in PrimaryShipping are URL encoded



325
326
327
# File 'app/services/workarea/global_e/merchant/order.rb', line 325

def primary_shipping
  @primary_shipping ||= Merchant::CustomerDetails.new hash["PrimaryShipping"], url_encoded: customer.is_end_customer_primary
end

#productsArray<Workarea::GlobalE::Merchant::Product>

The list of products being purchased



264
265
266
# File 'app/services/workarea/global_e/merchant/order.rb', line 264

def products
  @products ||= hash["Products"].map { |p| Merchant::Product.new p }
end

#rounding_rateFloat

Average conversion rate applied to the prices paid by the end customer, when calculating the prices paid by Global-e to the Merchant in the original Merchant’s currency. This rate includes “FX conversion” and “marketing rounding” factors.

Returns:

  • (Float)


96
97
# File 'app/services/workarea/global_e/merchant/order.rb', line 96

def rounding_rate
end

#same_day_dispatchBoolean

Indicates if the end customer has requested “Same Day Dispatch” on Global-e checkout.

Returns:

  • (Boolean)


170
171
# File 'app/services/workarea/global_e/merchant/order.rb', line 170

def same_day_dispatch
end

#same_day_dispatch_costFloat

Cost of “Same Day Dispatch” option selected by the end customer on Global-e checkout, in the original Merchant’s currency.

Returns:

  • (Float)


178
179
# File 'app/services/workarea/global_e/merchant/order.rb', line 178

def same_day_dispatch_cost
end

#secondary_billingWorkarea::GlobalE::Merchant::CustomerDetails

Secondary customer’s billing details. Secondary customer denotes the end customer who has placed the order with Global-e checkout unless Customer.IsEndCustomerPrimary is not set to TRUE. Note that all string attributes of end customer’s details are indicated in URL encoded form. Therefore, if Customer.IsEndCustomerPrimary is FALSE then all string attributes in SecondaryBilling are URL encoded.



346
347
348
# File 'app/services/workarea/global_e/merchant/order.rb', line 346

def secondary_billing
  @secondary_billing ||= Merchant::CustomerDetails.new hash["SecondaryBilling"], url_encoded: !customer.is_end_customer_primary
end

#secondary_shippingWorkarea::GlobalE::Merchant::CustomerDetails

Secondary customer’s shipping details. Secondary customer denotes the end customer who has placed the order with Global-e checkout unless Customer.IsEndCustomerPrimary is not set to TRUE. Note that all string attributes of end customer’s details are indicated in URL encoded form. Therefore, if Customer.IsEndCustomerPrimary is FALSE then all string attributes in SecondaryShipping are URL encoded.



359
360
361
# File 'app/services/workarea/global_e/merchant/order.rb', line 359

def secondary_shipping
  @secondary_shipping ||= Merchant::CustomerDetails.new hash["SecondaryShipping"], url_encoded: !customer.is_end_customer_primary
end

#ship_to_store_codeString

Code denoting the Merchant’s store specified by the customer for “ship to shop” shipping destination (to be mapped on Global-e side).

Returns:

  • (String)


213
214
# File 'app/services/workarea/global_e/merchant/order.rb', line 213

def ship_to_store_code
end

#shipping_method_codeString

Code denoting the local shipping method selected from the list of available shipping options provided in shippingOptionsList argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (String)


115
116
117
# File 'app/services/workarea/global_e/merchant/order.rb', line 115

def shipping_method_code
  hash ["ShippingMethodCode"]
end

#status_codeString

Code denoting the order status on the Merchant’s site (to be mapped on Global-e side).

Returns:

  • (String)


68
69
70
# File 'app/services/workarea/global_e/merchant/order.rb', line 68

def status_code
  hash["StatusCode"]
end

#to_hObject



11
12
13
# File 'app/services/workarea/global_e/merchant/order.rb', line 11

def to_h
  hash
end

#total_duties_and_taxes_priceFloat

Returns:

  • (Float)


408
409
410
# File 'app/services/workarea/global_e/merchant/order.rb', line 408

def total_duties_and_taxes_price
  hash["TotalDutiesAndTaxesPrice"]
end

#user_idString

Internal User identifier on the Merchant’s site originally specified in shippingDetails.UserId argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (String)


105
106
107
# File 'app/services/workarea/global_e/merchant/order.rb', line 105

def user_id
  hash["UserId"]
end

#web_store_codeString

Code used on the merchant’s side to identify the web store, as specified in WebStoreCode argument for SendCart method for the cart converted to this order on Global-e.

Returns:

  • (String)


257
258
# File 'app/services/workarea/global_e/merchant/order.rb', line 257

def web_store_code
end