/**
  * Create amount renderer
  *
  * @param AmountInterface $amount
  * @param SaleableInterface $saleableItem
  * @param PriceInterface $price
  * @param array $data
  * @return AmountRenderInterface
  * @throws \InvalidArgumentException
  */
 public function createAmountRender(AmountInterface $amount, SaleableInterface $saleableItem = null, PriceInterface $price = null, array $data = [])
 {
     $type = self::DEFAULT_PRICE_GROUP_TYPE;
     if ($saleableItem) {
         $type = $saleableItem->getTypeId();
     }
     $priceCode = null;
     $renderClassName = self::AMOUNT_RENDERER_DEFAULT;
     if ($price) {
         $priceCode = $price->getPriceCode();
         // implement class resolving fallback
         $pattern = [$type . '/prices/' . $priceCode . '/amount_render_class', $type . '/default_amount_render_class', 'default/prices/' . $priceCode . '/amount_render_class', 'default/default_amount_render_class'];
         $renderClassName = $this->findDataByPattern($pattern);
         if (!$renderClassName) {
             throw new \InvalidArgumentException('There is no amount render class for price code "' . $priceCode . '"');
         }
     }
     $arguments['data'] = $data;
     $arguments['rendererPool'] = $this;
     $arguments['amount'] = $amount;
     if ($saleableItem) {
         $arguments['saleableItem'] = $saleableItem;
         if ($price) {
             $arguments['price'] = $price;
         }
     }
     /** @var \Magento\Framework\View\Element\Template $amountBlock */
     $amountBlock = $this->getLayout()->createBlock($renderClassName, '', $arguments);
     if (!$amountBlock instanceof AmountRenderInterface) {
         throw new \InvalidArgumentException('Block "' . $renderClassName . '" must implement \\Magento\\Framework\\Pricing\\Render\\AmountRenderInterface');
     }
     $amountBlock->setTemplate($this->getAmountRenderBlockTemplate($type, $priceCode));
     return $amountBlock;
 }
 /**
  * Create Price Info object for particular product
  *
  * @param SaleableInterface $saleableItem
  * @param array $arguments
  * @return \Magento\Framework\Pricing\PriceInfoInterface
  * @throws \InvalidArgumentException
  */
 public function create(SaleableInterface $saleableItem, array $arguments = [])
 {
     $type = $saleableItem->getTypeId();
     if (isset($this->types[$type]['infoClass'])) {
         $priceInfo = $this->types[$type]['infoClass'];
     } else {
         $priceInfo = $this->types['default']['infoClass'];
     }
     if (isset($this->types[$type]['prices'])) {
         $priceCollection = $this->types[$type]['prices'];
     } else {
         $priceCollection = $this->types['default']['prices'];
     }
     $arguments['saleableItem'] = $saleableItem;
     $quantity = $saleableItem->getQty();
     if ($quantity) {
         $arguments['quantity'] = $quantity;
     }
     $arguments['prices'] = $this->objectManager->create($priceCollection, ['saleableItem' => $arguments['saleableItem'], 'quantity' => $quantity]);
     return $this->objectManager->create($priceInfo, $arguments);
 }