Beispiel #1
0
def make_tiers(carrier, prices, expires=None):
    for qty, handling, price in prices:
        t = QuantityTier(carrier=carrier,
                         handling=Decimal("%i.00" % handling),
                         price=Decimal("%i.00" % price),
                         quantity=Decimal(qty),
                         expires=expires)
        t.save()
Beispiel #2
0
def make_tiers(carrier, prices, expires=None):
    for qty, handling, price in prices:
        t = QuantityTier(carrier=carrier, 
            handling=Decimal("%i.00" % handling),
            price=Decimal("%i.00" % price),
            quantity=Decimal(qty),
            expires=expires
        )
        t.save()
Beispiel #3
0
 def setUp(self):
     self.carrier = Carrier(name="pricing", active=True)
     self.carrier.save()
     t = QuantityTier(carrier=self.carrier, 
         quantity=Decimal('1'),
         handling=Decimal("10.00"),
         price=Decimal("0.00"),
         )
     t.save()
Beispiel #4
0
 def setUp(self):
     self.carrier = Carrier(name="pricing", active=True)
     self.carrier.save()
     t = QuantityTier(
         carrier=self.carrier,
         quantity=Decimal('1'),
         handling=Decimal("10.00"),
         price=Decimal("0.00"),
     )
     t.save()
Beispiel #5
0
 def test2Prices(self):
     t = QuantityTier(carrier=self.carrier, 
         quantity=Decimal('10'),
         handling=Decimal("100.00"),
         price=Decimal("1.00"),
         )
     t.save()
     
     self.assertEqual(self.carrier.price(1), Decimal("10.00"))
     self.assertEqual(self.carrier.price(9), Decimal("10.00"))
     self.assertEqual(self.carrier.price(10), Decimal("110.00"))
     self.assertEqual(self.carrier.price(100), Decimal("200.00"))
Beispiel #6
0
 def testCreate(self):
     c = Carrier(key="test", active=True)
     c.save()
     t = QuantityTier(carrier=c, 
         quantity=Decimal('1'),
         handling=Decimal("10.00"),
         price=Decimal("0.00"),
         )
     t.save()
     
     self.assertEqual(c.price(1), Decimal("10.00"))
     self.assertEqual(c.price(4), Decimal("10.00"))
Beispiel #7
0
    def test2Prices(self):
        t = QuantityTier(
            carrier=self.carrier,
            quantity=Decimal('10'),
            handling=Decimal("100.00"),
            price=Decimal("1.00"),
        )
        t.save()

        self.assertEqual(self.carrier.price(1), Decimal("10.00"))
        self.assertEqual(self.carrier.price(9), Decimal("10.00"))
        self.assertEqual(self.carrier.price(10), Decimal("110.00"))
        self.assertEqual(self.carrier.price(100), Decimal("200.00"))
Beispiel #8
0
    def testCreate(self):
        c = Carrier(key="test", active=True)
        c.save()
        t = QuantityTier(
            carrier=c,
            quantity=Decimal('1'),
            handling=Decimal("10.00"),
            price=Decimal("0.00"),
        )
        t.save()

        self.assertEqual(c.price(1), Decimal("10.00"))
        self.assertEqual(c.price(4), Decimal("10.00"))