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


Python PaymentMethod.create_payment方法代码示例

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


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

示例1: test_create_payment

# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import create_payment [as 别名]
    def test_create_payment(self):
        acc = self.create_account()
        branch = self.create_branch()
        method = PaymentMethod(method_name=u'Test', destination_account=acc)
        group = self.create_payment_group()
        self.create_payment(payment_type=Payment.TYPE_IN, date=None,
                            value=100, method=method, branch=branch,
                            group=group)
        with self.assertRaisesRegex(
                PaymentMethodError,
                ('You can not create more inpayments for this payment '
                 'group since the maximum allowed for this payment '
                 'method is 1')):
            method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
                                  branch=branch, value=100, due_date=None,
                                  description=None, base_value=None,
                                  payment_number=None)

        self.create_payment(payment_type=Payment.TYPE_IN, date=None,
                            value=100, method=method, branch=branch,
                            group=group)
        with self.assertRaises(DatabaseInconsistency):
            method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
                                  branch=branch, value=100, due_date=None,
                                  description=None, base_value=None,
                                  payment_number=None)
开发者ID:hackedbellini,项目名称:stoq,代码行数:28,代码来源:test_payment_method.py

示例2: test_create_payment

# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import create_payment [as 别名]
 def test_create_payment(self):
     acc = self.create_account()
     branch = self.create_branch()
     method = PaymentMethod(method_name=u'Test', destination_account=acc)
     group = self.create_payment_group()
     self.create_payment(payment_type=Payment.TYPE_IN, date=None,
                         value=100, method=method, branch=branch,
                         group=group)
     with self.assertRaises(PaymentMethodError):
         method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
                               branch=branch, value=100, due_date=None,
                               description=None, base_value=None,
                               till=ValueUnset, payment_number=None)
     self.create_payment(payment_type=Payment.TYPE_IN, date=None,
                         value=100, method=method, branch=branch,
                         group=group)
     with self.assertRaises(DatabaseInconsistency):
         method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
                               branch=branch, value=100, due_date=None,
                               description=None, base_value=None,
                               till=ValueUnset, payment_number=None)
     with self.assertRaises(AssertionError):
         method.create_payment(payment_type=9, payment_group=group,
                               branch=branch, value=100, due_date=None,
                               description=None, base_value=None,
                               till=ValueUnset, payment_number=None)
开发者ID:pkaislan,项目名称:stoq,代码行数:28,代码来源:test_payment_method.py

示例3: test_create_payment

# 需要导入模块: from stoqlib.domain.payment.method import PaymentMethod [as 别名]
# 或者: from stoqlib.domain.payment.method.PaymentMethod import create_payment [as 别名]
    def test_create_payment(self):
        acc = self.create_account()
        branch = self.create_branch()
        method = PaymentMethod(method_name=u'Test', destination_account=acc)
        group = self.create_payment_group()
        self.create_payment(payment_type=Payment.TYPE_IN, date=None,
                            value=100, method=method, branch=branch,
                            group=group)
        with self.assertRaisesRegexp(
                PaymentMethodError,
                ('You can not create more inpayments for this payment '
                 'group since the maximum allowed for this payment '
                 'method is 1')):
            method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
                                  branch=branch, value=100, due_date=None,
                                  description=None, base_value=None,
                                  till=ValueUnset, payment_number=None)

        self.create_payment(payment_type=Payment.TYPE_IN, date=None,
                            value=100, method=method, branch=branch,
                            group=group)
        with self.assertRaises(DatabaseInconsistency):
            method.create_payment(payment_type=Payment.TYPE_IN, payment_group=group,
                                  branch=branch, value=100, due_date=None,
                                  description=None, base_value=None,
                                  till=ValueUnset, payment_number=None)
        with self.assertRaises(AssertionError):
            method.create_payment(payment_type=9, payment_group=group,
                                  branch=branch, value=100, due_date=None,
                                  description=None, base_value=None,
                                  till=ValueUnset, payment_number=None)

        with mock.patch('stoqlib.domain.till.Till.get_current') as get_current:
            get_current.side_effect = TillError('foobar')

            with self.assertRaisesRegexp(PaymentMethodError, 'foobar'):
                method.create_payment(payment_type=Payment.TYPE_IN,
                                      payment_group=self.create_payment_group(),
                                      branch=branch, value=100, due_date=None,
                                      description=None, base_value=None,
                                      till=ValueUnset)
开发者ID:EasyDevSolutions,项目名称:stoq,代码行数:43,代码来源:test_payment_method.py


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