Class: Workarea::GlobalE::Merchant::Discount
- Inherits:
-
Object
- Object
- Workarea::GlobalE::Merchant::Discount
- Defined in:
- app/services/workarea/global_e/merchant/discount.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#coupon_code ⇒ String
Merchant’s coupon code used for this discount (applicable to coupon-based discounts only).
-
#description ⇒ String
Discount textual description.
-
#discount_code ⇒ String
Discount code originally specified in Discount.DiscountCode property of the respective discount in SendCart method for the cart converted to this order on Global-e.
-
#discount_type ⇒ Integer
Discount type (“Cart”, “Shipping”, etc.), as defined in | DiscountType Option Value | Name | Description | | 1 | Cart Discount | Discount related to volume, amount, coupon or another promotion value.
-
#initialize(hash) ⇒ Discount
constructor
A new instance of Discount.
-
#international_price ⇒ Float
Discount value in end customer’s currency (specified in InternationalDetails.CurrencyCode property for the respective Merchant.Order), after applying country coefficient, FX conversion and IncludeVAT handling.
-
#local_vat_rate ⇒ Float
VAT rate that would be applied to this discount if the order was placed by the local customer.
-
#loyalty_voucher_code ⇒ String
Loyalty Voucher code originally specified in Discount.LoyaltyVoucherCode property of the respective discount in SendCart method for the cart converted to this order on Global-e.
-
#name ⇒ String
Discount Name.
-
#price ⇒ Float
Discount value in currency defined in CurrencyCode property of the respective Merchant.Order object for the order being submitted to the Merchant.
-
#product_cart_item_id ⇒ String[
Identifier of the product cart item related to this discount on the Merchant’s site originally specified in Discount.ProductCartItemId property of the respective discount in SendCart method for the cart converted to this order on Global-e.
- #shipping? ⇒ Boolean
-
#vat_rate ⇒ Float
VAT rate applied to this discount.
Constructor Details
#initialize(hash) ⇒ Discount
Returns a new instance of Discount.
7 8 9 |
# File 'app/services/workarea/global_e/merchant/discount.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/discount.rb', line 5 def hash @hash end |
Instance Method Details
#coupon_code ⇒ String
Merchant’s coupon code used for this discount (applicable to coupon-based discounts only)
71 72 73 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 71 def coupon_code hash["CouponCode"] end |
#description ⇒ String
Discount textual description
62 63 64 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 62 def description hash["Description"] end |
#discount_code ⇒ String
Discount code originally specified in Discount.DiscountCode property of the respective discount in SendCart method for the cart converted to this order on Global-e.
92 93 94 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 92 def discount_code hash["DiscountCode"] end |
#discount_type ⇒ Integer
Discount type (“Cart”, “Shipping”, etc.), as defined in | DiscountType Option Value | Name | Description | | 1 | Cart Discount | Discount related to volume, amount, coupon or another promotion value. | | 2 | Shipping Discount | Discount aimed to sponsor international shipping. | | 3 | Loyalty points discount | Discount applied against the Merchant’s loyalty points to be spent for this purchase. | | 4 | Duties discount | Discount aimed to sponsor taxes & duties pre- paid by the end customer in Global-e checkout. | | 5 | Checkout Loyalty Points Discount | Discount applied against the Merchant’s loyalty points in Global-e checkout. | | 6 | Payment Charge | Discount aimed to sponsor “Cash on Delivery” fee. |
117 118 119 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 117 def discount_type hash["DiscountType"] end |
#international_price ⇒ Float
Discount value in end customer’s currency (specified in InternationalDetails.CurrencyCode property for the respective Merchant.Order), after applying country coefficient, FX conversion and IncludeVAT handling.
54 55 56 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 54 def international_price hash["InternationalPrice"] end |
#local_vat_rate ⇒ Float
VAT rate that would be applied to this discount if the order was placed by the local customer. This value must be specified if UseCountryVAT for the current Country is TRUE and therefore VATRate property actually denotes the VAT for the target country.
43 44 45 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 43 def local_vat_rate hash["LocalVATRate"] end |
#loyalty_voucher_code ⇒ String
Loyalty Voucher code originally specified in Discount.LoyaltyVoucherCode property of the respective discount in SendCart method for the cart converted to this order on Global-e.
102 103 104 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 102 def loyalty_voucher_code hash["LoyaltyVoucherCode"] end |
#name ⇒ String
Discount Name
15 16 17 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 15 def name hash["Name"] end |
#price ⇒ Float
Discount value in currency defined in CurrencyCode property of the respective Merchant.Order object for the order being submitted to the Merchant.
24 25 26 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 24 def price hash["Price"] end |
#product_cart_item_id ⇒ String[
Identifier of the product cart item related to this discount on the Merchant’s site originally specified in Discount.ProductCartItemId property of the respective discount in SendCart method for the cart converted to this order on Global-e.
82 83 84 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 82 def product_cart_item_id hash["ProductCartItemId"] end |
#shipping? ⇒ Boolean
121 122 123 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 121 def shipping? discount_type == 2 end |
#vat_rate ⇒ Float
VAT rate applied to this discount
32 33 34 |
# File 'app/services/workarea/global_e/merchant/discount.rb', line 32 def vat_rate hash["VATRate"] end |