Commit 84dd197b authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_request_subscription: Follow up the standard

  We only expand by the end of the period, so we dont generate an invoice 15 days in advance anymore
parent 80ad0475
...@@ -897,8 +897,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -897,8 +897,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# Test if balance is bad now # Test if balance is bad now
subscriber = subscription_request.getDestinationSectionValue() subscriber = subscription_request.getDestinationSectionValue()
self.assertEqual(subscriber.Entity_statOutstandingAmount(at_date=DateTime()),
0.0)
if subscription_request.getPriceCurrency() == "currency_module/CNY": if subscription_request.getPriceCurrency() == "currency_module/CNY":
expected_individual_price_with_tax = self.expected_zh_individual_price_with_tax expected_individual_price_with_tax = self.expected_zh_individual_price_with_tax
...@@ -907,6 +906,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -907,6 +906,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
expected_amount = round(expected_individual_price_with_tax*sum([i.getQuantity(0) expected_amount = round(expected_individual_price_with_tax*sum([i.getQuantity(0)
for i in subscription_request_list]),2) for i in subscription_request_list]),2)
# We generate now after the debt is active
self.assertEqual(round(subscriber.Entity_statOutstandingAmount(at_date=DateTime()), 2), expected_amount)
self.assertEqual(round(subscriber.Entity_statOutstandingAmount(), 2), expected_amount) self.assertEqual(round(subscriber.Entity_statOutstandingAmount(), 2), expected_amount)
# Invoice to Pay # Invoice to Pay
...@@ -1805,7 +1806,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1805,7 +1806,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.assertEqual(instance_tree.getPeriodicityMonthDay(), self.assertEqual(instance_tree.getPeriodicityMonthDay(),
min(DateTime().day(), 28)) min(DateTime().day(), 28))
self.pinDateTime(DateTime(DateTime().asdatetime() + datetime.timedelta(days=17))) self.pinDateTime(DateTime(DateTime().asdatetime() + datetime.timedelta(days=32)))
self.addCleanup(self.unpinDateTime) self.addCleanup(self.unpinDateTime)
self._checkSecondMonthSimulation(subscription_request_list, self._checkSecondMonthSimulation(subscription_request_list,
......
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