/**
  * Constructor for the gateway.
  */
 public function __construct()
 {
     $this->id = 'paypal';
     $this->has_fields = false;
     $this->order_button_text = __('Proceed to PayPal', 'woocommerce');
     $this->method_title = __('PayPal', 'woocommerce');
     $this->method_description = sprintf(__('PayPal standard sends customers to PayPal to enter their payment information. PayPal IPN requires fsockopen/cURL support to update order statuses after payment. Check the %ssystem status%s page for more details.', 'woocommerce'), '<a href="' . admin_url('admin.php?page=wc-status') . '">', '</a>');
     $this->supports = array('products', 'refunds');
     // Load the settings.
     $this->init_form_fields();
     $this->init_settings();
     // Define user set variables
     $this->title = $this->get_option('title');
     $this->description = $this->get_option('description');
     $this->testmode = 'yes' === $this->get_option('testmode', 'no');
     $this->debug = 'yes' === $this->get_option('debug', 'no');
     $this->email = $this->get_option('email');
     $this->receiver_email = $this->get_option('receiver_email', $this->email);
     $this->identity_token = $this->get_option('identity_token');
     self::$log_enabled = $this->debug;
     add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     if (!$this->is_valid_for_use()) {
         $this->enabled = 'no';
     } else {
         include_once 'includes/class-wc-gateway-paypal-ipn-handler.php';
         new WC_Gateway_Paypal_IPN_Handler($this->testmode, $this->receiver_email);
         if ($this->identity_token) {
             include_once 'includes/class-wc-gateway-paypal-pdt-handler.php';
             new WC_Gateway_Paypal_PDT_Handler($this->testmode, $this->identity_token);
         }
     }
 }
예제 #2
0
 /**
  * Constructor for the gateway.
  */
 public function __construct()
 {
     $this->id = 'paypal';
     $this->has_fields = false;
     $this->order_button_text = __('Proceed to PayPal', 'woocommerce');
     $this->method_title = __('PayPal', 'woocommerce');
     $this->method_description = __('PayPal standard works by sending customers to PayPal where they can enter their payment information.', 'woocommerce');
     $this->supports = array('products', 'refunds');
     // Load the settings.
     $this->init_form_fields();
     $this->init_settings();
     // Define user set variables
     $this->title = $this->get_option('title');
     $this->description = $this->get_option('description');
     $this->testmode = 'yes' === $this->get_option('testmode', 'no');
     $this->debug = 'yes' === $this->get_option('debug', 'no');
     $this->email = $this->get_option('email');
     $this->receiver_email = $this->get_option('receiver_email', $this->email);
     $this->identity_token = $this->get_option('identity_token');
     self::$log_enabled = $this->debug;
     add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     if (!$this->is_valid_for_use()) {
         $this->enabled = 'no';
     } else {
         include_once 'includes/class-wc-gateway-paypal-ipn-handler.php';
         new WC_Gateway_Paypal_IPN_Handler($this->testmode, $this->receiver_email);
         if ($this->identity_token) {
             include_once 'includes/class-wc-gateway-paypal-pdt-handler.php';
             new WC_Gateway_Paypal_PDT_Handler($this->testmode, $this->identity_token);
         }
     }
 }