public function updateApiEntity(Order $apiOrder, $locale)
    {
        $items = $apiOrder->getItems();

        // Perform price calculation.
        $groupedPrices = [];
        $supplierItems = [];

        $prices = $this->priceCalculator->calculate(
            $items,
            $apiOrder->getNetShippingCosts(),
            $groupedPrices,
            $supplierItems,
            $this->defaultCurrency
        );

        if ($supplierItems) {
            $supplierItems = array_values($supplierItems);
            // Update media api entities.
            $this->createMediaForSupplierItems($supplierItems, $locale);
            // Set grouped items.
            $apiOrder->setSupplierItems($supplierItems);
        }

        $this->createMediaForItems($items, $locale);

        // Check if any price in cart has changed.
        $hasChangedPrices = false;
        foreach ($items as $item) {
            if ($item->getPriceChange()) {
                $hasChangedPrices = true;
                break;
            }
        }
        $apiOrder->setHasChangedPrices($hasChangedPrices);

        // Set total prices.
        $apiOrder->getEntity()->setTotalNetPrice($prices['totalNetPrice']);
        $apiOrder->getEntity()->setTotalPrice($prices['totalPrice']);
        $apiOrder->getEntity()->setTotalRecurringNetPrice($prices['totalRecurringNetPrice']);
        $apiOrder->getEntity()->setTotalRecurringPrice($prices['totalRecurringPrice']);
        $apiOrder->getEntity()->setShippingCosts($prices['shippingCosts']);
    }
public function updateApiEntity(Order $apiOrder, $locale)
    {
        $items = $apiOrder->getItems();

        // Perform price calculation.
        $groupedPrices = [];
        $supplierItems = [];

        $prices = $this->priceCalculator->calculate(
            $items,
            $apiOrder->getNetShippingCosts(),
            $groupedPrices,
            $supplierItems,
            $this->defaultCurrency
        );

        if ($supplierItems) {
            $supplierItems = array_values($supplierItems);
            // Update media api entities.
            $this->createMediaForSupplierItems($supplierItems, $locale);
            // Set grouped items.
            $apiOrder->setSupplierItems($supplierItems);
        }

        $this->createMediaForItems($items, $locale);

        // Check if any price in cart has changed.
        $hasChangedPrices = false;
        foreach ($items as $item) {
            if ($item->getPriceChange()) {
                $hasChangedPrices = true;
                break;
            }
        }
        $apiOrder->setHasChangedPrices($hasChangedPrices);

        // Set total prices.
        $apiOrder->getEntity()->setTotalNetPrice($prices['totalNetPrice']);
        $apiOrder->getEntity()->setTotalPrice($prices['totalPrice']);
        $apiOrder->getEntity()->setTotalRecurringNetPrice($prices['totalRecurringNetPrice']);
        $apiOrder->getEntity()->setTotalRecurringPrice($prices['totalRecurringPrice']);
        $apiOrder->getEntity()->setShippingCosts($prices['shippingCosts']);
    }
public function updateApiEntity ( Order $ apiOrder , $ locale ) { $ items = $ apiOrder -> getItems ( ) ; // Perform price calculation. $ groupedPrices = [ ] ; $ supplierItems = [ ] ; $ prices = $ this -> priceCalculator -> calculate ( $ items , $ apiOrder -> getNetShippingCosts ( ) , $ groupedPrices , $ supplierItems , $ this -> defaultCurrency ) ; if ( $ supplierItems ) { $ supplierItems = array_values ( $ supplierItems ) ; // Update media api entities. $ this -> createMediaForSupplierItems ( $ supplierItems , $ locale ) ; // Set grouped items. $ apiOrder -> setSupplierItems ( $ supplierItems ) ; } $ this -> createMediaForItems ( $ items , $ locale ) ; // Check if any price in cart has changed. $ hasChangedPrices = false ; foreach ( $ items as $ item ) { if ( $ item -> getPriceChange ( ) ) { $ hasChangedPrices = true ; break ; } } $ apiOrder -> setHasChangedPrices ( $ hasChangedPrices ) ; // Set total prices. $ apiOrder -> getEntity ( ) -> setTotalNetPrice ( $ prices [ 'totalNetPrice' ] ) ; $ apiOrder -> getEntity ( ) -> setTotalPrice ( $ prices [ 'totalPrice' ] ) ; $ apiOrder -> getEntity ( ) -> setTotalRecurringNetPrice ( $ prices [ 'totalRecurringNetPrice' ] ) ; $ apiOrder -> getEntity ( ) -> setTotalRecurringPrice ( $ prices [ 'totalRecurringPrice' ] ) ; $ apiOrder -> getEntity ( ) -> setShippingCosts ( $ prices [ 'shippingCosts' ] ) ; }
Function updates the api-entity, like price-calculations.

@param Order $apiOrder
Function updates the api - entity like price - calculations .