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