Perform the refund to transfer the amount from seller
to buyer

@param string $refundAmount   amount to refund to the buyer
@param string $refundCurrency currency of the refund

@return void
968105
private function _refundToBuyer($refundAmount, $refundCurrency)
    {
        $response = $this->callStepAndCheckForException(
            'refundToBuyer',
            array($refundAmount, $refundCurrency)
        );
        echo $this->printResponseToWebpage("printRefundResponse", array($response));
        return $response->getRefundResult()
            ->getRefundDetails()->getAmazonRefundId();
    }
795955
protected function getRefundAmount($response)
    {
        $lastCharge = Arr::last($response['charges']['data']);
        $lastRefund = Arr::last($lastCharge['refunds']['data']);

        return abs($lastRefund['amount']);
    }
603982
public function getRefundedAmount($orderIndex = 0)
    {
        $paymentAmountInfo = $this->getPaymentAmountInfo($orderIndex);
        return array_key_exists('refundedAmount', $paymentAmountInfo) ? $paymentAmountInfo['refundedAmount'] : null;
    }
1046657
public function refundOrder(Order $order, $currency, array $params = [])
    {
        $params['currency'] = $currency;

        $this->postAndMap($order->getResourcePath().'/refund', $params, 'toOrder', $order);
    }
931157
public function refund($amount, $reference, array $options = [])
    {
        $params = [];

        if ($amount !== null) {
            $params['amount'] = $this->gateway->amount($amount);
        }

        if (array_key_exists('reason', $options)) {
            $params['reason'] = $options['reason'];
        }

        $url = sprintf($this->gateway->buildUrlFromString('orders').'/%s/refund', $reference);

        return $this->gateway->commit('post', $url, $params);
    }
803940
public void refundTransaction(final String transactionId, @Nullable final BigDecimal amount) {
        String url = Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId;
        if (amount != null) {
            url = url + "?amount_in_cents=" + (amount.intValue() * 100);
        }
        doDELETE(url);
    }
472086
public function refundSet($out_trade_no, $refund_amount)
    {
        unset($this->commonParams['notify_url']);

        $this->commonParams['app_id']     = $this->appid;
        $this->commonParams['method']     = 'alipay.trade.refund';
        $this->commonParams['timestamp']  = date('Y-m-d H:i:s');

        $micro_time = explode(' ', microtime());

        $this->refundRequestParams['out_trade_no']    = $out_trade_no;
        $this->refundRequestParams['refund_amount']   = $refund_amount;
        $this->refundRequestParams['out_request_no']  = $micro_time[1] . ltrim($micro_time[0], '0.');
    }
42964
public function refund($guid, Amount $refundAmount) {
        return new Transaction(
            $this->client->post('transactions/' . $guid . '/refunds', ["amount" => $refundAmount])
        );
    }
449377
public function refund($charge)
    {
        $result = $this->request('POST', '/charges/' . $charge . '/refund');

        return $this->objectConverter->convert($result);
    }
842696
def clean_total_refund_amount(self):
        '''
        
        '''
        initial = self.cleaned_data.get('initial_refund_amount', 0)
        total = self.cleaned_data['total_refund_amount']
        summed_refunds = sum([v for k,v in self.cleaned_data.items() if k.startswith('item_refundamount_')])

        if not self.cleaned_data.get('id'):
            raise ValidationError('ID not in cleaned data')

        if summed_refunds != total:
            raise ValidationError(_('Passed value does not match sum of allocated refunds.'))
        elif summed_refunds > self.cleaned_data['id'].amountPaid + self.cleaned_data['id'].refunds:
            raise ValidationError(_('Total refunds allocated exceed revenue received.'))
        elif total < initial:
            raise ValidationError(_('Cannot reduce the total amount of the refund.'))
        return total
546816
public function refundPayment($orderUuid, $amount = null)
    {
        $request = $this
            ->apiRequestFactory
            ->createRefundPaymentRequest($orderUuid, $amount);

        return $this->send($request);
    }
235165
public function refund($amount)
    {
        $data = array(
            'amount' => (float)$amount
        );
        $data = $this->twisto->requestJson('POST', 'invoice/' . urlencode($this->invoice_id) . '/refund/', $data);
        $this->deserialize($data);
    }
482768
public function refund($purchaseOrderId, $order)
    {
        if(!is_numeric($purchaseOrderId)){
            throw new \Exception("purchaseOrderId must be numeric",1448480783);
        }

        $schema = [
            '/orderRefund' => [
                'namespace' => 'ns3',
                'childNamespace' => 'ns3',
            ],
            '/orderRefund/orderLines' => [
                'sendItemsAs' => 'orderLine',
            ],
            '/orderRefund/orderLines/orderLine/refunds' => [
                'sendItemsAs' => 'refund',
            ],
            '/orderRefund/orderLines/orderLine/refunds/refund/refundCharges' => [
                'sendItemsAs' => 'refundCharge',
            ],
            '@namespaces' => [
                'ns3' => 'http://walmart.com/mp/v3/orders'
            ],
        ];

        $a2x = new A2X($order, $schema);
        $xml = $a2x->asXml();

        return $this->refundOrder([
            'purchaseOrderId' => $purchaseOrderId,
            'order' => $xml,
        ]);
    }
376619
def delete_refund(self, refund_id):
        """"""
        request = self._delete('transactions/refunds/' + str(refund_id))
        return self.responder(request)
165168
public function getRefundResponseTransfer(RefundResponseContainer $responseContainer)
    {
        $result = new RefundResponseTransfer();
        $baseResponse = new BaseResponseTransfer();

        // Fill base response transfer
        $baseResponse->setErrorCode($responseContainer->getErrorcode());
        $baseResponse->setErrorMessage($responseContainer->getErrormessage());
        $baseResponse->setCustomerMessage($responseContainer->getCustomermessage());
        $baseResponse->setStatus($responseContainer->getStatus());
        $baseResponse->setRawResponse($responseContainer->getRawResponse());

        // Set plain attributes
        $result->setTxid($responseContainer->getTxid());
        $result->setProtectResultAvs($responseContainer->getProtectResultAvs());

        // Set aggregated transfers
        $result->setBaseResponse($baseResponse);

        return $result;
    }
457814
public function refund($amount, $originalTransactionReference, $clientReference = NULL, $comment = NULL, $description = NULL, $cardHolderName = NULL, $taxAmount = NULL)
	{
		$request = Request::createFromClient($this);

		$request->setTransactionType(Request::TRANSACTION_TYPE_REFUND)
		        ->setTotalAmount($amount)
		        ->setOriginalTransactionReference($originalTransactionReference)
		        ->setClientReference($clientReference)
		        ->setComment($comment)
		        ->setMerchantDescription($description)
		        ->setMerchantCardHolderName($cardHolderName)
		        ->setTaxAmount($taxAmount);

		return $request;
	}
1240004
public function cancelRefund(CardPayments\Refund $refund)
    {
        $refund->setRequiredFields(array('id'));
        $refund->checkRequiredFields();

        $tmpRefund = new CardPayments\Refund(array(
             'status' => 'CANCELLED'
        ));
        $request = new Request(array(
             'method' => Request::PUT,
             'uri' => $this->prepareURI("/refunds/" . $refund->id),
             'body' => $tmpRefund
        ));
        $response = $this->client->processRequest($request);

        return new CardPayments\Refund($response);
    }