src/Services/PaymentBundle/Entity/PaymentAdditionalInfo.php line 14

Open in your IDE?
  1. <?php
  2. namespace Services\PaymentBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JsonSerializable;
  5. /**
  6.  * Entity to save additional transaction information returned by psp
  7.  *
  8.  * @ORM\Table(name="payment_additional_info")
  9.  * @ORM\Entity(repositoryClass="Services\PaymentBundle\Repository\PaymentAdditionalInfoRepository")
  10.  */
  11. class PaymentAdditionalInfo implements JsonSerializable
  12. {
  13.     /**
  14.      * @var int
  15.      *
  16.      * @ORM\Column(name="id", type="integer")
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue(strategy="AUTO")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @var string
  23.      *
  24.      * @ORM\Column(name="psp_name", type="string")
  25.      */
  26.     private $pspName;
  27.     /**
  28.      * @var string
  29.      *
  30.      * @ORM\Column(name="order_id", type="string")
  31.      */
  32.     private $orderId;
  33.     /**
  34.      * @var string
  35.      *
  36.      * @ORM\Column(name="data", type="text")
  37.      */
  38.     private $data;
  39.     /**
  40.      * @var \DateTime
  41.      *
  42.      * @ORM\Column(name="created_at", type="datetime")
  43.      */
  44.     private $createdAt;
  45.     public function __construct()
  46.     {
  47.         $this->createdAt = new \DateTime('now');
  48.     }
  49.     /**
  50.      * @return int
  51.      */
  52.     public function getId(): int
  53.     {
  54.         return $this->id;
  55.     }
  56.     /**
  57.      * @param int $id
  58.      */
  59.     public function setId(int $id): void
  60.     {
  61.         $this->id $id;
  62.     }
  63.     /**
  64.      * @return string
  65.      */
  66.     public function getPspName(): string
  67.     {
  68.         return $this->pspName;
  69.     }
  70.     /**
  71.      * @param string $pspName
  72.      */
  73.     public function setPspName(string $pspName): void
  74.     {
  75.         $this->pspName $pspName;
  76.     }
  77.     /**
  78.      * @return string
  79.      */
  80.     public function getOrderId(): string
  81.     {
  82.         return $this->orderId;
  83.     }
  84.     /**
  85.      * @param string $orderId
  86.      */
  87.     public function setOrderId(string $orderId): void
  88.     {
  89.         $this->orderId $orderId;
  90.     }
  91.     public function getData():? array
  92.     {
  93.         return json_decode($this->datatrue);
  94.     }
  95.     public function setData($data): void
  96.     {
  97.         $this->data json_encode($data);
  98.     }
  99.     /**
  100.      * @return \DateTime
  101.      */
  102.     public function getCreatedAt(): \DateTime
  103.     {
  104.         return $this->createdAt;
  105.     }
  106.     /**
  107.      * @param \DateTime $createdAt
  108.      */
  109.     public function setCreatedAt(\DateTime $createdAt): void
  110.     {
  111.         $this->createdAt $createdAt;
  112.     }
  113.     /**
  114.      * Specify data which should be serialized to JSON
  115.      * @return array
  116.      */
  117.     public function jsonSerialize()
  118.     {
  119.         return [
  120.             $this->pspName,
  121.             $this->orderId,
  122.             $this->data,
  123.             $this->createdAt
  124.         ];
  125.     }
  126. }