lib/WitsPaymentBundle/src/Entity/Payment.php line 13

Open in your IDE?
  1. <?php
  2. namespace Wits\PaymentBundle\Entity;
  3. use App\Entity\Order;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Wits\PaymentBundle\Entity\Enum\PaymentStateEnum;
  6. /**
  7.  * @ORM\Table
  8.  * @ORM\Entity(repositoryClass="Wits\PaymentBundle\Repository\PaymentRepository")
  9.  */
  10. class Payment
  11. {
  12.     const STATE_PENDING 'pending';
  13.     const STATE_CONFIRMED 'confirmed';
  14.     const STATE_CANCELED 'canceled';
  15.     /**
  16.      * @ORM\Column(name="id", type="integer")
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="IDENTITY")
  19.      *
  20.      * @var integer $id
  21.      */
  22.     protected int $id;
  23.     /**
  24.      * @ORM\Column(name="stripe_pi", type="string", length=255)
  25.      */
  26.     private string $paymentIntent;
  27.     /**
  28.      * @ORM\Column(name="stripe_session", type="string", length=100, unique=true, nullable=true)
  29.      */
  30.     private ?string $sessionId;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private string $state self::STATE_PENDING;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      */
  38.     private ?string $clientEmail=null;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private ?string $clientId=null;
  43.     /**
  44.      * @ORM\Column(precision=10, scale=2)
  45.      */
  46.     private float $totalAmount;
  47.     /**
  48.      * @ORM\Column(type="text", nullable=true)
  49.      */
  50.     private ?string $informations=null;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=Order::class, inversedBy="payments")
  53.      */
  54.     private ?Order $order;
  55.     /**
  56.      * @return int
  57.      */
  58.     public function getId(): int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getLabel(): string
  63.     {
  64.         return '#'.$this->id;
  65.     }
  66.     /**
  67.      * @param int $id
  68.      */
  69.     public function setId(int $id): void
  70.     {
  71.         $this->id $id;
  72.     }
  73.     public function getClientEmail(): ?string
  74.     {
  75.         return $this->clientEmail;
  76.     }
  77.     /**
  78.      * @param mixed $clientEmail
  79.      */
  80.     public function setClientEmail($clientEmail): void
  81.     {
  82.         $this->clientEmail $clientEmail;
  83.     }
  84.     public function getTotalAmount(): float
  85.     {
  86.         return $this->totalAmount;
  87.     }
  88.     public function setTotalAmount($totalAmount): void
  89.     {
  90.         $this->totalAmount $totalAmount;
  91.     }
  92.     public function getState(): string
  93.     {
  94.         return $this->state;
  95.     }
  96.     public function getStateLabel(): string
  97.     {
  98.         return PaymentStateEnum::getStateName($this->state);
  99.     }
  100.     public function isConfirmed(): bool
  101.     {
  102.         return $this->state === self::STATE_CONFIRMED;
  103.     }
  104.     public function isPending(): bool
  105.     {
  106.         return $this->state === self::STATE_PENDING;
  107.     }
  108.     public function setState($state): void
  109.     {
  110.         $this->state $state;
  111.     }
  112.     public function getPaymentIntent(): string
  113.     {
  114.         return $this->paymentIntent;
  115.     }
  116.     public function setPaymentIntent($paymentIntent): void
  117.     {
  118.         $this->paymentIntent $paymentIntent;
  119.     }
  120.     public function getSessionId(): ?string
  121.     {
  122.         return $this->sessionId;
  123.     }
  124.     public function setSessionId($sessionId): void
  125.     {
  126.         $this->sessionId $sessionId;
  127.     }
  128.     public function getClientId(): string
  129.     {
  130.         return $this->clientId;
  131.     }
  132.     public function setClientId($clientId): void
  133.     {
  134.         $this->clientId $clientId;
  135.     }
  136.     public function getInformations(): ?string
  137.     {
  138.         return $this->informations;
  139.     }
  140.     public function setInformations(string $informations): void
  141.     {
  142.         $this->informations $informations;
  143.     }
  144.     public function getOrder(): ?Order
  145.     {
  146.         return $this->order;
  147.     }
  148.     public function setOrder(?Order $order): void
  149.     {
  150.         $this->order $order;
  151.     }
  152. }