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


Python PaymentMethod.find方法代码示例

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


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

示例1: store

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def store(self, credit_card, options=None):
     if isinstance(credit_card, CreditCard):
         if not self.validate_card(credit_card):
             raise InvalidCard("Invalid Card")
         payment_method = PaymentMethod.create(credit_card.number, 
                                                     credit_card.verification_value, 
                                                     credit_card.month, credit_card.year)
     else:
         # Using the token which has to be retained
         payment_method = PaymentMethod.find(credit_card)
         if payment_method.errors:
             transaction_was_unsuccessful.send(sender=self, 
                                               type="store",
                                               response=payment_method)
             return {'status': 'FAILURE', 'response': payment_method}
     response = payment_method.retain()
     if response.errors:
         transaction_was_unsuccessful.send(sender=self, 
                                           type="store",
                                           response=response)
         return {'status': 'FAILURE', 'response': response}
     transaction_was_successful.send(sender=self, 
                                     type="store",
                                     response=response)
     return {'status': 'SUCCESS', 'response': response}
开发者ID:atmb4u,项目名称:merchant,代码行数:27,代码来源:samurai_gateway.py

示例2: unstore

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def unstore(self, identification, options=None):
     payment_method = PaymentMethod.find(identification)
     if payment_method.errors:
         return {"status": "FAILURE", "response": payment_method}
     payment_method = payment_method.redact()
     if payment_method.errors:
         return {"status": "FAILURE", "response": payment_method}
     return {"status": "SUCCESS", "response": payment_method}
开发者ID:SimpleTax,项目名称:merchant,代码行数:10,代码来源:samurai_gateway.py

示例3: test_find_should_be_successful

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def test_find_should_be_successful(self):
   pm = PaymentMethod.create(**params)
   token = pm.payment_method_token
   pm = PaymentMethod.find(token)
   self.assertTrue(self.pm.is_sensitive_data_valid)
   self.assertTrue(self.pm.is_expiration_valid)
   self.assertEqual(self.pm.first_name, params['first_name'])
   self.assertEqual(self.pm.last_name, params['last_name'])
   self.assertEqual(self.pm.address_1, params['address_1'])
   self.assertEqual(self.pm.address_2, params['address_2'])
   self.assertEqual(self.pm.city, params['city'])
   self.assertEqual(self.pm.state, params['state'])
   self.assertEqual(self.pm.zip, params['zip'])
   self.assertEqual(self.pm.last_four_digits, params['card_number'][-4:])
   self.assertEqual(self.pm.expiry_month, int(params['expiry_month']))
   self.assertEqual(self.pm.expiry_year, int(params['expiry_year']))
开发者ID:FeeFighters,项目名称:samurai-client-python,代码行数:18,代码来源:test_payment_method.py

示例4: unstore

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def unstore(self, identification, options=None):
     payment_method = PaymentMethod.find(identification)
     if payment_method.errors:
         transaction_was_unsuccessful.send(sender=self, 
                                           type="unstore",
                                           response=payment_method)
         return {"status": "FAILURE", "response": payment_method}
     payment_method = payment_method.redact()
     if payment_method.errors:
         transaction_was_unsuccessful.send(sender=self, 
                                           type="unstore",
                                           response=payment_method)
         return {"status": "FAILURE", "response": payment_method}
     transaction_was_successful.send(sender=self, 
                                     type="unstore",
                                     response=payment_method)
     return {"status": "SUCCESS", "response": payment_method}
开发者ID:atmb4u,项目名称:merchant,代码行数:19,代码来源:samurai_gateway.py

示例5: test_find_should_fail_on_an_invalid_token

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def test_find_should_fail_on_an_invalid_token(self):
     pm = PaymentMethod.find('abc123')
     err = "Couldn't find PaymentMethod with token = abc123"
     self.assertIn({'context': 'system.general', 'key': 'default', 'subclass':'error', 'text':err}, pm.error_messages)
开发者ID:FeeFighters,项目名称:samurai-client-python,代码行数:6,代码来源:test_payment_method.py

示例6: unstore

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def unstore(self, identification, options=None):
     from samurai.payment_method import PaymentMethod
     payment_method = PaymentMethod.find(identification)
     payment_method = payment_method.redact()
     return {"status": "SUCCESS", "response": payment_method}
开发者ID:hayyat,项目名称:merchant,代码行数:7,代码来源:samurai_gateway.py

示例7: test_find_should_fail_on_an_invalid_token

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def test_find_should_fail_on_an_invalid_token(self):
     pm = PaymentMethod.find('abc123')
     err = "Couldn't find PaymentMethod with token = abc123"
     self.assertIn(err, pm.error_messages)
开发者ID:thoughtnirvana,项目名称:samurai-client-python,代码行数:6,代码来源:test_payment_method.py

示例8: __init__

# 需要导入模块: from samurai.payment_method import PaymentMethod [as 别名]
# 或者: from samurai.payment_method.PaymentMethod import find [as 别名]
 def __init__(self, pmt):
     """Given a payment method token, loads data from Samurai.
     """
     if pmt is not None:
        self._payment_method = SamuraiPaymentMethod.find(pmt)
开发者ID:bglusman,项目名称:www.gittip.com,代码行数:7,代码来源:billing.py


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