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())
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) 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
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
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
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())
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())
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())