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 <a href="%s">system status</a> page for more details.', 'woocommerce'), admin_url('admin.php?page=wc-status'));
$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'));
add_action('woocommerce_order_status_on-hold_to_processing', array($this, 'capture_payment'));
add_action('woocommerce_order_status_on-hold_to_completed', array($this, 'capture_payment'));
if (!$this->is_valid_for_use()) {
$this->enabled = 'no';
} else {
include_once dirname(__FILE__) . '/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 dirname(__FILE__) . '/includes/class-wc-gateway-paypal-pdt-handler.php';
new WC_Gateway_Paypal_PDT_Handler($this->testmode, $this->identity_token);
}
}
}