Plugin Directory

Changeset 2215055


Ignore:
Timestamp:
12/19/2019 12:42:24 PM (6 years ago)
Author:
wp_estatic
Message:

Remove deprecated funcations .

Location:
woo-eway-addon/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • woo-eway-addon/trunk/README.txt

    r1954326 r2215055  
    1 === Woo Eway Addon ===
     1=== Addon for Eway and WooCommerce ===
    22Contributors: wp_estatic
    33Tags: eway woocommerce plugin,eway plugin woocommerce,woocommerce, Eway, payment gateway,credit card,Eway addon,refund,credit cards payment Eway and woocommerce,Eway for woocommerce,Eway payment gateway for woocommerce,Eway payment in wordpress,Eway payment refunds,Eway plugin for woocommerce,Eway woocommerce addon,free Eway woocommerce plugin,woocommerce credit cards payment with Eway,woocommerce plugin Eway, ecommerce, e-commerce, commerce, cart, checkout
    44Requires at least: 4.0 & WooCommerce 2.3+
    5 Tested up to: 4.9.8 & Woocommerce 3.4.5
     5Tested up to: 5.3 & Woocommerce 3.8.1
    66Stable tag: trunk
    77License: GPLv3
     
    9292
    9393== Changelog ==
    94 = 1.0.1 =
     94= 1.9.1 =
    9595* Fix - Woocommerce Credit Card Form Compitable
    9696* Direct Payment and Error Code Display on Checkout form
     
    9898* Fix - Product restock issue
    9999* Update Folder structure and product sku issues
     100= 2.0.1 =
     101* Update - Latest version.
     102* Fix - Remove deprecate funcations.
    100103== Upgrade Notice ==
    101104
  • woo-eway-addon/trunk/woo-eway-addon.php

    r1954524 r2215055  
    11<?php
    22/**
    3  * Plugin Name:         Woo Eway Addon
    4  * Plugin URI :         Woo Eway Addon
    5  * Description:         Woo Eway Addon allows you to accept payments on your Woocommerce store. It accpets credit card payments and processes them securely with your merchant account.
    6  * Version:             1.0.1
     3 * Plugin Name:         Addon for Eway and WooCommerce
     4 * Plugin URI :         Addon for Eway and WooCommerce
     5 * Description:         Addon for Eway and WooCommerce allows you to accept payments on your Woocommerce store. It accpets credit card payments and processes them securely with your merchant account.
     6 * Version:             1.9.1
    77 * WC requires at least:2.3
    8  * WC tested up to:     3.4.5
     8 * WC tested up to:     3.8.1
    99 * Requires at least:   4.0+
    10  * Tested up to:        4.9.8
     10 * Tested up to:        5.3
    1111 * Contributors:        wp_estatic
    1212 * Author:              Estatic Infotech Pvt Ltd
     
    102102                if (is_admin()) {
    103103                    add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
    104                     add_action('woocommerce_order_status_processing_to_cancelled', array($this, 'restore_stock_eway_cancel'), 10, 1);
    105                     add_action('woocommerce_order_status_completed_to_cancelled', array($this, 'restore_stock_eway_cancel'), 10, 1);
    106                     add_action('woocommerce_order_status_on-hold_to_cancelled', array($this, 'restore_stock_eway_cancel'), 10, 1);
    107                     add_action('woocommerce_order_status_processing_to_refunded', array($this, 'restore_stock_eway'), 10, 1);
    108                     add_action('woocommerce_order_status_completed_to_refunded', array($this, 'restore_stock_eway'), 10, 1);
    109                     add_action('woocommerce_order_status_on-hold_to_refunded', array($this, 'restore_stock_eway'), 10, 1);
    110                     add_action('woocommerce_order_status_cancelled_to_processing', array($this, 'reduce_stock_eway'), 10, 1);
    111                     add_action('woocommerce_order_status_cancelled_to_completed', array($this, 'reduce_stock_eway'), 10, 1);
    112                     add_action('woocommerce_order_status_cancelled_to_on-hold', array($this, 'reduce_stock_eway'), 10, 1);
    113104                }
    114105            }
     
    193184                            'no' => 'No',
    194185                        ),
    195                         'default' => array('yes'),
     186                        'default' => 'yes',
    196187                    ), 'eway_cardtypes' => array(
    197188                        'title' => __('Accepted Card Types', 'eway'),
     
    265256            /**
    266257             *
    267              * @param type $order_id
    268              * @return type
    269              */
    270             public function restore_stock_eway($order_id) {
    271                 $order = new WC_Order($order_id);
    272                 $refund = self::process_refund($order_id, $amount = NULL);
    273                 if ($refund == true) {
    274                     $payment_method = get_post_meta($order->id, '_payment_method', true);
    275                     if ($payment_method == 'eway') {
    276                         if (!get_option('woocommerce_manage_stock') == 'yes' && !sizeof($order->get_items()) > 0) {
    277                             return;
    278                         }
    279                         foreach ($order->get_items() as $item) {
    280 
    281                             if ($item['product_id'] > 0) {
    282                                 $_product = $order->get_product_from_item($item);
    283 
    284                                 if ($_product && $_product->exists() && $_product->managing_stock()) {
    285 
    286                                     $old_stock = $_product->stock;
    287 
    288                                     $qty = apply_filters('woocommerce_order_item_quantity', $item['qty'], $this, $item);
    289 
    290                                     $new_quantity = $_product->increase_stock($qty);
    291 
    292                                     do_action('woocommerce_auto_stock_restored', $_product, $item);
    293 
    294                                     $order->add_order_note(sprintf(__('Item #%s stock incremented from %s to %s.', 'woocommerce'), $item['product_id'], $old_stock, $new_quantity));
    295 
    296                                     $order->send_stock_notifications($_product, $new_quantity, $item['qty']);
    297                                 }
    298                             }
    299                         }
    300                     }
    301                 }
    302             }
    303 
    304             /**
    305              *
    306              * @param type $order_id
    307              * @return type
    308              */
    309             public function reduce_stock_eway($order_id) {
    310                 $order = new WC_Order($order_id);
    311                 $payment_method = get_post_meta($order->id, '_payment_method', true);
    312                 if ($payment_method == 'eway') {
    313                     if (!get_option('woocommerce_manage_stock') == 'yes' && !sizeof($order->get_items()) > 0) {
    314                         return;
    315                     }
    316 
    317                     foreach ($order->get_items() as $item) {
    318 
    319                         if ($item['product_id'] > 0) {
    320                             $_product = $order->get_product_from_item($item);
    321 
    322                             if ($_product && $_product->exists() && $_product->managing_stock()) {
    323 
    324                                 $old_stock = $_product->stock;
    325 
    326                                 $qty = apply_filters('woocommerce_order_item_quantity', $item['qty'], $this, $item);
    327 
    328                                 $new_quantity = $_product->reduce_stock($qty);
    329 
    330                                 do_action('woocommerce_auto_stock_restored', $_product, $item);
    331 
    332                                 $order->add_order_note(sprintf(__('Item #%s stock reduce from %s to %s.', 'woocommerce'), $item['product_id'], $old_stock, $new_quantity));
    333 
    334                                 $order->send_stock_notifications($_product, $new_quantity, $item['qty']);
    335                             }
    336                         }
    337                     }
    338                 }
    339             }
    340 
    341             /**
    342              *
    343258             * @global type $woocommerce
    344259             * @param type $order_id
     
    347262            public function process_payment($order_id) {
    348263                global $woocommerce;
    349                 $customer_order = new WC_Order($order_id);
     264                $customer_order = wc_get_order($order_id);
    350265
    351266                require('vendor/autoload.php');
     
    373288                    return array(
    374289                        'result' => 'success',
    375                         'redirect' => WC()->cart->get_checkout_url(),
     290                        'redirect' => wc_get_checkout_url(),
    376291                    );
    377292                    die;
     
    477392                    return array(
    478393                        'result' => 'success',
    479                         'redirect' => WC()->cart->get_checkout_url(),
     394                        'redirect' => wc_get_checkout_url(),
    480395                    );
    481396                    die;
    482                 }
    483             }
    484 
    485             /**
    486              *
    487              * @param type $order_id
    488              * @return type
    489              */
    490             public function restore_stock_eway_cancel($order_id) {
    491                 $order = new WC_Order($order_id);
    492 
    493                 $payment_method = get_post_meta($order->id, '_payment_method', true);
    494                 if ($payment_method == 'eway') {
    495                     if (!get_option('woocommerce_manage_stock') == 'yes' && !sizeof($order->get_items()) > 0) {
    496                         return;
    497                     }
    498                     foreach ($order->get_items() as $item) {
    499 
    500                         if ($item['product_id'] > 0) {
    501                             $_product = $order->get_product_from_item($item);
    502 
    503                             if ($_product && $_product->exists() && $_product->managing_stock()) {
    504 
    505                                 $old_stock = $_product->stock;
    506 
    507                                 $qty = apply_filters('woocommerce_order_item_quantity', $item['qty'], $this, $item);
    508 
    509                                 $new_quantity = $_product->increase_stock($qty);
    510 
    511                                 do_action('woocommerce_auto_stock_restored', $_product, $item);
    512 
    513                                 $order->add_order_note(sprintf(__('Item #%s stock incremented from %s to %s.', 'woocommerce'), $item['product_id'], $old_stock, $new_quantity));
    514 
    515                                 $order->send_stock_notifications($_product, $new_quantity, $item['qty']);
    516                             }
    517                         }
    518                     }
    519397                }
    520398            }
     
    582460            public function process_refund($order_id, $amount = NULL, $reason = '') {
    583461                global $woocommerce;
    584                 $customer_order = new WC_Order($order_id);
     462                $customer_order = wc_get_order($order_id);
    585463                require('vendor/autoload.php');
    586464                $transaction_id = get_post_meta($order_id, '_transaction_id', true);
Note: See TracChangeset for help on using the changeset viewer.