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


Python CreditLine.add_account_credit方法代码示例

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


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

示例1: test_balance_adjustment

# 需要导入模块: from corehq.apps.accounting.models import CreditLine [as 别名]
# 或者: from corehq.apps.accounting.models.CreditLine import add_account_credit [as 别名]
    def test_balance_adjustment(self):
        """
        Makes sure that the balance is added to the same invoice and same line item credit.
        """
        product_credit = CreditLine.add_rate_credit(
            self.product_rate.monthly_fee,
            self.account,
            product_rate=self.product_rate,
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=product_credit).count(), 1)
        CreditLine.add_rate_credit(
            self.product_rate.monthly_fee,
            self.account,
            product_rate=self.product_rate,
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=product_credit).count(), 2)
        current_product_credit = CreditLine.objects.get(id=product_credit.id)
        self.assertEqual(current_product_credit.balance, self.product_rate.monthly_fee * 2)

        subscription_credit = CreditLine.add_subscription_credit(
            self.monthly_user_fee,
            self.subscription
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=subscription_credit).count(), 1)
        CreditLine.add_subscription_credit(
            self.monthly_user_fee,
            self.subscription
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=subscription_credit).count(), 2)
        current_subscription_credit = CreditLine.objects.get(id=subscription_credit.id)
        self.assertEqual(current_subscription_credit.balance, self.monthly_user_fee * 2)

        account_credit = CreditLine.add_account_credit(
            self.product_rate.monthly_fee,
            self.account
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=account_credit).count(), 1)
        CreditLine.add_account_credit(
            self.monthly_user_fee,
            self.account
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=account_credit).count(), 2)
        current_account_credit = CreditLine.objects.get(id=account_credit.id)
        self.assertEqual(current_account_credit.balance, self.product_rate.monthly_fee + self.monthly_user_fee)
开发者ID:dszafranek,项目名称:commcare-hq,代码行数:46,代码来源:test_credit_lines.py

示例2: _generate_subscription_and_account_invoice_credits

# 需要导入模块: from corehq.apps.accounting.models import CreditLine [as 别名]
# 或者: from corehq.apps.accounting.models.CreditLine import add_account_credit [as 别名]
    def _generate_subscription_and_account_invoice_credits(self, monthly_fee, subscription, account):
        subscription_credit = CreditLine.add_subscription_credit(
            monthly_fee,
            subscription
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=subscription_credit).count(), 1)

        account_credit = CreditLine.add_account_credit(
            monthly_fee,
            account
        )
        self.assertEqual(CreditAdjustment.objects.filter(credit_line=account_credit).count(), 1)
        return subscription_credit, account_credit
开发者ID:dszafranek,项目名称:commcare-hq,代码行数:15,代码来源:test_credit_lines.py

示例3: add_account_level

# 需要导入模块: from corehq.apps.accounting.models import CreditLine [as 别名]
# 或者: from corehq.apps.accounting.models.CreditLine import add_account_credit [as 别名]
 def add_account_level():
     CreditLine.add_account_credit(amount, account,
                                   note=note)
开发者ID:dszafranek,项目名称:commcare-hq,代码行数:5,代码来源:forms.py


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