diff options
author | Mark Wells <mark@freeside.biz> | 2015-07-10 14:29:33 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-07-10 14:29:33 -0700 |
commit | 32eacfe9022ab9edb6fd986618ac2d3949fc7dcd (patch) | |
tree | 584560216a6688e856a7e78d62e9e0b0ac0296c7 | |
parent | 45121e05ad3e284386826ae53d41845bfa8eb0f1 (diff) |
avoid sending SureTax requests when no items are taxable
-rw-r--r-- | FS/FS/TaxEngine/suretax.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/FS/FS/TaxEngine/suretax.pm b/FS/FS/TaxEngine/suretax.pm index 8139b1dff..4e7edd575 100644 --- a/FS/FS/TaxEngine/suretax.pm +++ b/FS/FS/TaxEngine/suretax.pm @@ -85,6 +85,8 @@ sub build_request { my @lines = map { $self->build_item($_) } $cust_bill->cust_bill_pkg; + return if !@lines; + my $ClientNumber = $conf->config('suretax-client_number') or die "suretax-client_number config required.\n"; my $ValidationKey = $conf->config('suretax-validation_key') @@ -306,6 +308,10 @@ sub make_taxlines { # assemble the request hash my $request = $self->build_request; + if (!$request) { + warn "no taxable items in invoice; skipping SureTax request\n" if $DEBUG; + return; + } warn "sending SureTax request\n" if $DEBUG; my $request_json = $json->encode($request); |