Through the Ubercart payment details rabbit hole
To program you have to crawl on your belly through a maze in a dark mine shaft memorizing all the turns until you find the problem, grope at it with your hands until you understand what's broken, back out slowly, and get the tool to fix it. Then you have to remember how you crawled in there to begin with.
Trying to figure out how the credit card type is currently stored— it splits into two parts on the saving side, and the part that seems to be kept gets some weird encryption... maybe this will be more straightforward to look at from the retrieval side.
Oops.
We know we see it on the page admin/store/orders/[number] and we find that this is defined by the hook_menu implementation in the file uc_order.module:
<?php
$items['admin/store/orders/%uc_order'] = array( ... )
?>
Which calls:
'page callback' => 'uc_order_view',
and is in:
'file' => 'uc_order.admin.inc',
Somewhere down inside the uc_order_view() function it becomes clear that this gets a whole bunch of different panes:
<?php
$panes = _order_pane_list($view);
foreach ($panes as $pane) {
if (in_array($view, $pane['show']) &&
variable_get('uc_order_pane_'. $pane['id'] .'_show_'. $view, $pane['enabled'])) {
$func = $pane['callback'];
if (function_exists($func) && ($contents = $func($view, $order)) != NULL) {
?>
uc_payment.module implements hook_order_pane() which is called above and returns uc_order_pane_payment() for its callback.
http://drupalcontrib.org/api/function/_save_cc_data_to_order/6
<?php
/**
* @file
* Module for determining credit card type from the first 2 digits.
* @see http://en.wikipedia.org/wiki/Bank_card_number
*/
/**
* Implements hook_order().
*/
function uccardtype_order($op, &$arg1, $arg2) {
drupal_set_message($op . '<pre>'.var_export($arg1,TRUE).'</pre>'); // @DEBUG
if ($op == 'save' && $arg1->payment_type == 'credit') {
$type = uccardtype_get($arg1->payment_details['cc_number']);
$arg1->payment_details['cc_type_auto'] = $type;
if (!$arg->payment_details['cc_type']) {
// If the user has not selected a type, set it to auto-determined one.
$arg1->payment_details['cc_type'] = $type;
}
}
}
?>
Comments
Post new comment