Class: Workarea::GlobalE::Api::SendOrderToMerchant::ItemPricer
- Inherits:
-
Object
- Object
- Workarea::GlobalE::Api::SendOrderToMerchant::ItemPricer
- Defined in:
- app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#discounts ⇒ Object
readonly
Returns the value of attribute discounts.
-
#international_currency ⇒ Object
readonly
Returns the value of attribute international_currency.
-
#merchant_product ⇒ Object
readonly
Returns the value of attribute merchant_product.
-
#order_item ⇒ Object
readonly
Returns the value of attribute order_item.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(order_item, merchant_product, discounts, currency, international_currency) ⇒ ItemPricer
constructor
A new instance of ItemPricer.
- #perform! ⇒ Object
Constructor Details
#initialize(order_item, merchant_product, discounts, currency, international_currency) ⇒ ItemPricer
Returns a new instance of ItemPricer.
11 12 13 14 15 16 17 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 11 def initialize(order_item, merchant_product, discounts, currency, international_currency) @order_item = order_item @merchant_product = merchant_product @discounts = discounts @currency = currency @international_currency = international_currency end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
9 10 11 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 9 def currency @currency end |
#discounts ⇒ Object (readonly)
Returns the value of attribute discounts.
9 10 11 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 9 def discounts @discounts end |
#international_currency ⇒ Object (readonly)
Returns the value of attribute international_currency.
9 10 11 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 9 def international_currency @international_currency end |
#merchant_product ⇒ Object (readonly)
Returns the value of attribute merchant_product.
9 10 11 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 9 def merchant_product @merchant_product end |
#order_item ⇒ Object (readonly)
Returns the value of attribute order_item.
9 10 11 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 9 def order_item @order_item end |
Class Method Details
.perform(order_item, merchant_product, discounts, currency, international_currency) ⇒ Object
5 6 7 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 5 def self.perform(order_item, merchant_product, discounts, currency, international_currency) new(order_item, merchant_product, discounts, currency, international_currency).perform! end |
Instance Method Details
#perform! ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb', line 19 def perform! order_item.update_attributes( price_adjustments: base_currency_adjustments, international_price_adjustments: international_currency_adjustments, total_value: discounted_price, international_total_value: international_discounted_price, total_price: base_currency_adjustments.adjusting("item").sum, international_total_price: international_currency_adjustments.adjusting("item").sum, discounted_price_for_customs: discounted_price_for_customs, generic_hs_code: merchant_product.generic_hs_code ) end |