Skip to content

Commit

Permalink
refactor: update interface so that canPauseSubscription needs to be i…
Browse files Browse the repository at this point in the history
…mplemented
  • Loading branch information
pauloiankoski committed Sep 21, 2024
1 parent 40a5af8 commit cef280a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@ public function pauseSubscription(Subscription $subscription, DateTime $resumesA
* @unreleased
*/
public function resumeSubscription(Subscription $subscription);

/**
* Check if subscription can be paused.
*
* @unreleased
*/
public function canPauseSubscription(): bool;
}
4 changes: 2 additions & 2 deletions src/Framework/PaymentGateways/PaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ public function resumeSubscription(Subscription $subscription)
*/
public function canPauseSubscription(): bool
{
if ($this->subscriptionModule) {
if ($this->subscriptionModule instanceof SubscriptionPausable) {
return $this->subscriptionModule->canPauseSubscription();
}

return $this->isFunctionImplementedInGatewayClass('pauseSubscription');
return false;
}

/**
Expand Down

0 comments on commit cef280a

Please sign in to comment.