diff options
author | Jared Norman <jared@super.gd> | 2019-04-11 14:59:24 +1200 |
---|---|---|
committer | Jared Norman <jared@super.gd> | 2019-04-11 14:59:24 +1200 |
commit | 0c7fb7e0e6d4c8a16c0454fedb60f1ae5d9690d3 (patch) | |
tree | 66498f2adbf66565def092c9dc9c041e38442500 /lib/super_good | |
parent | fbd8c7c044803843deae20045dd7972f1e6c34ac (diff) |
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.
Diffstat (limited to 'lib/super_good')
-rw-r--r-- | lib/super_good/solidus_taxjar/api_params.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 ) |