Class: Spree::Price
Constant Summary
collapse
- MAXIMUM_AMOUNT =
BigDecimal('99_999_999.99')
Instance Method Summary
collapse
money_methods
#gross_amount
Methods inherited from Base
belongs_to_required_by_default, for_store, has_many_inversing, json_api_columns, json_api_permitted_attributes, json_api_type, page, spree_base_scopes, spree_base_uniqueness_scope
#clear_preferences, #default_preferences, #defined_preferences, #deprecated_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_deprecated, #preference_type, #set_preference
Instance Method Details
#amount=(amount) ⇒ Object
36
37
38
|
# File 'app/models/spree/price.rb', line 36
def amount=(amount)
self[:amount] = Spree::LocalizedNumber.parse(amount)
end
|
#compare_at_amount=(compare_at_amount) ⇒ Object
44
45
46
|
# File 'app/models/spree/price.rb', line 44
def compare_at_amount=(compare_at_amount)
self[:compare_at_amount] = Spree::LocalizedNumber.parse(compare_at_amount)
end
|
#compare_at_money ⇒ Object
40
41
42
|
# File 'app/models/spree/price.rb', line 40
def compare_at_money
Spree::Money.new(compare_at_amount || 0, currency: currency)
end
|
#compare_at_price_including_vat_for(price_options) ⇒ Object
56
57
58
59
|
# File 'app/models/spree/price.rb', line 56
def compare_at_price_including_vat_for(price_options)
options = price_options.merge(tax_category: variant.tax_category)
gross_amount(compare_at_price, options)
end
|
#display_compare_at_price_including_vat_for(price_options) ⇒ Object
65
66
67
|
# File 'app/models/spree/price.rb', line 65
def display_compare_at_price_including_vat_for(price_options)
Spree::Money.new(compare_at_price_including_vat_for(price_options), currency: currency)
end
|
#display_price_including_vat_for(price_options) ⇒ Object
61
62
63
|
# File 'app/models/spree/price.rb', line 61
def display_price_including_vat_for(price_options)
Spree::Money.new(price_including_vat_for(price_options), currency: currency)
end
|
#money ⇒ Object
32
33
34
|
# File 'app/models/spree/price.rb', line 32
def money
Spree::Money.new(amount || 0, currency: currency.upcase)
end
|
#price_including_vat_for(price_options) ⇒ Object
51
52
53
54
|
# File 'app/models/spree/price.rb', line 51
def price_including_vat_for(price_options)
options = price_options.merge(tax_category: variant.tax_category)
gross_amount(price, options)
end
|