Actions
3 years ago
DataTransferObjects
3 years ago
Exceptions
4 years ago
Gateways
2 years ago
PayPalCommerce
2 years ago
Stripe
3 years ago
resources
4 years ago
PaymentGateway.php
4 years ago
PaypalSettingPage.php
3 years ago
ServiceProvider.php
2 years ago
SettingPage.php
4 years ago
ServiceProvider.php
83 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\PaymentGateways; |
| 4 | |
| 5 | use Give\Framework\LegacyPaymentGateways\Adapters\LegacyPaymentGatewayRegisterAdapter; |
| 6 | use Give\Framework\Migrations\MigrationsRegister; |
| 7 | use Give\Framework\PaymentGateways\PaymentGatewayRegister; |
| 8 | use Give\Framework\PaymentGateways\Routes\GatewayRoute; |
| 9 | use Give\Helpers\Hooks; |
| 10 | use Give\LegacyPaymentGateways\Actions\RegisterPaymentGatewaySettingsList; |
| 11 | use Give\PaymentGateways\Actions\RegisterPaymentGateways; |
| 12 | use Give\PaymentGateways\Gateways\PayPalStandard\Webhooks\WebhookRegister; |
| 13 | use Give\PaymentGateways\Gateways\Stripe\CheckoutGateway; |
| 14 | use Give\PaymentGateways\Gateways\Stripe\Controllers\UpdateStatementDescriptorAjaxRequestController; |
| 15 | use Give\PaymentGateways\Gateways\Stripe\Migrations\AddMissingTransactionIdForUncompletedDonations; |
| 16 | use Give\PaymentGateways\Gateways\Stripe\Migrations\AddStatementDescriptorToStripeAccounts; |
| 17 | use Give\PaymentGateways\PayPalCommerce\Migrations\RegisterPayPalDonationsRefreshTokenCronJobByMode; |
| 18 | use Give\PaymentGateways\PayPalCommerce\Migrations\RemoveLogWithCardInfo; |
| 19 | use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface; |
| 20 | |
| 21 | /** |
| 22 | * Class ServiceProvider - PaymentGateways |
| 23 | * |
| 24 | * The Service Provider for loading the Payment Gateways for Payment Flow 2.0 |
| 25 | * |
| 26 | * @since 2.18.0 |
| 27 | */ |
| 28 | class ServiceProvider implements ServiceProviderInterface |
| 29 | { |
| 30 | /** |
| 31 | * @inheritDoc |
| 32 | */ |
| 33 | public function register() |
| 34 | { |
| 35 | give()->singleton(PaymentGatewayRegister::class); |
| 36 | give()->singleton(WebhookRegister::class); |
| 37 | give()->alias(PaymentGatewayRegister::class, 'gateways'); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @inheritDoc |
| 42 | */ |
| 43 | public function boot() |
| 44 | { |
| 45 | $this->registerMigrations(); |
| 46 | |
| 47 | Hooks::addFilter('give_register_gateway', RegisterPaymentGateways::class); |
| 48 | Hooks::addFilter('give_payment_gateways', RegisterPaymentGatewaySettingsList::class); |
| 49 | Hooks::addFilter( |
| 50 | 'give_payment_gateways_admin_label', |
| 51 | LegacyPaymentGatewayRegisterAdapter::class, |
| 52 | 'updatePaymentGatewayAdminLabelsWithSupportedFormVersions', |
| 53 | 10, |
| 54 | 2 |
| 55 | ); |
| 56 | |
| 57 | Hooks::addAction('template_redirect', GatewayRoute::class); |
| 58 | Hooks::addAction( |
| 59 | 'wp_ajax_edit_stripe_account_statement_descriptor', |
| 60 | UpdateStatementDescriptorAjaxRequestController::class |
| 61 | ); |
| 62 | |
| 63 | /** |
| 64 | * Stripe Checkout Redirect Handler |
| 65 | */ |
| 66 | Hooks::addAction('wp_footer', CheckoutGateway::class, 'maybeHandleRedirect', 99999); |
| 67 | Hooks::addAction('give_embed_footer', CheckoutGateway::class, 'maybeHandleRedirect', 99999); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * @since 2.19.6 |
| 72 | */ |
| 73 | private function registerMigrations() |
| 74 | { |
| 75 | give(MigrationsRegister::class)->addMigrations([ |
| 76 | AddStatementDescriptorToStripeAccounts::class, |
| 77 | AddMissingTransactionIdForUncompletedDonations::class, |
| 78 | RemoveLogWithCardInfo::class, |
| 79 | RegisterPayPalDonationsRefreshTokenCronJobByMode::class |
| 80 | ]); |
| 81 | } |
| 82 | } |
| 83 |