Skip to content

Commit

Permalink
Various updates from OPHA shifting to use the passed in payment_proce…
Browse files Browse the repository at this point in the history
…ssor_id so multiple moneris payment processors could be used with separate jobs
  • Loading branch information
seamuslee001 committed Nov 19, 2021
1 parent cbd29a6 commit 1f00127
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 6 deletions.
Empty file modified CRM/Core/Payment/Moneris.php
100755 → 100644
Empty file.
Empty file modified CRM/Moneris/Upgrader.php
100755 → 100644
Empty file.
Empty file modified CRM/Moneris/mpgClasses.php
100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion api/v3/Job/Monerisvaultrecurringcontributions.mgd.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
array (
'name' => 'Cron:Job.Monerisvaultrecurringcontributions',
'entity' => 'Job',
'update' => 'never',
'params' =>
array (
'version' => 3,
Expand All @@ -19,4 +20,4 @@
'is_active' => 1,
),
),
);
);
9 changes: 4 additions & 5 deletions api/v3/Job/Monerisvaultrecurringcontributions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ function civicrm_api3_job_Monerisvaultrecurringcontributions($params) {
// for logging
$payments = [];

// not used, but we could add some params to limit which recurring payment to do
$sqlparams = [];
$sqlparams = [1 => [$params['payment_processor_id'], 'Integer']];

// TODO: strategy for failure ? right now, we stop any recurring after the first failure
// we might want to have different settings (retry x times every x days?)
Expand All @@ -68,11 +67,11 @@ function civicrm_api3_job_Monerisvaultrecurringcontributions($params) {
INNER JOIN civicrm_payment_processor pp ON cr.payment_processor_id = pp.id
LEFT JOIN civicrm_contribution c2 ON (c.contribution_recur_id = c2.contribution_recur_id AND c.id < c2.id)
WHERE
pp.name = 'Moneris' AND cr.payment_token_id IS NOT NULL
pp.id = %1 AND cr.payment_token_id IS NOT NULL
AND cr.contribution_status_id IN (2,5)
AND c2.id IS NULL
AND (cr.next_sched_contribution_date IS NOT NULL AND c.receive_date >= cr.next_sched_contribution_date)";
$dao = CRM_Core_DAO::executeQuery($sql);
$dao = CRM_Core_DAO::executeQuery($sql, $sqlparams);

// TODO: add some log
while ($dao->fetch()) {
Expand Down Expand Up @@ -118,7 +117,7 @@ function civicrm_api3_job_Monerisvaultrecurringcontributions($params) {
LEFT JOIN civicrm_contribution c2 ON (c.contribution_recur_id = c2.contribution_recur_id AND c.id < c2.id)
INNER JOIN civicrm_contact contact ON contact.id = c.contact_id
WHERE
pp.name = 'Moneris' AND cr.payment_token_id IS NOT NULL
pp.id = %1 AND cr.payment_token_id IS NOT NULL
AND cr.contribution_status_id IN (2,5)
AND c.contribution_status_id IN (1,2)
AND c2.id IS NULL";
Expand Down
Empty file modified info.xml
100755 → 100644
Empty file.
Empty file modified moneris.civix.php
100755 → 100644
Empty file.
Empty file modified moneris.php
100755 → 100644
Empty file.
Empty file modified xml/Menu/moneris.xml
100755 → 100644
Empty file.

0 comments on commit 1f00127

Please sign in to comment.