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


Python card.CreditProvider类代码示例

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


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

示例1: test_get_providers

    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,代码行数:13,代码来源:test_card.py

示例2: create_provider_filter

    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,代码行数:11,代码来源:searchdialog.py

示例3: _setup_widgets

    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,代码行数:12,代码来源:paymentslave.py

示例4: create_model

    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,代码行数:12,代码来源:paymentslave.py

示例5: fields

    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,代码行数:13,代码来源:paymentmethodeditor.py

示例6: _setup_widgets

    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,代码行数:14,代码来源:paymentmethodeditor.py

示例7: _ensure_card_providers

def _ensure_card_providers():
    """ Creates a list of default card providers """
    log.info("Creating Card Providers")
    from stoqlib.domain.payment.card import CreditProvider, CardPaymentDevice

    providers = [u"VISANET", u"REDECARD", u"AMEX", u"HIPERCARD", u"BANRISUL", u"PAGGO", u"CREDISHOP", u"CERTIF"]

    store = new_store()
    for name in providers:
        provider = CreditProvider.get_provider_by_provider_id(name, store)
        if not provider.is_empty():
            continue

        CreditProvider(short_name=name, provider_id=name, open_contract_date=TransactionTimestamp(), store=store)
    devices = store.find(CardPaymentDevice)
    if devices.is_empty():
        CardPaymentDevice(store=store, description=_(u"Default"))
    store.commit(close=True)
开发者ID:stoq,项目名称:stoq,代码行数:18,代码来源:admin.py

示例8: _ensure_card_providers

def _ensure_card_providers():
    """ Creates a list of default card providers """
    log.info("Creating Card Providers")
    from stoqlib.domain.payment.card import CreditProvider

    providers = [u'VISANET', u'REDECARD', u'AMEX', u'HIPERCARD',
                 u'BANRISUL', u'PAGGO', u'CREDISHOP', u'CERTIF']

    store = new_store()
    for name in providers:
        provider = CreditProvider.get_provider_by_provider_id(name, store)
        if not provider.is_empty():
            continue

        CreditProvider(short_name=name,
                       provider_id=name,
                       open_contract_date=TransactionTimestamp(),
                       store=store)
    store.commit(close=True)
开发者ID:romaia,项目名称:stoq,代码行数:19,代码来源:admin.py

示例9: _ensure_card_providers

def _ensure_card_providers():
    """ Creates a list of default card providers """
    log.info("Creating Card Providers")
    from stoqlib.domain.payment.card import CreditProvider, CardPaymentDevice

    providers = {u'VISA': u'VISA',
                 u'MASTER': u'MASTER',
                 u'AMEX': u'AMEX'}
    store = new_store()
    for short_name, provider_id in providers.items():
        provider = CreditProvider.get_provider_by_provider_id(provider_id, store)
        if not provider.is_empty():
            continue

        CreditProvider(short_name=short_name,
                       provider_id=providers[short_name],
                       open_contract_date=TransactionTimestamp(),
                       store=store)
    devices = store.find(CardPaymentDevice)
    if devices.is_empty():
        CardPaymentDevice(store=store, description=_(u'Default'))
    store.commit(close=True)
开发者ID:hackedbellini,项目名称:stoq,代码行数:22,代码来源:admin.py

示例10: next_step

    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,代码行数:62,代码来源:salewizard.py

示例11: test_get_provider_by_id

    def test_get_provider_by_id(self):
        provider = self.create_credit_provider()
        provider.provider_id = u'foo'

        obj = CreditProvider.get_provider_by_provider_id(u'foo', self.store)
        self.assertEqual(provider, obj[0])
开发者ID:stoq,项目名称:stoq,代码行数:6,代码来源:test_card.py

示例12: test_has_providers

    def test_has_providers(self):
        self.clean_domain([CreditProvider])
        self.assertFalse(CreditProvider.has_card_provider(self.store))

        self.create_credit_provider()
        self.assertTrue(CreditProvider.has_card_provider(self.store))
开发者ID:stoq,项目名称:stoq,代码行数:6,代码来源:test_card.py

示例13: create_model

 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,代码行数:6,代码来源:paymentmethodeditor.py

示例14: selectable

 def selectable(self, method):
     return CreditProvider.has_card_provider(
         method.store)
开发者ID:Guillon88,项目名称:stoq,代码行数:3,代码来源:operation.py

示例15: __init__

 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,代码行数:6,代码来源:paymentmethodeditor.py


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