use Civi\Payment\System;
/**
+ * Class CRM_Core_Payment.
*
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
+ * This class is the main class for the payment processor subsystem.
*
+ * It is the parent class for payment processors. It also holds some IPN related functions
+ * that need to be moved. In particular handlePaymentMethod should be moved to a factory class.
*/
abstract class CRM_Core_Payment {
/**
* Singleton function used to manage this object.
+ *
* We will migrate to calling Civi\Payment\System::singleton()->getByProcessor($paymentProcessor)
* & Civi\Payment\System::singleton()->getById($paymentProcessor) directly as the main access methods & work
* to remove this function all together
}
/**
- * @param array $params
+ * Log payment notification message to forensic system log.
+ *
* @todo move to factory class \Civi\Payment\System (or similar)
+ *
+ * @param array $params
+ *
* @return mixed
*/
public static function logPaymentNotification($params) {
/**
* Check if capability is supported.
+ *
+ * Capabilities have a one to one relationship with capability-related functions on this class.
+ *
+ * Payment processor classes should over-ride the capability-specific function rather than this one.
+ *
* @param string $capability
* E.g BackOffice, LiveMode, FutureRecurStartDate.
*
}
/**
- * Are back office payments supported - e.g paypal standard won't permit you to enter a credit card associated with someone else's login
- * The intention is to support off-site (other than paypal) & direct debit but that is not all working yet so to reach a 'stable' point we disable
+ * Are back office payments supported.
+ *
+ * e.g paypal standard won't permit you to enter a credit card associated
+ * with someone else's login.
+ * The intention is to support off-site (other than paypal) & direct debit but that is not all working yet so to
+ * reach a 'stable' point we disable.
+ *
* @return bool
*/
protected function supportsBackOffice() {
}
/**
- * Are live payments supported - e.g dummy doesn't support this
+ * Are live payments supported - e.g dummy doesn't support this.
+ *
* @return bool
*/
protected function supportsLiveMode() {
/**
* Are test payments supported.
+ *
* @return bool
*/
protected function supportsTestMode() {
/**
* Should the first payment date be configurable when setting up back office recurring payments.
+ *
* We set this to false for historical consistency but in fact most new processors use tokens for recurring and can support this
+ *
* @return bool
*/
protected function supportsFutureRecurStartDate() {
}
/**
- * Default payment instrument validation
+ * Default payment instrument validation.
+ *
* Implement the usual Luhn algorithm via a static function in the CRM_Core_Payment_Form if it's a credit card
- * Not a static function, because I need to check for payment_type
+ * Not a static function, because I need to check for payment_type.
+ *
+ * @param array $values
+ * @param array $errors
*/
public function validatePaymentInstrument($values, &$errors) {
if ($this->_paymentProcessor['payment_type'] == 1) {
}
/**
- * Setter for the payment form that wants to use the processor
+ * Setter for the payment form that wants to use the processor.
+ *
* @deprecated
+ *
* @param CRM_Core_Form $paymentForm
*/
public function setForm(&$paymentForm) {
/**
* Return an array of all the details about the fields potentially required for payment fields.
+ *
* Only those determined by getPaymentFormFields will actually be assigned to the form
*
* @return array
}
/**
- * Payment callback handler. The processor_name or processor_id is passed in.
+ * Payment callback handler.
+ *
+ * The processor_name or processor_id is passed in.
* Note that processor_id is more reliable as one site may have more than one instance of a
* processor & ideally the processor will be validating the results
* Load requested payment processor and call that processor's handle<$method> method
- * @todo move to0 \Civi\Payment\System factory method
*
- * @param $method
+ * @todo move to \Civi\Payment\System factory method
+ *
+ * @param string $method
+ * 'PaymentNotification' or 'PaymentCron'
* @param array $params
*/
public static function handlePaymentMethod($method, $params = array()) {
if (isset($params['processor_id'])) {
$sql .= " WHERE pp.id = %2";
$args[2] = array($params['processor_id'], 'Integer');
- $notfound = "No active instances of payment processor ID#'{$params['processor_id']}' were found.";
+ $notFound = "No active instances of payment processor ID#'{$params['processor_id']}' were found.";
}
else {
$sql .= " WHERE ppt.name = %2";
$args[2] = array($params['processor_name'], 'String');
- $notfound = "No active instances of the '{$params['processor_name']}' payment processor were found.";
+ $notFound = "No active instances of the '{$params['processor_name']}' payment processor were found.";
}
$dao = CRM_Core_DAO::executeQuery($sql, $args);
- // Check whether we found anything at all ..
+ // Check whether we found anything at all.
if (!$dao->N) {
- CRM_Core_Error::fatal($notfound);
+ CRM_Core_Error::fatal($notFound);
}
$method = 'handle' . $method;
}
/**
+ * Get url for users to manage this recurring contribution for this processor.
+ *
* @param int $entityID
* @param null $entity
* @param string $action