X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPayment.php;h=c52693c8e8539a996224609d09aaaeba096ba1b3;hb=21dfd5f567e7996ad92cf2a7d0fbe6f5fc205a5c;hp=c964ce2a9ea0717489b0298623fe5edc8c04c0a3;hpb=771e2548641c460d0f7a244ad0aefb05c703b478;p=civicrm-core.git
diff --git a/CRM/Core/Payment.php b/CRM/Core/Payment.php
index c964ce2a9e..c52693c8e8 100644
--- a/CRM/Core/Payment.php
+++ b/CRM/Core/Payment.php
@@ -1,7 +1,7 @@
getMapper();
if ($ext->isExtensionKey($paymentProcessor['class_name'])) {
$paymentClass = $ext->keyToClass($paymentProcessor['class_name'], 'payment');
- require_once ($ext->classToPath($paymentClass));
+ require_once $ext->classToPath($paymentClass);
}
else {
$paymentClass = 'CRM_Core_' . $paymentProcessor['class_name'];
if (empty($paymentClass)) {
throw new CRM_Core_Exception('no class provided');
}
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php');
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $paymentClass) . '.php';
}
//load the object.
@@ -125,7 +130,7 @@ abstract class CRM_Core_Payment {
//load the payment form for required processor.
//if ($paymentForm !== NULL) {
- //self::$_singleton[$cacheKey]->setForm($paymentForm);
+ //self::$_singleton[$cacheKey]->setForm($paymentForm);
//}
return self::$_singleton[$cacheKey];
@@ -151,7 +156,8 @@ abstract class CRM_Core_Payment {
/**
* Check if capability is supported
- * @param string $capability e.g BackOffice, LiveMode, FutureRecurStartDate
+ * @param string $capability
+ * E.g BackOffice, LiveMode, FutureRecurStartDate.
*
* @return bool
*/
@@ -178,13 +184,21 @@ abstract class CRM_Core_Payment {
}
/**
- * Are back office payments supported - e.g paypal standard won't permit you to enter a credit card associated with someone else's login
+ * Are live payments supported - e.g dummy doesn't support this
* @return bool
*/
protected function supportsLiveMode() {
return TRUE;
}
+ /**
+ * Are test payments supported
+ * @return bool
+ */
+ protected function supportsTestMode() {
+ return TRUE;
+ }
+
/**
* 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
@@ -200,7 +214,7 @@ abstract class CRM_Core_Payment {
* @param CRM_Core_Form $paymentForm
*
*/
- function setForm(&$paymentForm) {
+ public function setForm(&$paymentForm) {
$this->_paymentForm = $paymentForm;
}
@@ -209,7 +223,7 @@ abstract class CRM_Core_Payment {
*
* @return CRM_Core_Form A form object
*/
- function getForm() {
+ public function getForm() {
return $this->_paymentForm;
}
@@ -220,7 +234,7 @@ abstract class CRM_Core_Payment {
*
* @return null
*/
- function getVar($name) {
+ public function getVar($name) {
return isset($this->$name) ? $this->$name : NULL;
}
@@ -301,7 +315,7 @@ abstract class CRM_Core_Payment {
'attributes' => array(
'size' => 20,
'maxlength' => 20,
- 'autocomplete' => 'off'
+ 'autocomplete' => 'off',
),
'is_required' => TRUE,
),
@@ -313,7 +327,7 @@ abstract class CRM_Core_Payment {
'attributes' => array(
'size' => 5,
'maxlength' => 10,
- 'autocomplete' => 'off'
+ 'autocomplete' => 'off',
),
'is_required' => CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,
'cvv_backoffice_required',
@@ -357,7 +371,7 @@ abstract class CRM_Core_Payment {
'attributes' => array(
'size' => 20,
'maxlength' => 34,
- 'autocomplete' => 'on'
+ 'autocomplete' => 'on',
),
'is_required' => TRUE,
),
@@ -370,7 +384,7 @@ abstract class CRM_Core_Payment {
'attributes' => array(
'size' => 20,
'maxlength' => 34,
- 'autocomplete' => 'off'
+ 'autocomplete' => 'off',
),
'rules' => array(
array(
@@ -389,7 +403,7 @@ abstract class CRM_Core_Payment {
'attributes' => array(
'size' => 20,
'maxlength' => 11,
- 'autocomplete' => 'off'
+ 'autocomplete' => 'off',
),
'is_required' => TRUE,
'rules' => array(
@@ -407,11 +421,11 @@ abstract class CRM_Core_Payment {
'attributes' => array(
'size' => 20,
'maxlength' => 64,
- 'autocomplete' => 'off'
+ 'autocomplete' => 'off',
),
'is_required' => TRUE,
- )
+ ),
);
}
@@ -419,7 +433,8 @@ abstract class CRM_Core_Payment {
* This function collects all the information from a web/api form and invokes
* the relevant payment processor specific functions to perform the transaction
*
- * @param array $params assoc array of input parameters for this transaction
+ * @param array $params
+ * Assoc array of input parameters for this transaction.
*
* @return array the result in an nice formatted array (or an error object)
* @abstract
@@ -446,13 +461,14 @@ abstract class CRM_Core_Payment {
if (is_a($result, 'CRM_Core_Error')) {
throw new CRM_Core_Exception(CRM_Core_Error::getMessages($result));
}
+ //CRM-15767 - Submit Credit Card Contribution not being saved
+ return $result;
}
/**
* This function checks to see if we have the right config values
*
* @return string the error message if any
- * @public
*/
abstract function checkConfig();
@@ -461,7 +477,7 @@ abstract class CRM_Core_Payment {
*
* @return bool
*/
- static function paypalRedirect(&$paymentProcessor) {
+ public static function paypalRedirect(&$paymentProcessor) {
if (!$paymentProcessor) {
return FALSE;
}
@@ -479,9 +495,8 @@ abstract class CRM_Core_Payment {
/**
* Page callback for civicrm/payment/ipn
- * @public
*/
- static function handleIPN() {
+ public static function handleIPN() {
self::handlePaymentMethod(
'PaymentNotification',
array(
@@ -498,11 +513,10 @@ abstract class CRM_Core_Payment {
* processor & ideally the processor will be validating the results
* Load requested payment processor and call that processor's handle<$method> method
*
- * @public
* @param $method
* @param array $params
*/
- static function handlePaymentMethod($method, $params = array()) {
+ public static function handlePaymentMethod($method, $params = array()) {
if (!isset($params['processor_id']) && !isset($params['processor_name'])) {
CRM_Core_Error::fatal("Either 'processor_id' or 'processor_name' param is required for payment callback");
}
@@ -582,10 +596,12 @@ abstract class CRM_Core_Payment {
$extension_instance_found = TRUE;
}
- if (!$extension_instance_found) CRM_Core_Error::fatal(
- "No extension instances of the '{$params['processor_name']}' payment processor were found.
" .
- "$method method is unsupported in legacy payment processors."
- );
+ if (!$extension_instance_found) {
+ CRM_Core_Error::fatal(
+ "No extension instances of the '{$params['processor_name']}' payment processor were found.
" .
+ "$method method is unsupported in legacy payment processors."
+ );
+ }
// Exit here on web requests, allowing just the plain text response to be echoed
if ($method == 'handlePaymentNotification') {
@@ -596,12 +612,12 @@ abstract class CRM_Core_Payment {
/**
* Check whether a method is present ( & supported ) by the payment processor object.
*
- * @param string $method method to check for.
+ * @param string $method
+ * Method to check for.
*
* @return boolean
- * @public
*/
- function isSupported($method = 'cancelSubscription') {
+ public function isSupported($method = 'cancelSubscription') {
return method_exists(CRM_Utils_System::getClassName($this), $method);
}
@@ -612,20 +628,22 @@ abstract class CRM_Core_Payment {
*
* @return string
*/
- function subscriptionURL($entityID = NULL, $entity = NULL, $action = 'cancel') {
+ public function subscriptionURL($entityID = NULL, $entity = NULL, $action = 'cancel') {
// Set URL
switch ($action) {
- case 'cancel' :
+ case 'cancel':
$url = 'civicrm/contribute/unsubscribe';
break;
- case 'billing' :
+
+ case 'billing':
//in notify mode don't return the update billing url
if (!$this->isSupported('updateSubscriptionBillingInfo')) {
return NULL;
}
$url = 'civicrm/contribute/updatebilling';
break;
- case 'update' :
+
+ case 'update':
$url = 'civicrm/contribute/updaterecur';
break;
}
@@ -639,17 +657,17 @@ abstract class CRM_Core_Payment {
// Find related Contact
if ($entityID) {
switch ($entity) {
- case 'membership' :
+ case 'membership':
$contactID = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $entityID, "contact_id");
$entityArg = 'mid';
break;
- case 'contribution' :
+ case 'contribution':
$contactID = CRM_Core_DAO::getFieldValue("CRM_Contribute_DAO_Contribution", $entityID, "contact_id");
$entityArg = 'coid';
break;
- case 'recur' :
+ case 'recur':
$sql = "
SELECT con.contact_id
FROM civicrm_contribution_recur rec