Plugin Directory

Changeset 3376178


Ignore:
Timestamp:
10/10/2025 10:55:14 AM (6 months ago)
Author:
easypayment
Message:

tags/9.0.47

Location:
woo-paypal-gateway
Files:
1050 added
12 edited

Legend:

Unmodified
Added
Removed
  • woo-paypal-gateway/trunk/includes/class-woo-paypal-gateway.php

    r3368186 r3376178  
    5858            $this->version = WPG_PLUGIN_VERSION;
    5959        } else {
    60             $this->version = '9.0.46';
     60            $this->version = '9.0.47';
    6161        }
    6262        $this->plugin_name = 'woo-paypal-gateway';
  • woo-paypal-gateway/trunk/languages/woo-paypal-gateway.pot

    r3368186 r3376178  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Payment Gateway for PayPal on WooCommerce 9.0.46\n"
     5"Project-Id-Version: Payment Gateway for PayPal on WooCommerce 9.0.47\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woo-paypal-gateway\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  • woo-paypal-gateway/trunk/ppcp/checkout-block/ppcp-checkout.js

    r3366421 r3376178  
    159159                const ContentPPCPCheckout = (props) => {
    160160                    const {billing, shippingData, ...i} = props;
     161                    useEffect(() => {
     162                        jQuery(document.body).trigger("ppcp_checkout_updated");
     163                    }, []);
    161164                    if (l.use_place_order === true) {
    162165                        if (l.show_redirect_icon === 'yes') {
  • woo-paypal-gateway/trunk/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-gateway-cc.php

    r3366421 r3376178  
    271271            if (!class_exists('PPCP_Paypal_Checkout_For_Woocommerce_Request')) {
    272272                include_once WPG_PLUGIN_DIR . '/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-request.php';
    273                 $this->request = PPCP_Paypal_Checkout_For_Woocommerce_Request::instance();
    274             }
     273            }
     274            $this->request = PPCP_Paypal_Checkout_For_Woocommerce_Request::instance();
    275275            $order_id = $order->get_id();
    276             $this->payment_request->wpg_ppcp_capture_order_using_payment_method_token($order_id);
     276            $this->request->wpg_ppcp_capture_order_using_payment_method_token($order_id);
    277277        } catch (Exception $ex) {
    278278           
     
    285285                if (!class_exists('PPCP_Paypal_Checkout_For_Woocommerce_Request')) {
    286286                    include_once WPG_PLUGIN_DIR . '/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-request.php';
    287                     $this->request = PPCP_Paypal_Checkout_For_Woocommerce_Request::instance();
    288287                }
     288                $this->request = PPCP_Paypal_Checkout_For_Woocommerce_Request::instance();
    289289                $order = wc_get_order($order_id);
    290290                $token_id = wc_clean($_POST['wc-wpg_paypal_checkout_cc-payment-token']);
    291291                $token = WC_Payment_Tokens::get($token_id);
    292292                $order->payment_complete($token->get_token());
    293                 $this->payment_request->save_payment_token($order, $token->get_token());
     293                $this->request->save_payment_token($order, $token->get_token());
    294294                WC()->cart->empty_cart();
    295295                return array(
  • woo-paypal-gateway/trunk/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-gateway.php

    r3366421 r3376178  
    1616    public $plugin_name;
    1717    public $sandbox;
     18    public $testmode;
    1819    public $rest_client_id_sandbox;
    1920    public $sandbox_secret_id;
     
    7071                $this->order_button_text = _x('Proceed to PayPal', 'Important', 'woo-paypal-gateway');
    7172            }
     73        } else {
     74            $this->order_button_text = _x('Proceed to PayPal', 'Important', 'woo-paypal-gateway');
    7275        }
    7376        if (!has_action('woocommerce_update_options_payment_gateways_' . $this->id, [$this, 'process_admin_options'])) {
     
    123126            'multiple_subscriptions'
    124127        );
    125         $this->sandbox = 'yes' === $this->get_option('sandbox', 'no');
     128        $this->testmode = $this->sandbox = 'yes' === $this->get_option('sandbox', 'no');
    126129        $this->rest_client_id_sandbox = $this->get_option('rest_client_id_sandbox', '');
    127130        $this->sandbox_secret_id = $this->get_option('rest_secret_id_sandbox', '');
     
    850853                <td class="forminp" id="<?php echo esc_attr($field_key); ?>">
    851854                    <?php
    852                     $connected_email = $this->sandbox ? $this->get_option('ppcp_email_sandbox') : $this->get_option('ppcp_email_live');
     855                    $connected_email = $data['mode'] === 'sandbox' ? $this->get_option('ppcp_email_sandbox') : $this->get_option('ppcp_email_live');
    853856                    ?>
    854857                    <div class="wpg_ppcp_paypal_connection">
  • woo-paypal-gateway/trunk/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-request.php

    r3346894 r3376178  
    4545    public $CVV2Codes;
    4646    public $logger;
    47     public $invoice_prefix;
    4847    public $merchant_id;
    4948    public $send_items;
     
    196195    }
    197196
    198     public function ppcp_application_context($return = false) {
     197    public function ppcp_application_context($return = false, $woo_order_id) {
    199198        if (!class_exists('PPCP_Paypal_Checkout_For_Woocommerce_Locale_Handler')) {
    200199            require_once WPG_PLUGIN_DIR . '/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-locale_handler.php';
     
    206205            'locale' => $this->valid_bcp47_code(),
    207206            'landing_page' => $this->landing_page,
    208             'shipping_preference' => $this->ppcp_shipping_preference(),
     207            'shipping_preference' => $this->ppcp_shipping_preference($woo_order_id),
    209208            'user_action' => is_checkout() ? 'PAY_NOW' : 'CONTINUE',
    210209            'return_url' => add_query_arg(['ppcp_action' => 'ppcp_regular_capture', 'utm_nooverride' => '1'], $base_url),
     
    217216    }
    218217
    219     public function ppcp_shipping_preference() {
     218    public function ppcp_shipping_preference($woo_order_id = null) {
     219        // Default preference
    220220        $shipping_preference = 'GET_FROM_FILE';
    221         $page = null;
    222         if (isset($_GET) && !empty($_GET['from'])) {
    223             $page = $_GET['from'];
    224         } elseif (is_cart() && !WC()->cart->is_empty()) {
    225             $page = 'cart';
    226         } elseif (is_checkout() || is_checkout_pay_page()) {
    227             $page = 'checkout';
    228         } elseif (is_product()) {
    229             $page = 'product';
    230         }
     221
     222        // Detect current page
     223        $page = isset($_GET['from']) && !empty($_GET['from'])
     224            ? sanitize_text_field($_GET['from'])
     225            : (is_cart() ? 'cart' : (is_checkout() || is_checkout_pay_page() ? 'checkout' : (is_product() ? 'product' : null)));
     226
     227        // Determine if shipping is needed
     228        $needs_shipping = false;
     229
     230        // Use cart if available
     231        if (function_exists('WC') && WC()->cart && !WC()->cart->is_empty()) {
     232            $needs_shipping = WC()->cart->needs_shipping();
     233        }
     234        // If cart not available, try order ID
     235        elseif ($woo_order_id) {
     236            $order = wc_get_order($woo_order_id);
     237            if ($order) {
     238                $needs_shipping = $order->needs_shipping_address();
     239            }
     240        }
     241
     242        // Determine shipping preference based on page and need for shipping
    231243        if ($page === null) {
    232             return $shipping_preference = WC()->cart->needs_shipping() ? 'GET_FROM_FILE' : 'NO_SHIPPING';
    233         }
     244            return $needs_shipping ? 'GET_FROM_FILE' : 'NO_SHIPPING';
     245        }
     246
    234247        switch ($page) {
    235248            case 'product':
    236                 $shipping_preference = WC()->cart->needs_shipping() ? 'GET_FROM_FILE' : 'NO_SHIPPING';
    237249            case 'cart':
    238                 $shipping_preference = WC()->cart->needs_shipping() ? 'GET_FROM_FILE' : 'NO_SHIPPING';
     250                $shipping_preference = $needs_shipping ? 'GET_FROM_FILE' : 'NO_SHIPPING';
    239251                break;
     252
    240253            case 'checkout':
    241254            case 'pay_page':
    242                 $shipping_preference = WC()->cart->needs_shipping() ? 'SET_PROVIDED_ADDRESS' : 'NO_SHIPPING';
     255                $shipping_preference = $needs_shipping ? 'SET_PROVIDED_ADDRESS' : 'NO_SHIPPING';
    243256                break;
    244257        }
     258
    245259        return $shipping_preference;
    246260    }
     261
    247262
    248263    public function get_genrate_token() {
     
    381396            $body_request = array(
    382397                'intent' => $intent,
    383                 'application_context' => $this->ppcp_application_context(),
     398                'application_context' => $this->ppcp_application_context($return = false, $woo_order_id),
    384399                'payment_method' => array('payee_preferred' => ($this->payee_preferred) ? 'IMMEDIATE_PAYMENT_REQUIRED' : 'UNRESTRICTED'),
    385400                'purchase_units' =>
     
    21472162            $body_request = array(
    21482163                'intent' => $intent,
    2149                 'application_context' => $this->ppcp_application_context($return_url = true),
     2164                'application_context' => $this->ppcp_application_context($return_url = true, $woo_order_id),
    21502165                'payment_method' => array('payee_preferred' => ($this->payee_preferred) ? 'IMMEDIATE_PAYMENT_REQUIRED' : 'UNRESTRICTED'),
    21512166                'purchase_units' =>
     
    21652180            if ($woo_order_id != null) {
    21662181                $order = wc_get_order($woo_order_id);
    2167                 $body_request['purchase_units'][0]['invoice_id'] = $this->invoice_prefix . str_replace("#", "", $order->get_order_number());
    2168                 $body_request['purchase_units'][0]['custom_id'] = apply_filters('ppcp_custom_id', $this->invoice_prefix . str_replace("#", "", $order->get_order_number()), $order);
     2182                $body_request['purchase_units'][0]['invoice_id'] = $this->invoice_id_prefix . str_replace("#", "", $order->get_order_number());
     2183                $body_request['purchase_units'][0]['custom_id'] = apply_filters('ppcp_custom_id', $this->invoice_id_prefix . str_replace("#", "", $order->get_order_number()), $order);
    21692184            } else {
    21702185                $body_request['purchase_units'][0]['invoice_id'] = $reference_id;
     
    25762591            $body_request = array(
    25772592                'intent' => $intent,
    2578                 'application_context' => $this->ppcp_application_context($return_url = true),
     2593                'application_context' => $this->ppcp_application_context($return_url = true, $woo_order_id),
    25792594                'payment_method' => array('payee_preferred' => ($this->payee_preferred) ? 'IMMEDIATE_PAYMENT_REQUIRED' : 'UNRESTRICTED'),
    25802595                'purchase_units' =>
     
    25932608            );
    25942609            $order = wc_get_order($woo_order_id);
    2595             $body_request['purchase_units'][0]['invoice_id'] = $this->invoice_prefix . str_replace("#", "", $order->get_order_number());
    2596             $body_request['purchase_units'][0]['custom_id'] = apply_filters('ppcp_custom_id', $this->invoice_prefix . str_replace("#", "", $order->get_order_number()), $order);
     2610            $body_request['purchase_units'][0]['invoice_id'] = $this->invoice_id_prefix . str_replace("#", "", $order->get_order_number());
     2611            $body_request['purchase_units'][0]['custom_id'] = apply_filters('ppcp_custom_id', $this->invoice_id_prefix . str_replace("#", "", $order->get_order_number()), $order);
    25972612            $body_request['purchase_units'][0]['payee']['merchant_id'] = $this->merchant_id;
    25982613            if ($this->send_items === true) {
  • woo-paypal-gateway/trunk/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce.php

    r3291771 r3376178  
    7777        $this->subscription_support_enabled = class_exists('WC_Subscriptions') && function_exists('wcs_create_renewal_order');
    7878        include_once WPG_PLUGIN_DIR . '/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-gateway.php';
    79         if ($this->subscription_support_enabled) {
    80             include_once WPG_PLUGIN_DIR . '/ppcp/subscriptions/class-ppcp-paypal-checkout-for-woocommerce-subscriptions.php';
    81             include_once WPG_PLUGIN_DIR . '/ppcp/subscriptions/class-ppcp-paypal-checkout-for-woocommerce-subscriptions-cc.php';
    82         }
    8379        if (!class_exists('PPCP_Paypal_Checkout_For_Woocommerce_Gateway_CC')) {
    8480            include_once WPG_PLUGIN_DIR . '/ppcp/includes/class-ppcp-paypal-checkout-for-woocommerce-gateway-cc.php';
    8581        }
     82        if ($this->subscription_support_enabled) {
     83            if (!class_exists('PPCP_Paypal_Checkout_For_Woocommerce_Subscriptions')) {
     84                include_once WPG_PLUGIN_DIR . '/ppcp/subscriptions/class-ppcp-paypal-checkout-for-woocommerce-subscriptions.php';
     85            }
     86            if (!class_exists('PPCP_Paypal_Checkout_For_Woocommerce_Subscriptions_CC')) {
     87                include_once WPG_PLUGIN_DIR . '/ppcp/subscriptions/class-ppcp-paypal-checkout-for-woocommerce-subscriptions-cc.php';
     88            }
     89        }
    8690        $methods[] = $this->subscription_support_enabled ? 'PPCP_Paypal_Checkout_For_Woocommerce_Subscriptions_CC' : 'PPCP_Paypal_Checkout_For_Woocommerce_Gateway_CC';
    8791        $methods[] = $this->subscription_support_enabled ? 'PPCP_Paypal_Checkout_For_Woocommerce_Subscriptions' : 'PPCP_Paypal_Checkout_For_Woocommerce_Gateway';
    88         array_reverse($methods);
     92        $methods = array_reverse($methods);
    8993        return $methods;
    9094    }
  • woo-paypal-gateway/trunk/ppcp/public/class-ppcp-paypal-checkout-for-woocommerce-button-manager.php

    r3368186 r3376178  
    278278        add_action('wp_ajax_ppcp_get_product_total', array($this, 'ppcp_get_product_total'));
    279279        add_action('wp_ajax_nopriv_ppcp_get_product_total', array($this, 'ppcp_get_product_total'));
    280         add_filter('woocommerce_order_button_html', [$this, 'add_custom_class_to_place_order_button'], 20);
     280        if($this->use_place_order === false) {
     281            add_filter('woocommerce_order_button_html', [$this, 'add_custom_class_to_place_order_button'], 20);
     282        }
    281283    }
    282284
     
    319321                }
    320322            }
    321             if (WC()->cart && !WC()->cart->is_empty() && WC()->cart->needs_shipping()) {
     323            if ( WC()->cart && method_exists( WC()->cart, 'needs_shipping' ) && !WC()->cart->is_empty() && WC()->cart->needs_shipping() ) {
    322324                $needs_shipping = true;
    323325            }
     
    10771079        ?>
    10781080        <div class="ppcp_billing_details">
    1079             <?php if (wc_ship_to_billing_address_only() && WC()->cart->needs_shipping()) : ?>
     1081            <?php if (wc_ship_to_billing_address_only() && WC()->cart && method_exists( WC()->cart, 'needs_shipping' ) && WC()->cart->needs_shipping()) : ?>
    10801082                <h3><?php esc_html_e('Billing &amp; Shipping', 'woo-paypal-gateway'); ?>&nbsp;&nbsp;&nbsp;<a class="ppcp_edit_billing_address"><?php _e('Edit', 'woo-paypal-gateway'); ?></a></h3>
    10811083            <?php else : ?>
     
    13041306            return $fields;
    13051307        }
    1306         if (method_exists(WC()->cart, 'needs_shipping') && !WC()->cart->needs_shipping()) {
     1308        if ( WC()->cart && method_exists( WC()->cart, 'needs_shipping' ) && !WC()->cart->needs_shipping() ) {
    13071309            $not_required_fields = array('first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'postcode', 'country');
    13081310            foreach ($not_required_fields as $not_required_field) {
  • woo-paypal-gateway/trunk/ppcp/public/css/ppcp-paypal-checkout-for-woocommerce-public.css

    r3368186 r3376178  
    13321332    display: none !important;
    13331333}
    1334 .wp-theme-woodmart #ppcp_product, .wp-theme-woodmart .google-pay-container {
    1335     display: block !important;
    1336 }
    13371334.gpay-card-info-container {
    13381335    min-width: 0 !important;
  • woo-paypal-gateway/trunk/ppcp/public/js/ppcp-paypal-checkout-for-woocommerce-public.js

    r3368186 r3376178  
    234234                return this.handleCheckoutSubmit(event);
    235235            });
     236
    236237            $('#order_review').on('submit', (event) => {
    237                 event.preventDefault();
    238                 return this.handleCheckoutSubmit();
     238                if (this.isPpcpCCSelected()) {
     239                    event.preventDefault();
     240                    return this.handleCheckoutSubmit();
     241                }
    239242            });
    240243
     
    259262
    260263        handleCheckoutSubmit() {
    261             if ($('input[name="wc-wpg_paypal_checkout_cc-payment-token"]:checked').length > 0) {
    262                 return true;
     264            var selected = $('input[name="wc-wpg_paypal_checkout_cc-payment-token"]:checked').val();
     265            if (selected && selected !== 'new') {
     266                return true; // only return true for saved token (not for 'new')
    263267            }
    264268            if (this.isPpcpCCSelected() && this.isCardFieldEligible()) {
  • woo-paypal-gateway/trunk/readme.txt

    r3371788 r3376178  
    33Tags: PayPal, PayPal Checkout, Credit Cards, Venmo 
    44Requires at least: 3.3 
    5 Tested up to: 6.8.2
    6 Stable tag: 9.0.46 
     5Tested up to: 6.8.3
     6Stable tag: 9.0.47 
    77Requires PHP: 7.4 
    88License: GPLv3 
     
    82823. Enter your API credentials and adjust settings to fit your store's needs for a complete "PayPal For WooCommerce" experience.
    8383
     84== Screenshots ==
     851. **Settings Page**: Configure PayPal API credentials easily for WooCommerce.
     862. **Checkout Page**: Display multiple PayPal payment options, ideal for "PayPal For WooCommerce."
     873. **Order Confirmation**: Real-time status updates for seamless transactions.
     88
    8489== Frequently Asked Questions ==
    8590
     
    96101
    97102== Changelog ==
     103
     104= 9.0.47 - 2025-10-10 =
     105* Fixed - In Block Checkout, Smart Buttons not reinitializing on subsequent page loads in some themes.
     106* Fixed - Google Pay button appearing when Credit Card method is selected in a specific layout.
     107* Fixed - "Place Order" button hidden when both Advanced Credit Card and Express Checkout options are disabled.
     108* Fixed - Credit Card subscription renewal processing issue.
    98109
    99110= 9.0.46 - 2025-09-26 =
  • woo-paypal-gateway/trunk/woo-paypal-gateway.php

    r3368186 r3376178  
    66 * Plugin URI:        https://profiles.wordpress.org/easypayment
    77 * Description:       PayPal, Credit/Debit Cards, Google Pay, Apple Pay, Pay Later, Venmo, SEPA, iDEAL, Mercado Pago, Sofort, Bancontact & more - by an official PayPal Partner
    8  * Version:           9.0.46
     8 * Version:           9.0.47
    99 * Author:            easypayment
    1010 * Author URI:        https://profiles.wordpress.org/easypayment/
     
    2626
    2727if (!defined('WPG_PLUGIN_VERSION')) {
    28     define('WPG_PLUGIN_VERSION', '9.0.46');
     28    define('WPG_PLUGIN_VERSION', '9.0.47');
    2929}
    3030if (!defined('WPG_PLUGIN_PATH')) {
Note: See TracChangeset for help on using the changeset viewer.