本文整理匯總了Python中oscar.apps.shipping.methods.FixedPrice.set_basket方法的典型用法代碼示例。如果您正苦於以下問題:Python FixedPrice.set_basket方法的具體用法?Python FixedPrice.set_basket怎麽用?Python FixedPrice.set_basket使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oscar.apps.shipping.methods.FixedPrice
的用法示例。
在下文中一共展示了FixedPrice.set_basket方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_different_values
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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())
示例2: get_shipping_method
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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
示例3: get_shipping_method
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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
示例4: get_shipping_method
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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
示例5: get_shipping_method
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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
示例6: test_different_values
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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())
示例7: test_fixed_price_shipping_assumes_no_tax
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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())
示例8: test_fixed_price_shipping_charges_for_empty_basket
# 需要導入模塊: from oscar.apps.shipping.methods import FixedPrice [as 別名]
# 或者: from oscar.apps.shipping.methods.FixedPrice import set_basket [as 別名]
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())