Пример #1
0
 /**
  * Bootstraps the class and hooks required actions & filters.
  *
  * @since 2.0
  */
 public static function init()
 {
     self::$paypal_settings = self::get_options();
     // wc-api handler for express checkout transactions
     if (!has_action('woocommerce_api_wcs_paypal')) {
         add_action('woocommerce_api_wcs_paypal', __CLASS__ . '::handle_wc_api');
     }
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::reload_options', 100);
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::are_reference_transactions_enabled', 100);
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_filter('woocommerce_paypal_args', __CLASS__ . '::get_paypal_args', 10, 2);
     // Check a valid PayPal IPN request to see if it's a subscription *before* WCS_Gateway_Paypal::successful_request()
     add_action('valid-paypal-standard-ipn-request', __CLASS__ . '::process_ipn_request', 0);
     add_action('woocommerce_scheduled_subscription_payment_paypal', __CLASS__ . '::process_subscription_payment', 10, 2);
     // Don't copy over PayPal details to Resubscribe Orders
     add_filter('wcs_resubscribe_order_created', __CLASS__ . '::remove_resubscribe_order_meta', 10, 2);
     // Triggered by WCS_SV_API_Base::broadcast_request() whenever an API request is made
     add_action('wc_paypal_api_request_performed', __CLASS__ . '::log_api_requests', 10, 2);
     add_filter('woocommerce_subscriptions_admin_meta_boxes_script_parameters', __CLASS__ . '::maybe_add_change_payment_method_warning');
     WCS_PayPal_Supports::init();
     WCS_PayPal_Status_Manager::init();
     WCS_PayPal_Standard_Switcher::init();
     if (is_admin()) {
         WCS_PayPal_Admin::init();
         WCS_PayPal_Change_Payment_Method_Admin::init();
     }
 }
 /**
  * Add subscription support to the PayPal Standard gateway only when credentials are set
  *
  * @since 1.0
  */
 public static function add_paypal_standard_subscription_support($is_supported, $feature, $gateway)
 {
     _deprecated_function(__METHOD__, '2.0', 'WCS_PayPal_Supports::add_feature_support( $is_supported, $feature, $gateway )');
     return WCS_PayPal_Supports::add_feature_support($is_supported, $feature, $gateway);
 }