Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
firstofd.php
1<?php
2
3namespace Bitrix\Sale\Cashbox;
4
7
8Localization\Loc::loadMessages(__FILE__);
9
14class FirstOfd extends Ofd
15{
16 const ACTIVE_URL = 'https://consumer.1-ofd.ru/v1?';
17 const TEST_URL = 'https://test-consumer.1-ofd.ru/v1?';
18
22 protected function getUrl()
23 {
24 return $this->isTestMode() ? static::TEST_URL : static::ACTIVE_URL;
25 }
26
30 protected function getLinkParamsMap()
31 {
32 return array(
39 );
40 }
41
46 public function generateCheckLink($data)
47 {
48 $queryParams = array();
49
50 $map = $this->getLinkParamsMap();
51 foreach ($map as $queryKey => $checkKey)
52 {
53 if ($data[$checkKey])
54 {
55 if ($queryKey === 't')
56 {
57 $dateTime = Main\Type\DateTime::createFromTimestamp($data[$checkKey]);
58 $queryParams[] = $queryKey.'='.$dateTime->format('Ymd\THis');
59 }
60 else if ($queryKey === 'n')
61 {
62 $calculatedSignMap = $this->getCalculatedSignMap();
63 $queryParams[] = $queryKey.'='.$calculatedSignMap[$data[$checkKey]];
64 }
65 else
66 {
67 $queryParams[] = $queryKey.'='.$data[$checkKey];
68 }
69 }
70 }
71
72 if (empty($queryParams))
73 return '';
74
75 $url = $this->getUrl();
76 return $url.implode('&', $queryParams);
77 }
78
82 private function getCalculatedSignMap()
83 {
84 return array(
87 );
88 }
89
94 public static function getName()
95 {
96 return Localization\Loc::getMessage('SALE_CASHBOX_FIRST_OFD_NAME');
97 }
98
99}