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

Fix setting of recur ID for changeSubscriptionAmount

parent abb9d975
No related branches found
No related tags found
No related merge requests found
......@@ -503,7 +503,15 @@ trait CRM_Core_Payment_MJWTrait {
* ];
*/
$propertyBag = PropertyBag::cast($params);
$propertyBag->setContributionRecurID($params['contributionRecurID'] ?? $params['id']);
if (!$propertyBag->has('contributionRecurID')) {
if (!empty($params['id'])) {
$propertyBag->setContributionRecurID($params['id']);
}
else {
throw new PaymentProcessorException('You MUST pass contributionRecurID (or id) to changeSubscriptionAmount$params');
}
}
$propertyBag->setIsRecur(TRUE);
$existingRecur = ContributionRecur::get(FALSE)
......@@ -512,6 +520,9 @@ trait CRM_Core_Payment_MJWTrait {
->execute()
->first();
if (!$propertyBag->has('recurProcessorID')) {
$propertyBag->setRecurProcessorID($existingRecur['processor_id']);
}
$propertyBag->setRecurInstallments($existingRecur['installments'] ?? 0);
$propertyBag->setRecurFrequencyInterval($existingRecur['frequency_interval']);
$propertyBag->setRecurFrequencyUnit($existingRecur['frequency_unit']);
......
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