function pay_transaction::do_action in Pay 6
Same name and namespace in other branches
- 7 includes/handlers/pay_transaction.inc \pay_transaction::do_action()
Perform an action on this transaction.
Actions might include anything returned by $this->available_actions().
File
- includes/
handlers/ pay_transaction.inc, line 172 - A base class for payment transactions.
Class
- pay_transaction
- @file A base class for payment transactions.
Code
function do_action($action, $context = array()) {
$result = TRUE;
if ($action == 'delete') {
$result = $this
->delete();
}
elseif ($this
->valid_action($action)) {
// Inflict this action against each payment method that has been used.
foreach ($this
->pay_method_activities() as $pmid => $history) {
$pay_method = pay_method_load($pmid);
// Add a new activity with this payment method and execute it.
if ($pay_method
->valid_action($action, $this, $history)) {
$result = $result && $this
->add_activity($pay_method)
->do_activity($action);
}
}
}
return $result;
}