Module: Workarea::Storefront::OrderPricing
- Defined in:
- app/view_models/workarea/storefront/order_pricing.rb
Instance Method Summary collapse
-
#advance_payment_amount ⇒ Money
The total amount of payment the customer would perceive as prepaid - i.e.
- #order_balance ⇒ Object
- #store_credit? ⇒ Boolean
- #store_credit_amount ⇒ Object
- #total_adjustments ⇒ Object
Instance Method Details
#advance_payment_amount ⇒ Money
The total amount of payment the customer would perceive as prepaid - i.e. would be deducted from the total order balance. Examples of these types of payments would be store credit and gift cards.
32 33 34 |
# File 'app/view_models/workarea/storefront/order_pricing.rb', line 32 def advance_payment_amount store_credit_amount end |
#order_balance ⇒ Object
22 23 24 |
# File 'app/view_models/workarea/storefront/order_pricing.rb', line 22 def order_balance order.total_price - advance_payment_amount end |
#store_credit? ⇒ Boolean
10 11 12 |
# File 'app/view_models/workarea/storefront/order_pricing.rb', line 10 def store_credit? store_credit_amount > 0 end |
#store_credit_amount ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/view_models/workarea/storefront/order_pricing.rb', line 14 def store_credit_amount if store_credit_balance > order.total_price order.total_price else store_credit_balance end end |
#total_adjustments ⇒ Object
6 7 8 |
# File 'app/view_models/workarea/storefront/order_pricing.rb', line 6 def total_adjustments @total_adjustments ||= price_adjustments.reduce_by_description('order') end |