You are here

function hook_payment_method_callback in Ubercart 6.2

Callback function to perform various operations for a payment method.

Possible operations are as follows:

  • "cart-details": The payment method has been selected at checkout. Return HTML to be displayed in the payment method pane.
  • "cart-process": Called when the user submits the checkout form with this payment method selected, used to process any form elements output by the 'cart-details' op. Return FALSE to abort the checkout process, or NULL or TRUE to continue with checkout.
  • "cart-review": Called when the checkout review page is being displayed. Return an array of data to be displayed below the payment method title on the checkout review page.
  • "customer-view": Called when the order is being displayed to a customer. Return HTML to be displayed to customers.
  • "order-delete": Called when an order is being deleted. Payment methods should clean up any extra data they stored related to the order.
  • "order-details": Called when an order is being edited by an administrator. Return a string or a form array to be displayed to the administator.
  • "order-load": Called from hook_uc_order('load') when this payment method is selected for the order.
  • "order-process": Called when an order has been edited by an administrator. Process any form elements returned by the "order-details" op.
  • "order-save": Called from hook_uc_order('save') when this payment method is selected for the order.
  • "order-submit": Called from hook_uc_order('submit') when this payment method is selected for the order.
  • "order-view": Called when the order is being displayed on the order admin pages. Return HTML to be displayed to administrators.
  • "settings": Called when the payment methods page is being displayed. Return a system settings form array to configure the payment method.

Parameters

$op: The operation being performed.

&$arg1: The order object that relates to this operation.

$silent: If TRUE, the callback should not call drupal_set_message().

Return value

Dependent on $op.

See also

hook_payment_method()

1 string reference to 'hook_payment_method_callback'
hook_payment_method in docs/hooks.php
Registers callbacks for payment methods.

File

docs/hooks.php, line 1107
These are the hooks that are invoked by the Ubercart core.

Code

function hook_payment_method_callback($op, &$arg1, $silent = FALSE) {
  switch ($op) {
    case 'cart-details':
      return array(
        '#markup' => t('Continue with checkout to complete payment.'),
      );
    case 'settings':
      $form['uc_payment_method_account_number'] = array(
        '#type' => 'textfield',
        '#title' => t('Payment gateway account number'),
        '#default_value' => variable_get('uc_payment_method_account_number', ''),
      );
      return $form;
  }
}