/**
     * Initialize Gateway Settings Form Fields
     */
    function init_form_fields()
    {
        $require_ssl = '';
        if (!AngellEYE_Gateway_Paypal::is_ssl()) {
            $require_ssl = __('This image requires an SSL host.  Please upload your image to <a target="_blank" href="http://www.sslpic.com">www.sslpic.com</a> and enter the image URL here.', 'paypal-for-woocommerce');
        }
        $woocommerce_enable_guest_checkout = get_option('woocommerce_enable_guest_checkout');
        if (isset($woocommerce_enable_guest_checkout) && $woocommerce_enable_guest_checkout === "no") {
            $skip_final_review_option_not_allowed = ' (This is not available because your WooCommerce orders require an account.)';
        } else {
            $skip_final_review_option_not_allowed = '';
        }
        $args = array('sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'child_of' => 0, 'parent' => -1, 'exclude_tree' => '', 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish');
        $pages = get_pages($args);
        $cancel_page = array();
        foreach ($pages as $p) {
            $cancel_page[$p->ID] = $p->post_title;
        }
        $this->form_fields = array('enabled' => array('title' => __('Enable/Disable', 'paypal-for-woocommerce'), 'label' => __('Enable PayPal Express', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'description' => '', 'default' => 'no'), 'title' => array('title' => __('Title', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('This controls the title which the user sees during checkout.', 'paypal-for-woocommerce'), 'default' => __('PayPal Express', 'paypal-for-woocommerce')), 'description' => array('title' => __('Description', 'paypal-for-woocommerce'), 'type' => 'textarea', 'description' => __('This controls the description which the user sees during checkout.', 'paypal-for-woocommerce'), 'default' => __("Pay via PayPal; you can pay with your credit card if you don't have a PayPal account", 'paypal-for-woocommerce')), 'sandbox_api_username' => array('title' => __('Sandbox API User Name', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('Create sandbox accounts and obtain API credentials from within your <a href="http://developer.paypal.com">PayPal developer account</a>.', 'paypal-for-woocommerce'), 'default' => ''), 'sandbox_api_password' => array('title' => __('Sandbox API Password', 'paypal-for-woocommerce'), 'type' => 'password', 'default' => ''), 'sandbox_api_signature' => array('title' => __('Sandbox API Signature', 'paypal-for-woocommerce'), 'type' => 'password', 'default' => ''), 'api_username' => array('title' => __('Live API User Name', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('Get your live account API credentials from your PayPal account profile under the API Access section <br />or by using <a target="_blank" href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run">this tool</a>.', 'paypal-for-woocommerce'), 'default' => ''), 'api_password' => array('title' => __('Live API Password', 'paypal-for-woocommerce'), 'type' => 'password', 'default' => ''), 'api_signature' => array('title' => __('Live API Signature', 'paypal-for-woocommerce'), 'type' => 'password', 'default' => ''), 'testmode' => array('title' => __('PayPal Sandbox', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Enable PayPal Sandbox', 'paypal-for-woocommerce'), 'default' => 'yes', 'description' => __('The sandbox is PayPal\'s test environment and is only for use with sandbox accounts created within your <a href="http://developer.paypal.com" target="_blank">PayPal developer account</a>.', 'paypal-for-woocommerce')), 'debug' => array('title' => __('Debug', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Enable logging <code>/wp-content/uploads/wc-logs/paypal_express-{tag}.log</code>', 'paypal-for-woocommerce'), 'default' => 'no'), 'error_email_notify' => array('title' => __('Error Email Notifications', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Enable admin email notifications for errors.', 'paypal-for-woocommerce'), 'default' => 'yes', 'description' => __('This will send a detailed error email to the WordPress site administrator if a PayPal API error occurs.', 'paypal-for-woocommerce')), 'invoice_id_prefix' => array('title' => __('Invoice ID Prefix', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('Add a prefix to the invoice ID sent to PayPal. This can resolve duplicate invoice problems when working with multiple websites on the same PayPal account.', 'paypal-for-woocommerce')), 'checkout_with_pp_button_type' => array('title' => __('Checkout Button Type', 'paypal-for-woocommerce'), 'type' => 'select', 'label' => __('Use Checkout with PayPal image button', 'paypal-for-woocommerce'), 'class' => 'checkout_with_pp_button_type', 'options' => array('paypalimage' => __('PayPal Image', 'paypal-for-woocommerce'), 'textbutton' => __('Text Button', 'paypal-for-woocommerce'), 'customimage' => __('Custom Image', 'paypal-for-woocommerce'))), 'pp_button_type_my_custom' => array('title' => __('Select Image', 'paypal-for-woocommerce'), 'type' => 'text', 'label' => __('Use Checkout with PayPal image button', 'paypal-for-woocommerce'), 'class' => 'pp_button_type_my_custom'), 'pp_button_type_text_button' => array('title' => __('Custom Text', 'paypal-for-woocommerce'), 'type' => 'text', 'class' => 'pp_button_type_text_button', 'default' => 'Proceed to Checkout'), 'show_on_cart' => array('title' => __('Cart Page', 'paypal-for-woocommerce'), 'label' => __('Show Express Checkout button on shopping cart page.', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'default' => 'yes'), 'button_position' => array('title' => __('Cart Button Position', 'paypal-for-woocommerce'), 'label' => __('Where to display PayPal Express Checkout button(s).', 'paypal-for-woocommerce'), 'description' => __('Set where to display the PayPal Express Checkout button(s).'), 'type' => 'select', 'options' => array('top' => 'At the top, above the shopping cart details.', 'bottom' => 'At the bottom, below the shopping cart details.', 'both' => 'Both at the top and bottom, above and below the shopping cart details.'), 'default' => 'bottom'), 'show_on_checkout' => array('title' => __('Checkout Page Display', 'paypal-for-woocommerce'), 'type' => 'select', 'options' => array('no' => __("Do not display on checkout page.", 'paypal-for-woocommerce'), 'top' => __('Display at the top of the checkout page.', 'paypal-for-woocommerce'), 'regular' => __('Display in general list of enabled gatways on checkout page.', 'paypal-for-woocommerce'), 'both' => __('Display both at the top and in the general list of gateways on the checkout page.')), 'default' => 'top', 'description' => __('Displaying the checkout button at the top of the checkout page will allow users to skip filling out the forms and can potentially increase conversion rates.')), 'show_on_product_page' => array('title' => __('Product Page', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Show the Express Checkout button on product detail pages.', 'paypal-for-woocommerce'), 'default' => 'no', 'description' => __('Allows customers to checkout using PayPal directly from a product page.', 'paypal-for-woocommerce')), 'paypal_account_optional' => array('title' => __('PayPal Account Optional', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Allow customers to checkout without a PayPal account using their credit card.', 'paypal-for-woocommerce'), 'default' => 'no', 'description' => __('PayPal Account Optional must be turned on in your PayPal account profile under Website Preferences.', 'paypal-for-woocommerce')), 'landing_page' => array('title' => __('Landing Page', 'paypal-for-woocommerce'), 'type' => 'select', 'description' => __('Type of PayPal page to display as default. PayPal Account Optional must be checked for this option to be used.', 'paypal-for-woocommerce'), 'options' => array('login' => __('Login', 'paypal-for-woocommerce'), 'billing' => __('Billing', 'paypal-for-woocommerce')), 'default' => 'login'), 'error_display_type' => array('title' => __('Error Display Type', 'paypal-for-woocommerce'), 'type' => 'select', 'label' => __('Display detailed or generic errors', 'paypal-for-woocommerce'), 'class' => 'error_display_type_option', 'options' => array('detailed' => __('Detailed', 'paypal-for-woocommerce'), 'generic' => __('Generic', 'paypal-for-woocommerce')), 'description' => __('Detailed displays actual errors returned from PayPal.  Generic displays general errors that do not reveal details
									and helps to prevent fraudulant activity on your site.', 'paypal-for-woocommerce')), 'show_paypal_credit' => array('title' => __('Enable PayPal Credit', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Show the PayPal Credit button next to the Express Checkout button.', 'paypal-for-woocommerce'), 'default' => 'yes', 'description' => $this->not_us ? __('Currently disabled because PayPal Credit is only available for U.S. merchants.', 'paypal-for-woocommerce') : ""), 'use_wp_locale_code' => array('title' => __('Use WordPress Locale Code', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Pass the WordPress Locale Code setting to PayPal in order to display localized PayPal pages to buyers.', 'paypal-for-woocommerce'), 'default' => 'yes'), 'brand_name' => array('title' => __('Brand Name', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('This controls what users see as the brand / company name on PayPal review pages.', 'paypal-for-woocommerce'), 'default' => __(get_bloginfo('name'), 'paypal-for-woocommerce')), 'checkout_logo' => array('title' => __('PayPal Checkout Logo (190x90px)', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('This controls what users see as the logo on PayPal review pages. ', 'paypal-for-woocommerce') . $require_ssl, 'default' => ''), 'checkout_logo_hdrimg' => array('title' => __('PayPal Checkout Banner (750x90px)', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('This controls what users see as the header banner on PayPal review pages. ', 'paypal-for-woocommerce') . $require_ssl, 'default' => ''), 'customer_service_number' => array('title' => __('Customer Service Number', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('This controls what users see for your customer service phone number on PayPal review pages.', 'paypal-for-woocommerce'), 'default' => ''), 'gift_wrap_enabled' => array('title' => __('Gift Wrap', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Enables the gift wrap options for buyers.', 'paypal-for-woocommerce'), 'default' => 'no', 'description' => __('This will display a gift wrap option to buyers during checkout based on the following Gift Wrap settings.', 'paypal-for-woocommerce')), 'gift_message_enabled' => array('title' => __('Gift Message', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Enables the gift message widget on PayPal pages.', 'paypal-for-woocommerce'), 'default' => 'no', 'description' => __('This will allow buyers to enter a message they would like to include with the item as a gift.', 'paypal-for-woocommerce')), 'gift_receipt_enabled' => array('title' => __('Gift Receipt', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'label' => __('Enables the gift receipt widget on PayPal pages.', 'paypal-for-woocommerce'), 'default' => 'no', 'description' => __('This will allow buyers to choose whether or not to include a gift receipt in the order.', 'paypal-for-woocommerce')), 'gift_wrap_name' => array('title' => __('Gift Wrap Name', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('Label for the gift wrap option on PayPal pages, such as "Box with ribbon"', 'paypal-for-woocommerce'), 'default' => __('Box with ribbon', 'paypal-for-woocommerce')), 'gift_wrap_amount' => array('title' => __('Gift Wrap Amount', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('Amount to be charged to the buyer for adding the gift wrap option.', 'paypal-for-woocommerce'), 'default' => __('0.00', 'paypal-for-woocommerce')), 'angelleye_skip_text' => array('title' => __('Express Checkout Message', 'paypal-for-woocommerce'), 'type' => 'text', 'description' => __('This message will be displayed next to the PayPal Express Checkout button at the top of the checkout page.'), 'default' => __('Skip the forms and pay faster with PayPal!', 'paypal-for-woocommerce')), 'skip_final_review' => array('title' => __('Skip Final Review', 'paypal-for-woocommerce'), 'label' => __('Enables the option to skip the final review page.', 'paypal-for-woocommerce'), 'description' => __('By default, users will be returned from PayPal and presented with a final review page which includes shipping and tax in the order details.  Enable this option to eliminate this page in the checkout process.' . $skip_final_review_option_not_allowed), 'type' => 'checkbox', 'default' => 'no'), 'payment_action' => array('title' => __('Payment Action', 'paypal-for-woocommerce'), 'label' => __('Whether to process as a Sale or Authorization.', 'paypal-for-woocommerce'), 'description' => __('Sale will capture the funds immediately when the order is placed.  Authorization will authorize the payment but will not capture the funds.  You would need to capture funds through your PayPal account when you are ready to deliver.'), 'type' => 'select', 'options' => array('Sale' => 'Sale', 'Authorization' => 'Authorization'), 'default' => 'Sale'), 'billing_address' => array('title' => __('Billing Address', 'paypal-for-woocommerce'), 'label' => __('Set billing address in WooCommerce using the address returned by PayPal.', 'paypal-for-woocommerce'), 'description' => __('PayPal only returns a shipping address back to the website.  Enable this option if you would like to use this address for both billing and shipping in WooCommerce.'), 'type' => 'checkbox', 'default' => 'no'), 'cancel_page' => array('title' => __('Cancel Page', 'paypal-for-woocommerce'), 'description' => __('Sets the page users will be returned to if they click the Cancel link on the PayPal checkout pages.'), 'type' => 'select', 'options' => $cancel_page), 'send_items' => array('title' => __('Send Item Details', 'paypal-for-woocommerce'), 'label' => __('Send line item details to PayPal.', 'paypal-for-woocommerce'), 'type' => 'checkbox', 'description' => __('Include all line item details in the payment request to PayPal so that they can be seen from the PayPal transaction details page.', 'paypal-for-woocommerce'), 'default' => 'yes'));
        $this->form_fields = apply_filters('angelleye_ec_form_fields', $this->form_fields);
    }
 /**
  * Admin Script
  */
 function admin_scripts()
 {
     $dir = plugin_dir_path(__FILE__);
     wp_enqueue_media();
     wp_enqueue_script('jquery');
     // Localize the script with new data
     wp_register_script('angelleye_admin', plugins_url('/assets/js/angelleye-admin.js', __FILE__), array('jquery'));
     $translation_array = array('is_ssl' => AngellEYE_Gateway_Paypal::is_ssl() ? "yes" : "no", 'choose_image' => __('Choose Image', 'paypal-for-woocommerce'), 'shop_based_us' => substr(get_option("woocommerce_default_country"), 0, 2) == 'US' ? "yes" : "no");
     wp_localize_script('angelleye_admin', 'angelleye_admin', $translation_array);
     wp_enqueue_script('angelleye_admin');
 }