本文整理汇总了Python中stoqlib.domain.payment.card.CreditProvider.get_provider_by_provider_id方法的典型用法代码示例。如果您正苦于以下问题:Python CreditProvider.get_provider_by_provider_id方法的具体用法?Python CreditProvider.get_provider_by_provider_id怎么用?Python CreditProvider.get_provider_by_provider_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stoqlib.domain.payment.card.CreditProvider
的用法示例。
在下文中一共展示了CreditProvider.get_provider_by_provider_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ensure_card_providers
# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_provider_by_provider_id [as 别名]
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)
示例2: _ensure_card_providers
# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_provider_by_provider_id [as 别名]
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)
示例3: _ensure_card_providers
# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_provider_by_provider_id [as 别名]
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)
示例4: test_get_provider_by_id
# 需要导入模块: from stoqlib.domain.payment.card import CreditProvider [as 别名]
# 或者: from stoqlib.domain.payment.card.CreditProvider import get_provider_by_provider_id [as 别名]
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])