Plugin Directory

Changeset 3282256


Ignore:
Timestamp:
04/26/2025 06:10:58 AM (11 months ago)
Author:
razorpay
Message:

Update: 4.7.3

Location:
woo-razorpay/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • woo-razorpay/trunk/includes/razorpay-webhook.php

    r3269687 r3282256  
    1111class RZP_Webhook
    1212{
    13     /**
    14      * @var HTTP CONFLICT Request
    15      */
    16     const HTTP_CONFLICT_STATUS = 409;
    17 
    18     /**
    19      * @var Webhook Notify Wait Time
    20      */
    21     const WEBHOOK_NOTIFY_WAIT_TIME = (5 * 60);
    22 
    2313    /**
    2414     * Instance of the razorpay payments class
     
    148138                    rzpLogError(json_encode($log));
    149139
    150                     error_log(json_encode($log));
    151140                    return;
    152141                }
     
    210199            $integration = "woocommerce";
    211200
    212             $webhookEvents = $wpdb->get_results("SELECT rzp_webhook_data FROM $tableName where order_id=" . $data['woocommerce_order_number'] . "rzp_order_id=" . $rzpOrderId . ";");
     201            $webhookEvents = $wpdb->get_results("SELECT rzp_webhook_data FROM $tableName where order_id=" . $data['woocommerce_order_number'] . " AND rzp_order_id='" . $rzpOrderId . "';");
    213202
    214203            $rzpWebhookData = (array) json_decode($webhookEvents['rzp_webhook_data']);
     
    290279        // We don't process subscription/invoice payments here
    291280        if (isset($data['invoice_id']) === true) {
     281            rzpLogInfo("We don't process subscription/invoice payments here");
    292282            return;
    293283        }
     
    302292        if (!empty($orderId)) {
    303293            $order = $this->checkIsObject($orderId);
     294
     295            if ($order === false)
     296            {
     297                return;
     298            }
    304299        }
    305300
     
    323318
    324319        $payment = $this->getPaymentEntity($razorpayPaymentId, $data);
     320
     321        if ($payment === false)
     322        {
     323            return;
     324        }
    325325
    326326        $amount = $this->getOrderAmountAsInteger($order);
     
    352352                );
    353353
    354                 error_log(json_encode($log));
     354                rzpLogError(json_encode($log));
    355355
    356356                //
     
    358358                //
    359359                $payment = $this->getPaymentEntity($razorpayPaymentId, $data);
     360
     361                if ($payment === false)
     362                {
     363                    return;
     364                }
    360365
    361366                if ($payment['status'] === 'captured') {
     
    395400        if (!empty($orderId)) {
    396401            $order = $this->checkIsObject($orderId);
     402
     403            if ($order === false)
     404            {
     405                return;
     406            }
    397407        }
    398408
     
    415425        $payment = $this->getPaymentEntity($razorpayPaymentId, $data);
    416426
     427        if ($payment === false)
     428        {
     429            return;
     430        }
     431
    417432        $success      = false;
    418433        $errorMessage = 'The payment has failed.';
     
    448463        if (!empty($orderId)) {
    449464            $order = $this->checkIsObject($orderId);
     465
     466            if ($order === false)
     467            {
     468                return;
     469            }
    450470        }
    451471        // If it is already marked as paid, ignore the event
     
    459479
    460480        $payment = $this->getPaymentEntity($razorpayPaymentId, $data);
     481
     482        if ($payment === false)
     483        {
     484            return;
     485        }
    461486
    462487        $amount = $this->getOrderAmountAsInteger($order);
     
    495520                $payment = $this->getPaymentEntity($razorpayPaymentId, $data);
    496521
     522                if ($payment === false)
     523                {
     524                    return;
     525                }
     526
    497527                if ($payment['status'] === 'captured') {
    498528                    $success = true;
     
    519549            );
    520550
    521             error_log(json_encode($log));
    522 
    523             exit;
     551            rzpLogError(json_encode($log));
     552
     553            return false;
    524554        }
    525555
     
    579609        $payment = $this->getPaymentEntity($razorpayPaymentId, $data);
    580610
     611        if ($payment === false)
     612        {
     613            return;
     614        }
     615
    581616        //
    582617        // Order entity should be sent as part of the webhook payload
     
    586621        if (!empty($orderId)) {
    587622            $order = $this->checkIsObject($orderId);
     623
     624            if ($order === false)
     625            {
     626                return;
     627            }
    588628        }
    589629
     
    652692        } else {
    653693            rzpLogInfo("Woocommerce order Object does not exist");
    654             exit();
     694            return false;
    655695        }
    656696    }
  • woo-razorpay/trunk/readme.txt

    r3269687 r3282256  
    33Tags: razorpay, payments, india, woocommerce, curlec, malaysia, ecommerce, international, cross border
    44Requires at least: 3.9.2
    5 Tested up to: 6.7
    6 Stable tag: 4.7.2
     5Tested up to: 6.8
     6Stable tag: 4.7.3
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    6969
    7070== Changelog ==
     71
     72= 4.7.3 =
     73* Enhanced webhook cron.
    7174
    7275= 4.7.2 =
  • woo-razorpay/trunk/woo-razorpay.php

    r3269687 r3282256  
    44 * Plugin URI: https://razorpay.com
    55 * Description: Razorpay Payment Gateway Integration for WooCommerce.Razorpay Welcome Back Offer: New to Razorpay? Sign up to enjoy FREE payments* of INR 2 lakh till March 31st! Transact before January 10th to grab the offer.
    6  * Version: 4.7.2
    7  * Stable tag: 4.7.2
     6 * Version: 4.7.3
     7 * Stable tag: 4.7.3
    88 * Author: Team Razorpay
    99 * WC tested up to: 9.1.2
     
    30953095
    30963096    /**
     3097     * Create cron with 5 min interval
     3098     **/
     3099    if (!wp_next_scheduled('rzp_webhook_exec_cron'))
     3100    {
     3101        wp_schedule_event(time(), 'rzp_webhook_cron_interval', 'rzp_webhook_exec_cron');
     3102        rzpLogInfo("rzp_webhook_exec_cron cron created");
     3103    }
     3104
     3105    /**
    30973106     * Webhook Cron to execute events
    30983107     **/
     
    31593168    $rzpWebhookSetup = get_option('rzp_webhook_setup');
    31603169
    3161     if (empty($rzpWebhookSetup) === true)
     3170    if (($rzpWebhookSetup === 'yes') === false)
    31623171    {
    31633172        try
     
    31653174            // create table to save triggered webhook events
    31663175            global $wpdb;
    3167 
    3168             $sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}rzp_webhook_requests` (
     3176            $tableName = $wpdb->prefix . 'rzp_webhook_requests';
     3177
     3178            $sql = "CREATE TABLE IF NOT EXISTS $tableName (
    31693179                `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    31703180                `integration` varchar(25) NOT NULL,
     
    31763186                PRIMARY KEY (`id`)) " . $wpdb->get_charset_collate() . ";";
    31773187
    3178             // create cron with 5 min interval
    3179             if (wp_next_scheduled('rzp_webhook_exec_cron') === false)
    3180             {
    3181                 wp_schedule_event(time(), 'rzp_webhook_cron_interval', 'rzp_webhook_exec_cron');
    3182             }
    3183 
    3184             if ((empty(dbDelta($sql)) === false) and
    3185                 (empty(wp_next_scheduled('rzp_webhook_exec_cron')) === false))
    3186             {
    3187                 update_option('rzp_webhook_setup', true);
     3188            dbDelta($sql);
     3189
     3190            if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'" ) === $tableName)
     3191            {
     3192                update_option('rzp_webhook_setup', 'yes');
     3193                rzpLogInfo("Webhook table Created.");
    31883194            }
    31893195        }
    31903196        catch (Exception $e)
    31913197        {
    3192             rzpLogInfo("Webhook table/cron creation failed: ". $e->getMessage());
     3198            rzpLogInfo("Webhook table creation failed: ". $e->getMessage());
    31933199            delete_option('rzp_webhook_setup');
    31943200        }
Note: See TracChangeset for help on using the changeset viewer.