mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Clean up subscription service
This commit is contained in:
parent
bb4687f18d
commit
ecfd306fd7
@ -901,6 +901,8 @@ class SubscriptionService
|
||||
*/
|
||||
public function handleCancellation(RecurringInvoice $recurring_invoice)
|
||||
{
|
||||
$invoice_start_date = false;
|
||||
$refund_end_date = false;
|
||||
|
||||
//only refund if they are in the refund window.
|
||||
$outstanding_invoice = Invoice::where('subscription_id', $this->subscription->id)
|
||||
@ -909,8 +911,11 @@ class SubscriptionService
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
|
||||
if($outstanding_invoice)
|
||||
{
|
||||
$invoice_start_date = Carbon::parse($outstanding_invoice->date);
|
||||
$refund_end_date = $invoice_start_date->addSeconds($this->subscription->refund_period);
|
||||
}
|
||||
|
||||
/* Stop the recurring invoice and archive */
|
||||
$recurring_invoice->service()->stop()->save();
|
||||
|
Loading…
Reference in New Issue
Block a user