mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
Use continuation mode when APM does not redirect back
This commit is contained in:
parent
8a6437b558
commit
e29ef9c7d6
7 changed files with 105 additions and 16 deletions
|
@ -903,6 +903,12 @@ return array(
|
|||
'paylater' => _x( 'Pay Later', 'Name of payment method', 'woocommerce-paypal-payments' ),
|
||||
);
|
||||
},
|
||||
/**
|
||||
* The sources that do not cause issues about redirecting (on mobile, ...) and sometimes not returning back.
|
||||
*/
|
||||
'wcgateway.funding-sources-without-redirect' => static function( ContainerInterface $container ): array {
|
||||
return array( 'paypal', 'paylater', 'venmo', 'card' );
|
||||
},
|
||||
'wcgateway.settings.funding-sources' => static function( ContainerInterface $container ): array {
|
||||
return array_diff_key(
|
||||
$container->get( 'wcgateway.all-funding-sources' ),
|
||||
|
|
|
@ -13,6 +13,7 @@ use Exception;
|
|||
use Psr\Log\LoggerInterface;
|
||||
use WC_Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\OrderStatus;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentToken;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
|
@ -253,8 +254,13 @@ class PayPalGateway extends \WC_Payment_Gateway {
|
|||
|
||||
$funding_source = $this->session_handler->funding_source();
|
||||
if ( $funding_source ) {
|
||||
$this->title = $this->funding_source_renderer->render_name( $funding_source );
|
||||
$this->description = $this->funding_source_renderer->render_description( $funding_source );
|
||||
$order = $this->session_handler->order();
|
||||
if ( $order &&
|
||||
( $order->status()->is( OrderStatus::APPROVED ) || $order->status()->is( OrderStatus::COMPLETED ) )
|
||||
) {
|
||||
$this->title = $this->funding_source_renderer->render_name( $funding_source );
|
||||
$this->description = $this->funding_source_renderer->render_description( $funding_source );
|
||||
}
|
||||
}
|
||||
|
||||
$this->init_form_fields();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue