You are here

function pay_transaction_do_action in Pay 7

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

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

3 calls to pay_transaction_do_action()
pay_transaction_cancel_action in includes/pay.action.inc
Implementation of a Drupal action. Cancels a pending or preauthorized transaction.
pay_transaction_complete_action in includes/pay.action.inc
Implementation of a Drupal action. Completes a pending or preauthorized transaction.
pay_transaction_delete_action in includes/pay.action.inc
Implementation of a Drupal action. Deletes a transaction.
1 string reference to 'pay_transaction_do_action'
pay_menu_menu in includes/pay.menu.inc
Implementation of hook_menu().

File

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

Code

function pay_transaction_do_action($transaction, $action, $path = FALSE) {
  if ($transaction
    ->do_action($action)) {
    $info = $transaction->valid_actions[$action];
    if ($info['message']) {
      drupal_set_message($info['message']);
    }
  }

  // Redirect to the transaction page or the front page if it has been deleted.
  if ($path) {
    if ($path === TRUE) {
      $path = 'pay/transaction/' . $transaction->pxid;
      if ($action == 'delete') {
        $path = '<front>';
      }
    }
    drupal_goto($path);
  }
}