Skip to content
Snippets Groups Projects
Commit 8196c759 authored by eileen's avatar eileen
Browse files

add some comments to the code

parent 59fe57f7
Branches
Tags
No related merge requests found
......@@ -35,10 +35,29 @@
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
......@@ -92,10 +111,16 @@ class CRM_Core_Payment_BaseIPN {
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)) {
......@@ -139,6 +164,13 @@ class CRM_Core_Payment_BaseIPN {
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();
......@@ -195,6 +227,12 @@ class CRM_Core_Payment_BaseIPN {
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");
......@@ -589,6 +627,13 @@ LIMIT 1;";
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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment