src/Entity/Transaccion.php line 23

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\User;
  4. use App\Entity\TransaccionAfiliado;
  5. use App\Entity\UserStats;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use JMS\Serializer\Annotation as JMS;
  9. use App\Entity\Cupon;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. /**
  12.  * Transaccion
  13.  *
  14.  * @ORM\Table()
  15.  * @ORM\Entity(repositoryClass="App\Repository\TransaccionRepository")
  16.  * @ORM\HasLifecycleCallbacks()
  17.  */
  18. class Transaccion
  19. {
  20.     
  21.     const EN_PASSARELA_DE_PAGO  "En pasarela de pago";
  22.     const PAGADO                "Pagado";
  23.     const PENDIENTE_DE_PAGO     "Pendiente de pago";
  24.     const COBRADO               "Cobrado";
  25.     const CANCELADO             "Cancelado";
  26.     const ERROR_EN_PASARELA     "ERROR EN PASARELA";
  27.     const DEVUELTO              "Devuelto";
  28.     
  29.     const PENDIENTE     "PENDIENTE";
  30.     const EN_PROCESO    "EN PROCESO";
  31.     const ENVIADO       "ENVIADO";
  32.     const DISPONIBLE    "DISPONIBLE";
  33.     const ENTREGADO     "ENTREGADO";
  34.     
  35.     /**
  36.      * @var integer
  37.      *
  38.      * @ORM\Column(name="id", type="integer")
  39.      * @ORM\Id
  40.      * @ORM\GeneratedValue(strategy="AUTO")
  41.      * @JMS\Groups({"api-order"})
  42.      */
  43.     private $id;
  44.     /**
  45.     * @ORM\ManyToOne(targetEntity="Oficina", cascade={"merge"})
  46.     * @ORM\JoinColumn(name="oficina", referencedColumnName="id", nullable=true)
  47.     * @JMS\Groups({"api-order"})
  48.     */
  49.     private $oficina;
  50.     /**
  51.     * @ORM\ManyToOne(targetEntity="User", inversedBy="transacciones")
  52.     * @ORM\JoinColumn(name="usuario", referencedColumnName="id", nullable=true)
  53.     * @JMS\Groups({"api-order"})
  54.     */
  55.     private $usuario;
  56.     /**
  57.     * @ORM\ManyToOne(targetEntity="User", inversedBy="transaccionesAfiliadas")
  58.     * @ORM\JoinColumn(name="usuarioAfiliado", referencedColumnName="id", nullable=true)
  59.     * @JMS\Groups({"api-order"})
  60.     */
  61.     private $usuarioAfiliado;
  62.     /**
  63.      * @var string
  64.      *
  65.      * @ORM\Column(name="cupon", type="string", length=255, nullable=false)
  66.      */
  67.     private $cupon;
  68.     
  69.     /**
  70.      * @var string
  71.      *
  72.      * @ORM\Column(name="tipoPromo", type="integer", options={"default":0})
  73.      */
  74.     private $tipoPromo;
  75.     /**
  76.      * @var string
  77.      *
  78.      * @ORM\Column(name="anotacion", type="text", nullable=true)
  79.      */
  80.     private $anotacion;
  81.     /**
  82.      * @var string
  83.      *
  84.      * @ORM\Column(name="estado", type="string", length=255)
  85.      * @JMS\Groups({"api-order"})
  86.      */
  87.     private $estado;
  88.     /**
  89.      * @var \DateTime
  90.      *
  91.      * @ORM\Column(name="horaRecogida", type="time", nullable=true)
  92.      * @JMS\Groups({"api-order"})
  93.      */
  94.     private $horaRecogida;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity="TransaccionLinea", mappedBy="transaccion", cascade={"persist", "remove"}, orphanRemoval=true)
  97.      */
  98.     private $lineas;
  99.     /**
  100.      * @var \DateTime
  101.      *
  102.      * @ORM\Column(name="fechaRecogida", type="date", nullable=true)
  103.      * @JMS\Groups({"api-order"})
  104.      */
  105.     private $fechaRecogida;
  106.     /**
  107.      * Sumatorio de los gastos de todas las divisisas SIN gastos de envio
  108.      * @var integer
  109.      *
  110.      * @ORM\Column(name="totalLineas", type="float")
  111.      */
  112.     private $totalLineas=0;
  113.     /**
  114.      * Sumatorio de los gastos de todas las divisisas CON gastos de envio
  115.      * @var integer
  116.      *
  117.      * @ORM\Column(name="total", type="float")
  118.      */
  119.     private $total=0;
  120.   //  private $afiliadoRelacionado="";
  121.     /**
  122.      * @var integer
  123.      *
  124.      * @ORM\Column(name="gastosEnvio", type="float", nullable=true)
  125.      * @JMS\Groups({"api-order"})
  126.      */
  127.     private $gastosEnvio=0;
  128.     /**
  129.      * @var string
  130.      *
  131.      * @ORM\Column(name="TipoPago", type="string", length=255)
  132.      * @JMS\Groups({"api-order"})
  133.      */
  134.     private $tipoPago;
  135.     /**
  136.      * @var string
  137.      *
  138.      * @ORM\Column(name="direccionCompleta", type="string", length=255, nullable=true)
  139.      * @JMS\Groups({"api-order"})
  140.      */
  141.     private $direccionCompleta;
  142.     /**
  143.      * @var string
  144.      *
  145.      * @ORM\Column(name="codigoPostal", type="string", length=255, nullable=true)
  146.      * @JMS\Groups({"api-order"})
  147.      */
  148.     private $codigoPostal;
  149.     /**
  150.      * @var string
  151.      *
  152.      * @ORM\Column(name="ciudad", type="string", length=255, nullable=true)
  153.      * @JMS\Groups({"api-order"})
  154.      */
  155.     private $ciudad;
  156.     /**
  157.     * @ORM\ManyToOne(targetEntity="Provincia")
  158.     * @ORM\JoinColumn(name="provincia", referencedColumnName="id", nullable=true)
  159.     */
  160.     private $provincia;
  161.     /**
  162.      * @var string
  163.      *
  164.      * @ORM\Column(name="transaccionFecha", type="datetime", nullable=true)
  165.      * @JMS\Groups({"api-order"})
  166.      */
  167.     private $transaccionFecha;
  168.     /**
  169.      * @var string
  170.      *
  171.      * @ORM\Column(name="pais", type="string", length=255, nullable=true)
  172.      * @JMS\Groups({"api-order"})
  173.      */
  174.     private $pais;
  175.     /**
  176.      * @var string
  177.      *
  178.      * @ORM\Column(name="devoluciones", type="string", length=255, nullable=true)
  179.      * @JMS\Groups({"api-order"})
  180.      */
  181.     private $devoluciones;
  182.     /**
  183.      * @var string
  184.      *
  185.      * @ORM\Column(name="tiempoEnvio", type="datetime",nullable=true)
  186.      * @JMS\Groups({"api-order"})
  187.      */
  188.     private $tiempoEnvio;
  189.     /**
  190.      * @var string
  191.      *
  192.      * @ORM\Column(name="estado_envio", type="string", length=255, nullable=true)
  193.      * @JMS\Groups({"api-order"})
  194.      */
  195.     private $estadoEnvio='PENDIENTE';
  196.     /**
  197.      * @ORM\ManyToOne(targetEntity="Nacex", cascade={"persist", "remove"})
  198.      * @ORM\JoinColumn(name="nacex", referencedColumnName="id", nullable=true)
  199.      */
  200.     private $nacex;
  201.     /**
  202.      * @ORM\Column(name="dni_envio", type="string", length=255, nullable=true)
  203.      * @JMS\Groups({"api-order"})
  204.      */
  205.     protected $cardSend;
  206.     /**
  207.      * @ORM\Column(name="nombre_envio", type="string", length=255, nullable=true)
  208.      * @JMS\Groups({"api-order"})
  209.      */
  210.     protected $nameSend;
  211.     /**
  212.      * @ORM\Column(name="titular", type="string", length=255, nullable=true)
  213.      * @JMS\Groups({"api-order"})
  214.      */
  215.     protected $titular;
  216.     /**
  217.      * @var UserStats[]
  218.      * @ORM\ManyToMany(targetEntity="UserStats", mappedBy="orderConversions")
  219.      *
  220.      */
  221.     protected $userStats;
  222.     
  223.     /**
  224.      * @var \DateTime
  225.      *
  226.      * @ORM\Column(name="fecha_pagado", type="datetime", nullable=true)
  227.      */
  228.     private $fechaPagado;
  229.     /**
  230.      * @var string
  231.      *
  232.      * @ORM\Column(name="token_email", type="string", length=255, nullable=true)
  233.      */
  234.     private $tokenEmail;
  235.     /**
  236.      * @var string
  237.      *
  238.      * @ORM\Column(name="email_titular", type="string", length=255, nullable=true)
  239.      */
  240.     private $emailTitular;
  241.     /**
  242.     * @ORM\OneToOne(targetEntity="App\Entity\EmailTransaccionAbandonada", mappedBy="transaccion")
  243.     */
  244.     private $emailTransaccionAbandonada;
  245.     /**
  246.      * @var string
  247.      *
  248.      * @ORM\Column(name="idioma", type="string", length=45, nullable=true)
  249.      */
  250.     private $idioma;
  251.     /**
  252.      * @var ArrayCollection
  253.      *
  254.      * @ORM\OneToMany(targetEntity="HistorialDevolucion", mappedBy="transaccion")
  255.      */
  256.     protected $historialDevoluciones;
  257.     /**
  258.      * @var float
  259.      *
  260.      * @ORM\Column(name="devuelto", type="float")
  261.      */
  262.     private $devuelto=0;
  263.     /**
  264.      * @var string
  265.      *
  266.      * @ORM\Column(name="telefono", type="string", length=20, nullable=true)
  267.      */
  268.     private $telefono;
  269.     public function __construct() {
  270.         $this->transaccionFecha = new \DateTime();
  271.         $this->lineas = new ArrayCollection();
  272.         $this->userStats = new ArrayCollection();
  273.         $this->historialDevoluciones = new ArrayCollection();
  274.     }
  275.     
  276.     public function __toString() {
  277.         return $this->getId();
  278.     }
  279.     /**
  280.      * Get id
  281.      *
  282.      * @return integer
  283.      */
  284.     public function getId()
  285.     {
  286.         return $this->id;
  287.     }
  288.     /**
  289.      * Set oficina
  290.      *
  291.      * @param string $oficina
  292.      * @return Transaccion
  293.      */
  294.     public function setOficina($oficina)
  295.     {
  296.         $this->oficina $oficina;
  297.         return $this;
  298.     }
  299.     /**
  300.      * Get oficina
  301.      *
  302.      * @return Oficina
  303.      */
  304.     public function getOficina()
  305.     {
  306.         return $this->oficina;
  307.     }
  308.     /**
  309.      * Set cupon
  310.      *
  311.      * @param string $cupon
  312.      * @return Transaccion
  313.      */
  314.     public function setCupon($cupon)
  315.     {
  316.         $this->cupon $cupon;
  317.         return $this;
  318.     }
  319.     /**
  320.      * Get cupon
  321.      *
  322.      * @return Cupon
  323.      */
  324.     public function getCupon()
  325.     {
  326.         return $this->cupon;
  327.     }
  328.     /**
  329.      * Set usuario
  330.      *
  331.      * @param string $usuario
  332.      * @return Transaccion
  333.      */
  334.     public function setUsuario($usuario)
  335.     {
  336.         $this->usuario $usuario;
  337.         return $this;
  338.     }
  339.     /**
  340.      * Get usuario
  341.      *
  342.      * @return User
  343.      */
  344.     public function getUsuario()
  345.     {
  346.         return $this->usuario;
  347.     }
  348.     /**
  349.      * Set usuarioAfiliado
  350.      *
  351.      * @param string $usuarioAfiliado
  352.      * @return Transaccion
  353.      */
  354.     public function setUsuarioAfiliado($usuarioAfiliado)
  355.     {
  356.         $this->usuarioAfiliado $usuarioAfiliado;
  357.         return $this;
  358.     }
  359.     /**
  360.      * Get usuarioAfiliado
  361.      *
  362.      * @return User
  363.      */
  364.     public function getUsuarioAfiliado()
  365.     {
  366.         return $this->usuarioAfiliado;
  367.     }
  368.     /**
  369.      * Set anotacion
  370.      *
  371.      * @param string $anotacion
  372.      * @return Transaccion
  373.      */
  374.     public function setAnotacion($anotacion)
  375.     {
  376.         $this->anotacion $anotacion;
  377.         return $this;
  378.     }
  379.     /**
  380.      * Get anotacion
  381.      *
  382.      * @return string
  383.      */
  384.     public function getAnotacion()
  385.     {
  386.         return $this->anotacion;
  387.     }
  388.     /**
  389.      * Set estado
  390.      *
  391.      * @param string $estado
  392.      * @return Transaccion
  393.      */
  394.     public function setEstado($estado)
  395.     {
  396.         $this->estado $estado;
  397.         return $this;
  398.     }
  399.     /**
  400.      * Get estado
  401.      *
  402.      * @return string
  403.      */
  404.     public function getEstado()
  405.     {
  406.         return $this->estado;
  407.     }
  408.     /**
  409.      * Set horaRecogida
  410.      *
  411.      * @param string $horaRecogida
  412.      * @return Transaccion
  413.      */
  414.     public function setHoraRecogida($horaRecogida)
  415.     {
  416.         $this->horaRecogida $horaRecogida;
  417.         return $this;
  418.     }
  419.     /**
  420.      * Set lineas
  421.      *
  422.      * @param Linea $lineas
  423.      * @return Reserva
  424.      */
  425.     public function addLinea($linea)
  426.     {
  427.         $this->lineas[] = $linea;
  428.         $linea->setTransaccion($this);
  429.         return $this;
  430.     }
  431.     /**
  432.      * Get horaRecogida
  433.      *
  434.      * @return \DateTime
  435.      */
  436.     public function getHoraRecogida()
  437.     {
  438.         return $this->horaRecogida;
  439.     }
  440.     /**
  441.      * Set lineas
  442.      *
  443.      * @param string $lineas
  444.      * @return Transaccion
  445.      */
  446.     public function setLineas($lineas)
  447.     {
  448.         $this->lineas $lineas;
  449.         return $this;
  450.     }
  451.     /**
  452.      * Get lineas
  453.      *
  454.      * @return ArrayCollection
  455.      */
  456.     public function getLineas()
  457.     {
  458.         return $this->lineas;
  459.     }
  460.     /**
  461.      * Set fechaRecogida
  462.      *
  463.      * @param string $fechaRecogida
  464.      * @return Transaccion
  465.      */
  466.     public function setFechaRecogida($fechaRecogida)
  467.     {
  468.         $this->fechaRecogida $fechaRecogida;
  469.         return $this;
  470.     }
  471.     /**
  472.      * Get fechaRecogida
  473.      *
  474.      * @return \DateTime
  475.      */
  476.     public function getFechaRecogida()
  477.     {
  478.         return $this->fechaRecogida;
  479.     }
  480.     /**
  481.      * Get fechaTransaccion
  482.      *
  483.      * @return \DateTime
  484.      */
  485.     public function getFechaTransaccion()
  486.     {
  487.         return $this->fechaTransaccion;
  488.     }
  489.     /**
  490.      * Set tipoPago
  491.      *
  492.      * @param string $tipoPago
  493.      * @return Transaccion
  494.      */
  495.     public function setTipoPago($tipoPago)
  496.     {
  497.         $this->tipoPago $tipoPago;
  498.         return $this;
  499.     }
  500.     /**
  501.      * Get tipoPago
  502.      *
  503.      * @return string
  504.      */
  505.     public function getTipoPago()
  506.     {
  507.         return $this->tipoPago;
  508.     }
  509.     /**
  510.      * Set direccionCompleta
  511.      *
  512.      * @param string $direccionCompleta
  513.      * @return Transaccion
  514.      */
  515.     public function setDireccionCompleta($direccionCompleta)
  516.     {
  517.         $this->direccionCompleta $direccionCompleta;
  518.         return $this;
  519.     }
  520.     /**
  521.      * Get direccionCompleta
  522.      *
  523.      * @return string
  524.      */
  525.     public function getDireccionCompleta()
  526.     {
  527.         return $this->direccionCompleta;
  528.     }
  529.     /**
  530.      * Set codigoPostal
  531.      *
  532.      * @param string $codigoPostal
  533.      * @return Transaccion
  534.      */
  535.     public function setCodigoPostal($codigoPostal)
  536.     {
  537.         $this->codigoPostal $codigoPostal;
  538.         return $this;
  539.     }
  540.     /**
  541.      * Get codigoPostal
  542.      *
  543.      * @return string
  544.      */
  545.     public function getCodigoPostal()
  546.     {
  547.         return $this->codigoPostal;
  548.     }
  549.     /**
  550.      * Set ciudad
  551.      *
  552.      * @param string $ciudad
  553.      * @return Transaccion
  554.      */
  555.     public function setCiudad($ciudad)
  556.     {
  557.         $this->ciudad $ciudad;
  558.         return $this;
  559.     }
  560.     /**
  561.      * Get ciudad
  562.      *
  563.      * @return string
  564.      */
  565.     public function getCiudad()
  566.     {
  567.         return $this->ciudad;
  568.     }
  569.     /**
  570.      * Set provincia
  571.      *
  572.      * @param string $provincia
  573.      * @return Transaccion
  574.      */
  575.     public function setProvincia($provincia)
  576.     {
  577.         $this->provincia $provincia;
  578.         return $this;
  579.     }
  580.     /**
  581.      * Get provincia
  582.      *
  583.      * @return string
  584.      */
  585.     public function getProvincia()
  586.     {
  587.         return $this->provincia;
  588.     }
  589.     /**
  590.      * Set pais
  591.      *
  592.      * @param string $pais
  593.      * @return Transaccion
  594.      */
  595.     public function setPais($pais)
  596.     {
  597.         $this->pais $pais;
  598.         return $this;
  599.     }
  600.     /**
  601.      * Get pais
  602.      *
  603.      * @return string
  604.      */
  605.     public function getPais()
  606.     {
  607.         return $this->pais;
  608.     }
  609.     /**
  610.      * Set devoluciones
  611.      *
  612.      * @param string $devoluciones
  613.      * @return Transaccion
  614.      */
  615.     public function setDevoluciones($devoluciones)
  616.     {
  617.         $this->devoluciones $devoluciones;
  618.         return $this;
  619.     }
  620.     /**
  621.      * Get devoluciones
  622.      *
  623.      * @return string
  624.      */
  625.     public function getDevoluciones()
  626.     {
  627.         return $this->devoluciones;
  628.     }
  629.     /**
  630.      * Set transaccionFecha
  631.      *
  632.      * @param string $transaccionFecha
  633.      * @return Transaccion
  634.      */
  635.     public function setTransaccionFecha($transaccionFecha)
  636.     {
  637.         $this->transaccionFecha $transaccionFecha;
  638.         return $this;
  639.     }
  640.     /**
  641.      * Get transaccionFecha
  642.      *
  643.      * @return \DateTime
  644.      */
  645.     public function getTransaccionFecha()
  646.     {
  647.         return $this->transaccionFecha;
  648.     }
  649.     /**
  650.      * Set totalLineas
  651.      *
  652.      * @param string $totalLineas
  653.      * @return Transaccion
  654.      */
  655.     public function setTotalLineas($totalLineas)
  656.     {
  657.         $this->totalLineas $totalLineas;
  658.         return $this;
  659.     }
  660.     /**
  661.      * Get horaRecogida
  662.      *
  663.      * @return string
  664.      */
  665.     public function getTotalLineas()
  666.     {
  667.         return $this->totalLineas;
  668.     }
  669.     /**
  670.      * Set estadoEnvio
  671.      *
  672.      * @param string $estadoEnvio
  673.      * @return Transaccion
  674.      */
  675.     public function setEstadoEnvio($estadoEnvio)
  676.     {
  677.         $this->estadoEnvio $estadoEnvio;
  678.         return $this;
  679.     }
  680.     /**
  681.      * Get estadoEnvio
  682.      *
  683.      * @return string
  684.      */
  685.     public function getEstadoEnvio()
  686.     {
  687.         return $this->estadoEnvio;
  688.     }
  689.     /**
  690.      * Set gastosEnvio
  691.      *
  692.      * @param string gastosEnvio
  693.      * @return Transaccion
  694.      */
  695.     public function setGastosEnvio($gastosEnvio)
  696.     {
  697.         $this->gastosEnvio $gastosEnvio;
  698.         return $this;
  699.     }
  700.     /**
  701.      * Get gastosEnvio
  702.      *
  703.      * @return string
  704.      */
  705.     public function getGastosEnvio()
  706.     {
  707.         return $this->gastosEnvio;
  708.     }
  709.     /**
  710.      * Set total
  711.      *
  712.      * @param float $total
  713.      * @return Transaccion
  714.      */
  715.     public function setTotal($total)
  716.     {
  717.         $this->total $total;
  718.         return $this;
  719.     }
  720.     /**
  721.      * Get total
  722.      *
  723.      * @return string
  724.      */
  725.     public function getTotal()
  726.     {
  727.         return $this->total;
  728.     }
  729.     /**
  730.      * @ORM\PrePersist
  731.      * @ORM\PreUpdate
  732.      */
  733.     public function prePersist(){
  734.     
  735.         if ($this->provincia and $this->totalLineas 500){
  736.             $this->gastosEnvio=$this->provincia->getGastos();
  737.         }
  738.     
  739.         $this->total=$this->totalLineas+$this->gastosEnvio;
  740.     }
  741.     /**
  742.      * @return \DateTime
  743.      */
  744.     public function getTiempoEnvio()
  745.     {
  746.         return $this->tiempoEnvio;
  747.     }
  748.     /**
  749.      * @param string $tiempoEnvio
  750.      */
  751.     public function setTiempoEnvio($tiempoEnvio)
  752.     {
  753.         $this->tiempoEnvio $tiempoEnvio;
  754.     }
  755.     /**
  756.      * @return Nacex
  757.      */
  758.     public function getNacex()
  759.     {
  760.         return $this->nacex;
  761.     }
  762.     /**
  763.      * @param mixed $nacex
  764.      */
  765.     public function setNacex($nacex)
  766.     {
  767.         $this->nacex $nacex;
  768.     }
  769.     /**
  770.      * @return mixed
  771.      */
  772.     public function getCardSend()
  773.     {
  774.         return $this->cardSend;
  775.     }
  776.     /**
  777.      * @param mixed $cardSend
  778.      */
  779.     public function setCardSend($cardSend)
  780.     {
  781.         $this->cardSend $cardSend;
  782.     }
  783.     /**
  784.      * @return mixed
  785.      */
  786.     public function getNameSend()
  787.     {
  788.         return $this->nameSend;
  789.     }
  790.     /**
  791.      * @param mixed $nameSend
  792.      */
  793.     public function setNameSend($nameSend)
  794.     {
  795.         $this->nameSend $nameSend;
  796.     }
  797.     /**
  798.      * @return mixed
  799.      */
  800.     public function getTitular()
  801.     {
  802.         return $this->titular;
  803.     }
  804.     /**
  805.      * @param mixed $titular
  806.      */
  807.     public function setTitular($titular)
  808.     {
  809.         $this->titular $titular;
  810.     }
  811.     /**
  812.      * @return UserStats[]
  813.      */
  814.     public function getUserStats()
  815.     {
  816.         return $this->userStats;
  817.     }
  818.     
  819.     /**
  820.      * Set fechaPagado
  821.      *
  822.      * @param string $fechaPagado
  823.      * @return DateTime
  824.      */
  825.     public function setFechaPagado($fechaPagado)
  826.     {
  827.         $this->fechaPagado $fechaPagado;
  828.         return $this;
  829.     }
  830.     /**
  831.      * Get fechaPagado
  832.      *
  833.      * @return \DateTime
  834.      */
  835.     public function getFechaPagado()
  836.     {
  837.         return $this->fechaPagado;
  838.     }
  839.     
  840.     public static function getEstadosPago()
  841.     {
  842.         return array(
  843.             self::EN_PASSARELA_DE_PAGO   => "En pasarela de pago",
  844.             self::PAGADO                 => "Pagado",
  845.             self::PENDIENTE_DE_PAGO      => "Pendiente de pago",
  846.             self::COBRADO                => "Cobrado",
  847.             self::CANCELADO              => "Cancelado",
  848.             self::DEVUELTO               => "Devuelto",
  849.         );
  850.     }
  851.     
  852.     public static function getEstadosEnvio()
  853.     {
  854.         return array(
  855.             self::PENDIENTE     => "PENDIENTE",
  856.             self::EN_PROCESO    => "EN PROCESO",
  857.             self::ENVIADO       => "ENVIADO",
  858.             self::DISPONIBLE    => "DISPONIBLE",
  859.             self::ENTREGADO     => "ENTREGADO",
  860.         );
  861.     }
  862.     public function isPagado() {
  863.         return ($this->getEstado() == self::COBRADO);
  864.     }
  865.     public function puedeDevolver() {
  866.         return ($this->getEstado() == self::DEVUELTO and $this->getTotal() > $this->getDevuelto());
  867.     }
  868.     
  869.     
  870.     /**
  871.      * @return integer
  872.      */
  873.     public function getTipoPromo()
  874.     {
  875.         return $this->tipoPromo;
  876.     }
  877.     /**
  878.      * @param integer $tipoPromo
  879.      */
  880.     public function setTipoPromo($tipoPromo)
  881.     {
  882.         $this->tipoPromo $tipoPromo;
  883.     }
  884.     public function setTokenEmail($tokenEmail)
  885.     {
  886.         $this->tokenEmail $tokenEmail;
  887.         return $this;
  888.     }
  889.     public function getTokenEmail()
  890.     {
  891.         return $this->tokenEmail;
  892.     }
  893.     public function setEmailTitular($emailTitular)
  894.     {
  895.         $this->emailTitular $emailTitular;
  896.         return $this;
  897.     }
  898.     public function getEmailTitular()
  899.     {
  900.         return $this->emailTitular;
  901.     }
  902.     public function getEmailTransaccionAbandonada()
  903.     {
  904.         return $this->emailTransaccionAbandonada;
  905.     }
  906.     public function setEmailTransaccionAbandonada($emailTransaccionAbandonada)
  907.     {
  908.         $this->emailTransaccionAbandonada $emailTransaccionAbandonada;
  909.         return $this;
  910.     }
  911.     public function setIdioma($idioma)
  912.     {
  913.         $this->idioma $idioma;
  914.         return $this;
  915.     }
  916.     public function getIdioma()
  917.     {
  918.         return $this->idioma;
  919.     }
  920.     public function getHistorialDevoluciones()
  921.     {
  922.         return $this->historialDevoluciones;
  923.     }
  924.     public function addHistorialDevolucion($historialDevolucion)
  925.     {
  926.         if (!$this->historialDevoluciones->contains($historialDevolucion)) {
  927.             $this->historialDevoluciones->add($historialDevolucion);
  928.             $historialDevolucion->setTransaccion($this);
  929.         }
  930.         return $this;
  931.     }
  932.     public function removeHistorialDevolucion($historialDevolucion)
  933.     {
  934.         if ($this->historialDevoluciones->removeElement($historialDevolucion)) {
  935.             // set the owning side to null (unless already changed)
  936.             if ($historialDevolucion->getTransaccion() === $this) {
  937.                 $historialDevolucion->setTransaccion(null);
  938.             }
  939.         }
  940.         return $this;
  941.     }
  942.     public function getDevuelto()
  943.     {
  944.         return $this->devuelto;
  945.     }
  946.     public function setDevuelto(float $devuelto)
  947.     {
  948.         $this->devuelto $devuelto;
  949.         return $this;
  950.     }
  951.     public function setTelefono($telefono)
  952.     {
  953.         $this->telefono $telefono;
  954.         return $this;
  955.     }
  956.     public function getTelefono()
  957.     {
  958.         return $this->telefono;
  959.     }
  960. }