/**
  * Bootstraps the class and hooks required actions & filters.
  *
  * @since 1.0
  */
 public static function init()
 {
     global $woocommerce;
     self::$paypal_settings = self::get_wc_paypal_settings();
     // Logs
     self::$debug = self::$paypal_settings['debug'] == 'yes' ? true : false;
     self::$log = self::$debug ? $woocommerce->logger() : '';
     // Set creds
     self::$api_username = isset(self::$paypal_settings['api_username']) ? self::$paypal_settings['api_username'] : '';
     self::$api_password = isset(self::$paypal_settings['api_password']) ? self::$paypal_settings['api_password'] : '';
     self::$api_signature = isset(self::$paypal_settings['api_signature']) ? self::$paypal_settings['api_signature'] : '';
     // Invoice prefix added in WC 1.6.3
     self::$invoice_prefix = isset(self::$paypal_settings['invoice_prefix']) ? self::$paypal_settings['invoice_prefix'] : '';
     self::$api_endpoint = self::$paypal_settings['testmode'] == 'no' ? 'https://api-3t.paypal.com/nvp' : 'https://api-3t.sandbox.paypal.com/nvp';
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_filter('woocommerce_paypal_args', __CLASS__ . '::paypal_standard_subscription_args');
     // Check a valid PayPal IPN request to see if it's a subscription *before* WC_Paypal::successful_request()
     add_action('valid-paypal-standard-ipn-request', __CLASS__ . '::process_paypal_ipn_request', 9);
     // Set the PayPal Standard gateway to support subscriptions after it is added to the woocommerce_payment_gateways array
     add_filter('woocommerce_payment_gateway_supports', __CLASS__ . '::add_paypal_standard_subscription_support', 10, 3);
     // Add PayPal API fields to PayPal form fields as required
     add_action('woocommerce_settings_start', __CLASS__ . '::add_subscription_form_fields', 100);
     add_action('woocommerce_api_wc_gateway_paypal', __CLASS__ . '::add_subscription_form_fields', 100);
     // Save PayPal settings in WC 2.0+
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::save_subscription_form_fields', 11);
     // When a subscriber or store manager changes a subscription's status in the store, change the status with PayPal
     add_action('cancelled_subscription_paypal', __CLASS__ . '::cancel_subscription_with_paypal', 10, 2);
     add_action('subscription_put_on-hold_paypal', __CLASS__ . '::suspend_subscription_with_paypal', 10, 2);
     add_action('reactivated_subscription_paypal', __CLASS__ . '::reactivate_subscription_with_paypal', 10, 2);
     // Don't copy over PayPal details to new Parent Orders
     add_filter('woocommerce_subscriptions_renewal_order_meta_query', __CLASS__ . '::remove_renewal_order_meta', 10, 4);
     // Maybe show notice to enter PayPal API credentials
     add_action('admin_notices', __CLASS__ . '::maybe_show_admin_notice');
 }
 /**
  * Bootstraps the class and hooks required actions & filters.
  * 
  * @since 1.0
  */
 public static function init()
 {
     global $woocommerce;
     $paypal_settings = self::get_wc_paypal_settings();
     // Logs
     self::$debug = $paypal_settings['debug'] == 'yes' ? true : false;
     self::$log = self::$debug ? $woocommerce->logger() : '';
     // Set creds
     self::$api_username = isset($paypal_settings['api_username']) ? $paypal_settings['api_username'] : '';
     self::$api_password = isset($paypal_settings['api_password']) ? $paypal_settings['api_password'] : '';
     self::$api_signature = isset($paypal_settings['api_signature']) ? $paypal_settings['api_signature'] : '';
     // Invoice prefix added in WC 1.7
     self::$invoice_prefix = isset($paypal_settings['invoice_prefix']) ? $paypal_settings['invoice_prefix'] : '';
     self::$api_endpoint = $paypal_settings['testmode'] == 'no' ? 'https://api-3t.paypal.com/nvp' : 'https://api-3t.sandbox.paypal.com/nvp';
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_filter('woocommerce_paypal_args', __CLASS__ . '::paypal_standard_subscription_args');
     // Check a valid PayPal IPN request to see if it's a subscription *before* WC_Paypal::successful_request()
     add_action('valid-paypal-standard-ipn-request', __CLASS__ . '::process_paypal_ipn_request', 9);
     // Set the PayPal Standard gateway to support subscriptions after it is added to the woocommerce_payment_gateways array
     add_filter('woocommerce_payment_gateway_supports', __CLASS__ . '::add_paypal_standard_subscription_support', 10, 3);
     // Add PayPal API fields to PayPal form fields
     add_action('init', __CLASS__ . '::add_subscription_form_fields', 100);
     // When a subscriber or store manager cancel's a subscription in the store, suspend it with PayPal
     add_action('cancelled_subscription_paypal', __CLASS__ . '::cancel_subscription_with_paypal', 10, 2);
     add_action('suspended_subscription_paypal', __CLASS__ . '::suspend_subscription_with_paypal', 10, 2);
     add_action('reactivated_subscription_paypal', __CLASS__ . '::reactivate_subscription_with_paypal', 10, 2);
 }
 /**
  * Set the public properties to make sure  we don't trigger any fatal errors even though the class is deprecated.
  *
  * @since 1.0
  */
 public static function init()
 {
     self::$api_username = WCS_PayPal::get_option('api_username');
     self::$api_password = WCS_PayPal::get_option('api_password');
     self::$api_signature = WCS_PayPal::get_option('api_signature');
     self::$api_endpoint = 'no' == WCS_PayPal::get_option('testmode') ? 'https://api-3t.paypal.com/nvp' : 'https://api-3t.sandbox.paypal.com/nvp';
 }
 /**
  * Bootstraps the class and hooks required actions & filters.
  *
  * @since 1.0
  */
 public static function init()
 {
     global $woocommerce;
     self::$paypal_settings = self::get_wc_paypal_settings();
     // Logs
     self::$debug = self::$paypal_settings['debug'] == 'yes' ? true : false;
     if (self::$debug) {
         self::$log = class_exists('WC_Logger') ? new WC_Logger() : $woocommerce->logger();
         // WC <> 2.1
     } else {
         self::$log = '';
     }
     // Set creds
     self::$api_username = isset(self::$paypal_settings['api_username']) ? self::$paypal_settings['api_username'] : '';
     self::$api_password = isset(self::$paypal_settings['api_password']) ? self::$paypal_settings['api_password'] : '';
     self::$api_signature = isset(self::$paypal_settings['api_signature']) ? self::$paypal_settings['api_signature'] : '';
     // Invoice prefix added in WC 1.6.3
     self::$invoice_prefix = isset(self::$paypal_settings['invoice_prefix']) ? self::$paypal_settings['invoice_prefix'] : '';
     self::$api_endpoint = self::$paypal_settings['testmode'] == 'no' ? 'https://api-3t.paypal.com/nvp' : 'https://api-3t.sandbox.paypal.com/nvp';
     // When necessary, set the PayPal args to be for a subscription instead of shopping cart
     add_filter('woocommerce_paypal_args', __CLASS__ . '::paypal_standard_subscription_args');
     // Check a valid PayPal IPN request to see if it's a subscription *before* WC_Paypal::successful_request()
     add_action('valid-paypal-standard-ipn-request', __CLASS__ . '::process_paypal_ipn_request', 0);
     // Set the PayPal Standard gateway to support subscriptions after it is added to the woocommerce_payment_gateways array
     add_filter('woocommerce_payment_gateway_supports', __CLASS__ . '::add_paypal_standard_subscription_support', 10, 3);
     // Add PayPal API fields to PayPal form fields as required
     add_action('woocommerce_settings_start', __CLASS__ . '::add_subscription_form_fields', 100);
     add_action('woocommerce_api_wc_gateway_paypal', __CLASS__ . '::add_subscription_form_fields', 100);
     // Save PayPal settings
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::save_subscription_form_fields', 11);
     // When a subscriber or store manager changes a subscription's status in the store, change the status with PayPal
     add_action('cancelled_subscription_paypal', __CLASS__ . '::cancel_subscription_with_paypal', 10, 2);
     add_action('subscription_put_on-hold_paypal', __CLASS__ . '::suspend_subscription_with_paypal', 10, 2);
     add_action('reactivated_subscription_paypal', __CLASS__ . '::reactivate_subscription_with_paypal', 10, 2);
     // Don't copy over PayPal details to new Parent Orders
     add_filter('woocommerce_subscriptions_renewal_order_meta_query', __CLASS__ . '::remove_renewal_order_meta', 10, 4);
     // Maybe show notice to enter PayPal API credentials
     add_action('admin_notices', __CLASS__ . '::maybe_show_admin_notice');
     // When a payment is due, schedule a special check in one days time to make sure the payment went through
     add_action('scheduled_subscription_payment_paypal', __CLASS__ . '::scheduled_subscription_payment', 10, 3);
     // Don't automatically cancel a subscription with PayPal on payment method change - we'll cancel it ourselves
     add_action('woocommerce_subscriptions_pre_update_recurring_payment_method', __CLASS__ . '::maybe_remove_cancelled_subscription_hook', 10, 4);
     add_action('woocommerce_subscriptions_updated_recurring_payment_method', __CLASS__ . '::maybe_readd_cancelled_subscription_hook', 10, 4);
     // Don't update payment methods immediately when changing to PayPal - wait for the IPN notification
     add_filter('woocommerce_subscriptions_update_recurring_payment_via_pay_shortcode', __CLASS__ . '::maybe_dont_update_payment_method', 10, 2);
 }