Ejemplo n.º 1
0
 /**
  * Construct
  */
 function __construct()
 {
     parent::__construct();
     //** Fields for front-end. */
     $this->front_end_fields = array('customer_information' => array('first_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'first_name', 'label' => __('First Name', WPI)), 'last_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'last_name', 'label' => __('Last Name', WPI)), 'user_email' => array('type' => 'text', 'class' => 'text-input', 'name' => 'email_address', 'label' => __('Email Address', WPI)), 'phonenumber' => array('type' => 'text', 'class' => 'text-input', 'name' => 'phonenumber', 'label' => __('Phone', WPI)), 'streetaddress' => array('type' => 'text', 'class' => 'text-input', 'name' => 'address1', 'label' => __('Address', WPI)), 'city' => array('type' => 'text', 'class' => 'text-input', 'name' => 'city', 'label' => __('City', WPI)), 'state' => array('type' => 'text', 'class' => 'text-input', 'name' => 'state', 'label' => __('State/Province', WPI)), 'zip' => array('type' => 'text', 'class' => 'text-input', 'name' => 'zip', 'label' => __('Zip/Postal Code', WPI))));
     $this->options = array('name' => 'Stripe', 'allow' => '', 'default_option' => '', 'settings' => array('test_secret_key' => array('label' => "Test Secret Key", 'value' => ''), 'test_publishable_key' => array('label' => "Test Publishable Key", 'value' => ''), 'live_secret_key' => array('label' => "Live Secret Key", 'value' => ''), 'live_publishable_key' => array('label' => "Live Publishable Key", 'value' => ''), 'mode' => array('label' => __("Mode", WPI), 'description' => "Stripe payment mode", 'type' => 'select', 'value' => 'test', 'data' => array('test' => "Test", 'live' => "Live")), 'webhook_url' => array('label' => __("Webhook URL", WPI), 'type' => "readonly", 'value' => admin_url('admin-ajax.php?action=wpi_gateway_server_callback&type=wpi_stripe'), 'description' => __("Use webhooks to be notified about events that happen in your Stripe account.", WPI))));
 }
Ejemplo n.º 2
0
 /**
  * Construct
  */
 public function __construct()
 {
     parent::__construct();
     $this->options = array('name' => 'InterKassa', 'allow' => '', 'default_option' => '', 'settings' => array('ik_shop_id' => array('label' => __("Shop ID", WPI), 'value' => ''), 'secret_key' => array('label' => __("Secret Key", WPI), 'value' => ''), 'test_key' => array('label' => __("Test Key", WPI), 'value' => ''), 'ipn' => array('label' => __("Status URL", WPI), 'type' => "readonly", 'description' => __("Use this URL as Status URL in Merchant settings to get notified once payments made.", WPI))));
     //** Fields for front-end. */
     $this->front_end_fields = array('customer_information' => array('first_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'first_name', 'label' => __('First Name', WPI)), 'last_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'last_name', 'label' => __('Last Name', WPI)), 'user_email' => array('type' => 'text', 'class' => 'text-input', 'name' => 'email_address', 'label' => __('Email Address', WPI)), 'phonenumber' => array('type' => 'text', 'class' => 'text-input', 'name' => 'phonenumber', 'label' => __('Phone', WPI)), 'streetaddress' => array('type' => 'text', 'class' => 'text-input', 'name' => 'address1', 'label' => __('Address', WPI)), 'city' => array('type' => 'text', 'class' => 'text-input', 'name' => 'city', 'label' => __('City', WPI)), 'state' => array('type' => 'text', 'class' => 'text-input', 'name' => 'state', 'label' => __('State/Province', WPI)), 'zip' => array('type' => 'text', 'class' => 'text-input', 'name' => 'zip', 'label' => __('Zip/Postal Code', WPI))));
     $this->options['settings']['ipn']['value'] = admin_url('admin-ajax.php?action=wpi_gateway_server_callback&type=wpi_interkassa');
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->options = array('name' => __('2Checkout', WPI), 'allow' => '', 'default_option' => '', 'settings' => array('twocheckout_sid' => array('label' => __("2Checkout Seller ID", WPI), 'value' => ''), 'twocheckout_secret' => array('label' => __("2Checkout Secret Word", WPI), 'value' => ''), 'test_mode' => array('label' => __("Demo Mode", WPI), 'description' => __("Use 2Checkout Demo Mode", WPI), 'type' => 'select', 'value' => 'N', 'data' => array('N' => __("No", WPI), 'Y' => __("Yes", WPI))), 'passback' => array('label' => __("2Checkout Approved URL/INS URL", WPI), 'type' => "readonly", 'description' => __("Set this URL as your Approved URL in your 2Checkout Site Management page and Notification URL under your 2Checkout Notification page.", WPI))));
     //** Fields for front-end. */
     $this->front_end_fields = array('customer_information' => array('first_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'first_name', 'label' => __('First Name', WPI)), 'last_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'last_name', 'label' => __('Last Name', WPI)), 'user_email' => array('type' => 'text', 'class' => 'text-input', 'name' => 'email', 'label' => __('Email Address', WPI)), 'phonenumber' => array('type' => 'text', 'class' => 'text-input', 'name' => 'phonenumber', 'label' => __('Phone', WPI)), 'streetaddress' => array('type' => 'text', 'class' => 'text-input', 'name' => 'street_address', 'label' => __('Address', WPI)), 'country' => array('type' => 'text', 'class' => 'text-input', 'name' => 'country', 'label' => __('Country', WPI)), 'city' => array('type' => 'text', 'class' => 'text-input', 'name' => 'city', 'label' => __('City', WPI)), 'state' => array('type' => 'text', 'class' => 'text-input', 'name' => 'state', 'label' => __('State/Province', WPI)), 'zip' => array('type' => 'text', 'class' => 'text-input', 'name' => 'zip', 'label' => __('Zip/Postal Code', WPI))));
     $this->options['settings']['passback']['value'] = admin_url('admin-ajax.php?action=wpi_gateway_server_callback&type=wpi_twocheckout');
     self::$_options = $this->options;
 }
Ejemplo n.º 4
0
 /**
  * Construct
  */
 function __construct()
 {
     parent::__construct();
     /**
      * Opations array for settings page
      */
     $this->options = array('name' => 'Credit Card', 'public_name' => 'Credit Card', 'allow' => true, 'default_option' => '', 'settings' => array('gateway_username' => array('label' => __("Gateway Username", WPI), 'value' => '', 'description' => __("Your credit card processor will provide you with a gateway username.", WPI)), 'gateway_tran_key' => array('label' => __("Gateway Transaction Key", WPI), 'value' => "", 'description' => __("You will be able to generate this in your credit card processor's control panel.", WPI)), 'gateway_url' => array('label' => __("Gateway URL", WPI), 'value' => "", 'description' => __("This is the URL provided to you by your credit card processing company.", WPI), 'special' => array('MerchantPlus' => 'https://gateway.merchantplus.com/cgi-bin/PAWebClient.cgi', 'Authorize.Net' => 'https://secure.authorize.net/gateway/transact.dll', 'Authorize.Net Developer' => 'https://test.authorize.net/gateway/transact.dll')), 'recurring_gateway_url' => array('label' => __("Recurring Billing Gateway URL", WPI), 'value' => "", 'description' => __("Recurring billing gateway URL is most likely different from the Gateway URL, and will almost always be with Authorize.net. Be advised - test credit card numbers will be declined even when in test mode.", WPI), 'special' => array('Authorize.net ARB' => 'https://api.authorize.net/xml/v1/request.api', 'Authorize.Net ARB Testing' => 'https://apitest.authorize.net/xml/v1/request.api')), 'gateway_test_mode' => array('label' => __("Test / Live Mode", WPI), 'type' => "select", 'data' => array("TRUE" => __("Test - Do Not Process Transactions", WPI), "FALSE" => __("Live - Process Transactions", WPI))), 'gateway_delim_char' => array('label' => __("Delimiter Character", WPI), 'value' => ",", 'description' => __("Get this from your credit card processor. If the transactions are not going through, this character is most likely wrong.", WPI)), 'gateway_encap_char' => array('label' => __("Encapsulation Character", WPI), 'value' => "", 'description' => __("Authorize.net default is blank. Otherwise, get this from your credit card processor. If the transactions are going through, but getting strange responses, this character is most likely wrong.", WPI)), 'gateway_email_customer' => array('label' => __("Email Customer (on success)", WPI), 'type' => "select", 'value' => '', 'data' => array("TRUE" => __("Yes", WPI), "FALSE" => __("No", WPI))), 'gateway_merchant_email' => array('label' => __("Merchant Email", WPI), 'value' => "", 'description' => __("Email address to which the merchant's copy of the customer confirmation email should be sent. If a value is submitted, an email will be sent to this address as well as the address(es) configured in the Merchant Interface.", WPI)), 'gateway_header_email_receipt' => array('label' => __("Customer Receipt Email Header", WPI), 'value' => ""), 'gateway_MD5Hash' => array('label' => __("Security: MD5 Hash", WPI), 'value' => ""), 'gateway_delim_data' => array('label' => __("Delim Data", WPI), 'type' => "select", 'value' => '', 'data' => array("TRUE" => __("Yes", WPI), "FALSE" => __("No", WPI))), 'silent_post_url' => array('label' => __("Silent Post URL", WPI), 'type' => "readonly", 'value' => "", 'description' => __("Silent Post responses are returned in real-time, meaning as soon as the transaction processes the Silent Post is sent to your specified URL. Go to https://account.authorize.net -> Settings -> Silent Post URL and copy this URL to input field. Required only for Recurring Billing and not for all Merchants.", WPI))));
     /**
      * Fields list for frontend
      */
     $this->front_end_fields = array('customer_information' => array('first_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[first_name]', 'label' => __('First Name', WPI)), 'last_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[last_name]', 'label' => __('Last Name', WPI)), 'user_email' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[user_email]', 'label' => __('User Email', WPI)), 'phonenumber' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[phonenumber]', 'label' => __('Phone Number', WPI)), 'streetaddress' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[streetaddress]', 'label' => __('Address', WPI)), 'city' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[city]', 'label' => __('City', WPI)), 'state' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[state]', 'label' => __('State', WPI)), 'zip' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[zip]', 'label' => __('Zip', WPI)), 'country' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[country]', 'label' => __('Country', WPI))), 'billing_information' => array('card_num' => array('type' => 'text', 'class' => 'credit_card_number input_field text-input', 'name' => 'cc_data[card_num]', 'label' => __('Card Number', WPI)), 'exp_month' => array('type' => 'text', 'class' => 'text-input exp_month', 'name' => 'cc_data[exp_month]', 'label' => __('Expiration Month', WPI)), 'exp_year' => array('type' => 'text', 'class' => 'text-input exp_year', 'name' => 'cc_data[exp_year]', 'label' => __('Expiration Year', WPI)), 'card_code' => array('type' => 'text', 'class' => 'text-input', 'name' => 'cc_data[card_code]', 'label' => __('Card Code', WPI))));
     $this->options['settings']['silent_post_url']['value'] = admin_url('admin-ajax.php?action=wpi_gateway_server_callback&type=wpi_authorize');
     add_action('wpi_authorize_user_meta_updated', array($this, 'user_meta_updated'));
 }
Ejemplo n.º 5
0
 /**
  * Constructor
  */
 function __construct()
 {
     parent::__construct();
     /**
      * Payment settings
      *
      * @var array
      */
     $this->options = array('name' => 'PayPal', 'allow' => '', 'default_option' => '', 'settings' => array('paypal_address' => array('label' => __("PayPal Username", WPI), 'value' => ''), 'test_mode' => array('label' => __("Use in Test Mode", WPI), 'description' => __("Use PayPal SandBox for test mode", WPI), 'type' => 'select', 'value' => 'N', 'data' => array('N' => __("No", WPI), 'Y' => __("Yes", WPI))), 'ipn' => array('label' => __("PayPal IPN URL", WPI), 'type' => "readonly", 'description' => __("Once IPN is integrated, sellers can automate their back office so they don't have to wait for payments to come in to trigger order fulfillment. Setup this URL into your PayPal Merchant Account Settings.", WPI)), 'send_notify_url' => array('label' => __("Send IPN URL with payment request?", WPI), 'description' => __('Use this option if you did not set IPN in your PayPal account.', WPI), 'type' => "select", 'value' => '', 'data' => array("1" => __("Yes", WPI), "0" => __("No", WPI)))));
     /**
      * Fields list for frontend
      */
     $this->front_end_fields = array('customer_information' => array('first_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'first_name', 'label' => __('First Name', WPI)), 'last_name' => array('type' => 'text', 'class' => 'text-input', 'name' => 'last_name', 'label' => __('Last Name', WPI)), 'user_email' => array('type' => 'text', 'class' => 'text-input', 'name' => 'email_address', 'label' => __('Email Address', WPI)), 'phonenumber' => array(array('type' => 'text', 'class' => 'text-input small', 'name' => 'night_phone_a'), array('type' => 'text', 'class' => 'text-input small', 'name' => 'night_phone_b'), array('type' => 'text', 'class' => 'text-input small', 'name' => 'night_phone_c')), 'streetaddress' => array('type' => 'text', 'class' => 'text-input', 'name' => 'address1', 'label' => __('Address', WPI)), 'city' => array('type' => 'text', 'class' => 'text-input', 'name' => 'city', 'label' => __('City', WPI)), 'state' => array('type' => 'text', 'class' => 'text-input', 'name' => 'state', 'label' => __('State/Province', WPI)), 'zip' => array('type' => 'text', 'class' => 'text-input', 'name' => 'zip', 'label' => __('Zip/Postal Code', WPI)), 'country' => array('type' => 'text', 'class' => 'text-input', 'name' => 'country', 'label' => __('Country', WPI))));
     $this->options['settings']['ipn']['value'] = admin_url('admin-ajax.php?action=wpi_gateway_server_callback&type=wpi_paypal');
 }
    /**
     * Saves passed settings
     * 
     * @global array $wpi_settings
     * @param array $new_settings 
     */
    function SaveSettings($new_settings) {
      global $wpi_settings;
        
        //** Set 'first_time_setup_ran' as 'true' to avoid loading First Time Setup Page in future */
        $new_settings['first_time_setup_ran'] = 'true';
        
        $this->options = WPI_Functions::array_merge_recursive_distinct($this->options, $new_settings);
        
        //** Copy template files from plugin folder to active theme/template */
        if(isset($new_settings['install_use_custom_templates']) &&
          isset($new_settings['use_custom_templates']) &&
          $new_settings['install_use_custom_templates'] == 'yes' && 
          $new_settings['use_custom_templates'] == 'yes') {
            WPI_Functions::install_templates();
        }
        
        //** Process Special Settings */
        //** Default predefined services */
        $this->options['predefined_services'][0]['name']     = __("Web Design Services", WPI);
        $this->options['predefined_services'][0]['quantity'] = 1;
        $this->options['predefined_services'][0]['price']    = 30;
        $this->options['predefined_services'][1]['name']     = __("Web Development Services", WPI);
        $this->options['predefined_services'][1]['quantity'] = 1;
        $this->options['predefined_services'][1]['price']    = 30;
        
        $this->options['predefined_services'] = ( isset($new_settings['predefined_services']) ? $new_settings['predefined_services'] : $this->options['predefined_services'] );

        //** E-Mail Templates */
        if(isset($new_settings['notification'])) {
          $this->options['notification'] = $new_settings['notification'];
        }
        
        //** Process Special Settings */
        
        //** fix checkboxes */
        foreach($this->options['billing'] as $key => $value) {
            if(!isset($new_settings['billing'][$key]['allow'])) unset($this->options['billing'][$key]['allow']);
        }
        
        $checkbox_array = array('increment_invoice_id', 'send_thank_you_email', 'cc_thank_you_email', 'force_https', 'show_recurring_billing', 'send_invoice_creator_email');
        foreach($checkbox_array as $checkbox_name) {
            if(!isset($new_settings[$checkbox_name])) unset($this->options[$checkbox_name]);
        }
        
        $this->CommitUpdates();
        
        //** Update global variable */
        $wpi_settings = WPI_Functions::array_merge_recursive_distinct($wpi_settings, $this->options);
        //** Fix Predefined Services */
        $wpi_settings['predefined_services'] = $this->options['predefined_services'];
        //** Fix E-Mail Templates */
        $wpi_settings['notification'] = $this->options['notification'];
        wpi_gateway_base::sync_billing_objects();
    }
Ejemplo n.º 7
0
 /**
  * Saves passed settings
  *
  * @global array $wpi_settings
  *
  * @param array $new_settings
  */
 function SaveSettings($new_settings)
 {
     global $wpi_settings;
     //** Set 'first_time_setup_ran' as 'true' to avoid loading First Time Setup Page in future */
     $new_settings['first_time_setup_ran'] = 'true';
     $this->options = WPI_Functions::array_merge_recursive_distinct($this->options, $new_settings);
     //** just fo now we use the merged options array and overwrite two brances with new values. It is the custom solution to be able detete currency. odokienko@UD */
     if (isset($new_settings['currency']) && $new_settings['currency']) {
         $this->options['currency']['symbol'] = $new_settings['currency']['symbol'];
         $this->options['currency']['types'] = $new_settings['currency']['types'];
     }
     //** Process Special Settings */
     //** Default predefined services */
     $this->options['predefined_services'][0]['name'] = __("Web Design Services", WPI);
     $this->options['predefined_services'][0]['quantity'] = 1;
     $this->options['predefined_services'][0]['price'] = 30;
     $this->options['predefined_services'][1]['name'] = __("Web Development Services", WPI);
     $this->options['predefined_services'][1]['quantity'] = 1;
     $this->options['predefined_services'][1]['price'] = 30;
     $this->options['predefined_services'] = isset($new_settings['predefined_services']) ? $new_settings['predefined_services'] : $this->options['predefined_services'];
     //** E-Mail Templates */
     if (isset($new_settings['notification'])) {
         $this->options['notification'] = $new_settings['notification'];
     }
     //** fix checkboxes */
     foreach ($this->options['billing'] as $key => $value) {
         if (!isset($new_settings['billing'][$key]['allow'])) {
             unset($this->options['billing'][$key]['allow']);
         }
     }
     $checkbox_array = array('increment_invoice_id', 'send_thank_you_email', 'cc_thank_you_email', 'force_https', 'show_recurring_billing', 'send_invoice_creator_email');
     foreach ($checkbox_array as $checkbox_name) {
         if (!isset($new_settings[$checkbox_name])) {
             unset($this->options[$checkbox_name]);
         }
     }
     $this->CommitUpdates();
     //** Update global variable */
     $wpi_settings = WPI_Functions::array_merge_recursive_distinct($wpi_settings, $this->options);
     //** Fix Predefined Services */
     $wpi_settings['predefined_services'] = $this->options['predefined_services'];
     //** Fix E-Mail Templates */
     $wpi_settings['notification'] = $this->options['notification'];
     wpi_gateway_base::sync_billing_objects();
 }
 /**
  * Construct
  */
 function __construct() {
   parent::__construct();
   $this->options['settings']['silent_post_url']['value'] = urlencode(get_bloginfo('url') . '/wp-admin/admin-ajax.php?action=wpi_gateway_server_callback&type=wpi_authorize');
   
   add_action( 'wpi_payment_fields_authorize', array( $this, 'wpi_payment_fields' ) );
   add_action( 'wpi_authorize_user_meta_updated', array( $this, 'user_meta_updated' ) );
 }
Ejemplo n.º 9
0
 /**
  * This function loads our payment gateways
  *
  * @since 3.0
  */
 function load_gateways()
 {
     global $wpi_settings;
     $default_headers = array('Name' => __('Name', 'wpi_gateway'), 'Version' => __('Version', 'wpi_gateway'), 'Description' => __('Description', 'wpi_gateway'));
     if (!is_dir(WPI_Gateways_Path)) {
         return;
     }
     if ($premium_dir = opendir(WPI_Gateways_Path)) {
         if (file_exists(WPI_Gateways_Path . "/index.php")) {
             if (WP_DEBUG) {
                 include_once WPI_Gateways_Path . "/index.php";
             } else {
                 @(include_once WPI_Gateways_Path . "/index.php");
             }
         }
         while (false !== ($file = readdir($premium_dir))) {
             if ($file == 'index.php') {
                 continue;
             }
             $ex = explode(".", $file);
             if (end($ex) == 'php') {
                 $slug = str_replace(array('.php'), '', $file);
                 if (substr($slug, 0, 6) == "class_") {
                     $t = explode("class_", $slug);
                     $slug = $t[1];
                 }
                 $plugin_data = @get_file_data(WPI_Gateways_Path . "/" . $file, $default_headers, 'plugin');
                 $wpi_settings['installed_gateways'][$slug]['name'] = $plugin_data['Name'];
                 $wpi_settings['installed_gateways'][$slug]['version'] = $plugin_data['Version'];
                 $wpi_settings['installed_gateways'][$slug]['description'] = $plugin_data['Description'];
                 if (WP_DEBUG) {
                     include_once WPI_Gateways_Path . "/" . $file;
                 } else {
                     @(include_once WPI_Gateways_Path . "/" . $file);
                 }
                 // Disable plugin if class does not exists - file is empty
                 if (!class_exists($slug)) {
                     unset($wpi_settings['installed_gateways'][$slug]);
                 } else {
                     /** Initialize the object, then update the billing permissions to show whats in the object */
                     eval("\$wpi_settings['installed_gateways']['" . $slug . "']['object'] = new " . $slug . "();");
                 }
             }
         }
         /** Sync our options */
         wpi_gateway_base::sync_billing_objects();
     }
 }