Merge branch 'twingle_api_adaptions'
This commit is contained in:
commit
711ccd7469
2 changed files with 8 additions and 8 deletions
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?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 {
|
class CRM_TwingleCampaign_Exceptions_TwingleCampaignException extends Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
||||||
$response_copy = $response;
|
$response_copy = $response;
|
||||||
|
|
||||||
// Create soft credit for contribution
|
// Create soft credit for contribution
|
||||||
if (array_key_exists('contribution', $response['values'])) {
|
if (array_key_exists('contribution', $response)) {
|
||||||
$contribution = array_shift($response_copy['values']['contribution']);
|
$contribution = array_shift($response_copy['contribution']);
|
||||||
if (array_key_exists('campaign_id', $contribution)) {
|
if (array_key_exists('campaign_id', $contribution)) {
|
||||||
try {
|
try {
|
||||||
$twingle_event = civicrm_api3(
|
$twingle_event = civicrm_api3(
|
||||||
|
@ -49,7 +49,7 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
||||||
'getsingle',
|
'getsingle',
|
||||||
['id' => $contribution['campaign_id']]
|
['id' => $contribution['campaign_id']]
|
||||||
);
|
);
|
||||||
$response['values']['soft_credit'] =
|
$response['soft_credit'] =
|
||||||
self::createSoftCredit($contribution, $twingle_event)['values'];
|
self::createSoftCredit($contribution, $twingle_event)['values'];
|
||||||
$event->setResponse($response);
|
$event->setResponse($response);
|
||||||
} catch (CiviCRM_API3_Exception $e) {
|
} catch (CiviCRM_API3_Exception $e) {
|
||||||
|
@ -58,8 +58,8 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Create soft credit for sepa mandate
|
// Create soft credit for sepa mandate
|
||||||
elseif (array_key_exists('sepa_mandate', $response['values'])) {
|
elseif (array_key_exists('sepa_mandate', $response)) {
|
||||||
$sepa_mandate = array_pop($response_copy['values']['sepa_mandate']);
|
$sepa_mandate = array_pop($response_copy['sepa_mandate']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$contribution = civicrm_api3(
|
$contribution = civicrm_api3(
|
||||||
|
@ -84,7 +84,7 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
||||||
'getsingle',
|
'getsingle',
|
||||||
['id' => $contribution['contribution_campaign_id']]
|
['id' => $contribution['contribution_campaign_id']]
|
||||||
);
|
);
|
||||||
$response['values']['soft_credit'] =
|
$response['soft_credit'] =
|
||||||
self::createSoftCredit($contribution, $twingle_event)['values'];
|
self::createSoftCredit($contribution, $twingle_event)['values'];
|
||||||
$event->setResponse($response);
|
$event->setResponse($response);
|
||||||
} catch (CiviCRM_API3_Exception $e) {
|
} catch (CiviCRM_API3_Exception $e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue