Skip to content

Commit

Permalink
CIVIEWAY-230 Remove unwanted debug statements & fix up others.
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-fj committed Jun 30, 2022
1 parent d3a1412 commit c512aa9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
1 change: 0 additions & 1 deletion CRM/eWAYRecurring/PaymentToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class CRM_eWAYRecurring_PaymentToken {
public static function createToken() {
$contact_id = CRM_Utils_Request::retrieve('contact_id', 'String', $store, TRUE);
$pp_id = CRM_Utils_Request::retrieve('pp_id', 'String', $store, TRUE);
//Civi::log()->info(print_r($_POST, TRUE));

// get information from post data
$billingDetails = [];
Expand Down
4 changes: 0 additions & 4 deletions au_com_agileware_ewayrecurring.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,6 @@ public function doPayment(&$params, $component = 'contribute') {

CRM_Core_Session::singleton()->set('eWAYResponse', serialize($eWAYResponse), $params['qfKey']);

Civi::log()->debug('eWAYResponse: ' . print_r($eWAYResponse, TRUE));

//----------------------------------------------------------------------------------------------------
// If null data returned - tell 'em and bail out
//----------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -459,8 +457,6 @@ public function doPayment(&$params, $component = 'contribute') {
'is_email_receipt' => $params['is_email_receipt'],
];

Civi::log()->debug('ewayParams', $ewayParams);

// FIXME financial type, amount
if ($component == 'event') {
//$ewayParams['amount'] = $params['amount'];
Expand Down
21 changes: 12 additions & 9 deletions eWAYRecurring.process.inc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function process_recurring_payments($payment_processor, $paymentObject) {
}

// Process payment
// Civi::log()->debug("Processing payment for scheduled recurring contribution ID: " . $contribution->id . "\n");
$amount_in_cents = preg_replace('/\.([0-9]{0,2}).*$/', '$1',
$contribution->amount);

Expand Down Expand Up @@ -126,7 +125,6 @@ function process_recurring_payments($payment_processor, $paymentObject) {

$new_contribution_record = $repeated;

// Civi::log()->debug("Creating contribution record\n");
$new_contribution_record['contact_id'] = $contribution->contact_id;
$new_contribution_record['receive_date'] = CRM_Utils_Date::isoToMysql(date('Y-m-d H:i:s'));
$new_contribution_record['total_amount'] = ($contribution->amount - $mainContributions['tax_amount']);
Expand Down Expand Up @@ -252,7 +250,7 @@ function process_recurring_payments($payment_processor, $paymentObject) {
]);
}
catch (CiviCRM_API3_Exception $e) {
\Civi::log()->debug('eWAY Recurring: Couldn\'t record success activity: ' . $e->getMessage());
\Civi::log()->info('eWAY Recurring: Couldn\'t record success activity: ' . $e->getMessage());
}
}

Expand Down Expand Up @@ -295,8 +293,6 @@ function process_recurring_payments($payment_processor, $paymentObject) {
$note->save();
}

// Civi::log()->debug("Save contribution with trxn_id {$new_contribution_record->trxn_id}");

} catch (Exception $e) {
Civi::log()->warning("Processing payment {$contribution->id} for {$contribution->contact_id}: " . $e->getMessage());

Expand All @@ -307,8 +303,14 @@ function process_recurring_payments($payment_processor, $paymentObject) {
$new_contribution_record['contribution_status_id'] = _contribution_status_id('Failed');
}

$updated = civicrm_api3('Contribution', 'create', $new_contribution_record);
$new_contribution_record = reset($updated['values']);
try {
$updated = civicrm_api3('Contribution', 'create', $new_contribution_record);

$new_contribution_record = reset($updated['values']);
} catch (CiviCRM_API3_Exception $e) {
Civi::log()->warning("Recurring contribution - Unable to set status of new contribution: " . $e->getMessage(), $new_contribution_record);
}

// CIVIEWAY-147 there is an unknown system error that happen after civi talks to eway
// It might be a cache cleaning task happening at the same time that break this task
// Defer the query later to update the contribution status
Expand All @@ -319,7 +321,8 @@ function process_recurring_payments($payment_processor, $paymentObject) {
'payment_processor_id' => $contribution->payment_processor_id,
];
civicrm_api3('EwayContributionTransactions', 'create', $ewayParams);
} else {
}
else {
// Just mark it failed when eWay have no info about this at all
_eWAYRecurring_mark_recurring_contribution_Failed($contribution);
}
Expand Down Expand Up @@ -379,7 +382,7 @@ function _eWAYRecurring_mark_recurring_contribution_Failed($contribution) {
catch (CiviCRM_API3_Exception $e) {
/* Failing to create the failure activity should not prevent the
ContributionRecur entity from being updated. Log it and move on. */
\Civi::log()->debug('eWAY Recurring: Couldn\'t record failure activity: ' . $e->getMessage());
\Civi::log()->info('eWAY Recurring: Couldn\'t record failure activity: ' . $e->getMessage());
}

civicrm_api3('ContributionRecur', 'create', [
Expand Down
4 changes: 2 additions & 2 deletions info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<email>support@agileware.com.au</email>
</maintainer>
<develStage>stable</develStage>
<releaseDate>2022-03-23</releaseDate>
<version>2.3.18</version>
<releaseDate>2022-06-30</releaseDate>
<version>2.3.19</version>
<compatibility>
<ver>5.0</ver>
</compatibility>
Expand Down

0 comments on commit c512aa9

Please sign in to comment.