62 abstract public static function getType();
72 abstract public static function getName();
93 public static function create($handler)
95 if (class_exists($handler))
97 return new $handler();
108 $this->fields[
'TYPE'] = static::getType();
117 return $this->fields[
$name] ??
null;
126 $this->fields[
$name] = $value;
145 if (!$this->
getField(
'LINK_PARAMS'))
156 return $cashbox->getCheckLink($this->
getField(
'LINK_PARAMS'));
177 $entityRegistryType =
null;
179 foreach ($this->entities as
$entity)
183 $this->fields[
'PAYMENT_ID'] =
$entity->getId();
184 $this->fields[
'SUM'] =
$entity->getSum();
185 $this->fields[
'CURRENCY'] =
$entity->getField(
'CURRENCY');
191 $this->fields[
'SHIPMENT_ID'] =
$entity->getId();
194 if ($entityRegistryType ===
null)
196 $entityRegistryType = $entity::getRegistryType();
198 elseif ($entityRegistryType !== $entity::getRegistryType())
200 throw new Main\ArgumentTypeException(
'entities');
204 $collection =
$entity->getCollection();
208 $orderId = $collection->getOrder()->getId();
212 throw new Main\ArgumentTypeException(
'entities');
216 $this->fields[
'ORDER_ID'] =
$orderId;
217 $this->fields[
'ENTITY_REGISTRY_TYPE'] = $entityRegistryType;
224 public function getEntities()
233 if ($this->fields[
'ORDER_ID'] > 0)
235 $orderId = $this->fields[
'ORDER_ID'];
237 elseif ($this->fields[
'PAYMENT_ID'] > 0)
240 $paymentClassName = $registry->getPaymentClassName();
241 $dbRes = $paymentClassName::getList([
243 'ID' => $this->fields[
'PAYMENT_ID']
249 elseif ($this->fields[
'SHIPMENT_ID'] > 0)
252 $shipmentClassName = $registry->getShipmentClassName();
253 $dbRes = $shipmentClassName::getList([
255 'ID' => $this->fields[
'SHIPMENT_ID']
263 throw new Main\SystemException();
268 $orderClassName = $registry->getOrderClassName();
274 if ($this->fields[
'PAYMENT_ID'] > 0)
276 $payment =
$order->getPaymentCollection()->getItemById($this->fields[
'PAYMENT_ID']);
283 if ($this->fields[
'SHIPMENT_ID'] > 0)
285 $shipment =
$order->getShipmentCollection()->getItemById($this->fields[
'SHIPMENT_ID']);
288 $this->entities[] = $shipment;
305 return CashboxCheckTable::update($this->fields[
'ID'], $this->fields);
310 $result = CashboxCheckTable::add($this->fields);
317 $this->fields[
'ID'] = $checkId;
319 foreach ($this->cashboxList as $cashbox)
322 'CHECK_ID' => $checkId,
323 'CASHBOX_ID' => $cashbox[
'ID']
335 $this->fields[
'CASHBOX_ID'] = $cashboxId;
354 foreach ($eventHandlerList as
$event)
377 if (
Main\Loader::includeModule(
'catalog'))
static getList(array $parameters=array())
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)