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;
Comments
Post new comment