Plugin Directory

Changeset 3245713


Ignore:
Timestamp:
02/24/2025 11:59:07 AM (13 months ago)
Author:
ecommpay
Message:

new version 4.0.4

Location:
ecommpay-payments/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ecommpay-payments/trunk/common/EcpCore.php

    r3239955 r3245713  
    6363     * @since 2.0.0
    6464     */
    65     public const WC_ECP_VERSION = '4.0.3';
     65    public const WC_ECP_VERSION = '4.0.4';
    6666
    6767    public const ECOMMPAY_PAYMENT_METHOD = 'ecommpay';
     
    167167    public static function get_instance(): ?EcpCore {
    168168        if ( ! self::$instance ) {
    169             self::$instance = new EcpCore();
     169            self::$instance = new static();
    170170        }
    171171
  • ecommpay-payments/trunk/common/includes/filters/EcpWCFilterList.php

    r3218798 r3245713  
    1010    public const WOOCOMMERCE_ECOMMPAY_CAN_USER_FLUSH_CACHE = 'woocommerce_ecommpay_can_user_flush_cache';
    1111    public const WOOCOMMERCE_UPDATE_OPTIONS_PAYMENT_GATEWAYS = 'woocommerce_update_options_payment_gateways_';
    12     public const BEFORE_WOOCOMMERCE_PAY = 'before_woocommerce_pay';
    1312    public const WOOCOMMERCE_ECOMMPAY_CALLBACK_URL = 'woocommerce_ecommpay_callback_url';
    1413    public const WOOCOMMERCE_BLOCKS_ENQUEUE_CHECKOUT_BLOCK_SCRIPTS_BEFORE = 'woocommerce_blocks_enqueue_checkout_block_scripts_before';
    15     public const WOOCOMMERCE_BEFORE_CHECKOUT_FORM = 'woocommerce_before_checkout_form';
    1614    public const WOOCOMMERCE_ECOMMPAY_CALLBACK_ARGS = 'woocommerce_ecommpay_callback_args';
    1715    public const WOOCOMMERCE_ORDER_CLASS = 'woocommerce_order_class';
  • ecommpay-payments/trunk/common/modules/EcpModulePaymentPage.php

    r3227972 r3245713  
    281281        $cart_amount  = ecp_price_multiply( WC()->cart->total, get_woocommerce_currency() );
    282282        wp_send_json( [ 'amount_is_equal' => ( $query_amount === $cart_amount ) ] );
    283     }
    284 
    285     /**
    286      * <h2>Injects scripts and styles into the site.</h2>
    287      *
    288      * @return void
    289      * @since 2.0.0
    290      */
    291     public function include_frontend_scripts(): void {
    292         global $wp;
    293 
    294         try {
    295             if ( isset ( $wp->query_vars['order-pay'] ) && absint( $wp->query_vars['order-pay'] ) > 0 ) {
    296                 $order_id = absint( $wp->query_vars['order-pay'] ); // The order ID
    297             } else {
    298                 $order_id = is_wc_endpoint_url( 'order-pay' );
    299             }
    300         } catch ( Exception $e ) {
    301             $order_id = 0;
    302         }
    303 
    304         $url = ecp_payment_page()->get_url();
    305 
    306         // Ecommpay merchant bundle.
    307         wp_enqueue_script(
    308             'ecommpay_merchant_js',
    309             sprintf( '%s/shared/merchant.js', $url ),
    310             [],
    311             null
    312         );
    313         wp_enqueue_style(
    314             'ecommpay_merchant_css',
    315             sprintf( '%s/shared/merchant.css', $url ),
    316             [],
    317             null
    318         );
    319 
    320         // Woocommerce Ecommpay Plugin frontend
    321         wp_enqueue_script(
    322             'ecommpay_checkout_script',
    323             ecp_js_url( 'checkout.js' ),
    324             [ 'jquery' ],
    325             ecp_version()
    326         );
    327         wp_enqueue_script(
    328             'ecommpay_frontend_helpers_script',
    329             ecp_js_url( 'frontend-helpers.js' ),
    330             [ 'jquery' ],
    331             ecp_version()
    332         );
    333 
    334         wp_localize_script(
    335             'ecommpay_checkout_script',
    336             'ECP',
    337             [
    338                 'ajax_url'   => admin_url( "admin-ajax.php" ),
    339                 'origin_url' => $url,
    340                 'order_id'   => $order_id,
    341             ]
    342         );
    343 
    344         wp_enqueue_style( 'ecommpay_loader_css', ecp_css_url( 'loader.css' ) );
    345283    }
    346284
     
    586524        ] ); // Non-authorised user: Guest access
    587525
    588         // register hooks for display payment form on checkout page
    589         add_action( EcpWCFilterList::WOOCOMMERCE_BEFORE_CHECKOUT_FORM, [ $this, 'include_frontend_scripts' ] );
    590 
    591         // register hooks for display payment form on payment page
    592         add_action( EcpWCFilterList::BEFORE_WOOCOMMERCE_PAY, [ $this, 'include_frontend_scripts' ] );
    593526
    594527        // register hooks for display payment form on block-based checkout page
  • ecommpay-payments/trunk/gateway-ecommpay.php

    r3239955 r3245713  
    55 * GitHub Plugin URI:
    66 * Description:       Easy payment from WooCommerce by different methods in single Payment Page.
    7  * Version:           4.0.3
     7 * Version:           4.0.4
    88 * License:           GPL2
    99 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    8383            'wp_enqueue_scripts',
    8484            function () {
     85                global $wp;
     86
    8587                wp_enqueue_style(
    8688                    'woocommerce-ecommpay-frontend-style',
     
    8991                    ecp_version()
    9092                );
     93
     94                $is_checkout_scripts_needed = is_checkout() || is_wc_endpoint_url( 'order-pay' );
     95
     96                if ( $is_checkout_scripts_needed ) {
     97
     98                    $url = ecp_payment_page()->get_url();
     99
     100                    // Ecommpay merchant bundle.
     101                    wp_enqueue_script(
     102                        'ecommpay_merchant_js',
     103                        sprintf( '%s/shared/merchant.js', $url ),
     104                        [],
     105                        null
     106                    );
     107                    wp_enqueue_style(
     108                        'ecommpay_merchant_css',
     109                        sprintf( '%s/shared/merchant.css', $url ),
     110                        [],
     111                        null
     112                    );
     113                    wp_enqueue_script(
     114                        'ecommpay_checkout_script',
     115                        ecp_js_url( 'checkout.js' ),
     116                        [ 'jquery' ],
     117                        ecp_version()
     118                    );
     119
     120                    try {
     121                        if ( absint( $wp->query_vars['order-pay'] ?? 0) > 0 ) {
     122                            $order_id = absint( $wp->query_vars['order-pay'] ); // The order ID
     123                        } else {
     124                            $order_id = is_wc_endpoint_url( 'order-pay' );
     125                        }
     126                    } catch ( Exception $e ) {
     127                        $order_id = 0;
     128                    }
     129
     130                    // Woocommerce Ecommpay Plugin frontend
     131                    wp_enqueue_script(
     132                        'ecommpay_frontend_helpers_script',
     133                        ecp_js_url( 'frontend-helpers.js' ),
     134                        [ 'jquery' ],
     135                        ecp_version()
     136                    );
     137
     138                    wp_localize_script(
     139                        'ecommpay_checkout_script',
     140                        'ECP',
     141                        [
     142                            'ajax_url'   => admin_url( "admin-ajax.php" ),
     143                            'origin_url' => $url,
     144                            'order_id'   => $order_id,
     145                        ]
     146                    );
     147
     148                    wp_enqueue_style( 'ecommpay_loader_css', ecp_css_url( 'loader.css' ) );
     149                }
    91150            }
    92151        );
  • ecommpay-payments/trunk/readme.txt

    r3239955 r3245713  
    44Requires at least: 6.2
    55Tested up to: 6.7
    6 Stable tag: 4.0.3
     6Stable tag: 4.0.4
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.