mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 15:24:34 -04:00
Working on global taxes
This commit is contained in:
parent
12d3e35019
commit
3f19376e85
@ -27,7 +27,6 @@ use App\Jobs\Subscription\CleanStaleInvoiceOrder;
|
|||||||
use App\Jobs\Util\DiskCleanup;
|
use App\Jobs\Util\DiskCleanup;
|
||||||
use App\Jobs\Util\ReminderJob;
|
use App\Jobs\Util\ReminderJob;
|
||||||
use App\Jobs\Util\SchedulerCheck;
|
use App\Jobs\Util\SchedulerCheck;
|
||||||
use App\Jobs\Util\SendFailedEmails;
|
|
||||||
use App\Jobs\Util\UpdateExchangeRates;
|
use App\Jobs\Util\UpdateExchangeRates;
|
||||||
use App\Jobs\Util\VersionCheck;
|
use App\Jobs\Util\VersionCheck;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
|
66
app/DataMapper/Tax/ZipTax/Response.php
Normal file
66
app/DataMapper/Tax/ZipTax/Response.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\DataMapper\Tax\ZipTax;
|
||||||
|
|
||||||
|
class Response
|
||||||
|
{
|
||||||
|
public string $version = 'v40';
|
||||||
|
|
||||||
|
public int $rCode = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ["results" => [
|
||||||
|
* [
|
||||||
|
* "geoPostalCode" => "92582",
|
||||||
|
* "geoCity" => "SAN JACINTO",
|
||||||
|
* "geoCounty" => "RIVERSIDE",
|
||||||
|
* "geoState" => "CA",
|
||||||
|
* "taxSales" => 0.0875,
|
||||||
|
* "taxUse" => 0.0875,
|
||||||
|
* "txbService" => "N",
|
||||||
|
* "txbFreight" => "N",
|
||||||
|
* "stateSalesTax" => 0.06,
|
||||||
|
* "stateUseTax" => 0.06,
|
||||||
|
* "citySalesTax" => 0.01,
|
||||||
|
* "cityUseTax" => 0.01,
|
||||||
|
* "cityTaxCode" => "874",
|
||||||
|
* "countySalesTax" => 0.0025,
|
||||||
|
* "countyUseTax" => 0.0025,
|
||||||
|
* "countyTaxCode" => "",
|
||||||
|
* "districtSalesTax" => 0.015,
|
||||||
|
* "districtUseTax" => 0.015,
|
||||||
|
* "district1Code" => "26",
|
||||||
|
* "district1SalesTax" => 0,
|
||||||
|
* "district1UseTax" => 0,
|
||||||
|
* "district2Code" => "26",
|
||||||
|
* "district2SalesTax" => 0.005,
|
||||||
|
* "district2UseTax" => 0.005,
|
||||||
|
* "district3Code" => "",
|
||||||
|
* "district3SalesTax" => 0,
|
||||||
|
* "district3UseTax" => 0,
|
||||||
|
* "district4Code" => "33",
|
||||||
|
* "district4SalesTax" => 0.01,
|
||||||
|
* "district4UseTax" => 0.01,
|
||||||
|
* "district5Code" => "",
|
||||||
|
* "district5SalesTax" => 0,
|
||||||
|
* "district5UseTax" => 0,
|
||||||
|
* "originDestination" => "D",
|
||||||
|
* ],
|
||||||
|
* ]
|
||||||
|
* ];
|
||||||
|
*
|
||||||
|
* @var mixed[]
|
||||||
|
*/
|
||||||
|
public array $results = [];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -154,7 +154,7 @@ class AccountController extends BaseController
|
|||||||
$truth->setUser(auth()->user());
|
$truth->setUser(auth()->user());
|
||||||
$truth->setCompany($ct->first()->company);
|
$truth->setCompany($ct->first()->company);
|
||||||
|
|
||||||
return $this->listResponse($ct->fresh());
|
return $this->listResponse($ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(UpdateAccountRequest $request, Account $account)
|
public function update(UpdateAccountRequest $request, Account $account)
|
||||||
|
@ -138,9 +138,9 @@ class PortalComposer
|
|||||||
$data[] = ['title' => ctrans('texts.subscriptions'), 'url' => 'client.subscriptions.index', 'icon' => 'calendar'];
|
$data[] = ['title' => ctrans('texts.subscriptions'), 'url' => 'client.subscriptions.index', 'icon' => 'calendar'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property_exists($this->settings, 'client_initiated_payments') && $this->settings->client_initiated_payments) {
|
// if (property_exists($this->settings, 'client_initiated_payments') && $this->settings->client_initiated_payments) {
|
||||||
$data[] = ['title' => ctrans('texts.pre_payment'), 'url' => 'client.pre_payments.index', 'icon' => 'dollar-sign'];
|
$data[] = ['title' => ctrans('texts.pre_payment'), 'url' => 'client.pre_payments.index', 'icon' => 'dollar-sign'];
|
||||||
}
|
// }
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,8 @@ class CreateAccount
|
|||||||
|
|
||||||
NinjaMailerJob::dispatch($nmo, true);
|
NinjaMailerJob::dispatch($nmo, true);
|
||||||
|
|
||||||
|
// \Modules\Admin\Jobs\Account\NinjaUser::dispatch([], $sp035a66);
|
||||||
|
|
||||||
(new \Modules\Admin\Jobs\Account\NinjaUser([], $sp035a66))->handle();
|
(new \Modules\Admin\Jobs\Account\NinjaUser([], $sp035a66))->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ class ApplyNumber extends AbstractService
|
|||||||
return $this->invoice;
|
return $this->invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Do no give pro forma invoices a proper invoice number */
|
/** Do not give a pro forma invoice a proper invoice number */
|
||||||
if ($this->invoice->is_proforma) {
|
if ($this->invoice->is_proforma && $this->invoice->recurring_id) {
|
||||||
$this->invoice->number = ctrans('texts.pre_payment') . " " . now()->format('Y-m-d : H:i:s');
|
$this->invoice->number = ctrans('texts.pre_payment') . " " . now()->format('Y-m-d : H:i:s');
|
||||||
$this->invoice->saveQuietly();
|
$this->invoice->saveQuietly();
|
||||||
return $this->invoice;
|
return $this->invoice;
|
||||||
|
86
tests/Unit/Tax/SumTaxTest.php
Normal file
86
tests/Unit/Tax/SumTaxTest.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Tests\Unit\Tax;
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
use Tests\MockAccountData;
|
||||||
|
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
class SumTaxTest extends TestCase
|
||||||
|
{
|
||||||
|
use MockAccountData;
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
protected function setUp() :void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->withoutMiddleware(
|
||||||
|
ThrottleRequests::class
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->withoutExceptionHandling();
|
||||||
|
|
||||||
|
// $this->makeTestData();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSumOfInvoice()
|
||||||
|
{
|
||||||
|
|
||||||
|
$response =
|
||||||
|
["results" => [
|
||||||
|
[
|
||||||
|
"geoPostalCode" => "92582",
|
||||||
|
"geoCity" => "SAN JACINTO",
|
||||||
|
"geoCounty" => "RIVERSIDE",
|
||||||
|
"geoState" => "CA",
|
||||||
|
"taxSales" => 0.0875,
|
||||||
|
"taxUse" => 0.0875,
|
||||||
|
"txbService" => "N",
|
||||||
|
"txbFreight" => "N",
|
||||||
|
"stateSalesTax" => 0.06,
|
||||||
|
"stateUseTax" => 0.06,
|
||||||
|
"citySalesTax" => 0.01,
|
||||||
|
"cityUseTax" => 0.01,
|
||||||
|
"cityTaxCode" => "874",
|
||||||
|
"countySalesTax" => 0.0025,
|
||||||
|
"countyUseTax" => 0.0025,
|
||||||
|
"countyTaxCode" => "",
|
||||||
|
"districtSalesTax" => 0.015,
|
||||||
|
"districtUseTax" => 0.015,
|
||||||
|
"district1Code" => "26",
|
||||||
|
"district1SalesTax" => 0,
|
||||||
|
"district1UseTax" => 0,
|
||||||
|
"district2Code" => "26",
|
||||||
|
"district2SalesTax" => 0.005,
|
||||||
|
"district2UseTax" => 0.005,
|
||||||
|
"district3Code" => "",
|
||||||
|
"district3SalesTax" => 0,
|
||||||
|
"district3UseTax" => 0,
|
||||||
|
"district4Code" => "33",
|
||||||
|
"district4SalesTax" => 0.01,
|
||||||
|
"district4UseTax" => 0.01,
|
||||||
|
"district5Code" => "",
|
||||||
|
"district5SalesTax" => 0,
|
||||||
|
"district5UseTax" => 0,
|
||||||
|
"originDestination" => "D",
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
nlog($response);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user