You are here

function uc_payment_order in Ubercart 5

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

Implementation of hook_order().

File

payment/uc_payment/uc_payment.module, line 223

Code

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