Plugin Directory

Changeset 3116324


Ignore:
Timestamp:
07/11/2024 10:59:04 AM (21 months ago)
Author:
payhere
Message:

Fixed the issue with the text message when redirecting to the order-received page while the payment is pending.

Location:
payhere-payment-gateway/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • payhere-payment-gateway/trunk/gateway/class-wcgatewaypayhere.php

    r3111559 r3116324  
    192192        add_action('woocommerce_thankyou', array(&$this, 'remove_order_from_thankyou'), 10, 1);
    193193
     194        add_filter('woocommerce_thankyou_order_received_text', array($this, 'change_woo_order_received_text'), 10, 2);
    194195    }
    195196
     
    219220    public function generate_image_selection_html($key, $data)
    220221    {
    221         return $this->gateway_utilities->generate_image_selection_html($key,$data);
     222        return $this->gateway_utilities->generate_image_selection_html($key, $data);
    222223    }
    223224
     
    714715
    715716        $order_id = sanitize_text_field(wp_unslash($_order_id));
    716        
     717
    717718        if (empty($order_id)) {
    718719            $this->gateway_utilities->payhere_log('PAYHERE_RESPONSE', 'Order id Not Found after sanitize');
     
    894895        exit();
    895896    }
     897
     898    /**
     899     * Modify the WooCommerce order received page title for payment peding orders
     900     *
     901     * @param array $title Current title.
     902     * @param int   $id WC Order id.
     903     * @return Array retuns the apprpriate title for the order status.
     904     */
     905    public function change_woo_order_received_text($title, $order)
     906    {
     907        if (is_order_received_page()) {
     908            global $wp;
     909
     910            // There will be no nounce when the request is send.
     911            // phpcs:ignore
     912            $key = empty($_GET['key']) ? '' : wc_clean($_GET['key']);
     913
     914            $order_id  = apply_filters('woocommerce_thankyou_order_id', absint($wp->query_vars['order-received']));
     915            $order_key = apply_filters('woocommerce_thankyou_order_key', $key);
     916
     917
     918            if ($order_id > 0) {
     919                $order = wc_get_order($order_id);
     920                if ($order->get_order_key() !== $order_key) {
     921                    $order = false;
     922                }
     923            }
     924
     925            if (isset($order) && $order->get_payment_method() === $this->id) {
     926
     927                if (($order->get_status() === 'pending')) {
     928                    $title = 'Payment was not completed. Please try your purchase again.';
     929                }
     930            }
     931        }
     932
     933        return $title;
     934    }
    896935}
  • payhere-payment-gateway/trunk/payhere-payment-gateway.php

    r3111559 r3116324  
    88 * Plugin URI:        https://www.payhere.lk
    99 * Description:       PayHere Payment Gateway allows you to accept payment on your Woocommerce store via Visa, MasterCard, AMEX, eZcash, mCash & Internet banking services.
    10  * Version:           2.3.4
     10 * Version:           2.3.5
    1111 * Author:            PayHere (Private) Limited
    1212 * Author URI:        https://www.payhere.lk
     
    2626 * Start at version 2.0.0 and use SemVer - https://semver.org
    2727 */
    28 define('PAYHERE_VERSION', '2.3.4');
     28define('PAYHERE_VERSION', '2.3.5');
    2929/**
    3030 * Currently plugin text domain.
     
    5858/**
    5959 * Add function to remove old transaction logs.
    60  * This will remove in 2.3.4 update.
     60 * This will remove in 2.3.5 update.
    6161 */
    6262function payhere_check_upgrade()
  • payhere-payment-gateway/trunk/readme.txt

    r3111559 r3116324  
    33Donate link: https://www.payhere.lk
    44Tags: payhere, online, payments, sri lanka
    5 Requires at least: 6.4.0
     5Requires at least: 6.4
    66Tested up to: 6.5.5
    77WC tested up to: 9.0.0
    8 Stable tag: 2.3.4
     8Stable tag: 2.3.5
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    160160= 2.3.4 =
    161161Enabled support for changing the gateway icon, resolved the issues with WordPress Blocks, and fixed the gateway viewing issue.
     162
     163= 2.3.5 =
     164Fixed the issue with the text message when redirecting to the order-received page while the payment is pending.
    162165
    163166== Upgrade Notice ==
Note: See TracChangeset for help on using the changeset viewer.