You are here

function uc_authorizenet_menu in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_authorizenet/uc_authorizenet.module \uc_authorizenet_menu()
  2. 7.3 payment/uc_authorizenet/uc_authorizenet.module \uc_authorizenet_menu()

Implementation of hook_menu().

File

payment/uc_authorizenet/uc_authorizenet.module, line 14
Process payments using Authorize.net. Supports AIM and ARB.

Code

function uc_authorizenet_menu($may_cache) {
  $items = array();
  global $user;
  if ($may_cache) {
    $items[] = array(
      'path' => 'authnet/silent-post',
      'callback' => 'uc_authorizenet_silent_post',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
  }
  else {

    // User operations menu items.
    if (arg(0) == 'user' && arg(2) == 'recurring' && intval(arg(3)) > 0) {
      $items[] = array(
        'path' => 'user/' . arg(1) . '/recurring/' . arg(3) . '/arb-update',
        'title' => t('Update your payment details'),
        'description' => t('Update the payment details for a recurring fee.'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'uc_authorizenet_arb_user_update_form',
          arg(1),
          arg(3),
        ),
        'access' => $user->uid == intval(arg(1)) || user_access('administer recurring fees'),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'user/' . arg(1) . '/recurring/' . arg(3) . '/arb-cancel',
        'title' => t('Cancel the recurring fee?'),
        'description' => t('Cancel a recurring fee.'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'uc_authorizenet_arb_user_cancel_form',
          arg(1),
          arg(3),
        ),
        'access' => $user->uid == intval(arg(1)) || user_access('administer recurring fees'),
        'type' => MENU_CALLBACK,
      );
    }

    // Admin operations menu items.
    if (arg(3) == 'recurring' && intval(arg(4)) > 0) {
      if (arg(5) == 'arb-update') {
        $items[] = array(
          'path' => 'admin/store/orders/recurring/' . arg(4) . '/arb-update',
          'title' => t('Update ARB subscription', array(
            '@fee' => arg(4),
          )),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_authorizenet_arb_admin_update_form',
            arg(4),
          ),
          'access' => user_access('administer recurring fees'),
          'type' => MENU_CALLBACK,
        );
      }
      elseif (arg(5) == 'arb-cancel') {
        $items[] = array(
          'path' => 'admin/store/orders/recurring/' . arg(4) . '/arb-cancel',
          'title' => t('Cancel ARB subscription'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_authorizenet_arb_admin_cancel_form',
            arg(4),
          ),
          'access' => user_access('administer recurring fees'),
          'type' => MENU_CALLBACK,
        );
      }
    }
  }
  return $items;
}