Class: Coupon::CatalogItemPricing
- Inherits:
-
Object
- Object
- Coupon::CatalogItemPricing
- Defined in:
- app/services/coupon/catalog_item_pricing.rb
Overview
This class is responsible for figuring out the offer pricing on a single catalog item
A customer is required but it nil a msrp pricing will be returned
Instance Method Summary collapse
- #discounted_price ⇒ Object
-
#initialize(catalog_item, customer) ⇒ CatalogItemPricing
constructor
A new instance of CatalogItemPricing.
Constructor Details
#initialize(catalog_item, customer) ⇒ CatalogItemPricing
Returns a new instance of CatalogItemPricing.
5 6 7 8 9 10 |
# File 'app/services/coupon/catalog_item_pricing.rb', line 5 def initialize(catalog_item,customer) @catalog_item = catalog_item @customer = customer @base_price = @catalog_item.amount @max_discount = @catalog_item.max_discount || 100 end |
Instance Method Details
#discounted_price ⇒ Object
12 13 14 15 |
# File 'app/services/coupon/catalog_item_pricing.rb', line 12 def discounted_price #Find any coupons that apply to customer and this catalog item #Return the price end |