Sha256: f0f04180b8c6a14d5afd493bd8f1fd56b7d1fd8871e36d7b535de6a97dadc8c2
Contents?: true
Size: 853 Bytes
Versions: 9
Compression:
Stored size: 853 Bytes
Contents
class TaxCharge < Charge def calculate_adjustment adjustment_source && calculate_tax_charge end # Calculates taxation amountbased on Calculator::Vat or Calculator::SalesTax def calculate_tax_charge return unless order.shipment return Calculator::Vat.calculate_tax(order) if order.shipment.address.blank? and Spree::Config[:show_price_inc_vat] return unless order.shipment.address zones = Zone.match(order.shipment.address) tax_rates = zones.map{|zone| zone.tax_rates}.flatten.uniq calculated_taxes = tax_rates.map{|tax_rate| tax_rate.calculate_tax(order)} return(calculated_taxes.sum) end # Checks if charge is applicable for the order. # if it's tax or shipping charge we always preserve it (even if it's 0) # otherwise we fall back to default adjustment behaviour. def applicable? true end end
Version data entries
9 entries across 9 versions & 1 rubygems