$result = $this->invokeAPI($args);
- if (is_a($result, 'CRM_Core_Error')) {
- throw new PaymentProcessorException($result->message);
- }
-
/* Success */
return $result['token'];
$result = $this->invokeAPI($args);
- if (is_a($result, 'CRM_Core_Error')) {
- throw new PaymentProcessorException(CRM_Core_Error::getMessages($result));
- }
-
/* Success */
$fieldMap = [
'token' => 'token',
$result = $this->invokeAPI($args);
- if (is_a($result, 'CRM_Core_Error')) {
- throw new PaymentProcessorException(CRM_Core_Error::getMessages($result));
- }
-
/* Success */
$params['trxn_id'] = $result['transactionid'];
$params['gross_amount'] = $result['amt'];
$result = $this->invokeAPI($args);
- if (is_a($result, 'CRM_Core_Error')) {
- return $result;
- }
-
/* Success - result looks like"
* array (
* 'profileid' => 'I-CP1U0PLG91R2',
$result = $this->invokeAPI($args);
- // WAG
- if (is_a($result, 'CRM_Core_Error')) {
- return $result;
- }
-
$params['recurr_profile_id'] = NULL;
if (CRM_Utils_Array::value('is_recur', $params) == 1) {
$args['NOTE'] = CRM_Utils_Array::value('reason', $params);
$result = $this->invokeAPI($args);
- if (is_a($result, 'CRM_Core_Error')) {
- throw new PaymentProcessorException(CRM_Core_Error::getMessages($result, "\n"));
- }
+
$message = "{$result['ack']}: profileid={$result['profileid']}";
return TRUE;
}
$args['ZIP'] = $params['country'];
$result = $this->invokeAPI($args);
- if (is_a($result, 'CRM_Core_Error')) {
- return $result;
- }
+
$message = "{$result['ack']}: profileid={$result['profileid']}";
return TRUE;
}
$result = $this->invokeAPI($args);
CRM_Core_Error::debug_var('$result', $result);
- if (is_a($result, 'CRM_Core_Error')) {
- throw new PaymentProcessorException(CRM_Core_Error::getMessages($result, "\n"));
- }
+
$message = "{$result['ack']}: profileid={$result['profileid']}";
return TRUE;
}
* returns an associative array containing the response from the server.
*
* @param array $args
- * @param null $url
*
* @return array|object
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
- public function invokeAPI($args, $url = NULL) {
-
- if ($url === NULL) {
- if (empty($this->_paymentProcessor['url_api'])) {
- throw new PaymentProcessorException(ts('Please set the API URL. Please refer to the documentation for more details'));
- }
+ public function invokeAPI($args) {
- $url = $this->_paymentProcessor['url_api'] . 'nvp';
+ if (empty($this->_paymentProcessor['url_api'])) {
+ throw new PaymentProcessorException(ts('Please set the API URL. Please refer to the documentation for more details'));
}
+ $url = $this->_paymentProcessor['url_api'] . 'nvp';
+
$p = [];
foreach ($args as $n => $v) {
$p[] = "$n=" . urlencode($v);
$nvpreq = implode('&', $p);
if (!function_exists('curl_init')) {
- CRM_Core_Error::fatal("curl functions NOT available.");
+ throw new PaymentProcessorException('curl functions NOT available.');
}
//setting the curl parameters.