Plugin Directory

Changeset 2215674


Ignore:
Timestamp:
12/20/2019 12:30:22 PM (6 years ago)
Author:
wp_estatic
Message:

Fix - Update version.

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

Legend:

Unmodified
Added
Removed
  • woo-authorize-addon/trunk/readme.txt

    r1954387 r2215674  
    1 ==== Woo Authorize Addon ====
     1==== Addon for Authorize and WooCommerce ====
    22Contributors: wp_estatic
    3 Plugin Name: Authorize.Net WooCommerce Addon
     3Plugin Name: Addon for Authorize and WooCommerce
    44Plugin URI: https://wordpress.org/plugins/authorizenet-woocommerce-addon/
    55Tags: 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.
    66Requires at least: 4.0 & WooCommerce 2.3+
    7 Tested up to: 4.9.8 & Woocommerce 3.4.5
     7Tested up to: 5.3.2 & Woocommerce 3.8.1
    88Stable tag: trunk
    99License: GPLv3
     
    103103= 1.0.2 =
    104104* Fix - Woocommerce and wordpress version with Card Form Compitable
     105= 2.0.1 =
     106* Fix - Update version.
    105107
    106108== Upgrade Notice ==
  • woo-authorize-addon/trunk/woo-authorize-addon.php

    r1954387 r2215674  
    11<?php
    22/**
    3  * Plugin Name:         Woo Authorize Addon
    4  * Description:         Woo Authorize Addon allows 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.1
     3 * 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
    66 * WC requires at least:2.3
    7  * WC tested up to:     3.4.5
     7 * WC tested up to:     3.8.1
    88 * Requires at least:   4.0+
    9  * Tested up to:        4.9.8
     9 * Tested up to:        5.3.2
    1010 * Contributors:        wp_estatic
    1111 * Author:              Estatic Infotech Pvt Ltd
     
    8787                $this->authorizenet_cardtypes = $this->get_option('authorizenet_cardtypes');
    8888                $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);
    9889
    9990                if (is_admin()) {
     
    159150                            'live' => 'Live',
    160151                        ),
    161                         'default' => array('sandbox'),
     152                        'default' => 'sandbox',
    162153                    ),
    163154                    'show_accepted_auth' => array(
     
    171162                            'no' => 'No',
    172163                        ),
    173                         'default' => array('yes'),
     164                        'default' => 'yes',
    174165                    ),
    175166                    'authorizenet_cardtypes' => array(
     
    348339             */
    349340            public function process_payment($order_id) {
    350 
    351341                global $woocommerce;
    352342                $wc_order = new WC_Order($order_id);
    353343                $user_id = get_current_user_id();
     344
    354345                $customer_profile_id = get_user_meta($user_id, 'customer_profile_id', true);
    355346                $payment_profile_id = get_user_meta($user_id, 'payment_profile_id', true);
     347
    356348                if (!empty($customer_profile_id) && !empty($payment_profile_id)) {
    357349
     
    403395                    }
    404396                } else {
     397
    405398                    $cardtype = $this->get_card_type(sanitize_text_field(str_replace(' ', '', $_POST['authorizenet-card-number'])));
    406399                    if ($this->get_option('show_accepted_auth') == 'no') {
     
    408401                        return array(
    409402                            'result' => 'success',
    410                             'redirect' => WC()->cart->get_checkout_url(),
     403                            'redirect' => wc_get_checkout_url(),
    411404                        );
    412405                        die;
     
    416409                        return array(
    417410                            'result' => 'success',
    418                             'redirect' => WC()->cart->get_checkout_url(),
     411                            'redirect' => wc_get_checkout_url(),
    419412                        );
    420413                        die;
     
    443436                    $paymentCreditCard->setCreditCard($creditCard);
    444437                    $expiration_date = $exp_year . "-" . $exp_month;
     438
    445439                    if ($user_id == '') {
    446440
     
    485479                        }
    486480                    } else {
     481
    487482                        $billto = new AnetAPI\CustomerAddressType();
    488483                        $billto->setFirstName($wc_order->billing_first_name);
     
    524519                        $controller = new AnetController\CreateCustomerProfileController($request);
    525520                        $response = $controller->executeWithApiResponse($this->authlink);
    526 
     521                       
    527522                        if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
    528523                            $request2 = new AnetAPI\CreateCustomerShippingAddressRequest();
     
    554549                                $controller = new AnetController\CreateTransactionController($request);
    555550                                $response = $controller->executeWithApiResponse($this->authlink);
     551
    556552                                if ($response != null) {
    557553                                    $tresponse = $response->getTransactionResponse();
     
    575571                            return array(
    576572                                'result' => 'success',
    577                                 'redirect' => WC()->cart->get_checkout_url(),
     573                                'redirect' => wc_get_checkout_url(),
    578574                            );
    579575                            die;
     
    719715
    720716            /**
    721              *
    722              * @param type $order_id
    723              * @return type
    724              */
    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_id
    762              * @return type
    763              */
    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             /**
    797717             * sslerror_authorize
    798718             */
    799             public function sslerror_authorize() {
     719            public function wane_sslerror_authorize() {
    800720                $html = '<div class="error">';
    801721                $html .= '<p>';
     
    810730    } else {
    811731        if (!class_exists('WC_Payment_Gateway')) {
    812             add_action('admin_notices', 'activate_error_auth');
     732            add_action('admin_notices', 'wane_activate_error_auth');
    813733        }
    814734        deactivate_plugins(plugin_basename(__FILE__));
     
    820740 * activate_error_auth
    821741 */
    822 function activate_error_auth() {
     742function wane_activate_error_auth() {
    823743    $html = '<div class="error">';
    824744    $html .= '<p>';
     
    834754 * authorizenet_woocommerce_addon_activate
    835755 */
    836 function authorizenet_woocommerce_addon_activate() {
     756function wane_authorizenet_woocommerce_addon_activate() {
    837757
    838758    if (!function_exists('curl_exec')) {
     
    841761}
    842762
    843 register_activation_hook(__FILE__, 'authorizenet_woocommerce_addon_activate');
     763register_activation_hook(__FILE__, 'wane_authorizenet_woocommerce_addon_activate');
    844764
    845765/* Plugin Settings Link */
     
    850770 * @return type
    851771 */
    852 function authorizenet_woocommerce_settings_link($links) {
     772function wane_authorizenet_woocommerce_settings_link($links) {
    853773    $settings_link = '<a href="admin.php?page=wc-settings&tab=checkout&section=wc_authorizenet_gateway">' . __('Settings') . '</a>';
    854774    array_push($links, $settings_link);
     
    857777
    858778$plugin = plugin_basename(__FILE__);
    859 add_filter("plugin_action_links_$plugin", 'authorizenet_woocommerce_settings_link');
     779add_filter("plugin_action_links_$plugin", 'wane_authorizenet_woocommerce_settings_link');
    860780
    861781/**
    862782 * add_custom_js_auth
    863783 */
    864 function add_custom_js_auth() {
     784function wane_add_custom_js_auth() {
    865785    wp_enqueue_script('jquery-cc-authorizenet', plugin_dir_url(__FILE__) . 'js/cc.custom_auth.js', array('jquery'), '1.0', True);
    866786    wp_enqueue_style('authorizenet-css', plugin_dir_url(__FILE__) . 'css/style.css');
    867787}
    868788
    869 add_action('wp_enqueue_scripts', 'add_custom_js_auth');
     789add_action('wp_enqueue_scripts', 'wane_add_custom_js_auth');
    870790/* $Class1 = new WC_Authorizenet_Gateway; */
    871791$woo_authorize_settings = get_option('woocommerce_authorize_settings');
    872792if (!empty($woo_authorize_settings)) {
    873793    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'));
    875795    } else {
    876         remove_action('admin_notices', array('WC_Authorizenet_Gateway', 'sslerror_authorize'));
     796        remove_action('admin_notices', array('WC_Authorizenet_Gateway', 'wane_sslerror_authorize'));
    877797    }
    878798}
Note: See TracChangeset for help on using the changeset viewer.