function commerce_square_payment_transaction_access in Commerce Square Connect 7
Access callback for transaction forms.
Parameters
object $order: The order.
object $transaction: The transaction.
string $type: The operation type.
Return value
bool The access.
1 string reference to 'commerce_square_payment_transaction_access'
- commerce_square_menu in ./
commerce_square.module - Implements hook_menu().
File
- ./
commerce_square.module, line 761 - Module file for Commerce Square.
Code
function commerce_square_payment_transaction_access($order, $transaction, $type) {
if ($transaction->payment_method != 'commerce_square') {
return FALSE;
}
if (!entity_access('update', 'commerce_payment_transaction', $transaction)) {
return FALSE;
}
if ($transaction->amount <= 0) {
return FALSE;
}
switch ($type) {
case 'void':
return $transaction->status == COMMERCE_PAYMENT_STATUS_PENDING;
case 'capture':
return $transaction->status == COMMERCE_PAYMENT_STATUS_PENDING;
case 'refund':
return $transaction->status == COMMERCE_PAYMENT_STATUS_SUCCESS;
default:
return FALSE;
}
}