cancel invoice/bill
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Events\Purchase\BillCancelled;
|
||||
use App\Events\Purchase\BillCreated;
|
||||
use App\Events\Purchase\BillReceived;
|
||||
use App\Jobs\Banking\CreateDocumentTransaction;
|
||||
@ -32,7 +33,7 @@ $factory->define(Bill::class, function (Faker $faker) use ($company) {
|
||||
$contact = factory(Contact::class)->states('enabled', 'vendor')->create();
|
||||
}
|
||||
|
||||
$statuses = ['draft', 'received', 'partial', 'paid'];
|
||||
$statuses = ['draft', 'received', 'partial', 'paid', 'cancelled'];
|
||||
|
||||
return [
|
||||
'company_id' => $company->id,
|
||||
@ -62,6 +63,8 @@ $factory->state(Bill::class, 'partial', ['status' => 'partial']);
|
||||
|
||||
$factory->state(Bill::class, 'paid', ['status' => 'paid']);
|
||||
|
||||
$factory->state(Bill::class, 'cancelled', ['status' => 'cancelled']);
|
||||
|
||||
$factory->state(Bill::class, 'recurring', function (Faker $faker) {
|
||||
$frequencies = ['monthly', 'weekly'];
|
||||
|
||||
@ -175,6 +178,10 @@ $factory->afterCreating(Bill::class, function ($bill, $faker) use ($company) {
|
||||
|
||||
$transaction = dispatch_now(new CreateDocumentTransaction($updated_bill, $payment_request));
|
||||
|
||||
break;
|
||||
case 'cancelled':
|
||||
event(new BillCancelled($updated_bill));
|
||||
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user