Plugin Directory

Changeset 2694463


Ignore:
Timestamp:
03/15/2022 08:08:48 PM (4 years ago)
Author:
wpconcierges
Message:

added plex call center

Location:
autopopulate-checkout-for-woocommerce/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • autopopulate-checkout-for-woocommerce/trunk/README.txt

    r2687864 r2694463  
    55Requires at least: 3.0.1
    66Tested up to: 5.9.1
    7 Stable tag: 1.0.6
     7Stable tag: 1.0.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4545
    4646== Changelog ==
     47= 1.0.7 =
     48Added Plex Call Center
    4749= 1.0.6 =
    4850Fixed bugs with Revcent integration
  • autopopulate-checkout-for-woocommerce/trunk/admin/class-autopopulate-checkout-woo-admin.php

    r2687864 r2694463  
    191191    );   
    192192
    193 
     193    add_settings_field(
     194        'add-prospect-plex',
     195        apply_filters( $this->plugin_name . 'label-add-prospect-plex', esc_html__('Enable Send Prospect to Plex Call Center ',$this->plugin_name) ),
     196        array( $this, 'field_select' ),
     197        $this->plugin_name,
     198        $this->plugin_name . '-messages',
     199        array(
     200            'description'   => 'Enable Plex Call Center',
     201            'id'            => 'add-prospect-plex',
     202            'value'         => '',
     203        )
     204    );   
     205   
     206     add_settings_field(
     207        'plex-account-id',
     208        apply_filters( $this->plugin_name . 'label-plex-account-id', esc_html__('Plex Account Id ',$this->plugin_name) ),
     209        array( $this, 'field_text' ),
     210        $this->plugin_name,
     211        $this->plugin_name . '-messages',
     212        array(
     213            'description'   => 'Plex Account Id',
     214            'id'            => 'plex-account-id',
     215            'value'         => '',
     216        )
     217    );   
     218   
     219      add_settings_field(
     220        'plex-key',
     221        apply_filters( $this->plugin_name . 'label-plex-key', esc_html__('Plex Key',$this->plugin_name) ),
     222        array( $this, 'field_text' ),
     223        $this->plugin_name,
     224        $this->plugin_name . '-messages',
     225        array(
     226            'description'   => 'Plex Key',
     227            'id'            => 'plex-key',
     228            'value'         => '',
     229        )
     230    );   
     231   
     232      add_settings_field(
     233        'plex-list-id',
     234        apply_filters( $this->plugin_name . 'label-plex-list-id', esc_html__(' Plex List Id ',$this->plugin_name) ),
     235        array( $this, 'field_text' ),
     236        $this->plugin_name,
     237        $this->plugin_name . '-messages',
     238        array(
     239            'description'   => 'Plex List Id',
     240            'id'            => 'plex-list-id',
     241            'value'         => '',
     242        )
     243    );   
    194244  }
    195245 
     
    339389       
    340390        $options[] = array('add-prospect-revcent','select','Enable Revcent');
     391        $options[] = array('add-prospect-plex','select','Enable Plex Call Center');
     392        $options[] = array('plex-account-id','text','Plex Account Id');
     393        $options[] = array('plex-key','text','Plex Key');
     394        $options[] = array('plex-list-id','text','Plex List Id');
     395       
    341396       
    342397        return $options;
  • autopopulate-checkout-for-woocommerce/trunk/autopopulate-checkout-woo.php

    r2687864 r2694463  
    1717 * Plugin URI:        https://www.wpconcierges.com/plugins/autopopulate-checkout-woo/
    1818 * Description:       Pass in values for shipping, billing, to any page of your site and the plugin will create a customer session that is used on the Woocommerce Checkout page.
    19  * Version:           1.0.6
     19 * Version:           1.0.7
    2020 * Author:            WpConcierges
    2121 * Author URI:        https://www.wpconcierges.com/plugins/
     
    3838 * Rename this for your plugin and update it as you release new versions.
    3939 */
    40 define( 'AUTOPOPULATE_CHECKOUT_WOO_VERSION', '1.0.6' );
     40define( 'AUTOPOPULATE_CHECKOUT_WOO_VERSION', '1.0.7' );
    4141
    4242/**
  • autopopulate-checkout-for-woocommerce/trunk/includes/class-autopopulate-checkout-woo.php

    r2687864 r2694463  
    7171            $this->version = AUTOPOPULATE_CHECKOUT_WOO_VERSION;
    7272        } else {
    73             $this->version = '1.0.6';
     73            $this->version = '1.0.7';
    7474        }
    7575        $this->plugin_name = $this->autopopulate_checkout_woo = 'autopopulate-checkout-woo';
  • autopopulate-checkout-for-woocommerce/trunk/public/class-autopopulate-checkout-woo-public.php

    r2687864 r2694463  
    5858        $this->plugin_name = $autopopulate_checkout_woo;
    5959        $this->version = $version;
    60         $this->plugin_options = get_option($this->plugin_name."-options",array());
     60    $this->plugin_options = get_option($this->plugin_name."-options",array());
    6161        $this->revcent_url = 'https://api.revcent.com/v1';
     62        $this->plex_url = 'https://api.connectdataleads.com/api/lead_handler.php';
    6263    }
    6364
     
    287288            $this->add_customer_to_revcent();
    288289        }
     290       
     291        if($this->plugin_options['add-prospect-plex']=="yes"){
     292            $this->add_customer_to_plex();
     293        }
    289294    }
    290295 
    291     private function add_customer_to_revcent(){
     296    private function add_customer_to_plex(){
     297       
     298       
     299         $account_id = $this->plugin_options['plex-account-id'];
     300         $key        = $this->plugin_options['plex-key'];
     301         $list_id    = $this->plugin_options['plex-list-id'];
     302         
     303         $customer = $this->create_plex_prospect();
     304                 $customer['account_id']=$account_id;
     305                 $customer['key']=$key;
     306                 $customer['list_id']=$list_id;
     307                 
     308                 
     309                  $response = wp_remote_post($this->plex_url, array(
     310             'method' => 'POST',
     311             'body' => http_build_query($customer),
     312             'timeout' => 90,
     313             'sslverify' => false,
     314          ));
     315         
     316          $this->logger(print_r($response,true));
     317                 
     318       
     319    }
     320
     321  private function add_customer_to_revcent(){
    292322       
    293323            if(class_exists("revcent_payments")){
     
    304334       
    305335    }
    306 
     336   
     337   
    307338    private function send_revcent_customer(){
    308339        $payload_rq = $this->create_revcent_customer();
     
    430461           
    431462    }
     463   
     464    private function create_plex_prospect(){
     465        global $woocommerce;
     466       
     467     $customer =array();   
     468       
     469       
     470     
     471            $first_name ="";
     472            $last_name = "";
     473            $address_line_1 = "";
     474            $address_line_2 = "";
     475            $city ="";
     476            $state ="";
     477            $zip = "";
     478            $country = "";
     479            $email ="";
     480            $phone = "";
     481
     482            if(!is_null($woocommerce->customer->get_billing_first_name()))
     483             $first_name = $woocommerce->customer->get_billing_first_name();
     484 
     485             if(!is_null($woocommerce->customer->get_billing_last_name()))
     486             $last_name = $woocommerce->customer->get_billing_last_name();
     487             
     488             if(!is_null($woocommerce->customer->get_billing_address_1()))
     489             $address_line_1 = $woocommerce->customer->get_billing_address_1();
     490
     491             if(!is_null( $woocommerce->customer->get_billing_address_2()))
     492             $address_line_2 = $woocommerce->customer->get_billing_address_2();
     493
     494             if(!is_null($woocommerce->customer->get_billing_city()))
     495             $city = $woocommerce->customer->get_billing_city();
     496
     497             if(!is_null($woocommerce->customer->get_billing_state()))
     498             $state = $woocommerce->customer->get_billing_state();
     499
     500             if(!is_null($woocommerce->customer->get_billing_postcode()))
     501             $zip = $woocommerce->customer->get_billing_postcode();
     502
     503             if(!is_null($woocommerce->customer->get_billing_country()))
     504             $country = $woocommerce->customer->get_billing_country();
     505
     506             if(!is_null($woocommerce->customer->get_shipping_company()))
     507             $company =$woocommerce->customer->get_shipping_company(); 
     508   
     509             if(!is_null($woocommerce->customer->get_billing_email()))
     510             $email =$woocommerce->customer->get_billing_email(); 
     511   
     512             if(!is_null($woocommerce->customer->get_billing_phone()))
     513             $phone =$woocommerce->customer->get_billing_phone();
     514             
     515             
     516                $customer = array(
     517                    "shipping_first_name" => $first_name,
     518                    "shipping_last_name" => $last_name,
     519                    "shipping_address_1" => $address_line_1,
     520                    "shipping_address_2" => $address_line_2,
     521                    "shipping_city_town" => $city,
     522                    "shipping_state_province" => $state,
     523                    "shipping_zip_postcode" => $zip,
     524                    "shipping_country_code" => $country,
     525                    "phone_1" => $phone,
     526                    "email" => $email
     527            );
     528   
     529            return $customer;
     530           
     531    }
     532   
     533     protected function logger($data){
     534         global $woocommerce;
     535           if(!is_null($woocommerce)){
     536         $logger = new WC_Logger();
     537         $logger->add('autopopulate-checkout-woo', $data);
     538       }
     539        } 
     540       
    432541}
Note: See TracChangeset for help on using the changeset viewer.