Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
cashboxcheckbox.php
1<?php
2
3namespace Bitrix\Sale\Cashbox;
4
13
14Loc::loadMessages(__FILE__);
15
21{
22 private const HANDLER_MODE_TEST = 'TEST';
23 private const HANDLER_MODE_ACTIVE = 'ACTIVE';
24
25 private const API_VERSION = 'v1';
26 private const HANDLER_TEST_URL = 'https://dev-api.checkbox.in.ua/api';
27 private const HANDLER_ACTIVE_URL = 'https://api.checkbox.in.ua/api';
28
29 private const OPERATION_SIGN_IN = 'cashier/signin';
30 private const OPERATION_CREATE_SHIFT = 'shifts';
31 private const OPERATION_CHECK_SHIFTS = 'cashier/shift';
32 private const OPERATION_CLOSE_SHIFT = 'shifts/close';
33 private const OPERATION_CREATE_CHECK = 'receipts/sell';
34 private const OPERATION_GET_CHECK = 'receipts';
35
36 private const MAX_CODE_LENGTH = 256;
37 private const MAX_NAME_LENGTH = 256;
38
39 private const HTTP_METHOD_GET = 'get';
40 private const HTTP_METHOD_POST = 'post';
41 private const HTTP_NO_REDIRECT = false;
42 private const HTTP_RESPONSE_CODE_201 = 201;
43 private const HTTP_RESPONSE_CODE_202 = 202;
44 private const HTTP_RESPONSE_CODE_400 = 400;
45 private const HTTP_RESPONSE_CODE_401 = 401;
46 private const HTTP_RESPONSE_CODE_403 = 403;
47 private const HTTP_RESPONSE_CODE_422 = 422;
48
49 private const SHIFT_STATUS_OPENED = 'OPENED';
50
51 private const CHECK_STATUS_DONE = 'DONE';
52 private const CHECK_STATUS_ERROR = 'ERROR';
53
54 private const HEADER_TOKEN_TYPE = 'Bearer';
55 private const TOKEN_OPTION_NAME = 'cashbox_checkbox_token';
56
57 private const QUANTITY_MULTIPLIER = 1000;
58 private const PRICE_MULTIPLIER = 100;
59
60 private const DPS_URL = 'https://cabinet.tax.gov.ua/cashregs/check?';
61
62 private const CODE_NO_VAT = '0';
63 private const CODE_VAT_0 = '4';
64 private const CODE_VAT_7 = '2';
65 private const CODE_VAT_20 = '1';
66
67 private const OPEN_SHIFT_WAIT_SECONDS = 5;
68 private const OPEN_SHIFT_WAIT_ATTEMPTS = 2;
69
70 private const BITRIX_CLIENT_NAME = 'api_1c-bitrix';
71
72 public static function getName()
73 {
74 return Loc::getMessage('SALE_CASHBOX_CHECKBOX_TITLE');
75 }
76
77 private static function isCheckReturn(Check $check)
78 {
79 return ($check instanceof SellReturnCheck || $check instanceof SellReturnCashCheck);
80 }
81
82 public function buildCheckQuery(Check $check)
83 {
84 $checkData = $check->getDataForCheck();
85
86 $isReturn = self::isCheckReturn($check);
87
88 $goods = [];
89 foreach ($checkData['items'] as $item)
90 {
91 $goodEntry = [];
92
93 $itemId = $item['entity']->getField('PRODUCT_ID');
94 $code = $item['properties']['ARTNUMBER'];
95 if (!$code)
96 {
97 $code = $itemId;
98 }
99 if (!$code)
100 {
101 $code = 'delivery' . $item['entity']->getField('ID');
102 }
103
104 $vat = $this->getValueFromSettings('VAT', $item['vat']);
105 $goodEntry['good'] = [
106 'code' => mb_substr($code, 0, static::MAX_CODE_LENGTH),
107 'name' => mb_substr($item['name'], 0, static::MAX_NAME_LENGTH),
108 'price' => PriceMaths::roundPrecision($item['price'] * static::PRICE_MULTIPLIER),
109 ];
110
111 if ($vat && $vat !== static::CODE_NO_VAT)
112 {
113 $goodEntry['good']['tax'] = [$vat];
114 }
115
116 if ($item['barcode'])
117 {
118 $goodEntry['good']['barcode'] = $item['barcode'];
119 }
120
121 $goodEntry['quantity'] = $item['quantity'] * static::QUANTITY_MULTIPLIER;
122 $goodEntry['is_return'] = $isReturn;
123 $goods[] = $goodEntry;
124 }
125
126 $delivery = [];
127
128 if ($checkData['client_email'])
129 {
130 $delivery['email'] = $checkData['client_email'];
131 }
132
133 $payments = [];
134 foreach ($checkData['payments'] as $payment)
135 {
136 $paymentType = $payment['type'] === Check::PAYMENT_TYPE_CASH ? 'CASH' : 'CARD';
137 $paymentEntry = [
138 'type' => $paymentType,
139 'value' => PriceMaths::roundPrecision($payment['sum'] * static::PRICE_MULTIPLIER),
140 ];
141 $payments[] = $paymentEntry;
142 }
143
144 $result = [
145 'goods' => $goods,
146 'delivery' => $delivery,
147 'payments' => $payments,
148 ];
149
150 return $result;
151 }
152
156 public function buildZReportQuery($id)
157 {
158 return [];
159 }
160
164 public function check(Check $check)
165 {
166 $url = $this->getRequestUrl(static::OPERATION_GET_CHECK, ['CHECK_ID' => $check->getField('EXTERNAL_UUID')]);
167 $token = $this->getAccessToken();
168
169 $requestHeaders = [
170 'ACCESS_TOKEN' => $token,
171 ];
172
173 $requestBody = [];
174
175 $checkResult = $this->sendRequestWithAuthorization(self::HTTP_METHOD_GET, $url, $requestHeaders, $requestBody);
176 if (!$checkResult->isSuccess())
177 {
178 return $checkResult;
179 }
180
181 $response = $checkResult->getData();
182 $responseStatus = $response['status'];
183
184 switch ($responseStatus)
185 {
186 case static::CHECK_STATUS_DONE:
187 return static::applyCheckResult($response);
188 case static::CHECK_STATUS_ERROR:
189 $checkResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_CHECK_PRINT_ERROR')));
190 return $checkResult;
191 default:
192 return new Result();
193 }
194 }
195
196 protected static function extractCheckData(array $data)
197 {
198 $result = [];
199
200 if (!isset($data['id']))
201 {
202 return $result;
203 }
204
205 $checkInfo = CheckManager::getCheckInfoByExternalUuid($data['id']);
206 if (empty($checkInfo))
207 {
208 return $result;
209 }
210
211 $result['ID'] = $checkInfo['ID'];
212 $result['CHECK_TYPE'] = $checkInfo['TYPE'];
213
214 $check = CheckManager::getObjectById($checkInfo['ID']);
215 $dateTime = new Main\Type\DateTime($data['fiscal_date'], 'Y-m-d\TH:i:s.u');
216 $result['LINK_PARAMS'] = [
217 Check::PARAM_REG_NUMBER_KKT => $data['shift']['cash_register']['id'],
218 Check::PARAM_FISCAL_DOC_NUMBER => $data['fiscal_code'],
219 Check::PARAM_FN_NUMBER => $data['shift']['cash_register']['fiscal_number'],
220 Check::PARAM_SHIFT_NUMBER => $data['shift']['serial'],
221 Check::PARAM_DOC_SUM => (float)$checkInfo['SUM'],
222 Check::PARAM_DOC_TIME => $dateTime->getTimestamp(),
223 Check::PARAM_CALCULATION_ATTR => $check::getCalculatedSign()
224 ];
225
226 return $result;
227 }
228
232 public function printImmediately(Check $check)
233 {
234 $url = $this->getRequestUrl(static::OPERATION_CREATE_CHECK);
235 $token = $this->getAccessToken();
236
237 $requestHeaders = [
238 'ACCESS_TOKEN' => $token,
239 ];
240
241 $requestBody = $this->buildCheckQuery($check);
242
243 $printResult = $this->sendRequestWithAuthorization(self::HTTP_METHOD_POST, $url, $requestHeaders, $requestBody, self::HTTP_NO_REDIRECT);
244 if (!$printResult->isSuccess())
245 {
246 return $printResult;
247 }
248
249 $response = $printResult->getData();
250
251 if ($response['http_code'] === self::HTTP_RESPONSE_CODE_400)
252 {
253 $openShiftResult = $this->openShift();
254 if (!$openShiftResult->isSuccess())
255 {
256 return $openShiftResult;
257 }
258 $this->addCloseShiftAgent();
259
260 $printResult = $this->sendRequestWithAuthorization(self::HTTP_METHOD_POST, $url, $requestHeaders, $requestBody, self::HTTP_NO_REDIRECT);
261 if (!$printResult->isSuccess())
262 {
263 return $printResult;
264 }
265 $response = $printResult->getData();
266 }
267
268 $responseCode = $response['http_code'];
269 switch ($responseCode)
270 {
271 case self::HTTP_RESPONSE_CODE_201:
272 if ($response['id'])
273 {
274 $printResult->setData(['UUID' => $response['id']]);
275 }
276 else
277 {
278 $printResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_CHECK_PRINT_ERROR')));
279 }
280 break;
281 case self::HTTP_RESPONSE_CODE_422:
282 if ($response['detail'])
283 {
284 foreach ($response['detail'] as $errorDetail)
285 {
286 $printResult->addError(new Main\Error($errorDetail['msg']));
287 }
288 }
289 else
290 {
291 $printResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_CHECK_PRINT_ERROR')));
292 }
293 break;
294 default:
295 if ($response['message'])
296 {
297 $printResult->addError(new Main\Error($response['message']));
298 }
299 else
300 {
301 $printResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_CHECK_PRINT_ERROR')));
302 }
303 }
304
305 return $printResult;
306 }
307
308 private function addCloseShiftAgent()
309 {
310 $agentName = 'Bitrix\Sale\Cashbox\CashboxCheckbox::closeShiftAgent(' . $this->getField('ID') .');';
311 $agentTime = Main\Type\DateTime::createFromPhp(date_create('today 23:50'));
312 \CAgent::AddAgent($agentName, 'sale', 'Y', 0, '', 'Y', $agentTime);
313 }
314
321 public static function closeShiftAgent($cashboxId)
322 {
323 $cashbox = Manager::getObjectById($cashboxId);
324 if ($cashbox && $cashbox instanceof self)
325 {
326 $closeShiftResult = $cashbox->closeShift();
327 if (!$closeShiftResult->isSuccess())
328 {
329 $closeShiftErrors = $closeShiftResult->getErrorCollection();
330 foreach ($closeShiftErrors as $error)
331 {
332 if ($error instanceof Errors\Warning)
333 {
334 Logger::addWarning($error->getMessage(), $cashbox->getField('ID'));
335 }
336 else
337 {
338 Logger::addError($error->getMessage(), $cashbox->getField('ID'));
339 }
340 }
341 }
342 }
343 }
344
345 private function sendRequest(string $method, string $url, array $headersData = [], array $bodyData = [], bool $allowRedirect = true): Result
346 {
347 $result = new Result();
348
349 $requestHeaders = static::getHeaders($headersData);
350 $requestBody = static::encode($bodyData);
351
352 $httpClient = new HttpClient();
353 $httpClient->setRedirect($allowRedirect);
354 $httpClient->setHeaders($requestHeaders);
355
356 if ($method === self::HTTP_METHOD_POST)
357 {
358 $response = $httpClient->post($url, $requestBody);
359 }
360 else
361 {
362 $response = $httpClient->get($url);
363 }
364 if ($response)
365 {
366 $responseData = static::decode($response);
367 $responseData['http_code'] = $httpClient->getStatus();
368 $result->addData($responseData);
369 }
370 else
371 {
372 $error = $httpClient->getError();
373 foreach ($error as $code =>$message)
374 {
375 $result->addError(new Main\Error($message, $code));
376 }
377 }
378
379 return $result;
380 }
381
382 private function sendRequestWithAuthorization(string $method, string $url, array $headersData = [], array $bodyData = [], bool $allowRedirect = true): Result
383 {
384 $firstRequestResult = $this->sendRequest($method, $url, $headersData, $bodyData, $allowRedirect);
385 if (!$firstRequestResult->isSuccess())
386 {
387 return $firstRequestResult;
388 }
389
390 $firstRequestResponse = $firstRequestResult->getData();
391 $badResponseCodes = [self::HTTP_RESPONSE_CODE_401, self::HTTP_RESPONSE_CODE_403];
392 if (!in_array($firstRequestResponse['http_code'], $badResponseCodes))
393 {
394 return $firstRequestResult;
395 }
396
397 $headersDataWithNewToken = $headersData;
398 $requestTokenResult = $this->requestAccessToken();
399 if (!$requestTokenResult->isSuccess())
400 {
401 return $requestTokenResult;
402 }
403 $newToken = $requestTokenResult->get('token');
404 $headersDataWithNewToken['ACCESS_TOKEN'] = $newToken;
405
406 $secondRequestResult = $this->sendRequest($method, $url, $headersDataWithNewToken, $bodyData, $allowRedirect);
407 return $secondRequestResult;
408 }
409
410 private static function getAuthorizationHeaderValue(string $token): ?string
411 {
412 if ($token)
413 {
414 return static::HEADER_TOKEN_TYPE . ' ' . $token;
415 }
416
417 return null;
418 }
419
420 private static function getHeaders(array $headersData): array
421 {
422 $accessToken = $headersData['ACCESS_TOKEN'] ?? '';
423 return [
424 'Authorization' => static::getAuthorizationHeaderValue($accessToken),
425 'X-License-Key' => $headersData['LICENSE_KEY'],
426 'X-Client-Name' => static::BITRIX_CLIENT_NAME,
427 'X-Client-Version' => '1.0',
428 ];
429 }
430
431 private static function encode(array $data)
432 {
433 return Main\Web\Json::encode($data, JSON_UNESCAPED_UNICODE);
434 }
435
436 private static function decode(string $data)
437 {
438 return Main\Web\Json::decode($data);
439 }
440
441 private function getRequestUrl(string $action, array $requestParams = []): string
442 {
443 $url = static::HANDLER_ACTIVE_URL;
444
445 if ($this->getValueFromSettings('INTERACTION', 'HANDLER_MODE') === self::HANDLER_MODE_TEST)
446 {
447 $url = static::HANDLER_TEST_URL;
448 }
449
450 $url .= '/' . static::API_VERSION;
451
452 switch ($action)
453 {
454 case static::OPERATION_CREATE_SHIFT:
455 $url .= '/' . static::OPERATION_CREATE_SHIFT;
456 break;
457 case static::OPERATION_CHECK_SHIFTS:
458 $url .= '/' . static::OPERATION_CHECK_SHIFTS;
459 break;
460 case static::OPERATION_CLOSE_SHIFT:
461 $url .= '/' . static::OPERATION_CLOSE_SHIFT;
462 break;
463 case static::OPERATION_CREATE_CHECK:
464 $url .= '/' . static::OPERATION_CREATE_CHECK;
465 break;
466 case static::OPERATION_GET_CHECK:
467 $url .= '/' . static::OPERATION_GET_CHECK . '/' . $requestParams['CHECK_ID'];
468 break;
469 case static::OPERATION_SIGN_IN:
470 $url .= '/' . static::OPERATION_SIGN_IN;
471 break;
472 default:
473 throw new Main\SystemException();
474 }
475
476 return $url;
477 }
478
479 private function getTokenOptionName(): string
480 {
481 return static::TOKEN_OPTION_NAME . '_' . $this->getField('ID');
482 }
483
484 private function getAccessToken(): string
485 {
486 $optionName = $this->getTokenOptionName();
487 return Main\Config\Option::get('sale', $optionName, '');
488 }
489
490 private function setAccessToken(string $token): void
491 {
492 $optionName = $this->getTokenOptionName();
493 Main\Config\Option::set('sale', $optionName, $token);
494 }
495
496 private function requestAccessToken(): Result
497 {
498 $result = new Result();
499
500 $url = $this->getRequestUrl(static::OPERATION_SIGN_IN);
501
502 $requestData = [
503 'login' => $this->getValueFromSettings('AUTH', 'LOGIN'),
504 'password' => $this->getValueFromSettings('AUTH', 'PASSWORD'),
505 ];
506
507 $headersData = [];
508
509 $requestResult = $this->sendRequest(self::HTTP_METHOD_POST, $url, $headersData, $requestData);
510
511 if (!$requestResult->isSuccess())
512 {
513 return $requestResult;
514 }
515
516 $response = $requestResult->getData();
517
518 if ($response['http_code'] === self::HTTP_RESPONSE_CODE_403)
519 {
520 $result->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_AUTHORIZATION_ERROR')));
521 return $result;
522 }
523
524 if ($response['access_token'])
525 {
526 $token = $response['access_token'];
527 $this->setAccessToken($token);
528 $result->set('token', $token);
529 return $result;
530 }
531
532 $result->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_TOKEN_ERROR')));
533 return $result;
534 }
535
536 private function getCurrentShift(): Result
537 {
538 $url = $this->getRequestUrl(static::OPERATION_CHECK_SHIFTS);
539 $token = $this->getAccessToken();
540
541 $requestHeaders = [
542 'ACCESS_TOKEN' => $token,
543 ];
544
545 $requestBody = [];
546
547 $result = $this->sendRequestWithAuthorization(self::HTTP_METHOD_GET, $url, $requestHeaders, $requestBody);
548 return $result;
549 }
550
551 private function openShift(): Result
552 {
553 $url = $this->getRequestUrl(static::OPERATION_CREATE_SHIFT);
554 $token = $this->getAccessToken();
555
556 $requestHeaders = [
557 'ACCESS_TOKEN' => $token,
558 'LICENSE_KEY' => $this->getValueFromSettings('AUTH', 'LICENSE_KEY'),
559 ];
560
561 $requestBody = [];
562
563 $openShiftResult = $this->sendRequestWithAuthorization(self::HTTP_METHOD_POST, $url, $requestHeaders, $requestBody);
564 if (!$openShiftResult->isSuccess())
565 {
566 return $openShiftResult;
567 }
568
569 $response = $openShiftResult->getData();
570
571 switch ($response['http_code'])
572 {
573 case self::HTTP_RESPONSE_CODE_202:
574 $waitAttempts = 0;
575 $openShiftSuccess = false;
576 while ($waitAttempts < static::OPEN_SHIFT_WAIT_ATTEMPTS)
577 {
578 sleep(static::OPEN_SHIFT_WAIT_SECONDS);
579 $currentShiftResult = $this->getCurrentShift();
580 if (!$currentShiftResult->isSuccess())
581 {
582 return $currentShiftResult;
583 }
584
585 $currentShiftStatus = $currentShiftResult->getData()['status'];
586 if ($currentShiftStatus === static::SHIFT_STATUS_OPENED)
587 {
588 $openShiftSuccess = true;
589 break;
590 }
591 $waitAttempts++;
592 }
593
594 if (!$openShiftSuccess)
595 {
596 $openShiftResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_SHIFT_OPEN_ERROR')));
597 return $openShiftResult;
598 }
599
600 return $openShiftResult;
601 case self::HTTP_RESPONSE_CODE_400:
602 $currentShiftResult = $this->getCurrentShift();
603 if (!$currentShiftResult->isSuccess())
604 {
605 return $currentShiftResult;
606 }
607
608 $currentShift = $currentShiftResult->getData();
609 if ($currentShift['status'] && $currentShift['status'] === static::SHIFT_STATUS_OPENED)
610 {
611 $openShiftResult->addWarning(new ResultWarning(Loc::getMessage('SALE_CASHBOX_CHECKBOX_SHIFT_ALREADY_OPENED')));
612 return $openShiftResult;
613 }
614
615 $openShiftResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_SHIFT_OPEN_ERROR')));
616 return $openShiftResult;
617 default:
618 $openShiftResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_SHIFT_OPEN_ERROR')));
619 return $openShiftResult;
620 }
621 }
622
623 private function closeShift(): Result
624 {
625 $url = $this->getRequestUrl(static::OPERATION_CLOSE_SHIFT);
626 $token = $this->getAccessToken();
627
628 $requestHeaders = [
629 'ACCESS_TOKEN' => $token,
630 ];
631
632 $requestBody = [];
633
634 $closeShiftResult = $this->sendRequestWithAuthorization(self::HTTP_METHOD_POST, $url, $requestHeaders, $requestBody);
635 if (!$closeShiftResult->isSuccess())
636 {
637 return $closeShiftResult;
638 }
639
640 $response = $closeShiftResult->getData();
641
642 if ($response['http_code'] !== self::HTTP_RESPONSE_CODE_202)
643 {
644 $closeShiftResult->addError(new Main\Error(Loc::getMessage('SALE_CASHBOX_CHECKBOX_SHIFT_CLOSE_ERROR')));
645 }
646
647 return $closeShiftResult;
648 }
649
653 public static function getSettings($modelId = 0)
654 {
655 $settings = [
656 'AUTH' => [
657 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_AUTH'),
658 'REQUIRED' => 'Y',
659 'ITEMS' => [
660 'LOGIN' => [
661 'TYPE' => 'STRING',
662 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_AUTH_LOGIN_LABEL'),
663 ],
664 'PASSWORD' => [
665 'TYPE' => 'STRING',
666 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_AUTH_PASSWORD_LABEL'),
667 ],
668 'LICENSE_KEY' => [
669 'TYPE' => 'STRING',
670 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_AUTH_LICENSE_KEY_LABEL'),
671 ],
672 ],
673 ],
674 'INTERACTION' => [
675 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_INTERACTION'),
676 'ITEMS' => [
677 'HANDLER_MODE' => [
678 'TYPE' => 'ENUM',
679 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_HANDLER_MODE_LABEL'),
680 'OPTIONS' => [
681 self::HANDLER_MODE_ACTIVE => Loc::getMessage('SALE_CASHBOX_CHECKBOX_MODE_ACTIVE'),
682 self::HANDLER_MODE_TEST => Loc::getMessage('SALE_CASHBOX_CHECKBOX_MODE_TEST'),
683 ],
684 ],
685 ],
686 ],
687 ];
688
689 $settings['VAT'] = [
690 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_VAT'),
691 'REQUIRED' => 'Y',
692 'ITEMS' => [
693 'NOT_VAT' => [
694 'TYPE' => 'STRING',
695 'LABEL' => Loc::getMessage('SALE_CASHBOX_CHECKBOX_SETTINGS_VAT_LABEL_NOT_VAT'),
696 'VALUE' => static::CODE_NO_VAT,
697 ]
698 ]
699 ];
700
701 if (Main\Loader::includeModule('catalog'))
702 {
703 $dbRes = Catalog\VatTable::getList(['filter' => ['ACTIVE' => 'Y']]);
704 $vatList = $dbRes->fetchAll();
705 if ($vatList)
706 {
707 $defaultVatList = [
708 0 => static::CODE_VAT_0,
709 7 => static::CODE_VAT_7,
710 20 => static::CODE_VAT_20,
711 ];
712
713 foreach ($vatList as $vat)
714 {
715 $value = $defaultVatList[(int)$vat['RATE']] ?? '';
716
717 $settings['VAT']['ITEMS'][(int)$vat['ID']] = [
718 'TYPE' => 'STRING',
719 'LABEL' => $vat['NAME'].' ['.(int)$vat['RATE'].'%]',
720 'VALUE' => $value
721 ];
722 }
723 }
724 }
725
726 return $settings;
727 }
728
732 public function getCheckLink(array $linkParams)
733 {
734 $queryParams = [
735 'id=' . $linkParams[Check::PARAM_FISCAL_DOC_NUMBER],
736 'fn=' . $linkParams[Check::PARAM_FN_NUMBER],
737 'date=' . date("Y-m-d",$linkParams[Check::PARAM_DOC_TIME]),
738 ];
739
740 return static::DPS_URL.implode('&', $queryParams);
741 }
742}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
getValueFromSettings($name, $code)
Definition cashbox.php:201
static addWarning(?string $message, $cashboxId=null)
Definition logger.php:34
static addError(?string $message, $cashboxId=null)
Definition logger.php:25
static roundPrecision($value)