Plugin Directory

Changeset 2008883


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

Commit 3.1.3

Location:
pesapal-pay/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pesapal-pay/trunk/pesapal_pay.php

    r1952755 r2008883  
    33Plugin Name: Pesapal Pay
    44Description: A quick way to integrate pesapal to your website to handle the payment process. All you need to do is set up what parameters to capture from the form and the plugin will do the rest
    5 Version: 3.1.2.2
     5Version: 3.1.3
    66Author: rixeo
    77Author URI: http://thebunch.co.ke/
     
    888888            $request_status->set_parameter("pesapal_transaction_tracking_id",$invoice);
    889889            $request_status->sign_request($signature_method, $consumer, $token);
    890             $ch = curl_init();
    891             curl_setopt($ch, CURLOPT_URL, $request_status);
    892             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    893             curl_setopt($ch, CURLOPT_HEADER, 1);
    894             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    895              if(defined('CURL_PROXY_REQUIRED')) if (CURL_PROXY_REQUIRED == 'True'){
    896                 $proxy_tunnel_flag = (defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE') ? false : true;
    897                 curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
    898                 curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
    899                 curl_setopt ($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
     890           
     891            $request = wp_remote_get( $request_status );
     892            if ( is_wp_error( $request) ) {
     893                $response = __( 'PENDING' );
     894            } else {
     895                $response = wp_remote_retrieve_body( $request );
    900896            }
    901897
    902             $response = curl_exec($ch);
    903 
    904             $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    905             $raw_header  = substr($response, 0, $header_size - 4);
    906             $headerArray = explode("\r\n\r\n", $raw_header);
    907             $header      = $headerArray[count($headerArray) - 1];
    908 
    909              //transaction status
    910             $elements = preg_split("/=/",substr($response, $header_size));
    911             $status = $elements[1];
    912 
    913             curl_close ($ch);
    914             switch ($status) {
     898            switch ($response) {
    915899                case 'PENDING':
    916900                    $updated_status = 'order_pending';
     
    970954            $request_status->set_parameter("pesapal_transaction_tracking_id",$invoice);
    971955            $request_status->sign_request($signature_method, $consumer, $token);
    972             $ch = curl_init();
    973             curl_setopt($ch, CURLOPT_URL, $request_status);
    974             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    975             curl_setopt($ch, CURLOPT_HEADER, 1);
    976             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    977              if(defined('CURL_PROXY_REQUIRED')) if (CURL_PROXY_REQUIRED == 'True'){
    978                 $proxy_tunnel_flag = (defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE') ? false : true;
    979                 curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
    980                 curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
    981                 curl_setopt ($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
     956           
     957            $request = wp_remote_get( $request_status );
     958            if ( is_wp_error( $server_response) ) {
     959                $response = __( 'PENDING' );
     960            } else {
     961                $response   = wp_remote_retrieve_body( $response );
    982962            }
    983 
    984             $response = curl_exec($ch);
    985 
    986             $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    987             $raw_header  = substr($response, 0, $header_size - 4);
    988             $headerArray = explode("\r\n\r\n", $raw_header);
    989             $header      = $headerArray[count($headerArray) - 1];
    990 
    991              //transaction status
    992             $elements = preg_split("/=/",substr($response, $header_size));
    993             $status = $elements[1];
    994 
    995             curl_close ($ch);
    996             switch ($status) {
     963            switch ($response) {
    997964                case 'PENDING':
    998965                    $updated_status = 'order_pending';
  • pesapal-pay/trunk/readme.txt

    r1989778 r2008883  
    44Tags: Pesapal, e-commerce, ecommerce
    55Requires at least: 4.4.0
    6 Tested up to: 5.0
    7 Stable tag: 3.1.2.2
     6Tested up to: 5.1
     7Stable tag: 3.1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5151
    5252== Changelog ==
     53
     54= 3.1.3 =
     55* Refactor PesaPal to use WordPress HTTP API
     56* Other code fixes
    5357
    5458= 3.1.2.2 =
Note: See TracChangeset for help on using the changeset viewer.