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


Python CreditProvider.get_card_providers方法代码示例

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


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

示例1: test_get_providers

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
    def test_get_providers(self):
        self.clean_domain([CreditProvider])

        # Initialy no providers are present
        self.assertEqual(CreditProvider.get_card_providers(self.store).count(), 0)

        # Create one
        provider = self.create_credit_provider()

        # It should be fetched from the database
        providers = CreditProvider.get_card_providers(self.store)
        self.assertEqual(providers.count(), 1)
        self.assertEqual(providers[0], provider)
开发者ID:stoq,项目名称:stoq,代码行数:15,代码来源:test_card.py

示例2: create_provider_filter

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
    def create_provider_filter(self, label=None):
        from stoqlib.domain.payment.card import CreditProvider
        providers = CreditProvider.get_card_providers(self.store)
        items = [(p.short_name, p) for p in providers]
        items.insert(0, (_("Any"), None))

        if not label:
            label = _('Provider:')
        provider_filter = ComboSearchFilter(label, items)

        return provider_filter
开发者ID:leandrorchaves,项目名称:stoq,代码行数:13,代码来源:searchdialog.py

示例3: _setup_widgets

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
    def _setup_widgets(self):
        devices = CardPaymentDevice.get_devices(self.method.store)
        self.card_device.prefill(api.for_combo(devices))

        providers = CreditProvider.get_card_providers(
            self.method.store)
        self.credit_provider.prefill(api.for_combo(providers))

        self._radio_group = None

        for ptype, name in CreditCardData.types.items():
            self._add_card_type(name, ptype)
开发者ID:romaia,项目名称:stoq,代码行数:14,代码来源:paymentslave.py

示例4: create_model

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
    def create_model(self, store):
        if store.find(CardPaymentDevice).is_empty():
            raise ValueError('You must have card devices registered '
                             'before start doing sales')

        providers = CreditProvider.get_card_providers(
            self.method.store)
        if providers.count() == 0:
            raise ValueError('You must have credit providers information '
                             'stored in the database before start doing '
                             'sales')
        return _TemporaryCreditProviderGroupData(provider=None)
开发者ID:romaia,项目名称:stoq,代码行数:14,代码来源:paymentslave.py

示例5: fields

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
    def fields(self):
        device_values = api.for_combo(
            CardPaymentDevice.get_devices(self.store))
        provider_values = api.for_combo(
            CreditProvider.get_card_providers(self.store))

        return collections.OrderedDict(
            device=ChoiceField(_('Device'), proxy=True, mandatory=True,
                               values=device_values),
            provider=ChoiceField(_('Provider'), proxy=True, mandatory=True,
                                 values=provider_values),
            auth=TextField(_('Authorization'), proxy=True, mandatory=True)
        )
开发者ID:hackedbellini,项目名称:stoq,代码行数:15,代码来源:paymentmethodeditor.py

示例6: _setup_widgets

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
    def _setup_widgets(self):
        # Set a default provider, otherwise, if the user does not change the
        # combo, the provider may not be set (bug in kiwi)
        providers = CreditProvider.get_card_providers(self.store)
        self.provider.prefill(api.for_combo(providers))

        types = [(value, key) for key, value in CreditCardData.types.items()]
        self.card_type.prefill(types)

        # Set values to the ones of the model
        self.installment_start.set_value(self.model.installment_start)
        self.installment_end.set_value(self.model.installment_end)

        self.set_installment_limits()
开发者ID:LeonamSilva,项目名称:stoq,代码行数:16,代码来源:paymentmethodeditor.py

示例7: next_step

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
    def next_step(self):
        if not self.wizard.need_create_payment():
            return

        selected_method = self.get_selected_method()
        if selected_method.method_name == u'money':
            if not self.cash_change_slave.can_finish():
                warning(_(u"Invalid value, please verify if it was "
                          "properly typed."))
                self.cash_change_slave.received_value.select_region(
                    0, len(self.cash_change_slave.received_value.get_text()))
                self.cash_change_slave.received_value.grab_focus()
                return self

            # We have to modify the payment, so the fiscal printer can
            # calculate and print the payback, if necessary.
            payment = self.setup_cash_payment()
            total = self.cash_change_slave.get_received_value()
            payment.base_value = total

            # Return None here means call wizard.finish, which is exactly
            # what we need
            return None
        elif selected_method.method_name == u'store_credit':
            client = self.model.client
            total = self.wizard.get_total_amount()

            assert client.can_purchase(selected_method, total)

            step_class = PaymentMethodStep
        elif selected_method.method_name == 'card':
            providers = CreditProvider.get_card_providers(self.store)
            if providers.is_empty():
                warning(_("You need active credit providers to use the "
                          "card payment method."))
                return self
            step_class = PaymentMethodStep
        else:
            step_class = PaymentMethodStep

        retval = CreatePaymentEvent.emit(selected_method, self.model,
                                         self.store)

        # None means no one catched this event
        if retval is None or retval == CreatePaymentStatus.UNHANDLED:
            # FIXME: We cannot send outstanding_value to multiple editor
            # since if we have a trade going on, it will be calculated wrong
            if selected_method.method_name == 'multiple':
                outstanding_value = None
            else:
                outstanding_value = self.wizard.get_total_to_pay()

            return step_class(self.wizard, self, self.store, self.model,
                              selected_method,
                              outstanding_value=outstanding_value)

        # finish the wizard
        if retval == CreatePaymentStatus.SUCCESS:
            return None

        # returning self to stay on this step
        return self
开发者ID:romaia,项目名称:stoq,代码行数:64,代码来源:salewizard.py

示例8: create_model

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
 def create_model(self, store):
     provider = CreditProvider.get_card_providers(
         self.store).order_by(CreditProvider.short_name).first()
     real_model = CardOperationCost(provider=provider, device=self.device,
                                    store=self.store)
     return _TemporaryOperationCost(real_model)
开发者ID:hackedbellini,项目名称:stoq,代码行数:8,代码来源:paymentmethodeditor.py

示例9: __init__

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
 def __init__(self, store, model, visual_mode=None):
     self.fields['device'].values = api.for_combo(
         CardPaymentDevice.get_devices(store))
     self.fields['provider'].values = api.for_combo(
         CreditProvider.get_card_providers(store))
     BaseEditor.__init__(self, store, model)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:8,代码来源:paymentmethodeditor.py

示例10: create_model

# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_card_providers [as 别名]
 def create_model(self, store):
     provider = CreditProvider.get_card_providers(store).any()
     real_model = CardOperationCost(provider=provider, device=self.device,
                                    store=self.store)
     return _TemporaryOperationCost(real_model)
开发者ID:LeonamSilva,项目名称:stoq,代码行数:7,代码来源:paymentmethodeditor.py


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