- public function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE) {
+ public function single($input, $ids, $objects, $recur = FALSE, $first = FALSE) {
$contribution = &$objects['contribution'];
// make sure the invoice is valid and matches what we have in the contribution record
$contribution = &$objects['contribution'];
// make sure the invoice is valid and matches what we have in the contribution record
- if ($status == 'Denied' || $status == 'Failed' || $status == 'Voided') {
- return $this->failed($objects, $transaction);
+ if ($status === 'Denied' || $status === 'Failed' || $status === 'Voided') {
+ $this->failed($objects);
+ return;
- elseif ($status == 'Refunded' || $status == 'Reversed') {
- return $this->cancelled($objects, $transaction);
+ elseif ($status === 'Refunded' || $status === 'Reversed') {
+ $this->cancelled($objects);
+ return;
}
elseif ($status !== 'Completed') {
Civi::log()->debug('Returning since contribution status is not handled');
}
elseif ($status !== 'Completed') {
Civi::log()->debug('Returning since contribution status is not handled');
// check if contribution is already completed, if so we ignore this ipn
$completedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
if ($contribution->contribution_status_id == $completedStatusId) {
// check if contribution is already completed, if so we ignore this ipn
$completedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
if ($contribution->contribution_status_id == $completedStatusId) {
Civi::log()->debug('PayPalIPN: Returning since contribution has already been handled. (ID: ' . $contribution->id . ').');
echo 'Success: Contribution has already been handled<p>';
return;
}
Civi::log()->debug('PayPalIPN: Returning since contribution has already been handled. (ID: ' . $contribution->id . ').');
echo 'Success: Contribution has already been handled<p>';
return;
}
- $this->completeTransaction($input, $ids, $objects, $transaction, $recur);
+ $this->completeTransaction($input, $ids, $objects);
$membershipID = $this->retrieve('membershipID', 'Integer', FALSE);
$contributionRecurID = $this->retrieve('contributionRecurID', 'Integer', FALSE);
$membershipID = $this->retrieve('membershipID', 'Integer', FALSE);
$contributionRecurID = $this->retrieve('contributionRecurID', 'Integer', FALSE);
if ($component == 'event') {
$ids['event'] = $this->retrieve('eventID', 'Integer', TRUE);
if ($component == 'event') {
$ids['event'] = $this->retrieve('eventID', 'Integer', TRUE);
- $this->single($input, $ids, $objects, FALSE, FALSE);
+ $this->single($input, $ids, $objects);
- public function getInput(&$input, &$ids) {
- if (!$this->getBillingID($ids)) {
- return;
- }
-
+ public function getInput(&$input) {
+ $billingID = CRM_Core_BAO_LocationType::getBilling();
$input['txnType'] = $this->retrieve('txn_type', 'String', FALSE);
$input['paymentStatus'] = $this->retrieve('payment_status', 'String', FALSE);
$input['invoice'] = $this->retrieve('invoice', 'String', TRUE);
$input['amount'] = $this->retrieve('mc_gross', 'Money', FALSE);
$input['reasonCode'] = $this->retrieve('ReasonCode', 'String', FALSE);
$input['txnType'] = $this->retrieve('txn_type', 'String', FALSE);
$input['paymentStatus'] = $this->retrieve('payment_status', 'String', FALSE);
$input['invoice'] = $this->retrieve('invoice', 'String', TRUE);
$input['amount'] = $this->retrieve('mc_gross', 'Money', FALSE);
$input['reasonCode'] = $this->retrieve('ReasonCode', 'String', FALSE);
$lookup = [
"first_name" => 'first_name',
"last_name" => 'last_name',
$lookup = [
"first_name" => 'first_name',
"last_name" => 'last_name',