Version Description
- Fix - Fatal Error calling is_main_query.
- Fix - Customer invoice email doesn't allow payment with PPEC.
- Fix - Double stock reduction.
- Fix - Payment automatically goes to complete when payment action set to Authorize.
Download this release
Release Info
Developer | bor0 |
Plugin | WooCommerce PayPal Express Checkout Payment Gateway |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.3.0
DEVELOPER.md
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# DEVELOPER.md
|
2 |
+
|
3 |
+
## Sandbox URLs
|
4 |
+
* Developer: https://developer.paypal.com/
|
5 |
+
|
6 |
+
## Setup
|
7 |
+
1. Make sure your store has set the country to US and is using US dollars (for easier testing).
|
8 |
+
2. Sign up for a PayPal account.
|
9 |
+
3. Go to "My Apps & Credentials" and create a REST API apps.
|
10 |
+
4. Use the information from step 4 information to fill in the settings: Sandbox API Username, Password, Signature.
|
11 |
+
5. Remember that your buyer email and facilitator email are automatically generated and are available in Sandbox > Accounts. Likewise, the store email must match the facilitator email.
|
includes/abstracts/abstract-wc-gateway-ppec-paypal-request-handler.php
CHANGED
@@ -85,9 +85,11 @@ abstract class WC_Gateway_PPEC_PayPal_Request_Handler {
|
|
85 |
protected function payment_on_hold( $order, $reason = '' ) {
|
86 |
$order->update_status( 'on-hold', $reason );
|
87 |
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
88 |
-
$order->
|
|
|
|
|
89 |
} else {
|
90 |
-
|
91 |
}
|
92 |
WC()->cart->empty_cart();
|
93 |
}
|
85 |
protected function payment_on_hold( $order, $reason = '' ) {
|
86 |
$order->update_status( 'on-hold', $reason );
|
87 |
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
88 |
+
if ( ! get_post_meta( $order->id, '_order_stock_reduced', true ) ) {
|
89 |
+
$order->reduce_order_stock();
|
90 |
+
}
|
91 |
} else {
|
92 |
+
wc_maybe_reduce_stock_levels( $order->get_id() );
|
93 |
}
|
94 |
WC()->cart->empty_cart();
|
95 |
}
|
includes/class-wc-gateway-ppec-checkout-handler.php
CHANGED
@@ -70,7 +70,7 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
70 |
* @return string
|
71 |
*/
|
72 |
public function endpoint_page_titles( $title ) {
|
73 |
-
if ( is_main_query() && in_the_loop() && is_page() && is_checkout() && $this->has_active_session() ) {
|
74 |
$title = __( 'Confirm your PayPal order', 'woocommerce-gateway-paypal-express-checkout' );
|
75 |
remove_filter( 'the_title', array( $this, 'endpoint_page_titles' ) );
|
76 |
}
|
@@ -445,8 +445,9 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
445 |
unset( $gateways['ppec_paypal'] );
|
446 |
}
|
447 |
|
448 |
-
// If the cart total is zero (e.g. because of a coupon), don't allow this gateway
|
449 |
-
if
|
|
|
450 |
if ( isset( $gateways['ppec_paypal'] ) && ( 0 >= WC()->cart->total ) ) {
|
451 |
unset( $gateways['ppec_paypal'] );
|
452 |
}
|
@@ -841,9 +842,11 @@ class WC_Gateway_PPEC_Checkout_Handler {
|
|
841 |
$order->update_status( 'on-hold', sprintf( __( 'Payment pending (%s).', 'woocommerce-gateway-paypal-express-checkout' ), $payment->pending_reason ) );
|
842 |
}
|
843 |
if ( $old_wc ) {
|
844 |
-
$order->
|
|
|
|
|
845 |
} else {
|
846 |
-
|
847 |
}
|
848 |
}
|
849 |
}
|
70 |
* @return string
|
71 |
*/
|
72 |
public function endpoint_page_titles( $title ) {
|
73 |
+
if ( ! is_admin() && is_main_query() && in_the_loop() && is_page() && is_checkout() && $this->has_active_session() ) {
|
74 |
$title = __( 'Confirm your PayPal order', 'woocommerce-gateway-paypal-express-checkout' );
|
75 |
remove_filter( 'the_title', array( $this, 'endpoint_page_titles' ) );
|
76 |
}
|
445 |
unset( $gateways['ppec_paypal'] );
|
446 |
}
|
447 |
|
448 |
+
// If the cart total is zero (e.g. because of a coupon), don't allow this gateway.
|
449 |
+
// We do this only if we're on the checkout page (is_checkout), but not on the order-pay page (is_checkout_pay_page)
|
450 |
+
if ( is_cart() || ( is_checkout() && ! is_checkout_pay_page() ) ) {
|
451 |
if ( isset( $gateways['ppec_paypal'] ) && ( 0 >= WC()->cart->total ) ) {
|
452 |
unset( $gateways['ppec_paypal'] );
|
453 |
}
|
842 |
$order->update_status( 'on-hold', sprintf( __( 'Payment pending (%s).', 'woocommerce-gateway-paypal-express-checkout' ), $payment->pending_reason ) );
|
843 |
}
|
844 |
if ( $old_wc ) {
|
845 |
+
if ( ! get_post_meta( $order->id, '_order_stock_reduced', true ) ) {
|
846 |
+
$order->reduce_order_stock();
|
847 |
+
}
|
848 |
} else {
|
849 |
+
wc_maybe_reduce_stock_levels( $order->get_id() );
|
850 |
}
|
851 |
}
|
852 |
}
|
includes/class-wc-gateway-ppec-ipn-handler.php
CHANGED
@@ -97,7 +97,7 @@ class WC_Gateway_PPEC_IPN_Handler extends WC_Gateway_PPEC_PayPal_Request_Handler
|
|
97 |
$posted_data['payment_status'] = strtolower( $posted_data['payment_status'] );
|
98 |
|
99 |
// Sandbox fix.
|
100 |
-
if ( isset( $posted_data['test_ipn'] ) && 1 == $posted_data['test_ipn'] && 'pending' == $posted_data['payment_status'] ) {
|
101 |
$posted_data['payment_status'] = 'completed';
|
102 |
}
|
103 |
|
97 |
$posted_data['payment_status'] = strtolower( $posted_data['payment_status'] );
|
98 |
|
99 |
// Sandbox fix.
|
100 |
+
if ( ( empty( $posted_data['pending_reason'] ) || 'authorization' !== $posted_data['pending_reason'] ) && isset( $posted_data['test_ipn'] ) && 1 == $posted_data['test_ipn'] && 'pending' == $posted_data['payment_status'] ) {
|
101 |
$posted_data['payment_status'] = 'completed';
|
102 |
}
|
103 |
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring
|
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.
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
@@ -85,6 +85,12 @@ https://gist.github.com/mikejolley/ad2ecc286c9ad6cefbb7065ba6dfef48
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
= 1.2.1 =
|
89 |
* Fix - Avoid plugin links notice when WooCommerce is not active - props rellect
|
90 |
* Fix - Do not show this gateway when the cart amount is zero
|
2 |
Contributors: automattic, woothemes, akeda, dwainm, royho, allendav, slash1andy, woosteve, spraveenitpro, mikedmoore, fernashes, shellbeezy, danieldudzic, mikaey, fullysupportedphil, dsmithweb, corsonr, bor0, zandyring
|
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.7
|
6 |
+
Stable tag: 1.3.0
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
|
85 |
|
86 |
== Changelog ==
|
87 |
|
88 |
+
= 1.3.0 =
|
89 |
+
* Fix - Fatal Error calling is_main_query.
|
90 |
+
* Fix - Customer invoice email doesn't allow payment with PPEC.
|
91 |
+
* Fix - Double stock reduction.
|
92 |
+
* Fix - Payment automatically goes to complete when payment action set to Authorize.
|
93 |
+
|
94 |
= 1.2.1 =
|
95 |
* Fix - Avoid plugin links notice when WooCommerce is not active - props rellect
|
96 |
* Fix - Do not show this gateway when the cart amount is zero
|
woocommerce-gateway-paypal-express-checkout.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WooCommerce PayPal Express Checkout Gateway
|
4 |
* Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
|
5 |
* Description: A payment gateway for PayPal Express Checkout (https://www.paypal.com/us/webapps/mpp/express-checkout).
|
6 |
-
* Version: 1.
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com
|
9 |
* Copyright: © 2017 WooCommerce / PayPal.
|
@@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
25 |
exit; // Exit if accessed directly
|
26 |
}
|
27 |
|
28 |
-
define( 'WC_GATEWAY_PPEC_VERSION', '1.
|
29 |
|
30 |
/**
|
31 |
* Return instance of WC_Gateway_PPEC_Plugin.
|
3 |
* Plugin Name: WooCommerce PayPal Express Checkout Gateway
|
4 |
* Plugin URI: https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/
|
5 |
* Description: A payment gateway for PayPal Express Checkout (https://www.paypal.com/us/webapps/mpp/express-checkout).
|
6 |
+
* Version: 1.3.0
|
7 |
* Author: WooCommerce
|
8 |
* Author URI: https://woocommerce.com
|
9 |
* Copyright: © 2017 WooCommerce / PayPal.
|
25 |
exit; // Exit if accessed directly
|
26 |
}
|
27 |
|
28 |
+
define( 'WC_GATEWAY_PPEC_VERSION', '1.3.0' );
|
29 |
|
30 |
/**
|
31 |
* Return instance of WC_Gateway_PPEC_Plugin.
|