src/AtechNet/CoreBundle/Entity/OrderSetting.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.  * OrderSetting
  10.  *
  11.  * @Table(name="orders_setting")
  12.  * @Entity()
  13.  */
  14. class OrderSetting extends AbstractSignedEntity
  15. {
  16.     public const int TYPE_CETELEM_CODE = 1;
  17.     public const int TYPE_DEPOSIT = 2;
  18.     public const int TYPE_LABEL_PRINTED = 3;
  19.     public const int TYPE_PICKUP_POINT_ID = 4;
  20.     public const int TYPE_PARENT_ORDER_ID = 5;
  21.     public const int TYPE_CHILD_ORDER_ID = 6;
  22.     public const int TYPE_PICKUP_POINT_PARTNER_NOTIFIED = 7;
  23.     public const int TYPE_COUPON_CODE = 8;
  24.     public const int TYPE_GOPAY_PAYMENT_ID = 9;
  25.     public const int TYPE_SIMPLEPAY_PAYMENT_ID = 10;
  26.     public const int TYPE_SIMPLEPAY_PAYMENT_ORDER_REF = 11;
  27.     public const int TYPE_UPSELL_STATS = 12;
  28.     public const int TYPE_SHIPPING_NOTIFICATION = 13;
  29.     public const int TYPE_PAID_PRICE_BY_CARD = 14;
  30.     public const int TYPE_MINI_CRM_ID = 15;
  31.     public const int TYPE_CHOSEN_CARRIER_ID = 16;
  32.     public const int TYPE_DONE = 17;
  33.     public const int TYPE_SHIPPING_DATETIME = 18;
  34.     public const int TYPE_ORDER_CONFIRMED = 19;
  35.     public const int TYPE_BILLINGO_NOTE = 20;
  36.     public const int TYPE_PACKETA_BRANCH_ID = 21;
  37.     public const int TYPE_PACKETA_BRANCH_NAME = 22;
  38.     public const int TYPE_EU_PERSONAL_TAX_ID = 23;
  39.     public const int TYPE_FINISHED_BY_MARKETPLACE_API = 24;
  40.     public const int TYPE_INSTACASH_APPLICATION_ID = 25;
  41.     public const int TYPE_INSTACASH_APPLICATION_STATUS = 26;
  42.     public const int TYPE_INSTACASH_PAYMENT = 27;
  43.     public const int TYPE_DISABLE_INVOICE_CREATION = 28;
  44.     public const int TYPE_TRACKING_NUMBER_FROM_PBH = 29;
  45.     public const int TYPE_PAST_PAY_RESERVE = 30;
  46.     public const int TYPE_PAST_PAY_FINALIZED = 31;
  47.     public const int TYPE_PAST_PAY_RESERVATION_CANCELED = 32;
  48.     public const int TYPE_MARKETPLACE_ORDER_FINISHED_MANUALLY = 33;
  49.     public const int TYPE_KLARNA_PAYMENT_SESSION_ID = 34;
  50.     public const int TYPE_KLARNA_ORDER_ID = 35;
  51.     public const int TYPE_CLONED_ORDER = 36;
  52.     public const int TYPE_PAYPAL_ORDER_ID = 37;
  53.     public const int TYPE_CANCELED_ORDER = 38;
  54.     public const int TYPE_MILPAY_APPLICATION_ID = 39;
  55.     public const int TYPE_MILPAY_APPLICATION_STATUS = 40;
  56.     public const int TYPE_MILPAY_PAYMENT = 41;
  57.     public const int TYPE_PACKETA_CARRIER_ID = 42;
  58.     public const int TYPE_PRICE_BY_MARKETPLACE_API = 43;
  59.     public const int TYPE_PAYPAL_TRANSACTION_ID = 44;
  60.     public const int TYPE_FORCE_SAVING_USER = 45;
  61.     public const int TYPE_REQUIRED_QUALITY_CHECK = 46;
  62.     public const int TYPE_UZAVIERKA_PRINTED_AT = 47;
  63.     public const int TYPE_UNAS_ORDER_DOMAIN = 48;
  64.     public const int TYPE_STRIPE_ID = 49;
  65.     public const int TYPE_UNAS_USER_IS_REGISTERED = 50;
  66.     public const int TYPE_FEDEX_TRACKING_NUMBER = 51;
  67.     public const int TYPE_FEDEX_ADDRESS_VERIFIED = 52;
  68.     public const int TYPE_CLAIM_FEDEX_TRACKING_NUMBER = 53;
  69.     public const int TYPE_CLAIM_IMPORT_FEDEX_TRACKING_NUMBER = 54;
  70.     public const int TYPE_SALES_RISK = 55;
  71.     public const int TYPE_QUALITY_MAY_VARY = 56;
  72.     public const int TYPE_ALTERNATIVE_V2_PRODUCT = 57;
  73.     public const int TYPE_LASERED_PRODUCTS = 58;
  74.     public const int TYPE_CN_COUNT = 59;
  75.     public const int SUB_TYPE_UPSELL_STATS_VIEW = 1;
  76.     public const int SUB_TYPE_UPSELL_STATS_WANT = 2;
  77.     public const int SUB_TYPE_UPSELL_STATS_DONT_WANT = 3;
  78.     public const string VALUE_FINISH_BY_MARKETPLACE_API_SUCCESS = 'success';
  79.     public const string VALUE_FINISH_BY_MARKETPLACE_API_FAILED = 'failed';
  80.     public const string VALUE_FINISH_BY_MARKETPLACE_API_WARNING = 'warning';
  81.     /**
  82.      * @return string[]
  83.      */
  84.     public static function getTypeChoices(): array
  85.     {
  86.         return [
  87.             self::TYPE_CETELEM_CODE                  => 'Cetelem code',
  88.             self::TYPE_DEPOSIT                       => 'Deposit',
  89.             self::TYPE_LABEL_PRINTED                 => 'Label printed',
  90.             self::TYPE_PICKUP_POINT_ID               => 'Pickup point ID',
  91.             self::TYPE_PARENT_ORDER_ID               => 'Parent order ID',
  92.             self::TYPE_CHILD_ORDER_ID                => 'Child order ID',
  93.             self::TYPE_PICKUP_POINT_PARTNER_NOTIFIED => 'Partner notified',
  94.             self::TYPE_COUPON_CODE                   => 'Coupon code',
  95.             self::TYPE_GOPAY_PAYMENT_ID              => 'Gopay payment ID',
  96.             self::TYPE_SIMPLEPAY_PAYMENT_ID          => 'Simplepay payment ID',
  97.             self::TYPE_SIMPLEPAY_PAYMENT_ORDER_REF   => 'Simplepay payment order ref',
  98.             self::TYPE_UPSELL_STATS                  => 'Upsell stats',
  99.             self::TYPE_SHIPPING_NOTIFICATION         => 'Notification sent about shipping',
  100.             self::TYPE_MINI_CRM_ID                   => 'Mini CRM',
  101.             self::TYPE_CHOSEN_CARRIER_ID             => 'Chosen carrier',
  102.             self::TYPE_DONE                          => 'Done',
  103.             self::TYPE_SHIPPING_DATETIME             => 'Shipping date and time',
  104.             self::TYPE_ORDER_CONFIRMED               => 'Order confirmed',
  105.             self::TYPE_BILLINGO_NOTE                 => 'Note on the Billingo invoice',
  106.             self::TYPE_PACKETA_BRANCH_ID             => 'Packeta branch (pickup point) id',
  107.             self::TYPE_PACKETA_BRANCH_NAME           => 'Packeta branch (pickup point) name',
  108.             self::TYPE_INSTACASH_APPLICATION_ID      => 'Instacash application ID',
  109.             self::TYPE_INSTACASH_APPLICATION_STATUS  => 'Instacash application status',
  110.             self::TYPE_INSTACASH_PAYMENT             => 'Instacash payment',
  111.             self::TYPE_DISABLE_INVOICE_CREATION      => 'Disable invoice creation',
  112.             self::TYPE_MILPAY_APPLICATION_ID         => 'Milpay application ID ',
  113.             self::TYPE_MILPAY_APPLICATION_STATUS     => 'Milpay application status',
  114.             self::TYPE_MILPAY_PAYMENT                => 'Milpay payment',
  115.             self::TYPE_PACKETA_CARRIER_ID            => 'Packeta carrier id', 
  116.             self::TYPE_REQUIRED_QUALITY_CHECK        => 'Required quality check',
  117.             self::TYPE_CN_COUNT                      => 'Credit note count',
  118.         ];
  119.     }
  120.     /**
  121.      * @return string[][]
  122.      */
  123.     public static function getSubTypeChoices(): array
  124.     {
  125.         return [
  126.             self::TYPE_UPSELL_STATS => [
  127.                 self::SUB_TYPE_UPSELL_STATS_VIEW => 'Viewed',
  128.                 self::SUB_TYPE_UPSELL_STATS_WANT => 'Want',
  129.                 self::SUB_TYPE_UPSELL_STATS_DONT_WANT => 'Dont want',
  130.             ],
  131.         ];
  132.     }
  133.     /**
  134.      * @var Order
  135.      *
  136.      * @ManyToOne(targetEntity="Order", inversedBy="settings")
  137.      * @JoinColumn(name="order_id", referencedColumnName="id")
  138.      */
  139.     private $order;
  140.     /**
  141.      * @var int
  142.      *
  143.      * @Column(name="type", type="integer")
  144.      */
  145.     private $type;
  146.     /**
  147.      * @var string
  148.      *
  149.      * @Column(name="value", type="string", length=256)
  150.      */
  151.     private $value;
  152.     /**
  153.      * @return Order
  154.      */
  155.     public function getOrder()
  156.     {
  157.         return $this->order;
  158.     }
  159.     /**
  160.      * @param Order $order
  161.      */
  162.     public function setOrder(Order $order)
  163.     {
  164.         return $this->order = $order;
  165.     }
  166.     /**
  167.      * @return int
  168.      */
  169.     public function getType()
  170.     {
  171.         return $this->type;
  172.     }
  173.     /**
  174.      * @param int $type
  175.      */
  176.     public function setType($type)
  177.     {
  178.         return $this->type = $type;
  179.     }
  180.     /**
  181.      * @return string
  182.      */
  183.     public function getValue()
  184.     {
  185.         return $this->value;
  186.     }
  187.     /**
  188.      * @param string $value
  189.      */
  190.     public function setValue($value)
  191.     {
  192.         return $this->value = $value;
  193.     }
  194.     /**
  195.      * @param Order $order
  196.      * @param $settingCode
  197.      * @param $settingValue
  198.      * @return OrderSetting
  199.      */
  200.     public static function createSetting(Order $order, $settingCode, $settingValue): OrderSetting
  201.     {
  202.         $orderSetting = new OrderSetting();
  203.         $orderSetting->setOrder($order);
  204.         $orderSetting->setType($settingCode);
  205.         $orderSetting->setValue($settingValue);
  206.         return $orderSetting;
  207.     }
  208.     /**
  209.      * @param OrderSetting $orderSetting
  210.      * @param $settingValue
  211.      * @return OrderSetting
  212.      */
  213.     public static function updateSettingValue(OrderSetting $orderSetting, $settingValue): OrderSetting
  214.     {
  215.         $orderSetting->setValue($settingValue);
  216.         return $orderSetting;
  217.     }
  218. }