2021-04-08 17:11:14 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Livewire;
|
|
|
|
|
2021-06-07 03:06:31 +02:00
|
|
|
use App\Libraries\MultiDB;
|
2021-04-08 17:11:14 +02:00
|
|
|
use App\Models\RecurringInvoice;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class RecurringInvoiceCancellation extends Component
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var RecurringInvoice
|
|
|
|
*/
|
|
|
|
public $invoice;
|
|
|
|
|
2021-06-07 03:06:31 +02:00
|
|
|
public $company;
|
|
|
|
|
|
|
|
public function mount()
|
|
|
|
{
|
|
|
|
MultiDB::setDb($this->company->db);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
return render('components.livewire.recurring-invoice-cancellation');
|
|
|
|
}
|
|
|
|
|
2021-04-08 17:11:14 +02:00
|
|
|
public function processCancellation()
|
|
|
|
{
|
|
|
|
if ($this->invoice->subscription) {
|
2021-04-15 07:36:50 +02:00
|
|
|
return $this->invoice->subscription->service()->handleCancellation($this->invoice);
|
2021-04-08 17:11:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return redirect()->route('client.recurring_invoices.request_cancellation', ['recurring_invoice' => $this->invoice->hashed_id]);
|
|
|
|
}
|
|
|
|
|
2021-06-07 03:06:31 +02:00
|
|
|
|
2021-04-08 17:11:14 +02:00
|
|
|
}
|