TaxDetails.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Model\TaxDetails;
  7. use Magento\Framework\Model\AbstractExtensibleModel;
  8. use Magento\Tax\Api\Data\TaxDetailsInterface;
  9. /**
  10. * @codeCoverageIgnore
  11. */
  12. class TaxDetails extends AbstractExtensibleModel implements TaxDetailsInterface
  13. {
  14. /**#@+
  15. * Constants defined for keys of array, makes typos less likely
  16. */
  17. const KEY_SUBTOTAL = 'subtotal';
  18. const KEY_TAX_AMOUNT = 'tax_amount';
  19. const KEY_APPLIED_TAXES = 'applied_taxes';
  20. const KEY_ITEMS = 'items';
  21. const KEY_DISCOUNT_TAX_COMPENSATION_AMOUNT = 'discount_tax_compensation_amount';
  22. /**#@-*/
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function getSubtotal()
  27. {
  28. return $this->getData(self::KEY_SUBTOTAL);
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function getTaxAmount()
  34. {
  35. return $this->getData(self::KEY_TAX_AMOUNT);
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function getDiscountTaxCompensationAmount()
  41. {
  42. return $this->getData(self::KEY_DISCOUNT_TAX_COMPENSATION_AMOUNT);
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function getAppliedTaxes()
  48. {
  49. return $this->getData(self::KEY_APPLIED_TAXES);
  50. }
  51. /**
  52. * {@inheritdoc}
  53. */
  54. public function getItems()
  55. {
  56. return $this->getData(self::KEY_ITEMS);
  57. }
  58. /**
  59. * Set subtotal
  60. *
  61. * @param float $subtotal
  62. * @return $this
  63. */
  64. public function setSubtotal($subtotal)
  65. {
  66. return $this->setData(self::KEY_SUBTOTAL, $subtotal);
  67. }
  68. /**
  69. * Set tax amount
  70. *
  71. * @param float $taxAmount
  72. * @return $this
  73. */
  74. public function setTaxAmount($taxAmount)
  75. {
  76. return $this->setData(self::KEY_TAX_AMOUNT, $taxAmount);
  77. }
  78. /**
  79. * Set discount amount
  80. *
  81. * @param float $discountTaxCompensationAmount
  82. * @return $this
  83. */
  84. public function setDiscountTaxCompensationAmount($discountTaxCompensationAmount)
  85. {
  86. return $this->setData(
  87. self::KEY_DISCOUNT_TAX_COMPENSATION_AMOUNT,
  88. $discountTaxCompensationAmount
  89. );
  90. }
  91. /**
  92. * Set applied taxes
  93. *
  94. * @param \Magento\Tax\Api\Data\AppliedTaxInterface[] $appliedTaxes
  95. * @return $this
  96. */
  97. public function setAppliedTaxes(array $appliedTaxes = null)
  98. {
  99. return $this->setData(self::KEY_APPLIED_TAXES, $appliedTaxes);
  100. }
  101. /**
  102. * Set TaxDetails items
  103. *
  104. * @param \Magento\Tax\Api\Data\TaxDetailsItemInterface[] $items
  105. * @return $this
  106. */
  107. public function setItems(array $items = null)
  108. {
  109. return $this->setData(self::KEY_ITEMS, $items);
  110. }
  111. /**
  112. * {@inheritdoc}
  113. *
  114. * @return \Magento\Tax\Api\Data\TaxDetailsExtensionInterface|null
  115. */
  116. public function getExtensionAttributes()
  117. {
  118. return $this->_getExtensionAttributes();
  119. }
  120. /**
  121. * {@inheritdoc}
  122. *
  123. * @param \Magento\Tax\Api\Data\TaxDetailsExtensionInterface $extensionAttributes
  124. * @return $this
  125. */
  126. public function setExtensionAttributes(\Magento\Tax\Api\Data\TaxDetailsExtensionInterface $extensionAttributes)
  127. {
  128. return $this->_setExtensionAttributes($extensionAttributes);
  129. }
  130. }