From ddfcda0c0be7ff81a7437f59b78ddb4c11f25070 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 22 Jan 2021 18:50:03 +0000 Subject: [PATCH] Adapt imported Paypal code The #additional scope from Spree 2.2 is now present, so we can tidy up this conditional. --- app/controllers/spree/paypal_controller.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/controllers/spree/paypal_controller.rb b/app/controllers/spree/paypal_controller.rb index 81f7433c22..9b14ce409e 100644 --- a/app/controllers/spree/paypal_controller.rb +++ b/app/controllers/spree/paypal_controller.rb @@ -15,9 +15,7 @@ module Spree order = current_order || raise(ActiveRecord::RecordNotFound) items = order.line_items.map(&method(:line_item)) - tax_adjustments = order.adjustments.tax - # TODO: Remove in Spree 2.2 - tax_adjustments = tax_adjustments.additional if tax_adjustments.respond_to?(:additional) + tax_adjustments = order.adjustments.tax.additional shipping_adjustments = order.adjustments.shipping order.adjustments.eligible.each do |adjustment| @@ -175,12 +173,8 @@ module Spree def payment_details(items) item_sum = items.sum { |i| i[:Quantity] * i[:Amount][:value] } - # Would use tax_total here, but it can include "included" taxes as well. - # For instance, tax_total would include the 10% GST in Australian stores. - # A quick sum will get us around that little problem. - # TODO: Remove additional check in 2.2 - tax_adjustments = current_order.adjustments.tax - tax_adjustments = tax_adjustments.additional if tax_adjustments.respond_to?(:additional) + + tax_adjustments = current_order.adjustments.tax.additional tax_adjustments_total = tax_adjustments.sum(:amount) if item_sum.zero?