take into account the latest changes to the Twingle API
This commit is contained in:
parent
65c7e668b3
commit
beb9d8f170
2 changed files with 8 additions and 8 deletions
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* A simple custom exception that indicates a problem with the TwingleCampaign class
|
||||
* A simple custom exception that indicates a problem within the TwingleCampaign class
|
||||
*/
|
||||
class CRM_TwingleCampaign_Exceptions_TwingleCampaignException extends Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
$response_copy = $response;
|
||||
|
||||
// Create soft credit for contribution
|
||||
if (array_key_exists('contribution', $response['values'])) {
|
||||
$contribution = array_shift($response_copy['values']['contribution']);
|
||||
if (array_key_exists('contribution', $response)) {
|
||||
$contribution = array_shift($response_copy['contribution']);
|
||||
if (array_key_exists('campaign_id', $contribution)) {
|
||||
try {
|
||||
$twingle_event = civicrm_api3(
|
||||
|
@ -49,7 +49,7 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
'getsingle',
|
||||
['id' => $contribution['campaign_id']]
|
||||
);
|
||||
$response['values']['soft_credit'] =
|
||||
$response['soft_credit'] =
|
||||
self::createSoftCredit($contribution, $twingle_event)['values'];
|
||||
$event->setResponse($response);
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
|
@ -58,8 +58,8 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
}
|
||||
}
|
||||
// Create soft credit for sepa mandate
|
||||
elseif (array_key_exists('sepa_mandate', $response['values'])) {
|
||||
$sepa_mandate = array_pop($response_copy['values']['sepa_mandate']);
|
||||
elseif (array_key_exists('sepa_mandate', $response)) {
|
||||
$sepa_mandate = array_pop($response_copy['sepa_mandate']);
|
||||
|
||||
try {
|
||||
$contribution = civicrm_api3(
|
||||
|
@ -84,7 +84,7 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
'getsingle',
|
||||
['id' => $contribution['contribution_campaign_id']]
|
||||
);
|
||||
$response['values']['soft_credit'] =
|
||||
$response['soft_credit'] =
|
||||
self::createSoftCredit($contribution, $twingle_event)['values'];
|
||||
$event->setResponse($response);
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue