Version Description
- 2018-08-15 =
- Fix - Tax not applied on the (Confirm your PayPal order) page at the checkout.
Download this release
Release Info
| Developer | bor0 |
| Plugin | |
| Version | 1.6.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.6.1 to 1.6.2
changelog.txt
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
*** Changelog ***
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
= 1.6.1 - 2018-07-04 =
|
| 4 |
* Fix - GDPR Fatal error exporting user data when they have PPEC subscriptions.
|
| 5 |
* Fix - PayPal Credit still being disabled by default.
|
| 1 |
*** Changelog ***
|
| 2 |
|
| 3 |
+
= 1.6.2 - 2018-08-15 =
|
| 4 |
+
* Fix - Tax not applied on the (Confirm your PayPal order) page at the checkout.
|
| 5 |
+
|
| 6 |
= 1.6.1 - 2018-07-04 =
|
| 7 |
* Fix - GDPR Fatal error exporting user data when they have PPEC subscriptions.
|
| 8 |
* Fix - PayPal Credit still being disabled by default.
|
includes/class-wc-gateway-ppec-cart-handler.php
CHANGED
|
@@ -32,6 +32,7 @@ class WC_Gateway_PPEC_Cart_Handler {
|
|
| 32 |
if ( 'yes' === wc_gateway_ppec()->settings->checkout_on_single_product_enabled ) {
|
| 33 |
add_action( 'woocommerce_after_add_to_cart_form', array( $this, 'display_paypal_button_product' ), 1 );
|
| 34 |
add_action( 'wc_ajax_wc_ppec_generate_cart', array( $this, 'wc_ajax_generate_cart' ) );
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
add_action( 'wc_ajax_wc_ppec_update_shipping_costs', array( $this, 'wc_ajax_update_shipping_costs' ) );
|
|
@@ -333,7 +334,7 @@ class WC_Gateway_PPEC_Cart_Handler {
|
|
| 333 |
'page' => $page,
|
| 334 |
'button_color' => $settings->button_color,
|
| 335 |
'button_shape' => $settings->button_shape,
|
| 336 |
-
'start_checkout_nonce' =>
|
| 337 |
'start_checkout_url' => WC_AJAX::get_endpoint( 'wc_ppec_start_checkout' ),
|
| 338 |
);
|
| 339 |
|
|
@@ -364,7 +365,7 @@ class WC_Gateway_PPEC_Cart_Handler {
|
|
| 364 |
wp_enqueue_script( 'wc-gateway-ppec-generate-cart', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-generate-cart.js', array( 'jquery' ), wc_gateway_ppec()->version, true );
|
| 365 |
wp_localize_script( 'wc-gateway-ppec-generate-cart', 'wc_ppec_generate_cart_context',
|
| 366 |
array(
|
| 367 |
-
'generate_cart_nonce' =>
|
| 368 |
'ajaxurl' => WC_AJAX::get_endpoint( 'wc_ppec_generate_cart' ),
|
| 369 |
)
|
| 370 |
);
|
|
@@ -372,14 +373,12 @@ class WC_Gateway_PPEC_Cart_Handler {
|
|
| 372 |
}
|
| 373 |
|
| 374 |
/**
|
| 375 |
-
*
|
| 376 |
*/
|
| 377 |
-
|
| 378 |
if ( ! WC()->session->has_session() ) {
|
| 379 |
WC()->session->set_customer_session_cookie( true );
|
| 380 |
}
|
| 381 |
-
|
| 382 |
-
return wp_create_nonce( $action );
|
| 383 |
}
|
| 384 |
|
| 385 |
/**
|
| 32 |
if ( 'yes' === wc_gateway_ppec()->settings->checkout_on_single_product_enabled ) {
|
| 33 |
add_action( 'woocommerce_after_add_to_cart_form', array( $this, 'display_paypal_button_product' ), 1 );
|
| 34 |
add_action( 'wc_ajax_wc_ppec_generate_cart', array( $this, 'wc_ajax_generate_cart' ) );
|
| 35 |
+
add_action( 'wp', array( $this, 'ensure_session' ) ); // Ensure there is a customer session so that nonce is not invalidated by new session created on AJAX POST request.
|
| 36 |
}
|
| 37 |
|
| 38 |
add_action( 'wc_ajax_wc_ppec_update_shipping_costs', array( $this, 'wc_ajax_update_shipping_costs' ) );
|
| 334 |
'page' => $page,
|
| 335 |
'button_color' => $settings->button_color,
|
| 336 |
'button_shape' => $settings->button_shape,
|
| 337 |
+
'start_checkout_nonce' => wp_create_nonce( '_wc_ppec_start_checkout_nonce' ),
|
| 338 |
'start_checkout_url' => WC_AJAX::get_endpoint( 'wc_ppec_start_checkout' ),
|
| 339 |
);
|
| 340 |
|
| 365 |
wp_enqueue_script( 'wc-gateway-ppec-generate-cart', wc_gateway_ppec()->plugin_url . 'assets/js/wc-gateway-ppec-generate-cart.js', array( 'jquery' ), wc_gateway_ppec()->version, true );
|
| 366 |
wp_localize_script( 'wc-gateway-ppec-generate-cart', 'wc_ppec_generate_cart_context',
|
| 367 |
array(
|
| 368 |
+
'generate_cart_nonce' => wp_create_nonce( '_wc_ppec_generate_cart_nonce' ),
|
| 369 |
'ajaxurl' => WC_AJAX::get_endpoint( 'wc_ppec_generate_cart' ),
|
| 370 |
)
|
| 371 |
);
|
| 373 |
}
|
| 374 |
|
| 375 |
/**
|
| 376 |
+
* Creates a customer session if one is not already active.
|
| 377 |
*/
|
| 378 |
+
public function ensure_session() {
|
| 379 |
if ( ! WC()->session->has_session() ) {
|
| 380 |
WC()->session->set_customer_session_cookie( true );
|
| 381 |
}
|
|
|
|
|
|
|
| 382 |
}
|
| 383 |
|
| 384 |
/**
|
includes/class-wc-gateway-ppec-checkout-handler.php
CHANGED
|
@@ -438,6 +438,9 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
| 438 |
$session->payer_id = $payer_id;
|
| 439 |
$session->token = $token;
|
| 440 |
|
|
|
|
|
|
|
|
|
|
| 441 |
WC()->session->set( 'paypal', $session );
|
| 442 |
|
| 443 |
try {
|
|
@@ -476,6 +479,48 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
| 476 |
}
|
| 477 |
}
|
| 478 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
/**
|
| 480 |
* Maybe disable this or other gateways.
|
| 481 |
*
|
| 438 |
$session->payer_id = $payer_id;
|
| 439 |
$session->token = $token;
|
| 440 |
|
| 441 |
+
// Update customer addresses here from PayPal selection so they can be used to calculate local taxes.
|
| 442 |
+
$this->update_customer_addresses_from_paypal( $token );
|
| 443 |
+
|
| 444 |
WC()->session->set( 'paypal', $session );
|
| 445 |
|
| 446 |
try {
|
| 479 |
}
|
| 480 |
}
|
| 481 |
|
| 482 |
+
/**
|
| 483 |
+
* Updates shipping and billing addresses.
|
| 484 |
+
*
|
| 485 |
+
* Retrieves shipping and billing addresses from PayPal session.
|
| 486 |
+
* This should be done prior to generating order confirmation so
|
| 487 |
+
* local taxes can be calculated and displayed to customer.
|
| 488 |
+
*
|
| 489 |
+
* @since 1.6.2.
|
| 490 |
+
*
|
| 491 |
+
* @param string $token Token
|
| 492 |
+
*
|
| 493 |
+
* @return void
|
| 494 |
+
*/
|
| 495 |
+
private function update_customer_addresses_from_paypal( $token ) {
|
| 496 |
+
// Get the buyer details from PayPal.
|
| 497 |
+
try {
|
| 498 |
+
$checkout_details = $this->get_checkout_details( $token );
|
| 499 |
+
} catch ( PayPal_API_Exception $e ) {
|
| 500 |
+
wc_add_notice( $e->getMessage(), 'error' );
|
| 501 |
+
return;
|
| 502 |
+
}
|
| 503 |
+
$shipping_details = $this->get_mapped_shipping_address( $checkout_details );
|
| 504 |
+
$billing_details = $this->get_mapped_billing_address( $checkout_details );
|
| 505 |
+
|
| 506 |
+
$customer = WC()->customer;
|
| 507 |
+
|
| 508 |
+
// Update billing/shipping addresses.
|
| 509 |
+
$customer->set_billing_address( $billing_details['address_1'] );
|
| 510 |
+
$customer->set_billing_address_2( $billing_details['address_2'] );
|
| 511 |
+
$customer->set_billing_city( $billing_details['city'] );
|
| 512 |
+
$customer->set_billing_postcode( $billing_details['postcode'] );
|
| 513 |
+
$customer->set_billing_state( $billing_details['state'] );
|
| 514 |
+
$customer->set_billing_country( $billing_details['country'] );
|
| 515 |
+
|
| 516 |
+
$customer->set_shipping_address( $shipping_details['address_1'] );
|
| 517 |
+
$customer->set_shipping_address_2( $shipping_details['address_2'] );
|
| 518 |
+
$customer->set_shipping_city( $shipping_details['city'] );
|
| 519 |
+
$customer->set_shipping_postcode( $shipping_details['postcode'] );
|
| 520 |
+
$customer->set_shipping_state( $shipping_details['state'] );
|
| 521 |
+
$customer->set_shipping_country( $shipping_details['country'] );
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
/**
|
| 525 |
* Maybe disable this or other gateways.
|
| 526 |
*
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy,
|
|
| 3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
|
| 4 |
Requires at least: 4.4
|
| 5 |
Tested up to: 4.9.6
|
| 6 |
-
Stable tag: 1.6.
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
|
@@ -101,6 +101,9 @@ Please use this to inform us about bugs, or make contributions via PRs.
|
|
| 101 |
|
| 102 |
== Changelog ==
|
| 103 |
|
|
|
|
|
|
|
|
|
|
| 104 |
= 1.6.1 - 2018-07-04 =
|
| 105 |
* Fix - GDPR Fatal error exporting user data when they have PPEC subscriptions.
|
| 106 |
* Fix - PayPal Credit still being disabled by default.
|
| 3 |
Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, store, sales, sell, shop, shopping, cart, checkout, configurable, paypal
|
| 4 |
Requires at least: 4.4
|
| 5 |
Tested up to: 4.9.6
|
| 6 |
+
Stable tag: 1.6.2
|
| 7 |
License: GPLv3
|
| 8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
| 9 |
|
| 101 |
|
| 102 |
== Changelog ==
|
| 103 |
|
| 104 |
+
= 1.6.2 - 2018-08-15 =
|
| 105 |
+
* Fix - Tax not applied on the (Confirm your PayPal order) page at the checkout.
|
| 106 |
+
|
| 107 |
= 1.6.1 - 2018-07-04 =
|
| 108 |
* Fix - GDPR Fatal error exporting user data when they have PPEC subscriptions.
|
| 109 |
* Fix - PayPal Credit still being disabled by default.
|
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: A payment gateway for PayPal Checkout (https://www.paypal.com/us/webapps/mpp/paypal-checkout).
|
| 6 |
-
* Version: 1.6.
|
| 7 |
* Author: WooCommerce
|
| 8 |
* Author URI: https://woocommerce.com
|
| 9 |
* Copyright: © 2018 WooCommerce / PayPal.
|
|
@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
| 27 |
exit; // Exit if accessed directly
|
| 28 |
}
|
| 29 |
|
| 30 |
-
define( 'WC_GATEWAY_PPEC_VERSION', '1.6.
|
| 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: A payment gateway for PayPal Checkout (https://www.paypal.com/us/webapps/mpp/paypal-checkout).
|
| 6 |
+
* Version: 1.6.2
|
| 7 |
* Author: WooCommerce
|
| 8 |
* Author URI: https://woocommerce.com
|
| 9 |
* Copyright: © 2018 WooCommerce / PayPal.
|
| 27 |
exit; // Exit if accessed directly
|
| 28 |
}
|
| 29 |
|
| 30 |
+
define( 'WC_GATEWAY_PPEC_VERSION', '1.6.2' );
|
| 31 |
|
| 32 |
/**
|
| 33 |
* Return instance of WC_Gateway_PPEC_Plugin.
|
