Plugin Directory

Changeset 2212885


Ignore:
Timestamp:
12/16/2019 12:04:10 PM (6 years ago)
Author:
wp_estatic
Message:

Remove Depricated Funcations

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

Legend:

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

    r1954027 r2212885  
    1 === Woo Sage Pay Addon ===
     1=== Addon for sagepay and WooCommerce ===
    22Contributors: wp_estatic
    33Tags: woocommerce, Sage Pay, payment gateway, credit card, ecommerce, e-commerce, commerce, cart, checkout, Sage Pay addon,refund,credit cards payment Sage Pay and woocommerce, Sage Pay for woocommerce, Sage Pay payment gateway for woocommerce, Sage Pay payment in wordpress, Sage Pay payment refunds, Sage Pay plugin for woocommerce, Sage Pay woocommerce addon, free Sage Pay woocommerce plugin, woocommerce credit cards payment with Sage Pay, woocommerce plugin Sage Pay.
    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
     
    109109= 1.0.3 =
    110110* Fix - Payment method reduce issue
     111= 1.0.4 =
     112* Fix - Remove depricated funcations
    111113== Upgrade Notice ==
  • woo-sagepay-addon/trunk/woo-sagepay-addon.php

    r1954027 r2212885  
    22
    33/**
    4  * Plugin Name:         Woo sagepay Addon
    5  * Plugin URL:          Woo sagepay Addon
    6  * Description:         Woo sagepay Addon allows you to accept payments on your Woocommerce store. It accpets credit card payments and processes them securely with your merchant account.
    7  * Version:             1.0.3
     4 * Plugin Name:         Addon for sagepay and WooCommerce
     5 * Plugin URL:          Addon for sagepay and WooCommerce
     6 * Description:         Addon for sagepay and WooCommerce allows you to accept payments on your Woocommerce store. It accpets credit card payments and processes them securely with your merchant account.
     7 * Version:             1.0.4
    88 * WC requires at least:2.3
    9  * WC tested up to:     3.4.5
     9 * WC tested up to:     3.8.1
    1010 * Requires at least:   4.0+
    11  * Tested up to:        4.9.8
     11 * Tested up to:        5.3
    1212 * Contributors:        wp_estatic
    1313 * Author:              Estatic Infotech Pvt Ltd
     
    6969            $this->title = $this->get_option('title');
    7070            $this->method_description = sprintf(__('sagepay allows you to accept payments on your Woocommerce store. It accpets credit card payments and processes them securely with your merchant account.Please dont forget to test with sandbox account first. <li style="color: red;"><span id="message">Please Add Currency Which Is Provided By Your Sagepay Merchant Account</span></li> ', 'woocommerce'));
    71             //   $this->method_description = sprintf(__('test.', 'woocommerce'));
    7271
    7372            $this->description = $this->get_option('description');
     
    9190            add_action('woocommerce_order_status_completed_to_refunded', array($this, 'restore_order_stock'), 10, 1);
    9291            add_action('woocommerce_order_status_on-hold_to_refunded', array($this, 'restore_order_stock'), 10, 1);
    93             //     add_action('woocommerce_order_details_after_order_table', 'wdm_my_custom_notes_on_single_order_page', 10, 1);
    94             //  add_filter('woocommerce_credit_card_form_fields', array($this, 'sagepay_fields'), 10, 2);
    9592        }
    9693
     
    113110
    114111                foreach ($this->sagepay_cardtypes as $value) {
    115                     //   
     112                    //
    116113                    $new_cards_type .= '<option value="' . $value . '">' . $value . '</option>';
    117114                }
     
    126123                    <input id="' . esc_attr($payment_id) . '-card-name" class="input-text wc-credit-card-form-card-name" type="text" maxlength="20" autocomplete="off" placeholder="Name on Card" ' . $this->field_name('card-name') . ' />
    127124                </p>',
    128                         ), $args
     125                ), $args
    129126                );
    130127            }
     
    330327
    331328            $sagepay_args = array_merge(
    332                     array(
    333                         'PaReq' => WC()->session->get('set_pareq'),
    334                         'MD' => WC()->session->get('set_md'),
    335                         'TermUrl' => $this->notify_url
    336                     )
     329                array(
     330                    'PaReq' => WC()->session->get('set_pareq'),
     331                    'MD' => WC()->session->get('set_md'),
     332                    'TermUrl' => $this->notify_url
     333                )
    337334            );
    338335
     
    367364
    368365            $order = new WC_Order($order_id);
    369 
    370             //  $cardtype = $this->get_card_type(sanitize_text_field(str_replace(' ', '', $_POST['sagepay-card-number'])));
    371             /*
    372               if (!in_array($cardtype, $this->sagepay_cardtypes)) {
    373               wc_add_notice('Merchant do not accept/support payments using ' . ucwords($cardtype) . ' card', $notice_type = 'error');
    374               return array(
    375               'result' => 'success',
    376               'redirect' => WC()->cart->get_checkout_url(),
    377               );
    378               die;
    379               }
    380              *
    381              */
    382366
    383367            $credit_card = preg_replace('/(?<=\d)\s+(?=\d)/', '', trim(sanitize_text_field($_POST['sagepay-card-number'])));
     
    472456            $product_item['VPSTxID'] = //   $product_item['CreateToken'] = 1;
    473457
    474                     $post_values = "";
     458            $post_values = "";
    475459            foreach ($product_item as $key => $value) {
    476460                $post_values .= "$key=" . urlencode($value) . "&";
     
    568552                    }
    569553                }
    570 
    571                 if ($this->transtype == "DEFERRED") {
    572 
    573                     $body = '{' .
    574                             '"transactionType": "Deferred",' .
    575                             '"paymentMethod": {' .
    576                             '    "card": {' .
    577                             '        "merchantSessionKey": "' . $merchantSessionKey . '",' .
    578                             '        "cardIdentifier": "' . $cardIdentifier . '",' .
    579                             '        "save": "false",' .
    580                             '    }' .
    581                             '},' .
    582                             '"vendorTxCode": "demotransaction' . time() . '",' .
    583                             '"amount": 10000,' .
    584                             '"currency": "GBP",' .
    585                             '"description": "Demo transaction",' .
    586                             '"apply3DSecure": "UseMSPSetting",' .
    587                             '"customerFirstName": "Sam",' .
    588                             '"customerLastName": "Jones",' .
    589                             '"billingAddress": {' .
    590                             '    "address1": "407 St. John Street",' .
    591                             '    "city": "London",' .
    592                             '    "postalCode": "EC1V 4AB",' .
    593                             '    "country": "GB"' .
    594                             '},' .
    595                             '"entryMethod": "Ecommerce"' .
    596                             '}';
    597 
    598                     $args = array(
    599                         'body' => $body,
    600                         'method' => 'POST',
    601                         'headers' => array(
    602                             "Authorization: Basic ZGl2eWVzaDpkaXZ5ZXNoQDEyMw==",
    603                             "Cache-Control: no-cache",
    604                             "Content-Type: application/json"
    605                         )
    606                     );
    607 
    608                     $response = wp_remote_post('https://pi-test.sagepay.com/api/v1/transactions', $args);
    609                 }
    610554            } else {
    611555                wc_add_notice(__('Error. Please Contact Us.', 'woocommerce'), 'error');
     
    657601
    658602                if ($item['product_id'] > 0) {
    659                     $_product = $order->get_product_from_item($item);
    660 
    661                     if ($_product && $_product->exists() && $_product->managing_stock()) {
    662 
    663                         if ($this->mode == 'test') {
    664                             $refund__url = 'https://test.sagepay.com/gateway/service/refund.vsp';
    665                         } else if ($this->mode == 'live') {
    666                             $refund__url = 'https://live.sagepay.com/gateway/service/refund.vsp';
    667                         }
    668                         $url = $refund__url;
    669                         $params = array();
    670                         $params['VPSProtocol'] = urlencode('3.00');
    671                         $params['TxType'] = urlencode('REFUND');
    672                         $params['Vendor'] = urlencode('chestnutregistr');
    673                         $params['VendorTxCode'] = urlencode($generat);            //Sample value given by me
    674                         $params['Amount'] = urlencode($custom['_order_total'][$i]);
    675                         $params['Currency'] = urlencode($custom['_order_currency'][$i]);
    676                         $params['Description'] = urlencode('Testing Refunds');
    677                         $params['RelatedVPSTxId'] = urlencode($VPSTxId);     //VPSTxId of main transaction /* '210C00C7-8B04-CF68-6BE0-7AE59C18F5A8' */
    678                         $params['RelatedVendorTxCode'] = urlencode($custom['VendorTxCode'][$i]);         //VendorTxCode of main transaction
    679                         $params['RelatedSecurityKey'] = urlencode($custom['SecurityKey'][$i]);       //securitykey of main transaction
    680                         $params['RelatedTxAuthNo'] = urlencode($custom['TxAuthNo'][$i]);
    681 
    682                         $args = array(
    683                             'body' => $params,
    684                             'method' => 'POST',
    685                             'sslverify' => FALSE,
    686                             'timeout' => '5',
    687                             'headers' => array()
    688                         );
    689 
    690                         $response = wp_remote_post($url, $args);
    691 
    692                         if (strpos($response, 'INVALID') == false) {
    693                             $old_stock = $_product->stock;
    694 
    695                             $qty = apply_filters('woocommerce_order_item_quantity', $item['qty'], $this, $item);
    696 
    697                             $new_quantity = $_product->increase_stock($qty);
    698 
    699                             do_action('woocommerce_auto_stock_restored', $_product, $item);
    700 
    701                             $order->add_order_note(__('Item stock incremented from ' . $old_stock . ' to ' . $new_quantity . ' product id ' . $item['product_id'], 'woocommerce'), $item['product_id'], $old_stock, $new_quantity);
    702 
    703                             $order->send_stock_notifications($_product, $new_quantity, $item['qty']);
    704                         }
     603
     604                    if ($this->mode == 'test') {
     605                        $refund__url = 'https://test.sagepay.com/gateway/service/refund.vsp';
     606                    } else if ($this->mode == 'live') {
     607                        $refund__url = 'https://live.sagepay.com/gateway/service/refund.vsp';
    705608                    }
     609                    $url = $refund__url;
     610                    $params = array();
     611                    $params['VPSProtocol'] = urlencode('3.00');
     612                    $params['TxType'] = urlencode('REFUND');
     613                    $params['Vendor'] = urlencode('chestnutregistr');
     614                    $params['VendorTxCode'] = urlencode($generat);            //Sample value given by me
     615                    $params['Amount'] = urlencode($custom['_order_total'][$i]);
     616                    $params['Currency'] = urlencode($custom['_order_currency'][$i]);
     617                    $params['Description'] = urlencode('Testing Refunds');
     618                    $params['RelatedVPSTxId'] = urlencode($VPSTxId);     //VPSTxId of main transaction /* '210C00C7-8B04-CF68-6BE0-7AE59C18F5A8' */
     619                    $params['RelatedVendorTxCode'] = urlencode($custom['VendorTxCode'][$i]);         //VendorTxCode of main transaction
     620                    $params['RelatedSecurityKey'] = urlencode($custom['SecurityKey'][$i]);       //securitykey of main transaction
     621                    $params['RelatedTxAuthNo'] = urlencode($custom['TxAuthNo'][$i]);
     622
     623                    $args = array(
     624                        'body' => $params,
     625                        'method' => 'POST',
     626                        'sslverify' => FALSE,
     627                        'timeout' => '5',
     628                        'headers' => array()
     629                    );
     630
     631                    $response = wp_remote_post($url, $args);
     632
     633                    if (strpos($response, 'INVALID') == false) {
     634
     635                        // $qty = apply_filters('woocommerce_order_item_quantity', $item['qty'], $this, $item);
     636
     637                        //  $new_quantity = $_product->increase_stock($qty);
     638
     639                        //do_action('woocommerce_auto_stock_restored', $_product, $item);
     640
     641                        // $order->add_order_note(__('Item stock incremented from ' . $old_stock . ' to ' . $new_quantity . ' product id ' . $item['product_id'], 'woocommerce'), $item['product_id'], $old_stock, $new_quantity);
     642
     643                        // $order->send_stock_notifications($_product, $new_quantity, $item['qty']);
     644                    }
     645
    706646                }
    707647                $i++;
Note: See TracChangeset for help on using the changeset viewer.