mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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)
|
public function handleCancellation(RecurringInvoice $recurring_invoice)
|
||||||
{
|
{
|
||||||
|
$invoice_start_date = false;
|
||||||
|
$refund_end_date = false;
|
||||||
|
|
||||||
//only refund if they are in the refund window.
|
//only refund if they are in the refund window.
|
||||||
$outstanding_invoice = Invoice::where('subscription_id', $this->subscription->id)
|
$outstanding_invoice = Invoice::where('subscription_id', $this->subscription->id)
|
||||||
@ -909,8 +911,11 @@ class SubscriptionService
|
|||||||
->orderBy('id', 'desc')
|
->orderBy('id', 'desc')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
if($outstanding_invoice)
|
||||||
|
{
|
||||||
$invoice_start_date = Carbon::parse($outstanding_invoice->date);
|
$invoice_start_date = Carbon::parse($outstanding_invoice->date);
|
||||||
$refund_end_date = $invoice_start_date->addSeconds($this->subscription->refund_period);
|
$refund_end_date = $invoice_start_date->addSeconds($this->subscription->refund_period);
|
||||||
|
}
|
||||||
|
|
||||||
/* Stop the recurring invoice and archive */
|
/* Stop the recurring invoice and archive */
|
||||||
$recurring_invoice->service()->stop()->save();
|
$recurring_invoice->service()->stop()->save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user