Changeset 3245713
- Timestamp:
- 02/24/2025 11:59:07 AM (13 months ago)
- Location:
- ecommpay-payments/trunk
- Files:
-
- 5 edited
-
common/EcpCore.php (modified) (2 diffs)
-
common/includes/filters/EcpWCFilterList.php (modified) (1 diff)
-
common/modules/EcpModulePaymentPage.php (modified) (2 diffs)
-
gateway-ecommpay.php (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ecommpay-payments/trunk/common/EcpCore.php
r3239955 r3245713 63 63 * @since 2.0.0 64 64 */ 65 public const WC_ECP_VERSION = '4.0. 3';65 public const WC_ECP_VERSION = '4.0.4'; 66 66 67 67 public const ECOMMPAY_PAYMENT_METHOD = 'ecommpay'; … … 167 167 public static function get_instance(): ?EcpCore { 168 168 if ( ! self::$instance ) { 169 self::$instance = new EcpCore();169 self::$instance = new static(); 170 170 } 171 171 -
ecommpay-payments/trunk/common/includes/filters/EcpWCFilterList.php
r3218798 r3245713 10 10 public const WOOCOMMERCE_ECOMMPAY_CAN_USER_FLUSH_CACHE = 'woocommerce_ecommpay_can_user_flush_cache'; 11 11 public const WOOCOMMERCE_UPDATE_OPTIONS_PAYMENT_GATEWAYS = 'woocommerce_update_options_payment_gateways_'; 12 public const BEFORE_WOOCOMMERCE_PAY = 'before_woocommerce_pay';13 12 public const WOOCOMMERCE_ECOMMPAY_CALLBACK_URL = 'woocommerce_ecommpay_callback_url'; 14 13 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';16 14 public const WOOCOMMERCE_ECOMMPAY_CALLBACK_ARGS = 'woocommerce_ecommpay_callback_args'; 17 15 public const WOOCOMMERCE_ORDER_CLASS = 'woocommerce_order_class'; -
ecommpay-payments/trunk/common/modules/EcpModulePaymentPage.php
r3227972 r3245713 281 281 $cart_amount = ecp_price_multiply( WC()->cart->total, get_woocommerce_currency() ); 282 282 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 void289 * @since 2.0.0290 */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 ID297 } 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 null312 );313 wp_enqueue_style(314 'ecommpay_merchant_css',315 sprintf( '%s/shared/merchant.css', $url ),316 [],317 null318 );319 320 // Woocommerce Ecommpay Plugin frontend321 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' ) );345 283 } 346 284 … … 586 524 ] ); // Non-authorised user: Guest access 587 525 588 // register hooks for display payment form on checkout page589 add_action( EcpWCFilterList::WOOCOMMERCE_BEFORE_CHECKOUT_FORM, [ $this, 'include_frontend_scripts' ] );590 591 // register hooks for display payment form on payment page592 add_action( EcpWCFilterList::BEFORE_WOOCOMMERCE_PAY, [ $this, 'include_frontend_scripts' ] );593 526 594 527 // register hooks for display payment form on block-based checkout page -
ecommpay-payments/trunk/gateway-ecommpay.php
r3239955 r3245713 5 5 * GitHub Plugin URI: 6 6 * Description: Easy payment from WooCommerce by different methods in single Payment Page. 7 * Version: 4.0. 37 * Version: 4.0.4 8 8 * License: GPL2 9 9 * License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 83 83 'wp_enqueue_scripts', 84 84 function () { 85 global $wp; 86 85 87 wp_enqueue_style( 86 88 'woocommerce-ecommpay-frontend-style', … … 89 91 ecp_version() 90 92 ); 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 } 91 150 } 92 151 ); -
ecommpay-payments/trunk/readme.txt
r3239955 r3245713 4 4 Requires at least: 6.2 5 5 Tested up to: 6.7 6 Stable tag: 4.0. 36 Stable tag: 4.0.4 7 7 License: GPLv2 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.