spree/spree — pull request #3918 by NathanielWroblewski (2013-10-30 06:46:56+00:00)
Title: Set cc_type server-side in case of js failure

Currently, `cc_type` is set on the client-side using `jquery.payments`. This creates a single point of failure at malfunctioning or disabled javascript given that the lack of a `cc_type` on a payment source causes some spree gateways to fail. This pull request adds a redundant check on the server-side for cases where the javascript either fails or is disabled.

* Change `CreditCard#expiry=` to remove whitespace and split on `'/'` instead of splitting on `' / '` because when js fails, a user entry of `'04/12'` will break.
* Change `CreditCard#cc_type=` to match a type based on the card number when `cc_type` is an empty string, as is the case when js fails.