Plugin Directory

Changeset 1787349


Ignore:
Timestamp:
12/14/2017 11:47:49 PM (8 years ago)
Author:
cloughit
Message:

2017.11.30

Location:
payment-gateway-poli-for-woocommerce/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • payment-gateway-poli-for-woocommerce/trunk/readme.txt

    r1661918 r1787349  
    44Donate link: https://cloughit.com.au/donate/
    55Requires at least: 4.0
    6 Tested up to: 4.8
    7 Stable tag: 2017.05.22
     6Tested up to: 4.9.1
     7Stable tag: 2017.11.30
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4646== Changelog ==
    4747
     48= 2017.11.30 =
     49
     50* MOD: Changed method to get order details
     51* MOD: Changed method to obtain URL's
     52
    4853= 2017.05.22 =
    4954
  • payment-gateway-poli-for-woocommerce/trunk/woocommerce-poli.php

    r1661918 r1787349  
    55 * Author:      Clough I.T. Solutions
    66 * Author URI:  https://cloughit.com.au
    7  * Version:     2017.05.22
     7 * Version:     2017.11.30
    88 * Text Domain: payment-gateway-poli-for-woocommerce
    99 * License:     GNU General Public License v2 or later
     
    7878        public function process_payment( $order_id ) {
    7979            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 );
    8183
    8284            // Mark as on-hold (we're awaiting the cheque)
     
    8991                'Amount' => $order->get_total(),
    9092                'CurrencyCode' => get_woocommerce_currency(),
    91                 'MerchantReference' => $order_id,
     93                // 2017.11.30
     94                // 'MerchantReference' => $order_id,
     95                'MerchantReference' => $order->get_id(),
    9296                'MerchantHomepageURL' => home_url( '/' ),
    9397                'SuccessURL' => str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'poli_nudge', home_url( '/' ) ) ),
    9498                '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(),
    96102                'NotificationURL' => str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'poli_nudge', home_url( '/' ) ) )
    97103            );
     
    146152            curl_setopt( $ch, CURLOPT_POST, 0 );
    147153            curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0 );
    148             curl_setopt($ch, CURLOPT_REFERER, $referrer);//Set the referrer
     154            curl_setopt( $ch, CURLOPT_REFERER, $referrer);//Set the referrer
    149155            curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
    150156            $response = curl_exec( $ch );
     
    155161            if ( $json['TransactionStatusCode'] == 'Completed' ) {
    156162                $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               
    158167                $order->add_order_note( __( 'POLi Nudge Recieved. POLi ID: ' . $json['TransactionRefNo'], 'payment-gateway-poli-for-woocommerce' ) );
    159168                $order->payment_complete();
     
    170179                $error_message = $json['ErrorMessage'];
    171180                $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();
    173184                wp_safe_redirect( $redirect_url );
    174185                exit();
Note: See TracChangeset for help on using the changeset viewer.