You are here

function uc_payment_order in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_payment/uc_payment.module \uc_payment_order()

Implements hook_order().

File

payment/uc_payment/uc_payment.module, line 238

Code

function uc_payment_order($op, $order) {
  switch ($op) {
    case 'submit':
      $func = _payment_method_data($order->payment_method, 'callback');
      if (function_exists($func)) {
        return $func('order-submit', $order);
      }
      break;
    case 'load':
      $func = _payment_method_data($order->payment_method, 'callback');
      if (function_exists($func)) {
        $func('order-load', $order);
      }
      break;
    case 'save':
      $func = _payment_method_data($order->payment_method, 'callback');
      if (function_exists($func)) {
        $func('order-save', $order);
      }
      break;
    case 'can_delete':
      if (uc_payment_load_payments($order->order_id) !== FALSE) {
        return FALSE;
      }
      break;
    case 'delete':
      db_query("DELETE FROM {uc_payment_receipts} WHERE order_id = %d", $order->order_id);

      // Call each payment method to delete method specific data from the database.
      $methods = _payment_method_list();
      foreach ($methods as $method) {
        $func = $method['callback'];
        if (function_exists($func)) {
          $func('order-delete', $order);
        }
      }
      break;
  }
}