Actions
3 years ago
CommandHandlers
3 years ago
Commands
3 years ago
Contracts
3 years ago
Controllers
3 years ago
DataTransferObjects
3 years ago
Exceptions
4 years ago
Log
4 years ago
Routes
3 years ago
Traits
3 years ago
DonationSummary.php
3 years ago
PaymentGateway.php
3 years ago
PaymentGatewayRegister.php
3 years ago
SubscriptionModule.php
4 years ago
SubscriptionModule.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Framework\PaymentGateways; |
| 4 | |
| 5 | use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionAmountEditable; |
| 6 | use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionDashboardLinkable; |
| 7 | use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionPaymentMethodEditable; |
| 8 | use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionTransactionsSynchronizable; |
| 9 | use Give\Framework\PaymentGateways\Contracts\SubscriptionModuleInterface; |
| 10 | use Give\Framework\PaymentGateways\Traits\HasRouteMethods; |
| 11 | |
| 12 | /** |
| 13 | * @since 2.20.0 |
| 14 | * |
| 15 | * @template G |
| 16 | */ |
| 17 | abstract class SubscriptionModule implements SubscriptionModuleInterface |
| 18 | { |
| 19 | use HasRouteMethods; |
| 20 | |
| 21 | /** |
| 22 | * @var G |
| 23 | */ |
| 24 | protected $gateway; |
| 25 | |
| 26 | /** |
| 27 | * @param G $gateway |
| 28 | */ |
| 29 | public function setGateway(PaymentGateway $gateway) |
| 30 | { |
| 31 | $this->gateway = $gateway; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @inheritDoc |
| 36 | */ |
| 37 | public function canSyncSubscriptionWithPaymentGateway(): bool |
| 38 | { |
| 39 | return $this instanceof SubscriptionTransactionsSynchronizable; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * @inheritDoc |
| 44 | */ |
| 45 | public function canUpdateSubscriptionAmount(): bool |
| 46 | { |
| 47 | return $this instanceof SubscriptionAmountEditable; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @inheritDoc |
| 52 | */ |
| 53 | public function canUpdateSubscriptionPaymentMethod(): bool |
| 54 | { |
| 55 | return $this instanceof SubscriptionPaymentMethodEditable; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * @since 2.21.2 |
| 60 | */ |
| 61 | public function hasGatewayDashboardSubscriptionUrl(): bool |
| 62 | { |
| 63 | return $this instanceof SubscriptionDashboardLinkable; |
| 64 | } |
| 65 | } |
| 66 |