• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python processor.Processor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_capture_should_return_processor_transaction_declined

 def test_capture_should_return_processor_transaction_declined(self):
     auth = Processor.authorize(self.pm.payment_method_token, 100.00)
     capture = auth.capture(100.02)
     self.assertFalse(capture.success)
     err = {'context': 'processor.transaction', 'key': 'declined', 'subclass': 'error'}
     self.assertIn(err, capture.error_messages)
     self.assertIn('The card was declined.', capture.errors['processor.transaction'])
开发者ID:FeeFighters,项目名称:samurai-client-python,代码行数:7,代码来源:test_transaction.py


示例2: test_capture_should_return_input_amount_invalid

 def test_capture_should_return_input_amount_invalid(self):
     auth = Processor.authorize(self.pm.payment_method_token, 100.00)
     capture = auth.capture(100.10)
     self.assertFalse(capture.success)
     err = {'context': 'input.amount', 'key': 'invalid', 'subclass': 'error'}
     self.assertIn(err, capture.error_messages)
     self.assertIn('The transaction amount was invalid.', capture.errors['input.amount'])
开发者ID:FeeFighters,项目名称:samurai-client-python,代码行数:7,代码来源:test_transaction.py


示例3: test_cvv_should_return_processor_cvv_result_code_N

 def test_cvv_should_return_processor_cvv_result_code_N(self):
     token = test_helper.default_payment_method({'cvv':'222'}).payment_method_token
     purchase = Processor.purchase(token,
                                   1.00,
                                   billing_reference=self.rand)
     self.assertTrue(purchase.success)
     self.assertEqual(purchase.processor_response['cvv_result_code'], 'N')
开发者ID:thoughtnirvana,项目名称:samurai-client-python,代码行数:7,代码来源:test_processor.py


示例4: authorize

def authorize(participant_id, pmt):
    """Given two unicodes, return a dict.

    This function attempts to authorize the credit card details referenced by
    pmt. If the attempt succeeds we cancel the transaction. If it fails we log
    the failure. Even for failure we keep the payment_method_token, we don't
    reset it to None/NULL. It's useful for loading the previous (bad) credit
    card info from Samurai in order to prepopulate the form.

    """
    typecheck(pmt, unicode, participant_id, unicode)
    transaction = Processor.authorize(pmt, '1.00', custom=participant_id)
    if transaction.errors:
        last_bill_result = json.dumps(transaction.errors)
        out = dict(transaction.errors)
    else:
        transaction.reverse()
        last_bill_result = ''
        out = {}
        
    STANDING = """\

    UPDATE participants
       SET payment_method_token=%s
         , last_bill_result=%s 
     WHERE id=%s

    """
    db.execute(STANDING, (pmt, last_bill_result, participant_id))
    return out
开发者ID:bglusman,项目名称:www.gittip.com,代码行数:30,代码来源:billing.py


示例5: test_authorize_should_return_processor_avs_result_code_Y

 def test_authorize_should_return_processor_avs_result_code_Y(self):
     token = test_helper.default_payment_method({'address_1':'1000 1st Av',
                                                 'address_2':'',
                                                 'zip':'10101'}).payment_method_token
     purchase = Processor.authorize(token,
                                   1.00,
                                   billing_reference=self.rand)
     self.assertTrue(purchase.success)
     self.assertEqual(purchase.processor_response['avs_result_code'], 'Y')
开发者ID:thoughtnirvana,项目名称:samurai-client-python,代码行数:9,代码来源:test_processor.py


示例6: test_purchase_should_return_processor_transaction_declined

 def test_purchase_should_return_processor_transaction_declined(self):
     token = self.pm.payment_method_token
     purchase = Processor.purchase(token,
                                   1.02,
                                   billing_reference=self.rand)
     self.assertFalse(purchase.success)
     err = {'context': 'processor.transaction', 'key': 'declined', 'subclass': 'error'}
     self.assertIn(err, purchase.error_messages)
     self.assertIn('The card was declined.' , purchase.errors['processor.transaction'])
开发者ID:thoughtnirvana,项目名称:samurai-client-python,代码行数:9,代码来源:test_processor.py


示例7: test_purchase_should_return_input_amount_invalid

 def test_purchase_should_return_input_amount_invalid(self):
     token = self.pm.payment_method_token
     purchase = Processor.purchase(token,
                                   1.10,
                                   billing_reference=self.rand)
     self.assertFalse(purchase.success)
     err = {'context': 'input.amount', 'key': 'invalid', 'subclass': 'error'}
     self.assertIn(err, purchase.error_messages)
     self.assertIn('The transaction amount was invalid.', purchase.errors['input.amount'])
开发者ID:thoughtnirvana,项目名称:samurai-client-python,代码行数:9,代码来源:test_processor.py


示例8: test_should_return_processor_avs_result_code_N

 def test_should_return_processor_avs_result_code_N(self):
     token = test_helper.default_payment_method({'address_1':'123 Main St',
                                                'address_2':'',
                                                'zip':'60610'}).payment_method_token
     purchase = Processor.purchase(token,
                                   1.00,
                                   billing_reference=self.rand)
     self.assertTrue(purchase.success)
     self.assertEqual(purchase.processor_response['avs_result_code'], 'N')
开发者ID:thoughtnirvana,项目名称:samurai-client-python,代码行数:9,代码来源:test_processor.py


示例9: authorize

 def authorize(self, money, credit_card, options=None):
     if not self.validate_card(credit_card):
         raise InvalidCard("Invalid Card")
     try:
         from samurai.payment_method import PaymentMethod
         from samurai.processor import Processor
         pm = PaymentMethod.create(credit_card.number, credit_card.verification_value, credit_card.month, credit_card.year)
         payment_method_token = pm.payment_method_token
         response = Processor.authorize(payment_method_token, money)
     except Exception, error:
         return {'status': 'FAILURE', 'response': error}
开发者ID:hayyat,项目名称:merchant,代码行数:11,代码来源:samurai_gateway.py


示例10: purchase

def purchase(request):
    token = request.GET.get('payment_method_token', None)
    trans = Processor.purchase(token, 10)
    if trans.errors:
        errors = parse_error(trans.errors)
        for err in errors:
            messages.error(request, err, fail_silently=True)
        return redirect('/transparent_redirect/payment_form')
    else:
        messages.success(request, 'Purchase Successful.', fail_silently=True)
        return render_to_response('/transparent_redirect/receipt.html')
开发者ID:thoughtnirvana,项目名称:samurai-example-python,代码行数:11,代码来源:views.py


示例11: purchase

def purchase(request):
    if request.method == 'POST':
        token = request.POST.get('payment_method_token', None)
        trans = Processor.purchase(token, 10)
        if trans.errors:
            success=False
        else:
            success=True
        return_data = simplejson.dumps({'transaction':{'success':success}})
        return HttpResponse(return_data)
    else:
        return redirect('/samurai_js/payment_form')
开发者ID:FeeFighters,项目名称:samurai-example-python,代码行数:12,代码来源:views.py


示例12: auth

 def auth(self, amount, credit_card=None, billing_info=None, shipping_info=None):
     # set up the card for charging, obviously
     card_token = self.charge_setup(credit_card, billing_info)
     # start the timer
     start = time.time()
     # send it over for processing
     response = Processor.authorize(card_token, amount)
     # measure time
     end = time.time() # done timing it
     response_time = '%0.2f' % (end-start)
     # return parsed response
     return self.parse(response, response_time)
开发者ID:AdamJacobMuller,项目名称:Paython,代码行数:12,代码来源:samurai_ff.py


示例13: authorize

 def authorize(self, money, credit_card, options=None):
     payment_method_token = credit_card
     if isinstance(credit_card, CreditCard):
         if not self.validate_card(credit_card):
             raise InvalidCard("Invalid Card")
         pm = PaymentMethod.create(credit_card.number, credit_card.verification_value, 
                                   credit_card.month, credit_card.year)
         payment_method_token = pm.payment_method_token
     response = Processor.authorize(payment_method_token, money)
     if response.errors:
         return {'status': 'FAILURE', 'response': response}
     return {'status': 'SUCCESS', 'response': response}
开发者ID:SimpleTax,项目名称:merchant,代码行数:12,代码来源:samurai_gateway.py


示例14: purchase

 def purchase(self, money, credit_card):
     # Cases where token is directly sent for e.g. from Samurai.js
     payment_method_token = credit_card
     if isinstance(credit_card, CreditCard):
         if not self.validate_card(credit_card):
             raise InvalidCard("Invalid Card")
         pm = PaymentMethod.create(credit_card.number, credit_card.verification_value,
                                   credit_card.month, credit_card.year)
         payment_method_token = pm.payment_method_token
     response = Processor.purchase(payment_method_token, money)
     if response.errors:
         return {'status': 'FAILURE', 'response': response}
     return {'status': 'SUCCESS', 'response': response}
开发者ID:SimpleTax,项目名称:merchant,代码行数:13,代码来源:samurai_gateway.py


示例15: test_purchase_should_be_successful

 def test_purchase_should_be_successful(self):
     options = {'description':'description',
                'descriptor_name':'descriptor_name',
                'descriptor_phone':'descriptor_phone',
                'custom':'custom',
                'billing_reference':'ABC123%s' % self.rand,
                'customer_reference':'Customer (123)'}
     token = self.pm.payment_method_token
     purchase = Processor.purchase(token, 10.0, None, **options)
     self.assertTrue(purchase.success)
     self.assertEquals(purchase.error_messages, [])
     self.assertEqual(purchase.description, 'description')
     self.assertEqual(purchase.descriptor_name, 'descriptor_name')
     self.assertEqual(purchase.descriptor_phone, 'descriptor_phone')
     self.assertEqual(purchase.custom, 'custom')
     self.assertEqual(purchase.billing_reference, 'ABC123%s' % self.rand)
     self.assertEqual(purchase.customer_reference, 'Customer (123)')
开发者ID:thoughtnirvana,项目名称:samurai-client-python,代码行数:17,代码来源:test_processor.py


示例16: test_purchase_should_return_invalid_sandbox_card_error

 def test_purchase_should_return_invalid_sandbox_card_error(self):
     data = {
         'custom' : '',
         'first_name' : '',
         'last_name' : '',
         'address_1' : '',
         'address_2' : '',
         'city' : '',
         'state' : '',
         'zip' : '10101',
         'card_number' : '5256486068715680',
         'cvv' : '111',
         'expiry_month' : '05',
         'expiry_year' : '2014',
       }
     token = test_helper.default_payment_method(data).payment_method_token
     purchase = Processor.purchase(token, 1.00)
     self.assertIn({'context': 'system.general', 'key': 'default', 'subclass': 'error', 'text': 'Invalid Sandbox Card Number. For more information, see: https://samurai.feefighters.com/developers/sandbox'}, purchase.error_messages)
开发者ID:FeeFighters,项目名称:samurai-client-python,代码行数:18,代码来源:test_processor.py


示例17: test_purchase_should_return_payment_method_errors_on_blank_pm

 def test_purchase_should_return_payment_method_errors_on_blank_pm(self):
     data = {
         'custom' : '',
         'first_name' : '',
         'last_name' : '',
         'address_1' : '',
         'address_2' : '',
         'city' : '',
         'state' : '',
         'zip' : '',
         'card_number' : '',
         'cvv' : '',
         'expiry_month' : '05',
         'expiry_year' : '2014',
       }
     token = test_helper.default_payment_method(data).payment_method_token
     purchase = Processor.purchase(token, 1.00)
     self.assertFalse(purchase.success)
     self.assertIn({'context': 'input.card_number', 'key': 'not_numeric', 'subclass': 'error'}, purchase.error_messages)
     self.assertIn({'context': 'input.card_number', 'key': 'too_short', 'subclass': 'error'}, purchase.error_messages)
     self.assertIn({'context': 'input.card_number', 'key': 'is_blank', 'subclass': 'error'}, purchase.error_messages)
开发者ID:FeeFighters,项目名称:samurai-client-python,代码行数:21,代码来源:test_processor.py


示例18: setUp

 def setUp(self):
     self.pm = test_helper.default_payment_method()
     self.rand = randint(100, 999)
     self.auth = Processor.authorize(self.pm.payment_method_token, 100.0)
     self.purchase = Processor.purchase(self.pm.payment_method_token, 100.0)
开发者ID:FeeFighters,项目名称:samurai-client-python,代码行数:5,代码来源:test_transaction.py


示例19: test_authorize_failure

 def test_authorize_failure(self):
     token = self.pm.payment_method_token
     trans = Processor.authorize(token, 10.02)
     errors = [{'context': 'processor.transaction', 'key': 'declined', 'subclass': 'error'}]
     self.assertEquals(trans.errors, errors)
开发者ID:edulender,项目名称:samurai-client-python,代码行数:5,代码来源:test_processor.py


示例20: test_purchase

 def test_purchase(self):
     token = self.pm.payment_method_token
     trans = Processor.purchase(token, 10.0)
     self.assertTrue(trans.success)
     self.assertEquals(trans.errors, [])
开发者ID:edulender,项目名称:samurai-client-python,代码行数:5,代码来源:test_processor.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utest.raises函数代码示例发布时间:2022-05-27
下一篇:
Python payment_method.PaymentMethod类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap