/**
  * 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;
     $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);
 }
 /**
  * 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.6.3
     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);
     // Save PayPal settings in WC 2.0+
     add_action('woocommerce_update_options_payment_gateways_paypal', __CLASS__ . '::save_subscription_form_fields', 11);
     // Check for IPN messages using the WC 1.x format
     add_action('init', __CLASS__ . '::check_for_old_ipn_requests', 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');
 }
 /**
  * Return the default WC PayPal gateway's settings.
  *
  * @since 1.2
  */
 private static function get_wc_paypal_settings()
 {
     if (!isset(self::$paypal_settings)) {
         self::$paypal_settings = get_option('woocommerce_paypal_settings');
     }
     return self::$paypal_settings;
 }