diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index ad3d68f..8e78ef4 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -243,7 +243,7 @@ module Spree :depth => item.variant.weight } end - credits = order.adjustments.map do |credit| + credits = order.adjustments.eligible.map do |credit| if credit.amount < 0.00 { :name => credit.label, :description => credit.label, @@ -266,13 +266,10 @@ module Spree :custom => order.number, :items => items, :subtotal => ((order.item_total * 100) + credits_total).to_i, - :tax => ((order.adjustments.map { |a| a.amount if ( a.source_type == 'Spree::Order' && a.label == 'Tax') }.compact.sum) * 100 ).to_i, - :shipping => ((order.adjustments.map { |a| a.amount if a.source_type == 'Spree::Shipment' }.compact.sum) * 100 ).to_i, + :tax => (order.tax_total*100).to_i, + :shipping => (order.ship_total*100).to_i, :money => (order.total * 100 ).to_i } - # add correct tax amount by subtracting subtotal and shipping otherwise tax = 0 -> need to check adjustments.map - opts[:tax] = (order.total*100).to_i - opts.slice(:subtotal, :shipping).values.sum - if stage == "checkout" opts[:handling] = 0