Skip to content

Commit

Permalink
Merge pull request #238 from spurjobs/feature/laws-193-ky-local-updates
Browse files Browse the repository at this point in the history
LAWS-193 2020 Kentucky Local Tax Updates: Smiths Grove, Highland Heights, Pendleton County, Elliott County
  • Loading branch information
Aidancs authored Apr 6, 2020
2 parents da6fb05 + ba2fa15 commit ad9d228
Show file tree
Hide file tree
Showing 14 changed files with 320 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Countries/US/Kentucky/ElliottCounty/ElliottCounty.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Appleton\Taxes\Countries\US\Kentucky\ElliottCounty;

use Appleton\Taxes\Classes\WorkerTaxes\Taxes\BaseOccupational;

abstract class ElliottCounty extends BaseOccupational
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Appleton\Taxes\Countries\US\Kentucky\ElliottCounty\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\ElliottCounty\ElliottCounty as BaseElliottCounty;

class ElliottCounty extends BaseElliottCounty
{
public const TAX_RATE = 0.01;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
namespace Appleton\Taxes\Countries\US\Kentucky\HighlandHeightsCity\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\HighlandHeightsCity\HighlandHeightsCity as BaseHighlandHeightsCity;
use Appleton\Taxes\Traits\HasWageBase;
use Illuminate\Database\Eloquent\Collection;

class HighlandHeightsCity extends BaseHighlandHeightsCity
{
use HasWageBase;

public const TAX_RATE = 0.01;
const WAGE_BASE = 137700;

public function compute(Collection $tax_areas)
{
return round($this->payroll->withholdTax(min($this->payroll->getEarnings(), $this->getBaseEarnings($tax_areas->first()->workGovernmentalUnitArea)) * self::TAX_RATE), 2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Appleton\Taxes\Countries\US\Kentucky\PendletonCounty\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\PendletonCounty\PendletonCounty as BasePendletonCounty;

class PendletonCounty extends BasePendletonCounty
{
public const TAX_RATE = 0.01;
}
9 changes: 9 additions & 0 deletions src/Countries/US/Kentucky/SmithsGrove/SmithsGrove.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Appleton\Taxes\Countries\US\Kentucky\SmithsGrove;

use Appleton\Taxes\Classes\WorkerTaxes\Taxes\BaseOccupational;

abstract class SmithsGrove extends BaseOccupational
{
}
10 changes: 10 additions & 0 deletions src/Countries/US/Kentucky/SmithsGrove/V20200101/SmithsGrove.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Appleton\Taxes\Countries\US\Kentucky\SmithsGrove\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\SmithsGrove\SmithsGrove as BaseSmithsGrove;

class SmithsGrove extends BaseSmithsGrove
{
public const TAX_RATE = 0.01;
}
2 changes: 2 additions & 0 deletions src/Providers/TaxServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class TaxServiceProvider extends ServiceProvider
\Appleton\Taxes\Countries\US\Kentucky\ElizabethtownCity\ElizabethtownCity::class,
\Appleton\Taxes\Countries\US\Kentucky\ElkhornCity\ElkhornCity::class,
\Appleton\Taxes\Countries\US\Kentucky\ElktonCity\ElktonCity::class,
\Appleton\Taxes\Countries\US\Kentucky\ElliottCounty\ElliottCounty::class,
\Appleton\Taxes\Countries\US\Kentucky\ElsmereCity\ElsmereCity::class,
\Appleton\Taxes\Countries\US\Kentucky\EminenceCity\EminenceCity::class,
\Appleton\Taxes\Countries\US\Kentucky\ErlangerCity\ErlangerCity::class,
Expand Down Expand Up @@ -406,6 +407,7 @@ class TaxServiceProvider extends ServiceProvider
\Appleton\Taxes\Countries\US\Kentucky\SilverGroveCity\SilverGroveCity::class,
\Appleton\Taxes\Countries\US\Kentucky\SimpsonCounty\SimpsonCounty::class,
\Appleton\Taxes\Countries\US\Kentucky\SimpsonvilleCity\SimpsonvilleCity::class,
\Appleton\Taxes\Countries\US\Kentucky\SmithsGrove\SmithsGrove::class,
\Appleton\Taxes\Countries\US\Kentucky\SomersetCity\SomersetCity::class,
\Appleton\Taxes\Countries\US\Kentucky\SouthgateCity\SouthgateCity::class,
\Appleton\Taxes\Countries\US\Kentucky\SpencerCounty\SpencerCounty::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Appleton\Taxes\Countries\US\Kentucky\SmithsGrove\SmithsGrove;
use Appleton\Taxes\Models\TaxArea;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class AddSmithsGroveKentuckyLocalTax extends Migration
{
protected $governmental_unit_areas = 'governmental_unit_areas';
protected $taxes = 'taxes';
protected $tax_areas = 'tax_areas';

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$smiths_grove_gua_id = DB::table($this->governmental_unit_areas)->insertGetId([
'name' => 'Smiths Grove, KY',
'area' => '0106000020E61000000100000001030000000100000021000000D00A0C59DD8D55C0BBEEAD484C864240D13FC1C58A8D55C0E961687572864240F86A47718E8D55C03048FAB48A8642408507CDAE7B8D55C03656629E95864240FC885FB1868D55C0A1DAE044F4874240577A6D36568D55C045F30016F987424029C93A1C5D8D55C0103FFF3D788742408F6E8445458D55C04B3D0B42798742406991ED7C3F8D55C0D21742CEFB874240A912656F298D55C05A7F4B00FE8742409A94826E2F8D55C001C11C3D7E8742407E18213CDA8C55C09E978A8D79874240C0249529E68C55C0F54883DBDA864240A0A696ADF58C55C0CB64389ECF8642402D978DCEF98C55C03A77BB5E9A864240EDEF6C8FDE8C55C01EFAEE569686424066BFEE74E78C55C01FF5D72B2C864240AE44A0FA078D55C02DE8BD3104864240321AF9BCE28C55C0C1AC50A4FB854240C5C72764E78C55C08481E7DEC3854240F05014E8138D55C067EDB60BCD8542404B21904B1C8D55C0DF180280638542400AA01859328D55C0F62345645885424081785DBF608D55C0740B5D8940854240020F0C207C8D55C09944BDE0D384424050340F60918D55C021C9ACDEE1844240A6F0A0D9758D55C07218CC5F21854240D3BB783F6E8D55C09A081B9E5E85424076C1E09A3B8D55C016139B8F6B8542400FF10F5B7A8D55C0C18A53AD85854240E78A5242B08D55C070AFCC5B75854240ECBE6378EC8D55C09A25016A6A854240D00A0C59DD8D55C0BBEEAD484C864240'
]);


$smiths_grove_tax_id = DB::table($this->taxes)->insertGetId([
'name' => 'Smiths Grove Kentucky Tax',
'class' => SmithsGrove::class,
]);

DB::table($this->tax_areas)->insert([[
'tax_id' => $smiths_grove_tax_id,
'work_governmental_unit_area_id' => $smiths_grove_gua_id,
'based' => TaxArea::BASED_ON_WORK_LOCATION,
]]);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Appleton\Taxes\Tests\Unit\Countries\US\Kentucky\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\ElliottCounty\ElliottCounty;
use Appleton\Taxes\Tests\Unit\Countries\TestParametersBuilder;
use Appleton\Taxes\Tests\Unit\Countries\TaxTestCase;

class ElliottCountyTest extends TaxTestCase
{
private const DATE = '2020-01-01';
private const LOCATION = 'us.kentucky.elliott_county';
private const TAX_CLASS = ElliottCounty::class;

public function setUp(): void
{
parent::setUp();
$this->query_runner->addTax(self::TAX_CLASS);
}

public function testTax(): void
{
$this->validate(
(new TestParametersBuilder())->setDate(self::DATE)
->setHomeLocation(self::LOCATION)
->setTaxClass(self::TAX_CLASS)
->setPayPeriods(52)
->setWagesInCents(30000)
->setExpectedAmountInCents(300)
->build()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

namespace Appleton\Taxes\Tests\Unit\Countries\US\Kentucky\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\HighlandHeightsCity\HighlandHeightsCity;
use Appleton\Taxes\Tests\Unit\Countries\TestParameters;
use Appleton\Taxes\Tests\Unit\Countries\TestParametersBuilder;
use Appleton\Taxes\Tests\Unit\Countries\TaxTestCase;

class HighlandHeightsCityTest extends TaxTestCase
{
private const DATE = '2020-01-01';
private const LOCATION = 'us.kentucky.highland_heights_city';
private const TAX_CLASS = HighlandHeightsCity::class;

public function setUp(): void
{
parent::setUp();
$this->query_runner->addTax(self::TAX_CLASS);
}

/**
* @dataProvider provideTestData
*/
public function testTax(TestParameters $parameters): void
{
$this->validate($parameters);
}

public function provideTestData(): array
{
$builder = new TestParametersBuilder();
$builder
->setDate(self::DATE)
->setHomeLocation(self::LOCATION)
->setTaxClass(self::TAX_CLASS)
->setPayPeriods(52);

return [
'00' => [
$builder
->setWagesInCents(0)
->setYtdWagesInCents(0)
->setExpectedAmountInCents(0)
->setExpectedEarningsInCents(0)
->build()
],
'01' => [
$builder
->setWagesInCents(30000)
->setYtdWagesInCents(500000)
->setExpectedAmountInCents(300)
->setExpectedEarningsInCents(30000)
->build()
],
'02' => [
$builder
->setWagesInCents(90000)
->setYtdWagesInCents(9910000)
->setExpectedAmountInCents(900)
->setExpectedEarningsInCents(90000)
->build()
],
'over wage base' => [
$builder
->setWagesInCents(77100)
->setYtdWagesInCents(13770000)
->setExpectedAmountInCents(0)
->setExpectedEarningsInCents(0)
->build()
],
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Appleton\Taxes\Tests\Unit\Countries\US\Kentucky\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\PendletonCounty\PendletonCounty;
use Appleton\Taxes\Tests\Unit\Countries\TestParametersBuilder;
use Appleton\Taxes\Tests\Unit\Countries\TaxTestCase;

class PendletonCountyTest extends TaxTestCase
{
private const DATE = '2020-01-01';
private const LOCATION = 'us.kentucky.pendleton_county';
private const TAX_CLASS = PendletonCounty::class;

public function setUp(): void
{
parent::setUp();
$this->query_runner->addTax(self::TAX_CLASS);
}

public function testTax(): void
{
$this->validate(
(new TestParametersBuilder())->setDate(self::DATE)
->setHomeLocation(self::LOCATION)
->setTaxClass(self::TAX_CLASS)
->setPayPeriods(52)
->setWagesInCents(30000)
->setExpectedAmountInCents(300)
->build()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Appleton\Taxes\Tests\Unit\Countries\US\Kentucky\V20200101;

use Appleton\Taxes\Countries\US\Kentucky\SmithsGrove\SmithsGrove;
use Appleton\Taxes\Tests\Unit\Countries\TestParametersBuilder;
use Appleton\Taxes\Tests\Unit\Countries\TaxTestCase;

class SmithsGroveTest extends TaxTestCase
{
private const DATE = '2020-01-01';
private const LOCATION = 'us.kentucky.smiths_grove';
private const TAX_CLASS = SmithsGrove::class;

public function setUp(): void
{
parent::setUp();
$this->query_runner->addTax(self::TAX_CLASS);
}

public function testTax(): void
{
$this->validate(
(new TestParametersBuilder())->setDate(self::DATE)
->setHomeLocation(self::LOCATION)
->setTaxClass(self::TAX_CLASS)
->setPayPeriods(52)
->setWagesInCents(30000)
->setExpectedAmountInCents(300)
->build()
);
}
}
2 changes: 2 additions & 0 deletions tests/Unit/TestLocations.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ protected function getLocation($name)
'us.kentucky.elizabethtown_city' => [37.7030646, -85.8649408],
'us.kentucky.elkhorn_city' => [37.303997, -82.3509794],
'us.kentucky.elkton_city' => [36.8100425, -87.1541675],
'us.kentucky.elliott_county' => [38.1575, -883.1220],
'us.kentucky.elsmere_city' => [39.0125608, -84.6046663],
'us.kentucky.eminence_city' => [38.3700683, -85.1805105],
'us.kentucky.erlanger_city' => [39.0167275, -84.6007773],
Expand Down Expand Up @@ -367,6 +368,7 @@ protected function getLocation($name)
'us.kentucky.silver_grove_city' => [39.0345062, -84.3902174],
'us.kentucky.simpson_county' => [36.7772014, -86.6207943],
'us.kentucky.simpsonville_city' => [38.22257, -85.3552349],
'us.kentucky.smiths_grove' => [37.0525, -86.2078],
'us.kentucky.somerset_city' => [37.0920222, -84.6041084],
'us.kentucky.southgate_city' => [39.072005, -84.4727195],
'us.kentucky.spencer_county' => [38.0123167, -85.3136218],
Expand Down

0 comments on commit ad9d228

Please sign in to comment.