[#9] added cancellation protection for recurring contributions
This commit is contained in:
commit
ee05e44995
6 changed files with 125 additions and 0 deletions
|
@ -122,12 +122,14 @@ function civicrm_api3_twingle_donation_Cancel($params) {
|
|||
));
|
||||
}
|
||||
else {
|
||||
CRM_Twingle_Tools::$protection_suspended = TRUE;
|
||||
$contribution = civicrm_api3($contribution_type, 'create', array(
|
||||
'id' => $contribution['id'],
|
||||
'cancel_date' => $params['cancelled_at'],
|
||||
'contribution_status_id' => 'Cancelled',
|
||||
'cancel_reason' => $params['cancel_reason'],
|
||||
));
|
||||
CRM_Twingle_Tools::$protection_suspended = FALSE;
|
||||
}
|
||||
|
||||
$result = civicrm_api3_create_success($contribution);
|
||||
|
|
|
@ -113,11 +113,13 @@ function civicrm_api3_twingle_donation_endrecurring($params) {
|
|||
));
|
||||
}
|
||||
else {
|
||||
CRM_Twingle_Tools::$protection_suspended = TRUE;
|
||||
$contribution = civicrm_api3('ContributionRecur', 'create', array(
|
||||
'id' => $contribution['id'],
|
||||
'end_date' => $params['ended_at'],
|
||||
'contribution_status_id' => CRM_Twingle_Submission::CONTRIBUTION_STATUS_COMPLETED,
|
||||
));
|
||||
CRM_Twingle_Tools::$protection_suspended = FALSE;
|
||||
}
|
||||
|
||||
$result = civicrm_api3_create_success($contribution);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue