Plugin Directory

Changeset 3471099


Ignore:
Timestamp:
02/27/2026 12:42:53 PM (4 weeks ago)
Author:
peachpay
Message:

1.120.15

Location:
peachpay-for-woocommerce
Files:
894 added
5 edited

Legend:

Unmodified
Added
Removed
  • peachpay-for-woocommerce/trunk/changelog.txt

    r3470414 r3471099  
    11*** PeachPay for WooCommerce Changelog ***
     2
     32026-02-27 - version 1.120.15
     4* CPay Refactor:
     5* Event Handling: Implemented a unified "listen to change" mechanism to handle updates without component remounting, improving checkout stability and flow.
     6* Apple Pay: Ensured proper session integration and reliable behavior during checkout.
     7* Fees Accuracy: Fixed and validated calculation/display of additional fees.
     8* Cart Logic: Optimized cart recalculation to work smoothly with the new mounting structure.
     9* Subscriptions: Resolved remount-related issues affecting subscription flows.
     10* Compliance: Updated implementation to align with WooCommerce standards and best practices.
     11* Compatibility: Updated tested WordPress version to 6.9.1.
    212
    3132026-02-26 - version 1.120.14
  • peachpay-for-woocommerce/trunk/core/payments/convesiopay/gateways/class-peachpay-convesiopay-unified-gateway.php

    r3470414 r3471099  
    209209        if ( isset( $_POST['convesiopay_selected_method'] ) && ! empty( $_POST['convesiopay_selected_method'] ) ) {
    210210            // phpcs:ignore WordPress.Security.NonceVerification.Missing
    211             $method = sanitize_text_field( wp_unslash( $_POST['convesiopay_selected_method'] ) );
     211            $method = $this->normalize_convesiopay_method( wp_unslash( $_POST['convesiopay_selected_method'] ) );
    212212            $source = 'POST';
    213213        }
     
    217217        if ( ! $method && isset( $_POST['extensions']['peachpay_convesiopay_unified']['selected_method'] ) ) {
    218218            // phpcs:ignore WordPress.Security.NonceVerification.Missing
    219             $method = sanitize_text_field( wp_unslash( $_POST['extensions']['peachpay_convesiopay_unified']['selected_method'] ) );
     219            $method = $this->normalize_convesiopay_method( wp_unslash( $_POST['extensions']['peachpay_convesiopay_unified']['selected_method'] ) );
    220220            $source = 'POST extensions';
    221221        }
     
    225225            $session_method = WC()->session->get( 'convesiopay_selected_method' );
    226226            if ( $session_method ) {
    227                 $method = $session_method;
     227                $method = $this->normalize_convesiopay_method( $session_method );
    228228                $source = 'session';
    229229            }
     
    279279
    280280        if ( isset( $_POST['convesiopay_selected_method'] ) && ! empty( $_POST['convesiopay_selected_method'] ) ) {
    281             $selected_method = sanitize_text_field( wp_unslash( $_POST['convesiopay_selected_method'] ) );
     281            $selected_method = $this->normalize_convesiopay_method( wp_unslash( $_POST['convesiopay_selected_method'] ) );
    282282        }
    283283
     
    288288
    289289            if ( is_array( $payment_method_data ) ) {
    290                 $selected_method = sanitize_text_field(
    291                     $payment_method_data['payment_method_type']
     290                $selected_method = $this->normalize_convesiopay_method(
     291                    $payment_method_data['convesiopay_selected_method']
     292                    ?? $payment_method_data['selected_method']
     293                    ?? $payment_method_data['selectedMethod']
     294                    ?? $payment_method_data['method']
     295                    ?? $payment_method_data['payment_method']
     296                    ?? $payment_method_data['paymentMethodType']
     297                    ?? $payment_method_data['payment_method_type']
    292298                    ?? $payment_method_data['paymentMethod']
    293299                    ?? $payment_method_data['paymentmethod']
     
    648654    private function detect_payment_method( $payment_data ) {
    649655        // Method 1: Check explicit payment method in data
    650         $explicit_method = $payment_data['paymentMethod'] ?? $payment_data['paymentmethod'] ?? $payment_data['payment_method_type'] ?? '';
     656        $explicit_method = $this->normalize_convesiopay_method(
     657            $payment_data['paymentMethod']
     658            ?? $payment_data['paymentmethod']
     659            ?? $payment_data['payment_method_type']
     660            ?? $payment_data['convesiopay_selected_method']
     661            ?? $payment_data['selected_method']
     662            ?? ''
     663        );
    651664
    652665        if ( ! empty( $explicit_method ) ) {
    653666            return $explicit_method;
    654667        }
    655        
     668
    656669        // Method 1.5: Check for payment token (express checkout)
    657670        if ( isset( $payment_data['convesiopay_payment_token'] ) && ! empty( $payment_data['convesiopay_payment_token'] ) ) {
     
    729742        }
    730743
     744        // Method 4: Use selected method from request/session after token/data heuristics.
     745        $selected_method = $this->normalize_convesiopay_method( $this->get_selected_convesiopay_method() );
     746        if ( in_array( $selected_method, array( 'card', 'applepay', 'btcpay' ), true ) ) {
     747            return $selected_method;
     748        }
     749
    731750        // Default fallback
    732751        return 'unknown';
     752    }
     753
     754    /**
     755     * Normalize method aliases to canonical unified values.
     756     *
     757     * @param string $method Raw method value.
     758     * @return string Canonical method or empty string.
     759     */
     760    private function normalize_convesiopay_method( $method ) {
     761        $normalized = strtolower( sanitize_text_field( (string) $method ) );
     762        if ( empty( $normalized ) ) {
     763            return '';
     764        }
     765        if ( in_array( $normalized, array( 'applepay', 'apple_pay', 'apple-pay' ), true ) ) {
     766            return 'applepay';
     767        }
     768        if ( in_array( $normalized, array( 'btcpay', 'crypto', 'btc_pay', 'btc-pay' ), true ) ) {
     769            return 'btcpay';
     770        }
     771        if ( 'card' === $normalized ) {
     772            return 'card';
     773        }
     774        return '';
    733775    }
    734776   
     
    11431185        wp_enqueue_script(
    11441186            'peachpay-convesiopay-unified-classic',
    1145             plugins_url( 'core/payments/convesiopay/assets/js/convesiopay-unified-classic.js', PEACHPAY_PLUGIN_FILE ),
     1187            plugins_url( 'core/payments/convesiopay/assets/js/convesiopay-unified-classic-v2.js', PEACHPAY_PLUGIN_FILE ),
    11461188            array( 'jquery', 'convesiopay-sdk' ),
    1147             '1.1.7',
     1189            '1.1.71',
    11481190            true
    11491191        );
     
    12101252            'fee_config' => $fee_config,
    12111253            'cart_total' => floatval( $cart_total ),
     1254            'peachpay_is_advanced_logging_enabled' => peachpay_is_advanced_logging_enabled()
    12121255        );
    12131256
     
    17451788
    17461789        // Add ConvesioPay component container (min-height/min-width prevent layout shift during Adyen load)
    1747         echo '<div id="convesiopay-unified-payment-container" style="min-height: 300px; min-width: 100%; width: 100%;"></div>';
     1790        echo '<div id="convesiopay-unified-payment-container"></div>';
    17481791
    17491792        // Skip parent payment_fields to avoid test mode notice
  • peachpay-for-woocommerce/trunk/core/payments/convesiopay/hooks.php

    r3468859 r3471099  
    6666// This ensures the checkout order matches what users set in WooCommerce > Settings > Payments
    6767add_filter( 'woocommerce_available_payment_gateways', 'peachpay_convesiopay_position_unified_gateway', 100 );
     68// Preserve mounted ConvesioPay secured fields during classic checkout updates.
     69// When unified is selected, skip replacing .woocommerce-checkout-payment fragment.
     70add_filter( 'woocommerce_update_order_review_fragments', 'peachpay_convesiopay_preserve_unified_payment_fragment', 20 );
    6871
    6972// Store credit / wallet gateways: PeachPay must not remove or hide them. We restore any known store-credit
     
    152155
    153156    return $result;
     157}
     158
     159/**
     160 * Preserve checkout payment fragment when ConvesioPay unified is present.
     161 *
     162 * Why:
     163 * Replacing .woocommerce-checkout-payment destroys mounted secured-field iframes
     164 * (card number/expiry/cvc) and clears user input. Preserving this fragment keeps
     165 * the mounted ConvesioPay DOM stable even when customers temporarily choose
     166 * another gateway (e.g. COD) and then return.
     167 *
     168 * @param array $fragments WooCommerce checkout fragments.
     169 * @return array
     170 */
     171function peachpay_convesiopay_preserve_unified_payment_fragment( $fragments ) {
     172    if ( empty( $fragments ) || ! is_array( $fragments ) ) {
     173        return $fragments;
     174    }
     175
     176    $payment_fragment_html = isset( $fragments['.woocommerce-checkout-payment'] ) && is_string( $fragments['.woocommerce-checkout-payment'] )
     177        ? $fragments['.woocommerce-checkout-payment']
     178        : '';
     179
     180    // Only preserve when unified gateway exists in the current payment fragment.
     181    // This avoids touching checkouts that do not include ConvesioPay.
     182    if ( false === strpos( $payment_fragment_html, 'payment_method_peachpay_convesiopay_unified' ) ) {
     183        return $fragments;
     184    }
     185
     186    $selected_gateway = '';
     187    if ( isset( $_POST['payment_method'] ) ) {
     188        $selected_gateway = sanitize_text_field( wp_unslash( $_POST['payment_method'] ) );
     189    } elseif ( isset( $_POST['post_data'] ) && is_string( $_POST['post_data'] ) ) {
     190        $post_data = array();
     191        parse_str( wp_unslash( $_POST['post_data'] ), $post_data );
     192        if ( isset( $post_data['payment_method'] ) ) {
     193            $selected_gateway = sanitize_text_field( $post_data['payment_method'] );
     194        }
     195    }
     196    if ( empty( $selected_gateway ) && function_exists( 'WC' ) && WC()->session ) {
     197        $selected_gateway = (string) WC()->session->get( 'chosen_payment_method' );
     198    }
     199
     200    if ( 'peachpay_convesiopay_unified' !== $selected_gateway ) {
     201        return $fragments;
     202    }
     203
     204    if ( isset( $fragments['.woocommerce-checkout-payment'] ) ) {
     205        unset( $fragments['.woocommerce-checkout-payment'] );
     206    }
     207
     208    return $fragments;
    154209}
    155210
  • peachpay-for-woocommerce/trunk/peachpay.php

    r3470414 r3471099  
    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.120.14
     6 * Version: 1.120.15
    77 * Text Domain: peachpay-for-woocommerce
    88 * Domain Path: /languages
    99 * Author: PeachPay, Inc.
    1010 * Author URI: https://peachpay.app
    11  * Tested up to: 6.8.1
     11 * Tested up to: 6.9.1
    1212 * WC requires at least: 5.0
    1313 * WC tested up to: 8.1.1
  • peachpay-for-woocommerce/trunk/readme.txt

    r3470414 r3471099  
    33Tags: woocommerce, checkout, payments, stripe, paypal
    44Requires at least: 5.8
    5 Tested up to: 6.8.1
    6 Stable tag: 1.120.14
     5Tested up to: 6.9.1
     6Stable tag: 1.120.15
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    262262
    263263== Changelog ==
     264
     265= 1.120.15 =
     266* CPay Refactor:
     267* Event Handling: Implemented a unified "listen to change" mechanism to handle updates without component remounting, improving checkout stability and flow.
     268* Apple Pay: Ensured proper session integration and reliable behavior during checkout.
     269* Fees Accuracy: Fixed and validated calculation/display of additional fees.
     270* Cart Logic: Optimized cart recalculation to work smoothly with the new mounting structure.
     271* Subscriptions: Resolved remount-related issues affecting subscription flows.
     272* Compliance: Updated implementation to align with WooCommerce standards and best practices.
     273* Compatibility: Updated tested WordPress version to 6.9.1.
    264274
    265275= 1.120.14 =
Note: See TracChangeset for help on using the changeset viewer.