WooCommerce PayPal Powered by Braintree Payment Gateway - Version 2.3.1

Version Description

Download this release

Release Info

Developer SkyVerge
Plugin Icon 128x128 WooCommerce PayPal Powered by Braintree Payment Gateway
Version 2.3.1
Comparing to
See all releases

Code changes from version 2.3.0 to 2.3.1

class-wc-braintree.php CHANGED
@@ -88,7 +88,7 @@ class WC_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_Plugin {
88
 
89
 
90
  /** plugin version number */
91
- const VERSION = '2.3.0';
92
 
93
  /** Braintree JS SDK version */
94
  const BRAINTREE_JS_SDK_VERSION = '3.48.0';
88
 
89
 
90
  /** plugin version number */
91
+ const VERSION = '2.3.1';
92
 
93
  /** Braintree JS SDK version */
94
  const BRAINTREE_JS_SDK_VERSION = '3.48.0';
i18n/languages/woocommerce-gateway-paypal-powered-by-braintree.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the WooCommerce PayPal Powered by Braintree Gateway package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce PayPal Powered by Braintree Gateway 2.3.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
- "POT-Creation-Date: 2019-10-03 05:34:51+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
2
  # This file is distributed under the same license as the WooCommerce PayPal Powered by Braintree Gateway package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce PayPal Powered by Braintree Gateway 2.3.1\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://woocommerce.com/my-account/marketplace-ticket-form/\n"
8
+ "POT-Creation-Date: 2019-10-17 00:56:40+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
includes/api/requests/class-wc-braintree-api-customer-request.php CHANGED
@@ -54,7 +54,7 @@ class WC_Braintree_API_Customer_Request extends WC_Braintree_API_Vault_Request {
54
  $this->request_data = array(
55
  'company' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_company' ),
56
  'email' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_email' ),
57
- 'phone' => WC_Braintree_Framework\SV_WC_Helper::str_truncate( preg_replace( '/[^\d-().]/', '', WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_phone' ) ), 14, '' ),
58
  'firstName' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_first_name' ),
59
  'lastName' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_last_name' ),
60
  'paymentMethodNonce' => $order->payment->nonce,
54
  $this->request_data = array(
55
  'company' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_company' ),
56
  'email' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_email' ),
57
+ 'phone' => WC_Braintree_Framework\SV_WC_Helper::str_truncate( preg_replace( '/[^\d\-().]/', '', WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_phone' ) ), 14, '' ),
58
  'firstName' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_first_name' ),
59
  'lastName' => WC_Braintree_Framework\SV_WC_Order_Compatibility::get_prop( $order, 'billing_last_name' ),
60
  'paymentMethodNonce' => $order->payment->nonce,
includes/class-wc-gateway-braintree.php CHANGED
@@ -1416,7 +1416,7 @@ class WC_Gateway_Braintree extends WC_Braintree_Framework\SV_WC_Payment_Gateway_
1416
  }
1417
 
1418
  // check for invalid characters
1419
- if ( $invalid_characters = preg_replace( '/[\d-().]/', '', $value ) ) {
1420
  return false;
1421
  }
1422
 
1416
  }
1417
 
1418
  // check for invalid characters
1419
+ if ( $invalid_characters = preg_replace( '/[\d\-().]/', '', $value ) ) {
1420
  return false;
1421
  }
1422
 
includes/payment-forms/class-wc-braintree-hosted-fields-payment-form.php CHANGED
@@ -132,7 +132,7 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
132
  $params = array_merge( $params, [
133
  'csc_required' => $this->get_gateway()->is_csc_required(),
134
  'threeds' => array(
135
- 'enabled' => ! is_add_payment_method_page() && $this->get_gateway()->is_3d_secure_enabled(), // setting this to false overrides any account configuration
136
  'liability_shift_always_required' => $this->get_gateway()->is_3d_secure_liability_shift_always_required(),
137
  'card_types' => $card_types,
138
  'failure_message' => __( 'We cannot process your order with the payment information that you provided. Please use an alternate payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
@@ -145,6 +145,27 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
145
  }
146
 
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  /**
149
  * Gets the enabled card types in the Braintree SDK format.
150
  *
@@ -220,7 +241,7 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
220
  echo '<input type="hidden" name="wc-' . $this->get_gateway()->get_id_dasherized() . '-' . esc_attr( $field ) . '" value="" />';
221
  }
222
 
223
- $order_total = $this->get_order_total();
224
 
225
  echo '<input type="hidden" name="wc-' . $this->get_gateway()->get_id_dasherized() . '-3d-secure-order-total" value="' . esc_attr( WC_Braintree_Framework\SV_WC_Helper::number_format( $order_total ) ) . '" />';
226
 
@@ -266,4 +287,46 @@ class WC_Braintree_Hosted_Fields_Payment_Form extends WC_Braintree_Payment_Form
266
  }
267
 
268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  }
132
  $params = array_merge( $params, [
133
  'csc_required' => $this->get_gateway()->is_csc_required(),
134
  'threeds' => array(
135
+ 'enabled' => $this->should_enable_3d_secure(), // setting this to false overrides any account configuration
136
  'liability_shift_always_required' => $this->get_gateway()->is_3d_secure_liability_shift_always_required(),
137
  'card_types' => $card_types,
138
  'failure_message' => __( 'We cannot process your order with the payment information that you provided. Please use an alternate payment method.', 'woocommerce-gateway-paypal-powered-by-braintree' ),
145
  }
146
 
147
 
148
+ /**
149
+ * Determines whether 3D Secure should be enabled for the current transaction.
150
+ *
151
+ * @since 2.3.1
152
+ *
153
+ * @return bool
154
+ */
155
+ private function should_enable_3d_secure() {
156
+
157
+ $enable = false;
158
+
159
+ if ( ! is_add_payment_method_page() && $this->get_gateway()->is_3d_secure_enabled() ) {
160
+
161
+ // disable 3D Secure if we can't determine a non-zero cart total, as $0 verifications are currently not supported
162
+ $enable = $this->get_order_total_for_3d_secure() !== 0.0;
163
+ }
164
+
165
+ return $enable;
166
+ }
167
+
168
+
169
  /**
170
  * Gets the enabled card types in the Braintree SDK format.
171
  *
241
  echo '<input type="hidden" name="wc-' . $this->get_gateway()->get_id_dasherized() . '-' . esc_attr( $field ) . '" value="" />';
242
  }
243
 
244
+ $order_total = $this->get_order_total_for_3d_secure();
245
 
246
  echo '<input type="hidden" name="wc-' . $this->get_gateway()->get_id_dasherized() . '-3d-secure-order-total" value="' . esc_attr( WC_Braintree_Framework\SV_WC_Helper::number_format( $order_total ) ) . '" />';
247
 
287
  }
288
 
289
 
290
+ /**
291
+ * Calculate the order total used for card verification.
292
+ *
293
+ * @since 2.3.1
294
+ *
295
+ * @return float cart total or the subscription recurring amount
296
+ */
297
+ private function get_order_total_for_3d_secure() {
298
+
299
+ $order_total = (float) $this->get_order_total();
300
+
301
+ if ( $order_total === 0.0 && wc_braintree()->is_subscriptions_active() && \WC_Subscriptions_Cart::cart_contains_subscription() ) {
302
+ $order_total = $this->get_subscription_totals();
303
+ }
304
+
305
+ return $order_total;
306
+ }
307
+
308
+
309
+ /**
310
+ * Calculate the recurring amount for the subscriptions included in the cart.
311
+ *
312
+ * @since 2.3.1
313
+ *
314
+ * @see \WC_Subscriptions_Cart::calculate_subscription_totals()
315
+ * @return float
316
+ */
317
+ private function get_subscription_totals() {
318
+
319
+ $total = 0.0;
320
+
321
+ if ( isset( WC()->cart->recurring_carts ) && is_array( WC()->cart->recurring_carts ) ) {
322
+
323
+ foreach ( WC()->cart->recurring_carts as $recurring_cart ) {
324
+ $total += (float) $recurring_cart->total;
325
+ }
326
+ }
327
+
328
+ return $total;
329
+ }
330
+
331
+
332
  }
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: automattic, akeda, allendav, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, dsmithweb, fullysupportedphil, corsonr, zandyring, skyverge
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
4
  Requires at least: 4.4
5
- Tested up to: 5.2.3
6
  Requires PHP: 5.4
7
  Stable tag: 2.3.0
8
  License: GPLv3
@@ -124,6 +124,10 @@ New feature requests and bugs reports can be made in the plugin forum.
124
 
125
  == Changelog ==
126
 
 
 
 
 
127
  = 2019.10.03 - version 2.3.0 =
128
  * Feature - PayPal buy-now buttons can now be added to product pages
129
  * Tweak - Enable PayPal Credit by default on new installs
2
  Contributors: automattic, akeda, allendav, royho, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, dsmithweb, fullysupportedphil, corsonr, zandyring, skyverge
3
  Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal, braintree
4
  Requires at least: 4.4
5
+ Tested up to: 5.2.4
6
  Requires PHP: 5.4
7
  Stable tag: 2.3.0
8
  License: GPLv3
124
 
125
  == Changelog ==
126
 
127
+ = 2019.10.16 - version 2.3.1 =
128
+ * Fix - Prevent 3D Secure errors trying to purchase free trial subscriptions
129
+ * Fix - Fix a bug with regular expressions being used in PHP 7.3+
130
+
131
  = 2019.10.03 - version 2.3.0 =
132
  * Feature - PayPal buy-now buttons can now be added to product pages
133
  * Tweak - Enable PayPal Credit by default on new installs
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit925e102bad64dd22618e8624d9f99af4::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d::getLoader();
vendor/composer/LICENSE CHANGED
@@ -1,3 +1,4 @@
 
1
  Copyright (c) Nils Adermann, Jordi Boggiano
2
 
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -17,3 +18,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
  THE SOFTWARE.
 
1
+
2
  Copyright (c) Nils Adermann, Jordi Boggiano
3
 
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
18
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
  THE SOFTWARE.
21
+
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit925e102bad64dd22618e8624d9f99af4
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit925e102bad64dd22618e8624d9f99af4
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit925e102bad64dd22618e8624d9f99af4', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit925e102bad64dd22618e8624d9f99af4', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit925e102bad64dd22618e8624d9f99af4::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit78ba8a3ab3ee78c6e37de8c092dbb23d', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit925e102bad64dd22618e8624d9f99af4
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
@@ -33,9 +33,9 @@ class ComposerStaticInit925e102bad64dd22618e8624d9f99af4
33
  public static function getInitializer(ClassLoader $loader)
34
  {
35
  return \Closure::bind(function () use ($loader) {
36
- $loader->prefixLengthsPsr4 = ComposerStaticInit925e102bad64dd22618e8624d9f99af4::$prefixLengthsPsr4;
37
- $loader->prefixDirsPsr4 = ComposerStaticInit925e102bad64dd22618e8624d9f99af4::$prefixDirsPsr4;
38
- $loader->prefixesPsr0 = ComposerStaticInit925e102bad64dd22618e8624d9f99af4::$prefixesPsr0;
39
 
40
  }, null, ClassLoader::class);
41
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'B' =>
33
  public static function getInitializer(ClassLoader $loader)
34
  {
35
  return \Closure::bind(function () use ($loader) {
36
+ $loader->prefixLengthsPsr4 = ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::$prefixLengthsPsr4;
37
+ $loader->prefixDirsPsr4 = ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::$prefixDirsPsr4;
38
+ $loader->prefixesPsr0 = ComposerStaticInit78ba8a3ab3ee78c6e37de8c092dbb23d::$prefixesPsr0;
39
 
40
  }, null, ClassLoader::class);
41
  }
woocommerce-gateway-paypal-powered-by-braintree.php CHANGED
@@ -5,12 +5,12 @@
5
  * Description: Receive credit card or PayPal payments using Paypal Powered by Braintree. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP 5.4+
6
  * Author: WooCommerce
7
  * Author URI: http://woocommerce.com/
8
- * Version: 2.3.0
9
  * Text Domain: woocommerce-gateway-paypal-powered-by-braintree
10
  * Domain Path: /i18n/languages/
11
  *
12
  * WC requires at least: 2.6.14
13
- * WC tested up to: 3.7.0
14
  *
15
  * Copyright (c) 2016-2019, Automattic, Inc.
16
  *
5
  * Description: Receive credit card or PayPal payments using Paypal Powered by Braintree. A server with cURL, SSL support, and a valid SSL certificate is required (for security reasons) for this gateway to function. Requires PHP 5.4+
6
  * Author: WooCommerce
7
  * Author URI: http://woocommerce.com/
8
+ * Version: 2.3.1
9
  * Text Domain: woocommerce-gateway-paypal-powered-by-braintree
10
  * Domain Path: /i18n/languages/
11
  *
12
  * WC requires at least: 2.6.14
13
+ * WC tested up to: 3.7.1
14
  *
15
  * Copyright (c) 2016-2019, Automattic, Inc.
16
  *