function uc_pma_order in Ubercart Payment Method Adjustments 6
Same name and namespace in other branches
- 7 uc_pma.module \uc_pma_order()
Implementation of hook_order().
File
- ./
uc_pma.module, line 97 - This module hooks into a few different parts of Ubercart to allow store administrators to associate a fee or discount with payment methods.
Code
function uc_pma_order($op, &$arg1) {
switch ($op) {
case 'save':
$adjustment = _payment_method_adjustment($arg1);
db_query("DELETE FROM {uc_order_line_items} WHERE order_id = %d AND type = 'payment_method'", $arg1->order_id);
$min_adjust = 0.01;
if ($adjustment['value'] && ($adjustment['value'] >= $min_adjust || $adjustment['value'] <= -$min_adjust)) {
uc_order_line_item_add($arg1->order_id, 'payment_method', $adjustment['description'], $adjustment['value'], 1);
}
break;
}
}