You are here

function payment_ubercart_uc_order in Payment for Ubercart 7.2

Same name and namespace in other branches
  1. 7 payment_ubercart.module \payment_ubercart_uc_order()

Implements hook_uc_order().

File

./payment_ubercart.module, line 38
Hook implementations and shared functions.

Code

function payment_ubercart_uc_order($op, $order, $arg2) {
  if (strpos($order->payment_method, 'payment_ubercart_') === 0) {
    switch ($op) {
      case 'delete':
        if (variable_get('payment_ubercart_uc_order_delete', FALSE)) {
          $pids = payment_ubercart_pids_load($order->order_id);
          if ($pids) {
            entity_delete_multiple('payment', $pids);
          }
        }
        break;
      case 'submit':
        $pids = payment_ubercart_pids_load($order->order_id);
        if ($pids) {
          $payment = entity_load_single('payment', end($pids));
          $payment
            ->execute();
        }
        break;
    }
  }
}