- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/cashbox/cashboxatolfarmv4.php
- Класс: BitrixSaleCashboxCashboxAtolFarmV4
- Вызов: CashboxAtolFarmV4::buildCorrectionCheckQuery
public function buildCorrectionCheckQuery(CorrectionCheck $check)
{
$data = $check->getDataForCheck();
/** @var MainTypeDateTime $dateTime */
$dateTime = $data['date_create'];
$documentDate = $data['correction_info']['document_date'];
if (!$documentDate instanceof MainTypeDate)
{
$documentDate = new MainTypeDate($documentDate);
}
$result = [
'timestamp' => $dateTime->format('d.m.Y H:i:s'),
'external_id' => static::buildUuid(static::UUID_TYPE_CHECK, $data['unique_id']),
'service' => [
'callback_url' => $this->getCallbackUrl(),
],
'correction' => [
'company' => [
'sno' => $this->getValueFromSettings('TAX', 'SNO'),
'inn' => $this->getValueFromSettings('SERVICE', 'INN'),
'payment_address' => $this->getValueFromSettings('SERVICE', 'P_ADDRESS'),
],
'correction_info' => [
'type' => $data['correction_info']['type'],
'base_date' => $documentDate->format('d.m.Y H:i:s'),
'base_number' => $data['correction_info']['document_number'],
'base_name' => mb_substr(
$data['correction_info']['description'],
0,
255
),
],
'payments' => [],
'vats' => []
]
];
if (isset($data['payments']))
{
$paymentTypeMap = $this->getPaymentTypeMap();
foreach ($data['payments'] as $payment)
{
$result['correction']['payments'][] = [
'type' => $paymentTypeMap[$payment['type']],
'sum' => (float)$payment['sum']
];
}
}
if (isset($data['vats']))
{
foreach ($data['vats'] as $item)
{
$vat = $this->getValueFromSettings('VAT', $item['type']);
if (is_null($vat) || $vat === '')
{
$vat = $this->getValueFromSettings('VAT', 'NOT_VAT');
}
$result['correction']['vats'][] = [
'type' => $vat,
'sum' => (float)$item['sum']
];
}
}
return $result;
}