Currency.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Quote\Model\Cart;
  7. /**
  8. * @codeCoverageIgnore
  9. */
  10. class Currency extends \Magento\Framework\Model\AbstractExtensibleModel implements
  11. \Magento\Quote\Api\Data\CurrencyInterface
  12. {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public function getGlobalCurrencyCode()
  17. {
  18. return $this->getData(self::KEY_GLOBAL_CURRENCY_CODE);
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function getBaseCurrencyCode()
  24. {
  25. return $this->getData(self::KEY_BASE_CURRENCY_CODE);
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function getStoreCurrencyCode()
  31. {
  32. return $this->getData(self::KEY_STORE_CURRENCY_CODE);
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function getQuoteCurrencyCode()
  38. {
  39. return $this->getData(self::KEY_QUOTE_CURRENCY_CODE);
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function getStoreToBaseRate()
  45. {
  46. return $this->getData(self::KEY_STORE_TO_BASE_RATE);
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function getStoreToQuoteRate()
  52. {
  53. return $this->getData(self::KEY_STORE_TO_QUOTE_RATE);
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. public function getBaseToGlobalRate()
  59. {
  60. return $this->getData(self::KEY_BASE_TO_GLOBAL_RATE);
  61. }
  62. /**
  63. * {@inheritdoc}
  64. */
  65. public function getBaseToQuoteRate()
  66. {
  67. return $this->getData(self::KEY_BASE_TO_QUOTE_RATE);
  68. }
  69. /**
  70. * Set global currency code
  71. *
  72. * @param string $globalCurrencyCode
  73. * @return $this
  74. */
  75. public function setGlobalCurrencyCode($globalCurrencyCode)
  76. {
  77. return $this->setData(self::KEY_GLOBAL_CURRENCY_CODE, $globalCurrencyCode);
  78. }
  79. /**
  80. * Set base currency code
  81. *
  82. * @param string $baseCurrencyCode
  83. * @return $this
  84. */
  85. public function setBaseCurrencyCode($baseCurrencyCode)
  86. {
  87. return $this->setData(self::KEY_BASE_CURRENCY_CODE, $baseCurrencyCode);
  88. }
  89. /**
  90. * Set store currency code
  91. *
  92. * @param string $storeCurrencyCode
  93. * @return $this
  94. */
  95. public function setStoreCurrencyCode($storeCurrencyCode)
  96. {
  97. return $this->setData(self::KEY_STORE_CURRENCY_CODE, $storeCurrencyCode);
  98. }
  99. /**
  100. * Set quote currency code
  101. *
  102. * @param string $quoteCurrencyCode
  103. * @return $this
  104. */
  105. public function setQuoteCurrencyCode($quoteCurrencyCode)
  106. {
  107. return $this->setData(self::KEY_QUOTE_CURRENCY_CODE, $quoteCurrencyCode);
  108. }
  109. /**
  110. * Set store currency to base currency rate
  111. *
  112. * @param float $storeToBaseRate
  113. * @return $this
  114. */
  115. public function setStoreToBaseRate($storeToBaseRate)
  116. {
  117. return $this->setData(self::KEY_STORE_TO_BASE_RATE, $storeToBaseRate);
  118. }
  119. /**
  120. * Set store currency to quote currency rate
  121. *
  122. * @param float $storeToQuoteRate
  123. * @return $this
  124. */
  125. public function setStoreToQuoteRate($storeToQuoteRate)
  126. {
  127. return $this->setData(self::KEY_STORE_TO_QUOTE_RATE, $storeToQuoteRate);
  128. }
  129. /**
  130. * Set base currency to global currency rate
  131. *
  132. * @param float $baseToGlobalRate
  133. * @return $this
  134. */
  135. public function setBaseToGlobalRate($baseToGlobalRate)
  136. {
  137. return $this->setData(self::KEY_BASE_TO_GLOBAL_RATE, $baseToGlobalRate);
  138. }
  139. /**
  140. * Set base currency to quote currency rate
  141. *
  142. * @param float $baseToQuoteRate
  143. * @return $this
  144. */
  145. public function setBaseToQuoteRate($baseToQuoteRate)
  146. {
  147. return $this->setData(self::KEY_BASE_TO_QUOTE_RATE, $baseToQuoteRate);
  148. }
  149. /**
  150. * {@inheritdoc}
  151. *
  152. * @return \Magento\Quote\Api\Data\CurrencyExtensionInterface|null
  153. */
  154. public function getExtensionAttributes()
  155. {
  156. return $this->_getExtensionAttributes();
  157. }
  158. /**
  159. * {@inheritdoc}
  160. *
  161. * @param \Magento\Quote\Api\Data\CurrencyExtensionInterface $extensionAttributes
  162. * @return $this
  163. */
  164. public function setExtensionAttributes(\Magento\Quote\Api\Data\CurrencyExtensionInterface $extensionAttributes)
  165. {
  166. return $this->_setExtensionAttributes($extensionAttributes);
  167. }
  168. }