It is used for Return Transaction
@param string $hostlogkey
@param string $amount
@param string $currency
@return bool
339775
function DoPointReturnTran($hostlogkey,
                               $wpamount,
                               $currency) {

        $posnetRequest = new PosnetRequest();

        $posnetRequest->hostlogkey = $hostlogkey;
        $posnetRequest->wpamount = $wpamount;
        $posnetRequest->currency = $currency;

        return $this->DoTran($posnetRequest, "pointReturn");
    }
577964
public static function of($amount, $currency) : RationalMoney
    {
        $amount = BigRational::of($amount);

        if (! $currency instanceof Currency) {
            $currency = Currency::of($currency);
        }

        return new RationalMoney($amount, $currency);
    }
165321
public function inc(string $key, int $amount=1): int
  {
    $success = false;
    $value = apcu_inc( $key, $amount, $success);

    return ( $success ? $value : false );
  }
549552
private function validateCustomerBalance($balance, $amount, $useDelta = false)
    {
        if ($useDelta) {
            $result = (($balance + self::CONVERSION_DELTA) >= $amount);
        } else {
            $result = ($balance >= $amount);
        }
        return $result;
    }
1298115
public void logPurchase(BigDecimal purchaseAmount, Currency currency, Bundle parameters) {
        appEventsLogger.logPurchase(purchaseAmount, currency, parameters);
    }
165315
private function retrieveExchangeRateFor(Currency $currency): void
    {
        $conversion = sprintf('%s_%s', $this->baseCurrency->getCode(), $currency->getCode());

        $response = $this->client->request('GET', self::EXCHANGE_RATE_API_URL . '/api/v6/convert', [
            'query' => ['q' => $conversion]
        ]);

        $data = json_decode($response->getBody(), true);

        if (! array_key_exists($conversion, $data['results'])) {
            throw CurrencyConverterApiException::currencyNotFound($currency->getCode());
        }

        $this->exchangeRates[$currency->getCode()] = (float) $data['results'][$conversion]['val'];
    }
865047
public function createBill($login, $amount, $receiver, $message)
    {
        $currencyEntry = new Gamecurrency();
        $currencyEntry->setAmount($amount);
        $currencyEntry->setSenderlogin($login);
        $currencyEntry->setReceiverlogin($receiver);
        $currencyEntry->setMessage($message);
        $currencyEntry->setDatetime(new \DateTime());
        try {
            $currencyEntry->save();

            return $currencyEntry;

        } catch (\Exception $e) {
            $this->logger->error("Error while creating bill", ["exception" => $e]);
            $this->console->write('$f00 Fail.', true);

            return false;
        }
    }
1301994
public function getCurrency($currencyCode) : Currency
    {
        if (isset($this->currencies[$currencyCode])) {
            return $this->currencies[$currencyCode];
        }

        if (! isset($this->currencyData[$currencyCode])) {
            if ($this->numericToCurrency === null) {
                $this->numericToCurrency = require __DIR__ . '/../data/numeric-to-currency.php';
            }

            if (isset($this->numericToCurrency[$currencyCode])) {
                return $this->getCurrency($this->numericToCurrency[$currencyCode]);
            }

            throw UnknownCurrencyException::unknownCurrency($currencyCode);
        }

        $currency = new Currency(... $this->currencyData[$currencyCode]);

        return $this->currencies[$currencyCode] = $currency;
    }
877840
public function convertAndFormat($money, $language = null, $currency = null)
    {
        if (!$currency) {
            $currency = $this->currencyCode;
        }

        $convertedMoney = $money->convertToCurrency($currency);

        return $this->intlFormatter($language)->format($convertedMoney);
    }
1263282
public function setPayment(string $provider_token, string $currency = 'EUR')
    {
        if (!$provider_token) {
            $this->logger->warning('setPayment expects a valid provider token, an invalid one given.');
            throw new BotException('Invalid provider token given to "setPayment"');
        }

        $this->_provider_token = $provider_token;
        $this->_payment_currency = $currency;
    }
1187166
public function toMachine(string $amount, string $swift_code = ''): int
    {
        $swift_code = empty($swift_code) ? config('currency.default_swift_code') : $swift_code;

        return (new DecimalMoneyParser(
                new ISOCurrencies()
            ))->parse(
                preg_replace('/[^0-9.-]/im', '', $amount),
                (new Currency($swift_code))
            )->getAmount();
    }
546875
public function captureFull($paymentID, $amount = 0, $currency = '')
    {
        $obj = new stdClass();
        
        $obj->MerchantID = $this->getMerchantID();
        $obj->Timestamp = $this->getTimestamp();
        $obj->amount = $amount;
        $obj->currency = $currency;
        $obj->PaymentID = $paymentID;
        
        // Generate checksum for the request
        $obj->Checksum = $this->generateChecksum($obj, $this->getSecretCode());
        
        // Make the request
        $request = $this->client->CaptureFull($obj);
        
        // Fetch the result
        $result = $request->CaptureFullResult;
        
        // Store result checksum
        $resultChecksum = $result->Checksum;
        
        // Remove result checksum from object
        unset($result->Checksum);
        
        // Create result checksum
        $checkSum = $this->generateChecksum($result, $this->getSecretCode());
        
        // Compare generated checksum and result checksum
        if ($resultChecksum !== $checkSum)
            throw new Exception('Data could not be verified');
        
        // Return result
        return $result;
    }
469073
public function loadCurrency($currencyCode) {
    $filePath = $this->getCurrencyResourceDirectory() . "/$currencyCode.json";
    if (is_readable($filePath)) {
      return $this->createCurrencyFromJson(file_get_contents($filePath));
    }
    else {
      return null;
    }
  }
1184809
public function reward($giftCard, $amount, $currency = 'usd', $gratuity = null, $tax = null)
    {
        $txnType = 'GiftCardReward';

        HpsInputValidation::checkCurrency($currency);
        $amount = HpsInputValidation::checkAmount($amount);

        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsGiftCard = $xml->createElement('hps:'. $txnType);
        $hpsBlock1 = $xml->createElement('hps:Block1');

        $hpsBlock1->appendChild($xml->createElement('hps:Amt', $amount));

        if ( $giftCard instanceof HpsTokenData ) {
            $cardData = new HpsGiftCard();
            $cardData->tokenValue = $giftCard->tokenValue;
        } else {
            $cardData = $giftCard;
        }
        $hpsBlock1->appendChild($this->_hydrateGiftCardData($cardData, $xml));

        if (strtolower($currency) == 'usd' || $currency == 'points') {
            $hpsBlock1->appendChild($xml->createElement('hps:Currency', (strtolower($currency) == 'usd' ? 'USD' : 'POINTS')));
        }
        if ($gratuity != null) {
            $hpsBlock1->appendChild($xml->createElement('hps:GratuityAmtInfo', $gratuity));
        }
        if ($tax != null) {
            $hpsBlock1->appendChild($xml->createElement('hps:TaxAmtInfo', $tax));
        }

        $hpsGiftCard->appendChild($hpsBlock1);
        $hpsTransaction->appendChild($hpsGiftCard);

        return $this->_submitTransaction($hpsTransaction, $txnType);
    }
376907
function DoPointReverseTran($hostlogkey) {

        $posnetRequest = new PosnetRequest();

        $posnetRequest->hostlogkey = $hostlogkey;

        return $this->DoTran($posnetRequest, "pointusagerev");
    }
1062370
protected function isCurrencyValid($currencyValue)
    {
        $availableCurrencies = $this->facade->getAvailableCurrencies();
        /** @var Currency $currency */
        $currencyFound = false;
        foreach ($availableCurrencies as $currency) {
            if ($currencyValue == $currency->getCode()) {
                $currencyFound = true;
            }
        }
        if (!$currencyFound) {
            throw new InvalidConditionValueException(
                \get_class(),
                'currency'
            );
        }

        return true;
    }
814465
function DoCaptTran($hostlogkey,
                        $authcode,
                        $amount,
                        $currency,
                        $instnumber,
                        $multpoint = "00",
                        $extpoint = "000000") {

        $posnetRequest = new PosnetRequest();

        $posnetRequest->hostlogkey = $hostlogkey;
        $posnetRequest->authcode = $authcode;
        $posnetRequest->amount = $amount;
        $posnetRequest->currency = $currency;
        $posnetRequest->instnumber = $instnumber;
        $posnetRequest->multiplepoint = $multpoint;
        $posnetRequest->extrapoint = $extpoint;

        return $this->DoTran($posnetRequest, "capt");
    }