src/Entity/CompanyPayment.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use SpecShaper\EncryptBundle\Annotations\Encrypted;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\Repository\CompanyPaymentRepository")
  7.  */
  8. class CompanyPayment
  9. {
  10.     /**
  11.      * @ORM\Id()
  12.      * @ORM\GeneratedValue()
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\Column(type="smallint")
  18.      */
  19.     private $type;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      * @Encrypted
  23.      */
  24.     private $fullname;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      * @Encrypted
  28.      */
  29.     private $creditCardNumber;
  30.     /**
  31.      * @ORM\Column(type="date", nullable=true)
  32.      */
  33.     private $creditCardExpiration;
  34.     /**
  35.      * @ORM\Column(type="string", length=5,  nullable=true)
  36.      */
  37.     private $creditCardCVV;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $contactName;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity="App\Entity\Company", inversedBy="payments")
  44.      * @ORM\JoinColumn(nullable=false)
  45.      */
  46.     private $company;
  47.     /**
  48.      * @ORM\Column(type="datetime")
  49.      */
  50.     private $date;
  51.     /**
  52.      * @ORM\Column(type="boolean")
  53.      */
  54.     private $invoice=false;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      */
  58.     private $stripeAccountId;
  59.     public $forceDisplayNumbers=false;
  60.     public function __construct(){
  61.         $this->date = new \DateTime();
  62.     }
  63.     public function getId(): ?int
  64.     {
  65.         return $this->id;
  66.     }
  67.     public function getType(): ?int
  68.     {
  69.         return $this->type;
  70.     }
  71.     public function setType(int $type): self
  72.     {
  73.         $this->type $type;
  74.         return $this;
  75.     }
  76.     public function getFullname(): ?string
  77.     {
  78.         return $this->fullname;
  79.     }
  80.     public function setFullname(?string $fullname): self
  81.     {
  82.         $this->fullname $fullname;
  83.         return $this;
  84.     }
  85.     public function getCreditCardNumberHidden(): ?string
  86.     {
  87.         if(!empty($this->creditCardNumber) && !$this->forceDisplayNumbers){
  88.             $lastDigits substr($this->creditCardNumber, -4);
  89.             return '0000 0000 0000 '.$lastDigits;
  90.         }
  91.         return $this->creditCardNumber;
  92.     }
  93.     public function setCreditCardNumberHidden($cc): self
  94.     {
  95.         if (strpos($cc'0000 0000') === false) {
  96.             $this->creditCardNumber $cc;
  97.         }
  98.         return $this;
  99.     }
  100.     public function getCreditCardNumber(): ?string
  101.     {
  102.         return $this->creditCardNumber;
  103.     }
  104.     public function setCreditCardNumber(?string $creditCardNumber): self
  105.     {
  106.         $this->creditCardNumber $creditCardNumber;
  107.         return $this;
  108.     }
  109.     public function getCreditCardExpirationMonth()
  110.     {
  111.         return $this->getCreditCardExpiration()->format('m');    
  112.     }
  113.     public function getCreditCardExpirationYear()
  114.     {
  115.         return $this->getCreditCardExpiration()->format('Y');    
  116.     }
  117.     public function getCreditCardExpiration(): ?\DateTimeInterface
  118.     {
  119.         return $this->creditCardExpiration;
  120.     }
  121.     public function setCreditCardExpiration(?\DateTimeInterface $creditCardExpiration): self
  122.     {
  123.         $this->creditCardExpiration $creditCardExpiration;
  124.         return $this;
  125.     }
  126.     public function getCreditCardCVV(): ?string
  127.     {
  128.         return $this->creditCardCVV;
  129.     }
  130.     public function setCreditCardCVV($creditCardCVV): self
  131.     {
  132.         $this->creditCardCVV str_pad($creditCardCVV3'0'STR_PAD_LEFT);
  133.         return $this;
  134.     }
  135.     public function getContactName(): ?string
  136.     {
  137.         return $this->contactName;
  138.     }
  139.     public function setContactName(?string $contactName): self
  140.     {
  141.         $this->contactName $contactName;
  142.         return $this;
  143.     }
  144.     public function getCompany(): ?Company
  145.     {
  146.         return $this->company;
  147.     }
  148.     public function setCompany(?Company $company): self
  149.     {
  150.         $this->company $company;
  151.         return $this;
  152.     }
  153.     public function getDate(): ?\DateTimeInterface
  154.     {
  155.         return $this->date;
  156.     }
  157.     public function setDate(\DateTimeInterface $date): self
  158.     {
  159.         $this->date $date;
  160.         return $this;
  161.     }
  162.     public function getInvoiced(): ?bool
  163.     {
  164.         return $this->invoiced;
  165.     }
  166.     public function setInvoiced(bool $invoiced): self
  167.     {
  168.         $this->invoiced $invoiced;
  169.         return $this;
  170.     }
  171.     public function getStripeAccountId(): ?string
  172.     {
  173.         return $this->stripeAccountId;
  174.     }
  175.     public function setStripeAccountId(string $stripeAccountId): self
  176.     {
  177.         $this->stripeAccountId $stripeAccountId;
  178.         return $this;
  179.     }
  180. }