public function refundTransaction($transactionID, $amount) {
    if ($transactionID !== null && $amount !== null && (is_int($amount) || ctype_digit($amount))) {
      $url = $this->url . str_replace(":transactionID", $transactionID, Connect2PayClient::$API_ROUTES['TRANS_REFUND']);
      $trans = array();
      $trans['apiVersion'] = $this->apiVersion;
      $trans['amount'] = intval($amount);

      $result = $this->doPost($url, json_encode($trans));

      $this->status = null;
      if ($result != null && is_array($result)) {
        $this->status = new RefundStatus();
        if (isset($result['code'])) {
          $this->status->setCode($result['code']);
        }
        if (isset($result['message'])) {
          $this->status->setMessage($result['message']);
        }
        if (isset($result['transactionID'])) {
          $this->status->setTransactionID($result['transactionID']);
        }
        if (isset($result['operation'])) {
          $this->status->setOperation($result['operation']);
        }

        return $this->status;
      } else {
        $this->clientErrorMessage = 'No result received from refund call';
      }
    } else {
      $this->clientErrorMessage = '"transactionID" must not be null, "amount" must be a positive integer';
    }

    return null;
  }
public function refundTransaction($transactionID, $amount) {
    if ($transactionID !== null && $amount !== null && (is_int($amount) || ctype_digit($amount))) {
      $url = $this->url . str_replace(":transactionID", $transactionID, Connect2PayClient::$API_ROUTES['TRANS_REFUND']);
      $trans = array();
      $trans['apiVersion'] = $this->apiVersion;
      $trans['amount'] = intval($amount);

      $result = $this->doPost($url, json_encode($trans));

      $this->status = null;
      if ($result != null && is_array($result)) {
        $this->status = new RefundStatus();
        if (isset($result['code'])) {
          $this->status->setCode($result['code']);
        }
        if (isset($result['message'])) {
          $this->status->setMessage($result['message']);
        }
        if (isset($result['transactionID'])) {
          $this->status->setTransactionID($result['transactionID']);
        }
        if (isset($result['operation'])) {
          $this->status->setOperation($result['operation']);
        }

        return $this->status;
      } else {
        $this->clientErrorMessage = 'No result received from refund call';
      }
    } else {
      $this->clientErrorMessage = '"transactionID" must not be null, "amount" must be a positive integer';
    }

    return null;
  }
public function refundTransaction ( $ transactionID , $ amount ) { if ( $ transactionID !== null && $ amount !== null && ( is_int ( $ amount ) || ctype_digit ( $ amount ) ) ) { $ url = $ this -> url . str_replace ( ":transactionID" , $ transactionID , Connect2PayClient :: $ API_ROUTES [ 'TRANS_REFUND' ] ) ; $ trans = array ( ) ; $ trans [ 'apiVersion' ] = $ this -> apiVersion ; $ trans [ 'amount' ] = intval ( $ amount ) ; $ result = $ this -> doPost ( $ url , json_encode ( $ trans ) ) ; $ this -> status = null ; if ( $ result != null && is_array ( $ result ) ) { $ this -> status = new RefundStatus ( ) ; if ( isset ( $ result [ 'code' ] ) ) { $ this -> status -> setCode ( $ result [ 'code' ] ) ; } if ( isset ( $ result [ 'message' ] ) ) { $ this -> status -> setMessage ( $ result [ 'message' ] ) ; } if ( isset ( $ result [ 'transactionID' ] ) ) { $ this -> status -> setTransactionID ( $ result [ 'transactionID' ] ) ; } if ( isset ( $ result [ 'operation' ] ) ) { $ this -> status -> setOperation ( $ result [ 'operation' ] ) ; } return $ this -> status ; } else { $ this -> clientErrorMessage = 'No result received from refund call' ; } } else { $ this -> clientErrorMessage = '"transactionID" must not be null, "amount" must be a positive integer' ; } return null ; }
Refund a transaction.

@param string $transactionID
Identifier of the transaction to refund
@param int $amount
The amount to refund
@return RefundStatus The RefundStatus filled with values returned from the
operation or
null on failure (in that case call getClientErrorMessage())
Refund a transaction .