Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ofdruofd.php
1<?php
2
3namespace Bitrix\Sale\Cashbox;
4
8
9Localization\Loc::loadMessages(__FILE__);
10
15class OfdruOfd extends Ofd
16{
17 const ACTIVE_URL = 'https://ofd.ru/rec/';
18
22 protected function getUrl()
23 {
24 return static::ACTIVE_URL;
25 }
26
31 public static function getName()
32 {
33 return Localization\Loc::getMessage('SALE_CASHBOX_OFDRU_OFD_NAME');
34 }
35
40 public function generateCheckLink($data)
41 {
42 $url = $this->getUrl();
43 $url .= $this->getValueFromSettings('SELLER', 'INN').'/';
44 $url .= $data[Check::PARAM_REG_NUMBER_KKT].'/';
45 $url .= $data[Check::PARAM_FN_NUMBER].'/';
46 $url .= $data[Check::PARAM_FISCAL_DOC_NUMBER].'/';
47 $url .= $data[Check::PARAM_FISCAL_DOC_ATTR];
48
49 return $url;
50 }
51
55 public static function getSettings()
56 {
57 $settings = parent::getSettings();
58
59 $settings['SELLER'] = array(
60 'LABEL' => Localization\Loc::getMessage('SALE_CASHBOX_OFDRU_SETTINGS_SELLER_INFO'),
61 'ITEMS' => array(
62 'INN' => array(
63 'TYPE' => 'STRING',
64 'REQUIRED' => 'Y',
65 'LABEL' => Localization\Loc::getMessage('SALE_CASHBOX_OFDRU_SELLER_INN'),
66 'VALUE' => ''
67 )
68 )
69 );
70
71 return $settings;
72 }
73
77 public function validate()
78 {
79 $result = new Result();
80
81 $settings = $this->cashbox->getField('OFD_SETTINGS');
82
83 if (empty($settings['SELLER']['INN']))
84 {
85 $result->addError(new Main\Error(Localization\Loc::getMessage('SALE_CASHBOX_OFD_VALIDATE_E_INN')));
86 }
87
88 return $result;
89 }
90
91}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
getValueFromSettings($name, $code=null)
Definition ofd.php:185