From 738320c3fef280a5519450f3eafb52812dd87376 Mon Sep 17 00:00:00 2001 From: Sander van Hooft Date: Thu, 5 Dec 2019 16:51:13 +0100 Subject: [PATCH] Added swapAndInvoice and incrementAndInvoice --- src/Subscription.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Subscription.php b/src/Subscription.php index 3b393a27..024aacd9 100644 --- a/src/Subscription.php +++ b/src/Subscription.php @@ -208,6 +208,17 @@ public function swap(string $plan, $invoiceNow = true) return $this; } + /** + * Swap the subscription to a new plan, and invoice immediately. + * + * @param string $plan + * @return $this + */ + public function swapAndInvoice($plan) + { + return $this->swap($plan, true); + } + /** * Schedule this subscription to be swapped to another plan once the current cycle has completed. * @@ -543,6 +554,18 @@ public function incrementQuantity(int $count = 1, $invoiceNow = true) return $this->updateQuantity($this->quantity + $count, $invoiceNow); } + /** + * Increment the quantity of the subscription, and invoice immediately. + * + * @param int $count + * @return \Laravel\Cashier\Subscription + * @throws \Throwable + */ + public function incrementAndInvoice($count = 1) + { + return $this->incrementQuantity($count, true); + } + /** * Decrement the quantity of the subscription. *