Sha256: ec49ee27a1f345e203a722275382c83b56c4915f43a951a925166e171c84db32
Contents?: true
Size: 616 Bytes
Versions: 7
Compression:
Stored size: 616 Bytes
Contents
Spree::LineItem.class_eval do money_methods :discount_amount, :vat_amount def discount_amount adjustments.non_tax.sum(:amount).abs end def vat_amount adjustments.tax.sum(:amount).abs end def vat_rate if adjustments.tax.any? # Spree allows line items to have multiple TaxRate adjustments. # Mollie does not support this. Raise an error if there > 1 TaxRate adjustment. if adjustments.tax.count > 1 raise 'Mollie does not support multiple TaxRate adjustments per line item' end adjustments.tax.first.source.amount else 0.00 end end end
Version data entries
7 entries across 7 versions & 1 rubygems