Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 3.145.158.137
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
3 /
yoomoney /
yookassa-sdk-php /
lib /
Model /
Delete
Unzip
Name
Size
Permission
Date
Action
Confirmation
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
ConfirmationAttributes
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
Deal
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
Notification
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
PaymentData
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
PaymentMethod
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
Payout
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
Receipt
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
Webhook
[ DIR ]
drwxrwxr-x
2023-01-19 06:56
Airline.php
9.95
KB
-rw-rw-r--
2023-01-19 06:56
AirlineInterface.php
1.97
KB
-rw-rw-r--
2023-01-19 06:56
AmountInterface.php
2.13
KB
-rw-rw-r--
2023-01-19 06:56
AuthorizationDetails.php
5.61
KB
-rw-rw-r--
2023-01-19 06:56
AuthorizationDetailsInterface.php
2.6
KB
-rw-rw-r--
2023-01-19 06:56
BaseDeal.php
2.35
KB
-rw-rw-r--
2023-01-19 06:56
CancellationDetails.php
4.09
KB
-rw-rw-r--
2023-01-19 06:56
CancellationDetailsInterface.php
1.95
KB
-rw-rw-r--
2023-01-19 06:56
CancellationDetailsPartyCode.php
1.92
KB
-rw-rw-r--
2023-01-19 06:56
CancellationDetailsReasonCode.php
9.53
KB
-rw-rw-r--
2023-01-19 06:56
ConfirmationType.php
2.64
KB
-rw-rw-r--
2023-01-19 06:56
CurrencyCode.php
1.96
KB
-rw-rw-r--
2023-01-19 06:56
DealInterface.php
4.58
KB
-rw-rw-r--
2023-01-19 06:56
Leg.php
4.93
KB
-rw-rw-r--
2023-01-19 06:56
LegInterface.php
2.7
KB
-rw-rw-r--
2023-01-19 06:56
Locale.php
1.64
KB
-rw-rw-r--
2023-01-19 06:56
Metadata.php
2.21
KB
-rw-rw-r--
2023-01-19 06:56
MonetaryAmount.php
9.03
KB
-rw-rw-r--
2023-01-19 06:56
NotificationEventType.php
3.25
KB
-rw-rw-r--
2023-01-19 06:56
NotificationType.php
1.36
KB
-rw-rw-r--
2023-01-19 06:56
Passenger.php
3.94
KB
-rw-rw-r--
2023-01-19 06:56
PassengerInterface.php
1.8
KB
-rw-rw-r--
2023-01-19 06:56
Payment.php
32.86
KB
-rw-rw-r--
2023-01-19 06:56
PaymentInterface.php
9.06
KB
-rw-rw-r--
2023-01-19 06:56
PaymentMethodType.php
4.48
KB
-rw-rw-r--
2023-01-19 06:56
PaymentStatus.php
2.37
KB
-rw-rw-r--
2023-01-19 06:56
Payout.php
15.97
KB
-rw-rw-r--
2023-01-19 06:56
PayoutInterface.php
4.88
KB
-rw-rw-r--
2023-01-19 06:56
PayoutStatus.php
2.48
KB
-rw-rw-r--
2023-01-19 06:56
Receipt.php
23.58
KB
-rw-rw-r--
2023-01-19 06:56
ReceiptCustomer.php
8.22
KB
-rw-rw-r--
2023-01-19 06:56
ReceiptCustomerInterface.php
3.02
KB
-rw-rw-r--
2023-01-19 06:56
ReceiptInterface.php
3.4
KB
-rw-rw-r--
2023-01-19 06:56
ReceiptItem.php
38.2
KB
-rw-rw-r--
2023-01-19 06:56
ReceiptItemInterface.php
10.04
KB
-rw-rw-r--
2023-01-19 06:56
ReceiptRegistrationStatus.php
2.34
KB
-rw-rw-r--
2023-01-19 06:56
ReceiptType.php
1.81
KB
-rw-rw-r--
2023-01-19 06:56
Recipient.php
4.91
KB
-rw-rw-r--
2023-01-19 06:56
RecipientInterface.php
2.35
KB
-rw-rw-r--
2023-01-19 06:56
Refund.php
16.26
KB
-rw-rw-r--
2023-01-19 06:56
RefundInterface.php
4.09
KB
-rw-rw-r--
2023-01-19 06:56
RefundStatus.php
1.76
KB
-rw-rw-r--
2023-01-19 06:56
Requestor.php
4.65
KB
-rw-rw-r--
2023-01-19 06:56
RequestorInterface.php
1.98
KB
-rw-rw-r--
2023-01-19 06:56
SafeDeal.php
13
KB
-rw-rw-r--
2023-01-19 06:56
Settlement.php
4.56
KB
-rw-rw-r--
2023-01-19 06:56
SettlementInterface.php
1.76
KB
-rw-rw-r--
2023-01-19 06:56
Source.php
5.15
KB
-rw-rw-r--
2023-01-19 06:56
SourceInterface.php
3.61
KB
-rw-rw-r--
2023-01-19 06:56
Supplier.php
4.02
KB
-rw-rw-r--
2023-01-19 06:56
SupplierInterface.php
3.01
KB
-rw-rw-r--
2023-01-19 06:56
ThreeDSecure.php
2.26
KB
-rw-rw-r--
2023-01-19 06:56
Transfer.php
9.07
KB
-rw-rw-r--
2023-01-19 06:56
TransferInterface.php
6.54
KB
-rw-rw-r--
2023-01-19 06:56
TransferStatus.php
2.14
KB
-rw-rw-r--
2023-01-19 06:56
Save
Rename
<?php /** * The MIT License * * Copyright (c) 2022 "YooMoney", NBСO LLC * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ namespace YooKassa\Model; use YooKassa\Common\AbstractObject; use YooKassa\Common\Exceptions\EmptyPropertyValueException; use YooKassa\Common\Exceptions\InvalidPropertyValueException; use YooKassa\Common\Exceptions\InvalidPropertyValueTypeException; use YooKassa\Model\Receipt\AdditionalUserProps; use YooKassa\Model\Receipt\IndustryDetails; use YooKassa\Model\Receipt\OperationalDetails; /** * Класс данных для формирования чека в онлайн-кассе (для соблюдения 54-ФЗ) * * @property ReceiptCustomer $customer Информация о плательщике * @property ReceiptItemInterface[] $items Список товаров в заказе * @property SettlementInterface[] $settlements Массив оплат, обеспечивающих выдачу товара * @property int $taxSystemCode Код системы налогообложения. Число 1-6. * @property int $tax_system_code Код системы налогообложения. Число 1-6. * @property AdditionalUserProps $additionalUserProps Дополнительный реквизит пользователя (тег в 54 ФЗ — 1084) * @property AdditionalUserProps $additional_user_props Дополнительный реквизит пользователя (тег в 54 ФЗ — 1084) * @property IndustryDetails[] $receiptIndustryDetails Отраслевой реквизит чека (тег в 54 ФЗ — 1261) * @property IndustryDetails[] $receipt_industry_details Отраслевой реквизит чека (тег в 54 ФЗ — 1261) * @property OperationalDetails $receiptOperationalDetails Операционный реквизит чека (тег в 54 ФЗ — 1270) * @property OperationalDetails $receipt_operational_details Операционный реквизит чека (тег в 54 ФЗ — 1270) */ class Receipt extends AbstractObject implements ReceiptInterface { /** * @var ReceiptCustomer Информация о плательщике */ private $_customer; /** * @var ReceiptItem[] Список товаров в заказе */ private $_items = array(); /** * @var Settlement[] Массив оплат, обеспечивающих выдачу товара */ private $_settlements = array(); /** * @var ReceiptItem[] Список айтемов в заказе, являющихся доставкой */ private $_shippingItems = array(); /** * @var int Код системы налогообложения. Число 1-6. */ private $_taxSystemCode; /** @var AdditionalUserProps Дополнительный реквизит пользователя (тег в 54 ФЗ — 1084) */ private $_additionalUserProps; /** * @var IndustryDetails[] Отраслевой реквизит чека (тег в 54 ФЗ — 1261) */ private $_receiptIndustryDetails; /** * @var OperationalDetails Операционный реквизит чека (тег в 54 ФЗ — 1270) */ private $_receiptOperationalDetails; /** * Возвращает информацию о плательщике * * @return ReceiptCustomer Информация о плательщике */ public function getCustomer() { if (!$this->_customer) { $this->_customer = new ReceiptCustomer(); } return $this->_customer; } /** * Устанавливает информацию о плательщике * @param ReceiptCustomer $customer */ public function setCustomer($customer) { $this->_customer = $customer; } /** * Возвращает список позиций в текущем чеке * * @return ReceiptItemInterface[] Список товаров в заказе */ public function getItems() { return $this->_items; } /** * Устанавливает список позиций в чеке * * Если до этого в чеке уже были установлены значения, они удаляются и полностью заменяются переданным списком * позиций. Все передаваемые значения в массиве позиций должны быть объектами класса, реализующего интерфейс * ReceiptItemInterface, в противном случае будет выброшено исключение InvalidPropertyValueTypeException. * * @param ReceiptItemInterface[] $value Список товаров в заказе * * @throws EmptyPropertyValueException Выбрасывается если передали пустой массив значений * @throws InvalidPropertyValueTypeException Выбрасывается если в качестве значения был передан не массив и не * итератор, либо если одно из переданных значений не реализует интерфейс ReceiptItemInterface */ public function setItems($value) { if ($value === null || $value === '') { throw new EmptyPropertyValueException('Empty items value in receipt', 0, 'receipt.items'); } if (!is_array($value) && !($value instanceof \Traversable)) { throw new InvalidPropertyValueTypeException( 'Invalid items value type in receipt', 0, 'receipt.items', $value ); } $this->_items = array(); $this->_shippingItems = array(); foreach ($value as $key => $val) { if ($val instanceof ReceiptItemInterface) { $this->addItem($val); } else { throw new InvalidPropertyValueTypeException( 'Invalid item value type in receipt', 0, 'receipt.items['.$key.']', $val ); } } } /** * Добавляет товар в чек * * @param ReceiptItemInterface $value Объект добавляемой в чек позиции */ public function addItem($value) { $this->_items[] = $value; if ($value->isShipping()) { $this->_shippingItems[] = $value; } } /** * Возвращает массив оплат, обеспечивающих выдачу товара * * @return SettlementInterface[] Массив оплат, обеспечивающих выдачу товара. */ public function getSettlements() { return $this->_settlements; } /** * Возвращает массив оплат, обеспечивающих выдачу товара * * @param SettlementInterface[] $value */ public function setSettlements($value) { if ($value === null || $value === '') { throw new EmptyPropertyValueException('Empty settlements value in receipt', 0, 'receipt.settlements'); } if (!is_array($value) && !($value instanceof \Traversable)) { throw new InvalidPropertyValueTypeException( 'Invalid settlements value type in receipt', 0, 'receipt.settlements', $value ); } $this->_settlements = array(); foreach ($value as $key => $val) { if (is_array($val)) { $this->addSettlement(new Settlement($val)); } elseif ($val instanceof SettlementInterface) { $this->addSettlement($val); } else { throw new InvalidPropertyValueTypeException( 'Invalid settlements value type in receipt', 0, 'receipt.settlements['.$key.']', $val ); } } } /** * Добавляет оплату в чек * * @param SettlementInterface $value Объект добавляемой в чек позиции */ public function addSettlement($value) { $this->_settlements[] = $value; } /** * Возвращает код системы налогообложения * * @return int Код системы налогообложения. Число 1-6. */ public function getTaxSystemCode() { return $this->_taxSystemCode; } /** * Устанавливает код системы налогообложения * * @param int $value Код системы налогообложения. Число 1-6 * * @throws InvalidPropertyValueTypeException Выбрасывается если переданный аргумент - не число * @throws InvalidPropertyValueException Выбрасывается если переданный аргумент меньше одного или больше шести */ public function setTaxSystemCode($value) { if ($value === null || $value === '') { $this->_taxSystemCode = null; } elseif (!is_numeric($value)) { throw new InvalidPropertyValueTypeException('Invalid taxSystemCode value type', 0, 'receipt.taxSystemCode'); } else { $castedValue = (int)$value; if ($castedValue < 1 || $castedValue > 6) { throw new InvalidPropertyValueException('Invalid taxSystemCode value: ' . $value, 0, 'receipt.taxSystemCode'); } $this->_taxSystemCode = $castedValue; } } /** * Возвращает дополнительный реквизит пользователя * * @return AdditionalUserProps Дополнительный реквизит пользователя */ public function getAdditionalUserProps() { return $this->_additionalUserProps; } /** * Устанавливает дополнительный реквизит пользователя * * @param AdditionalUserProps|array $value Дополнительный реквизит пользователя */ public function setAdditionalUserProps($value) { if (empty($value)) { $this->_additionalUserProps = null; return; } if (is_array($value)) { $this->_additionalUserProps = new AdditionalUserProps($value); } elseif ($value instanceof AdditionalUserProps) { $this->_additionalUserProps = $value; } else { throw new InvalidPropertyValueTypeException( 'Invalid additionalUserProps value type in receipt', 0, 'Receipt.additional_user_props', $value ); } } /** * Возвращает отраслевой реквизит чека * @return IndustryDetails[] Отраслевой реквизит чека */ public function getReceiptIndustryDetails() { return $this->_receiptIndustryDetails; } /** * Устанавливает отраслевой реквизит чека * @param array|IndustryDetails[] $value Отраслевой реквизит чека * * @throws InvalidPropertyValueTypeException Выбрасывается если переданный аргумент - не массив */ public function setReceiptIndustryDetails($value) { if (empty($value)) { $this->_receiptIndustryDetails = null; return; } if (!is_array($value) && !($value instanceof \Traversable)) { throw new InvalidPropertyValueTypeException( 'Invalid receiptIndustryDetails value type in Receipt', 0, 'Receipt.receipt_industry_details', $value ); } $details = array(); foreach ($value as $key => $item) { if (is_array($item)) { $item = new IndustryDetails($item); } if ($item instanceof IndustryDetails) { $details[] = $item; } else { throw new InvalidPropertyValueTypeException( 'Invalid receiptIndustryDetails value type in Receipt', 0, 'Receipt.receipt_industry_details[' . $key . ']', $item ); } } $this->_receiptIndustryDetails = $details; } /** * Возвращает операционный реквизит чека * @return OperationalDetails Операционный реквизит чека */ public function getReceiptOperationalDetails() { return $this->_receiptOperationalDetails; } /** * Устанавливает операционный реквизит чека * @param array|OperationalDetails $value Операционный реквизит чека * * @throws InvalidPropertyValueTypeException Выбрасывается если переданный аргумент - не массив */ public function setReceiptOperationalDetails($value) { if (empty($value)) { $this->_receiptOperationalDetails = null; return; } if (!is_array($value) && !($value instanceof OperationalDetails)) { throw new InvalidPropertyValueTypeException( 'Invalid receiptOperationalDetails value type in Receipt', 0, 'Receipt.receipt_operational_details', $value ); } if (is_array($value)) { $value = new OperationalDetails($value); } $this->_receiptOperationalDetails = $value; } /** * Проверяет есть ли в чеке хотя бы одна позиция * * @return bool True если чек не пуст, false если в чеке нет ни одной позиции */ public function notEmpty() { return !empty($this->_items); } /** * Возвращает стоимость заказа исходя из состава чека * * @param bool $withShipping Добавить ли к стоимости заказа стоимость доставки * * @return int Общая стоимость заказа в центах/копейках */ public function getAmountValue($withShipping = true) { $result = 0; foreach ($this->_items as $item) { if ($withShipping || !$item->isShipping()) { $result += $item->getAmount(); } } return $result; } /** * Возвращает стоимость доставки исходя из состава чека * * @return int Стоимость доставки из состава чека в центах/копейках */ public function getShippingAmountValue() { $result = 0; foreach ($this->_items as $item) { if ($item->isShipping()) { $result += $item->getAmount(); } } return $result; } /** * Подгоняет стоимость товаров в чеке к общей цене заказа * * @param AmountInterface $orderAmount Общая стоимость заказа * @param bool $withShipping Поменять ли заодно и цену доставки */ public function normalize(AmountInterface $orderAmount, $withShipping = false) { $amount = $orderAmount->getIntegerValue(); if (!$withShipping) { if ($this->_shippingItems !== null) { if ($amount > $this->getShippingAmountValue()) { $amount -= $this->getShippingAmountValue(); } else { $withShipping = true; } } } $realAmount = $this->getAmountValue($withShipping); if ($realAmount !== $amount) { $coefficient = (float)$amount / (float)$realAmount; $items = array(); $realAmount = 0; foreach ($this->_items as $item) { if ($withShipping || !$item->isShipping()) { $price = round($coefficient * $item->getPrice()->getIntegerValue()); if ($price < 1.0) { if ($item->getPrice()->getIntegerValue() > 1) { $item->getPrice()->setValue(0.01); } $amount -= $item->getAmount(); } else { $items[] = $item; $realAmount += $item->getAmount(); } } } uasort($items, function (ReceiptItemInterface $a, ReceiptItemInterface $b) { if ($a->getPrice()->getIntegerValue() > $b->getPrice()->getIntegerValue()) { return -1; } if ($a->getPrice()->getIntegerValue() < $b->getPrice()->getIntegerValue()) { return 1; } return 0; }); $coefficient = (float)$amount / (float)$realAmount; $realAmount = 0; $aloneId = null; foreach ($items as $index => $item) { if ($withShipping || !$item->isShipping()) { $item->applyDiscountCoefficient($coefficient); $realAmount += $item->getAmount(); if ($aloneId === null && $item->getQuantity() === 1.0 && !$item->isShipping()) { $aloneId = $index; } } } if ($aloneId === null) { foreach ($this->_items as $index => $item) { if (!$item->isShipping()) { $aloneId = $index; break; } } } if ($aloneId === null) { $aloneId = 0; } $diff = $amount - $realAmount; if (abs($diff) >= 0.1) { if ($this->_items[$aloneId]->getQuantity() === 1.0) { $this->_items[$aloneId]->increasePrice($diff / 100.0); } elseif ($this->_items[$aloneId]->getQuantity() > 1.0) { $item = $this->_items[$aloneId]->fetchItem(1); $item->increasePrice($diff / 100.0); array_splice($this->_items, $aloneId + 1, 0, array($item)); } else { $item = $this->_items[$aloneId]->fetchItem($this->_items[$aloneId]->getQuantity() / 2); $item->increasePrice($diff / 100.0); array_splice($this->_items, $aloneId + 1, 0, array($item)); } } } } /** * Возвращает номер телефона плательщика в формате ITU-T E.164 на который будет выслан чек * * @deprecated 1.3.0 Устарел — данные рекомендуется брать в параметре receipt.customer.phone. * * @return string Номер телефона плательщика */ public function getPhone() { return $this->getCustomer() ? $this->getCustomer()->getPhone() : null; } /** * Устанавливает номер телефона плательщика в формате ITU-T E.164 на который будет выслан чек * * @deprecated 1.3.0 Устарел — данные рекомендуется передавать в параметре receipt.customer.phone. * * @param string $value Номер телефона плательщика в формате ITU-T E.164 * * @throws InvalidPropertyValueTypeException Выбрасывается если в качестве значения была передана не строка */ public function setPhone($value) { if (!$this->getCustomer()) { $this->setCustomer(new ReceiptCustomer()); } $this->getCustomer()->setPhone($value); } /** * Возвращает адрес электронной почты на который будет выслан чек * * @deprecated 1.3.0 Устарел — данные рекомендуется брать в параметре receipt.customer.email. * * @return string E-mail адрес плательщика */ public function getEmail() { return $this->getCustomer() ? $this->getCustomer()->getEmail() : null; } /** * Устанавливает адрес электронной почты на который будет выслан чек * * @deprecated 1.3.0 Устарел — данные рекомендуется передавать в параметре receipt.customer.email. * * @param string $value E-mail адрес плательщика * * @throws InvalidPropertyValueTypeException Выбрасывается если в качестве значения была передана не строка */ public function setEmail($value) { if (!$this->getCustomer()) { $this->setCustomer(new ReceiptCustomer()); } $this->getCustomer()->setEmail($value); } /** * Устанавливает значения свойств текущего объекта из массива * * @param array|\Traversable $sourceArray Ассоциативный массив с настройками */ public function fromArray($sourceArray) { if (!empty($sourceArray['customer'])) { $sourceArray['customer'] = new ReceiptCustomer($sourceArray['customer']); } if (!empty($sourceArray['items'])) { foreach ($sourceArray['items'] as $i => $itemArray) { if (is_array($itemArray)) { $sourceArray['items'][$i] = new ReceiptItem($itemArray); } } } if (!empty($sourceArray['settlements'])) { foreach ($sourceArray['settlements'] as $i => $itemArray) { if (is_array($itemArray)) { $sourceArray['settlements'][$i] = new Settlement($itemArray); } } } parent::fromArray($sourceArray); } /** * Возвращает Id объекта чека * * @return string Id объекта чека */ public function getObjectId() { return null; } }