[#20] fixes for mandate ref / postprocessing
This commit is contained in:
parent
0e8534619e
commit
db9c53bd10
1 changed files with 11 additions and 3 deletions
|
@ -707,8 +707,16 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
||||||
$recurring_contribution_id = $contribution_id = '';
|
$recurring_contribution_id = $contribution_id = '';
|
||||||
if (isset($contribution_recur['id'])) {
|
if (isset($contribution_recur['id'])) {
|
||||||
$recurring_contribution_id = $contribution_recur['id'];
|
$recurring_contribution_id = $contribution_recur['id'];
|
||||||
} elseif (!empty($mandate['entity_id']) && $mandate['type'] == 'RCUR') {
|
} elseif (!empty($mandate['id'])) {
|
||||||
$recurring_contribution_id = $mandate['entity_id'];
|
// load mandate and see...
|
||||||
|
try {
|
||||||
|
$mandate_created = civicrm_api3('SepaMandate', 'getsingle', ['id' => $mandate['id']]);
|
||||||
|
if ($mandate_created['entity_table'] == 'civicrm_contribution_recur') {
|
||||||
|
$recurring_contribution_id = $mandate['entity_id'];
|
||||||
|
}
|
||||||
|
} catch(CiviCRM_API3_Exception $ex) {
|
||||||
|
Civi::log()->warning("Couldn't load SepaMandate with id '{$mandate['id']}'.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($contribution['id'])) {
|
if (isset($contribution['id'])) {
|
||||||
$contribution_id = $contribution['id'];
|
$contribution_id = $contribution['id'];
|
||||||
|
@ -724,7 +732,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// refresh membership data
|
// refresh membership data
|
||||||
$result_values['membership'] = civicrm_api3('Membership', 'getsingle', $membership['id']);
|
$result_values['membership'] = civicrm_api3('Membership', 'getsingle', ['id' => $membership['id']]);
|
||||||
|
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
// TODO: more error handling?
|
// TODO: more error handling?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue