You are here

function payment_ubercart_uc_checkout_complete in Payment for Ubercart 7.2

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

Implements hook_uc_checkout_complete().

File

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

Code

function payment_ubercart_uc_checkout_complete($order, $account) {
  if (strpos($order->payment_method, 'payment_ubercart_') === 0) {
    $pids = payment_ubercart_pids_load($order->order_id);
    if ($pids) {
      $payment = entity_load_single('payment', end($pids));

      // For anonymous checkouts, set the payment UID to that of the order for
      // which a user account was created during checkout completion.
      if ($payment->uid != $order->uid) {
        $payment->uid = $order->uid;
        entity_save('payment', $payment);
      }
    }
  }
}