Changeset 3029959
- Timestamp:
- 02/01/2024 10:10:18 AM (2 years ago)
- Location:
- sagepay-direct-gateway-for-woocommerce/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
sagepaydirect.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sagepay-direct-gateway-for-woocommerce/trunk/readme.txt
r2158322 r3029959 2 2 Contributors: patsatech 3 3 Tags: ecommerce, payment gateway, wordpress, woocommerce,sagepay direct,sagepay go 4 Requires at least: 4.05 Tested up to: 5.2.36 Stable tag: 1.3. 04 Requires at least: 6.0 5 Tested up to: 6.4.3 6 Stable tag: 1.3.1 7 7 License: GPLv2 or later 8 8 … … 43 43 * Updated the plugin to support latest version of WooCommerce 3.7+ and Wordpress 5.2+ 44 44 * Added support for SagePay Payment Services Directive 2, Strong Customer Authentication and 3D Secure v2 45 46 = 1.3.1 = 47 * Updated the url as per the notification from Elavon. 48 * Updated to add support WooCommerce HPOS system. -
sagepay-direct-gateway-for-woocommerce/trunk/sagepaydirect.php
r2158322 r3029959 1 1 <?php 2 2 /** 3 * Plugin Name: SagePayDirect Gateway for WooCommerce3 * Plugin Name: PatSaTECH's Opayo Direct Gateway for WooCommerce 4 4 * Plugin URI: http://www.patsatech.com/ 5 5 * Description: WooCommerce Plugin for accepting payment through SagePay Direct Gateway. 6 * Version: 1.3. 06 * Version: 1.3.1 7 7 * Author: PatSaTECH 8 8 * Author URI: http://www.patsatech.com 9 9 * Contributors: patsatech 10 * Requires at least: 4.511 * Tested up to: 5.2.312 * WC requires at least: 3.0.013 * WC tested up to: 3.7.010 * Requires at least: 6.0 11 * Tested up to: 6.4.3 12 * WC requires at least: 6.0.0 13 * WC tested up to: 8.2.2 14 14 * 15 15 * Text Domain: woo-sagepay-patsatech … … 305 305 global $woocommerce; 306 306 307 $order = new WC_Order($order_id);307 $order = wc_get_order( $order_id ); 308 308 309 309 if( !empty( WC()->session->get('sagepay_pareq') ) ){ … … 316 316 $sagepaydirect_args = array( 317 317 'creq' => WC()->session->get('sagepay_creq'), 318 'threeDSSessionData' => WC()->session->get('sagepay_vpstxid'),318 'threeDSSessionData' => str_replace(array("{", "}"), "", WC()->session->get('sagepay_vpstxid')), 319 319 'TermUrl' => $this->notify_url 320 320 ); … … 364 364 global $woocommerce; 365 365 366 $order = new WC_Order($order_id);366 $order = wc_get_order( $order_id ); 367 367 368 368 $credit_card = preg_replace('/(?<=\d)\s+(?=\d)/', '', trim($_POST['sagepaydirect-card-number'])); … … 517 517 518 518 if ($this->mode == 'test') { 519 $gateway_url = 'https:// test.sagepay.com/gateway/service/vspdirect-register.vsp';519 $gateway_url = 'https://sandbox.opayo.eu.elavon.com/gateway/service/vspdirect-register.vsp'; 520 520 } elseif ($this->mode == 'live') { 521 $gateway_url = 'https://live. sagepay.com/gateway/service/vspdirect-register.vsp';521 $gateway_url = 'https://live.opayo.eu.elavon.com/gateway/service/vspdirect-register.vsp'; 522 522 } 523 523 … … 543 543 544 544 if (isset($resp['Status'])) { 545 update_post_meta($order->id,'Status', $resp['Status']);545 $order->update_meta_data( 'Status', $resp['Status']); 546 546 } 547 547 if (isset($resp['StatusDetail'])) { 548 update_post_meta($order->id,'StatusDetail', $resp['StatusDetail']);548 $order->update_meta_data( 'StatusDetail', $resp['StatusDetail']); 549 549 } 550 550 if (isset($resp['VPSTxId'])) { 551 update_post_meta($order->id,'VPSTxId', $resp['VPSTxId']);551 $order->update_meta_data( 'VPSTxId', $resp['VPSTxId']); 552 552 WC()->session->set('sagepay_vpstxid', $resp['VPSTxId']); 553 553 } 554 554 if (isset($resp['CAVV'])) { 555 update_post_meta($order->id,'CAVV', $resp['CAVV']);555 $order->update_meta_data( 'CAVV', $resp['CAVV']); 556 556 } 557 557 if (isset($resp['SecurityKey'])) { 558 update_post_meta($order->id,'SecurityKey', $resp['SecurityKey']);558 $order->update_meta_data( 'SecurityKey', $resp['SecurityKey']); 559 559 } 560 560 if (isset($resp['TxAuthNo'])) { 561 update_post_meta($order->id,'TxAuthNo', $resp['TxAuthNo']);561 $order->update_meta_data( 'TxAuthNo', $resp['TxAuthNo']); 562 562 } 563 563 if (isset($resp['AVSCV2'])) { 564 update_post_meta($order->id,'AVSCV2', $resp['AVSCV2']);564 $order->update_meta_data( 'AVSCV2', $resp['AVSCV2']); 565 565 } 566 566 if (isset($resp['AddressResult'])) { 567 update_post_meta($order->id,'AddressResult', $resp['AddressResult']);567 $order->update_meta_data( 'AddressResult', $resp['AddressResult']); 568 568 } 569 569 if (isset($resp['PostCodeResult'])) { 570 update_post_meta($order->id,'PostCodeResult', $resp['PostCodeResult']);570 $order->update_meta_data( 'PostCodeResult', $resp['PostCodeResult']); 571 571 } 572 572 if (isset($resp['CV2Result'])) { 573 update_post_meta($order->id,'CV2Result', $resp['CV2Result']);573 $order->update_meta_data( 'CV2Result', $resp['CV2Result']); 574 574 } 575 575 if (isset($resp['3DSecureStatus'])) { 576 update_post_meta($order->id,'3DSecureStatus', $resp['3DSecureStatus']);576 $order->update_meta_data( '3DSecureStatus', $resp['3DSecureStatus']); 577 577 } 578 578 if(isset($orderid)){ 579 update_post_meta($order_id, 'VendorTxCode', $orderid ); 580 } 579 $order->update_meta_data( 'VendorTxCode', $orderid ); 580 } 581 582 $order->save(); // Don't forget to save the changes. 581 583 582 584 if ($resp['Status'] == "OK" || $resp['Status'] == "REGISTERED" || $resp['Status'] == "AUTHENTICATED") { … … 644 646 645 647 if ( ( isset($_REQUEST['MD']) && isset($_REQUEST['PaRes']) ) || isset($_REQUEST['cres']) ) { 646 $order = new WC_Order(WC()->session->get('sagepay_oid'));648 $order = wc_get_order( WC()->session->get('sagepay_oid') ); 647 649 648 650 if( isset($_REQUEST['cres']) ){ … … 668 670 669 671 if ($this->mode == 'test') { 670 $gateway_url = 'https:// test.sagepay.com/gateway/service/direct3dcallback.vsp';672 $gateway_url = 'https://sandbox.opayo.eu.elavon.com/gateway/service/direct3dcallback.vsp'; 671 673 } elseif ($this->mode == 'live') { 672 $gateway_url = 'https://live. sagepay.com/gateway/service/direct3dcallback.vsp';674 $gateway_url = 'https://live.opayo.eu.elavon.com/gateway/service/direct3dcallback.vsp'; 673 675 } 674 676 … … 690 692 691 693 if (isset($resp['Status'])) { 692 update_post_meta($order->id,'Status', $resp['Status']);694 $order->update_meta_data( 'Status', $resp['Status']); 693 695 } 694 696 if (isset($resp['StatusDetail'])) { 695 update_post_meta($order->id,'StatusDetail', $resp['StatusDetail']);697 $order->update_meta_data( 'StatusDetail', $resp['StatusDetail']); 696 698 } 697 699 if (isset($resp['VPSTxId'])) { 698 update_post_meta($order->id,'VPSTxId', $resp['VPSTxId']);700 $order->update_meta_data( 'VPSTxId', $resp['VPSTxId']); 699 701 } 700 702 if (isset($resp['CAVV'])) { 701 update_post_meta($order->id,'CAVV', $resp['CAVV']);703 $order->update_meta_data( 'CAVV', $resp['CAVV']); 702 704 } 703 705 if (isset($resp['SecurityKey'])) { 704 update_post_meta($order->id,'SecurityKey', $resp['SecurityKey']);706 $order->update_meta_data( 'SecurityKey', $resp['SecurityKey']); 705 707 } 706 708 if (isset($resp['TxAuthNo'])) { 707 update_post_meta($order->id,'TxAuthNo', $resp['TxAuthNo']);709 $order->update_meta_data( 'TxAuthNo', $resp['TxAuthNo']); 708 710 } 709 711 if (isset($resp['AVSCV2'])) { 710 update_post_meta($order->id,'AVSCV2', $resp['AVSCV2']);712 $order->update_meta_data( 'AVSCV2', $resp['AVSCV2']); 711 713 } 712 714 if (isset($resp['AddressResult'])) { 713 update_post_meta($order->id,'AddressResult', $resp['AddressResult']);715 $order->update_meta_data( 'AddressResult', $resp['AddressResult']); 714 716 } 715 717 if (isset($resp['PostCodeResult'])) { 716 update_post_meta($order->id,'PostCodeResult', $resp['PostCodeResult']);718 $order->update_meta_data( 'PostCodeResult', $resp['PostCodeResult']); 717 719 } 718 720 if (isset($resp['CV2Result'])) { 719 update_post_meta($order->id,'CV2Result', $resp['CV2Result']);721 $order->update_meta_data( 'CV2Result', $resp['CV2Result']); 720 722 } 721 723 if (isset($resp['3DSecureStatus'])) { 722 update_post_meta($order->id,'3DSecureStatus', $resp['3DSecureStatus']);724 $order->update_meta_data( '3DSecureStatus', $resp['3DSecureStatus']); 723 725 } 724 726 if (WC()->session->get('sagepay_vtc') != '') { 725 update_post_meta($order->id, 'VendorTxCode', WC()->session->get('sagepay_vtc')); 726 } 727 $order->update_meta_data( 'VendorTxCode', WC()->session->get('sagepay_vtc')); 728 } 729 730 $order->save(); // Don't forget to save the changes. 727 731 728 732 if ($resp['Status'] == "OK" || $resp['Status'] == "REGISTERED" || $resp['Status'] == "AUTHENTICATED") { … … 922 926 } 923 927 add_filter('woocommerce_payment_gateways', 'add_sagepaydirect_gateway'); 928 929 930 add_action('before_woocommerce_init', function(){ 931 932 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 933 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 934 935 } 936 937 }); 924 938 }
Note: See TracChangeset
for help on using the changeset viewer.