src/AtechNet/CoreBundle/Entity/DocumentPayment.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use Doctrine\ORM\Mapping\Column;
  4. use Doctrine\ORM\Mapping\Entity;
  5. use Doctrine\ORM\Mapping\JoinColumn;
  6. use Doctrine\ORM\Mapping\ManyToOne;
  7. use Doctrine\ORM\Mapping\Table as Table;
  8. /**
  9.  * DocumentPayment
  10.  *
  11.  * @Table(name="document_payments")
  12.  * @Entity(repositoryClass="App\AtechNet\CoreBundle\Repository\DocumentPaymentRepository")
  13.  */
  14. class DocumentPayment extends AbstractSignedEntity
  15. {
  16.     public const int NOT_SELECTED = 0;
  17.     public const int BANK_SK_SLSP_1 = 1;
  18.     public const int BANK_SK_TATRA_BANKA = 2;
  19.     public const int BANK_CZ_CESKA_SPORITELNA = 3;
  20.     public const int BANK_ERSTE = 4;
  21.     public const int BANK_OTP = 5;
  22.     public const int CASH = 6;
  23.     public const int CASH_ON_DELIVERY = 7;
  24.     public const int GOPAY = 8;
  25.     public const int SIMPLEPAY = 9;
  26.     public const int PAYPAL = 10;
  27.     public const int REVOLUT = 11;
  28.     public const int COMPENSATION = 12;
  29.     public const int CETELEM = 13;
  30.     public const int QUATRO = 14;
  31.     public const int INSTACASH = 15;
  32.     public const int BANK_SK_CSOB = 16;
  33.     public const int PASTPAY = 17;
  34.     public const int KLARNA = 18;
  35.     public const int BANK_RAIFFEISEN = 19;
  36.     public const int MILPAY = 20;
  37.     public const int BANK_VUB = 21;
  38.     /**
  39.      * @return array
  40.      */
  41.     public static function getPaymentSourceList(): array
  42.     {
  43.         return [
  44.             self::NOT_SELECTED             => 'Not selected',
  45.             self::BANK_SK_SLSP_1           => 'SLSP 1',
  46.             self::BANK_SK_TATRA_BANKA      => 'Tatra banka',
  47.             self::BANK_SK_CSOB             => 'ČSOB SK',
  48.             self::BANK_CZ_CESKA_SPORITELNA => 'Česká spořitelna',
  49.             self::BANK_ERSTE               => 'Erste',
  50.             self::BANK_OTP                 => 'OTP',
  51.             self::BANK_RAIFFEISEN          => 'Raiffeisen',
  52.             self::CASH                     => 'Cash',
  53.             self::CASH_ON_DELIVERY         => 'Cash on delivery',
  54.             self::GOPAY                    => 'GoPay',
  55.             self::SIMPLEPAY                => 'SimplePay',
  56.             self::PAYPAL                   => 'PayPal',
  57.             self::REVOLUT                  => 'Revolut',
  58.             self::COMPENSATION             => 'Compensation',
  59.             self::CETELEM                  => 'Cetelem',
  60.             self::QUATRO                   => 'Quatro',
  61.             self::INSTACASH                => 'Instacash',
  62.             self::PASTPAY                  => 'Pastpay',
  63.             self::KLARNA                   => 'Klarna',
  64.             self::MILPAY                   => 'Milpay',
  65.             self::BANK_VUB                 => 'VUB bank'
  66.         ];
  67.     }
  68.     /**
  69.      * @return array
  70.      */
  71.     public static function getBankAccountAddressList(): array
  72.     {
  73.         return [
  74.             self::BANK_SK_SLSP_1           => [
  75.                 'iban'  => 'SK4509000000000212959395',
  76.                 'swift' => 'GIBASKBX',
  77.             ],
  78.             self::BANK_SK_TATRA_BANKA      => [
  79.                 'iban'  => 'SK8511000000002946074341',
  80.                 'swift' => 'TATRSKBX',
  81.             ],
  82.             self::BANK_CZ_CESKA_SPORITELNA => [
  83.                 'iban'  => 'CZ3808000000004732551359',
  84.                 'swift' => 'GIBACZPX',
  85.             ],
  86.         ];
  87.     }
  88.     /**
  89.      * @var Document
  90.      *
  91.      * @ManyToOne(targetEntity="Document", inversedBy="payments")
  92.      * @JoinColumn(name="document_id", referencedColumnName="id", nullable=false)
  93.      */
  94.     private $document;
  95.     /**
  96.      * @var string
  97.      *
  98.      * @Column(name="amount", type="decimal", precision=10, scale=2)
  99.      */
  100.     private $amount = 0;
  101.     /**
  102.      * @var string
  103.      *
  104.      * @Column(name="note", type="text", nullable=true)
  105.      */
  106.     private $note;
  107.     /**
  108.      * @var int
  109.      *
  110.      * @Column(name="payment_source", type="integer")
  111.      */
  112.     private $paymentSource = self::NOT_SELECTED;
  113.     /**
  114.      * @var string
  115.      *
  116.      * @Column(name="transaction_id", type="string", length=64, nullable=true)
  117.      */
  118.     private $transactionId;
  119.     /**
  120.      * @var \DateTime
  121.      *
  122.      * @Column(name="payment_date", type="datetime", nullable=true)
  123.      */
  124.     private $paymentDate;
  125.     public function __construct()
  126.     {
  127.         $this->paymentDate = (new \DateTime())->setTime(0, 0);
  128.     }
  129.     /**
  130.      * @return Document
  131.      */
  132.     public function getDocument()
  133.     {
  134.         return $this->document;
  135.     }
  136.     /**
  137.      * @param Document $document
  138.      */
  139.     public function setDocument($document)
  140.     {
  141.         $this->document = $document;
  142.     }
  143.     /**
  144.      * @return string
  145.      */
  146.     public function getAmount()
  147.     {
  148.         return $this->amount;
  149.     }
  150.     /**
  151.      * @param string $amount
  152.      * @return $this
  153.      */
  154.     public function setAmount($amount)
  155.     {
  156.         $this->amount = str_replace(',', '.', $amount);
  157.         return $this;
  158.     }
  159.     /**
  160.      * @return int
  161.      */
  162.     public function getNote()
  163.     {
  164.         return $this->note;
  165.     }
  166.     /**
  167.      * @param int $note
  168.      * @return $this
  169.      */
  170.     public function setNote($note)
  171.     {
  172.         $this->note = $note;
  173.         return $this;
  174.     }
  175.     /**
  176.      * @return int
  177.      */
  178.     public function getPaymentSource()
  179.     {
  180.         return $this->paymentSource;
  181.     }
  182.     /**
  183.      * @param int $paymentSource
  184.      */
  185.     public function setPaymentSource($paymentSource)
  186.     {
  187.         $this->paymentSource = $paymentSource;
  188.     }
  189.     /**
  190.      * @return \DateTime
  191.      */
  192.     public function getPaymentDate()
  193.     {
  194.         return $this->paymentDate;
  195.     }
  196.     /**
  197.      * @param \DateTime $paymentDate
  198.      */
  199.     public function setPaymentDate($paymentDate)
  200.     {
  201.         $this->paymentDate = $paymentDate;
  202.     }
  203.     /**
  204.      * @return string|null
  205.      */
  206.     public function getTransactionId(): ?string
  207.     {
  208.         return $this->transactionId;
  209.     }
  210.     /**
  211.      * @param string|null $transactionId
  212.      */
  213.     public function setTransactionId(?string $transactionId): void
  214.     {
  215.         $this->transactionId = $transactionId;
  216.     }
  217. }