當前位置: 首頁>>代碼示例>>Python>>正文


Python FixedPrice.set_basket方法代碼示例

本文整理匯總了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())
開發者ID:AndreaCrotti,項目名稱:django-oscar,代碼行數:9,代碼來源:shipping_tests.py

示例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
開發者ID:ComSource,項目名稱:django-oscar-paypal,代碼行數:12,代碼來源:views.py

示例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
開發者ID:vinnyrose,項目名稱:django-oscar-paypal,代碼行數:19,代碼來源:views.py

示例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
開發者ID:kapt,項目名稱:django-oscar-paypal,代碼行數:22,代碼來源:views.py

示例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
開發者ID:nka11,項目名稱:django-oscar-paypal,代碼行數:24,代碼來源:views.py

示例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())
開發者ID:bakanov,項目名稱:django-oscar,代碼行數:7,代碼來源:shipping_tests.py

示例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())
開發者ID:bakanov,項目名稱:django-oscar,代碼行數:7,代碼來源:shipping_tests.py

示例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())
開發者ID:bakanov,項目名稱:django-oscar,代碼行數:8,代碼來源:shipping_tests.py


注:本文中的oscar.apps.shipping.methods.FixedPrice.set_basket方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。