I don't have a minimal test case for this yet, but I wanted to get some notes down on the behavior I'm seeing.
Given I have turned on verification:
FakeBraintree.verify_all_cards!
When I submit a TR request with an "invalid" credit card number ("1234123412341234"), I get back an error result with a string where the params hash should be:
(rdb:1) p result
#<Braintree::ErrorResult params:{...} errors:<> credit_card_verification: #<Braintree::CreditCardVerification status: nil, processor_response_code: nil, processor_response_text: nil, cvv_response_code: nil, avs_error_response_code: nil, avs_postal_code_response_code: nil, avs_street_address_response_code: nil, merchant_account_id: nil, gateway_rejection_reason: "cvv", id: nil, credit_card: nil, billing: nil, created_at: nil>>
(rdb:1) p result.params
"\n "
Weirdly, result.inspect suggests params is a hash, but result.params is a string. I'd expect it to be a hash of the user-submitted params, which I can use to repopulate the form.
(I don't know why it's saying the rejection is due to "cvv"; AFAIK it's only the card number that's invalid.)
I looked at the situation from within FakeBraintree::Customer#failure_response:
/Users/eostrom/.rvm/gems/ruby-1.9.3-p194@iowl/gems/fake_braintree-0.2.1/lib/fake_braintree/customer.rb:164
gzipped_response(code, FakeBraintree.failure_response(credit_card_number).to_xml(:root => 'api_error_response'))
(rdb:2) p FakeBraintree.failure_response(credit_card_number)
{"message"=>nil, "verification"=>{"status"=>nil, "processor_response_text"=>nil, "processor_response_code"=>nil, "gateway_rejection_reason"=>"cvv", "cvv_response_code"=>nil}, "errors"=>{"errors"=>[]}, "params"=>{}}
(rdb:2) p FakeBraintree.failure_response(credit_card_number).to_xml(:root => 'api_error_response')
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<api-error-response>\n <message nil=\"true\"/>\n <verification>\n <status nil=\"true\"/>\n <processor-response-text nil=\"true\"/>\n <processor-response-code nil=\"true\"/>\n <gateway-rejection-reason>cvv</gateway-rejection-reason>\n <cvv-response-code nil=\"true\"/>\n </verification>\n <errors>\n <errors type=\"array\"/>\n </errors>\n <params>\n </params>\n</api-error-response>\n"
I don't know if that's how an empty hash should be encoded to XML (it doesn't seem to be decoded properly, by whatever's decoding it), but I don't think the params hash should be empty in the first place.
I'm using Ruby 1.9.3, Rails 3.2.12, Braintree 2.22.0, Fake Braintree 0.2.1, and obviously a bunch of other gems. I'd appreciate any informed suggestions about where the trouble might be, or how to figure that out.
I don't have a minimal test case for this yet, but I wanted to get some notes down on the behavior I'm seeing.
Given I have turned on verification:
When I submit a TR request with an "invalid" credit card number ("1234123412341234"), I get back an error result with a string where the
paramshash should be:Weirdly,
result.inspectsuggestsparamsis a hash, butresult.paramsis a string. I'd expect it to be a hash of the user-submitted params, which I can use to repopulate the form.(I don't know why it's saying the rejection is due to "cvv"; AFAIK it's only the card number that's invalid.)
I looked at the situation from within FakeBraintree::Customer#failure_response:
I don't know if that's how an empty hash should be encoded to XML (it doesn't seem to be decoded properly, by whatever's decoding it), but I don't think the
paramshash should be empty in the first place.I'm using Ruby 1.9.3, Rails 3.2.12, Braintree 2.22.0, Fake Braintree 0.2.1, and obviously a bunch of other gems. I'd appreciate any informed suggestions about where the trouble might be, or how to figure that out.