Changeset 1787349
- Timestamp:
- 12/14/2017 11:47:49 PM (8 years ago)
- Location:
- payment-gateway-poli-for-woocommerce/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
woocommerce-poli.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
payment-gateway-poli-for-woocommerce/trunk/readme.txt
r1661918 r1787349 4 4 Donate link: https://cloughit.com.au/donate/ 5 5 Requires at least: 4.0 6 Tested up to: 4. 87 Stable tag: 2017. 05.226 Tested up to: 4.9.1 7 Stable tag: 2017.11.30 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 46 46 == Changelog == 47 47 48 = 2017.11.30 = 49 50 * MOD: Changed method to get order details 51 * MOD: Changed method to obtain URL's 52 48 53 = 2017.05.22 = 49 54 -
payment-gateway-poli-for-woocommerce/trunk/woocommerce-poli.php
r1661918 r1787349 5 5 * Author: Clough I.T. Solutions 6 6 * Author URI: https://cloughit.com.au 7 * Version: 2017. 05.227 * Version: 2017.11.30 8 8 * Text Domain: payment-gateway-poli-for-woocommerce 9 9 * License: GNU General Public License v2 or later … … 78 78 public function process_payment( $order_id ) { 79 79 global $woocommerce; 80 $order = new WC_Order( $order_id ); 80 // 2017.11.30 81 // $order = new WC_Order( $order_id ); 82 $order = wc_get_order( $order_id ); 81 83 82 84 // Mark as on-hold (we're awaiting the cheque) … … 89 91 'Amount' => $order->get_total(), 90 92 'CurrencyCode' => get_woocommerce_currency(), 91 'MerchantReference' => $order_id, 93 // 2017.11.30 94 // 'MerchantReference' => $order_id, 95 'MerchantReference' => $order->get_id(), 92 96 'MerchantHomepageURL' => home_url( '/' ), 93 97 'SuccessURL' => str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'poli_nudge', home_url( '/' ) ) ), 94 98 'FailureURL' => str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'poli_nudge', home_url( '/' ) ) ), 95 'CancellationURL' => get_permalink( woocommerce_get_page_id( 'pay' ) ), 99 // 2017.11.30 100 // 'CancellationURL' => get_permalink( woocommerce_get_page_id( 'pay' ) ), 101 'CancellationURL' => WC_Order::get_checkout_payment_url(), 96 102 'NotificationURL' => str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'poli_nudge', home_url( '/' ) ) ) 97 103 ); … … 146 152 curl_setopt( $ch, CURLOPT_POST, 0 ); 147 153 curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0 ); 148 curl_setopt( $ch, CURLOPT_REFERER, $referrer);//Set the referrer154 curl_setopt( $ch, CURLOPT_REFERER, $referrer);//Set the referrer 149 155 curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); 150 156 $response = curl_exec( $ch ); … … 155 161 if ( $json['TransactionStatusCode'] == 'Completed' ) { 156 162 $order_id = $json['MerchantReference']; 157 $order = new WC_Order( $order_id ); 163 // 2017.11.30 164 // $order = new WC_Order( $order_id ); 165 $order = wc_get_order( $order_id ); 166 158 167 $order->add_order_note( __( 'POLi Nudge Recieved. POLi ID: ' . $json['TransactionRefNo'], 'payment-gateway-poli-for-woocommerce' ) ); 159 168 $order->payment_complete(); … … 170 179 $error_message = $json['ErrorMessage']; 171 180 $woocommerce->add_error( __( 'Payment error:', 'payment-gateway-poli-for-woocommerce') . ' Order ID: ' . $order_id . ' Error Code: ' . $error_code . ' Error Message: ' .$error_message ); 172 $redirect_url = get_permalink( woocommerce_get_page_id( 'pay' ) ); 181 // 2017.11.30 182 // $redirect_url = get_permalink( woocommerce_get_page_id( 'pay' ) ); 183 $redirect_url = WC_Order::get_checkout_payment_url(); 173 184 wp_safe_redirect( $redirect_url ); 174 185 exit();
Note: See TracChangeset
for help on using the changeset viewer.