// fetch available contribution statuses
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
+ $result = [];
// check for application errors
// TODO:
// AVS, CVV2, CAVV, and other verification results
switch ($response_fields[0]) {
case self::AUTH_REVIEW:
- $params['payment_status_id'] = array_search('Pending', $contributionStatus);
- $params['payment_status'] = 'Pending';
+ $result = $this->setStatusPaymentPending($result);
break;
case self::AUTH_ERROR:
default:
// Success
- $params['trxn_id'] = !empty($response_fields[6]) ? $response_fields[6] : $this->getTestTrxnID();
- $params['payment_status_id'] = array_search('Completed', $statuses);
- $params['payment_status'] = 'Completed';
+ $result['trxn_id'] = !empty($response_fields[6]) ? $response_fields[6] : $this->getTestTrxnID();
+ $result = $this->setStatusPaymentCompleted($result);
break;
}
- return $params;
+ return $result;
}
/**
$template->assign('billingState', $this->_getParam('state_province'));
$template->assign('billingZip', $this->_getParam('postal_code', TRUE));
$template->assign('billingCountry', $this->_getParam('country'));
-
+ // Required to be set for s
+ $template->ensureVariablesAreAssigned(['subscriptionType']);
$arbXML = $template->fetch('CRM/Contribute/Form/Contribution/AuthorizeNetARB.tpl');
// Submit to authorize.net