mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Do not delay scheduled action when subscription behavior is capture auth
This commit is contained in:
parent
ac31130649
commit
b1a49a9af1
3 changed files with 6 additions and 5 deletions
|
@ -148,7 +148,7 @@ class PaymentTokenChecker {
|
||||||
$subscription->set_requires_manual_renewal( true );
|
$subscription->set_requires_manual_renewal( true );
|
||||||
$subscription->save();
|
$subscription->save();
|
||||||
|
|
||||||
$message = __( 'Subscription set to Manual Renewal because the payment method could not be saved at PayPal', 'woocommerce-paypal-payments' );
|
$message = __( 'Subscription set to Manual Renewal because payment method was not saved at PayPal.', 'woocommerce-paypal-payments' );
|
||||||
$wc_order->add_order_note( $message );
|
$wc_order->add_order_note( $message );
|
||||||
|
|
||||||
} catch ( Exception $exception ) {
|
} catch ( Exception $exception ) {
|
||||||
|
@ -197,7 +197,7 @@ class PaymentTokenChecker {
|
||||||
* @param WC_Order $wc_order The WC order.
|
* @param WC_Order $wc_order The WC order.
|
||||||
*/
|
*/
|
||||||
private function update_failed_status( WC_Order $wc_order ): void {
|
private function update_failed_status( WC_Order $wc_order ): void {
|
||||||
$error_message = __( 'Subscription payment failed because the payment method could not be saved at PayPal. Contact PayPal MTS for guidance.', 'woocommerce-paypal-payments' );
|
$error_message = __( 'Subscription payment failed. Payment method was not saved at PayPal.', 'woocommerce-paypal-payments' );
|
||||||
$wc_order->update_status( 'failed', $error_message );
|
$wc_order->update_status( 'failed', $error_message );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -197,7 +197,7 @@ class VaultingModule implements ModuleInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $subscription_behavior_when_vault_fails === 'capture_auth' ) {
|
if ( $subscription_behavior_when_vault_fails === 'capture_auth' ) {
|
||||||
echo wp_kses_post( '<p>' . __( 'Subscription set to Manual Renewal because the payment method could not be saved. To enable automatic renewal payments, please try a different payment method.', 'woocommerce-paypal-payments' ) . '</p>' );
|
echo wp_kses_post( '<p>' . __( 'The subscription has been activated but the payment method could not be saved. Please try again with a different payment method to allow automatic renewal payments.', 'woocommerce-paypal-payments' ) . '</p>' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,15 +53,16 @@ trait ProcessPaymentTrait {
|
||||||
* @param int $customer_id The customer ID.
|
* @param int $customer_id The customer ID.
|
||||||
*/
|
*/
|
||||||
protected function schedule_saved_payment_check( int $wc_order_id, int $customer_id ): void {
|
protected function schedule_saved_payment_check( int $wc_order_id, int $customer_id ): void {
|
||||||
|
$timestamp = 1 * MINUTE_IN_SECONDS;
|
||||||
if (
|
if (
|
||||||
$this->config->has( 'subscription_behavior_when_vault_fails' )
|
$this->config->has( 'subscription_behavior_when_vault_fails' )
|
||||||
&& $this->config->get( 'subscription_behavior_when_vault_fails' ) === 'capture_auth'
|
&& $this->config->get( 'subscription_behavior_when_vault_fails' ) === 'capture_auth'
|
||||||
) {
|
) {
|
||||||
return;
|
$timestamp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
as_schedule_single_action(
|
as_schedule_single_action(
|
||||||
time() + ( 1 * MINUTE_IN_SECONDS ),
|
time() + $timestamp,
|
||||||
'woocommerce_paypal_payments_check_saved_payment',
|
'woocommerce_paypal_payments_check_saved_payment',
|
||||||
array(
|
array(
|
||||||
'order_id' => $wc_order_id,
|
'order_id' => $wc_order_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue