Merge pull request #15402 from woocommerce/fix/ipn-authorization

Fix IPN authorization setting orders to completed automatically
This commit is contained in:
Mike Jolley 2017-06-05 13:24:33 +01:00 committed by GitHub
commit 6f4ce488e2
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ class WC_Gateway_Paypal_IPN_Handler extends WC_Gateway_Paypal_Response {
$posted['payment_status'] = strtolower( $posted['payment_status'] );
// Sandbox fix.
if ( isset( $posted['test_ipn'] ) && 1 == $posted['test_ipn'] && 'pending' == $posted['payment_status'] ) {
if ( ( empty( $posted['pending_reason'] ) || 'authorization' !== $posted['pending_reason'] ) && isset( $posted['test_ipn'] ) && 1 == $posted['test_ipn'] && 'pending' == $posted['payment_status'] ) {
$posted['payment_status'] = 'completed';
}