diff options
author | Mark Wells <mark@freeside.biz> | 2015-07-10 14:29:33 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-07-10 18:15:44 -0700 |
commit | 5f18e4b6de3cd9c8b0282f003655c46c4c6628c4 (patch) | |
tree | b795a61df47f05651ffbd9c31e001444707faaba /FS/FS | |
parent | ac3329e210b11172d56fd987624a1a85c3bcfeb9 (diff) |
avoid sending SureTax requests when no items are taxable
Diffstat (limited to 'FS/FS')
-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 8139b1d..4e7edd5 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); |