Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
paymentdocument.php
1<?php
3
5{
6 protected static $FIELD_INFOS = null;
7
11 static public function getFieldsInfo()
12 {
13 if(!self::$FIELD_INFOS)
14 {
15 self::$FIELD_INFOS = array(
16 //region export fields
17 /*'XML_1C_DOCUMENT_ID' => array(
18 'TYPE' => 'string'
19 ),*/
20 'DATE' => array(
21 'TYPE' => 'date'
22 ),
23 'TIME' => array(
24 'TYPE' => 'time'
25 ),
26 'ROLE' => array(
27 'TYPE' => 'string'
28 ),
29 'CURRENCY' => array(
30 'TYPE' => 'string'
31 ),
32 'CURRENCY_RATE' => array(
33 'TYPE' => 'string'
34 ),
35 'VERSION' => array(
36 'TYPE' => 'string'
37 ),
38 'NUMBER_BASE' => array(
39 'TYPE' => 'string'
40 ),
41 'NUMBER' => array(
42 'TYPE' => 'int'
43 ),
44 //endregion
45 'ID' => array(
46 'TYPE' => 'string'
47 ),
48 //'XML_1C_DOCUMENT_ID' => array(
49 // 'TYPE' => 'string'
50 //),
51 'OPERATION' => array(
52 'TYPE' => 'string'
53 ),
54 'ORDER_ID' => array(
55 'TYPE' => 'string'
56 ),
57 'AMOUNT' => array(
58 'TYPE' => 'float'
59 ),
60 'COMMENT' => array(
61 'TYPE' => 'string'
62 ),
63 'CANCELED' => array(
64 'TYPE' => 'bool'
65 ),
66 'VERSION_1C' => array(
67 'TYPE' => 'string'
68 ),
69 'ID_1C' => array(
70 'TYPE' => 'string'
71 ),
72 'CASH_BOX_CHECKS' => array(
73 'ID' => array(
74 'TYPE' => 'string'
75 ),
76
77 'PROPERTIES' => array(
78 'TYPE' => 'array',
79 'FIELDS' => array(
80 'CASHBOX_URL' => array(
81 'TYPE' => 'string'
82 ),
83 'CASHBOX_FISCAL_SIGN' => array(
84 'TYPE' => 'int'
85 ),
86 'CASHBOX_REG_NUMBER_KKT' => array(
87 'TYPE' => 'int'
88 ),
89 'CASHBOX_PRINT_CHECK' => array(
90 'TYPE' => 'bool'
91 )
92 )
93 ),
94 //region export checks.fields
95 'PROP_VALUES' => array(
96 'TYPE'=>'array',
97 'FIELDS'=>array(
98 'ID'=> array(
99 'TYPE'=>'string'
100 ),
101 'VALUE'=> array(
102 'TYPE'=>'bool'
103 )
104 )
105 )
106 //endregion
107 ),
108 'REK_VALUES' => array(
109 'TYPE' => 'array',
110 'FIELDS' => array(
111 //region export fields
112 'PAYED_DATE' => array(
113 'TYPE' => 'array',
114 'FIELDS' => array(
115 'NAME' => array(
116 'TYPE' => 'string'
117 ),
118 'VALUE' => array(
119 'TYPE' => 'datetime'
120 )
121 )
122 ),
123 'PAY_SYSTEM' => array(
124 'TYPE' => 'array',
125 'FIELDS' => array(
126 'NAME' => array(
127 'TYPE' => 'string'
128 ),
129 'VALUE' => array(
130 'TYPE' => 'string'
131 )
132 )
133 ),
134 'PAY_PAID' => array(
135 'TYPE' => 'array',
136 'FIELDS' => array(
137 'NAME' => array(
138 'TYPE' => 'string'
139 ),
140 'VALUE' => array(
141 'TYPE' => 'bool'
142 )
143 )
144 ),
145 'PAY_RETURN' => array(
146 'TYPE' => 'array',
147 'FIELDS' => array(
148 'NAME' => array(
149 'TYPE' => 'string'
150 ),
151 'VALUE' => array(
152 'TYPE' => 'bool'
153 )
154 )
155 ),
156 'PAY_RETURN_REASON' => array(
157 'TYPE' => 'array',
158 'FIELDS' => array(
159 'NAME' => array(
160 'TYPE' => 'string'
161 ),
162 'VALUE' => array(
163 'TYPE' => 'string'
164 )
165 )
166 ),
167 'SITE_NAME' => array(
168 'TYPE' => 'array',
169 'FIELDS' => array(
170 'NAME' => array(
171 'TYPE' => 'string'
172 ),
173 'VALUE' => array(
174 'TYPE' => 'string'
175 )
176 )
177 ),
178 'REKV' => array(
179 'TYPE' => 'array',
180 'FIELDS' => array(
181 'NAME' => array(
182 'TYPE' => 'string'
183 ),
184 'VALUE' => array(
185 'TYPE' => 'string'
186 )
187 )
188 ),
189 //endregion
190 '1C_PAYED_DATE' => array(
191 'TYPE' => 'array',
192 'FIELDS' => array(
193 'NAME' => array(
194 'TYPE' => 'string'
195 ),
196 'VALUE' => array(
197 'TYPE' => 'datetime'
198 )
199 )
200 ),
201 '1C_PAYED_NUM' => array(
202 'TYPE' => 'array',
203 'FIELDS' => array(
204 'NAME' => array(
205 'TYPE' => 'string'
206 ),
207 'VALUE' => array(
208 'TYPE' => 'string'
209 )
210 )
211 ),
212 'CANCEL' => array(
213 'TYPE' => 'array',
214 'FIELDS' => array(
215 'NAME' => array(
216 'TYPE' => 'string'
217 ),
218 'VALUE' => array(
219 'TYPE' => 'bool'
220 )
221 )
222 ),
223 '1C_RETURN' => array(
224 'TYPE' => 'array',
225 'FIELDS' => array(
226 'NAME' => array(
227 'TYPE' => 'string'
228 ),
229 'VALUE' => array(
230 'TYPE' => 'bool'
231 )
232 )
233 ),
234 '1C_RETURN_REASON' => array(
235 'TYPE' => 'array',
236 'FIELDS' => array(
237 'NAME' => array(
238 'TYPE' => 'string'
239 ),
240 'VALUE' => array(
241 'TYPE' => 'string'
242 )
243 )
244 ),
245 '1C_PAYED' => array(
246 'TYPE' => 'array',
247 'FIELDS' => array(
248 'NAME' => array(
249 'TYPE' => 'string'
250 ),
251 'VALUE' => array(
252 'TYPE' => 'bool'
253 )
254 )
255 ),
256 'PAY_SYSTEM_ID' => array(
257 'TYPE' => 'array',
258 'FIELDS' => array(
259 'NAME' => array(
260 'TYPE' => 'string'
261 ),
262 'VALUE' => array(
263 'TYPE' => 'int'
264 )
265 )
266 ),
267 )
268 )
269 );
270 }
271 return self::$FIELD_INFOS;
272 }
273
278 public function output($level=0)
279 {
280 $fields = $this->getFieldValues();
281 $xml = parent::outputXml($fields, $level);
282
283 foreach ($fields as $name=>$value)
284 {
285 if(is_array($value))
286 {
287 switch ($name)
288 {
289 case 'CASH_BOX_CHECKS':
290 $xml .= $this->outputXmlCashBoxChecks($level+0, $name, array($value));
291 break;
292 }
293 }
294 }
295
296 return $xml;
297 }
298
299 protected function outputXmlCashBoxChecks($level, $name, $checks)
300 {
301 $result ='';
302 $result .= $this->openNodeDirectory($level+0, 'CASHBOX_CHECKS');
303
304 foreach ($checks as $check)
305 {
306 $result .= $this->openNodeDirectory($level+1, 'CASHBOX_CHECK');
307 foreach ($check as $code=>$value)
308 {
309 if(is_array($value))
310 {
311 switch ($code)
312 {
313 case 'PROP_VALUES':
314 $result .= $this->openNodeDirectory($level+2, $code);
315 $result .= $this->openNodeDirectory($level+3, 'PROP_VALUE');
316 foreach ($value as $k=>$v)
317 $result .= $this->formatXMLNode($level+4, $k, $v);
318 $result .= $this->closeNodeDirectory($level+3, 'PROP_VALUE');
319 $result .= $this->closeNodeDirectory($level+2, $code);
320 break;
321 }
322 }
323 else
324 $result .= $this->formatXMLNode($level+2, $code, $value);
325 }
326 $result .= $this->closeNodeDirectory($level+1, 'CASHBOX_CHECK');
327 }
328 $result .= $this->closeNodeDirectory($level+0, 'CASHBOX_CHECKS');
329 return $result;
330 }
331}
332
334{
338 public function getTypeId()
339 {
341 }
342}
343
345{
349 public function getTypeId()
350 {
352 }
353}
354
356{
357
361 public function getTypeId()
362 {
364 }
365
366}
formatXMLNode($level, $name, $value, $parameters=array())