Plugin Directory

Changeset 2008877


Ignore:
Timestamp:
01/09/2019 06:00:25 AM (7 years ago)
Author:
alloykenya
Message:

Fixes for 1.1.9

Location:
thebunch-ke-pesapal-woocommerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • thebunch-ke-pesapal-woocommerce/trunk/readme.txt

    r1989776 r2008877  
    44Tags: pesapal, woocommerce, ecommerce, gateway, payment
    55Requires at least: 4.0
    6 Tested up to: 5.0
    7 Stable tag: 1.1.8
     6Tested up to: 5.1
     7Stable tag: 1.1.9
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3131
    3232== Changelog ==
     33
     34= 1.1.9 =
     35* Update from Curl to WordPress HTTP API
     36* Fix WooCommerce deprecated functions
    3337
    3438= 1.1.8 =
  • thebunch-ke-pesapal-woocommerce/trunk/thebunchke_pesapal_woocommerce.php

    r1852264 r2008877  
    33Plugin Name: TheBunch KE Pesapal Woocommerce
    44Description: Add PesaPal payment gateway to your Woocommerce plugin
    5 Version: 1.1.8
     5Version: 1.1.9
    66Author: rixeo
    77Author URI: http://thebunch.co.ke/
     
    355355                    $pesapal_args['total'] = $order->get_total();
    356356                    $pesapal_args['reference'] = $order_id;
    357                     $pesapal_args['first_name'] = $order->billing_first_name;
    358                     $pesapal_args['last_name'] = $order->billing_last_name;
    359                     $pesapal_args['email'] = $order->billing_email;
    360                     $pesapal_args['phone'] = $order->billing_phone;
     357                    $pesapal_args['first_name'] = $order->get_billing_first_name();
     358                    $pesapal_args['last_name'] = $order->get_billing_last_name();
     359                    $pesapal_args['email'] = $order->get_billing_email();
     360                    $pesapal_args['phone'] = $order->get_billing_phone();
    361361                 
    362362                 
     
    456456                 **/
    457457                function curlRequest($request_status){
    458        
    459                     $ch = curl_init();
    460                     curl_setopt($ch, CURLOPT_URL, $request_status);
    461                     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    462                     curl_setopt($ch, CURLOPT_HEADER, 1);
    463                     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    464                     if(defined('CURL_PROXY_REQUIRED')) if (CURL_PROXY_REQUIRED == 'True'){
    465                         $proxy_tunnel_flag = (defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE') ? false : true;
    466                         curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
    467                         curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
    468                         curl_setopt ($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
    469                     }
    470        
    471                     $response = curl_exec($ch);
    472                     $header_size  = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    473                     $raw_header = substr($response, 0, $header_size - 4);
    474                     $headerArray = explode("\r\n\r\n", $raw_header);
    475                     $header = $headerArray[count($headerArray) - 1];
    476        
    477                     //transaction status
    478                     $elements = preg_split("/=/",substr($response, $header_size));
    479                     $pesapal_response_data = $elements[1];
    480        
    481                     return $pesapal_response_data;
     458                   
     459                    $response = wp_remote_get( $request_status );
     460                    if ( is_wp_error( $server_response) ) {
     461                        return __( 'An Error Occurred' );
     462                    } else {
     463                        $resp_body  = wp_remote_retrieve_body( $response );
     464                        return $resp_body;
     465                    }
    482466   
    483467                }
Note: See TracChangeset for help on using the changeset viewer.