Changeset 2215674
- Timestamp:
- 12/20/2019 12:30:22 PM (6 years ago)
- Location:
- woo-authorize-addon/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
woo-authorize-addon.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-authorize-addon/trunk/readme.txt
r1954387 r2215674 1 ==== Woo Authorize Addon====1 ==== Addon for Authorize and WooCommerce ==== 2 2 Contributors: wp_estatic 3 Plugin Name: A uthorize.Net WooCommerce Addon3 Plugin Name: Addon for Authorize and WooCommerce 4 4 Plugin URI: https://wordpress.org/plugins/authorizenet-woocommerce-addon/ 5 5 Tags: woocommerce authorize.net plugin,authorize.net for woocommerce,credit card payment with Authorize.Net,authorize.net payment gateway for woocommerce,authorize.net woocommerce plugin,authorize.net woocommerce plugin for wordpress,authorize.net aim payment gateway plugin,woocommerce authorizenet payment gateway. 6 6 Requires at least: 4.0 & WooCommerce 2.3+ 7 Tested up to: 4.9.8 & Woocommerce 3.4.57 Tested up to: 5.3.2 & Woocommerce 3.8.1 8 8 Stable tag: trunk 9 9 License: GPLv3 … … 103 103 = 1.0.2 = 104 104 * Fix - Woocommerce and wordpress version with Card Form Compitable 105 = 2.0.1 = 106 * Fix - Update version. 105 107 106 108 == Upgrade Notice == -
woo-authorize-addon/trunk/woo-authorize-addon.php
r1954387 r2215674 1 1 <?php 2 2 /** 3 * Plugin Name: Woo Authorize Addon4 * Description: Woo Authorize Addonallows you to accept payments on your Woocommerce store. It accpets credit card payments and processes them securely with your merchant account.5 * Version: 1.0.13 * Plugin Name: Addon for Authorize and WooCommerce 4 * Description: Addon for Authorize and WooCommerce allows you to accept payments on your Woocommerce store. It accpets credit card payments and processes them securely with your merchant account. 5 * Version: 2.0.1 6 6 * WC requires at least:2.3 7 * WC tested up to: 3. 4.57 * WC tested up to: 3.8.1 8 8 * Requires at least: 4.0+ 9 * Tested up to: 4.9.89 * Tested up to: 5.3.2 10 10 * Contributors: wp_estatic 11 11 * Author: Estatic Infotech Pvt Ltd … … 87 87 $this->authorizenet_cardtypes = $this->get_option('authorizenet_cardtypes'); 88 88 $this->authorizenet_enable_for_methods = $this->get_option('authorizenet_enable_for_methods', array()); 89 add_action('woocommerce_order_status_processing_to_cancelled', array($this, 'restore_stock_authorize'), 10, 1);90 add_action('woocommerce_order_status_completed_to_cancelled', array($this, 'restore_stock_authorize'), 10, 1);91 add_action('woocommerce_order_status_on-hold_to_cancelled', array($this, 'restore_stock_authorize'), 10, 1);92 add_action('woocommerce_order_status_processing_to_refunded', array($this, 'restore_stock_authorize'), 10, 1);93 add_action('woocommerce_order_status_completed_to_refunded', array($this, 'restore_stock_authorize'), 10, 1);94 add_action('woocommerce_order_status_on-hold_to_refunded', array($this, 'restore_stock_authorize'), 10, 1);95 add_action('woocommerce_order_status_cancelled_to_processing', array($this, 'drestore_stock_authorize'), 10, 1);96 add_action('woocommerce_order_status_cancelled_to_completed', array($this, 'drestore_stock_authorize'), 10, 1);97 add_action('woocommerce_order_status_cancelled_to_on-hold', array($this, 'drestore_stock_authorize'), 10, 1);98 89 99 90 if (is_admin()) { … … 159 150 'live' => 'Live', 160 151 ), 161 'default' => array('sandbox'),152 'default' => 'sandbox', 162 153 ), 163 154 'show_accepted_auth' => array( … … 171 162 'no' => 'No', 172 163 ), 173 'default' => array('yes'),164 'default' => 'yes', 174 165 ), 175 166 'authorizenet_cardtypes' => array( … … 348 339 */ 349 340 public function process_payment($order_id) { 350 351 341 global $woocommerce; 352 342 $wc_order = new WC_Order($order_id); 353 343 $user_id = get_current_user_id(); 344 354 345 $customer_profile_id = get_user_meta($user_id, 'customer_profile_id', true); 355 346 $payment_profile_id = get_user_meta($user_id, 'payment_profile_id', true); 347 356 348 if (!empty($customer_profile_id) && !empty($payment_profile_id)) { 357 349 … … 403 395 } 404 396 } else { 397 405 398 $cardtype = $this->get_card_type(sanitize_text_field(str_replace(' ', '', $_POST['authorizenet-card-number']))); 406 399 if ($this->get_option('show_accepted_auth') == 'no') { … … 408 401 return array( 409 402 'result' => 'success', 410 'redirect' => WC()->cart->get_checkout_url(),403 'redirect' => wc_get_checkout_url(), 411 404 ); 412 405 die; … … 416 409 return array( 417 410 'result' => 'success', 418 'redirect' => WC()->cart->get_checkout_url(),411 'redirect' => wc_get_checkout_url(), 419 412 ); 420 413 die; … … 443 436 $paymentCreditCard->setCreditCard($creditCard); 444 437 $expiration_date = $exp_year . "-" . $exp_month; 438 445 439 if ($user_id == '') { 446 440 … … 485 479 } 486 480 } else { 481 487 482 $billto = new AnetAPI\CustomerAddressType(); 488 483 $billto->setFirstName($wc_order->billing_first_name); … … 524 519 $controller = new AnetController\CreateCustomerProfileController($request); 525 520 $response = $controller->executeWithApiResponse($this->authlink); 526 521 527 522 if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) { 528 523 $request2 = new AnetAPI\CreateCustomerShippingAddressRequest(); … … 554 549 $controller = new AnetController\CreateTransactionController($request); 555 550 $response = $controller->executeWithApiResponse($this->authlink); 551 556 552 if ($response != null) { 557 553 $tresponse = $response->getTransactionResponse(); … … 575 571 return array( 576 572 'result' => 'success', 577 'redirect' => WC()->cart->get_checkout_url(),573 'redirect' => wc_get_checkout_url(), 578 574 ); 579 575 die; … … 719 715 720 716 /** 721 *722 * @param type $order_id723 * @return type724 */725 public function restore_stock_authorize($order_id) {726 $order = new WC_Order($order_id);727 $payment_method = get_post_meta($order->id, '_payment_method', true);728 if ($payment_method == 'authorizenet') {729 $refund = self::process_refund($order_id, $amount = NULL);730 731 if ($refund == TRUE) {732 if (!get_option('woocommerce_manage_stock') == 'yes' && !sizeof($order->get_items()) > 0) {733 return;734 }735 foreach ($order->get_items() as $item) {736 737 if ($item['product_id'] > 0) {738 739 $_product = $order->get_product_from_item($item);740 741 if ($_product && $_product->exists() && $_product->managing_stock()) {742 743 $old_stock = $_product->stock;744 745 $qty = apply_filters('woocommerce_order_item_quantity', $item['qty'], $this, $item);746 747 $new_quantity = $_product->increase_stock($qty);748 749 $order->add_order_note(sprintf(__('Item #%s stock incremented from %s to %s.', 'woocommerce'), $item['product_id'], $old_stock, $new_quantity));750 751 $order->send_stock_notifications($_product, $new_quantity, $item['qty']);752 }753 }754 }755 }756 }757 }758 759 /**760 *761 * @param type $order_id762 * @return type763 */764 public function drestore_stock_authorize($order_id) {765 $order = new WC_Order($order_id);766 $payment_method = get_post_meta($order->id, '_payment_method', true);767 if ($payment_method == 'authorizenet') {768 if (!get_option('woocommerce_manage_stock') == 'yes' && !sizeof($order->get_items()) > 0) {769 return;770 }771 772 foreach ($order->get_items() as $item) {773 774 if ($item['product_id'] > 0) {775 $_product = $order->get_product_from_item($item);776 777 if ($_product && $_product->exists() && $_product->managing_stock()) {778 779 $old_stock = $_product->stock;780 781 $qty = apply_filters('woocommerce_order_item_quantity', $item['qty'], $this, $item);782 783 $new_quantity = $_product->reduce_stock($qty);784 785 do_action('woocommerce_auto_stock_restored', $_product, $item);786 787 $order->add_order_note(sprintf(__('Item #%s stock reduce from %s to %s.', 'woocommerce'), $item['product_id'], $old_stock, $new_quantity));788 789 $order->send_stock_notifications($_product, $new_quantity, $item['qty']);790 }791 }792 }793 }794 }795 796 /**797 717 * sslerror_authorize 798 718 */ 799 public function sslerror_authorize() {719 public function wane_sslerror_authorize() { 800 720 $html = '<div class="error">'; 801 721 $html .= '<p>'; … … 810 730 } else { 811 731 if (!class_exists('WC_Payment_Gateway')) { 812 add_action('admin_notices', ' activate_error_auth');732 add_action('admin_notices', 'wane_activate_error_auth'); 813 733 } 814 734 deactivate_plugins(plugin_basename(__FILE__)); … … 820 740 * activate_error_auth 821 741 */ 822 function activate_error_auth() {742 function wane_activate_error_auth() { 823 743 $html = '<div class="error">'; 824 744 $html .= '<p>'; … … 834 754 * authorizenet_woocommerce_addon_activate 835 755 */ 836 function authorizenet_woocommerce_addon_activate() {756 function wane_authorizenet_woocommerce_addon_activate() { 837 757 838 758 if (!function_exists('curl_exec')) { … … 841 761 } 842 762 843 register_activation_hook(__FILE__, ' authorizenet_woocommerce_addon_activate');763 register_activation_hook(__FILE__, 'wane_authorizenet_woocommerce_addon_activate'); 844 764 845 765 /* Plugin Settings Link */ … … 850 770 * @return type 851 771 */ 852 function authorizenet_woocommerce_settings_link($links) {772 function wane_authorizenet_woocommerce_settings_link($links) { 853 773 $settings_link = '<a href="admin.php?page=wc-settings&tab=checkout§ion=wc_authorizenet_gateway">' . __('Settings') . '</a>'; 854 774 array_push($links, $settings_link); … … 857 777 858 778 $plugin = plugin_basename(__FILE__); 859 add_filter("plugin_action_links_$plugin", ' authorizenet_woocommerce_settings_link');779 add_filter("plugin_action_links_$plugin", 'wane_authorizenet_woocommerce_settings_link'); 860 780 861 781 /** 862 782 * add_custom_js_auth 863 783 */ 864 function add_custom_js_auth() {784 function wane_add_custom_js_auth() { 865 785 wp_enqueue_script('jquery-cc-authorizenet', plugin_dir_url(__FILE__) . 'js/cc.custom_auth.js', array('jquery'), '1.0', True); 866 786 wp_enqueue_style('authorizenet-css', plugin_dir_url(__FILE__) . 'css/style.css'); 867 787 } 868 788 869 add_action('wp_enqueue_scripts', ' add_custom_js_auth');789 add_action('wp_enqueue_scripts', 'wane_add_custom_js_auth'); 870 790 /* $Class1 = new WC_Authorizenet_Gateway; */ 871 791 $woo_authorize_settings = get_option('woocommerce_authorize_settings'); 872 792 if (!empty($woo_authorize_settings)) { 873 793 if ($woo_authorize_settings['enabled'] == 'yes' && $woo_authorize_settings['mode'] == 'live' && !is_ssl()) { 874 add_action('admin_notices', array('WC_Authorizenet_Gateway', ' sslerror_authorize'));794 add_action('admin_notices', array('WC_Authorizenet_Gateway', 'wane_sslerror_authorize')); 875 795 } else { 876 remove_action('admin_notices', array('WC_Authorizenet_Gateway', ' sslerror_authorize'));796 remove_action('admin_notices', array('WC_Authorizenet_Gateway', 'wane_sslerror_authorize')); 877 797 } 878 798 }
Note: See TracChangeset
for help on using the changeset viewer.