@param string $label
@param string $amount

@return PaymentSummary
961525
public function addPriceList(string $label, string $amount): self
    {
        $this->priceList[] = new PriceList($label, $amount);

        return $this;
    }
1073538
public function charge($amount = null)
    {
        return (new AuthorizationBuilder(TransactionType::SALE, $this))
                        ->withAmount($amount)
                        ->withOneTimePayment(true);
    }
1238773
public function formatAmount($amount, $currency)
    {
        switch ($currency) {
            case "JPY":
            case "IDR":
            case "KRW":
            case "BYR":
            case "VND":
            case "CVE":
            case "DJF":
            case "GNF":
            case "PYG":
            case "RWF":
            case "UGX":
            case "VUV":
            case "XAF":
            case "XOF":
            case "XPF":
            case "GHC":
            case "KMF":
                $format = 0;
                break;
            case "MRO":
                $format = 1;
                break;
            case "BHD":
            case "JOD":
            case "KWD":
            case "OMR":
            case "LYD":
            case "TND":
                $format = 3;
                break;
            default:
                $format = 2;
                break;
        }

        return (int)number_format($amount, $format, '', '');
    }
933243
public function addParticipatePage($label)
    {
        $participate = $this->addContainer($label);
        $subscr = $participate->addPage($this->_('Subscribe'), 'pr.participate.subscribe', 'participate', 'subscribe');
        $subscr->addPage(null, 'pr.participate.subscribe', 'participate', 'subscribe-thanks');
        $unsub = $participate->addPage($this->_('Unsubscribe'), 'pr.participate.unsubscribe', 'participate', 'unsubscribe');
        $unsub->addPage(null, 'pr.participate.unsubscribe', 'participate', 'unsubscribe-thanks');

        return $participate;
    }
6443
private function getFormattedAmount($amount, $status)
    {
        $currency = '€';
        $sign = $amount < 0.0 ? '-' : '';
        /** @noinspection CallableParameterUseCaseInTypeContextInspection */
        $amount = abs($amount);
        $statusClass = $this->getStatusClass($status);
        $statusMessage = $this->getAmountStatusTitle($status);
        $this->setStatus($status, $statusMessage);
        if (!empty($statusMessage)) {
            $statusMessage = " title=\"$statusMessage\"";
        }

        $result = '';
        $result .= '<span class="sign">' . $sign . '</span>';
        $result .= '<span class="currency">' . $currency . '</span>';
        $result .= number_format($amount, 2, ',', '.');
        // Prevents warning "There should be a space between attribute ...
        $wrapperBegin = "<span class=\"amount notice-$statusClass\"" . $statusMessage . '>';
        $result = $wrapperBegin . $result . '</span>';
        return $result;
    }
1074284
public function create($amount, $payment, $options = [])
    {
        $payload = [
            'intent'              => 'sale',
            'application_context' => [],
            'payer'               => [
                'payment_method' => 'paypal',
                'payer_info'     => [],
            ],
            'transactions' => [
                [
                    'amount' => [
                        'currency' => Arr::get($options, 'currency', $this->gateway->getCurrency()),
                        'total'    => $this->gateway->amount($amount),
                        'details'  => [],
                    ],
                    'description'     => Arr::get($options, 'description', 'PayMe Purchase'),
                    'payment_options' => ['allowed_payment_method' => 'IMMEDIATE_PAY'],
                    'invoice_number'  => Arr::get($options, 'reference', ''),
                    'item_list'       => [],
                ],
            ],
            'redirect_urls' => [
                'cancel_url' => Arr::get($options, 'cancel_url', ''),
                'return_url' => Arr::get($options, 'return_url', ''),
            ],
        ];

        $payload = $this->addLineItems($payload, $options);
        $payload = $this->addBilling($payload, $options);
        $payload = $this->addShipping($payload, $options);
        $payload = $this->addDiscount($payload, $options);

        return $this->gateway->commit(
            'post',
            $this->gateway->buildUrlFromString('payments/payment'),
            $payload, $options
        );
    }
1280423
public function setAmount($amount)
    {
        if ($amount instanceof DBMoney) {
            $this->setField('Money', $amount);
        } elseif ($this->Status == 'Created' && is_numeric($amount)) {
            $this->MoneyAmount = $amount;
        }
        return $this;
    }
147323
public function select($field, $label) {
        $select = new Select($this->_entity, $field, $label);
        array_push($this->_elements, $select);

        return $select;
    }
889443
public function criteriaSummaryText(&$label, &$value)
    {
        $label = "";
        $value = "";
        $name = $this->query_name;

        if (isset($this->criteria_summary) && $this->criteria_summary) {
            $label = $this->deriveAttribute("column_title", $this->query_name);
            $value = $this->criteria_summary;
        } else {
            if (ReporticoUtility::getRequestItem($this->query_name . "_FROMDATE_DAY", "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $mth = ReporticoUtility::getRequestItem($name . "_FROMDATE_MONTH", "") + 1;
                $value = ReporticoUtility::getRequestItem($name . "_FROMDATE_DAY", "") . "/" .
                $mth . "/" .
                ReporticoUtility::getRequestItem($name . "_FROMDATE_YEAR", "");
                if (ReporticoUtility::getRequestItem($name . "_TODATE_DAY", "")) {
                    $mth = ReporticoUtility::getRequestItem($name . "_TODATE_MONTH", "") + 1;
                    $value .= "-";
                    $value .= ReporticoUtility::getRequestItem($name . "_TODATE_DAY", "") . "/" .
                    $mth . "/" .
                    ReporticoUtility::getRequestItem($name . "_TODATE_YEAR", "");
                }
            } else if (ReporticoUtility::getRequestItem("MANUAL_" . $name . "_FROMDATE", "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value = ReporticoUtility::getRequestItem("MANUAL_" . $name . "_FROMDATE", "");
                if (ReporticoUtility::getRequestItem("MANUAL_" . $name . "_TODATE", "")) {
                    $value .= "-";
                    $value .= ReporticoUtility::getRequestItem("MANUAL_" . $name . "_TODATE");
                }

            } else if (ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_FROMDATE", "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value = ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_FROMDATE", "");
                if (ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_TODATE", "")) {
                    $value .= "-";
                    $value .= ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_TODATE");
                }

            } else if (ReporticoUtility::getRequestItem("EXPANDED_" . $name, "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value .= implode(ReporticoUtility::getRequestItem("EXPANDED_" . $name, ""), ",");
            } else if (ReporticoUtility::getRequestItem("MANUAL_" . $name, "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value .= ReporticoUtility::getRequestItem("MANUAL_" . $name, "");
            }
        }
    }
93632
public function refund($amount, $currency, $cardData, $cardHolder = null, $details = null)
    {
        HpsInputValidation::checkCurrency($currency);
        $this->_currency = $currency;
        $this->_amount = HpsInputValidation::checkAmount($amount);

        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsCreditReturn = $xml->createElement('hps:CreditReturn');
        $hpsBlock1 = $xml->createElement('hps:Block1');

        $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', 'Y'));
        $hpsBlock1->appendChild($xml->createElement('hps:Amt', $amount));
        if ($cardData instanceof HpsCreditCard) {
            $cardDataElement = $xml->createElement('hps:CardData');
            $cardDataElement->appendChild($this->_hydrateManualEntry($cardData, $xml));
            $hpsBlock1->appendChild($cardDataElement);
        } else if ($cardData instanceof HpsTokenData) {
            $cardDataElement = $xml->createElement('hps:CardData');
            $cardDataElement->appendChild($this->_hydrateTokenData($cardData, $xml));
            $hpsBlock1->appendChild($cardDataElement);
        } else {
            $hpsBlock1->appendChild($xml->createElement('hps:GatewayTxnId', $cardData));
        }
        if ($cardHolder != null) {
            $hpsBlock1->appendChild($this->_hydrateCardHolderData($cardHolder, $xml));
        }
        if ($details != null) {
            $hpsBlock1->appendChild($this->_hydrateAdditionalTxnFields($details, $xml));
        }

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

        return $this->_submitTransaction($hpsTransaction, 'CreditReturn', (isset($details->clientTransactionId) ? $details->clientTransationId : null));
    }
87248
public function filterByAmount($amount)
    {
        $amount = intval($amount);
        $filteredArr = array();
        foreach ($this->_paymentMethodsArrayFiltered as $paymentMethod) {
            $continue = true;
            foreach ($paymentMethod["Issuers"] as $issuer) {
                foreach ($issuer["Countries"] as $country) {
                    if ($amount >= intval($country["MinimumAmount"]) &&
                            $amount <= intval($country["MaximumAmount"])) {
                        array_push($filteredArr, $paymentMethod);
                        $continue = false;
                    }
                    if (!$continue)
                        break;
                }
                if (!$continue)
                    break;
            }
        }
        $this->_paymentMethodsArrayFiltered = $filteredArr;
        return $this;
    }
534037
public static function startAggregate($label, $sublabel = '')
    {
        $time = microtime(true);

        if (empty(self::$aggregated[$label])) {
            self::$aggregated[$label] = array('total' => 0, 'start' => $time, 'count' => 0, 'sub' => array());
        } else {
            self::$aggregated[$label]['start'] = $time;
        }

        if ($sublabel) {

            if (empty(self::$aggregated[$label]['sub'][$sublabel])) {
                self::$aggregated[$label]['sub'][$sublabel] = array('total' => 0, 'start' => $time, 'count' => 0);
            } else {
                self::$aggregated[$label]['sub'][$sublabel]['start'] = $time;
            }
        }
    }
802274
public function toCommon(int $amount, bool $format = true): string
    {
        $money          = $this->castMoney($amount, $this->getCurrencySwiftCode());
        $moneyFormatter = new DecimalMoneyFormatter(new ISOCurrencies());

        return ($format) ?
        number_format($moneyFormatter->format($money), 2, '.', ',') :
        $moneyFormatter->format($money);
    }
73445
public function getPlural($amount, array $variants, $absence = null)
    {
        if ($amount || $absence === null) {
            $result = RUtils::formatNumber($amount).' '.$this->choosePlural($amount, $variants);
        } else {
            $result = $absence;
        }
        return $result;
    }
1265711
public static function clicksToAds($amount): string
    {
        $amountAsString = (string)$amount;
        $isNegativeValue = false;
        if ('-' === $amountAsString[0]) {
            $isNegativeValue = true;
            // cut minus sign from negative value
            $amountAsString = substr($amountAsString, 1, strlen($amountAsString));
        }
        //add leading zeros
        $amountAsString = str_pad($amountAsString, 12, '0', STR_PAD_LEFT);
        // insert decimal separator
        $amountAsString = substr_replace($amountAsString, '.', strlen($amountAsString) - 11, 0);
        if ($isNegativeValue) {
            // prepend minus sign for negative value
            $amountAsString = '-' . $amountAsString;
        }
        return $amountAsString;
    }
314085
public static function findDoublePay($term, $city, $amount, $to, $status = null)
	{
		$payment = self::$paymentStatic
			->newInstance()
			->whereTerm($term)
			->whereTo($to)
			->whereAmount($amount)
			->whereCity($city)
			->whereType(Type::PAY);

		if (!is_array($status)) {
			$status = (array)$status;
		}
		if ($status) {
			$payment->whereIn('status', $status);
		}
		$payment->orderBy('id', 'desc');

		$payment = $payment->first();

		return $payment;

	}
993547
public function inc($field, $amount = 1) {
        $this->checkIncOrDecAmount($amount);

        $data = [$field => ['exp', "{$field} + {$amount}"]];
        return $this->update($data);
    }