-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Braintree Blue: Update card verfification payload if billing address fields are not present #5142
Conversation
9c7a95f
to
847e910
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this IRL and think maybe we need further investigation:
- Why are we only sending
zip
in thebilling_address
hash? - Is
billing_address
optional? ie, if it's empty inoptions
should we just skip adding it to the payload?
The nature of the error message (Addresses must have at least one field filled in.
) led us to wonder about this, because it doesn't seem like the Braintree API is rejecting an empty zip
per se; rather, it seems like a billing_address
object with no details included is the problem
That error message would also be a strange one to receive (as an end user) if there were other details in the billing_address
hash, but not zip
Braintrees card verification documentation requires: |
847e910
to
1125374
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the changes to the gateway model look good; my only request is for some updates to the remote test suite:
test_successful_credit_card_verification
now returns a failure because the AVS Result Code comes back asM
instead ofP
. This is expected because we are sending more information to Braintree; as I understand it,M
means street and postal code match, whileP
means there's a postal code match but street can't be confirmed.P
was accurate for the previous zip-only logic, but now we are sending more than that.- Can you add assertions for your new tests that check the
response.avs_result['code']
, similar to the above failing test?
1125374
to
bbae39c
Compare
Good callout! I updated the remote tests with more of the avs and cvv code assertions. Interestingly enough and expected, when not sending any address related fields, the code given back was a "B" meaning AVS checks were skipped for this transaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
bbae39c
to
8a1f34e
Compare
8a1f34e
to
83157ff
Compare
83157ff
to
32e4da3
Compare
This lets us gracefully return an error code or message from Braintree if the postal zip code is missing.
Local:
5923 tests, 79804 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Unit:
103 tests, 218 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
Remote:
121 tests, 649 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed