/**
* Constructor
*
- * @param string $mode the mode of operation: live or test
+ * @param string $mode
+ * The mode of operation: live or test.
*
* @param $paymentProcessor
*
* @return \CRM_Core_Payment_PayPalImpl
*/
- function __construct($mode, &$paymentProcessor) {
+ public function __construct($mode, &$paymentProcessor) {
$this->_mode = $mode;
$this->_paymentProcessor = $paymentProcessor;
$this->_processorName = ts('PayPal Pro');
- $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, null, 'name');
+ $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, NULL, 'name');
if ($this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('PayPal_Standard', $paymentProcessorType)) {
$this->_processorName = ts('PayPal Standard');
}
}
- /**
- * Singleton function used to manage this object
- *
- * @param string $mode the mode of operation: live or test
- *
- * @param object $paymentProcessor
- * @param null $paymentForm
- * @param bool $force
- *
- * @return object
- * @static
- */
- static function &singleton($mode, &$paymentProcessor, &$paymentForm = NULL, $force = FALSE) {
- $processorName = $paymentProcessor['name'];
- if (!isset(self::$_singleton[$processorName]) || self::$_singleton[$processorName] === NULL) {
- self::$_singleton[$processorName] = new CRM_Core_Payment_PaypalImpl($mode, $paymentProcessor);
- }
- return self::$_singleton[$processorName];
- }
-
/**
* Are back office payments supported - e.g paypal standard won't permit you to enter a credit card associated with someone else's login
* @return bool
/**
* Express checkout code. Check PayPal documentation for more information
*
- * @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)
- * @public
*/
- function setExpressCheckOut(&$params) {
+ public function setExpressCheckOut(&$params) {
$args = array();
$this->initialize($args, 'SetExpressCheckout');
/**
* Get details from paypal. Check PayPal documentation for more information
*
- * @param string $token the key associated with this transaction
+ * @param string $token
+ * The key associated with this transaction.
*
* @return array the result in an nice formatted array (or an error object)
- * @public
*/
- function getExpressCheckoutDetails($token) {
+ public function getExpressCheckoutDetails($token) {
$args = array();
$this->initialize($args, 'GetExpressCheckoutDetails');
* @internal param string $token the key associated with this transaction
*
* @return array the result in an nice formatted array (or an error object)
- * @public
*/
- function doExpressCheckout(&$params) {
+ public function doExpressCheckout(&$params) {
$args = array();
$this->initialize($args, 'DoExpressCheckoutPayment');
*
* @return mixed
*/
- function createRecurringPayments(&$params) {
+ public function createRecurringPayments(&$params) {
$args = array();
$this->initialize($args, 'CreateRecurringPaymentsProfile');
* @param $args
* @param $method
*/
- function initialize(&$args, $method) {
+ public function initialize(&$args, $method) {
$args['user'] = $this->_paymentProcessor['user_name'];
$args['pwd'] = $this->_paymentProcessor['password'];
$args['version'] = 3.0;
* 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.
*
* @param string $component
* @return array the result in an nice formatted array (or an error object)
- * @public
*/
- function doDirectPayment(&$params, $component = 'contribute') {
+ public function doDirectPayment(&$params, $component = 'contribute') {
$args = array();
$this->initialize($args, 'DoDirectPayment');
* This function checks to see if we have the right config values
*
* @return string the error message if any
- * @public
*/
- function checkConfig() {
+ public function checkConfig() {
$error = array();
- $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(false, null, 'name');
+ $paymentProcessorType = CRM_Core_PseudoConstant::paymentProcessorType(FALSE, NULL, 'name');
if (
$this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('PayPal_Standard', $paymentProcessorType) ||
$this->_paymentProcessor['payment_processor_type_id'] == CRM_Utils_Array::key('PayPal', $paymentProcessorType)
/**
* @return null|string
*/
- function cancelSubscriptionURL() {
+ public function cancelSubscriptionURL() {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal_Standard') {
return "{$this->_paymentProcessor['url_site']}cgi-bin/webscr?cmd=_subscr-find&alias=" . urlencode($this->_paymentProcessor['user_name']);
}
/**
* 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') {
if ($this->_paymentProcessor['payment_processor_type'] != 'PayPal') {
// since subscription methods like cancelSubscription or updateBilling is not yet implemented / supported
// by standard or express.
*
* @return array|bool|object
*/
- function cancelSubscription(&$message = '', $params = array()) {
+ public function cancelSubscription(&$message = '', $params = array()) {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal') {
$args = array();
$this->initialize($args, 'ManageRecurringPaymentsProfileStatus');
*
* @return array|bool|object
*/
- function updateSubscriptionBillingInfo(&$message = '', $params = array()) {
+ public function updateSubscriptionBillingInfo(&$message = '', $params = array()) {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal') {
$config = CRM_Core_Config::singleton();
$args = array();
*
* @return array|bool|object
*/
- function changeSubscriptionAmount(&$message = '', $params = array()) {
+ public function changeSubscriptionAmount(&$message = '', $params = array()) {
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal') {
$config = CRM_Core_Config::singleton();
$args = array();
*
* @throws Exception
*/
- function doTransferCheckout(&$params, $component = 'contribute') {
+ public function doTransferCheckout(&$params, $component = 'contribute') {
$config = CRM_Core_Config::singleton();
if ($component != 'contribute' && $component != 'event') {
* @nvpStr is nvp string.
* returns an associtive array containing the response from the server.
*/
- function invokeAPI($args, $url = NULL) {
+ public function invokeAPI($args, $url = NULL) {
if ($url === NULL) {
if (empty($this->_paymentProcessor['url_api'])) {
* @nvpstr is NVPString.
* @nvpArray is Associative Array.
*/
- static function deformat($str) {
+ public static function deformat($str) {
$result = array();
while (strlen($str)) {
return $result;
}
}
-