WooCommerce PayPal Express Checkout Payment Gateway - Version 2.0.1

Version Description

  • 2020-05-26 =
  • Fix - PayPal buttons not loading on the page, accompanied with the javascript/console error: "paypal.getFundingSources (or paypal.Buttons) is not a function". PR#740
Download this release

Release Info

Developer woothemes
Plugin Icon 128x128 WooCommerce PayPal Express Checkout Payment Gateway
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0.0 to 2.0.1

assets/js/wc-gateway-ppec-smart-payment-buttons.js CHANGED
@@ -2,6 +2,9 @@
2
  ;( function ( $, window, document ) {
3
  'use strict';
4
 
 
 
 
5
  // Show error notice at top of checkout form, or else within button container
6
  var showError = function( errorMessage, selector ) {
7
  var $container = $( '.woocommerce-notices-wrapper, form.checkout' );
2
  ;( function ( $, window, document ) {
3
  'use strict';
4
 
5
+ // Use global 'paypal' object or namespaced 'paypal_sdk' as PayPal API (depends on legacy/SDK mode).
6
+ var paypal = wc_ppec_context.use_checkout_js ? window.paypal : window.paypal_sdk;
7
+
8
  // Show error notice at top of checkout form, or else within button container
9
  var showError = function( errorMessage, selector ) {
10
  var $container = $( '.woocommerce-notices-wrapper, form.checkout' );
changelog.txt CHANGED
@@ -1,5 +1,8 @@
1
  *** Changelog ***
2
 
 
 
 
3
  = 2.0.0 - 2020-05-25 =
4
  * New - Upgrade to the latest PayPal Checkout Javascript SDK. PR#668
5
  * Add - New setting found under Button Styles for choosing a Smart Payment Button label. PR#666
1
  *** Changelog ***
2
 
3
+ = 2.0.1 - 2020-05-26 =
4
+ * Fix - PayPal buttons not loading on the page, accompanied with the javascript/console error: "paypal.getFundingSources (or paypal.Buttons) is not a function". PR#740
5
+
6
  = 2.0.0 - 2020-05-25 =
7
  * New - Upgrade to the latest PayPal Checkout Javascript SDK. PR#668
8
  * Add - New setting found under Button Styles for choosing a Smart Payment Button label. PR#666
includes/class-wc-gateway-ppec-cart-handler.php CHANGED
@@ -22,6 +22,7 @@ class WC_Gateway_PPEC_Cart_Handler {
22
  add_action( 'woocommerce_before_cart_totals', array( $this, 'before_cart_totals' ) );
23
  add_action( 'woocommerce_proceed_to_checkout', array( $this, 'display_paypal_button' ), 20 );
24
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 
25
 
26
  if ( 'yes' === wc_gateway_ppec()->settings->use_spb ) {
27
  add_action( 'woocommerce_after_mini_cart', array( $this, 'display_mini_paypal_button' ), 20 );
@@ -493,7 +494,7 @@ class WC_Gateway_PPEC_Cart_Handler {
493
  );
494
 
495
  } elseif ( 'yes' === $settings->use_spb ) {
496
- $spb_script_dependencies = array( 'jquery', 'paypal-checkout-js' );
497
  $data = array(
498
  'use_checkout_js' => $settings->use_legacy_checkout_js(),
499
  'environment' => 'sandbox' === $settings->get_environment() ? 'sandbox' : 'production',
@@ -542,7 +543,8 @@ class WC_Gateway_PPEC_Cart_Handler {
542
  'currency' => get_woocommerce_currency(),
543
  );
544
 
545
- wp_register_script( 'paypal-checkout-js', add_query_arg( $script_args, 'https://www.paypal.com/sdk/js' ), array(), null, true );
 
546
 
547
  // register the fetch/promise polyfills files so the new PayPal Checkout SDK works with IE
548
  if ( $is_IE ) {
@@ -553,6 +555,7 @@ class WC_Gateway_PPEC_Cart_Handler {
553
  }
554
  } else {
555
  wp_register_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
 
556
  }
557
 
558
  wp_register_script( 'wc-gateway-ppec-smart-payment-buttons', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-smart-payment-buttons.js', $spb_script_dependencies, wc_gateway_ppec()->version, true );
@@ -560,6 +563,18 @@ class WC_Gateway_PPEC_Cart_Handler {
560
  }
561
  }
562
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  /**
564
  * Creates a customer session if one is not already active.
565
  */
22
  add_action( 'woocommerce_before_cart_totals', array( $this, 'before_cart_totals' ) );
23
  add_action( 'woocommerce_proceed_to_checkout', array( $this, 'display_paypal_button' ), 20 );
24
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
25
+ add_filter( 'script_loader_tag', array( $this, 'add_paypal_sdk_namespace_attribute' ), 10, 2 );
26
 
27
  if ( 'yes' === wc_gateway_ppec()->settings->use_spb ) {
28
  add_action( 'woocommerce_after_mini_cart', array( $this, 'display_mini_paypal_button' ), 20 );
494
  );
495
 
496
  } elseif ( 'yes' === $settings->use_spb ) {
497
+ $spb_script_dependencies = array( 'jquery' );
498
  $data = array(
499
  'use_checkout_js' => $settings->use_legacy_checkout_js(),
500
  'environment' => 'sandbox' === $settings->get_environment() ? 'sandbox' : 'production',
543
  'currency' => get_woocommerce_currency(),
544
  );
545
 
546
+ wp_register_script( 'paypal-checkout-sdk', add_query_arg( $script_args, 'https://www.paypal.com/sdk/js' ), array(), null, true );
547
+ $spb_script_dependencies[] = 'paypal-checkout-sdk';
548
 
549
  // register the fetch/promise polyfills files so the new PayPal Checkout SDK works with IE
550
  if ( $is_IE ) {
555
  }
556
  } else {
557
  wp_register_script( 'paypal-checkout-js', 'https://www.paypalobjects.com/api/checkout.js', array(), null, true );
558
+ $spb_script_dependencies[] = 'paypal-checkout-js';
559
  }
560
 
561
  wp_register_script( 'wc-gateway-ppec-smart-payment-buttons', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-smart-payment-buttons.js', $spb_script_dependencies, wc_gateway_ppec()->version, true );
563
  }
564
  }
565
 
566
+ /**
567
+ * Adds the data-namespace attribute when enqueuing the PayPal SDK script
568
+ *
569
+ * @since 2.0.1
570
+ * @param string $tag
571
+ * @param string $handle
572
+ * @return string
573
+ */
574
+ public function add_paypal_sdk_namespace_attribute( $tag, $handle ) {
575
+ return ( 'paypal-checkout-sdk' === $handle ) ? str_replace( ' src', ' data-namespace="paypal_sdk" src', $tag ) : $tag;
576
+ }
577
+
578
  /**
579
  * Creates a customer session if one is not already active.
580
  */
languages/woocommerce-gateway-paypal-express-checkout.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the WooCommerce PayPal Checkout Gateway plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce PayPal Checkout Gateway 2.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-gateway-paypal-express-checkout\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-05-25T14:58:35+10:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woocommerce-gateway-paypal-express-checkout\n"
@@ -298,27 +298,27 @@ msgstr ""
298
  msgid "An error (%s) occurred while processing your PayPal payment. Please contact the store owner for assistance."
299
  msgstr ""
300
 
301
- #: includes/class-wc-gateway-ppec-cart-handler.php:70
302
- #: includes/class-wc-gateway-ppec-cart-handler.php:140
303
- #: includes/class-wc-gateway-ppec-cart-handler.php:161
304
  msgid "Cheatin&#8217; huh?"
305
  msgstr ""
306
 
307
- #: includes/class-wc-gateway-ppec-cart-handler.php:319
308
- #: includes/class-wc-gateway-ppec-cart-handler.php:364
309
- #: includes/class-wc-gateway-ppec-cart-handler.php:399
310
  msgid "Check out with PayPal"
311
  msgstr ""
312
 
313
- #: includes/class-wc-gateway-ppec-cart-handler.php:354
314
  msgid "&mdash; or &mdash;"
315
  msgstr ""
316
 
317
- #: includes/class-wc-gateway-ppec-cart-handler.php:369
318
  msgid "Pay with PayPal Credit"
319
  msgstr ""
320
 
321
- #: includes/class-wc-gateway-ppec-cart-handler.php:509
322
  msgid "An error occurred while processing your PayPal payment. Please contact the store owner for assistance."
323
  msgstr ""
324
 
2
  # This file is distributed under the same license as the WooCommerce PayPal Checkout Gateway plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce PayPal Checkout Gateway 2.0.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-gateway-paypal-express-checkout\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-05-26T08:06:44+10:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: woocommerce-gateway-paypal-express-checkout\n"
298
  msgid "An error (%s) occurred while processing your PayPal payment. Please contact the store owner for assistance."
299
  msgstr ""
300
 
301
+ #: includes/class-wc-gateway-ppec-cart-handler.php:71
302
+ #: includes/class-wc-gateway-ppec-cart-handler.php:141
303
+ #: includes/class-wc-gateway-ppec-cart-handler.php:162
304
  msgid "Cheatin&#8217; huh?"
305
  msgstr ""
306
 
307
+ #: includes/class-wc-gateway-ppec-cart-handler.php:320
308
+ #: includes/class-wc-gateway-ppec-cart-handler.php:365
309
+ #: includes/class-wc-gateway-ppec-cart-handler.php:400
310
  msgid "Check out with PayPal"
311
  msgstr ""
312
 
313
+ #: includes/class-wc-gateway-ppec-cart-handler.php:355
314
  msgid "&mdash; or &mdash;"
315
  msgstr ""
316
 
317
+ #: includes/class-wc-gateway-ppec-cart-handler.php:370
318
  msgid "Pay with PayPal Credit"
319
  msgstr ""
320
 
321
+ #: includes/class-wc-gateway-ppec-cart-handler.php:510
322
  msgid "An error occurred while processing your PayPal payment. Please contact the store owner for assistance."
323
  msgstr ""
324
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sa
4
  Requires at least: 4.4
5
  Tested up to: 5.4
6
  Requires PHP: 5.5
7
- Stable tag: 2.0.0
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -102,6 +102,9 @@ Please use this to inform us about bugs, or make contributions via PRs.
102
 
103
  == Changelog ==
104
 
 
 
 
105
  = 2.0.0 - 2020-05-25 =
106
  * New - Upgrade to the latest PayPal Checkout Javascript SDK. PR#668
107
  * Add - New setting found under Button Styles for choosing a Smart Payment Button label. PR#666
4
  Requires at least: 4.4
5
  Tested up to: 5.4
6
  Requires PHP: 5.5
7
+ Stable tag: 2.0.1
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
102
 
103
  == Changelog ==
104
 
105
+ = 2.0.1 - 2020-05-26 =
106
+ * Fix - PayPal buttons not loading on the page, accompanied with the javascript/console error: "paypal.getFundingSources (or paypal.Buttons) is not a function". PR#740
107
+
108
  = 2.0.0 - 2020-05-25 =
109
  * New - Upgrade to the latest PayPal Checkout Javascript SDK. PR#668
110
  * Add - New setting found under Button Styles for choosing a Smart Payment Button label. PR#666
woocommerce-gateway-paypal-express-checkout.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WooCommerce PayPal Checkout Gateway
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: Accept all major credit and debit cards, plus Venmo and PayPal Credit in the US, presenting options in a customizable stack of payment buttons. Fast, seamless, and flexible.
6
- * Version: 2.0.0
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2019 WooCommerce / PayPal.
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
27
  exit; // Exit if accessed directly
28
  }
29
 
30
- define( 'WC_GATEWAY_PPEC_VERSION', '2.0.0' );
31
 
32
  /**
33
  * Return instance of WC_Gateway_PPEC_Plugin.
3
  * Plugin Name: WooCommerce PayPal Checkout Gateway
4
  * Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
5
  * Description: Accept all major credit and debit cards, plus Venmo and PayPal Credit in the US, presenting options in a customizable stack of payment buttons. Fast, seamless, and flexible.
6
+ * Version: 2.0.1
7
  * Author: WooCommerce
8
  * Author URI: https://woocommerce.com
9
  * Copyright: © 2019 WooCommerce / PayPal.
27
  exit; // Exit if accessed directly
28
  }
29
 
30
+ define( 'WC_GATEWAY_PPEC_VERSION', '2.0.1' );
31
 
32
  /**
33
  * Return instance of WC_Gateway_PPEC_Plugin.