<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN {
/**
- * constructor function
+ * Constructor function
*
- * @param $inputData array contents of HTTP REQUEST
+ * @param $inputData
+ * Array contents of HTTP REQUEST.
*
* @throws CRM_Core_Exception
*/
- function __construct($inputData) {
+ public function __construct($inputData) {
$this->setInputParameters($inputData);
parent::__construct();
}
*
* @return bool|void
*/
- function main($component = 'contribute') {
+ public function main($component = 'contribute') {
//we only get invoice num as a key player from payment gateway response.
//for ARB we get x_subscription_id and x_subscription_paynum
*
* @return bool
*/
- function recur(&$input, &$ids, &$objects, $first) {
+ public function recur(&$input, &$ids, &$objects, $first) {
+ $this->_isRecurring = TRUE;
$recur = &$objects['contributionRecur'];
// do a subscription check
// check and validate gateway MD5 response if present
$this->checkMD5($ids, $input);
- $sendNotification = FALSE;
if ($input['response_code'] == 1) {
// Approved
if ($first) {
$recur->start_date = $now;
$recur->trxn_id = $recur->processor_id;
- $sendNotification = TRUE;
- $subscriptionPaymentStatus = CRM_Core_Payment::RECURRING_PAYMENT_START;
+ $this->_isFirstOrLastRecurringPayment = CRM_Core_Payment::RECURRING_PAYMENT_START;
}
$statusName = 'In Progress';
if (($recur->installments > 0) &&
// this is the last payment
$statusName = 'Completed';
$recur->end_date = $now;
- $sendNotification = TRUE;
- $subscriptionPaymentStatus = CRM_Core_Payment::RECURRING_PAYMENT_END;
+ $this->_isFirstOrLastRecurringPayment = CRM_Core_Payment::RECURRING_PAYMENT_END;
}
$recur->modified_date = $now;
$recur->contribution_status_id = array_search($statusName, $contributionStatus);
}
$this->completeTransaction($input, $ids, $objects, $transaction, $recur);
-
- if ($sendNotification) {
- $autoRenewMembership = FALSE;
- if ($recur->id &&
- isset($ids['membership']) && $ids['membership']
- ) {
- $autoRenewMembership = TRUE;
- }
-
- //send recurring Notification email for user
- CRM_Contribute_BAO_ContributionPage::recurringNotify($subscriptionPaymentStatus,
- $ids['contact'],
- $ids['contributionPage'],
- $recur,
- $autoRenewMembership
- );
- }
}
/**
* @param $input
* @param $ids
*/
- function getInput(&$input, &$ids) {
+ public function getInput(&$input, &$ids) {
$input['amount'] = $this->retrieve('x_amount', 'String');
$input['subscription_id'] = $this->retrieve('x_subscription_id', 'Integer');
$input['response_code'] = $this->retrieve('x_response_code', 'Integer');
* @param $ids
* @param $input
*/
- function getIDs(&$ids, &$input) {
+ public function getIDs(&$ids, &$input) {
$ids['contact'] = $this->retrieve('x_cust_id', 'Integer', FALSE, 0);
$ids['contribution'] = $this->retrieve('x_invoice_num', 'Integer');
}
/**
- * @param string $name parameter name
- * @param string $type parameter type
- * @param bool $abort abort if not present
- * @param null $default default value
+ * @param string $name
+ * Parameter name.
+ * @param string $type
+ * Parameter type.
+ * @param bool $abort
+ * Abort if not present.
+ * @param null $default
+ * Default value.
*
* @throws CRM_Core_Exception
* @return mixed
*/
- function retrieve($name, $type, $abort = TRUE, $default = NULL) {
+ public function retrieve($name, $type, $abort = TRUE, $default = NULL) {
$value = CRM_Utils_Type::validate(
empty($this->_inputParameters[$name]) ? $default : $this->_inputParameters[$name],
$type,
throw new CRM_Core_Exception("Could not find an entry for $name");
}
return $value;
-}
+ }
/**
* @param $ids
*
* @return bool
*/
- function checkMD5($ids, $input) {
+ public function checkMD5($ids, $input) {
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ids['paymentProcessor'],
$input['is_test'] ? 'test' : 'live'
);
return TRUE;
}
}
-