Tax.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Model\Sales\Order;
  7. /**
  8. * @method int getOrderId()
  9. * @method \Magento\Tax\Model\Sales\Order\Tax setOrderId(int $value)
  10. * @method int getPriority()
  11. * @method \Magento\Tax\Model\Sales\Order\Tax setPriority(int $value)
  12. * @method int getPosition()
  13. * @method \Magento\Tax\Model\Sales\Order\Tax setPosition(int $value)
  14. * @method int getProcess()
  15. * @method \Magento\Tax\Model\Sales\Order\Tax setProcess(int $value)
  16. * @method float getBaseRealAmount()
  17. * @method \Magento\Tax\Model\Sales\Order\Tax setBaseRealAmount(float $value)
  18. * @codeCoverageIgnore
  19. */
  20. class Tax extends \Magento\Framework\Model\AbstractExtensibleModel implements
  21. \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxInterface
  22. {
  23. /**#@+
  24. * Constants defined for keys of array, makes typos less likely
  25. */
  26. const KEY_CODE = 'code';
  27. const KEY_TITLE = 'title';
  28. const KEY_PERCENT = 'percent';
  29. const KEY_AMOUNT = 'amount';
  30. const KEY_BASE_AMOUNT = 'base_amount';
  31. const KEY_RATES = 'rates';
  32. /**#@-*/
  33. /**
  34. * @return void
  35. */
  36. protected function _construct()
  37. {
  38. $this->_init(\Magento\Tax\Model\ResourceModel\Sales\Order\Tax::class);
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function getCode()
  44. {
  45. return $this->getData(self::KEY_CODE);
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function getTitle()
  51. {
  52. return $this->getData(self::KEY_TITLE);
  53. }
  54. /**
  55. * {@inheritdoc}
  56. */
  57. public function getPercent()
  58. {
  59. return $this->getData(self::KEY_PERCENT);
  60. }
  61. /**
  62. * {@inheritdoc}
  63. */
  64. public function getAmount()
  65. {
  66. return $this->getData(self::KEY_AMOUNT);
  67. }
  68. /**
  69. * {@inheritdoc}
  70. */
  71. public function getBaseAmount()
  72. {
  73. return $this->getData(self::KEY_BASE_AMOUNT);
  74. }
  75. /**
  76. * Set code
  77. *
  78. * @param string $code
  79. * @return $this
  80. */
  81. public function setCode($code)
  82. {
  83. return $this->setData(self::KEY_CODE, $code);
  84. }
  85. /**
  86. * Set Title
  87. *
  88. * @param string $title
  89. * @return $this
  90. */
  91. public function setTitle($title)
  92. {
  93. return $this->setData(self::KEY_TITLE, $title);
  94. }
  95. /**
  96. * Set Tax Percent
  97. *
  98. * @param float $percent
  99. * @return $this
  100. */
  101. public function setPercent($percent)
  102. {
  103. return $this->setData(self::KEY_PERCENT, $percent);
  104. }
  105. /**
  106. * Set tax amount
  107. *
  108. * @param float $amount
  109. * @return $this
  110. */
  111. public function setAmount($amount)
  112. {
  113. return $this->setData(self::KEY_AMOUNT, $amount);
  114. }
  115. /**
  116. * Set tax amount in base currency
  117. *
  118. * @param float $baseAmount
  119. * @return $this
  120. */
  121. public function setBaseAmount($baseAmount)
  122. {
  123. return $this->setData(self::KEY_BASE_AMOUNT, $baseAmount);
  124. }
  125. /**
  126. *
  127. * @return \Magento\Tax\Api\Data\AppliedTaxRateInterface[]
  128. */
  129. public function getRates()
  130. {
  131. return $this->getData(self::KEY_RATES);
  132. }
  133. /**
  134. *
  135. * @param \Magento\Tax\Api\Data\AppliedTaxRateInterface[] $rates
  136. * @return $this
  137. */
  138. public function setRates($rates)
  139. {
  140. return $this->setData(self::KEY_RATES, $rates);
  141. }
  142. /**
  143. * {@inheritdoc}
  144. *
  145. * @return \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface|null
  146. */
  147. public function getExtensionAttributes()
  148. {
  149. return $this->_getExtensionAttributes();
  150. }
  151. /**
  152. * {@inheritdoc}
  153. *
  154. * @param \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface $extensionAttributes
  155. * @return $this
  156. */
  157. public function setExtensionAttributes(
  158. \Magento\Tax\Api\Data\OrderTaxDetailsAppliedTaxExtensionInterface $extensionAttributes
  159. ) {
  160. return $this->_setExtensionAttributes($extensionAttributes);
  161. }
  162. }