Commit 6d9c9bf3 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting&subscription_request: Invoice a single month rather them 3 upfront.

parent aa3d8cc5
Pipeline #9290 failed with stage
in 0 seconds
...@@ -163,8 +163,11 @@ if (add_line_list): ...@@ -163,8 +163,11 @@ if (add_line_list):
edit_kw['price'] = subscription_request.getPrice() edit_kw['price'] = subscription_request.getPrice()
edit_kw['price_currency'] = subscription_request.getPriceCurrency() edit_kw['price_currency'] = subscription_request.getPriceCurrency()
# While create move the start date to be at least 1 months # While create move the start date to be at least 1 months
# So we can charge 3 months at once. # So we can charge 3 months at once
start_date_delta = 65 # You can increase 65 days to generate 3 months
# You can increase 32 days to generate 2 months
# You can increase 0 days to keep generating one month only
start_date_delta = 0
open_sale_order_line.edit( open_sale_order_line.edit(
activate_kw=activate_kw, activate_kw=activate_kw,
......
...@@ -223,9 +223,9 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -223,9 +223,9 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.login() self.login()
# 195 is the month payment # 195 is the month payment
# 195*3 is the 3 months to pay upfront to use. # 195*1 is the 1 months to pay upfront to use.
# 25 is the reservation fee deduction. # 25 is the reservation fee deduction.
authAmount = (int(self.expected_individual_price_with_tax*100)*3-2500)*quantity authAmount = (int(self.expected_individual_price_with_tax*100)*1-2500)*quantity
data_kw = { data_kw = {
'errorCode': '0', 'errorCode': '0',
'transactionStatus': '6', 'transactionStatus': '6',
...@@ -350,11 +350,11 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -350,11 +350,11 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
quantity = subscription_request.getQuantity() quantity = subscription_request.getQuantity()
# The values are without tax # The values are without tax
self.assertEqual(sale_packing_list_line.getQuantity(), 3*quantity) self.assertEqual(sale_packing_list_line.getQuantity(), 1*quantity)
self.assertEqual(sale_packing_list_line.getPrice(), self.assertEqual(round(sale_packing_list_line.getPrice(), 2),
self.expected_individual_price_without_tax) round(self.expected_individual_price_without_tax, 2))
self.assertEqual(round(sale_packing_list_line.getTotalPrice(), 2), self.assertEqual(round(sale_packing_list_line.getTotalPrice(), 2),
3*self.expected_individual_price_without_tax*quantity) round(1*self.expected_individual_price_without_tax*quantity, 2))
self.assertEqual(sale_packing_list.getCausality(), self.assertEqual(sale_packing_list.getCausality(),
subscription_request.getRelativeUrl()) subscription_request.getRelativeUrl())
...@@ -523,7 +523,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -523,7 +523,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.checkAggregatedSalePackingList(subscription_request, sale_packing_list_list[0]) self.checkAggregatedSalePackingList(subscription_request, sale_packing_list_list[0])
expected_sale_packing_list_amount = len(subscription_request_list) * 3 expected_sale_packing_list_amount = len(subscription_request_list) * 1
self.assertEqual(expected_sale_packing_list_amount, self.assertEqual(expected_sale_packing_list_amount,
len(self.getSubscriptionSalePackingList(subscription_request))) len(self.getSubscriptionSalePackingList(subscription_request)))
...@@ -689,7 +689,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -689,7 +689,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self.checkAggregatedSalePackingList(subscription_request, sale_packing_list_list[0]) self.checkAggregatedSalePackingList(subscription_request, sale_packing_list_list[0])
expected_sale_packing_list_amount = len(subscription_request_list) * 3 expected_sale_packing_list_amount = len(subscription_request_list) * 1
self.assertEqual(expected_sale_packing_list_amount, self.assertEqual(expected_sale_packing_list_amount,
len(self.getSubscriptionSalePackingList(subscription_request))) len(self.getSubscriptionSalePackingList(subscription_request)))
......
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