Plugin Directory

Changeset 1882092


Ignore:
Timestamp:
05/27/2018 08:46:05 AM (8 years ago)
Author:
bkonyn
Message:

update to version 2.1.0

Location:
woo-payment-gateway-verotel-cardbilling/trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • woo-payment-gateway-verotel-cardbilling/trunk/FlexPay.php

    r1662140 r1882092  
    8585            $shopID = $params['shopID'];
    8686        }
    87        
    88         $gateway = new WC_Gateway_CardBilling();
    89         $customer = $gateway->customer_id;
    90         if ($customer) {
    91             $brand = Verotel\FlexPay\Brand::create_from_merchant_id($customer);
    92         } else {
    93             $name = $gateway->which;
    94             if (!$name) $name= "Verotel";
    95             $brand = Verotel\FlexPay\Brand::create_from_name($name);
    96         }
    97        
    98         return new Verotel\FlexPay\Client($shopID, $secret, $brand);
     87        return new Verotel\FlexPay\Client($shopID, $secret);
    9988    }
    10089}
  • woo-payment-gateway-verotel-cardbilling/trunk/functions.php

    r1662140 r1882092  
    66Author: Speak Digital
    77Contributors: jcroucher
    8 Version: 2.0.3
     8Version: 2.1.0
    99Author URI: http://www.speakdigital.co.uk
    1010Notes:
     
    221221            );
    222222           
     223            $brand = Verotel\FlexPay\Brand::create_from_merchant_id($this->customer_id);
     224            $flexpayClient = new Verotel\FlexPay\Client($this->shop_id,$this->sig_key, $brand);
    223225
    224226            // If the order contains a subscription process the order using the subscription message
     
    230232
    231233                $price_per_period = WC_Subscriptions_Order::get_recurring_total( $order );
    232                 $url = FlexPay::get_subscription_URL($this->sig_key,$params);   
     234                $url = $flexpayClient->get_subscription_URL($params);   
    233235            }
    234236            else
    235237            {
    236238                // Standard purchase
    237                 $url = FlexPay::get_purchase_URL($this->sig_key,$params);   
     239                $url = $flexpayClient->get_purchase_URL($params);
    238240            }
    239241           
     
    293295        function check_verotel_response() {
    294296            @ob_clean();
     297            error_reporting(E_ALL);
     298            ini_set('display_errors', 1);
    295299
    296300            global $woocommerce;
    297301
    298302            $params = $_REQUEST;
    299 
     303            unset($params['woocommerce-login-nonce']);
     304            unset($params['_wpnonce']);
     305
     306            $brand = Verotel\FlexPay\Brand::create_from_merchant_id($this->customer_id);
     307            $flexpayClient = new Verotel\FlexPay\Client($this->shop_id,$this->sig_key, $brand);
     308
     309           
    300310            $error = false;
    301311
     
    306316            else
    307317            {   
    308                 if (!FlexPay::validate_signature($this->sig_key,$params))
     318                if (!$flexpayClient->validate_signature($params))
    309319                {   
    310320                    $error = "Signature check failed";
     321                    print "\n".$this->sig_key."\n";
     322                    print_r($params);
    311323                }
    312324                else
     
    328340
    329341                        // Attempt to load the order from the reference
    330                         $order = new WC_Order( $referenceID );
    331 
    332                         $this->set_token_sale_id( $order, $params['saleID'] );
    333 
    334 
    335                         // We may have a priceAmount or an here depending on the type of request
    336                         $amount = 0;
    337 
    338                         if( isset($params['priceAmount']) )
    339                             $amount = $params['priceAmount'];
    340 
    341                         if( isset($params['amount']) )
    342                             $amount = $params['amount'];
    343 
    344                         // Make sure the amount in WooCommerce matches the amount sent from the gateway
    345                         if ( $amount != $order->order_total )
    346                         {   
    347                             $error = "Order value does not match payment value. Order: $" . $order->order_total . ' Paid: $' . $amount;
    348                         }
     342                        try
     343                        {   $order = new WC_Order( $referenceID );
     344   
     345                            $this->set_token_sale_id( $order, $params['saleID'] );
     346   
     347   
     348                            // We may have a priceAmount or an here depending on the type of request
     349                            $amount = 0;
     350   
     351                            if( isset($params['priceAmount']) )
     352                                $amount = $params['priceAmount'];
     353   
     354                            if( isset($params['amount']) )
     355                                $amount = $params['amount'];
     356   
     357                            // Make sure the amount in WooCommerce matches the amount sent from the gateway
     358                            if ( $amount != $order->order_total )
     359                            {   
     360                                $error = "Order value does not match payment value. Order: $" . $order->order_total . ' Paid: $' . $amount;
     361                            }
     362                        } catch (Exception $e) {
     363                            $error = "Invalid order ID";   
     364                        }
    349365                    }
    350366                }
     
    352368
    353369            if ($error) {
    354                 wp_die("Verotel Transaction Verification Failed: ".$error); //TODO: Need to email site manager and display nicer error
     370                //wp_die("Verotel Transaction Verification Failed: ".$error); //TODO: Need to email site manager and display nicer error
     371                print "ERROR\n".$error;
     372                exit;
    355373            }
    356374        }
     
    504522            $statusparams = array();
    505523            $statusparams['shopID'] = $this->shop_id;
    506             $statusparams['referenceID'] = $params['saleID'];               
    507             $url = FlexPay::get_status_URL($this->sig_key,$statusparams);
     524            $statusparams['referenceID'] = $params['saleID'];
     525           
     526            $brand = Verotel\FlexPay\Brand::create_from_merchant_id($this->customer_id);
     527            $flexpayClient = new Verotel\FlexPay\Client($this->shop_id,$this->sig_key, $brand);
     528
     529                           
     530            $url = $flexpayClient->get_status_URL($statusparams);
    508531
    509532            $ch = curl_init();
  • woo-payment-gateway-verotel-cardbilling/trunk/readme.txt

    r1662140 r1882092  
    33Tags: woocommerce, payment, gateway, verotel, cardbilling
    44Requires at least: 3.0.1
    5 Tested up to: 4.7.5
     5Tested up to: 4.9.6
    66Stable tag: trunk
    77Contributors: jcroucher
     
    3232== Changelog ==
    3333
    34 = 2.0.3 =
    35 * Added Customer ID setting to automatically select Verotel / CardBilling
    36 * Removed manual option for selecting which brand
    37 * Updated FlexPay API code to 4.0.1 and included all branding files
     34= 2.1.0 =
     35* Latest WooCommerce added some nonce fialds that broke signature validation
     36* Changed to using client object instead of static functions
    3837
    3938= 2.0.2 =
  • woo-payment-gateway-verotel-cardbilling/trunk/src/Verotel/FlexPay/Brand.php

    r1662140 r1882092  
    99        '9762' => 'CardBilling',
    1010        '9653' => 'FreenomPay',
     11        '9511' => 'Bill',
     12        '9444' => 'PaintFest',
     13        '9388' => 'GayCharge',
    1114    );
    1215
  • woo-payment-gateway-verotel-cardbilling/trunk/src/Verotel/FlexPay/Client.php

    r1662140 r1882092  
    77 * This library allows merchants to use Verotel payment gateway
    88 * and get paid by their users via Credit card and other payment methods.
    9  *
    10  * This library could be used also for Cardbilling or FreenomPay brands
    119 *
    1210 */
Note: See TracChangeset for help on using the changeset viewer.