Commit df2019db authored by mattwire's avatar mattwire
Browse files

Move more functions to use \Civi\Payment\Propertybag

parent bd5fb015
......@@ -146,14 +146,14 @@ abstract class CRM_Core_Payment_AuthorizeNetCommon extends CRM_Core_Payment {
* @throws \CiviCRM_API3_Exception
*/
public function doPayment(&$params, $component = 'contribute') {
/* @var \Civi\Payment\PropertyBag $paramsPb */
$paramsPb = \Civi\Payment\PropertyBag::cast($params);
$paramsPb = $this->beginDoPayment($paramsPb);
/* @var \Civi\Payment\PropertyBag $propertyBag */
$propertyBag = \Civi\Payment\PropertyBag::cast($params);
$propertyBag = $this->beginDoPayment($propertyBag);
// @todo From here on we are using the array instead of propertyBag. To be converted later...
$params = $this->getPropertyBagAsArray($paramsPb);
$params = $this->getPropertyBagAsArray($propertyBag);
if ($paramsPb->getIsRecur() && $paramsPb->has('contributionRecurID')) {
if ($propertyBag->getIsRecur() && $propertyBag->has('contributionRecurID')) {
return $this->doRecurPayment($params);
}
......@@ -433,7 +433,8 @@ abstract class CRM_Core_Payment_AuthorizeNetCommon extends CRM_Core_Payment {
* @throws \CiviCRM_API3_Exception
*/
protected function getSubscriptionId($params) {
$recurId = $this->getRecurringContributionId($params);
$propertyBag = \Civi\Payment\PropertyBag::cast($params);
$recurId = $this->getRecurringContributionId($propertyBag);
return (string) civicrm_api3('ContributionRecur', 'getvalue', ['id' => $recurId, 'return' => 'trxn_id']);
}
......@@ -572,7 +573,8 @@ abstract class CRM_Core_Payment_AuthorizeNetCommon extends CRM_Core_Payment {
* @throws \Exception
*/
public function changeSubscriptionAmount(&$message = '', $params = []) {
$existingParams = civicrm_api3('ContributionRecur', 'getsingle', ['id' => $this->getRecurringContributionId($params)]);
$propertyBag = \Civi\Payment\PropertyBag::cast($params);
$existingParams = civicrm_api3('ContributionRecur', 'getsingle', ['id' => $this->getRecurringContributionId($propertyBag)]);
$params = array_merge($existingParams, $params);
$merchantAuthentication = $this->getMerchantAuthentication($params);
......
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