OrderInvoiceStatus.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * @copyright Vertex. All rights reserved. https://www.vertexinc.com/
  4. * @author Mediotype https://www.mediotype.com/
  5. */
  6. namespace Vertex\Tax\Model\Data;
  7. use Magento\Framework\Model\AbstractModel;
  8. use Vertex\Tax\Model\ResourceModel\OrderInvoiceStatus as ResourceModel;
  9. /**
  10. * Model for storage of the invoice sent flag on the order level
  11. *
  12. * This model is primarily used to prevent double commits to the Tax Log while an Order goes through statuses
  13. */
  14. class OrderInvoiceStatus extends AbstractModel
  15. {
  16. const FIELD_ID = ResourceModel::FIELD_ID;
  17. const FIELD_SENT = ResourceModel::FIELD_SENT;
  18. /**
  19. * {@inheritdoc}
  20. *
  21. * MEQP2 Warning: Protected method. Needed to override AbstractDb's _construct
  22. */
  23. protected function _construct()
  24. {
  25. $this->_init(ResourceModel::class);
  26. }
  27. /**
  28. * Retrieve ID of Order with sent status
  29. *
  30. * @return int|null
  31. */
  32. public function getOrderId()
  33. {
  34. return $this->getId();
  35. }
  36. /**
  37. * Set ID of Order with sent status
  38. *
  39. * @param int $orderId
  40. * @return OrderInvoiceStatus
  41. */
  42. public function setOrderId($orderId)
  43. {
  44. return $this->setId($orderId);
  45. }
  46. /**
  47. * Retrieve status of Order being sent to Vertex
  48. *
  49. * @return bool|null
  50. */
  51. public function isSent()
  52. {
  53. return $this->getData(static::FIELD_SENT);
  54. }
  55. /**
  56. * Set status of Order being sent to Vertex
  57. *
  58. * @param bool $isSent
  59. * @return OrderInvoiceStatus
  60. */
  61. public function setIsSent($isSent)
  62. {
  63. return $this->setData(static::FIELD_SENT, (bool)$isSent);
  64. }
  65. }