Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Commit

Permalink
Added swapAndInvoice and incrementAndInvoice
Browse files Browse the repository at this point in the history
  • Loading branch information
sandervanhooft committed Dec 5, 2019
1 parent 3d51814 commit 738320c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 738320c

Please sign in to comment.