cancel invoice/bill

This commit is contained in:
denisdulici
2020-03-28 17:54:36 +03:00
parent 889be5fd98
commit 75413a0496
30 changed files with 445 additions and 104 deletions

View File

@ -1,5 +1,6 @@
<?php
use App\Events\Sale\InvoiceCancelled;
use App\Events\Sale\InvoiceCreated;
use App\Events\Sale\InvoiceSent;
use App\Events\Sale\InvoiceViewed;
@ -33,7 +34,7 @@ $factory->define(Invoice::class, function (Faker $faker) use ($company) {
$contact = factory(Contact::class)->states('enabled', 'customer')->create();
}
$statuses = ['draft', 'sent', 'viewed', 'partial', 'paid'];
$statuses = ['draft', 'sent', 'viewed', 'partial', 'paid', 'cancelled'];
return [
'company_id' => $company->id,
@ -65,6 +66,8 @@ $factory->state(Invoice::class, 'partial', ['status' => 'partial']);
$factory->state(Invoice::class, 'paid', ['status' => 'paid']);
$factory->state(Invoice::class, 'cancelled', ['status' => 'cancelled']);
$factory->state(Invoice::class, 'recurring', function (Faker $faker) {
$frequencies = ['monthly', 'weekly'];
@ -184,6 +187,10 @@ $factory->afterCreating(Invoice::class, function ($invoice, $faker) use ($compan
event(new PaymentReceived($updated_invoice, $payment_request));
break;
case 'cancelled':
event(new InvoiceCancelled($updated_invoice));
break;
}
});