You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 line
3.0KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Model\Credit;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Lc\CaracoleBundle\Doctrine\Extension\PayoffTrait;
  5. use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface;
  6. use Lc\CaracoleBundle\Model\Order\OrderRefundInterface;
  7. use Lc\CaracoleBundle\Doctrine\Extension\PayoffInterface;
  8. use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Lc\SovBundle\Doctrine\Extension\BlameableNullableTrait;
  11. use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
  12. /**
  13. * @ORM\MappedSuperclass()
  14. */
  15. abstract class CreditHistoryModel extends AbstractLightEntity implements PayoffInterface, CreditHistoryInterface
  16. {
  17. use PayoffTrait;
  18. const TYPE_CREDIT = 'credit';
  19. const TYPE_DEBIT = 'debit';
  20. const MEAN_PAYMENT_CREDIT_CARD = 'cb';
  21. const MEAN_PAYMENT_CHEQUE = 'cheque';
  22. const MEAN_PAYMENT_CREDIT = 'credit';
  23. const MEAN_PAYMENT_TRANSFER = 'transfer';
  24. const MEAN_PAYMENT_CASH = 'cash';
  25. const MEAN_PAYMENT_GIFT = 'transfer-gift';
  26. /**
  27. * @ORM\Column(type="float", nullable=true)
  28. */
  29. protected $amount;
  30. /**
  31. * @ORM\Column(type="string", length=31)
  32. */
  33. protected $type;
  34. /**
  35. * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories")
  36. * @ORM\JoinColumn(nullable=false)
  37. */
  38. protected $userMerchant;
  39. /**
  40. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderPaymentInterface", cascade={"persist", "remove"})
  41. */
  42. protected $orderPayment;
  43. /**
  44. * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", cascade={"persist", "remove"})
  45. */
  46. protected $orderRefund;
  47. public function __toString(){
  48. //Todo a écrire
  49. return $this->getType();
  50. }
  51. public function getAmount(): ?float
  52. {
  53. return $this->amount;
  54. }
  55. public function setAmount(?float $amount): self
  56. {
  57. $this->amount = $amount;
  58. return $this;
  59. }
  60. public function getType(): ?string
  61. {
  62. return $this->type;
  63. }
  64. public function setType(string $type): self
  65. {
  66. $this->type = $type;
  67. return $this;
  68. }
  69. public function getUserMerchant(): ?UserMerchantInterface
  70. {
  71. return $this->userMerchant;
  72. }
  73. public function setUserMerchant(?UserMerchantInterface $userMerchant): self
  74. {
  75. $this->userMerchant = $userMerchant;
  76. return $this;
  77. }
  78. public function getOrderPayment(): ?OrderPaymentInterface
  79. {
  80. return $this->orderPayment;
  81. }
  82. public function setOrderPayment(?OrderPaymentInterface $orderPayment): self
  83. {
  84. $this->orderPayment = $orderPayment;
  85. return $this;
  86. }
  87. public function getOrderRefund(): ?OrderRefundInterface
  88. {
  89. return $this->orderRefund;
  90. }
  91. public function setOrderRefund(?OrderRefundInterface $orderRefund): self
  92. {
  93. $this->orderRefund = $orderRefund;
  94. return $this;
  95. }
  96. }