| 1 |
<?php |
| 2 |
|
| 3 |
namespace Give\Framework\PaymentGateways\Contracts; |
| 4 |
|
| 5 |
use Give\Donations\Models\Donation; |
| 6 |
use Give\Framework\PaymentGateways\Commands\GatewayCommand; |
| 7 |
use Give\Framework\PaymentGateways\Commands\RedirectOffsite; |
| 8 |
use Give\Subscriptions\Models\Subscription; |
| 9 |
|
| 10 |
interface SubscriptionModuleInterface |
| 11 |
{ |
| 12 |
/** |
| 13 |
* Create a subscription with gateway |
| 14 |
* Note: You can use "givewp_create_subscription_gateway_data_{$gatewayId}" filter hook to pass additional data for gateway which helps/require to process initial subscription transaction. |
| 15 |
* This filter will help to add additional arguments to this function which should be optional otherwise you will get PHP fatal error. |
| 16 |
* |
| 17 |
* @since 2.21.2 Add third param to function to pass gateway data to process transaction |
| 18 |
* @since 2.18.0 |
| 19 |
* |
| 20 |
* @param array $gatewayData |
| 21 |
* |
| 22 |
* @return GatewayCommand|RedirectOffsite |
| 23 |
*/ |
| 24 |
public function createSubscription(Donation $donation, Subscription $subscription, $gatewayData); |
| 25 |
|
| 26 |
/** |
| 27 |
* Cancel subscription. |
| 28 |
* |
| 29 |
* @since 2.20.0 |
| 30 |
*/ |
| 31 |
public function cancelSubscription(Subscription $subscription); |
| 32 |
|
| 33 |
/** |
| 34 |
* Whether the gateway supports pausing subscriptions. |
| 35 |
* |
| 36 |
* @since 3.17.0 |
| 37 |
*/ |
| 38 |
public function canPauseSubscription(): bool; |
| 39 |
|
| 40 |
/** |
| 41 |
* Returns whether the gateway supports syncing subscriptions. |
| 42 |
* |
| 43 |
* @since 2.20.0 |
| 44 |
*/ |
| 45 |
public function canSyncSubscriptionWithPaymentGateway(): bool; |
| 46 |
|
| 47 |
/** |
| 48 |
* Whether the gateway supports updating subscription amount. |
| 49 |
* |
| 50 |
* @since 2.20.0 |
| 51 |
*/ |
| 52 |
public function canUpdateSubscriptionAmount(): bool; |
| 53 |
|
| 54 |
/** |
| 55 |
* Whether the gateway supports updating subscription method. |
| 56 |
* |
| 57 |
* @since 2.20.0 |
| 58 |
*/ |
| 59 |
public function canUpdateSubscriptionPaymentMethod(): bool; |
| 60 |
} |
| 61 |
|