User login

Store credit card type, automatically determined from credit card number, for Ubercart

If the user selects a credit card type, store it (this is committed)
http://www.ubercart.org/forum/general_discussion/8157/storage_credit_card_type_info

A patch to fix this for admin interface also, linked from that issue too.

But that's not what we want. We want the card type automatically figured out.

Something like this in a new module's invocation of hook_order may work. This is pseudo-code, will not work as is:

    case 'save':
      if ($arg1->payment_method == 'credit') {
        // Build an array of CC data to store with the order.
        if (!empty($arg1->payment_details)) {
          $cc_number = $arg1->payment_details['cc_number'];
// Parse to make CC type
// AmEx starts with 34 or 37, Visa with 4, and MC with 51-55.
// See http://en.wikipedia.org/wiki/Bank_card_number
//       'cc_type' => check_plain($arg1->payment_details['cc_type']), // DFM 1.13.09 save Credit Card type (Visa, MC, etc.)

          // Need to look up this function and probably use parts of it, as it probably overwrites rather than merges with what was before (or we could fill out all cc_data again and simply overwrite)
          _save_cc_data_to_order($cc_data, $arg1->order_id);
        }
      }
      break;

Searched words: 
automatic ubercart card type MasterCard, Visa, American Express

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.