Merge pull request #1711 from woocommerce/PCP-2030-remove-payment-vaulted-checker

Remove payment vaulted checker functionality (2030)
This commit is contained in:
Emili Castells 2023-09-21 14:27:23 +02:00 committed by GitHub
commit 31f726155f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 344 additions and 2500 deletions

View file

@ -441,7 +441,7 @@ return array(
assert( $subscription_helper instanceof SubscriptionHelper );
$fields = array(
'checkout_settings_heading' => array(
'checkout_settings_heading' => array(
'heading' => __( 'Standard Payments Settings', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
@ -451,7 +451,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'title' => array(
'title' => array(
'title' => __( 'Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
'description' => __(
@ -467,7 +467,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'dcc_enabled' => array(
'dcc_enabled' => array(
'title' => __( 'Enable/Disable', 'woocommerce-paypal-payments' ),
'desc_tip' => true,
'description' => __( 'Once enabled, the Credit Card option will show up in the checkout.', 'woocommerce-paypal-payments' ),
@ -482,7 +482,7 @@ return array(
State::STATE_ONBOARDED,
),
),
'dcc_gateway_title' => array(
'dcc_gateway_title' => array(
'title' => __( 'Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
'description' => __(
@ -499,7 +499,7 @@ return array(
),
'gateway' => 'dcc',
),
'description' => array(
'description' => array(
'title' => __( 'Description', 'woocommerce-paypal-payments' ),
'type' => 'text',
'desc_tip' => true,
@ -518,7 +518,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'intent' => array(
'intent' => array(
'title' => __( 'Intent', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@ -540,7 +540,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'capture_on_status_change' => array(
'capture_on_status_change' => array(
'title' => __( 'Capture On Status Change', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'default' => false,
@ -557,7 +557,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'capture_for_virtual_only' => array(
'capture_for_virtual_only' => array(
'title' => __( 'Capture Virtual-Only Orders ', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'default' => false,
@ -574,7 +574,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'payee_preferred' => array(
'payee_preferred' => array(
'title' => __( 'Instant Payments ', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'default' => false,
@ -591,7 +591,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'brand_name' => array(
'brand_name' => array(
'title' => __( 'Brand Name', 'woocommerce-paypal-payments' ),
'type' => 'text',
'default' => get_bloginfo( 'name' ),
@ -607,7 +607,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'landing_page' => array(
'landing_page' => array(
'title' => __( 'Landing Page', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@ -629,7 +629,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'alternative_payment_methods' => array(
'alternative_payment_methods' => array(
'heading' => __( 'Alternative Payment Methods', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s, %2$s, %3$s and %4$s are a link tags.
@ -645,7 +645,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'disable_funding' => array(
'disable_funding' => array(
'title' => __( 'Disable Alternative Payment Methods', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-multiselect',
'class' => array(),
@ -669,7 +669,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'card_billing_data_mode' => array(
'card_billing_data_mode' => array(
'title' => __( 'Send checkout billing data to card fields', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@ -689,7 +689,7 @@ return array(
'requirements' => array(),
'gateway' => array( 'paypal', CardButtonGateway::ID ),
),
'allow_card_button_gateway' => array(
'allow_card_button_gateway' => array(
'title' => __( 'Create gateway for Standard Card Button', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'desc_tip' => true,
@ -703,7 +703,7 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'disable_cards' => array(
'disable_cards' => array(
'title' => __( 'Disable specific credit cards', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-multiselect',
'class' => array(),
@ -731,7 +731,7 @@ return array(
),
'gateway' => 'dcc',
),
'card_icons' => array(
'card_icons' => array(
'title' => __( 'Show logo of the following credit cards', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-multiselect',
'class' => array(),
@ -761,7 +761,7 @@ return array(
),
'gateway' => 'dcc',
),
'vault_enabled_dcc' => array(
'vault_enabled_dcc' => array(
'title' => __( 'Vaulting', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'desc_tip' => true,
@ -780,7 +780,7 @@ return array(
'gateway' => 'dcc',
'input_class' => $container->get( 'wcgateway.helper.vaulting-scope' ) ? array() : array( 'ppcp-disabled-checkbox' ),
),
'3d_secure_heading' => array(
'3d_secure_heading' => array(
'heading' => __( '3D Secure', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'description' => wp_kses_post(
@ -808,7 +808,7 @@ return array(
),
'gateway' => 'dcc',
),
'3d_secure_contingency' => array(
'3d_secure_contingency' => array(
'title' => __( 'Contingency for 3D Secure', 'woocommerce-paypal-payments' ),
'type' => 'select',
'description' => sprintf(
@ -836,7 +836,7 @@ return array(
),
'gateway' => 'dcc',
),
'paypal_saved_payments' => array(
'paypal_saved_payments' => array(
'heading' => __( 'Saved payments', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s, %2$s, %3$s and %4$s are a link tags.
@ -854,8 +854,8 @@ return array(
'requirements' => array(),
'gateway' => 'paypal',
),
'subscriptions_mode' => $container->get( 'wcgateway.settings.fields.subscriptions_mode' ),
'vault_enabled' => array(
'subscriptions_mode' => $container->get( 'wcgateway.settings.fields.subscriptions_mode' ),
'vault_enabled' => array(
'title' => __( 'Vaulting', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'desc_tip' => true,
@ -874,26 +874,6 @@ return array(
'gateway' => 'paypal',
'input_class' => $container->get( 'wcgateway.helper.vaulting-scope' ) ? array() : array( 'ppcp-disabled-checkbox' ),
),
'subscription_behavior_when_vault_fails' => array(
'title' => __( 'Subscription capture behavior if Vault fails', 'woocommerce-paypal-payments' ),
'type' => 'select',
'classes' => $subscription_helper->plugin_is_active() ? array() : array( 'hide' ),
'input_class' => array( 'wc-enhanced-select' ),
'default' => 'void_auth',
'desc_tip' => true,
'description' => __( 'By default, subscription payments are captured only when saving the payment method was successful. Without a saved payment method, automatic renewal payments are not possible.', 'woocommerce-paypal-payments' ),
'description_with_tip' => __( 'Determines whether authorized payments for subscription orders are captured or voided if there is no saved payment method. This only applies when the intent Capture is used for the subscription order.', 'woocommerce-paypal-payments' ),
'options' => array(
'void_auth' => __( 'Void authorization & fail the order/subscription', 'woocommerce-paypal-payments' ),
'capture_auth' => __( 'Capture authorized payment & set subscription to Manual Renewal', 'woocommerce-paypal-payments' ),
'capture_auth_ignore' => __( 'Capture authorized payment & disregard missing payment method', 'woocommerce-paypal-payments' ),
),
'screens' => array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => array( 'paypal' ),
),
);
if ( ! $subscription_helper->plugin_is_active() ) {

View file

@ -299,9 +299,7 @@ class CardButtonGateway extends \WC_Payment_Gateway {
);
}
if ( $this->subscription_helper->has_subscription( $order_id ) ) {
$this->schedule_saved_payment_check( $order_id, $wc_order->get_customer_id() );
}
do_action( 'woocommerce_paypal_payments_before_handle_payment_success', $wc_order );
return $this->handle_payment_success( $wc_order );
} catch ( PayPalApiException $error ) {

View file

@ -396,9 +396,7 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
);
}
if ( $this->subscription_helper->has_subscription( $order_id ) ) {
$this->schedule_saved_payment_check( $order_id, $wc_order->get_customer_id() );
}
do_action( 'woocommerce_paypal_payments_before_handle_payment_success', $wc_order );
return $this->handle_payment_success( $wc_order );
} catch ( PayPalApiException $error ) {

View file

@ -556,9 +556,7 @@ class PayPalGateway extends \WC_Payment_Gateway {
);
}
if ( $this->subscription_helper->has_subscription( $order_id ) ) {
$this->schedule_saved_payment_check( $order_id, $wc_order->get_customer_id() );
}
do_action( 'woocommerce_paypal_payments_before_handle_payment_success', $wc_order );
return $this->handle_payment_success( $wc_order );
} catch ( PayPalApiException $error ) {

View file

@ -33,32 +33,6 @@ trait ProcessPaymentTrait {
return false;
}
/**
* Scheduled the vaulted payment check.
*
* @param int $wc_order_id The WC order ID.
* @param int $customer_id The customer ID.
*/
protected function schedule_saved_payment_check( int $wc_order_id, int $customer_id ): void {
$timestamp = 3 * MINUTE_IN_SECONDS;
if (
$this->config->has( 'subscription_behavior_when_vault_fails' )
&& $this->config->get( 'subscription_behavior_when_vault_fails' ) === 'capture_auth'
) {
$timestamp = 0;
}
as_schedule_single_action(
time() + $timestamp,
'woocommerce_paypal_payments_check_saved_payment',
array(
'order_id' => $wc_order_id,
'customer_id' => $customer_id,
'intent' => $this->config->has( 'intent' ) ? $this->config->get( 'intent' ) : '',
)
);
}
/**
* Handles the payment failure.
*