Plugin Directory

Changeset 3347212


Ignore:
Timestamp:
08/19/2025 07:11:26 PM (7 months ago)
Author:
peachpay
Message:

1.117.4

Location:
peachpay-for-woocommerce
Files:
868 added
19 edited

Legend:

Unmodified
Added
Removed
  • peachpay-for-woocommerce/trunk/core/functions.php

    r3331686 r3347212  
    228228
    229229/**
    230  * Declare our support for Woocommerce High performance order storage.
     230 * Declare our support for WooCommerce High performance order storage.
    231231 *
    232232 * @since 1.99.3
    233233 */
    234234function pp_declare_wc_hpos_support() {
    235     if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
    236         \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', PEACHPAY_BASENAME, true );
     235    // Ensure WooCommerce is loaded before declaring compatibility
     236    if ( ! defined( 'WC_VERSION' ) ) {
     237        return;
     238    }
     239
     240    // Check for FeaturesUtil class and declare HPOS compatibility
     241    if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
     242        try {
     243            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', PEACHPAY_BASENAME, true );
     244           
     245            // Also declare compatibility with cart and checkout blocks
     246            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', PEACHPAY_BASENAME, true );
     247        } catch ( Exception $e ) {
     248            // Log error but don't break the site
     249            error_log( 'PeachPay HPOS compatibility declaration failed: ' . $e->getMessage() );
     250        }
    237251    }
    238252}
     
    362376
    363377/**
     378 * Safely retrieves a payment gateway instance, returning null if not found.
     379 *
     380 * @param string $gateway_id The gateway ID to retrieve.
     381 * @return WC_Payment_Gateway|null The gateway instance or null if not found.
     382 */
     383function peachpay_get_payment_gateway( $gateway_id ) {
     384    if ( empty( $gateway_id ) || ! WC() || ! WC()->payment_gateways ) {
     385        return null;
     386    }
     387
     388    $gateways = WC()->payment_gateways->payment_gateways();
     389    if ( ! isset( $gateways[ $gateway_id ] ) || ! is_object( $gateways[ $gateway_id ] ) ) {
     390        return null;
     391    }
     392
     393    return $gateways[ $gateway_id ];
     394}
     395
     396/**
    364397 * Registers fee to the cart based on selected payment method.
    365398 *
     
    372405
    373406    $gateway_id = WC()->session->get( 'chosen_payment_method' );
    374     if ( empty( $gateway_id ) || ! isset( WC()->payment_gateways->payment_gateways()[ $gateway_id ] ) ) {
    375         return;
    376     }
    377 
    378     $gateway_instance = WC()->payment_gateways->payment_gateways()[ $gateway_id ];
    379     if ( ! ( $gateway_instance instanceof PeachPay_Payment_Gateway ) ) {
     407    $gateway_instance = peachpay_get_payment_gateway( $gateway_id );
     408    if ( ! $gateway_instance || ! ( $gateway_instance instanceof PeachPay_Payment_Gateway ) ) {
    380409        return;
    381410    }
  • peachpay-for-woocommerce/trunk/core/payments/square/blocks/class-peachpay-square-ach-gateway-blocks-support.php

    r3035340 r3347212  
    3333     */
    3434    public function initialize() {
    35         $gateways       = WC()->payment_gateways->payment_gateways();
    36         $this->gateway  = $gateways[ $this->name ];
     35        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3736        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3837    }
     
    4443     */
    4544    public function is_active() {
     45        // Check if gateway exists before calling methods on it
     46        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     47            return false;
     48        }
    4649        return $this->gateway->is_available( true );
    4750    }
     
    7679     */
    7780    public function get_payment_method_data() {
     81        // Return empty array if gateway is not available
     82        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     83            return array();
     84        }
     85
    7886        return array(
    7987            'square'            => array(
  • peachpay-for-woocommerce/trunk/core/payments/square/blocks/class-peachpay-square-afterpay-gateway-blocks-support.php

    r3055750 r3347212  
    3333     */
    3434    public function initialize() {
    35         $gateways       = WC()->payment_gateways->payment_gateways();
    36         $this->gateway  = $gateways[ $this->name ];
     35        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3736        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3837    }
     
    4443     */
    4544    public function is_active() {
     45        // Check if gateway exists before calling methods on it
     46        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     47            return false;
     48        }
    4649        return $this->gateway->is_available( true );
    4750    }
     
    7679     */
    7780    public function get_payment_method_data() {
     81        // Return empty array if gateway is not available
     82        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     83            return array();
     84        }
     85
    7886        return array(
    7987            'square'            => array(
  • peachpay-for-woocommerce/trunk/core/payments/square/blocks/class-peachpay-square-card-gateway-blocks-support.php

    r3035340 r3347212  
    3333     */
    3434    public function initialize() {
    35         $gateways       = WC()->payment_gateways->payment_gateways();
    36         $this->gateway  = $gateways[ $this->name ];
     35        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3736        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3837    }
     
    4443     */
    4544    public function is_active() {
     45        // Check if gateway exists before calling methods on it
     46        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     47            return false;
     48        }
    4649        return $this->gateway->is_available( true );
    4750    }
     
    7679     */
    7780    public function get_payment_method_data() {
     81        // Return empty array if gateway is not available
     82        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     83            return array();
     84        }
     85
    7886        return array(
    7987            'square'            => array(
  • peachpay-for-woocommerce/trunk/core/payments/square/blocks/class-peachpay-square-googlepay-gateway-blocks-support.php

    r3035340 r3347212  
    3333     */
    3434    public function initialize() {
    35         $gateways       = WC()->payment_gateways->payment_gateways();
    36         $this->gateway  = $gateways[ $this->name ];
     35        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3736        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3837    }
     
    4443     */
    4544    public function is_active() {
     45        // Check if gateway exists before calling methods on it
     46        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     47            return false;
     48        }
    4649        return $this->gateway->is_available( true );
    4750    }
     
    7679     */
    7780    public function get_payment_method_data() {
     81        // Return empty array if gateway is not available
     82        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     83            return array();
     84        }
     85
    7886        return array(
    7987            'square'            => array(
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-achdebit-payment-blocks-support.php

    r3331686 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    7372     */
    7473    public function get_payment_method_data() {
     74        // Return empty array if gateway is not available
     75        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     76            return array();
     77        }
     78
    7579        return array(
    7680            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-affirm-payment-blocks-support.php

    r3035340 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-afterpay-payment-blocks-support.php

    r3045937 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-bancontact-payment-blocks-support.php

    r3045937 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-card-payment-blocks-support.php

    r3035340 r3347212  
    3333     */
    3434    public function initialize() {
    35         $gateways       = WC()->payment_gateways->payment_gateways();
    36         $this->gateway  = $gateways[ $this->name ];
     35        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3736        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3837    }
     
    4443     */
    4544    public function is_active() {
     45        // Check if gateway exists before calling methods on it
     46        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     47            return false;
     48        }
    4649        return $this->gateway->is_available( true );
    4750    }
     
    7073     */
    7174    public function get_payment_method_data() {
     75        // Return empty array if gateway is not available
     76        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     77            return array();
     78        }
     79
    7280        return array(
    7381            'icon'                       => $this->gateway->get_icon_url(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-eps-payment-blocks-support.php

    r3045937 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-giropay-payment-blocks-support.php

    r3045937 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-googlepay-payment-blocks-support.php

    r3059260 r3347212  
    3333     */
    3434    public function initialize() {
    35         $gateways       = WC()->payment_gateways->payment_gateways();
    36         $this->gateway  = $gateways[ $this->name ];
     35        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3736        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3837    }
     
    4443     */
    4544    public function is_active() {
     45        // Check if gateway exists before calling methods on it
     46        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     47            return false;
     48        }
    4649        return $this->gateway->is_available( true );
    4750    }
     
    7073     */
    7174    public function get_payment_method_data() {
     75        // Return empty array if gateway is not available
     76        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     77            return array();
     78        }
     79
    7280        return array(
    7381            'icon_url'                   => $this->gateway->get_icon_url(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-ideal-payment-blocks-support.php

    r3045937 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-klarna-payment-blocks-support.php

    r3039373 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-p24-payment-blocks-support.php

    r3045937 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/core/payments/stripe/blocks/class-peachpay-stripe-sofort-payment-blocks-support.php

    r3045937 r3347212  
    3131     */
    3232    public function initialize() {
    33         $gateways       = WC()->payment_gateways->payment_gateways();
    34         $this->gateway  = $gateways[ $this->name ];
     33        $this->gateway  = peachpay_get_payment_gateway( $this->name );
    3534        $this->settings = get_option( 'peachpay_' . $this->name . '_settings', array() );
    3635    }
     
    4241     */
    4342    public function is_active() {
     43        // Check if gateway exists before calling methods on it
     44        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     45            return false;
     46        }
    4447        return $this->gateway->is_available( true );
    4548    }
     
    6871     */
    6972    public function get_payment_method_data() {
     73        // Return empty array if gateway is not available
     74        if ( ! $this->gateway || ! is_object( $this->gateway ) ) {
     75            return array();
     76        }
     77
    7078        return array(
    7179            'connect_id'                 => PeachPay_Stripe_Integration::connect_id(),
  • peachpay-for-woocommerce/trunk/peachpay.php

    r3340650 r3347212  
    44 * Plugin URI: https://woocommerce.com/products/peachpay
    55 * Description: Connect and manage all your payment methods, offer shoppers a beautiful Express Checkout, and reduce cart abandonment.
    6  * Version: 1.117.3
     6 * Version: 1.117.4
    77 * Text Domain: peachpay-for-woocommerce
    88 * Domain Path: /languages
  • peachpay-for-woocommerce/trunk/readme.txt

    r3340650 r3347212  
    11=== Payments Plugin and Checkout Plugin for WooCommerce: Stripe, PayPal, Square, Authorize.net ===
    2 Contributors: peachpay,tfanelli
    3 Tags: woocommerce, checkout, payments, stripe, paypal, square, subscriptions, field editor, currency switcher, analytics, express checkout
     2Contributors: peachpay,tfanelli,vikrantsant
     3Tags: woocommerce, checkout, payments, stripe, paypal
    44Requires at least: 5.8
    55Tested up to: 6.8.1
    6 Stable tag: 1.117.3
     6Stable tag: 1.117.4
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    263263== Changelog ==
    264264
     265### 1.117.4 (2025-08-19)
     266
     267#### New features
     268- WooCommerce: Enhanced compatibility with High-Performance Order Storage (HPOS)
     269- Blocks: Improved WooCommerce Blocks support and integration
     270- Core: Updated plugin architecture for better performance and reliability
     271
     272#### Improvements
     273- Database: Optimized database queries for HPOS compatibility
     274- Performance: Enhanced order processing efficiency
     275- Compatibility: Better integration with modern WooCommerce features
     276
     277#### Bug Fixes
     278- HPOS: Fixed order data retrieval issues with High-Performance Order Storage
     279- Blocks: Resolved compatibility issues with WooCommerce Blocks checkout
     280- Core: Various stability improvements and bug fixes
     281
    265282### 1.117.3 (2025-08-06)
    266283
     
    655672- Currency Switcher: Currency conversions failing when the base currency is not defined
    656673- Payments: Don't display unsupported PeachPay payment methods in the customer's "My Account > Payment Methods" page
     674
     675For information about versions 1.95.2 and earlier, please see the full changelog in our repository or contact support.
    657676
    658677### 1.95.2 (2023-07-17)
     
    959978- A few small bugs related to PeachPay Premium and the UI of some settings
    960979
    961 ### 1.90.0 (2023-03-28)
     980For information about versions 1.90.0 and earlier, please see the full changelog in our repository or contact support.
    962981
    963982#### New features
Note: See TracChangeset for help on using the changeset viewer.