Commit 5927449b authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Readjust days to delay for trigger next escalation days

    - Invoice is generated 15 days before next period and a RR is created
   - 15 later a stop warning is sent (or when invoice expires)
   - 7 days later all instances are stopped if RR still open
    - 5 days after the user is informed his instances will be removed if payment is not done
    - 10 days after ALL his instances will be removed (for safety, as instances can be scaled faster if needed)

So, we assume:

   User is informed 22 days in advance before his instances stop to work, and if nothing is done 15 after (or 37 days after the first request to pay), we just remove all.
parent f14d5aa9
......@@ -20,7 +20,7 @@ for payment in person.Person_getSubscriptionRequestFirstUnpaidPaymentList():
# It can't be smaller, we are considernig all open invoices are from unpaid_payment_amount
if round(float(outstanding_amount), 2) == round(-float(unpaid_payment_amount), 2):
context.invalidate(comment="Automatically disabled as balance is %s" % person.Entity_statOutstandingAmount())
return
if (int(outstanding_amount) > 0):
return
......
......@@ -19,10 +19,10 @@ else:
body = notification_message.convert(format='text')[1]
return context.RegularisationRequest_checkToTriggerNextEscalationStep(
38,
'service_module/slapos_crm_acknowledgement',
'service_module/slapos_crm_stop_reminder',
subject,
body,
'Stopping reminder.',
delay_period_in_days=15,
current_service_relative_url='service_module/slapos_crm_acknowledgement',
next_service_relative_url='service_module/slapos_crm_stop_reminder',
title=subject,
text_content=body,
comment='Stopping reminder.',
)
......@@ -18,10 +18,10 @@ else:
body = notification_message.convert(format='text')[1]
return context.RegularisationRequest_checkToTriggerNextEscalationStep(
2,
'service_module/slapos_crm_delete_reminder',
'service_module/slapos_crm_delete_acknowledgement',
subject,
body,
'Deleting acknowledgment.',
delay_period_in_days=10,
current_service_relative_url='service_module/slapos_crm_delete_reminder',
next_service_relative_url='service_module/slapos_crm_delete_acknowledgement',
title=subject,
text_content=body,
comment='Deleting acknowledgment.',
)
......@@ -18,10 +18,10 @@ else:
body = notification_message.convert(format='text')[1]
return context.RegularisationRequest_checkToTriggerNextEscalationStep(
13,
'service_module/slapos_crm_stop_acknowledgement',
'service_module/slapos_crm_delete_reminder',
subject,
body,
'Deleting reminder.',
delay_period_in_days=7,
current_service_relative_url='service_module/slapos_crm_stop_acknowledgement',
next_service_relative_url='service_module/slapos_crm_delete_reminder',
title=subject,
text_content=body,
comment='Deleting reminder.',
)
......@@ -18,10 +18,10 @@ else:
body = notification_message.convert(format='text')[1]
return context.RegularisationRequest_checkToTriggerNextEscalationStep(
7,
'service_module/slapos_crm_stop_reminder',
'service_module/slapos_crm_stop_acknowledgement',
subject,
body,
'Stopping acknowledgment.',
delay_period_in_days=7,
current_service_relative_url='service_module/slapos_crm_stop_reminder',
next_service_relative_url='service_module/slapos_crm_stop_acknowledgement',
title=subject,
text_content=body,
comment='Stopping acknowledgment.',
)
......@@ -823,18 +823,18 @@ class TestSlapOSRegularisationRequest_triggerAcknowledgmentEscalation(
REQUEST={})
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_matching_event(self):
ticket = self.createRegularisationRequest()
ticket.RegularisationRequest_triggerAcknowledgmentEscalation()
self.assertEqual(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s' % \
(38,
(15,
'service_module/slapos_crm_acknowledgement',
'service_module/slapos_crm_stop_reminder',
'Reminder: invoice payment requested',
......@@ -855,11 +855,11 @@ The slapos team
'return context.restrictedTraverse(' \
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])')
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_notification_message(self):
ticket = self.createRegularisationRequest()
new_id = self.generateNewId()
......@@ -876,7 +876,7 @@ The slapos team
self.assertEqual(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s' % \
(38,
(15,
'service_module/slapos_crm_acknowledgement',
'service_module/slapos_crm_stop_reminder',
'Test NM title %s' % new_id,
......@@ -895,11 +895,11 @@ class TestSlapOSRegularisationRequest_triggerStopReminderEscalation(
REQUEST={})
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_matching_event(self):
ticket = self.createRegularisationRequest()
ticket.RegularisationRequest_triggerStopReminderEscalation()
......@@ -927,11 +927,11 @@ The slapos team
'return context.restrictedTraverse(' \
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])')
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_notification_message(self):
ticket = self.createRegularisationRequest()
new_id = self.generateNewId()
......@@ -967,18 +967,18 @@ class TestSlapOSRegularisationRequest_triggerStopAcknowledgmentEscalation(
REQUEST={})
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_matching_event(self):
ticket = self.createRegularisationRequest()
ticket.RegularisationRequest_triggerStopAcknowledgmentEscalation()
self.assertEqual(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s' % \
(13,
(7,
'service_module/slapos_crm_stop_acknowledgement',
'service_module/slapos_crm_delete_reminder',
'Last reminder: invoice payment requested',
......@@ -999,11 +999,11 @@ The slapos team
'return context.restrictedTraverse(' \
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])')
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_notification_message(self):
ticket = self.createRegularisationRequest()
new_id = self.generateNewId()
......@@ -1020,7 +1020,7 @@ The slapos team
self.assertEqual(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s' % \
(13,
(7,
'service_module/slapos_crm_stop_acknowledgement',
'service_module/slapos_crm_delete_reminder',
'Test NM title %s' % new_id,
......@@ -1039,18 +1039,18 @@ class TestSlapOSRegularisationRequest_triggerDeleteReminderEscalation(
REQUEST={})
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_matching_event(self):
ticket = self.createRegularisationRequest()
ticket.RegularisationRequest_triggerDeleteReminderEscalation()
self.assertEqual(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s' % \
(2,
(10,
'service_module/slapos_crm_delete_reminder',
'service_module/slapos_crm_delete_acknowledgement',
'Acknowledgment: instances deleted',
......@@ -1071,11 +1071,11 @@ The slapos team
'return context.restrictedTraverse(' \
'context.REQUEST["test_checkToTriggerNextEscalationStep_notification_message"])')
@simulate('RegularisationRequest_checkToTriggerNextEscalationStep',
'day, current, next, title, text_content, comment, REQUEST=None',
'delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s" % (day, current, next, title, text_content, comment))')
'%s %s %s %s %s %s" % (delay_period_in_days, current_service_relative_url, next_service_relative_url, title, text_content, comment))')
def test_checkToTriggerNextEscalationStep_notification_message(self):
ticket = self.createRegularisationRequest()
new_id = self.generateNewId()
......@@ -1092,7 +1092,7 @@ The slapos team
self.assertEqual(
'Visited by RegularisationRequest_checkToTriggerNextEscalationStep ' \
'%s %s %s %s %s %s' % \
(2,
(10,
'service_module/slapos_crm_delete_reminder',
'service_module/slapos_crm_delete_acknowledgement',
'Test NM title %s' % new_id,
......
......@@ -490,7 +490,7 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
self.tic()
# escalate 1
self.trickCrmEvent('slapos_crm_acknowledgement', 38, public_reference)
self.trickCrmEvent('slapos_crm_acknowledgement', 15, public_reference)
self.stepCallSlaposCrmTriggerAcknowledgmentEscalationAlarm()
self.tic()
......@@ -505,12 +505,12 @@ class TestSlapOSDefaultCRMEscalation(DefaultScenarioMixin):
self.assertSubscriptionStopped(person)
# escalate 3
self.trickCrmEvent('slapos_crm_stop_acknowledgement', 13, public_reference)
self.trickCrmEvent('slapos_crm_stop_acknowledgement', 7, public_reference)
self.stepCallSlaposCrmTriggerStopAcknowledgmentEscalationAlarm()
self.tic()
# escalate 4
self.trickCrmEvent('slapos_crm_delete_reminder', 2, public_reference)
self.trickCrmEvent('slapos_crm_delete_reminder', 10, public_reference)
self.stepCallSlaposCrmTriggerDeleteReminderEscalationAlarm()
self.tic()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment