I just retested this, and the server side credit card validation is working for ALL the 'submit credit card xxx' forms EXCEPT "Submit Credit Card Contribution".
The error noted by Jitendra is NOT a form validation error - but demonstrates that validation on the credit card did NOT happen (and the process continued through to an expected error from the Payment Processor.
When this is working properly, the form should reload with the field validation error displayed next to the credit card field AND in the pop-up message. Screenshot showing how this works in Submit Credit Card Membership form is attached.
Submitted a PR : https://github.com/civicrm/civicrm-core/pull/5178
Jitendra - The current patch adds the field validation but we should also be displaying the error on the form as done in Submit Credit Card Membership (see attached), and as already done for invalid Card Exp Date.
PR that fixes regression in membership and also fixes the issue: https://github.com/civicrm/civicrm-core/pull/5278
There's one issue with the current formRule behavior. If you do NOT select a credit card type, the form validation mistakenly returns invalid Credit Card Number and Security Code error messages. I think this could be confusing for users. Screenshot attached.
(In 4.5 we also did client-side validation on the credit card # (onblur) which I think was helpful. Was this dropped for a reason - maybe to allow more flexibility on different payment methods ??)
Spurious error messages when Card Type is not selected.
Added javascript validation for credit card number: https://github.com/civicrm/civicrm-core/pull/5338
Now user won't be able to submit until CC error is corrected.
Kurund - The erroneous errors when a Card Type is not selected are still happening. See new screenshot. It SHOULD give a 'Card Type is required.' error in this case, rather than reporting (erroneously) that the credit card number and security code are invalid.
This is a non-critical usability issue in my opinion, so if it's difficult to fix (due to changes in the code to handle different payment types ??) - then just close the issue for now.
I just tried to replicate this, but was unable to do so. I followed the following steps :-
1) Opened the "Submit Credit Card Contribution" Form for a contact and filled the appropriate fields with wrong entry in CC # textbox.
2) Clicked on Save Button.
3) I get a proper Server Validation Message as "This transaction cannot be processed. Please enter a valid credit card number and type" (Screenshot Attached).
Also checked the same on 'Submit Credit Card Membership' form. Please let me know if I'm missing anything.
Thanks.