Get the refund

@param string $refundId

@return Result\Refund
@throws Error
434256
public static function get($refundId)
    {
        $api = new Api\Info();
        $api->setRefundId($refundId);
        $result = $api->doRequest();

        $result['refundId'] = $refundId;

        return new Result\Refund($result);
    }
821643
public function refund($options, $refund_amount = null)
    {
        if (!is_array($options)) $options = ['out_trade_no' => $options, 'refund_amount' => $refund_amount];
        $this->options->set('method', 'alipay.trade.refund');
        return $this->getResult($options);
    }
1226629
public function createRefund($parameters = [])
    {
        $response = $this->client->post('transactions/refunds', [
            'json' => $parameters,
        ]);
        return json_decode($response->getBody())->refund;
    }
600234
public static function isRefundExist($bill_id, $refund_id)
	{
		$existRefund = Refund::whereBillId($bill_id)
			->whereRefundId($refund_id)
			->first();
		if ($existRefund != null) {
			return true;
		}

		return false;
	}
1310951
public function getForId($paymentId, $refundId, array $parameters = [])
    {
        $this->parentId = $paymentId;

        return parent::rest_read($refundId, $parameters);
    }
751000
private function doCancelTransaction($transactionId)
    {
        $refund = [
            'TransactionID' => $transactionId,
        ];

        /** @var Refund $refund */
        $refund = ClassValidator::getInstance('Eway\Rapid\Model\Refund', $refund);

        return $this->getHttpService()->postCancelAuthorisation($refund->toArray());
    }
257037
protected static function deleteRefundTransactionByIdAsyncWithHttpInfo($refund_transaction_id) 
    {
        $returnType = '';  
        $request = self::deleteRefundTransactionByIdRequest($refund_transaction_id); 

        return self::getHttpClient()
            ->sendAsync($request, self::createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
426345
private function doRefund($refund)
    {
        /** @var Refund $refund */
        $refund = ClassValidator::getInstance('Eway\Rapid\Model\Refund', $refund);

        return $this->getHttpService()->postTransactionRefund($refund->Refund->TransactionID, $refund->toArray());
    }
1245988
private function dataFromObj(Refund $refund)
	{
		$data = array();
		$data['refund_id'] = $refund->refund_id;
		$data['amount'] = $refund->amount;
		$data['status'] = $refund->status;

		foreach ($data as $key => $value) {
			if ($value === null) {
				unset($data[$key]);
			}
		}

		return $data;
	}
1279946
final protected function _refund($a) {
		$ii = $this->ii(); /** @var OP $ii */
		/**
		 * 2016-03-17, 2017-11-11
		 * Despite of its name, @uses \Magento\Sales\Model\Order\Payment::getAuthorizationTransaction()
		 * simply returns the previous transaction,
		 * and it can be not only an `authorization` transaction,
		 * but a transaction of another type (e.g. `payment`) too.
		 *		public function getAuthorizationTransaction() {
		 *			return $this->transactionManager->getAuthorizationTransaction(
		 *				$this->getParentTransactionId(),
		 *				$this->getId(),
		 *				$this->getOrder()->getId()
		 *			);
		 *		}
		 * The code is the same in Magento 2.0.0 - 2.2.1:
		 * https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Sales/Model/Order/Payment.php#L1242-#L1253
		 * https://github.com/magento/magento2/blob/2.2.1/app/code/Magento/Sales/Model/Order/Payment.php#L1316-L1327
		 * @see \Magento\Sales\Model\Order\Payment\Transaction\Manager::getAuthorizationTransaction()
		 *	public function getAuthorizationTransaction($parentTransactionId, $paymentId, $orderId) {
		 *		$transaction = false;
		 *		if ($parentTransactionId) {
		 *			$transaction = $this->transactionRepository->getByTransactionId(
		 *				$parentTransactionId,
		 *				$paymentId,
		 *				$orderId
		 *			);
		 *		}
		 *		return $transaction ?: $this->transactionRepository->getByTransactionType(
		 *			Transaction::TYPE_AUTH,
		 *			$paymentId,
		 *			$orderId
		 *		);
		 *	}
		 * The code is the same in Magento 2.0.0 - 2.2.1:
		 * https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Sales/Model/Order/Payment/Transaction/Manager.php#L31-L47
		 * https://github.com/magento/magento2/blob/2.2.1/app/code/Magento/Sales/Model/Order/Payment/Transaction/Manager.php#L31-L47
		 * It is exactly what we need,
		 * because the module can be set up to capture payments without a preliminary authorization.
		 */
		if ($tPrev = $ii->getAuthorizationTransaction() /** @var T|false $tPrev */) {
			$id = $this->i2e($tPrev->getTxnId()); /** @var string $id */
			// 2016-03-24
			// Credit Memo и Invoice отсутствуют в сценарии Authorize / Capture
			// и присутствуют в сценарии Capture / Refund.
			$cm = $ii->getCreditmemo(); /** @var CM|null $cm */
			$fc = $this->fCharge(); /** @var fCharge $fc */
			$resp = $cm ? $fc->refund($id, $this->amountFormat($a)) : $fc->void($id); /** @var object $resp */
			$this->transInfo($resp);
			$ii->setTransactionId($this->e2i($id, $cm ? Ev::T_REFUND : 'void'));
			if ($cm) {
				/**
				 * 2017-01-19
				 * Записаваем идентификатор операции в БД,
				 * чтобы затем, при обработке оповещений от платёжной системы,
				 * проверять, не было ли это оповещение инициировано нашей же операцией,
				 * и если было, то не обрабатывать его повторно:
				 * @see \Df\Payment\W\Strategy\Refund::_handle()
				 * https://github.com/mage2pro/core/blob/1.12.16/StripeClone/WebhookStrategy/Charge/Refunded.php?ts=4#L21-L23
				 */
				dfp_container_add($this->ii(), self::II_TRANS, fRefund::s($this)->transId($resp));
			}
		}
	}
1046992
public function refund(CardPayments\Refund $refund)
    {
        $refund->setRequiredFields(array('settlementID'));
        $refund->checkRequiredFields();
        $refund->setRequiredFields(array('merchantRefNum'));
        $refund->setOptionalFields(array(
             'amount',
             'dupCheck',
             'splitpay',
        ));

        $request = new Request(array(
             'method' => Request::POST,
             'uri' => $this->prepareURI("/settlements/" . $refund->settlementID . "/refunds"),
             'body' => $refund
        ));

        $response = $this->client->processRequest($request);

        return new CardPayments\Refund($response);
    }
294830
public function setRefId($refId)
    {
        if ($this->refIdAttribute == $this->guidAttribute) {
            return $this->setGUID($refId);
        }
        if ($this->refIdAttribute == $this->idAttribute) {
            return $this->setID($refId);
        }
        return $this->{$this->refIdAttribute} = $refId;
    }
936012
public function getRefunds(CardPayments\Refund $refund = null, CardPayments\Filter $filter = null)
    {
        $queryStr = array();
        if($refund && $refund->merchantRefNum) {
            $queryStr['merchantRefNum'] = $refund->merchantRefNum;
        }
        if($filter) {
            if(isset($filter->limit)) {
                $queryStr['limit'] = $filter->limit;
            }
            if(isset($filter->offset)) {
                $queryStr['offset'] = $filter->offset;
            }
            if(isset($filter->startDate)) {
                $queryStr['startDate'] = $filter->startDate;
            }
            if(isset($filter->endDate)) {
                $queryStr['endDate'] = $filter->endDate;
            }
        }
        $request = new Request(array(
             'method' => Request::GET,
             'uri' => $this->prepareURI("/refunds"),
             'queryStr' => $queryStr
        ));

        $response = $this->client->processRequest($request);

        return new CardPayments\Pagerator($this->client, $response, '\Paysafe\CardPayments\Refund');
    }
1230312
public function getFor(Payment $payment, $refundId, array $parameters = [])
    {
        return $this->getForId($payment->id, $refundId, $parameters);
    }
689715
public function getRefundDetails($sAmazonRefundId)
    {
        //Set default params
        $aRequestParameters['amazon_refund_id'] = $sAmazonRefundId;

        //Make request
        $oData = $this->_convertResponse($this->_getAmazonClient()->getRefundDetails($aRequestParameters));

        //Update/Insert Refund info
        if ((array)$oData !== array()) {
            $sError = '';

            if (isset($oData->Error) === true) {
                $sState = 'Error';
                $sError = $oData->Error->Message;
            } else {
                $sState = $oData->GetRefundDetailsResult->RefundDetails->RefundStatus->State;
            }

            $this->updateRefund($sAmazonRefundId, $sState, $sError);
        }

        return $oData;
    }
1303970
public function refund($paymentId, Model\Money $amount, $merchantReference = '', $requestId = '')
    {
        $request = [
            'amount' => $amount,
            'merchantReference' => $merchantReference,
            'requestId' => $requestId,
        ];

        try {
            $result = $this->getClient()->post(
                sprintf('payments/%s/refund', $paymentId),
                [
                    'auth' => [
                        $this->getAuthorization()->getMerchantId(),
                        $this->getAuthorization()->getSecret(),
                    ],
                    'headers' => [
                        'Accept' => 'application/json',
                        'Content-Type' => 'application/json',
                    ],
                    'body' => $this->getSerializer()->serialize($request, 'json'),
                ]
            );
        } catch (BadResponseException $e) {
            throw new ApiException(
                $this->getSerializer()->deserialize(
                    (string) $e->getResponse()->getBody(),
                    Model\ErrorResponse::class,
                    'json'
                ),
                $e
            );
        }

        return $this->getSerializer()->deserialize(
            (string) $result->getBody(),
            Model\Merchant\Refund::class,
            'json'
        );
    }
892661
public function refundToBuyer($refundAmount, $refundCurrency)
    {
        $refund = new OffAmazonPaymentsService_Model_Price();
        $refund->setCurrencyCode($refundCurrency);
        $refund->setAmount($refundAmount);
        
        $refundRequest = new OffAmazonPaymentsService_Model_RefundRequest();
        $refundRequest->setSellerId($this->_sellerId);
        $refundRequest->setAmazonCaptureId($this->_amazonCaptureId);
        $refundRequest->setRefundReferenceId($this->_refundReferenceId);
        $refundRequest->setRefundAmount($refund);
        
        return $this->_service->refund($refundRequest);
    }