+ /**
+ * 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'],
+ 'net_amount' => $params['gross_amount'] - $result['feeamt'],
+ );
+ }
+