pronamic / wp-pronamic-pay

The Pronamic Pay plugin allows you to easily accept payments with payment methods like credit card, iDEAL, Bancontact and Sofort through a variety of payment providers on your WordPress website.
https://pronamicpay.com
34 stars 14 forks source link

Schedule single event for each follow-up payment? #220

Closed remcotolsma closed 2 years ago

remcotolsma commented 2 years ago

Option 2 - One global daily schedule event that schedules single events for each follow-up payment

Note that scheduling an event to occur within 10 minutes of an existing event with the same action hook will be ignored unless you pass unique $args values for each scheduled event.

https://developer.wordpress.org/reference/functions/wp_schedule_single_event/

The advantage of this may also be that if a follow-up payment cannot be started at the gateway, we can reschedule the single event. I'm not exactly sure what WordPress does with events that throw an exception. It might not be watertight yet, but this option might solve some issues.

Originally posted by @remcotolsma in https://github.com/pronamic/wp-pronamic-pay/issues/212#issuecomment-929909849

rvdsteege commented 2 years ago

In the query via SubscriptionsModule::process_subscriptions_follow_up_payment() we now also check if there is no event scheduled yet: