Commit c8c036f3 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Update default Price

parent 1bbea36a
Pipeline #15359 failed with stage
in 0 seconds
...@@ -25,19 +25,19 @@ class TestSlapOSSubscriptionCDNScenarioMixin(TestSlapOSSubscriptionScenarioMixin ...@@ -25,19 +25,19 @@ class TestSlapOSSubscriptionCDNScenarioMixin(TestSlapOSSubscriptionScenarioMixin
def afterSetUp(self): def afterSetUp(self):
TestSlapOSSubscriptionScenarioMixin.afterSetUp(self) TestSlapOSSubscriptionScenarioMixin.afterSetUp(self)
self.expected_individual_price_without_tax = 4.16666666667 self.expected_individual_price_without_tax = 5
self.expected_individual_price_with_tax = 5.0 self.expected_individual_price_with_tax = 6.0
self.expected_reservation_fee = 1.0 self.expected_reservation_fee = 1.2
self.expected_reservation_fee_without_tax = 0.833333333333333 self.expected_reservation_fee_without_tax = 1
self.expected_reservation_quantity_tax = 0.833333333333333 self.expected_reservation_quantity_tax = 1.0
self.expected_reservation_tax = 0.166666666666667 self.expected_reservation_tax = 0.2
self.expected_price_currency = "currency_module/EUR" self.expected_price_currency = "currency_module/EUR"
self.expected_zh_individual_price_without_tax = 40 self.expected_zh_individual_price_without_tax = 40
self.expected_zh_individual_price_with_tax = 40.4 self.expected_zh_individual_price_with_tax = 40.4
self.expected_zh_reservation_fee = 8.08 self.expected_zh_reservation_fee = 8.08
self.expected_zh_reservation_fee_without_tax = 8.0 self.expected_zh_reservation_fee_without_tax = 8.0
self.expected_zh_reservation_quantity_tax = 8.08 self.expected_zh_reservation_quantity_tax = 8.0
self.expected_zh_reservation_tax = 0.08 self.expected_zh_reservation_tax = 0.08
self.resource_variation_reference = "CDN" self.resource_variation_reference = "CDN"
......
...@@ -31,12 +31,12 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin): ...@@ -31,12 +31,12 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
def afterSetUp(self): def afterSetUp(self):
self.unpinDateTime() self.unpinDateTime()
self.normal_user = None self.normal_user = None
self.expected_individual_price_without_tax = 162.50 self.expected_individual_price_without_tax = 195
self.expected_individual_price_with_tax = 195.00 self.expected_individual_price_with_tax = 234
self.expected_reservation_fee = 25.00 self.expected_reservation_fee = 30.00
self.expected_reservation_fee_without_tax = 20.833333333333333 self.expected_reservation_fee_without_tax = 25
self.expected_reservation_quantity_tax = 20.833333333333333 self.expected_reservation_quantity_tax = 25
self.expected_reservation_tax = 4.166666666666667 self.expected_reservation_tax = 5.0
self.expected_price_currency = "currency_module/EUR" self.expected_price_currency = "currency_module/EUR"
...@@ -412,7 +412,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -412,7 +412,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.assertEqual(payment.getSourcePayment(), self.assertEqual(payment.getSourcePayment(),
"%s/bank_account" % expected_source_section) "%s/bank_account" % expected_source_section)
self.assertEqual(int(payment.PaymentTransaction_getTotalPayablePrice()*100), self.assertEqual(int(round(payment.PaymentTransaction_getTotalPayablePrice(), 2)*100),
-authAmount) -authAmount)
self.assertEqual(payment.getPriceCurrency(), self.assertEqual(payment.getPriceCurrency(),
...@@ -601,8 +601,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -601,8 +601,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# Pay with appropriate mode depending of the currency. # Pay with appropriate mode depending of the currency.
if payment.getPriceCurrency() == "currency_module/CNY": if payment.getPriceCurrency() == "currency_module/CNY":
self.assertEqual(-self.expected_zh_reservation_fee*quantity, self.assertEqual(-round(self.expected_zh_reservation_fee*quantity, 2),
payment.PaymentTransaction_getTotalPayablePrice()) round(payment.PaymentTransaction_getTotalPayablePrice(), 2))
# Pay 188 CNY per VM # Pay 188 CNY per VM
data_kw = { data_kw = {
...@@ -615,8 +615,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -615,8 +615,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# Wechat_processUpdate will mark payment as payed by stopping it. # Wechat_processUpdate will mark payment as payed by stopping it.
payment.PaymentTransaction_createWechatEvent().WechatEvent_processUpdate(data_kw) payment.PaymentTransaction_createWechatEvent().WechatEvent_processUpdate(data_kw)
else: else:
self.assertEqual(-self.expected_reservation_fee*quantity, self.assertEqual(-round(self.expected_reservation_fee*quantity, 2),
payment.PaymentTransaction_getTotalPayablePrice()) round(payment.PaymentTransaction_getTotalPayablePrice(), 2))
# Pay 25 euros per VM # Pay 25 euros per VM
data_kw = { data_kw = {
...@@ -734,7 +734,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -734,7 +734,8 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.assertEqual(round(line.getTotalPrice(), 2), self.assertEqual(round(line.getTotalPrice(), 2),
round(expected_reservation_tax*quantity, 2)) round(expected_reservation_tax*quantity, 2))
self.assertEqual(round(invoice.getTotalPrice(), 2), expected_reservation_fee*quantity) self.assertEqual(round(invoice.getTotalPrice(), 2),
round(expected_reservation_fee*quantity, 2))
def checkSecondMonthAggregatedSalePackingList(self, subscription_request, sale_packing_list): def checkSecondMonthAggregatedSalePackingList(self, subscription_request, sale_packing_list):
sale_packing_list_line = [ i for i in sale_packing_list.objectValues() sale_packing_list_line = [ i for i in sale_packing_list.objectValues()
......
...@@ -488,9 +488,9 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix ...@@ -488,9 +488,9 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
for line in current_payment.contentValues(): for line in current_payment.contentValues():
if line.getSource() == "account_module/payment_to_encash": if line.getSource() == "account_module/payment_to_encash":
self.assertEqual(line.getQuantity(), -25*quantity) self.assertEqual(line.getQuantity(), -30*quantity)
if line.getSource() == "account_module/receivable": if line.getSource() == "account_module/receivable":
self.assertEqual(line.getQuantity(), 25*quantity) self.assertEqual(line.getQuantity(), 30*quantity)
def _test_request_payment_transaction_chinese(self, quantity): def _test_request_payment_transaction_chinese(self, quantity):
email = "abc%s@nexedi.com" % self.new_id email = "abc%s@nexedi.com" % self.new_id
...@@ -518,13 +518,13 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix ...@@ -518,13 +518,13 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
for line in current_payment.contentValues(): for line in current_payment.contentValues():
if line.getSource() == "account_module/payment_to_encash": if line.getSource() == "account_module/payment_to_encash":
self.assertEqual(line.getQuantity(), -188*quantity) self.assertEqual(line.getQuantity(), -189.88*quantity)
if line.getSource() == "account_module/receivable": if line.getSource() == "account_module/receivable":
self.assertEqual(line.getQuantity(), 188*quantity) self.assertEqual(line.getQuantity(), 189.88*quantity)
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None @simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment assert payment
assert price == 20.8333333 assert price == 25.0
assert tag == 'TAG' assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""") assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q1(self): def test_request_payment_transaction_q1(self):
...@@ -532,7 +532,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc ...@@ -532,7 +532,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None @simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment assert payment
assert price == 20.8333333 assert price == 25.0
assert tag == 'TAG' assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""") assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q2(self): def test_request_payment_transaction_q2(self):
...@@ -540,7 +540,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc ...@@ -540,7 +540,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None @simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment assert payment
assert price == 20.8333333 assert price == 25.0
assert tag == 'TAG' assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""") assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q10(self): def test_request_payment_transaction_q10(self):
......
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