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.     
  270.     
  271.     /**
  272.      * @var string
  273.      *
  274.      * @ORM\Column(name="comentario_interno", type="text", nullable=true)
  275.      */
  276.     private $comentarioInterno;    
  277.     public function __construct() {
  278.         $this->transaccionFecha = new \DateTime();
  279.         $this->lineas = new ArrayCollection();
  280.         $this->userStats = new ArrayCollection();
  281.         $this->historialDevoluciones = new ArrayCollection();
  282.     }
  283.     
  284.     public function __toString() {
  285.         return $this->getId();
  286.     }
  287.     /**
  288.      * Get id
  289.      *
  290.      * @return integer
  291.      */
  292.     public function getId()
  293.     {
  294.         return $this->id;
  295.     }
  296.     /**
  297.      * Set oficina
  298.      *
  299.      * @param string $oficina
  300.      * @return Transaccion
  301.      */
  302.     public function setOficina($oficina)
  303.     {
  304.         $this->oficina $oficina;
  305.         return $this;
  306.     }
  307.     /**
  308.      * Get oficina
  309.      *
  310.      * @return Oficina
  311.      */
  312.     public function getOficina()
  313.     {
  314.         return $this->oficina;
  315.     }
  316.     /**
  317.      * Set cupon
  318.      *
  319.      * @param string $cupon
  320.      * @return Transaccion
  321.      */
  322.     public function setCupon($cupon)
  323.     {
  324.         $this->cupon $cupon;
  325.         return $this;
  326.     }
  327.     /**
  328.      * Get cupon
  329.      *
  330.      * @return Cupon
  331.      */
  332.     public function getCupon()
  333.     {
  334.         return $this->cupon;
  335.     }
  336.     /**
  337.      * Set usuario
  338.      *
  339.      * @param string $usuario
  340.      * @return Transaccion
  341.      */
  342.     public function setUsuario($usuario)
  343.     {
  344.         $this->usuario $usuario;
  345.         return $this;
  346.     }
  347.     /**
  348.      * Get usuario
  349.      *
  350.      * @return User
  351.      */
  352.     public function getUsuario()
  353.     {
  354.         return $this->usuario;
  355.     }
  356.     /**
  357.      * Set usuarioAfiliado
  358.      *
  359.      * @param string $usuarioAfiliado
  360.      * @return Transaccion
  361.      */
  362.     public function setUsuarioAfiliado($usuarioAfiliado)
  363.     {
  364.         $this->usuarioAfiliado $usuarioAfiliado;
  365.         return $this;
  366.     }
  367.     /**
  368.      * Get usuarioAfiliado
  369.      *
  370.      * @return User
  371.      */
  372.     public function getUsuarioAfiliado()
  373.     {
  374.         return $this->usuarioAfiliado;
  375.     }
  376.     /**
  377.      * Set anotacion
  378.      *
  379.      * @param string $anotacion
  380.      * @return Transaccion
  381.      */
  382.     public function setAnotacion($anotacion)
  383.     {
  384.         $this->anotacion $anotacion;
  385.         return $this;
  386.     }
  387.     /**
  388.      * Get anotacion
  389.      *
  390.      * @return string
  391.      */
  392.     public function getAnotacion()
  393.     {
  394.         return $this->anotacion;
  395.     }
  396.     /**
  397.      * Set estado
  398.      *
  399.      * @param string $estado
  400.      * @return Transaccion
  401.      */
  402.     public function setEstado($estado)
  403.     {
  404.         $this->estado $estado;
  405.         return $this;
  406.     }
  407.     /**
  408.      * Get estado
  409.      *
  410.      * @return string
  411.      */
  412.     public function getEstado()
  413.     {
  414.         return $this->estado;
  415.     }
  416.     /**
  417.      * Set horaRecogida
  418.      *
  419.      * @param string $horaRecogida
  420.      * @return Transaccion
  421.      */
  422.     public function setHoraRecogida($horaRecogida)
  423.     {
  424.         $this->horaRecogida $horaRecogida;
  425.         return $this;
  426.     }
  427.     /**
  428.      * Set lineas
  429.      *
  430.      * @param Linea $lineas
  431.      * @return Reserva
  432.      */
  433.     public function addLinea($linea)
  434.     {
  435.         $this->lineas[] = $linea;
  436.         $linea->setTransaccion($this);
  437.         return $this;
  438.     }
  439.     /**
  440.      * Get horaRecogida
  441.      *
  442.      * @return \DateTime
  443.      */
  444.     public function getHoraRecogida()
  445.     {
  446.         return $this->horaRecogida;
  447.     }
  448.     /**
  449.      * Set lineas
  450.      *
  451.      * @param string $lineas
  452.      * @return Transaccion
  453.      */
  454.     public function setLineas($lineas)
  455.     {
  456.         $this->lineas $lineas;
  457.         return $this;
  458.     }
  459.     /**
  460.      * Get lineas
  461.      *
  462.      * @return ArrayCollection
  463.      */
  464.     public function getLineas()
  465.     {
  466.         return $this->lineas;
  467.     }
  468.     /**
  469.      * Set fechaRecogida
  470.      *
  471.      * @param string $fechaRecogida
  472.      * @return Transaccion
  473.      */
  474.     public function setFechaRecogida($fechaRecogida)
  475.     {
  476.         $this->fechaRecogida $fechaRecogida;
  477.         return $this;
  478.     }
  479.     /**
  480.      * Get fechaRecogida
  481.      *
  482.      * @return \DateTime
  483.      */
  484.     public function getFechaRecogida()
  485.     {
  486.         return $this->fechaRecogida;
  487.     }
  488.     /**
  489.      * Get fechaTransaccion
  490.      *
  491.      * @return \DateTime
  492.      */
  493.     public function getFechaTransaccion()
  494.     {
  495.         return $this->fechaTransaccion;
  496.     }
  497.     /**
  498.      * Set tipoPago
  499.      *
  500.      * @param string $tipoPago
  501.      * @return Transaccion
  502.      */
  503.     public function setTipoPago($tipoPago)
  504.     {
  505.         $this->tipoPago $tipoPago;
  506.         return $this;
  507.     }
  508.     /**
  509.      * Get tipoPago
  510.      *
  511.      * @return string
  512.      */
  513.     public function getTipoPago()
  514.     {
  515.         return $this->tipoPago;
  516.     }
  517.     /**
  518.      * Set direccionCompleta
  519.      *
  520.      * @param string $direccionCompleta
  521.      * @return Transaccion
  522.      */
  523.     public function setDireccionCompleta($direccionCompleta)
  524.     {
  525.         $this->direccionCompleta $direccionCompleta;
  526.         return $this;
  527.     }
  528.     /**
  529.      * Get direccionCompleta
  530.      *
  531.      * @return string
  532.      */
  533.     public function getDireccionCompleta()
  534.     {
  535.         return $this->direccionCompleta;
  536.     }
  537.     /**
  538.      * Set codigoPostal
  539.      *
  540.      * @param string $codigoPostal
  541.      * @return Transaccion
  542.      */
  543.     public function setCodigoPostal($codigoPostal)
  544.     {
  545.         $this->codigoPostal $codigoPostal;
  546.         return $this;
  547.     }
  548.     /**
  549.      * Get codigoPostal
  550.      *
  551.      * @return string
  552.      */
  553.     public function getCodigoPostal()
  554.     {
  555.         return $this->codigoPostal;
  556.     }
  557.     /**
  558.      * Set ciudad
  559.      *
  560.      * @param string $ciudad
  561.      * @return Transaccion
  562.      */
  563.     public function setCiudad($ciudad)
  564.     {
  565.         $this->ciudad $ciudad;
  566.         return $this;
  567.     }
  568.     /**
  569.      * Get ciudad
  570.      *
  571.      * @return string
  572.      */
  573.     public function getCiudad()
  574.     {
  575.         return $this->ciudad;
  576.     }
  577.     /**
  578.      * Set provincia
  579.      *
  580.      * @param string $provincia
  581.      * @return Transaccion
  582.      */
  583.     public function setProvincia($provincia)
  584.     {
  585.         $this->provincia $provincia;
  586.         return $this;
  587.     }
  588.     /**
  589.      * Get provincia
  590.      *
  591.      * @return string
  592.      */
  593.     public function getProvincia()
  594.     {
  595.         return $this->provincia;
  596.     }
  597.     /**
  598.      * Set pais
  599.      *
  600.      * @param string $pais
  601.      * @return Transaccion
  602.      */
  603.     public function setPais($pais)
  604.     {
  605.         $this->pais $pais;
  606.         return $this;
  607.     }
  608.     /**
  609.      * Get pais
  610.      *
  611.      * @return string
  612.      */
  613.     public function getPais()
  614.     {
  615.         return $this->pais;
  616.     }
  617.     /**
  618.      * Set devoluciones
  619.      *
  620.      * @param string $devoluciones
  621.      * @return Transaccion
  622.      */
  623.     public function setDevoluciones($devoluciones)
  624.     {
  625.         $this->devoluciones $devoluciones;
  626.         return $this;
  627.     }
  628.     /**
  629.      * Get devoluciones
  630.      *
  631.      * @return string
  632.      */
  633.     public function getDevoluciones()
  634.     {
  635.         return $this->devoluciones;
  636.     }
  637.     /**
  638.      * Set transaccionFecha
  639.      *
  640.      * @param string $transaccionFecha
  641.      * @return Transaccion
  642.      */
  643.     public function setTransaccionFecha($transaccionFecha)
  644.     {
  645.         $this->transaccionFecha $transaccionFecha;
  646.         return $this;
  647.     }
  648.     /**
  649.      * Get transaccionFecha
  650.      *
  651.      * @return \DateTime
  652.      */
  653.     public function getTransaccionFecha()
  654.     {
  655.         return $this->transaccionFecha;
  656.     }
  657.     /**
  658.      * Set totalLineas
  659.      *
  660.      * @param string $totalLineas
  661.      * @return Transaccion
  662.      */
  663.     public function setTotalLineas($totalLineas)
  664.     {
  665.         $this->totalLineas $totalLineas;
  666.         return $this;
  667.     }
  668.     /**
  669.      * Get horaRecogida
  670.      *
  671.      * @return string
  672.      */
  673.     public function getTotalLineas()
  674.     {
  675.         return $this->totalLineas;
  676.     }
  677.     /**
  678.      * Set estadoEnvio
  679.      *
  680.      * @param string $estadoEnvio
  681.      * @return Transaccion
  682.      */
  683.     public function setEstadoEnvio($estadoEnvio)
  684.     {
  685.         $this->estadoEnvio $estadoEnvio;
  686.         return $this;
  687.     }
  688.     /**
  689.      * Get estadoEnvio
  690.      *
  691.      * @return string
  692.      */
  693.     public function getEstadoEnvio()
  694.     {
  695.         return $this->estadoEnvio;
  696.     }
  697.     /**
  698.      * Set gastosEnvio
  699.      *
  700.      * @param string gastosEnvio
  701.      * @return Transaccion
  702.      */
  703.     public function setGastosEnvio($gastosEnvio)
  704.     {
  705.         $this->gastosEnvio $gastosEnvio;
  706.         return $this;
  707.     }
  708.     /**
  709.      * Get gastosEnvio
  710.      *
  711.      * @return string
  712.      */
  713.     public function getGastosEnvio()
  714.     {
  715.         return $this->gastosEnvio;
  716.     }
  717.     /**
  718.      * Set total
  719.      *
  720.      * @param float $total
  721.      * @return Transaccion
  722.      */
  723.     public function setTotal($total)
  724.     {
  725.         $this->total $total;
  726.         return $this;
  727.     }
  728.     /**
  729.      * Get total
  730.      *
  731.      * @return string
  732.      */
  733.     public function getTotal()
  734.     {
  735.         return $this->total;
  736.     }
  737.     /**
  738.      * @ORM\PrePersist
  739.      * @ORM\PreUpdate
  740.      */
  741.     public function prePersist(){
  742.     
  743.         if ($this->provincia and $this->totalLineas 500){
  744.             $this->gastosEnvio=$this->provincia->getGastos();
  745.         }
  746.     
  747.         $this->total=$this->totalLineas+$this->gastosEnvio;
  748.     }
  749.     /**
  750.      * @return \DateTime
  751.      */
  752.     public function getTiempoEnvio()
  753.     {
  754.         return $this->tiempoEnvio;
  755.     }
  756.     /**
  757.      * @param string $tiempoEnvio
  758.      */
  759.     public function setTiempoEnvio($tiempoEnvio)
  760.     {
  761.         $this->tiempoEnvio $tiempoEnvio;
  762.     }
  763.     /**
  764.      * @return Nacex
  765.      */
  766.     public function getNacex()
  767.     {
  768.         return $this->nacex;
  769.     }
  770.     /**
  771.      * @param mixed $nacex
  772.      */
  773.     public function setNacex($nacex)
  774.     {
  775.         $this->nacex $nacex;
  776.     }
  777.     /**
  778.      * @return mixed
  779.      */
  780.     public function getCardSend()
  781.     {
  782.         return $this->cardSend;
  783.     }
  784.     /**
  785.      * @param mixed $cardSend
  786.      */
  787.     public function setCardSend($cardSend)
  788.     {
  789.         $this->cardSend $cardSend;
  790.     }
  791.     /**
  792.      * @return mixed
  793.      */
  794.     public function getNameSend()
  795.     {
  796.         return $this->nameSend;
  797.     }
  798.     /**
  799.      * @param mixed $nameSend
  800.      */
  801.     public function setNameSend($nameSend)
  802.     {
  803.         $this->nameSend $nameSend;
  804.     }
  805.     /**
  806.      * @return mixed
  807.      */
  808.     public function getTitular()
  809.     {
  810.         return $this->titular;
  811.     }
  812.     /**
  813.      * @param mixed $titular
  814.      */
  815.     public function setTitular($titular)
  816.     {
  817.         $this->titular $titular;
  818.     }
  819.     /**
  820.      * @return UserStats[]
  821.      */
  822.     public function getUserStats()
  823.     {
  824.         return $this->userStats;
  825.     }
  826.     
  827.     /**
  828.      * Set fechaPagado
  829.      *
  830.      * @param string $fechaPagado
  831.      * @return DateTime
  832.      */
  833.     public function setFechaPagado($fechaPagado)
  834.     {
  835.         $this->fechaPagado $fechaPagado;
  836.         return $this;
  837.     }
  838.     /**
  839.      * Get fechaPagado
  840.      *
  841.      * @return \DateTime
  842.      */
  843.     public function getFechaPagado()
  844.     {
  845.         return $this->fechaPagado;
  846.     }
  847.     
  848.     public static function getEstadosPago()
  849.     {
  850.         return array(
  851.             self::EN_PASSARELA_DE_PAGO   => "En pasarela de pago",
  852.             self::PAGADO                 => "Pagado",
  853.             self::PENDIENTE_DE_PAGO      => "Pendiente de pago",
  854.             self::COBRADO                => "Cobrado",
  855.             self::CANCELADO              => "Cancelado",
  856.             self::DEVUELTO               => "Devuelto",
  857.         );
  858.     }
  859.     
  860.     public static function getEstadosEnvio()
  861.     {
  862.         return array(
  863.             self::PENDIENTE     => "PENDIENTE",
  864.             self::EN_PROCESO    => "EN PROCESO",
  865.             self::ENVIADO       => "ENVIADO",
  866.             self::DISPONIBLE    => "DISPONIBLE",
  867.             self::ENTREGADO     => "ENTREGADO",
  868.         );
  869.     }
  870.     public function isPagado() {
  871.         return ($this->getEstado() == self::COBRADO);
  872.     }
  873.     public function puedeDevolver() {
  874.         return ($this->getEstado() == self::DEVUELTO and $this->getTotal() > $this->getDevuelto());
  875.     }
  876.     
  877.     
  878.     /**
  879.      * @return integer
  880.      */
  881.     public function getTipoPromo()
  882.     {
  883.         return $this->tipoPromo;
  884.     }
  885.     /**
  886.      * @param integer $tipoPromo
  887.      */
  888.     public function setTipoPromo($tipoPromo)
  889.     {
  890.         $this->tipoPromo $tipoPromo;
  891.     }
  892.     public function setTokenEmail($tokenEmail)
  893.     {
  894.         $this->tokenEmail $tokenEmail;
  895.         return $this;
  896.     }
  897.     public function getTokenEmail()
  898.     {
  899.         return $this->tokenEmail;
  900.     }
  901.     public function setEmailTitular($emailTitular)
  902.     {
  903.         $this->emailTitular $emailTitular;
  904.         return $this;
  905.     }
  906.     public function getEmailTitular()
  907.     {
  908.         return $this->emailTitular;
  909.     }
  910.     public function getEmailTransaccionAbandonada()
  911.     {
  912.         return $this->emailTransaccionAbandonada;
  913.     }
  914.     public function setEmailTransaccionAbandonada($emailTransaccionAbandonada)
  915.     {
  916.         $this->emailTransaccionAbandonada $emailTransaccionAbandonada;
  917.         return $this;
  918.     }
  919.     public function setIdioma($idioma)
  920.     {
  921.         $this->idioma $idioma;
  922.         return $this;
  923.     }
  924.     public function getIdioma()
  925.     {
  926.         return $this->idioma;
  927.     }
  928.     public function getHistorialDevoluciones()
  929.     {
  930.         return $this->historialDevoluciones;
  931.     }
  932.     public function addHistorialDevolucion($historialDevolucion)
  933.     {
  934.         if (!$this->historialDevoluciones->contains($historialDevolucion)) {
  935.             $this->historialDevoluciones->add($historialDevolucion);
  936.             $historialDevolucion->setTransaccion($this);
  937.         }
  938.         return $this;
  939.     }
  940.     public function removeHistorialDevolucion($historialDevolucion)
  941.     {
  942.         if ($this->historialDevoluciones->removeElement($historialDevolucion)) {
  943.             // set the owning side to null (unless already changed)
  944.             if ($historialDevolucion->getTransaccion() === $this) {
  945.                 $historialDevolucion->setTransaccion(null);
  946.             }
  947.         }
  948.         return $this;
  949.     }
  950.     public function getDevuelto()
  951.     {
  952.         return $this->devuelto;
  953.     }
  954.     public function setDevuelto(float $devuelto)
  955.     {
  956.         $this->devuelto $devuelto;
  957.         return $this;
  958.     }
  959.     public function setTelefono($telefono)
  960.     {
  961.         $this->telefono $telefono;
  962.         return $this;
  963.     }
  964.     public function getTelefono()
  965.     {
  966.         return $this->telefono;
  967.     }
  968.     
  969.     /**
  970.      * Set comentarioInterno
  971.      *
  972.      * @param string $comentarioInterno
  973.      * @return Transaccion
  974.      */
  975.     public function setComentarioInterno($comentarioInterno)
  976.     {
  977.         $this->comentarioInterno $comentarioInterno;
  978.         return $this;
  979.     }
  980.     /**
  981.      * Get comentarioInterno
  982.      *
  983.      * @return string
  984.      */
  985.     public function getComentarioInterno()
  986.     {
  987.         return $this->comentarioInterno;
  988.     }
  989. }