当前位置: 首页>>代码示例>>Python>>正文


Python Order.is_payed方法代码示例

本文整理汇总了Python中shop.models.ordermodel.Order.is_payed方法的典型用法代码示例。如果您正苦于以下问题:Python Order.is_payed方法的具体用法?Python Order.is_payed怎么用?Python Order.is_payed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shop.models.ordermodel.Order的用法示例。


在下文中一共展示了Order.is_payed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OrderPaymentTestCase

# 需要导入模块: from shop.models.ordermodel import Order [as 别名]
# 或者: from shop.models.ordermodel.Order import is_payed [as 别名]
class OrderPaymentTestCase(TestCase):
    
    def create_fixtures(self):
        self.user = User.objects.create(username="test", email="[email protected]")
        
        self.request = Mock()
        setattr(self.request, 'user', None)
        
        self.order = Order()
        self.order.order_subtotal = Decimal('10')
        self.order.order_total = Decimal('10')
        self.order.shipping_cost = Decimal('0')
        
        self.order.shipping_name = 'toto'
        self.order.shipping_address = 'address'
        self.order.shipping_address2 = 'address2'
        self.order.shipping_zip_code = 'zip'
        self.order.shipping_state = 'state'
        self.order.shipping_country = 'country'
        
        self.order.billing_name = 'toto'
        self.order.billing_address = 'address'
        self.order.billing_address2 = 'address2'
        self.order.billing_zip_code = 'zip'
        self.order.billing_state = 'state'
        self.order.billing_country = 'country'
        
        self.order.save()
    
    def test_payment_sum_works(self):
        self.create_fixtures()
        
        self.assertEqual(self.order.amount_payed, 0)
        
    def test_payment_sum_works_with_partial_payments(self):
        self.create_fixtures()
        OrderPayment.objects.create(
                order = self.order,
                amount = Decimal('2'),
                transaction_id = 'whatever',
                payment_method = 'test method'
                )
        self.assertEqual(self.order.amount_payed, 2)
        self.assertEqual(self.order.is_payed(), False)
        
    def test_payment_sum_works_with_full_payments(self):
        self.create_fixtures()
        OrderPayment.objects.create(
                order = self.order,
                amount = Decimal('10'),
                transaction_id = 'whatever',
                payment_method = 'test method'
                )
        self.assertEqual(self.order.amount_payed, 10)
        self.assertEqual(self.order.is_payed(), True)
开发者ID:matthiasnuesch,项目名称:django-shop,代码行数:57,代码来源:order.py

示例2: OrderTestCase

# 需要导入模块: from shop.models.ordermodel import Order [as 别名]
# 或者: from shop.models.ordermodel.Order import is_payed [as 别名]
class OrderTestCase(TestCase):
    def create_fixtures(self):
        
        self.order = Order()
        self.order.order_subtotal = Decimal('10')
        self.order.order_total = Decimal('10')
        self.order.amount_payed = Decimal('0')
        self.order.shipping_cost = Decimal('0')
        
        self.order.shipping_name = 'toto'
        self.order.shipping_address = 'address'
        self.order.shipping_address2 = 'address2'
        self.order.shipping_zip_code = 'zip'
        self.order.shipping_state = 'state'
        self.order.shipping_country = 'country'
        
        self.order.billing_name = 'toto'
        self.order.billing_address = 'address'
        self.order.billing_address2 = 'address2'
        self.order.billing_zip_code = 'zip'
        self.order.billing_state = 'state'
        self.order.billing_country = 'country'
        
        self.order.save()
    
    def test_01_order_is_completed_works(self):
        self.create_fixtures()
        ret = self.order.is_completed()
        self.assertNotEqual(ret, Order.COMPLETED)
    
    def test_02_is_payed_works(self):
        self.create_fixtures()
        ret = self.order.is_payed()
        self.assertEqual(ret, False)
开发者ID:FinalAngel,项目名称:django-shop,代码行数:36,代码来源:order.py

示例3: OrderTestCase

# 需要导入模块: from shop.models.ordermodel import Order [as 别名]
# 或者: from shop.models.ordermodel.Order import is_payed [as 别名]
class OrderTestCase(TestCase):
    def setUp(self):

        self.order = Order()
        self.order.order_subtotal = Decimal("10")
        self.order.order_total = Decimal("10")
        self.order.shipping_cost = Decimal("0")

        self.order.shipping_name = "toto"
        self.order.shipping_address = "address"
        self.order.shipping_address2 = "address2"
        self.order.shipping_zip_code = "zip"
        self.order.shipping_state = "state"
        self.order.shipping_country = "country"

        self.order.billing_name = "toto"
        self.order.billing_address = "address"
        self.order.billing_address2 = "address2"
        self.order.billing_zip_code = "zip"
        self.order.billing_state = "state"
        self.order.billing_country = "country"

        self.order.save()

    def test_order_is_completed_works(self):
        ret = self.order.is_completed()
        self.assertNotEqual(ret, Order.COMPLETED)

    def test_is_payed_works(self):
        ret = self.order.is_payed()
        self.assertEqual(ret, False)
开发者ID:wmsmith,项目名称:django-shop,代码行数:33,代码来源:order.py

示例4: OrderPaymentTestCase

# 需要导入模块: from shop.models.ordermodel import Order [as 别名]
# 或者: from shop.models.ordermodel.Order import is_payed [as 别名]
class OrderPaymentTestCase(TestCase):

    def setUp(self):
        self.user = User.objects.create(username="test",
            email="[email protected]")

        self.request = Mock()
        setattr(self.request, 'user', None)

        self.order = Order()
        self.order.order_subtotal = Decimal('10')
        self.order.order_total = Decimal('10')
        self.order.shipping_cost = Decimal('0')

        self.order.shipping_address_text = 'shipping address example'
        self.order.billing_address_text = 'billing address example'

        self.order.save()

    def test_payment_sum_works(self):
        self.assertEqual(self.order.amount_payed, Decimal('-1'))
        self.assertEqual(self.order.amount_paid, Decimal('-1'))

    def test_payment_sum_works_with_partial_payments(self):
        OrderPayment.objects.create(
                order=self.order,
                amount=Decimal('2'),
                transaction_id='whatever',
                payment_method='test method')
        self.assertEqual(self.order.amount_payed, 2)
        self.assertEqual(self.order.is_payed(), False)
        self.assertEqual(self.order.amount_paid, 2)
        self.assertEqual(self.order.is_paid(), False)

    def test_payment_sum_works_with_full_payments(self):
        OrderPayment.objects.create(
                order=self.order,
                amount=Decimal('10'),
                transaction_id='whatever',
                payment_method='test method')
        self.assertEqual(self.order.amount_payed, 10)
        self.assertEqual(self.order.is_payed(), True)
        self.assertEqual(self.order.amount_paid, 10)
        self.assertEqual(self.order.is_paid(), True)
开发者ID:bakanov,项目名称:django-shop,代码行数:46,代码来源:order.py

示例5: OrderPaymentTestCase

# 需要导入模块: from shop.models.ordermodel import Order [as 别名]
# 或者: from shop.models.ordermodel.Order import is_payed [as 别名]
class OrderPaymentTestCase(TestCase):
    def setUp(self):
        self.user = User.objects.create(username="test", email="[email protected]")

        self.request = Mock()
        setattr(self.request, "user", None)

        self.order = Order()
        self.order.order_subtotal = Decimal("10")
        self.order.order_total = Decimal("10")
        self.order.shipping_cost = Decimal("0")

        self.order.shipping_name = "toto"
        self.order.shipping_address = "address"
        self.order.shipping_address2 = "address2"
        self.order.shipping_zip_code = "zip"
        self.order.shipping_state = "state"
        self.order.shipping_country = "country"

        self.order.billing_name = "toto"
        self.order.billing_address = "address"
        self.order.billing_address2 = "address2"
        self.order.billing_zip_code = "zip"
        self.order.billing_state = "state"
        self.order.billing_country = "country"

        self.order.save()

    def test_payment_sum_works(self):
        self.assertEqual(self.order.amount_payed, Decimal("-1"))

    def test_payment_sum_works_with_partial_payments(self):
        OrderPayment.objects.create(
            order=self.order, amount=Decimal("2"), transaction_id="whatever", payment_method="test method"
        )
        self.assertEqual(self.order.amount_payed, 2)
        self.assertEqual(self.order.is_payed(), False)

    def test_payment_sum_works_with_full_payments(self):
        OrderPayment.objects.create(
            order=self.order, amount=Decimal("10"), transaction_id="whatever", payment_method="test method"
        )
        self.assertEqual(self.order.amount_payed, 10)
        self.assertEqual(self.order.is_payed(), True)
开发者ID:wmsmith,项目名称:django-shop,代码行数:46,代码来源:order.py

示例6: OrderTestCase

# 需要导入模块: from shop.models.ordermodel import Order [as 别名]
# 或者: from shop.models.ordermodel.Order import is_payed [as 别名]
class OrderTestCase(TestCase):
    def setUp(self):
        
        self.order = Order()
        self.order.order_subtotal = Decimal('10')
        self.order.order_total = Decimal('10')
        self.order.shipping_cost = Decimal('0')
        
        self.order.shipping_address_text = 'shipping address example'
        self.order.billing_address_text = 'billing address example'
        
        self.order.save()
    
    def test_order_is_completed_works(self):
        ret = self.order.is_completed()
        self.assertNotEqual(ret, Order.COMPLETED)
    
    def test_is_payed_works(self):
        ret = self.order.is_payed()
        self.assertEqual(ret, False)
开发者ID:IAbuElRuzz,项目名称:django-shop,代码行数:22,代码来源:order.py


注:本文中的shop.models.ordermodel.Order.is_payed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。