src/Entity/BFPaymentIntentEdition.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\BFPaymentIntentEditionRepository")
  8.  */
  9. class BFPaymentIntentEdition
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\ManyToOne(targetEntity="App\Entity\BFUser", inversedBy="bFPaymentIntentEditions")
  19.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  20.      */
  21.     private $user;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $stripeid;
  26.     /**
  27.      * @ORM\Column(type="datetime")
  28.      */
  29.     private $creationdate;
  30.     /**
  31.      * @ORM\Column(type="datetime", nullable=true)
  32.      */
  33.     private $successdate;
  34.     /**
  35.      * @ORM\Column(type="datetime", nullable=true)
  36.      */
  37.     private $failedtime;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity="App\Entity\BFOrderEdition", mappedBy="bFPaymentIntentEdition", cascade={"persist"}, orphanRemoval=true)
  40.      */
  41.     private $ordereditions;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity="App\Entity\BFEdition", inversedBy="bFPaymentIntentEditions")
  44.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  45.      */
  46.     private $edition;
  47.     /**
  48.      * @ORM\Column(type="boolean")
  49.      */
  50.     private $reclamation;
  51.     /**
  52.      * @ORM\Column(type="datetime", nullable=true)
  53.      */
  54.     private $refunddate;
  55.     /**
  56.      * @ORM\Column(type="string", length=255)
  57.      */
  58.     private $email;
  59.     public function __construct()
  60.     {
  61.         $this->ordereditions = new ArrayCollection();
  62.         $this->creationdate= new \DateTime();
  63.         $this->reclamation=false;
  64.     }
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getUser(): ?BFUser
  70.     {
  71.         return $this->user;
  72.     }
  73.     public function setUser(?BFUser $user): self
  74.     {
  75.         $this->user $user;
  76.         
  77.         if($user!=null)
  78.             $this->setEmail($user->getEmail());
  79.         return $this;
  80.     }
  81.     public function getStripeid(): ?string
  82.     {
  83.         return $this->stripeid;
  84.     }
  85.     public function setStripeid(string $stripeid): self
  86.     {
  87.         $this->stripeid $stripeid;
  88.         return $this;
  89.     }
  90.     public function getCreationdate(): ?\DateTimeInterface
  91.     {
  92.         return $this->creationdate;
  93.     }
  94.     public function setCreationdate(\DateTimeInterface $creationdate): self
  95.     {
  96.         $this->creationdate $creationdate;
  97.         return $this;
  98.     }
  99.     public function getSuccessdate(): ?\DateTimeInterface
  100.     {
  101.         return $this->successdate;
  102.     }
  103.     public function setSuccessdate(?\DateTimeInterface $successdate): self
  104.     {
  105.         $this->successdate $successdate;
  106.         return $this;
  107.     }
  108.     public function getFailedtime(): ?\DateTimeInterface
  109.     {
  110.         return $this->failedtime;
  111.     }
  112.     public function setFailedtime(?\DateTimeInterface $failedtime): self
  113.     {
  114.         $this->failedtime $failedtime;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection|BFOrderEdition[]
  119.      */
  120.     public function getOrdereditions(): Collection
  121.     {
  122.         return $this->ordereditions;
  123.     }
  124.     public function addOrderedition(BFOrderEdition $orderedition): self
  125.     {
  126.         if (!$this->ordereditions->contains($orderedition)) {
  127.             $this->ordereditions[] = $orderedition;
  128.             $orderedition->setBFPaymentIntentEdition($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeOrderedition(BFOrderEdition $orderedition): self
  133.     {
  134.         if ($this->ordereditions->contains($orderedition)) {
  135.             $this->ordereditions->removeElement($orderedition);
  136.             // set the owning side to null (unless already changed)
  137.             if ($orderedition->getBFPaymentIntentEdition() === $this) {
  138.                 $orderedition->setBFPaymentIntentEdition(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     
  144.     public function getPrice(): ?int
  145.     {
  146.         $price 0;
  147.         $bfordereditions $this->getOrdereditions();
  148.         
  149.         foreach($bfordereditions as $bforderedition)
  150.         {
  151.             $price+= $bforderedition->getProductedition()->getPrice() * $bforderedition->getQuantity();
  152.         }
  153.         
  154.         return $price;
  155.     }
  156.     
  157.     public function getDisplayprice(): ?float
  158.     {
  159.         return $this->getPrice()/100;
  160.     }
  161.     
  162.     public function getBffees():?int
  163.     {
  164.         $bffees=0;
  165.         $bfordereditions $this->getOrdereditions();
  166.         
  167.         foreach($bfordereditions as $bforderedition)
  168.         {
  169.             $bffees+= $bforderedition->getQuantity() * $bforderedition->getFeebf();
  170.         }
  171.         
  172.         return $bffees;
  173.     }
  174.     
  175.     public function getDisplaybffees(): ?float 
  176.     {
  177.         return $this->getBffees()/100;
  178.     }
  179.     
  180.     public function getEdition(): ?BFEdition
  181.     {
  182.         return $this->edition;
  183.     }
  184.     
  185.     public function setEdition(?BFEdition $edition): self
  186.     {
  187.         $this->edition $edition;
  188.         return $this;
  189.     }
  190.     
  191.     public function getStatus(): ?string
  192.     {
  193.         if($this->getRefunddate()!=null)
  194.             return 'refund';
  195.         if($this->getReclamation()==true)
  196.             return 'reclamation';
  197.         if($this->getSuccessdate()!=null)
  198.             return 'success';
  199.         if($this->getFailedtime()!=null)
  200.             return 'failed';
  201.         
  202.         return 'inprogress';
  203.     }
  204.     public function getReclamation(): ?bool
  205.     {
  206.         return $this->reclamation;
  207.     }
  208.     public function setReclamation(bool $reclamation): self
  209.     {
  210.         $this->reclamation $reclamation;
  211.         return $this;
  212.     }
  213.     public function getRefunddate(): ?\DateTimeInterface
  214.     {
  215.         return $this->refunddate;
  216.     }
  217.     public function setRefunddate(?\DateTimeInterface $refunddate): self
  218.     {
  219.         $this->refunddate $refunddate;
  220.         return $this;
  221.     }
  222.     public function getEmail(): ?string
  223.     {
  224.         return $this->email;
  225.     }
  226.     public function setEmail(string $email): self
  227.     {
  228.         $this->email $email;
  229.         return $this;
  230.     }
  231. }