diff --git a/CRM/Core/Payment/iATSService.php b/CRM/Core/Payment/iATSService.php index d47c3e95..eb7fef0c 100644 --- a/CRM/Core/Payment/iATSService.php +++ b/CRM/Core/Payment/iATSService.php @@ -565,6 +565,13 @@ protected function updateRecurring($params, $update) { // By default, it's empty, unless we've got a future start date. if (empty($update['receive_date'])) { $next = strtotime('+' . $params['frequency_interval'] . ' ' . $params['frequency_unit']); + // handle the special case of monthly contributions made after the 28th + if ('month' == $params['frequency_unit']) { + $now = getdate(); + if ($now['mday'] > 28) { // pull it back to the 28th + $next = $next - (($now['mday'] - 28) * 24 * 60 * 60); + } + } $recur_update['next_sched_contribution_date'] = date('Ymd', $next) . '030000'; } else {