spree/spree — pull request #4412 by huoxito (2014-03-08 04:47:30+00:00)
Title: Remember customer credit cards on checkout

Mostly inspired by Jeff Squires, @jsqu99, spree_reuse_credit_card extension, see
https://github.com/jsqu99/spree_reuse_credit_card

Once customers enter their cc info and recurring tokens are saved for
those credit cards the store can remember that info and display the
cards back to the customers so they don't have to enter cc info again

![screen shot 2014-03-08 at 1 31 49 am](https://f.cloud.github.com/assets/245662/2364535/5447fdc8-a67b-11e3-92ca-4006dff3337d.png)

This is a work in progress still want to add a couple more tweaks here and of course get some much appreciated feedback.

- [ ] feature specs for reusing cards / not reusing them even then they're present on the page
- [ ] display only cards with a reference token (otherwise I believe the gateway won't know how to reuse them)
- [ ] provide common interface for destroying card info from a customer perspective

My idea here is merge it in both master and 2-2-stable. Please try it out when you have chance. :) All you need is run spree on this branch and add this code somewhere in your rails app (assuming you user class is Spree::User):

```ruby
Spree::User.has_many :credit_cards
```

Spree backend already offers a very similar feature except that it only remembers credit cards attach to the specific current order.