Commit 549de9c2 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Accelerate generation of the invoice

Call the API rather them wait for the alarm hourly alarm. This might update simulation as soon as possible once the Hosting Subscription is created.
parent cacfb8e0
......@@ -5,9 +5,16 @@ hosting_subscription = context.getAggregateValue()
# Don't request again if it is already requested.
if hosting_subscription is None:
context.SubscriptionRequest_processRequest()
hosting_subscription = context.getAggregateValue()
# Don't perform everything on the same transaction
return
if hosting_subscription is not None:
if hosting_subscription.getCausalityState() == "diverged":
# Call it as soon as possible
hosting_subscription.HostingSubscription_requestUpdateOpenSaleOrder()
instance = hosting_subscription.getPredecessorValue()
# This ensure that the user has a valid cloud contract.
......
......@@ -465,6 +465,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
# The alarms might be called multiple times for move each step
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
return subscription_request
def checkSubscriptionDeploymentAndSimulation(self, default_email_text, subscription_server):
......@@ -487,10 +491,6 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
# the confirmation of the new Payment.
self.checkRelatedInstance(subscription_request)
# check the Open Sale Order coverage
self.stepCallSlaposRequestUpdateHostingSubscriptionOpenSaleOrderAlarm()
self.tic()
# generate simulation for open order
self.stepCallUpdateOpenOrderSimulationAlarm()
self.tic()
......@@ -591,7 +591,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm()
self.tic()
# If there is something unbuild recall alarm.
if len(builder.OrderBuilder_generateUnrelatedInvoiceList()):
if not len(builder.OrderBuilder_generateUnrelatedInvoiceList()):
break
# start the payzen payment
......@@ -615,6 +615,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
# The alarms might be called multiple times for move each step
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
for subscription_request in subscription_request_list:
# Check if instance was already allocated, in this case, it shouldn't
# until the allocation alarm kicks in.
......@@ -654,8 +658,8 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.checkRelatedInstance(subscription_request)
# check the Open Sale Order coverage
self.stepCallSlaposRequestUpdateHostingSubscriptionOpenSaleOrderAlarm()
self.tic()
#self.stepCallSlaposRequestUpdateHostingSubscriptionOpenSaleOrderAlarm()
#self.tic()
# generate simulation for open order
self.stepCallUpdateOpenOrderSimulationAlarm()
......@@ -757,7 +761,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm()
self.tic()
# If there is something unbuild recall alarm.
if len(builder.OrderBuilder_generateUnrelatedInvoiceList()):
if not len(builder.OrderBuilder_generateUnrelatedInvoiceList()):
break
# start the payzen payment
......@@ -781,6 +785,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
# The alarms might be called multiple times for move each step
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
for subscription_request in subscription_request_list:
# Check if instance was already allocated, in this case, it shouldn't
# until the allocation alarm kicks in.
......@@ -865,6 +873,10 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
# The alarms might be called multiple times for move each step
self.stepCallSlaposSubscriptionRequestProcessOrderedAlarm()
self.tic()
self.checkSubscriptionDeploymentAndSimulation(
default_email_text, subscription_server)
......
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