Plugin Directory

Changeset 2307714


Ignore:
Timestamp:
05/19/2020 07:50:55 AM (6 years ago)
Author:
eftsecure
Message:

Woocommerce 3.X support

Location:
woo-eftsecure-gateway/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • woo-eftsecure-gateway/trunk/changelog.txt

    r1691756 r2307714  
    1515* Added redirect support and option to enable checkout
    1616* Precreate order for Checkout widget
     17
     18= 1.0.4 - 2020.05.16 =
     19* Woocommerce 3.X support
  • woo-eftsecure-gateway/trunk/includes/class-wc-eftsecure-api.php

    r1691756 r2307714  
    115115        );
    116116
     117        if (is_wp_error($response)) {
     118            WC_Eftsecure::log( "WP Error: ".$response->get_error_message());
     119            return $response;
     120        }
     121
     122        WC_Eftsecure::log( "Response: ".json_encode($response));
     123
    117124        $parsed_response = json_decode( $response['body'] );
     125
    118126
    119127        if(empty( $response['body'] ) ) {
     
    128136
    129137        // Handle response
    130         if ( ! empty( $parsed_response->status ) && $parsed_response->status != 200 ) {
    131             $error = new WP_Error( $parsed_response->status, $parsed_response->name );
    132             return $error;
    133         } else {
    134             return $parsed_response;
    135         }
     138        return $parsed_response;
    136139    }
    137140
     
    160163        if ( is_wp_error( $response ) ) {
    161164            WC_Eftsecure::log( 'EFTsecure Transaction API Error: '.$response->get_error_message() );
    162             throw new Exception('EFTsecure Transaction: '.$response->get_error_message());
    163165        }
    164166        return $response;
  • woo-eftsecure-gateway/trunk/includes/class-wc-gateway-eftsecure.php

    r1691756 r2307714  
    335335
    336336        if ( $order->has_status( array( 'pending', 'failed' ) ) ) {
    337             $order->reduce_order_stock();
     337            if ( version_compare( WC_VERSION, '3.0', '>=' ) ) {
     338                // new version code
     339                wc_reduce_stock_levels($order);
     340            } else {
     341                $order->reduce_order_stock();
     342            }
    338343        }
    339344
     
    350355            throw new Exception( __( 'OrderID was not specified in IPN response', 'woocommerce-gateway-eftsecure' ) );
    351356        }
     357
     358        WC_Eftsecure::log( __( 'EFT IPN response received '.json_encode($_REQUEST), 'woocommerce-gateway-eftsecure' ) );
    352359
    353360        $order_id = $_REQUEST['order_id'];
     
    391398
    392399            if ($response->successful == 1) {
    393 
    394400                if ($order->has_status(array('pending', 'failed'))) {
    395                     $order->reduce_order_stock();
     401                    if ( version_compare( WC_VERSION, '3.0', '>=' ) ) {
     402                        // new version code
     403                        wc_reduce_stock_levels($order);
     404                    } else {
     405                        $order->reduce_order_stock();
     406                    }
    396407                }
    397408
  • woo-eftsecure-gateway/trunk/readme.txt

    r1691756 r2307714  
    2121
    2222== Changelog ==
     23= 1.0.4 - 2020.05.16 =
     24* Woocommerce 3.X support
     25
    2326= 1.0.3 - 2017.05.05 =
    2427* Additional validation bug fixes
  • woo-eftsecure-gateway/trunk/woocommerce-gateway-eftsecure.php

    r1691756 r2307714  
    55 * Author: CallPay
    66 * Author URI: http://www.eftsecure.co.za/
    7  * Version: 1.0.3
     7 * Version: 1.0.4
    88 * Text Domain: woocommerce-gateway-eftsecure
    99 * Domain Path: /languages
     
    1919 * Required minimums and constants
    2020 */
    21 define( 'WC_EFTSECURE_VERSION', '1.0.3' );
     21define( 'WC_EFTSECURE_VERSION', '1.0.4' );
    2222define( 'WC_EFTSECURE_MIN_WC_VER', '2.2.0' );
    2323define( 'WC_EFTSECURE_MAIN_FILE', __FILE__ );
Note: See TracChangeset for help on using the changeset viewer.