src/Entity/Transaction.php line 17

Open in your IDE?
  1. <?php
  2. /**
  3.  * This class handles all payment transaction resulting from Payment system (Axepta).
  4.  */
  5. namespace App\Entity;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\TransactionRepository")
  10.  *
  11.  * @ORM\Table(name="payment_transaction")
  12.  */
  13. class Transaction
  14. {
  15.     /**
  16.      * @Gedmo\Timestampable(on="create")
  17.      *
  18.      * @ORM\Column(type="datetime", name="created_at", nullable=true)
  19.      */
  20.     protected $createdAt;
  21.     /**
  22.      * @var int
  23.      *
  24.      * @ORM\Id
  25.      *
  26.      * @ORM\Column(type="integer")
  27.      *
  28.      * @ORM\GeneratedValue(strategy="AUTO")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @var bool
  33.      *
  34.      * @ORM\Column(type="boolean", nullable=true)
  35.      */
  36.     private $isValid;
  37.     /**
  38.      * @var string
  39.      *
  40.      * @ORM\Column(type="string", nullable=true)
  41.      */
  42.     private $responseCode;
  43.     /**
  44.      * @var string
  45.      *
  46.      * @ORM\Column(type="text", nullable=true)
  47.      */
  48.     private $message;
  49.     /**
  50.      * @var string
  51.      *
  52.      * @ORM\Column(type="string", nullable=true)
  53.      */
  54.     private $merchant_id;
  55.     /**
  56.      * @var string
  57.      *
  58.      * @ORM\Column(type="string", nullable=true)
  59.      */
  60.     private $amount;
  61.     /**
  62.      * @var string
  63.      *
  64.      * @ORM\Column(type="string", nullable=true)
  65.      */
  66.     private $transaction_id;
  67.     /**
  68.      * @var User
  69.      *
  70.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="transactions", cascade={"persist"})
  71.      *
  72.      * @ORM\JoinColumn(nullable=false)
  73.      */
  74.     private $user;
  75.     /**
  76.      * @var Sale
  77.      *
  78.      * @ORM\ManyToOne(targetEntity="App\Entity\Sale", inversedBy="transactions", cascade={"persist"})
  79.      *
  80.      * @ORM\JoinColumn(name="sale_saleid", referencedColumnName="id", nullable=false)
  81.      */
  82.     private $sale;
  83.     /**
  84.      * @var string
  85.      *
  86.      * @ORM\Column(type="string", nullable=true)
  87.      */
  88.     private $customer_email;
  89.     /**
  90.      * @var string|null
  91.      *
  92.      * @ORM\Column(type="string", nullable=true)
  93.      */
  94.     private $country;
  95.     public function getId(): int
  96.     {
  97.         return $this->id;
  98.     }
  99.     public function setResponseCode(?string $responseCode): void
  100.     {
  101.         $this->responseCode $responseCode;
  102.     }
  103.     public function getResponseCode(): ?string
  104.     {
  105.         return $this->responseCode;
  106.     }
  107.     public function setMessage(?string $message): void
  108.     {
  109.         $this->message $message;
  110.     }
  111.     public function getMessage(): ?string
  112.     {
  113.         return $this->message;
  114.     }
  115.     public function setMerchantId(?string $merchantId): void
  116.     {
  117.         $this->merchant_id $merchantId;
  118.     }
  119.     public function getMerchantId(): ?string
  120.     {
  121.         return $this->merchant_id;
  122.     }
  123.     public function setAmount(?string $amount): void
  124.     {
  125.         $this->amount $amount;
  126.     }
  127.     public function getAmount(): ?string
  128.     {
  129.         return $this->amount;
  130.     }
  131.     public function setUser(User $user): void
  132.     {
  133.         $this->user $user;
  134.         $this->customer_email $user->getEmail();
  135.     }
  136.     public function getUser(): User
  137.     {
  138.         return $this->user;
  139.     }
  140.     public function setSale(Sale $sale): void
  141.     {
  142.         $this->sale $sale;
  143.     }
  144.     public function getSale(): Sale
  145.     {
  146.         return $this->sale;
  147.     }
  148.     /**
  149.      * Get transaction successfulness.
  150.      */
  151.     public function isValid(): bool
  152.     {
  153.         return (bool) $this->isValid;
  154.     }
  155.     public function setIsValid(bool $isValid): void
  156.     {
  157.         $this->isValid $isValid;
  158.     }
  159.     public function getTransactionId(): ?string
  160.     {
  161.         return $this->transaction_id;
  162.     }
  163.     public function setTransactionId(string $transaction_id): void
  164.     {
  165.         $this->transaction_id $transaction_id;
  166.     }
  167.     public function setCreatedAt($createdAt): void
  168.     {
  169.         $this->createdAt $createdAt;
  170.     }
  171.     public function getCreatedAt()
  172.     {
  173.         return $this->createdAt;
  174.     }
  175.     public function setCountry(?string $country): void
  176.     {
  177.         $this->country $country;
  178.     }
  179.     public function getCountry(): ?string
  180.     {
  181.         return $this->country;
  182.     }
  183. }