gravityplus / gravity-forms-braintree

Braintree Gravity Forms Add-On
https://wordpress.org/plugins/gravity-forms-braintree/
3 stars 13 forks source link

Credit cards entered with dashes fail validation, but submit to braintree for settlement #14

Closed gregblass closed 10 years ago

gregblass commented 10 years ago

If the user enters their credit card number with dashes (XXXX-XXXX-XXXX-XXXX), I'm showing the transaction as submitted for settlement in my braintree sandbox account, even though validations fail (red message comes up).

This could be pretty confusing and cause multiple charges in a live environment.

I'm going to see what I can do with this but I am completely new to this codebase, so if any of you guys can figure this out sooner than I can, that'd be awesome too.

lukerollans commented 10 years ago

One would think that if a transaction was invalid that Braintree wouldn't send back a success message. I'll give this a test and see what's going on!

gregblass commented 10 years ago

Braintree doesn't send back a success message at all. The gravity forms validations come back as red on that field. But the transactions are going through.

I was able to remedy this for the time being by enabling HTML5 form validations in gravity forms to prevent the user from entering in dashes in the credit card field. But I really think that the code should be fixed on the server too.

lukerollans commented 10 years ago

That makes things clearer.

Well, if Braintree is flagging it as an invalid transaction and Gravity Forms validation is erroring, that's what you want. I don't really see this as an issue.

Every merchant will have invalid transactions in their account, that's just the nature of E-Commerce.

Although, we can strip slashes from the credit card number before sending to Braintree which should avoid any confusion.

Will test and get a patch in to the next version if necessary. Or, feel free to submit a pull request.

Thanks for taking the time to open an issue!

gregblass commented 10 years ago

No - Braintree is NOT flagging it as an invalid transaction. Its going through FINE to braintree and gets put through as submitted for settlement.

Yet to the user, it looks like it didn't go through yet because the validations fail. Thats a serious issue.

lukerollans commented 10 years ago

Ah, right, thanks for clarifying. Your opening sentence on the first comment was a bit ambiguous

I'm showing the transaction as submitted for settlement in my braintree sandbox account, even though validations fail (red message comes up).

We'll test this as a matter of urgency and release a new version with a fix. Thanks!

gregblass commented 10 years ago

I'd be happy to try to patch it myself but I looked through the code and I'm not sure where it would go as I don't have much of a grasp of the code as a whole.

Check out what they did here with another plugin: (cleanCcNumber)

https://github.com/webaware/gravityforms-eway/commit/90c70e0ac773de7afb8cf25f84197c91c8fe973b

lukerollans commented 10 years ago

Patched to 1.1.1

New version will be up on WordPress SVN shortly.

We could not replicate adding dashes in to the credit card field with our version of Gravity Forms as this was invalidated natively, but the issue is patched regardless.

gregblass commented 10 years ago

Thanks!

If you turn off HTML5 form validations you should be able to replicate the issue.