def test_different_values(self):
     shipping_values = ['1.00', '5.00', '10.00', '12.00']
     for value in shipping_values:
         basket = Basket()
         method = FixedPrice(D(value))
         method.set_basket(basket)
         self.assertEquals(D(value), method.basket_charge_excl_tax())
Example #2
0
 def test_different_values(self):
     shipping_values = ['1.00', '5.00', '10.00', '12.00']
     for value in shipping_values:
         basket = Basket()
         method = FixedPrice(D(value))
         method.set_basket(basket)
         self.assertEquals(D(value), method.basket_charge_excl_tax())
Example #3
0
 def get_shipping_method(self, basket=None):
     """
     Return the shipping method used
     """
     charge = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))
     method = FixedPrice(charge)
     basket = basket if basket else self.request.basket
     method.set_basket(basket)
     method.name = self.txn.value('SHIPPINGOPTIONNAME')
     return method
 def get_shipping_method(self, basket=None):
     """
     Return the shipping method used
     """
     charge = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))
     method = FixedPrice(charge)
     basket = basket if basket else self.request.basket
     method.set_basket(basket)
     method.name = self.txn.value('SHIPPINGOPTIONNAME')
     return method
Example #5
0
 def get_shipping_method(self, basket=None):
     """
     Return the shipping method used
     """
     charge = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))
     method = FixedPrice(charge)
     basket = basket if basket else self.request.basket
     method.set_basket(basket)
     name = self.txn.value('SHIPPINGOPTIONNAME')
     if not name:
         # Look to see if there is a method in the session
         session_method = self.checkout_session.shipping_method(basket)
         if session_method:
             method.name = session_method.name
     else:
         method.name = name
     return method
Example #6
0
 def get_shipping_method(self, basket=None):
     """
     Return the shipping method used
     """
     charge = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))
     method = FixedPrice(charge)
     basket = basket if basket else self.request.basket
     method.set_basket(basket)
     name = self.txn.value('SHIPPINGOPTIONNAME')
     if not name:
         # Look to see if there is a method in the session
         session_method = self.checkout_session.shipping_method(basket)
         if session_method:
             method.name = session_method.name
     else:
         method.name = name
     return method
Example #7
0
    def get_shipping_method(self, basket=None, shipping_address=None, **kwargs):
        """
        Return the shipping method used
        """

        # Instantiate a new FixedPrice shipping method instance
        charge_incl_tax = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))
        # Assume no tax for now
        charge_excl_tax = charge_incl_tax
        method = FixedPrice(charge_excl_tax, charge_incl_tax)
        method.set_basket(basket)
        name = self.txn.value('SHIPPINGOPTIONNAME')
        if not name:
            # Look to see if there is a method in the session
            session_method = super(SuccessResponseView, self).get_shipping_method(basket, shipping_address)
            if session_method:
                method.name = session_method.name
        else:
            method.name = name
        return method
Example #8
0
    def get_shipping_method(self, basket, shipping_address=None, **kwargs):
        """
        Return the shipping method used
        """
        if not basket.is_shipping_required():
            return NoShippingRequired()

        # Instantiate a new FixedPrice shipping method instance
        charge_incl_tax = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))
        # Assume no tax for now
        charge_excl_tax = charge_incl_tax
        method = FixedPrice(charge_excl_tax, charge_incl_tax)
        method.set_basket(basket)
        name = self.txn.value('SHIPPINGOPTIONNAME')
        if not name:
            # Look to see if there is a method in the session
            session_method = self.checkout_session.shipping_method_code(basket)
            if session_method:
                method.name = session_method  #.name
        else:
            method.name = name
        return method
Example #9
0
    def get_shipping_method(self, basket, shipping_address=None, **kwargs):
        """
        Return the shipping method used
        """
        if not basket.is_shipping_required():
            return NoShippingRequired()

        # Instantiate a new FixedPrice shipping method instance
        charge_incl_tax = D(self.txn.value('PAYMENTREQUEST_0_SHIPPINGAMT'))
        # Assume no tax for now
        charge_excl_tax = charge_incl_tax
        method = FixedPrice(charge_excl_tax, charge_incl_tax)
        method.set_basket(basket)
        name = self.txn.value('SHIPPINGOPTIONNAME')
        if not name:
            # Look to see if there is a method in the session
            session_method = self.checkout_session.shipping_method_code(basket)
            if session_method:
                method.name = session_method #.name
        else:
            method.name = name
        return method
Example #10
0
 def test_different_values(self, value):
     method = FixedPrice(D(value))
     basket = Basket()
     method.set_basket(basket)
     self.assertEquals(D(value), method.basket_charge_excl_tax())
Example #11
0
 def test_fixed_price_shipping_assumes_no_tax(self):
     method = FixedPrice(D('10.00'))
     basket = Basket()
     method.set_basket(basket)
     self.assertEquals(D('10.00'), method.basket_charge_excl_tax())
Example #12
0
 def test_fixed_price_shipping_charges_for_empty_basket(self):
     method = FixedPrice(D('10.00'), D('10.00'))
     basket = Basket()
     method.set_basket(basket)
     self.assertEquals(D('10.00'), method.basket_charge_incl_tax())
     self.assertEquals(D('10.00'), method.basket_charge_excl_tax())
Example #13
0
 def test_fixed_price_shipping_assumes_no_tax(self):
     method = FixedPrice(D('10.00'))
     basket = Basket()
     method.set_basket(basket)
     self.assertEquals(D('10.00'), method.basket_charge_excl_tax())
Example #14
0
 def test_fixed_price_shipping_charges_for_empty_basket(self):
     method = FixedPrice(D('10.00'), D('10.00'))
     basket = Basket()
     method.set_basket(basket)
     self.assertEquals(D('10.00'), method.basket_charge_incl_tax())
     self.assertEquals(D('10.00'), method.basket_charge_excl_tax())
Example #15
0
 def test_different_values(self, value):
     method = FixedPrice(D(value))
     basket = Basket()
     method.set_basket(basket)
     self.assertEquals(D(value), method.basket_charge_excl_tax())