mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for Zip Tax Response
This commit is contained in:
parent
63da663afa
commit
913599334b
@ -144,6 +144,8 @@ class Rule extends BaseRule implements RuleInterface
|
||||
*/
|
||||
public function default(): self
|
||||
{
|
||||
nlog("default rate");
|
||||
nlog($this->tax_data);
|
||||
|
||||
if($this->tax_data?->stateSalesTax == 0) {
|
||||
|
||||
|
@ -31,17 +31,17 @@ class ZipTax implements TaxProviderInterface
|
||||
|
||||
$response = $this->callApi(['key' => $this->api_key, 'address' => $string_address]);
|
||||
|
||||
if($response->successful())
|
||||
return $response->json();
|
||||
if($response->successful()){
|
||||
|
||||
return $this->parseResponse($response->json());
|
||||
|
||||
}
|
||||
|
||||
if(isset($this->address['postal_code'])) {
|
||||
$response = $this->callApi(['key' => $this->api_key, 'address' => $this->address['postal_code']]);
|
||||
|
||||
nlog($response->json());
|
||||
nlog($response->body());
|
||||
|
||||
if($response->successful())
|
||||
return $response->json();
|
||||
return $this->parseResponse($response->json());
|
||||
|
||||
}
|
||||
|
||||
@ -69,4 +69,11 @@ class ZipTax implements TaxProviderInterface
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
private function parseResponse($response)
|
||||
{
|
||||
$tax = $response['results']['0'];
|
||||
|
||||
return $tax;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user