send_amount returns the actual amount paid for the corresponding
 PathPaymentOp to this result.
177636
def send_amount
      s = success!
      return s.last.amount if s.offers.blank?

      source_asset = s.offers.first.asset_bought
      source_offers = s.offers.take_while{|o| o.asset_bought == source_asset}

      source_offers.map(&:amount_bought).sum
    end
1321113
def perform_request
      @raw_response = Braintree::Transaction.submit_for_settlement(
        @options[:reference_number], @options[:amount]
      )
      Conduit::Driver::Braintree::Json::Transaction.new(@raw_response).to_json
    end
527315
protected function sendPayRequest()
    {
        $this->newTransaction();
        $fields = [
            'api'      => $this->config->get('gateway.payir.api'),
            'amount'   => $this->amount,
            'redirect' => $this->getCallback(),
        ];

        if (isset($this->factorNumber))
            $fields['factorNumber'] = $this->factorNumber;

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->serverUrl);
        curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields));
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response = curl_exec($ch);
        $response = json_decode($response, true);
        curl_close($ch);
        if (is_numeric($response['status']) && $response['status'] > 0) {
            $this->refId = $response['transId'];
            $this->transactionSetRefId();
            return true;
        }
        $this->transactionFailed();
        $this->newLog($response['errorCode'], PayirSendException::$errors[ $response['errorCode'] ]);
        throw new PayirSendException($response['errorCode']);
    }
555551
def online(cls, payload, ip, req_sig):
        

        from getpaid.models import Payment

        params = json.loads(payload)
        order_data = params.get('order', {})
        pos_id = order_data.get('merchantPosId')
        payment_id = order_data.get('extOrderId')

        key2 = cls.get_backend_setting('key2')

        if pos_id != cls.get_backend_setting('pos_id'):
            logger.warning('Received message for different pos: {}'.format(pos_id))
            return 'ERROR'

        req_sig_dict = cls.parse_payu_sig(req_sig)
        sig = cls.compute_sig(payload, key2, algorithm=req_sig_dict.get('algorithm', 'md5'))

        if sig != req_sig_dict['signature']:
            logger.warning('Received message with malformed signature. Payload: {}'.format(payload))
            return 'ERROR'

        try:
            payment = Payment.objects.get(id=payment_id)
        except Payment.DoesNotExist:
            logger.warning('Received message for nonexistent payment: {}.\nPayload: {}'.format(payment_id, payload))
            return 'ERROR'
        status = order_data['status']
        if payment.status != 'paid':
            if status == 'COMPLETED':
                payment.external_id = order_data['orderId']
                payment.amount = Decimal(order_data['totalAmount']) / Decimal(100)
                payment.amount_paid = payment.amount
                payment.currenct = order_data['currencyCode']
                payment.paid_on = pendulum.parse(params['localReceiptDateTime']).in_tz('utc')
                payment.description = order_data['description']
                payment.change_status('paid')

            elif status == 'PENDING':
                payment.change_status('in_progress')
            elif status in ['CANCELED', 'REJECTED']:
                payment.change_status('cancelled')
        return 'OK'
864795
def send_money(self, account_id, **params):
        """"""
        for required in ['to', 'amount', 'currency']:
            if required not in params:
                raise ValueError("Missing required parameter: %s" % required)
        params['type'] = 'send'
        response = self._post('v2', 'accounts', account_id, 'transactions', data=params)
        return self._make_api_object(response, Transaction)
595774
public function capture($payment, $amount)
        {
            $error = false;
            // check for payment
            if($amount > 0) {
                $payment->setAmount($amount);

                // Map magento keys to moneris way
                $transaction = $this->_build($payment, self::TRANSACTION_COMPLETION);
                $response = $this->_send($transaction);

                if($response->getResponseCode() > 0 && $response->getResponseCode() <= self::ERROR_CODE_LIMIT) {
                    $payment->setStatus(self::STATUS_SUCCESS);
                } else if($response->getResponseCode() > self::ERROR_CODE_LIMIT && $response->getResponseCode() < self::ERROR_CODE_UPPER_LIMIT) {
                    $error = $this->_errors[$response->getResponseCode()];
                } else {
                    $error = 'Incomplete transaction.';
                }
            } else {
                $error = 'Invalid amount for authorization.';
            }

            // we've got something bad here.
            if ($error !== false) {
                $this->_log($error);
            }
            return $this;
        }
342545
def payments_for_address(self, address):
        ""
        URL = self.api_domain + ("/address/%s?format=json" % address)
        d = urlopen(URL).read()
        json_response = json.loads(d.decode("utf8"))
        response = []
        for tx in json_response.get("txs", []):
            total_out = 0
            for tx_out in tx.get("out", []):
                if tx_out.get("addr") == address:
                    total_out += tx_out.get("value", 0)
            if total_out > 0:
                response.append((tx.get("hash"), total_out))
        return response
737200
def compute_payments(self, precision=None):
        '''
        
        '''
        return quantize(sum([payment.amount for payment in self.__payments]),
                        precision)
615470
private function __sendCheckRequest($path, $param)
    {
        $result = self::__sendRequest($path, 'GET', $param);

        // if response code is 200 return the response value
        if ($result->code === 200) {
            if (isset($result->response->qr))
                unset($result->response->qr);

            return $result->response;

        } else if ($result->code == 0) { // if response code is 0 return false and set error message
            $this->error = $result->response;
            return false;
        } else { //Get error massage and return false
            if (isset($result->response->description) && !is_null($result->response->description))
                $this->error = $result->response->description;
            else if (isset($result->response->message) && !is_null($result->response->message))
                $this->error = $result->response->message;
            return false;
        }
    }
617335
public function getAmount()
    {
        $amount = $this->getRequest()->getRequestParameter('refund_amount');

        return $amount ? $amount : $this->getPaymentBeingRefunded()->getRemainingRefundAmount();
    }
833292
def get_money(self):
        """"""
        response = self.session.get(self.mission_url, verify=False)
        soup = BeautifulSoup(response.text, 'html.parser')
        onclick = soup.find('input', class_='super normal button')['onclick']
        url = onclick.split('=', 1)[1][2:-2]

        if url == '/balance':
            return "You have completed the mission today."
        else:
            headers = {'Referer': 'https://www.v2ex.com/mission/daily'}
            data = {'once': url.split('=')[-1]}
            self.session.get('https://www.v2ex.com'+url, verify=False,
                             headers=headers, data=data)
            balance = self._get_balance()
            return balance
1077993
def transfer(self, payment_id, data={}, **kwargs):
        "
        url = "{}/{}/transfers".format(self.base_url, payment_id)
        return self.post_url(url, data, **kwargs)
3888
public function paymentSuccessful() {
    if ($this->requestHasSucceeded() && $this->requestMethod->isDirectPayment()) {
      return $this->requestMethod->getTransactionSuccessfulCode() == $this->response['resultPayment'];
    }

    return false;
  }
783498
def result(success, data = nil)
      PayDirt::Result.new(success: success, data: data)
    end
1372942
def payable(self, s):
        
        s = parseable_str(s)
        return self.address(s) or self.script(s)
669426
def pay_cost(self, source, amount: int) -> int:
		
		if self.spells_cost_health and source.type == CardType.SPELL:
			self.log("%s spells cost %i health", self, amount)
			self.game.queue_actions(self, [Hit(self.hero, amount)])
			return amount
		if self.temp_mana:
			# Coin, Innervate etc
			used_temp = min(self.temp_mana, amount)
			amount -= used_temp
			self.temp_mana -= used_temp
		self.log("%s pays %i mana", self, amount)
		self.used_mana += amount
		return amount
313399
def rai_from_raw(self, amount):
        

        amount = self._process_value(amount, 'int')

        payload = {"amount": amount}

        resp = self.call('rai_from_raw', payload)

        return int(resp['amount'])