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

Add option to disable `pronamic_pay_update_subscription_payments` schedule event? #221

Closed remcotolsma closed 2 years ago

remcotolsma commented 2 years ago

I think @rvdsteege is already working on this.

rvdsteege commented 2 years ago

Indeed, added a setting in https://github.com/pronamic/wp-pay-core/commit/901ed772c4ce58a584b5a9ee61c4599d425dba90

Schermafbeelding 2021-09-30 om 14 38 38

Notes:

@remcotolsma questions:

  1. Do we want to completely remove/reschedule the event(s) if the setting gets updated? Or leave the scheduled event and only check the current setting status when the action is being called?
  2. Completing subscriptions should also be halted if the setting is disabled?
remcotolsma commented 2 years ago
  1. Do we want to completely remove/reschedule the event(s) if the setting gets updated? Or leave the scheduled event and only check the current setting status when the action is being called?

I think an early return is the easiest in terms of code?

  1. Completing subscriptions should also be halted if the setting is disabled?

Is that necessary if we want to prevent a test/staging environment from sending emails?

Enable processing of recurring payments

I'm still wondering if we should change 'Enable processing of recurring payments' to 'Disable processing of recurring payments', that might indicate more that it is enabled by default but that you have the option to disable it.

rvdsteege commented 2 years ago

Transformed to 'Disable starting recurring payments at gateway' setting in https://github.com/pronamic/wp-pay-core/commit/e1e0ce63eb3600145e8cab8edc913b800ac564c1

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

Is that necessary if we want to prevent a test/staging environment from sending emails?

It seems not, the SubscriptionsModule::complete_subscriptions() also checks if there is no _pronamic_subscription_next_payment meta. If processing is disabled, the subscriptions will still have their next payment date meta.

remcotolsma commented 2 years ago

Might be relevant: https://docs.woocommerce.com/document/subscriptions-handles-staging-sites/.