Changeset 1882092
- Timestamp:
- 05/27/2018 08:46:05 AM (8 years ago)
- Location:
- woo-payment-gateway-verotel-cardbilling/trunk
- Files:
-
- 3 added
- 5 edited
-
FlexPay.php (modified) (1 diff)
-
functions.php (modified) (8 diffs)
-
readme.txt (modified) (2 diffs)
-
src/Verotel/FlexPay/Brand.php (modified) (1 diff)
-
src/Verotel/FlexPay/Brand/Bill.php (added)
-
src/Verotel/FlexPay/Brand/GayCharge.php (added)
-
src/Verotel/FlexPay/Brand/PaintFest.php (added)
-
src/Verotel/FlexPay/Client.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
woo-payment-gateway-verotel-cardbilling/trunk/FlexPay.php
r1662140 r1882092 85 85 $shopID = $params['shopID']; 86 86 } 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); 99 88 } 100 89 } -
woo-payment-gateway-verotel-cardbilling/trunk/functions.php
r1662140 r1882092 6 6 Author: Speak Digital 7 7 Contributors: jcroucher 8 Version: 2. 0.38 Version: 2.1.0 9 9 Author URI: http://www.speakdigital.co.uk 10 10 Notes: … … 221 221 ); 222 222 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); 223 225 224 226 // If the order contains a subscription process the order using the subscription message … … 230 232 231 233 $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); 233 235 } 234 236 else 235 237 { 236 238 // Standard purchase 237 $url = FlexPay::get_purchase_URL($this->sig_key,$params);239 $url = $flexpayClient->get_purchase_URL($params); 238 240 } 239 241 … … 293 295 function check_verotel_response() { 294 296 @ob_clean(); 297 error_reporting(E_ALL); 298 ini_set('display_errors', 1); 295 299 296 300 global $woocommerce; 297 301 298 302 $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 300 310 $error = false; 301 311 … … 306 316 else 307 317 { 308 if (! FlexPay::validate_signature($this->sig_key,$params))318 if (!$flexpayClient->validate_signature($params)) 309 319 { 310 320 $error = "Signature check failed"; 321 print "\n".$this->sig_key."\n"; 322 print_r($params); 311 323 } 312 324 else … … 328 340 329 341 // 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 } 349 365 } 350 366 } … … 352 368 353 369 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; 355 373 } 356 374 } … … 504 522 $statusparams = array(); 505 523 $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); 508 531 509 532 $ch = curl_init(); -
woo-payment-gateway-verotel-cardbilling/trunk/readme.txt
r1662140 r1882092 3 3 Tags: woocommerce, payment, gateway, verotel, cardbilling 4 4 Requires at least: 3.0.1 5 Tested up to: 4. 7.55 Tested up to: 4.9.6 6 6 Stable tag: trunk 7 7 Contributors: jcroucher … … 32 32 == Changelog == 33 33 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 38 37 39 38 = 2.0.2 = -
woo-payment-gateway-verotel-cardbilling/trunk/src/Verotel/FlexPay/Brand.php
r1662140 r1882092 9 9 '9762' => 'CardBilling', 10 10 '9653' => 'FreenomPay', 11 '9511' => 'Bill', 12 '9444' => 'PaintFest', 13 '9388' => 'GayCharge', 11 14 ); 12 15 -
woo-payment-gateway-verotel-cardbilling/trunk/src/Verotel/FlexPay/Client.php
r1662140 r1882092 7 7 * This library allows merchants to use Verotel payment gateway 8 8 * 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 brands11 9 * 12 10 */
Note: See TracChangeset
for help on using the changeset viewer.