You are here

function uc_payment_delete in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 payment/uc_payment/uc_payment.module \uc_payment_delete()
  2. 5 payment/uc_payment/uc_payment.module \uc_payment_delete()
  3. 7.3 payment/uc_payment/uc_payment.module \uc_payment_delete()

Deletes a payment from the database.

1 call to uc_payment_delete()
uc_payment_delete_confirm_form_submit in payment/uc_payment/uc_payment.admin.inc
Form submission handler for uc_payment_delete_confirm_form().

File

payment/uc_payment/uc_payment.module, line 685

Code

function uc_payment_delete($receipt_id) {
  if (!is_numeric($receipt_id)) {
    return FALSE;
  }
  if (variable_get('uc_payment_logging', TRUE)) {
    global $user;
    $payment = uc_payment_load($receipt_id);
    $context = array(
      'revision' => 'formatted',
      'type' => 'payment',
      'subject' => array(
        'payment' => $payment,
      ),
    );
    $log_message = t('@method payment for @amount deleted by @user.', array(
      '@method' => $payment->method,
      '@amount' => uc_price($payment->amount, $context),
      '@user' => uc_get_initials($user->uid),
    ));
    uc_order_log_changes($payment->order_id, array(
      $log_message,
    ));
  }
  db_query("DELETE FROM {uc_payment_receipts} WHERE receipt_id = %d", $receipt_id);
}