PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / trunk
Subscriptions for WooCommerce with Stripe Recurring Payments vtrunk
2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 All 65 releases
subscription / includes / Illuminate / Gateways / Paypal / Paypal_Blocks_Integration.php

Paypal_Blocks_Integration.php in Subscriptions for WooCommerce with Stripe Recurring Payments trunk, at includes/Illuminate/Gateways/Paypal/Paypal_Blocks_Integration.php

82 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SpringDevs\Subscription\Illuminate\Gateways\Paypal;
4
5 use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
6
7 /**
8 * Paypal Blocks Integration Class
9 * This class integrates the PayPal payment gateway with WooCommerce Blocks.
10 *
11 * @package SpringDevs\Subscription\Illuminate\Gateways\Paypal
12 */
13 final class Paypal_Blocks_Integration extends AbstractPaymentMethodType {
14
15 /**
16 * The gateway instance.
17 *
18 * @var Paypal
19 */
20 private $gateway;
21
22 /**
23 * Payment method name/id/slug.
24 *
25 * @var string
26 */
27 protected $name = 'wp_subscription_paypal';
28
29 /**
30 * Initialize the gateway.
31 *
32 * @return void
33 */
34 public function initialize() {
35 $this->settings = get_option( 'woocommerce_wp_subscription_paypal_settings', [] );
36 $this->gateway = Paypal::get_instance();
37 }
38
39 /**
40 * Check if the gateway is active.
41 *
42 * @return bool
43 */
44 public function is_active() {
45 return $this->gateway->is_available();
46 }
47
48 /**
49 * Get the payment method title.
50 *
51 * @return string
52 */
53 public function get_payment_method_script_handles() {
54 wp_register_script(
55 'wp_subscription_paypal-blocks-integration',
56 SUBSCRPT_URL . '/assets/js/wp_subscription_paypal-block.js',
57 [ 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n' ],
58 1,
59 true
60 );
61 if ( function_exists( 'wp_set_script_translations' ) ) {
62 wp_set_script_translations( 'wp_subscription_paypal-blocks-integration', 'subscription', SUBSCRPT_PATH . '/languages' );
63 }
64
65 return array( 'wp_subscription_paypal-blocks-integration' );
66 }
67
68 /**
69 * Get the payment method title.
70 *
71 * @return string
72 */
73 public function get_payment_method_data() {
74 return [
75 'title' => $this->gateway->title,
76 'description' => $this->gateway->description,
77 'icon' => $this->gateway->icon,
78 'features' => $this->gateway->supports,
79 ];
80 }
81 }
82