*/ class AngellEYE_PayPal_Invoicing_WC_Payment extends WC_Payment_Gateway { /** * Constructor for the gateway. */ public function __construct() { $this->id = 'pifw_paypal_invoice'; $this->icon = apply_filters('woocommerce_pifw_paypal_invoice_icon', ''); $this->has_fields = false; $this->method_title = _x('PayPal Invoice', 'PayPal Invoice', 'angelleye-paypal-invoicing'); $this->method_description = __('PayPal Invoice', 'angelleye-paypal-invoicing'); $this->apifw_setting = get_option('apifw_setting'); $apifw_setting = $this->apifw_setting; $this->enable_paypal_sandbox = isset($apifw_setting['enable_paypal_sandbox']) ? $apifw_setting['enable_paypal_sandbox'] : ''; $this->sandbox_secret = isset($apifw_setting['sandbox_secret']) ? $apifw_setting['sandbox_secret'] : ''; $this->sandbox_client_id = isset($apifw_setting['sandbox_client_id']) ? $apifw_setting['sandbox_client_id'] : ''; $this->client_id = isset($apifw_setting['client_id']) ? $apifw_setting['client_id'] : ''; $this->secret = isset($apifw_setting['secret']) ? $apifw_setting['secret'] : ''; $this->paypal_email = isset($apifw_setting['paypal_email']) ? $apifw_setting['paypal_email'] : ''; $this->sandbox_paypal_email = isset($apifw_setting['sandbox_paypal_email']) ? $apifw_setting['sandbox_paypal_email'] : ''; $this->note_to_recipient = isset($apifw_setting['note_to_recipient']) ? $apifw_setting['note_to_recipient'] : ''; $this->terms_and_condition = isset($apifw_setting['terms_and_condition']) ? $apifw_setting['terms_and_condition'] : ''; $this->init_form_fields(); $this->init_settings(); $this->title = $this->get_option('title'); $this->description = $this->get_option('description'); $this->instructions = $this->get_option('instructions'); $this->is_enabled = 'yes' === $this->get_option('enabled', 'no'); $this->testmode = 'yes' === ($this->enable_paypal_sandbox == 'on' ? 'yes' : 'no'); $this->mode = ($this->testmode == true) ? 'SANDBOX' : 'LIVE'; if ($this->testmode == true) { $this->rest_client_id = $this->sandbox_client_id; $this->rest_secret_id = $this->sandbox_secret; $this->rest_paypal_email = $this->sandbox_paypal_email; } else { $this->rest_client_id = $this->client_id; $this->rest_secret_id = $this->secret; $this->rest_paypal_email = $this->paypal_email; } add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); add_action('woocommerce_thankyou_pifw_paypal_invoice', array($this, 'thankyou_page')); add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 3); } /** * Initialise Gateway Settings Form Fields. */ public function init_form_fields() { $this->form_fields = array( 'enabled' => array( 'title' => __('Enable/Disable', 'angelleye-paypal-invoicing'), 'type' => 'checkbox', 'label' => __('Enable PayPal Invoice', 'angelleye-paypal-invoicing'), 'default' => 'no', ), 'title' => array( 'title' => __('Title', 'angelleye-paypal-invoicing'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'angelleye-paypal-invoicing'), 'default' => _x('PayPal Invoice', 'PayPal Invoice', 'angelleye-paypal-invoicing'), 'desc_tip' => true, ), 'description' => array( 'title' => __('Description', 'angelleye-paypal-invoicing'), 'type' => 'textarea', 'description' => __('Payment method description that the customer will see on your checkout.', 'angelleye-paypal-invoicing'), 'default' => __('Please send a check to Store Name, Store Street, Store Town, Store State / County, Store Postcode.', 'angelleye-paypal-invoicing'), 'desc_tip' => true, ), 'instructions' => array( 'title' => __('Instructions', 'angelleye-paypal-invoicing'), 'type' => 'textarea', 'description' => __('Instructions that will be added to the thank you page and emails.', 'angelleye-paypal-invoicing'), 'default' => '', 'desc_tip' => true, ), ); } public function admin_options() { ?>
method_description, 'angelleye-paypal-invoicing'); ?>