LinkPrice.php 782 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Downloadable\Pricing\Price;
  7. use Magento\Catalog\Pricing\Price\RegularPrice;
  8. use Magento\Downloadable\Model\Link;
  9. /**
  10. * Class LinkPrice Model
  11. *
  12. */
  13. class LinkPrice extends RegularPrice implements LinkPriceInterface
  14. {
  15. /**
  16. * Default price type
  17. */
  18. const PRICE_CODE = 'link_price';
  19. /**
  20. * @param Link $link
  21. * @return \Magento\Framework\Pricing\Amount\AmountInterface
  22. */
  23. public function getLinkAmount(Link $link)
  24. {
  25. $price = $link->getPrice();
  26. $convertedPrice = $this->priceCurrency->convertAndRound($price);
  27. return $this->calculator->getAmount($convertedPrice, $link->getProduct());
  28. }
  29. }