Order.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. /**
  3. * This file is part of the Klarna Core module
  4. *
  5. * (c) Klarna Bank AB (publ)
  6. *
  7. * For the full copyright and license information, please view the NOTICE
  8. * and LICENSE files that were distributed with this source code.
  9. */
  10. namespace Klarna\Core\Model;
  11. use Klarna\Core\Api\OrderInterface;
  12. use Magento\Framework\DataObject\IdentityInterface;
  13. use Magento\Framework\Model\AbstractModel;
  14. /**
  15. * Class Order
  16. *
  17. * @package Klarna\Core\Model
  18. */
  19. class Order extends AbstractModel implements OrderInterface, IdentityInterface
  20. {
  21. const CACHE_TAG = 'klarna_core_order';
  22. /**
  23. * Get Identities
  24. *
  25. * @return array
  26. */
  27. public function getIdentities()
  28. {
  29. return [self::CACHE_TAG . '_' . $this->getId()];
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function getKlarnaOrderId()
  35. {
  36. return $this->_getData('klarna_order_id');
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function getOrderId()
  42. {
  43. return $this->_getData('order_id');
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function setOrderId($orderId)
  49. {
  50. $this->setData('order_id', $orderId);
  51. return $this;
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function getReservationId()
  57. {
  58. return $this->_getData('reservation_id');
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function setReservationId($reservationId)
  64. {
  65. $this->setData('reservation_id', $reservationId);
  66. return $this;
  67. }
  68. /**
  69. * {@inheritdoc}
  70. */
  71. public function getSessionId()
  72. {
  73. return $this->_getData('session_id');
  74. }
  75. /**
  76. * {@inheritdoc}
  77. */
  78. public function setSessionId($sessionId)
  79. {
  80. $this->setData('session_id', $sessionId);
  81. return $this;
  82. }
  83. /**
  84. * {@inheritdoc}
  85. */
  86. public function setKlarnaOrderId($orderId)
  87. {
  88. $this->setData('klarna_order_id', $orderId);
  89. return $this;
  90. }
  91. /**
  92. * {@inheritdoc}
  93. */
  94. public function setIsAcknowledged($acknowledged)
  95. {
  96. $this->setData('is_acknowledged', $acknowledged);
  97. return $this;
  98. }
  99. /**
  100. * {@inheritdoc}
  101. */
  102. public function getIsAcknowledged()
  103. {
  104. return $this->_getData('is_acknowledged');
  105. }
  106. /**
  107. * {@inheritdoc}
  108. */
  109. public function isAcknowledged()
  110. {
  111. return (bool)$this->_getData('is_acknowledged');
  112. }
  113. /**
  114. * Constructor
  115. *
  116. * @codeCoverageIgnore
  117. * @codingStandardsIgnoreLine
  118. */
  119. protected function _construct()
  120. {
  121. $this->_init(\Klarna\Core\Model\ResourceModel\Order::class);
  122. }
  123. }