From 0c7fb7e0e6d4c8a16c0454fedb60f1ae5d9690d3 Mon Sep 17 00:00:00 2001 From: Jared Norman Date: Thu, 11 Apr 2019 14:59:24 +1200 Subject: Avoid sending negative order totals If an order is adjusted to zero, we don't want to subtract the tax from it... because that don't make no sense. A better solution that properly factors in order level adjustments will be coming eventually, this is just a hack to process some orders immediately. --- lib/super_good/solidus_taxjar/api_params.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/super_good/solidus_taxjar') diff --git a/lib/super_good/solidus_taxjar/api_params.rb b/lib/super_good/solidus_taxjar/api_params.rb index 25f8317..3d898c3 100644 --- a/lib/super_good/solidus_taxjar/api_params.rb +++ b/lib/super_good/solidus_taxjar/api_params.rb @@ -28,7 +28,7 @@ module SuperGood .merge( transaction_id: order.number, transaction_date: order.completed_at.to_formatted_s(:iso8601), - amount: order.total - order.additional_tax_total, + amount: [order.total - order.additional_tax_total, 0].max, shipping: shipping(order), sales_tax: order.additional_tax_total ) -- cgit v1.2.3