Skip to content

Subscriptions follow-up payments controller and missed schedule #188

@remcotolsma

Description

@remcotolsma

The subscriptions follow-up payments controller will only initiate follow-up payments for subscriptions where the next payment date is between now and 1 day ago:

/**
* Get query start date for subscriptions that require a follow-up payment.
*
* @return \DateTimeImmutable
* @throws \Exception Throws exception in case of error.
*/
private function get_follow_up_payment_query_start_date() {
return new \DateTimeImmutable( '-1 day', new \DateTimeZone( 'GMT' ) );
}
/**
* Get query end date for subscriptions that require a follow-up payment.
*
* @return \DateTimeImmutable
* @throws \Exception Throws exception in case of error.
*/
private function get_follow_up_payment_query_end_date() {
return new \DateTimeImmutable( 'now', new \DateTimeZone( 'GMT' ) );
}

Because this routine has to run every day, it should always work. However, there are situations where the routine does not run for a day or several days. For example, if a website is offline for a longer period of time due to a malfunction or something similar.

We cannot securely initiate payments for subscriptions with a next payment date in the past?

Subscriptions for which a follow-up payment has not been initiated on time remain active and administrators are not informed that there is a 'missed schedule'.

Should we introduce an extra controller that will put the 'missed schedule' subscriptions 'on hold'? By putting subscriptions with a next payment date that is more than 2 days in the past 'on hold'?

Or are there other options to better inform administrators about this?

CC @rvdsteege

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions