mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Remove code duplication
This commit is contained in:
parent
9db147679d
commit
fde0aae9a0
1 changed files with 3 additions and 11 deletions
|
@ -9,12 +9,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\Session\Cancellation;
|
||||
|
||||
use WooCommerce\PayPalCommerce\Button\Helper\ContextTrait;
|
||||
use WooCommerce\PayPalCommerce\Session\SessionHandler;
|
||||
|
||||
/**
|
||||
* Class CancelController
|
||||
*/
|
||||
class CancelController {
|
||||
use ContextTrait;
|
||||
|
||||
public const NONCE = 'ppcp-cancel';
|
||||
|
||||
|
@ -61,20 +63,10 @@ class CancelController {
|
|||
$this->session_handler->destroy_session_data();
|
||||
}
|
||||
|
||||
$order = $this->session_handler->order();
|
||||
if ( ! $order ) {
|
||||
if ( ! $this->is_paypal_continuation() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$source = $order->payment_source();
|
||||
if ( $source && $source->card() ) {
|
||||
return; // Ignore for DCC.
|
||||
}
|
||||
|
||||
if ( 'card' === $this->session_handler->funding_source() ) {
|
||||
return; // Ignore for card buttons.
|
||||
}
|
||||
|
||||
$url = add_query_arg( array( $param_name => wp_create_nonce( self::NONCE ) ), wc_get_checkout_url() );
|
||||
add_action(
|
||||
'woocommerce_review_order_after_submit',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue