Class: Workarea::GlobalE::Merchant::Order
- Inherits:
-
Object
- Object
- Workarea::GlobalE::Merchant::Order
- Defined in:
- app/services/workarea/global_e/merchant/order.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#allow_mails_from_merchant ⇒ Boolean
Indicates if the end customer has opted on Global-e checkout to receive emails from the Merchant.
-
#cart_hash ⇒ String
Cart hash originally specified in merchantCartHash argument for SendCart method for the cart converted to this order on Global-e.
-
#cart_id ⇒ String
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.
-
#clear_cart ⇒ Boolean
Indicates if the end customer’s cart must be cleared before this method finishes execution on the Merchant’s site.
-
#contains_clearance_fees_price ⇒ Float
Contains clearance Fees (CCF), in the merchant currency.
- #culture_code ⇒ String
-
#currency_code ⇒ String
3-char ISO currency code for the order being posted.
-
#customer ⇒ Workarea::GlobalE::Merchant::Customer
The paying customer’s preferences (Global-e acts as a paying customer).
-
#customer_comments ⇒ String
Comments text entered by the end customer in Global-e checkout.
-
#discounted_shipping_price ⇒ Float
The shipping price paid by the customer converted to the merchant’s currency.
-
#discounts ⇒ Array<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.
-
#do_not_charge_vat ⇒ Boolean
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.
-
#free_shipping_coupon_code ⇒ String
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.
-
#initialize(hash) ⇒ Order
constructor
A new instance of Order.
-
#international_details ⇒ Workarea::GlobalE::Merchant::InternationalDetails
Details referring to the end customer’s order placed on Global-e side.
-
#is_free_shipping ⇒ Boolean
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.
-
#is_replacement_order ⇒ Boolean
Indicates if the order is replacement.
-
#is_split_order ⇒ Boolean
Indicates if the order should be handled as split order (i.e. without consolidation).
-
#loyalty_code ⇒ String
Loyalty code applicable to the Merchant’s site entered by the end customer in Global-e checkout.
-
#loyalty_points_earned ⇒ Float
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.
-
#loyalty_points_spend ⇒ Float
Number of loyalty points spent for this purchase.
-
#markups ⇒ Array<Workarea::GlobalE::Merchant::Discount>
The list of markups being applied to the order, according to the Merchant shipping configuration on Global-e.
-
#merchant_guid ⇒ String
Unique identifier of the Merchant on Global-e.
-
#merchant_order_id ⇒ String
Order unique identifier on the Merchant’s site returned from a previous call to SendOrderToMerchant method for this order.
-
#order_id ⇒ String
Global-e order unique identifier.
-
#original_order ⇒ Workarea::GlobalE::Merchant::OriginalOrder
Details reffering to the original order if the current order is replacement.
-
#ot_currency_code ⇒ String
Currency of the onetime voucher code used to place the order.
-
#ot_voucher_amount ⇒ Float
Amount taken off the voucher when applicable.
-
#ot_voucher_code ⇒ String
Onetime voucher code used to place the order.
-
#payment_details ⇒ Workarea::GlobalE::Merchant::PaymentDetails
The paying customer’s payment details.
-
#pre_pay_offered ⇒ Boolean
Indicates if the prepayment option for duties and taxes was offered to the customer.
-
#price_coefficient_rate ⇒ Float
CountryCoefficient rate applied to the prices in this order.
-
#primary_billing ⇒ Workarea::GlobalE::Merchant::CustomerDetails
Primary customer’s billing details.
-
#primary_shipping ⇒ Workarea::GlobalE::Merchant::CustomerDetails
Primary customer’s shipping details.
-
#products ⇒ Array<Workarea::GlobalE::Merchant::Product>
The list of products being purchased.
-
#rounding_rate ⇒ Float
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.
-
#same_day_dispatch ⇒ Boolean
Indicates if the end customer has requested “Same Day Dispatch” on Global-e checkout.
-
#same_day_dispatch_cost ⇒ Float
Cost of “Same Day Dispatch” option selected by the end customer on Global-e checkout, in the original Merchant’s currency.
-
#secondary_billing ⇒ Workarea::GlobalE::Merchant::CustomerDetails
Secondary customer’s billing details.
-
#secondary_shipping ⇒ Workarea::GlobalE::Merchant::CustomerDetails
Secondary customer’s shipping details.
-
#ship_to_store_code ⇒ String
Code denoting the Merchant’s store specified by the customer for “ship to shop” shipping destination (to be mapped on Global-e side).
-
#shipping_method_code ⇒ String
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.
-
#status_code ⇒ String
Code denoting the order status on the Merchant’s site (to be mapped on Global-e side).
- #to_h ⇒ Object
- #total_duties_and_taxes_price ⇒ Float
-
#user_id ⇒ String
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.
-
#web_store_code ⇒ String
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.
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
#hash ⇒ Object (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_merchant ⇒ Boolean
Indicates if the end customer has opted on Global-e checkout to receive emails from the Merchant.
133 134 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 133 def allow_mails_from_merchant end |
#cart_hash ⇒ String
Cart hash originally specified in merchantCartHash argument for SendCart method for the cart converted to this order on Global-e.
61 62 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 61 def cart_hash end |
#cart_id ⇒ String
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.
52 53 54 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 52 def cart_id hash["CartId"] end |
#clear_cart ⇒ Boolean
Indicates if the end customer’s cart must be cleared before this method finishes execution on the Merchant’s site.
124 125 126 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 124 def clear_cart hash["ClearCart"] end |
#contains_clearance_fees_price ⇒ Float
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.
419 420 421 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 419 def contains_clearance_fees_price hash["CCFPrice"] end |
#culture_code ⇒ String
17 18 19 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 17 def culture_code hash["CultureCode"] end |
#currency_code ⇒ String
3-char ISO currency code for the order being posted. By default this is set to the original Merchant’s currency.
77 78 79 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 77 def currency_code hash["CurrencyCode"] end |
#customer ⇒ Workarea::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_comments ⇒ String
Comments text entered by the end customer in Global-e checkout.
220 221 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 220 def customer_comments end |
#discounted_shipping_price ⇒ Float
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).
380 381 382 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 380 def discounted_shipping_price hash["DiscountedShippingPrice"] end |
#discounts ⇒ Array<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_vat ⇒ Boolean
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.
187 188 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 187 def do_not_charge_vat end |
#free_shipping_coupon_code ⇒ String
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.
205 206 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 205 def free_shipping_coupon_code end |
#international_details ⇒ Workarea::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_shipping ⇒ Boolean
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.
196 197 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 196 def is_free_shipping end |
#is_replacement_order ⇒ Boolean
Indicates if the order is replacement.
396 397 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 396 def is_replacement_order end |
#is_split_order ⇒ Boolean
Indicates if the order should be handled as split order (i.e. without consolidation)
227 228 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 227 def is_split_order end |
#loyalty_code ⇒ String
Loyalty code applicable to the Merchant’s site entered by the end customer in Global-e checkout.
162 163 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 162 def loyalty_code end |
#loyalty_points_earned ⇒ Float
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.
154 155 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 154 def loyalty_points_earned end |
#loyalty_points_spend ⇒ Float
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).
144 145 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 144 def loyalty_points_spend end |
#markups ⇒ Array<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_guid ⇒ String
Unique identifier of the Merchant on Global-e.
25 26 27 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 25 def merchant_guid hash["MerchantGUID"] end |
#merchant_order_id ⇒ String
Order unique identifier on the Merchant’s site returned from a previous call to SendOrderToMerchant method for this order.
42 43 44 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 42 def merchant_order_id hash["MerchantOrderId"] end |
#order_id ⇒ String
Global-e order unique identifier.
33 34 35 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 33 def order_id hash["OrderId"] end |
#original_order ⇒ Workarea::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_code ⇒ String
Currency of the onetime voucher code used to place the order
241 242 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 241 def ot_currency_code end |
#ot_voucher_amount ⇒ Float
Amount taken off the voucher when applicable
248 249 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 248 def ot_voucher_amount end |
#ot_voucher_code ⇒ String
Onetime voucher code used to place the order
234 235 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 234 def ot_voucher_code end |
#payment_details ⇒ Workarea::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_offered ⇒ Boolean
Indicates if the prepayment option for duties and taxes was offered to the customer.
389 390 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 389 def pre_pay_offered end |
#price_coefficient_rate ⇒ Float
CountryCoefficient rate applied to the prices in this order.
85 86 87 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 85 def price_coefficient_rate hash["PriceCoefficientRate"] end |
#primary_billing ⇒ Workarea::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_shipping ⇒ Workarea::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 |
#products ⇒ Array<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_rate ⇒ Float
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.
96 97 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 96 def rounding_rate end |
#same_day_dispatch ⇒ Boolean
Indicates if the end customer has requested “Same Day Dispatch” on Global-e checkout.
170 171 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 170 def same_day_dispatch end |
#same_day_dispatch_cost ⇒ Float
Cost of “Same Day Dispatch” option selected by the end customer on Global-e checkout, in the original Merchant’s currency.
178 179 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 178 def same_day_dispatch_cost end |
#secondary_billing ⇒ Workarea::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_shipping ⇒ Workarea::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_code ⇒ String
Code denoting the Merchant’s store specified by the customer for “ship to shop” shipping destination (to be mapped on Global-e side).
213 214 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 213 def ship_to_store_code end |
#shipping_method_code ⇒ String
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.
115 116 117 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 115 def shipping_method_code hash ["ShippingMethodCode"] end |
#status_code ⇒ String
Code denoting the order status on the Merchant’s site (to be mapped on Global-e side).
68 69 70 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 68 def status_code hash["StatusCode"] end |
#to_h ⇒ Object
11 12 13 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 11 def to_h hash end |
#total_duties_and_taxes_price ⇒ 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_id ⇒ String
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.
105 106 107 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 105 def user_id hash["UserId"] end |
#web_store_code ⇒ String
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.
257 258 |
# File 'app/services/workarea/global_e/merchant/order.rb', line 257 def web_store_code end |