Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.6.0-b2
-
Component/s: None
-
Labels:None
Description
Currently, when a service renewal fails, the only thing that happens is that a staff notice is sent (which has to be subscribed to and is often overlooked by users). No reattempt to provision is made.
We should use the service_invoices table for this but it needs some cleaning and updating.
Migration
Record meeting either the following criteria should be removed from the service_invoices table:
- The linked invoices.date_closed < log_cron.date_started for the latest run of process_renewing_services
- The linked services.date_last_renewed === null
Two columns should be added to the service_invoices table
- failed_attempts INT(10) UNSIGNED NOT NULL DEFAULT 0
- maximum_attempts INT(10) UNSIGNED NOT NULL DEFAULT 1
A company setting should be created service_renewal_attempts and defaulted to 24
Setting
Add a company setting "Service Renewal Attempt" in "Invoice and Charge Options" (for now) just under "Auto Debit Attempts" as a numeric input.
When a service_invoices record is inserted, maximum_attempts should be set to service_renewal_attempts
Cron
Services::getAllRenewablePaid() should be updated to ignore the date filter. It should then be updated to only fetch records whose failed_attempts < maximum_attempts.
Services::renew() should be updated to increment service_invoices.failed_attempts on a failed attempt.
Other
ServiceInvoice records should not be added when a service is created, only when one is renewed.
Invoices::createFromServices() needs to be updated to only add ServiceInvoice records if the services are being renewed.
Invoices::appendServices() should not add a ServiceInvoice record.