219 $this->
isNewItem($fields[
'ORDER'])? $listFieldsInfoAdd:$listFieldsInfoUpdate
222 if(isset($fields[
'ORDER'][
'BASKET_ITEMS']))
224 $result[
'ORDER'][
'BASKET_ITEMS'] = $basketItem->internalizeFieldsModify($fields)[
'ORDER'][
'BASKET_ITEMS'];
227 if(isset($fields[
'ORDER'][
'PROPERTY_VALUES']))
229 $result[
'ORDER'][
'PROPERTY_VALUES'] = $propertyValue->internalizeFieldsModify($fields)[
'ORDER'][
'PROPERTY_VALUES'];
232 if(isset($fields[
'ORDER'][
'PAYMENTS']))
234 $result[
'ORDER'][
'PAYMENTS'] = $payment->internalizeFieldsModify($fields)[
'ORDER'][
'PAYMENTS'];
237 if(isset($fields[
'ORDER'][
'SHIPMENTS']))
239 $result[
'ORDER'][
'SHIPMENTS'] = $shipment->internalizeFieldsModify($fields)[
'ORDER'][
'SHIPMENTS'];
242 if(isset($fields[
'ORDER'][
'TRADE_BINDINGS']))
244 $result[
'ORDER'][
'TRADE_BINDINGS'] = $tradeBinding->internalizeFieldsModify($fields)[
'ORDER'][
'TRADE_BINDINGS'];
323 if(isset($fields[
'ORDER']))
328 if(isset($fields[
'ORDER'][
'BASKET_ITEMS']))
330 $result[
'ORDER'][
'BASKET_ITEMS'] = $basketItem->internalizeListFields($fields[
'ORDER'][
'BASKET_ITEMS']);
332 foreach ($fields[
'ORDER'][
'BASKET_ITEMS'] as $k=>$items)
334 if(isset($items[
'PROPERTIES']))
336 $result[
'ORDER'][
'BASKET_ITEMS'][$k][
'PROPERTIES'] = $basketProperties->internalizeListFields($items[
'PROPERTIES']);
341 if(isset($fields[
'ORDER'][
'PROPERTY_VALUES']))
343 $result[
'ORDER'][
'PROPERTY_VALUES'] = $propertyValue->internalizeListFields($fields[
'ORDER'][
'PROPERTY_VALUES']);
346 if(isset($fields[
'ORDER'][
'PAYMENTS']))
348 $result[
'ORDER'][
'PAYMENTS'] = $payment->internalizeListFields($fields[
'ORDER'][
'PAYMENTS']);
351 if(isset($fields[
'ORDER'][
'SHIPMENTS']))
353 $result[
'ORDER'][
'SHIPMENTS'] = $shipment->internalizeListFields($fields[
'ORDER'][
'SHIPMENTS']);
355 foreach ($fields[
'ORDER'][
'SHIPMENTS'] as $k=>$items)
357 if(isset($items[
'SHIPMENT_ITEMS']))
359 $result[
'ORDER'][
'SHIPMENTS'][$k][
'SHIPMENT_ITEMS'] = $shipmentItem->internalizeListFields($items[
'SHIPMENT_ITEMS']);
364 if(isset($fields[
'ORDER'][
'TRADE_BINDINGS']))
366 $result[
'ORDER'][
'TRADE_BINDINGS'] = $tradeBinding->internalizeListFields($fields[
'ORDER'][
'TRADE_BINDINGS']);
386 $basketItem = new \Bitrix\Sale\Rest\Entity\BasketItem();
387 $payment = new \Bitrix\Sale\Rest\Entity\Payment();
388 $shipment = new \Bitrix\Sale\Rest\Entity\Shipment();
389 $shipmentItem = new \Bitrix\Sale\Rest\Entity\ShipmentItem();
392 $basketProperties = new \Bitrix\Sale\Rest\Entity\BasketProperties();
394 $result = parent::externalizeFields($fields);
396 if(isset($fields[
'PROPERTY_VALUES']) && count($fields[
'PROPERTY_VALUES'])>0)
398 $result[
'PROPERTY_VALUES'] = $propertyValue->externalizeListFields($fields[
'PROPERTY_VALUES']);
401 if(isset($fields[
'BASKET_ITEMS']) && count($fields[
'BASKET_ITEMS'])>0)
403 foreach ($fields[
'BASKET_ITEMS'] as $k=>$item)
405 $result[
'BASKET_ITEMS'][$k] = $basketItem->externalizeFields($item);
410 if(isset($fields[
'PAYMENTS']) && count($fields[
'PAYMENTS'])>0)
412 $result[
'PAYMENTS'] = $payment->externalizeListFields($fields[
'PAYMENTS']);
415 if(isset($fields[
'SHIPMENTS']) && count($fields[
'SHIPMENTS'])>0)
417 foreach($fields[
'SHIPMENTS'] as $k=>$item)
419 $result[
'SHIPMENTS'][$k] = $shipment->externalizeFields($item);
427 if(isset($fields[
'TRADE_BINDINGS']) && count($fields[
'TRADE_BINDINGS'])>0)
428 $result[
'TRADE_BINDINGS'] = $tradeBinding->externalizeListFields($fields[
'TRADE_BINDINGS']);
469 if($name ==
'getdeliveryidlist'
470 || $name ==
'getpaysystemidlist'
471 || $name ==
'getprintedchecks'
473 elseif ($name ==
'getbasket')
476 $fields = $basketItem->externalizeListFields($fields);
478 elseif ($name ==
'getpayments')
481 $fields = $payment->externalizeListFields($fields);
483 elseif ($name ==
'getshipments')
486 $fields = $shipment->externalizeListFields($fields);
488 elseif ($name ==
'getpropertyvalues')
491 $fields = $propertyValue->externalizeListFields($fields);
493 elseif($name ==
'import')
499 $fields = parent::externalizeResult($name, $fields);
519 $this->
isNewItem($fields[
'ORDER'])? $listFieldsInfoAdd:$listFieldsInfoUpdate
521 if($required->isSuccess() ==
false)
523 $r->addError(
new Error(implode(
', ', $required->getErrorMessages()).
'.'));
526 $required = $propertyValue->checkRequiredFieldsModify($fields);
527 if($required->isSuccess() ==
false)
529 $r->addError(
new Error(implode(
', ', $required->getErrorMessages())));
532 if(isset($fields[
'ORDER'][
'BASKET_ITEMS']))
534 $required = $basketItem->checkRequiredFieldsModify($fields);
535 if($required->isSuccess() ==
false)
537 $r->addError(
new Error(implode(
', ', $required->getErrorMessages())));
541 if(isset($fields[
'ORDER'][
'PAYMENTS']))
543 $required = $payment->checkRequiredFieldsModify($fields);
544 if($required->isSuccess() ==
false)
546 $r->addError(
new Error(implode(
', ', $required->getErrorMessages())));
550 if(isset($fields[
'ORDER'][
'SHIPMENTS']))
552 $required = $shipment->checkRequiredFieldsModify($fields);
553 if($required->isSuccess() ==
false)
555 $r->addError(
new Error(implode(
', ', $required->getErrorMessages())));
559 if(isset($fields[
'ORDER'][
'TRADE_BINDINGS']))
561 $required = $tradeBinding->checkRequiredFieldsModify($fields);
562 if($required->isSuccess() ==
false)
564 $r->addError(
new Error(implode(
', ', $required->getErrorMessages())));