Commit df201085 authored by mattwire's avatar mattwire
Browse files

Don't allow refunds on negative amounts or if there is no trxn_id

parent 93064c6f
......@@ -233,6 +233,13 @@ function mjwshared_civicrm_links($op, $objectName, $objectId, &$links, &$mask, &
if ((int)$payment['status_id'] !== CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed')) {
return;
}
// Don't allow refunds if we have no trxn_id to match it against.
if (empty($payment['trxn_id'])) {
return;
}
if ($payment['total_amount'] < 0) {
return;
}
$paymentProcessor = \Civi\Payment\System::singleton()
->getById($payment['payment_processor_id']);
if ($paymentProcessor->supportsRefund()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment