class CRM_Core_Payment_BaseIPN {
static $_now = NULL;
+
+ /**
+ * Constructor
+ */
function __construct() {
self::$_now = date('YmdHis');
}
+ /**
+ * Validate incoming data. This function is intended to ensure that incoming data matches
+ * It provides a form of pseudo-authentication - by checking the calling fn already knows
+ * the correct contact id & contribution id (this can be problematic when that has changed in
+ * the meantime for transactions that are delayed & contacts are merged in-between. e.g
+ * Paypal allows you to resend Instant Payment Notifications if you, for example, moved site
+ * and didn't update your IPN URL.
+ *
+ * @param array $input interpreted values from the values returned through the IPN
+ * @param array $ids more interpreted values (ids) from the values returned through the IPN
+ * @param array $objects an empty array that will be populated with loaded object
+ * @param boolean $required boolean Return FALSE if the relevant objects don't exist
+ * @param integer $paymentProcessorID Id of the payment processor ID in use
+ * @return boolean
+ */
function validateData(&$input, &$ids, &$objects, $required = TRUE, $paymentProcessorID = NULL) {
// make sure contact exists and is valid
return TRUE;
}
- /*
+ /**
* Load objects related to contribution
*
* @input array information from Payment processor
+ * @param array $ids
+ * @param array $objects
+ * @param boolean $required
+ * @param integer $paymentProcessorID
+ * @param array $error_handling
+ * @return multitype:number NULL |boolean
*/
function loadObjects(&$input, &$ids, &$objects, $required, $paymentProcessorID, $error_handling = NULL) {
if (empty($error_handling)) {
return $success;
}
+ /**
+ * Set contribution to failed
+ * @param array $objects
+ * @param object $transaction
+ * @param array $input
+ * @return boolean
+ */
function failed(&$objects, &$transaction, $input = array()) {
$contribution = &$objects['contribution'];
$memberships = array();
return TRUE;
}
+ /**
+ * Handled pending contribution status
+ * @param array $objects
+ * @param object $transaction
+ * @return boolean
+ */
function pending(&$objects, &$transaction) {
$transaction->commit();
CRM_Core_Error::debug_log_message("returning since contribution status is pending");
return $contribution->composeMessageArray($input, $ids, $values, $recur, $returnMessageText);
}
+ /**
+ * Update contribution status - this is only called from one place in the code &
+ * it is unclear whether it is a function on the way in or on the way out
+ *
+ * @param unknown_type $params
+ * @return void|Ambigous <value, unknown, array>
+ */
function updateContributionStatus(&$params) {
// get minimum required values.
$statusId = CRM_Utils_Array::value('contribution_status_id', $params);