test if response array contains contribution
This commit is contained in:
parent
c20c4ab16c
commit
5e068f6d31
1 changed files with 16 additions and 14 deletions
|
@ -36,20 +36,22 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
||||||
$response = $event->getResponse();
|
$response = $event->getResponse();
|
||||||
|
|
||||||
// Create soft credit for contribution
|
// Create soft credit for contribution
|
||||||
$contribution = $response['values']['contribution']
|
if (array_key_exists('contribution', $response['values'])) {
|
||||||
[array_key_first($response['values']['contribution'])];
|
$contribution = $response['values']['contribution']
|
||||||
if (array_key_exists('campaign_id', $contribution)) {
|
[array_key_first($response['values']['contribution'])];
|
||||||
try {
|
if (array_key_exists('campaign_id', $contribution)) {
|
||||||
$twingle_event = civicrm_api3(
|
try {
|
||||||
'TwingleEvent',
|
$twingle_event = civicrm_api3(
|
||||||
'getsingle',
|
'TwingleEvent',
|
||||||
['id' => $contribution['campaign_id']]
|
'getsingle',
|
||||||
)['values'];
|
['id' => $contribution['campaign_id']]
|
||||||
$response['values']['soft_credit'] =
|
)['values'];
|
||||||
self::createSoftCredit($contribution, $twingle_event)['values'];
|
$response['values']['soft_credit'] =
|
||||||
$event->setResponse($response);
|
self::createSoftCredit($contribution, $twingle_event)['values'];
|
||||||
} catch (CiviCRM_API3_Exception $e) {
|
$event->setResponse($response);
|
||||||
// Do nothing
|
} catch (CiviCRM_API3_Exception $e) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue