From 420cb19701e8de7ea562229aab413b1e2d645faf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 27 Nov 2022 08:20:03 +1100 Subject: [PATCH] Fix for subscription cancellation where there are no outstanding invoices present to refund --- app/Services/Subscription/SubscriptionService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index 86344c4197..ac044bc235 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -923,7 +923,7 @@ class SubscriptionService $recurring_invoice_repo->archive($recurring_invoice); /* Refund only if we are in the window - and there is nothing outstanding on the invoice */ - if($refund_end_date->greaterThan(now()) && (int)$outstanding_invoice->balance == 0) + if($refund_end_date && $refund_end_date->greaterThan(now()) && (int)$outstanding_invoice->balance == 0) { if($outstanding_invoice->payments()->exists())