return $result;
}
+ /**
+ * Query payment processor for details about a transaction.
+ *
+ * @param array $params
+ * Array of parameters containing one of:
+ * - trxn_id Id of an individual transaction.
+ * - processor_id Id of a recurring contribution series as stored in the civicrm_contribution_recur table.
+ *
+ * @return array
+ * Extra parameters retrieved.
+ * Any parameters retrievable through this should be documented in the function comments at
+ * CRM_Core_Payment::doQuery. Currently:
+ * - fee_amount Amount of fee paid
+ */
+ public function doQuery($params) {
+ return array();
+ }
+
/**
* This function checks to see if we have the right config values.
*
$params['trxn_id'] = CRM_Utils_Array::value('transactionid', $result);
$params['gross_amount'] = CRM_Utils_Array::value('amt', $result);
+ $params = array_merge($params, $this->doQuery($params));
return $params;
}
+ /**
+ * Query payment processor for details about a transaction.
+ *
+ * For paypal see : https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/
+ *
+ * @param array $params
+ * Array of parameters containing one of:
+ * - trxn_id Id of an individual transaction.
+ * - processor_id Id of a recurring contribution series as stored in the civicrm_contribution_recur table.
+ *
+ * @return array
+ * Extra parameters retrieved.
+ * Any parameters retrievable through this should be documented in the function comments at
+ * CRM_Core_Payment::doQuery. Currently
+ * - fee_amount Amount of fee paid
+ *
+ * @throws \Civi\Payment\Exception\PaymentProcessorException
+ */
+ public function doQuery($params) {
+ if (empty($params['trxn_id'])) {
+ throw new \Civi\Payment\Exception\PaymentProcessorException('transaction id not set');
+ }
+ $args = array(
+ 'TRANSACTIONID' => $params['trxn_id'],
+ );
+ $this->initialize($args, 'GetTransactionDetails');
+ $result = $this->invokeAPI($args);
+ return array(
+ 'fee_amount' => $result['feeamt'],
+ );
+ }
+
/**
* This function checks to see if we have the right config values.
*