mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
Merge branch 'negative-tax-options' into 'master'
Solved negative tax options issue See merge request mohit.panjvani/crater-web!735
This commit is contained in:
@ -157,7 +157,7 @@ export default {
|
|||||||
},
|
},
|
||||||
percent: {
|
percent: {
|
||||||
required,
|
required,
|
||||||
between: between(0, 100),
|
between: between(-100, 100),
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
maxLength: maxLength(255),
|
maxLength: maxLength(255),
|
||||||
|
|||||||
@ -257,3 +257,31 @@ test('clone invoice', function () {
|
|||||||
'success' => true,
|
'success' => true,
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('create invoice with negative tax', function () {
|
||||||
|
$invoice = Invoice::factory()
|
||||||
|
->raw([
|
||||||
|
'taxes' => [Tax::factory()->raw([
|
||||||
|
'percent' => -9.99
|
||||||
|
])],
|
||||||
|
'items' => [InvoiceItem::factory()->raw()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = postJson('api/v1/invoices', $invoice);
|
||||||
|
|
||||||
|
$response->assertOk();
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('invoices', [
|
||||||
|
'invoice_number' => $invoice['invoice_number'],
|
||||||
|
'sub_total' => $invoice['sub_total'],
|
||||||
|
'total' => $invoice['total'],
|
||||||
|
'tax' => $invoice['tax'],
|
||||||
|
'discount' => $invoice['discount'],
|
||||||
|
'user_id' => $invoice['user_id'],
|
||||||
|
'invoice_template_id' => $invoice['invoice_template_id'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('invoice_items', $invoice['items'][0]);
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('taxes', $invoice['taxes'][0]);
|
||||||
|
});
|
||||||
|
|||||||
@ -92,3 +92,15 @@ test('delete tax type', function () {
|
|||||||
|
|
||||||
$this->assertDeleted($taxType);
|
$this->assertDeleted($taxType);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test('create negative tax type', function () {
|
||||||
|
$taxType = TaxType::factory()->raw([
|
||||||
|
'percent' => -9.99
|
||||||
|
]);
|
||||||
|
|
||||||
|
postJson('api/v1/tax-types', $taxType)
|
||||||
|
->assertOk();
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('tax_types', $taxType);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user