You are here

function pay_transaction_valid_action in Pay 7

Same name and namespace in other branches
  1. 6 pay.module \pay_transaction_valid_action()

Wrapper for $pay_transaction->valid_action(), to be used as a menu callback.

1 string reference to 'pay_transaction_valid_action'
pay_menu_menu in includes/pay.menu.inc
Implementation of hook_menu().

File

./pay.module, line 582
Pay module allows for accepting payments using pluggable payment backends.

Code

function pay_transaction_valid_action($pay_transaction, $action) {

  // Not a valid action for this transaction.  Skip it and return FALSE.
  if (!$pay_transaction
    ->valid_action($action)) {
    return FALSE;
  }

  // Return TRUE for payment administrators for this/all forms.
  if (user_access('administer payments for any form')) {
    return TRUE;
  }
  $handler = $pay_transaction
    ->pay_form()
    ->handler();
  if (user_access('administer payments for ' . $handler . ' forms')) {
    return TRUE;
  }

  // Give up and return false.
  return FALSE;
}