Changeset 2212885
- Timestamp:
- 12/16/2019 12:04:10 PM (6 years ago)
- Location:
- woo-sagepay-addon/trunk
- Files:
-
- 2 edited
-
README.txt (modified) (2 diffs)
-
woo-sagepay-addon.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-sagepay-addon/trunk/README.txt
r1954027 r2212885 1 === Woo Sage Pay Addon===1 === Addon for sagepay and WooCommerce === 2 2 Contributors: wp_estatic 3 3 Tags: 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. 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 … … 109 109 = 1.0.3 = 110 110 * Fix - Payment method reduce issue 111 = 1.0.4 = 112 * Fix - Remove depricated funcations 111 113 == Upgrade Notice == -
woo-sagepay-addon/trunk/woo-sagepay-addon.php
r1954027 r2212885 2 2 3 3 /** 4 * Plugin Name: Woo sagepay Addon5 * Plugin URL: Woo sagepay Addon6 * Description: Woo sagepay Addonallows 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. 34 * 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 8 8 * WC requires at least:2.3 9 * WC tested up to: 3. 4.59 * WC tested up to: 3.8.1 10 10 * Requires at least: 4.0+ 11 * Tested up to: 4.9.811 * Tested up to: 5.3 12 12 * Contributors: wp_estatic 13 13 * Author: Estatic Infotech Pvt Ltd … … 69 69 $this->title = $this->get_option('title'); 70 70 $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'));72 71 73 72 $this->description = $this->get_option('description'); … … 91 90 add_action('woocommerce_order_status_completed_to_refunded', array($this, 'restore_order_stock'), 10, 1); 92 91 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);95 92 } 96 93 … … 113 110 114 111 foreach ($this->sagepay_cardtypes as $value) { 115 // 112 // 116 113 $new_cards_type .= '<option value="' . $value . '">' . $value . '</option>'; 117 114 } … … 126 123 <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') . ' /> 127 124 </p>', 128 ), $args125 ), $args 129 126 ); 130 127 } … … 330 327 331 328 $sagepay_args = array_merge( 332 array(333 'PaReq' => WC()->session->get('set_pareq'),334 'MD' => WC()->session->get('set_md'),335 'TermUrl' => $this->notify_url336 )329 array( 330 'PaReq' => WC()->session->get('set_pareq'), 331 'MD' => WC()->session->get('set_md'), 332 'TermUrl' => $this->notify_url 333 ) 337 334 ); 338 335 … … 367 364 368 365 $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 */382 366 383 367 $credit_card = preg_replace('/(?<=\d)\s+(?=\d)/', '', trim(sanitize_text_field($_POST['sagepay-card-number']))); … … 472 456 $product_item['VPSTxID'] = // $product_item['CreateToken'] = 1; 473 457 474 $post_values = "";458 $post_values = ""; 475 459 foreach ($product_item as $key => $value) { 476 460 $post_values .= "$key=" . urlencode($value) . "&"; … … 568 552 } 569 553 } 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 }610 554 } else { 611 555 wc_add_notice(__('Error. Please Contact Us.', 'woocommerce'), 'error'); … … 657 601 658 602 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'; 705 608 } 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 706 646 } 707 647 $i++;
Note: See TracChangeset
for help on using the changeset viewer.