Fixes for tax providers and blank credentials

This commit is contained in:
David Bomba 2023-09-17 12:40:24 +10:00
parent 59130006b9
commit d308173500
2 changed files with 31 additions and 29 deletions

View File

@ -75,18 +75,20 @@ class TaxProvider
*/ */
public function updateCompanyTaxData(): self public function updateCompanyTaxData(): self
{ {
$this->configureProvider($this->provider, $this->company->country()->iso_3166_2); //hard coded for now to one provider, but we'll be able to swap these out later
$company_details = [
'address2' => $this->company->settings->address2,
'address1' => $this->company->settings->address1,
'city' => $this->company->settings->city,
'state' => $this->company->settings->state,
'postal_code' => $this->company->settings->postal_code,
'country' => $this->company->country()->name,
];
try { try {
$this->configureProvider($this->provider, $this->company->country()->iso_3166_2); //hard coded for now to one provider, but we'll be able to swap these out later
$company_details = [
'address2' => $this->company->settings->address2,
'address1' => $this->company->settings->address1,
'city' => $this->company->settings->city,
'state' => $this->company->settings->state,
'postal_code' => $this->company->settings->postal_code,
'country' => $this->company->country()->name,
];
$tax_provider = new $this->provider($company_details); $tax_provider = new $this->provider($company_details);
$tax_provider->setApiCredentials($this->api_credentials); $tax_provider->setApiCredentials($this->api_credentials);
@ -143,7 +145,7 @@ class TaxProvider
$tax_data = $tax_provider->run(); $tax_data = $tax_provider->run();
nlog($tax_data); // nlog($tax_data);
if($tax_data) { if($tax_data) {
$this->client->tax_data = $tax_data; $this->client->tax_data = $tax_data;

36
composer.lock generated
View File

@ -525,16 +525,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.281.7", "version": "3.281.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "926cea9a41a545ca9801ac304f2a9ffd23ac68c9" "reference": "eb349b9f31502a05c70362f57913b9fed6b65b1f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/926cea9a41a545ca9801ac304f2a9ffd23ac68c9", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/eb349b9f31502a05c70362f57913b9fed6b65b1f",
"reference": "926cea9a41a545ca9801ac304f2a9ffd23ac68c9", "reference": "eb349b9f31502a05c70362f57913b9fed6b65b1f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -614,9 +614,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.281.7" "source": "https://github.com/aws/aws-sdk-php/tree/3.281.8"
}, },
"time": "2023-09-14T18:05:11+00:00" "time": "2023-09-15T18:34:59+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -8062,16 +8062,16 @@
}, },
{ {
"name": "phpseclib/phpseclib", "name": "phpseclib/phpseclib",
"version": "3.0.21", "version": "3.0.22",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpseclib/phpseclib.git", "url": "https://github.com/phpseclib/phpseclib.git",
"reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1" "reference": "b6bd1c5f79b2c39e144770eb6d9180fbdb00d09b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/4580645d3fc05c189024eb3b834c6c1e4f0f30a1", "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/b6bd1c5f79b2c39e144770eb6d9180fbdb00d09b",
"reference": "4580645d3fc05c189024eb3b834c6c1e4f0f30a1", "reference": "b6bd1c5f79b2c39e144770eb6d9180fbdb00d09b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -8152,7 +8152,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpseclib/phpseclib/issues", "issues": "https://github.com/phpseclib/phpseclib/issues",
"source": "https://github.com/phpseclib/phpseclib/tree/3.0.21" "source": "https://github.com/phpseclib/phpseclib/tree/3.0.22"
}, },
"funding": [ "funding": [
{ {
@ -8168,7 +8168,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-07-09T15:24:48+00:00" "time": "2023-09-16T11:49:37+00:00"
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
@ -15793,16 +15793,16 @@
}, },
{ {
"name": "phpmyadmin/sql-parser", "name": "phpmyadmin/sql-parser",
"version": "5.8.0", "version": "5.8.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpmyadmin/sql-parser.git", "url": "https://github.com/phpmyadmin/sql-parser.git",
"reference": "db1b3069b5dbc220d393d67ff911e0ae76732755" "reference": "b877ee6262a00f0f498da5e01335e8a5dc01d203"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/db1b3069b5dbc220d393d67ff911e0ae76732755", "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/b877ee6262a00f0f498da5e01335e8a5dc01d203",
"reference": "db1b3069b5dbc220d393d67ff911e0ae76732755", "reference": "b877ee6262a00f0f498da5e01335e8a5dc01d203",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -15824,7 +15824,7 @@
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psalm/plugin-phpunit": "^0.16.1", "psalm/plugin-phpunit": "^0.16.1",
"vimeo/psalm": "^4.11", "vimeo/psalm": "^4.11",
"zumba/json-serializer": "^3.0" "zumba/json-serializer": "~3.0.2"
}, },
"suggest": { "suggest": {
"ext-mbstring": "For best performance", "ext-mbstring": "For best performance",
@ -15876,7 +15876,7 @@
"type": "other" "type": "other"
} }
], ],
"time": "2023-06-05T18:19:38+00:00" "time": "2023-09-15T18:21:22+00:00"
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",