Do not delay scheduled action when subscription behavior is capture auth

This commit is contained in:
dinamiko 2022-08-16 15:55:13 +02:00
parent ac31130649
commit b1a49a9af1
3 changed files with 6 additions and 5 deletions

View file

@ -53,15 +53,16 @@ trait ProcessPaymentTrait {
* @param int $customer_id The customer ID.
*/
protected function schedule_saved_payment_check( int $wc_order_id, int $customer_id ): void {
$timestamp = 1 * MINUTE_IN_SECONDS;
if (
$this->config->has( 'subscription_behavior_when_vault_fails' )
&& $this->config->get( 'subscription_behavior_when_vault_fails' ) === 'capture_auth'
) {
return;
$timestamp = 0;
}
as_schedule_single_action(
time() + ( 1 * MINUTE_IN_SECONDS ),
time() + $timestamp,
'woocommerce_paypal_payments_check_saved_payment',
array(
'order_id' => $wc_order_id,