Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Updated actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki committed May 17, 2021
1 parent 0d05970 commit 0425c6e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/Contracts/HandleSubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ public function checkoutOnSubscription($subscription, $billable, Plan $plan, Req
/**
* Subscribe the user to a given plan.
*
* @param \RenokiCo\CashierRegister\Models\Stripe\Subscription $subscription
* @param \Illuminate\Database\Eloquent\Model $billable
* @param \RenokiCo\CashierRegister\Plan $plan
* @param \Illuminate\Http\Request $request
* @return void
*/
public function subscribeToPlan($subscription, $billable, Plan $plan, Request $request);
public function subscribeToPlan($billable, Plan $plan, Request $request);

/**
* Swap the current subscription plan.
Expand Down
5 changes: 1 addition & 4 deletions src/Http/Controllers/Inertia/SubscriptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@ public function swapPlan(HandleSubscriptions $manager, Request $request, string
// a default payment method set and we will initialize the subscription in case it is not subscribed
// to a plan with the given subscription name.
return $manager->subscribeToPlan(
$billable->newSubscription($request->subscription, $newPlan->getId()),
$billable,
$newPlan,
$request
$billable, $newPlan, $request
);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ public function checkoutOnSubscription($subscription, $billable, Plan $plan, Req
/**
* Subscribe the user to a given plan.
*
* @param \RenokiCo\CashierRegister\Models\Stripe\Subscription $subscription
* @param \Illuminate\Database\Eloquent\Model $billable
* @param \RenokiCo\CashierRegister\Plan $plan
* @param \Illuminate\Http\Request $request
* @return \RenokiCo\CashierRegister\Models\Stripe\Subscription
*/
public function subscribeToPlan($subscription, $billable, Plan $plan, Request $request)
public function subscribeToPlan($billable, Plan $plan, Request $request)
{
return $subscription->create($billable->defaultPaymentMethod()->id);
return $billable
->newSubscription($request->subscription, $plan->getId())
->create($billable->defaultPaymentMethod()->id);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions tests/Actions/HandleSubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ public function checkoutOnSubscription($subscription, $billable, Plan $plan, Req
/**
* Subscribe the user to a given plan.
*
* @param \RenokiCo\CashierRegister\Models\Stripe\Subscription $subscription
* @param \Illuminate\Database\Eloquent\Model $billable
* @param \RenokiCo\CashierRegister\Plan $plan
* @param \Illuminate\Http\Request $request
* @return void
*/
public function subscribeToPlan($subscription, $billable, Plan $plan, Request $request)
public function subscribeToPlan($billable, Plan $plan, Request $request)
{
return $subscription->create($billable->defaultPaymentMethod()->id);
return $billable
->newSubscription($request->subscription, $plan->getId())
->create($billable->defaultPaymentMethod()->id);
}

/**
Expand Down

0 comments on commit 0425c6e

Please sign in to comment.