Ruby on rails result.credit_card_验证返回零,即使braintree中出现错误
我正在使用braintree进行支付处理,我正在尝试使用Ruby从braintree获取信息 这是我的密码:Ruby on rails result.credit_card_验证返回零,即使braintree中出现错误,ruby-on-rails,ruby,ruby-on-rails-3,payment-processing,braintree,Ruby On Rails,Ruby,Ruby On Rails 3,Payment Processing,Braintree,我正在使用braintree进行支付处理,我正在尝试使用Ruby从braintree获取信息 这是我的密码: verification = result.credit_card_verification response_code = verification.try(:processor_response_code) 即使有错误,我也会得到零验证 是否还有其他东西可以获取处理器响应代码 我从你那里得到这个密码 这是我的结果。错误: :errors: !ruby/object:Braint
verification = result.credit_card_verification
response_code = verification.try(:processor_response_code)
即使有错误,我也会得到零验证
是否还有其他东西可以获取处理器响应代码
我从你那里得到这个密码
这是我的结果。错误:
:errors: !ruby/object:Braintree::Errors
errors: !ruby/object:Braintree::ValidationErrorCollection
errors: []
nested:
:customer: !ruby/object:Braintree::ValidationErrorCollection
errors: []
nested:
:credit_card: !ruby/object:Braintree::ValidationErrorCollection
errors:
- !ruby/object:Braintree::ValidationError
code: '81707'
attribute: cvv
message: CVV must be 4 digits for American Express and 3 digits for
other card types.
- !ruby/object:Braintree::ValidationError
code: '81713'
attribute: expiration_year
message: Expiration year is invalid.
- !ruby/object:Braintree::ValidationError
code: '81703'
attribute: number
message: Credit card type is not accepted by this merchant account.
- !ruby/object:Braintree::ValidationError
code: '81715'
attribute: number
message: Credit card number is invalid.
nested:
:billing_address: !ruby/object:Braintree::ValidationErrorCollection
errors: []
nested: {}
我在Braintree工作。如果您希望得到更多关于堆栈溢出的帮助,请联系
处理是渐进的
如果result.success?
为false
,则检查表示错误的result.errors
如果result.errors
为nil
,则请求有效。在这种情况下,您将拥有一个事务
或验证
对象,就像结果一样。成功?
是真的
然后可以查看结果。验证
状态,处理器响应
,网关拒绝
原因等
链接文档提供了有关处理错误结果的更多详细信息。我在Braintree工作。如果存在验证错误,则不会进行验证。
结果。错误是什么样子的?@agf我已经更新了我的问题。实际上,我想处理所有错误,并根据处理器响应代码中列出的错误类型显示一些通用消息。顺便说一句,是否必须先显示此验证错误,然后再管理处理器响应代码?(或者您可以说是最佳实践),为什么不在所有部分的开发文档中明确说明???为什么只有交易部分有解释?。如果我做交易,它会说明如何做,但如果我做保险库的东西,就没有任何关于处理结果的内容。在这样一个复杂的结果对象上,文档读者不能假设它对事务的工作方式与对create\u customer\u数据的工作方式相同。顺便问一下,如果您提供了无效的参数,您会得到Braintree::AuthorizationError。exeption名称不清楚。@RutgerKarlsson,是的,它对于任何可以创建事务/验证的对象都是一致的。