service level specific base fees
This commit is contained in:
parent
150250bfb1
commit
033eea92cd
9 changed files with 716 additions and 58 deletions
|
@ -303,14 +303,15 @@ class VSHNAppCatPriceTestCase(TestCase):
|
|||
base_fee = VSHNAppCatBaseFee.objects.create(
|
||||
vshn_appcat_price_config=self.price_config,
|
||||
currency=Currency.CHF,
|
||||
service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED,
|
||||
amount=Decimal("50.00"),
|
||||
)
|
||||
|
||||
retrieved_fee = self.price_config.get_base_fee(Currency.CHF)
|
||||
retrieved_fee = self.price_config.get_base_fee(Currency.CHF, VSHNAppCatPrice.ServiceLevel.GUARANTEED)
|
||||
self.assertEqual(retrieved_fee, Decimal("50.00"))
|
||||
|
||||
# Test non-existent currency
|
||||
non_existent_fee = self.price_config.get_base_fee(Currency.EUR)
|
||||
non_existent_fee = self.price_config.get_base_fee(Currency.EUR, VSHNAppCatPrice.ServiceLevel.GUARANTEED)
|
||||
self.assertIsNone(non_existent_fee)
|
||||
|
||||
def test_unit_rate_creation_and_retrieval(self):
|
||||
|
@ -339,6 +340,7 @@ class VSHNAppCatPriceTestCase(TestCase):
|
|||
VSHNAppCatBaseFee.objects.create(
|
||||
vshn_appcat_price_config=self.price_config,
|
||||
currency=Currency.CHF,
|
||||
service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED,
|
||||
amount=Decimal("50.00"),
|
||||
)
|
||||
|
||||
|
@ -364,6 +366,7 @@ class VSHNAppCatPriceTestCase(TestCase):
|
|||
VSHNAppCatBaseFee.objects.create(
|
||||
vshn_appcat_price_config=self.price_config,
|
||||
currency=Currency.CHF,
|
||||
service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED,
|
||||
amount=Decimal("50.00"),
|
||||
)
|
||||
|
||||
|
@ -392,6 +395,7 @@ class VSHNAppCatPriceTestCase(TestCase):
|
|||
VSHNAppCatBaseFee.objects.create(
|
||||
vshn_appcat_price_config=self.price_config,
|
||||
currency=Currency.CHF,
|
||||
service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED,
|
||||
amount=Decimal("50.00"),
|
||||
)
|
||||
|
||||
|
@ -413,6 +417,7 @@ class VSHNAppCatPriceTestCase(TestCase):
|
|||
VSHNAppCatBaseFee.objects.create(
|
||||
vshn_appcat_price_config=self.price_config,
|
||||
currency=Currency.CHF,
|
||||
service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED,
|
||||
amount=Decimal("50.00"),
|
||||
)
|
||||
|
||||
|
@ -431,6 +436,7 @@ class VSHNAppCatPriceTestCase(TestCase):
|
|||
VSHNAppCatBaseFee.objects.create(
|
||||
vshn_appcat_price_config=self.price_config,
|
||||
currency=Currency.CHF,
|
||||
service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED,
|
||||
amount=Decimal("50.00"),
|
||||
)
|
||||
|
||||
|
@ -473,6 +479,7 @@ class VSHNAppCatAddonTestCase(TestCase):
|
|||
VSHNAppCatBaseFee.objects.create(
|
||||
vshn_appcat_price_config=self.price_config,
|
||||
currency=Currency.CHF,
|
||||
service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED,
|
||||
amount=Decimal("50.00"),
|
||||
)
|
||||
|
||||
|
@ -495,11 +502,11 @@ class VSHNAppCatAddonTestCase(TestCase):
|
|||
|
||||
# Create base fee for addon
|
||||
VSHNAppCatAddonBaseFee.objects.create(
|
||||
addon=addon, currency=Currency.CHF, amount=Decimal("25.00")
|
||||
addon=addon, currency=Currency.CHF, service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED, amount=Decimal("25.00")
|
||||
)
|
||||
|
||||
# Test get_price method
|
||||
price = addon.get_price(Currency.CHF)
|
||||
price = addon.get_price(Currency.CHF, VSHNAppCatPrice.ServiceLevel.GUARANTEED)
|
||||
self.assertEqual(price, Decimal("25.00"))
|
||||
|
||||
def test_addon_unit_rate_type(self):
|
||||
|
@ -553,7 +560,7 @@ class VSHNAppCatAddonTestCase(TestCase):
|
|||
)
|
||||
|
||||
VSHNAppCatAddonBaseFee.objects.create(
|
||||
addon=mandatory_addon, currency=Currency.CHF, amount=Decimal("25.00")
|
||||
addon=mandatory_addon, currency=Currency.CHF, service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED, amount=Decimal("25.00")
|
||||
)
|
||||
|
||||
# Create mandatory unit rate addon
|
||||
|
@ -594,7 +601,7 @@ class VSHNAppCatAddonTestCase(TestCase):
|
|||
)
|
||||
|
||||
VSHNAppCatAddonBaseFee.objects.create(
|
||||
addon=optional_addon, currency=Currency.CHF, amount=Decimal("15.00")
|
||||
addon=optional_addon, currency=Currency.CHF, service_level=VSHNAppCatPrice.ServiceLevel.GUARANTEED, amount=Decimal("15.00")
|
||||
)
|
||||
|
||||
# Calculate price with selected addon
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue