QuoteDetails.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Tax\Model\Sales\Quote;
  7. use Magento\Framework\Model\AbstractExtensibleModel;
  8. use Magento\Tax\Api\Data\QuoteDetailsInterface;
  9. /**
  10. * @codeCoverageIgnore
  11. */
  12. class QuoteDetails extends AbstractExtensibleModel implements QuoteDetailsInterface
  13. {
  14. /**#@+
  15. * Constants defined for keys of array, makes typos less likely
  16. */
  17. const KEY_BILLING_ADDRESS = 'billing_address';
  18. const KEY_SHIPPING_ADDRESS = 'shipping_address';
  19. const KEY_CUSTOMER_TAX_CLASS_KEY = 'customer_tax_class_key';
  20. const KEY_ITEMS = 'items';
  21. const KEY_CUSTOMER_TAX_CLASS_ID = 'customer_tax_class_id';
  22. const KEY_CUSTOMER_ID = 'customer_id';
  23. /**#@-*/
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function getBillingAddress()
  28. {
  29. return $this->getData(self::KEY_BILLING_ADDRESS);
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function getShippingAddress()
  35. {
  36. return $this->getData(self::KEY_SHIPPING_ADDRESS);
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function getCustomerTaxClassKey()
  42. {
  43. return $this->getData(self::KEY_CUSTOMER_TAX_CLASS_KEY);
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function getCustomerId()
  49. {
  50. return $this->getData(self::KEY_CUSTOMER_ID);
  51. }
  52. /**
  53. * {@inheritdoc}
  54. */
  55. public function getItems()
  56. {
  57. return $this->getData(self::KEY_ITEMS);
  58. }
  59. /**
  60. * {@inheritdoc}
  61. */
  62. public function getCustomerTaxClassId()
  63. {
  64. return $this->getData(self::KEY_CUSTOMER_TAX_CLASS_ID);
  65. }
  66. /**
  67. * Set customer billing address
  68. *
  69. * @param \Magento\Customer\Api\Data\AddressInterface $billingAddress
  70. * @return $this
  71. */
  72. public function setBillingAddress(\Magento\Customer\Api\Data\AddressInterface $billingAddress = null)
  73. {
  74. return $this->setData(self::KEY_BILLING_ADDRESS, $billingAddress);
  75. }
  76. /**
  77. * Set customer shipping address
  78. *
  79. * @param \Magento\Customer\Api\Data\AddressInterface $shippingAddress
  80. * @return $this
  81. */
  82. public function setShippingAddress(\Magento\Customer\Api\Data\AddressInterface $shippingAddress = null)
  83. {
  84. return $this->setData(self::KEY_SHIPPING_ADDRESS, $shippingAddress);
  85. }
  86. /**
  87. * Set customer tax class key
  88. *
  89. * @param \Magento\Tax\Api\Data\TaxClassKeyInterface $customerTaxClassKey
  90. * @return $this
  91. */
  92. public function setCustomerTaxClassKey(\Magento\Tax\Api\Data\TaxClassKeyInterface $customerTaxClassKey = null)
  93. {
  94. return $this->setData(self::KEY_CUSTOMER_TAX_CLASS_KEY, $customerTaxClassKey);
  95. }
  96. /**
  97. * Set customer id
  98. *
  99. * @param int $customerId
  100. * @return $this
  101. */
  102. public function setCustomerId($customerId)
  103. {
  104. return $this->setData(self::KEY_CUSTOMER_ID, $customerId);
  105. }
  106. /**
  107. * Set customer data
  108. *
  109. * @param \Magento\Tax\Api\Data\QuoteDetailsItemInterface[] $items
  110. * @return $this
  111. */
  112. public function setItems(array $items = null)
  113. {
  114. return $this->setData(self::KEY_ITEMS, $items);
  115. }
  116. /**
  117. * Set customer tax class id
  118. *
  119. * @param int $customerTaxClassId
  120. * @return $this
  121. */
  122. public function setCustomerTaxClassId($customerTaxClassId)
  123. {
  124. return $this->setData(self::KEY_CUSTOMER_TAX_CLASS_ID, $customerTaxClassId);
  125. }
  126. /**
  127. * {@inheritdoc}
  128. *
  129. * @return \Magento\Tax\Api\Data\QuoteDetailsExtensionInterface|null
  130. */
  131. public function getExtensionAttributes()
  132. {
  133. return $this->_getExtensionAttributes();
  134. }
  135. /**
  136. * {@inheritdoc}
  137. *
  138. * @param \Magento\Tax\Api\Data\QuoteDetailsExtensionInterface $extensionAttributes
  139. * @return $this
  140. */
  141. public function setExtensionAttributes(\Magento\Tax\Api\Data\QuoteDetailsExtensionInterface $extensionAttributes)
  142. {
  143. return $this->_setExtensionAttributes($extensionAttributes);
  144. }
  145. }