Plugin Directory

Changeset 2938292


Ignore:
Timestamp:
07/13/2023 02:38:51 PM (3 years ago)
Author:
integrationdevpaytm
Message:

Added HPOS feature

Location:
paytm-payments/trunk
Files:
12 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • paytm-payments/trunk/class.paytm.php

    r2904623 r2938292  
    2020        if ($invertLogo == 1) {
    2121            $this->icon= esc_url("https://staticpg.paytm.in/pg_plugins_logo/paytm_logo_invert.svg");
    22         } else {
     22        }
     23        else {
    2324            $this->icon= esc_url("https://staticpg.paytm.in/pg_plugins_logo/paytm_logo_paymodes.svg");
    2425        }
     
    266267        // Transaction URL is not working properly or not able to communicate with paytm
    267268        if (!empty(PaytmHelper::getPaytmURL(PaytmConstants::ORDER_STATUS_URL, $this->getSetting('environment')))) {
     269            //wp_remote_get($url, array('sslverify' => FALSE));
     270
    268271            $response = (array)wp_remote_get(PaytmHelper::getPaytmURL(PaytmConstants::ORDER_STATUS_URL, $this->getSetting('environment')));
    269272            if (!empty($response['errors'])) {
  • paytm-payments/trunk/includes/PaytmConstants.php

    r2904648 r2938292  
    2424    CONST TIMEOUT= 10;
    2525
    26     CONST LAST_UPDATED= "20230426";
    27     CONST PLUGIN_VERSION= "2.7.9";
    28     CONST PLUGIN_VERSION_FOLDER= "279";
     26    CONST LAST_UPDATED= "20230713";
     27    CONST PLUGIN_VERSION= "2.8.0";
     28    CONST PLUGIN_VERSION_FOLDER= "280";
    2929
    3030    CONST CUSTOM_CALLBACK_URL= "";
  • paytm-payments/trunk/includes/PaytmHelper.php

    r2904623 r2938292  
    6464                $ch = curl_init(trim($transaction_status_url));
    6565                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     66                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     67
    6668                $res = curl_exec($ch);
    6769                curl_close($ch);
     
    106108                'headers' => $headers,
    107109                'body'      => json_encode($requestParamList, JSON_UNESCAPED_SLASHES),
    108                 'method'    => $method
     110                'method'    => $method,
    109111            );
    110112
  • paytm-payments/trunk/readme.txt

    r2904623 r2938292  
    22Contributors: integrationdevpaytm
    33Tags: Paytm, Paytm Payments, PayWithPaytm, Paytm WooCommerce, Paytm Plugin, Paytm Payment Gateway
    4 Requires PHP: 5.6
     4Requires PHP: 7.4
    55Requires at least: 4.0.1
    66Tested up to: 6.2
    7 Stable tag: 2.7.9
     7Stable tag: 2.8.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1717* Wordpress v3.9.2 or higher
    1818* Woocommerce v2.4 or higher
    19 * PHP v5.6.0 or higher
     19* PHP v7.4.0 or higher
    2020* Php-curl
    2121
     
    100100== Changelog ==
    101101
     102= 2.8.0 =
     103* Compatible and tested with WooCommerce version up to 7.8.2.
     104* Supports HPOS WooCommerce feature.
     105* Enhanced security with updates.
     106
    102107= 2.7.9 =
    103108* Compatible and tested with Woocommerce version upto 7.5.1
    104 * Optimize JS and CSS
     109* Optimized JS and CSS
    105110* Updated Security
    106111
  • paytm-payments/trunk/woo-paytm.php

    r2904623 r2938292  
    44 * Plugin URI: https://github.com/Paytm/
    55 * Description: This plugin allow you to accept payments using Paytm. This plugin will add a Paytm Payment option on WooCommerce checkout page, when user choses Paytm as Payment Method, he will redirected to Paytm website to complete his transaction and on completion his payment, paytm will send that user back to your website along with transactions details. This plugin uses server-to-server verification to add additional security layer for validating transactions. Admin can also see payment status for orders by navigating to WooCommerce > Orders from menu in admin.
    6  * Version: 2.7.9
     6 * Version: 2.8.0
    77 * Author: Paytm
    88 * Author URI: https://business.paytm.com/payment-gateway
     
    1010 * Requires at least: 4.0.1
    1111 * Tested up to: 6.2
    12  * Requires PHP: 5.6
     12 * Requires PHP: 7.4
    1313 * Text Domain: Paytm Payments
    1414 * WC requires at least: 2.0.0
    15  * WC tested up to: 7.5.1
     15 * WC tested up to: 7.8.2
    1616 */
    1717
     
    2525}
    2626
     27
     28use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
     29
     30
    2731require_once __DIR__.'/includes/PaytmHelper.php';
    2832require_once __DIR__.'/includes/PaytmChecksum.php';
    2933
     34
     35add_action( 'before_woocommerce_init', function() {
     36    if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     37        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     38        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'product_block_editor', __FILE__, true );
     39    }
     40} );
     41
    3042add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'woocommerce_paytm_add_action_links');
     43
    3144function woocommerce_paytm_add_action_links( $links )
    3245{
     
    6881    global $wpdb;
    6982    $table_name = $wpdb->prefix . 'paytm_order_data';
    70     $sql = "DROP TABLE IF EXISTS $table_name";
    71     $wpdb->query($sql);
     83    $query = "SELECT * FROM $table_name";
     84    $results = $wpdb->get_results($query);
     85    if(count($results) <= 0 ){
     86        $sql = "DROP TABLE IF EXISTS $table_name";
     87        $wpdb->query($sql);
     88    }
    7289    delete_option('woocommerce_paytm_settings');
    7390}
     
    88105add_action( 'wp_enqueue_scripts', 'paytmWoopayment_js_css' );
    89106
    90 
    91107if (PaytmConstants::SAVE_PAYTM_RESPONSE) {
     108 
    92109    // Add a paytm payments box only for shop_order post type (order edit pages)
    93110    add_action('add_meta_boxes', 'add_paytm_payment_block');
     111
     112    //Function changes for woocommerce HPOS features
    94113    function add_paytm_payment_block()
    95114    {
     115
    96116        global $wpdb;
    97117        $settings = get_option("woocommerce_paytm_settings");
    98         $post_id1 = sanitize_text_field($_GET['post']);
     118        $post_id1 = sanitize_text_field(isset($_GET['post']) ? $_GET['post'] : '');
    99119        $post_id = preg_replace('/[^a-zA-Z0-9]/', '', $post_id1);
     120
     121
     122        if ($post_id == '' && get_option("woocommerce_custom_orders_table_enabled") == 'yes') {
     123            $post_id = isset($_GET['id']) ? $_GET['id'] : '';
     124        }
     125
    100126        if(! $post_id ) return; // Exit
    101 
     127        $screen = wc_get_container()->get( CustomOrdersTableController::class )->custom_orders_table_usage_is_enabled()
     128        ? wc_get_page_screen_id( 'shop-order' )
     129        : 'shop_order';
    102130        $results = getPaytmOrderData($post_id);
     131
    103132        // paytm enabled and order is exists with paym_order_data
    104133        if ($settings['enabled'] == 'yes' && !empty($results)) {
    105             add_meta_box('_paytm_response_table', __('Paytm Payments'), '_paytm_response_table', 'shop_order', 'normal', 'default', array('results' => $results
     134            add_meta_box('_paytm_response_table', __('Paytm Payments'), '_paytm_response_table', $screen, 'normal', 'default', array('results' => $results
    106135                )
    107136            );
     
    110139
    111140    function _paytm_response_table($post = array(),$data = array())
    112     {
     141    { 
    113142        //Echoing HTML safely start
    114143        global $allowedposttags;
     
    195224        }
    196225        $table_html .= '</div>';
     226        echo $table_html;die;
    197227
    198228        echo wp_kses($table_html, $allowedposttags);
    199229    }
     230
     231
    200232    function getPaytmOrderData($order_id)
    201233    {
     
    203235        $sql = "SELECT * FROM `".$wpdb->prefix ."paytm_order_data` WHERE `order_id` = '".$order_id."' ORDER BY `id` DESC LIMIT 1";
    204236        return $wpdb->get_row($sql, "ARRAY_A");
     237    }
     238
     239    function get_custom_order($order_id) {
     240        global $wpdb;
     241        $table_name = $wpdb->prefix . 'wc_orders';
     242
     243        $order = $wpdb->get_row(
     244            $wpdb->prepare(
     245                "SELECT * FROM $table_name WHERE id = %d",
     246                $order_id
     247            ),
     248            ARRAY_A
     249        );
     250
     251        if ($order) {
     252            $order_data = maybe_unserialize($order['order_data']);
     253
     254            // Additional processing if needed
     255
     256            return $order_data;
     257        }
     258
     259        return null;
    205260    }
    206261
     
    324379        require_once(plugin_basename('class.paytm.php'));
    325380
     381
    326382        add_filter('woocommerce_payment_gateways', 'woocommerce_add_paytm_gateway' );
    327383        function woocommerce_add_paytm_gateway($methods)
Note: See TracChangeset for help on using the changeset viewer.