Skip to content
Snippets Groups Projects
Commit e887ac8b authored by mattwire's avatar mattwire
Browse files

Convert getTokenParameter() to use propertyBag

parent d20d6540
No related branches found
No related tags found
No related merge requests found
......@@ -652,26 +652,26 @@ trait CRM_Core_Payment_MJWTrait {
* Get a "token" parameter that was inserted via javascript on the payment form (eg. paymentIntentID).
*
* @param string $parameterName
* @param \Civi\Payment\PropertyBag $params
* @param \Civi\Payment\PropertyBag $propertyBag
* @param bool $required
*
* @return \Civi\Payment\PropertyBag
* @throws \CRM_Core_Exception
*/
protected function getTokenParameter($parameterName, $params, $required = TRUE) {
protected function getTokenParameter($parameterName, $propertyBag, $required = TRUE) {
// If we stored it via pre_approval_parameters it should already be in the params array
if ($params->has($parameterName)) {
return $params;
if ($propertyBag->has($parameterName)) {
return $propertyBag;
}
// If we're submitting without a confirmation page it should be in the $_POST array
$parameterValue = CRM_Utils_Request::retrieve($parameterName, 'String');
$params->setCustomProperty($parameterName, $parameterValue);
$propertyBag->setCustomProperty($parameterName, $parameterValue);
if (empty($parameterValue) && $required) {
Civi::log()->debug("{$parameterName} not found. \$params: " . print_r($params, TRUE));
Civi::log()->debug("{$parameterName} not found. \$params: " . print_r($propertyBag, TRUE));
CRM_Core_Error::statusBounce(E::ts('Unable to complete payment! Missing %1.', [1 => $parameterName]));
}
return $params;
return $propertyBag;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment