Merge pull request #616 from mchev/taxdecimal

Support 3-decimal tax percentages (e.g. 6.625%)
This commit is contained in:
mchev
2026-04-08 09:28:44 +02:00
committed by GitHub
4 changed files with 92 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ use App\Http\Requests\TaxTypeRequest;
use App\Models\TaxType;
use App\Models\User;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Laravel\Sanctum\Sanctum;
use function Pest\Laravel\deleteJson;
@@ -110,3 +111,22 @@ test('create fixed amount tax type', function () {
$this->assertDatabaseHas('tax_types', $taxType);
});
test('create percentage tax type with three decimals', function () {
$payload = TaxType::factory()->raw([
'calculation_type' => 'percentage',
'percent' => 6.625,
'fixed_amount' => null,
]);
$response = postJson('api/v1/tax-types', $payload)
->assertStatus(201);
$taxTypeId = $response->json('data.id');
expect($taxTypeId)->not()->toBeNull();
$rawPercent = DB::table('tax_types')->where('id', $taxTypeId)->value('percent');
expect((string) $rawPercent)->toBe('6.625');
});