Merge branch 'trunk' of github.com:woocommerce/woocommerce-paypal-payments into bug/fix-project-configuration

This commit is contained in:
dinamiko 2021-10-13 10:55:38 +02:00
commit f405778bdc
8 changed files with 82 additions and 13 deletions

View file

@ -1,5 +1,12 @@
*** Changelog ***
= 1.6.1 - 2021-10-12 =
* Fix - Handle authorization capture failures #312
* Fix - Handle denied payment authorization #302
* Fix - Handle failed authorizations when capturing order #303
* Fix - Transactions cannot be voided #293
* Fix - Fatal error: get_3ds_contingency() #310
= 1.6.0 - 2021-09-29 =
* Add - Webhook status. #246 #273
* Add - Show CC gateway in admin payments list. #236

View file

@ -47,10 +47,25 @@ class AuthorizationStatusDetails {
/**
* Returns the reason explaining authorization status.
* One of AuthorizationStatusDetails constants.
*
* @return string
*/
public function reason(): string {
return $this->reason;
}
/**
* Returns the human-readable reason text explaining authorization status.
*
* @return string
*/
public function text(): string {
switch ( $this->reason ) {
case self::PENDING_REVIEW:
return __( 'Authorization is pending manual review.', 'woocommerce-paypal-payments' );
default:
return $this->reason;
}
}
}

View file

@ -25,7 +25,7 @@ class CaptureStatusDetails {
const RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION = 'RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION';
const REFUNDED = 'REFUNDED';
const TRANSACTION_APPROVED_AWAITING_FUNDING = 'TRANSACTION_APPROVED_AWAITING_FUNDING';
const UNILATERAL = 'REFUNDED';
const UNILATERAL = 'UNILATERAL';
const VERIFICATION_REQUIRED = 'VERIFICATION_REQUIRED';
/**
@ -57,10 +57,45 @@ class CaptureStatusDetails {
/**
* Returns the reason explaining capture status.
* One of CaptureStatusDetails constants.
*
* @return string
*/
public function reason(): string {
return $this->reason;
}
/**
* Returns the human-readable reason text explaining capture status.
*
* @return string
*/
public function text(): string {
switch ( $this->reason ) {
case self::BUYER_COMPLAINT:
return __( 'The payer initiated a dispute for this captured payment with PayPal.', 'woocommerce-paypal-payments' );
case self::CHARGEBACK:
return __( 'The captured funds were reversed in response to the payer disputing this captured payment with the issuer of the financial instrument used to pay for this captured payment.', 'woocommerce-paypal-payments' );
case self::ECHECK:
return __( 'The payer paid by an eCheck that has not yet cleared.', 'woocommerce-paypal-payments' );
case self::INTERNATIONAL_WITHDRAWAL:
return __( 'Visit your online account. In your Account Overview, accept and deny this payment.', 'woocommerce-paypal-payments' );
case self::OTHER:
return __( 'No additional specific reason can be provided. For more information about this captured payment, visit your account online or contact PayPal.', 'woocommerce-paypal-payments' );
case self::PENDING_REVIEW:
return __( 'The captured payment is pending manual review.', 'woocommerce-paypal-payments' );
case self::RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION:
return __( 'The payee has not yet set up appropriate receiving preferences for their account. For more information about how to accept or deny this payment, visit your account online. This reason is typically offered in scenarios such as when the currency of the captured payment is different from the primary holding currency of the payee.', 'woocommerce-paypal-payments' );
case self::REFUNDED:
return __( 'The captured funds were refunded.', 'woocommerce-paypal-payments' );
case self::TRANSACTION_APPROVED_AWAITING_FUNDING:
return __( 'The payer must send the funds for this captured payment. This code generally appears for manual EFTs.', 'woocommerce-paypal-payments' );
case self::UNILATERAL:
return __( 'The payee does not have a PayPal account.', 'woocommerce-paypal-payments' );
case self::VERIFICATION_REQUIRED:
return __( 'The payee\'s PayPal account is not verified.', 'woocommerce-paypal-payments' );
default:
return $this->reason;
}
}
}

View file

@ -9,6 +9,7 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\WcGateway\Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Entity\CaptureStatus;
use WooCommerce\PayPalCommerce\Onboarding\Environment;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\Session\SessionHandler;
@ -271,12 +272,16 @@ class PayPalGateway extends \WC_Payment_Gateway {
return false;
}
$this->handle_capture_status( end( $captures ), $wc_order );
$capture = end( $captures );
$this->handle_capture_status( $capture, $wc_order );
if ( AuthorizedPaymentsProcessor::SUCCESSFUL === $result_status ) {
$wc_order->add_order_note(
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
);
if ( $capture->status()->is( CaptureStatus::COMPLETED ) ) {
$wc_order->add_order_note(
__( 'Payment successfully captured.', 'woocommerce-paypal-payments' )
);
}
$wc_order->update_meta_data( self::CAPTURED_META_KEY, 'true' );
$wc_order->save();
return true;

View file

@ -56,7 +56,7 @@ trait PaymentsStatusHandlingTrait {
$status = $capture->status();
if ( $status->details() ) {
$this->add_status_details_note( $wc_order, $status->name(), $status->details()->reason() );
$this->add_status_details_note( $wc_order, $status->name(), $status->details()->text() );
}
switch ( $status->name() ) {
@ -96,7 +96,7 @@ trait PaymentsStatusHandlingTrait {
$status = $authorization->status();
if ( $status->details() ) {
$this->add_status_details_note( $wc_order, $status->name(), $status->details()->reason() );
$this->add_status_details_note( $wc_order, $status->name(), $status->details()->text() );
}
switch ( $status->name() ) {
@ -130,8 +130,8 @@ trait PaymentsStatusHandlingTrait {
): void {
$wc_order->add_order_note(
sprintf(
/* translators: %1$s - PENDING, DENIED, ... %2$s - PENDING_REVIEW, ... */
__( 'PayPal order payment is set to %1$s status, details: %2$s.', 'woocommerce-paypal-payments' ),
/* translators: %1$s - PENDING, DENIED, ... %2$s - text explaining the reason, ... */
__( 'PayPal order payment is set to %1$s status, details: %2$s', 'woocommerce-paypal-payments' ),
$status,
$reason
)

View file

@ -1,6 +1,6 @@
{
"name": "woocommerce-paypal-payments",
"version": "1.6.0",
"version": "1.6.1",
"description": "WooCommerce PayPal Payments",
"repository": "https://github.com/woocommerce/woocommerce-paypal-payments",
"license": "GPL-2.0",

View file

@ -4,7 +4,7 @@ Tags: woocommerce, paypal, payments, ecommerce, e-commerce, store, sales, sell,
Requires at least: 5.3
Tested up to: 5.8
Requires PHP: 7.1
Stable tag: 1.6.0
Stable tag: 1.6.1
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -81,6 +81,13 @@ Follow the steps below to connect the plugin to your PayPal account:
== Changelog ==
= 1.6.1 =
* Fix - Handle authorization capture failures #312
* Fix - Handle denied payment authorization #302
* Fix - Handle failed authorizations when capturing order #303
* Fix - Transactions cannot be voided #293
* Fix - Fatal error: get_3ds_contingency() #310
= 1.6.0 =
* Add - Webhook status. #246 #273
* Add - Show CC gateway in admin payments list. #236

View file

@ -3,13 +3,13 @@
* Plugin Name: WooCommerce PayPal Payments
* Plugin URI: https://woocommerce.com/products/woocommerce-paypal-payments/
* Description: PayPal's latest complete payments processing solution. Accept PayPal, Pay Later, credit/debit cards, alternative digital wallets local payment types and bank accounts. Turn on only PayPal options or process a full suite of payment methods. Enable global transaction with extensive currency and country coverage.
* Version: 1.6.0
* Version: 1.6.1
* Author: WooCommerce
* Author URI: https://woocommerce.com/
* License: GPL-2.0
* Requires PHP: 7.1
* WC requires at least: 3.9
* WC tested up to: 5.6
* WC tested up to: 5.7
* Text Domain: woocommerce-paypal-payments
*
* @package WooCommerce\PayPalCommerce