Changeset 2215055
- Timestamp:
- 12/19/2019 12:42:24 PM (6 years ago)
- Location:
- woo-eway-addon/trunk
- Files:
-
- 2 edited
-
README.txt (modified) (3 diffs)
-
woo-eway-addon.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-eway-addon/trunk/README.txt
r1954326 r2215055 1 === Woo Eway Addon===1 === Addon for Eway and WooCommerce === 2 2 Contributors: wp_estatic 3 3 Tags: 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 4 4 Requires at least: 4.0 & WooCommerce 2.3+ 5 Tested up to: 4.9.8 & Woocommerce 3.4.55 Tested up to: 5.3 & Woocommerce 3.8.1 6 6 Stable tag: trunk 7 7 License: GPLv3 … … 92 92 93 93 == Changelog == 94 = 1. 0.1 =94 = 1.9.1 = 95 95 * Fix - Woocommerce Credit Card Form Compitable 96 96 * Direct Payment and Error Code Display on Checkout form … … 98 98 * Fix - Product restock issue 99 99 * Update Folder structure and product sku issues 100 = 2.0.1 = 101 * Update - Latest version. 102 * Fix - Remove deprecate funcations. 100 103 == Upgrade Notice == 101 104 -
woo-eway-addon/trunk/woo-eway-addon.php
r1954524 r2215055 1 1 <?php 2 2 /** 3 * Plugin Name: Woo Eway Addon4 * Plugin URI : Woo Eway Addon5 * Description: Woo Eway Addonallows 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.13 * 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 7 7 * WC requires at least:2.3 8 * WC tested up to: 3. 4.58 * WC tested up to: 3.8.1 9 9 * Requires at least: 4.0+ 10 * Tested up to: 4.9.810 * Tested up to: 5.3 11 11 * Contributors: wp_estatic 12 12 * Author: Estatic Infotech Pvt Ltd … … 102 102 if (is_admin()) { 103 103 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);113 104 } 114 105 } … … 193 184 'no' => 'No', 194 185 ), 195 'default' => array('yes'),186 'default' => 'yes', 196 187 ), 'eway_cardtypes' => array( 197 188 'title' => __('Accepted Card Types', 'eway'), … … 265 256 /** 266 257 * 267 * @param type $order_id268 * @return type269 */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_id307 * @return type308 */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 *343 258 * @global type $woocommerce 344 259 * @param type $order_id … … 347 262 public function process_payment($order_id) { 348 263 global $woocommerce; 349 $customer_order = new WC_Order($order_id);264 $customer_order = wc_get_order($order_id); 350 265 351 266 require('vendor/autoload.php'); … … 373 288 return array( 374 289 'result' => 'success', 375 'redirect' => WC()->cart->get_checkout_url(),290 'redirect' => wc_get_checkout_url(), 376 291 ); 377 292 die; … … 477 392 return array( 478 393 'result' => 'success', 479 'redirect' => WC()->cart->get_checkout_url(),394 'redirect' => wc_get_checkout_url(), 480 395 ); 481 396 die; 482 }483 }484 485 /**486 *487 * @param type $order_id488 * @return type489 */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 }519 397 } 520 398 } … … 582 460 public function process_refund($order_id, $amount = NULL, $reason = '') { 583 461 global $woocommerce; 584 $customer_order = new WC_Order($order_id);462 $customer_order = wc_get_order($order_id); 585 463 require('vendor/autoload.php'); 586 464 $transaction_id = get_post_meta($order_id, '_transaction_id', true);
Note: See TracChangeset
for help on using the changeset viewer.