modules/XPay/XPaymentsCloud/src/Model/Subscription/Plan.php line 19

Open in your IDE?
  1. <?php
  2. // vim: set ts=4 sw=4 sts=4 et:
  3. /**
  4.  * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
  5.  * See https://www.x-cart.com/license-agreement.html for license details.
  6.  */
  7. namespace XPay\XPaymentsCloud\Model\Subscription;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * X-Payments Subscription Plan entity
  11.  *
  12.  * @ORM\Entity
  13.  * @ORM\Table  (name="xpayments_subscription_plans")
  14.  */
  15. class Plan extends Base\ASubscriptionPlan
  16. {
  17.     /**
  18.      * Unique id
  19.      *
  20.      * @var int
  21.      *
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue (strategy="AUTO")
  24.      * @ORM\Column         (type="integer", options={ "unsigned": true, "comment": "Unique id" })
  25.      */
  26.     protected $id;
  27.     /**
  28.      * Product
  29.      *
  30.      * @var \XLite\Model\Product
  31.      *
  32.      * @ORM\OneToOne   (targetEntity="XLite\Model\Product", inversedBy="xpaymentsSubscriptionPlan")
  33.      * @ORM\JoinColumn (name="productId", referencedColumnName="product_id")
  34.      */
  35.     protected $product;
  36.     /**
  37.      * Is the product a subscription plan
  38.      *
  39.      * @var boolean
  40.      *
  41.      * @ORM\Column (type="boolean", options={ "comment": "Is the product a subscription plan" })
  42.      */
  43.     protected $isSubscription false;
  44.     /**
  45.      * Setup fee for plan
  46.      *
  47.      * @var float
  48.      *
  49.      * @ORM\Column (type="decimal", precision=14, scale=4, options={ "comment": "Setup fee for the plan" })
  50.      */
  51.     protected $setupFee 0.0000;
  52.     /**
  53.      * Whether to calculate shipping for recurring orders
  54.      *
  55.      * @var boolean
  56.      *
  57.      * @ORM\Column (type="boolean", options={ "comment": "Whether to calculate shipping for recurring orders" })
  58.      */
  59.     protected $calculateShipping false;
  60.     /**
  61.      * Trial duration (measured in the respective unit)
  62.      *
  63.      * @var int
  64.      *
  65.      * @ORM\Column (type="integer", options={ "default": 0, "comment": "Trial duration (in days / weeks / months / years)" })
  66.      */
  67.     protected $trialDuration 0;
  68.     /**
  69.      * Trial duration unit (days / weeks / months / years)
  70.      *
  71.      * @var string
  72.      *
  73.      * @ORM\Column (type="string", options={ "fixed": true, "default": "D" }, length=1)
  74.      */
  75.     protected $trialDurationUnit self::TRIAL_DURATION_UNIT_DAY;
  76.     /**
  77.      * Has trial period or not
  78.      *
  79.      * @var boolean
  80.      *
  81.      * @ORM\Column (type="boolean", options={ "default": false, "comment": "Has trial period or not" })
  82.      */
  83.     protected $hasTrialPeriod false;
  84.     /**
  85.      * Set subscription
  86.      *
  87.      * @param boolean $isSubscription
  88.      *
  89.      * @return Plan
  90.      */
  91.     public function setIsSubscription($isSubscription)
  92.     {
  93.         $this->isSubscription $isSubscription;
  94.         return $this;
  95.     }
  96.     /**
  97.      * Is subscription
  98.      *
  99.      * @return boolean
  100.      */
  101.     public function getIsSubscription()
  102.     {
  103.         return $this->isSubscription;
  104.     }
  105.     /**
  106.      * Set setupFee
  107.      *
  108.      * @param float $setupFee
  109.      *
  110.      * @return Plan
  111.      */
  112.     public function setSetupFee($setupFee)
  113.     {
  114.         $this->setupFee $setupFee;
  115.         return $this;
  116.     }
  117.     /**
  118.      * Get setupFee
  119.      *
  120.      * @return float
  121.      */
  122.     public function getSetupFee()
  123.     {
  124.         return $this->setupFee;
  125.     }
  126.     /**
  127.      * Get id
  128.      *
  129.      * @return integer
  130.      */
  131.     public function getId()
  132.     {
  133.         return $this->id;
  134.     }
  135.     /**
  136.      * Set type
  137.      *
  138.      * @param string $type
  139.      *
  140.      * @return Plan
  141.      */
  142.     public function setType($type)
  143.     {
  144.         $this->type $type;
  145.         return $this;
  146.     }
  147.     /**
  148.      * Get type
  149.      *
  150.      * @return string
  151.      */
  152.     public function getType()
  153.     {
  154.         return $this->type;
  155.     }
  156.     /**
  157.      * Set number
  158.      *
  159.      * @param integer $number
  160.      *
  161.      * @return Plan
  162.      */
  163.     public function setNumber($number)
  164.     {
  165.         $this->number $number;
  166.         return $this;
  167.     }
  168.     /**
  169.      * Set period
  170.      *
  171.      * @param string $period
  172.      *
  173.      * @return Plan
  174.      */
  175.     public function setPeriod($period)
  176.     {
  177.         $this->period $period;
  178.         return $this;
  179.     }
  180.     /**
  181.      * Get period
  182.      *
  183.      * @return string
  184.      */
  185.     public function getPeriod()
  186.     {
  187.         return $this->period;
  188.     }
  189.     /**
  190.      * Set reverse
  191.      *
  192.      * @param boolean $reverse
  193.      *
  194.      * @return Plan
  195.      */
  196.     public function setReverse($reverse)
  197.     {
  198.         $this->reverse = (bool)$reverse;
  199.         return $this;
  200.     }
  201.     /**
  202.      * Get reverse
  203.      *
  204.      * @return boolean
  205.      */
  206.     public function getReverse()
  207.     {
  208.         return $this->reverse;
  209.     }
  210.     /**
  211.      * Set periods
  212.      *
  213.      * @param integer $periods
  214.      *
  215.      * @return Plan
  216.      */
  217.     public function setPeriods($periods)
  218.     {
  219.         $this->periods $periods;
  220.         return $this;
  221.     }
  222.     /**
  223.      * Get periods
  224.      *
  225.      * @return integer
  226.      */
  227.     public function getPeriods()
  228.     {
  229.         return $this->periods;
  230.     }
  231.     /**
  232.      * Set product
  233.      *
  234.      * @param \XLite\Model\Product $product
  235.      *
  236.      * @return Plan
  237.      */
  238.     public function setProduct(\XLite\Model\Product $product null)
  239.     {
  240.         $this->product $product;
  241.         return $this;
  242.     }
  243.     /**
  244.      * Get product
  245.      *
  246.      * @return \XLite\Model\Product
  247.      */
  248.     public function getProduct()
  249.     {
  250.         return $this->product;
  251.     }
  252.     /**
  253.      * Set value of "Calculate shipping for recurring orders" option of subscription plan
  254.      *
  255.      * @param boolean $calculateShipping
  256.      *
  257.      * @return Plan
  258.      */
  259.     public function setCalculateShipping($calculateShipping)
  260.     {
  261.         $this->calculateShipping $calculateShipping;
  262.         return $this;
  263.     }
  264.     /**
  265.      * Get value of "Calculate shipping for recurring orders" option of subscription plan
  266.      *
  267.      * @return string
  268.      */
  269.     public function getCalculateShipping()
  270.     {
  271.         return $this->calculateShipping;
  272.     }
  273.     /**
  274.      * Getter for hasTrialPeriod (used by core automatically)
  275.      *
  276.      * @return bool
  277.      */
  278.     public function getHasTrialPeriod()
  279.     {
  280.         return $this->hasTrialPeriod;
  281.     }
  282.     /**
  283.      * Pretty named check for trial period
  284.      *
  285.      * @return bool
  286.      */
  287.     public function hasTrialPeriod()
  288.     {
  289.         return $this->getHasTrialPeriod();
  290.     }
  291.     /**
  292.      * @param bool $hasTrialPeriod
  293.      *
  294.      * @return Plan
  295.      */
  296.     public function setHasTrialPeriod($hasTrialPeriod)
  297.     {
  298.         $this->hasTrialPeriod $hasTrialPeriod;
  299.         return $this;
  300.     }
  301.     /**
  302.      * @return int
  303.      */
  304.     public function getTrialDuration()
  305.     {
  306.         return $this->trialDuration;
  307.     }
  308.     /**
  309.      * @param int $trialDuration
  310.      *
  311.      * @return Plan
  312.      */
  313.     public function setTrialDuration($trialDuration)
  314.     {
  315.         $this->trialDuration $trialDuration;
  316.         return $this;
  317.     }
  318.     /**
  319.      * @return string
  320.      */
  321.     public function getTrialDurationUnit()
  322.     {
  323.         return $this->trialDurationUnit;
  324.     }
  325.     /**
  326.      * @param int $trialDurationUnit
  327.      *
  328.      * @return Plan
  329.      */
  330.     public function setTrialDurationUnit($trialDurationUnit)
  331.     {
  332.         $this->trialDurationUnit $trialDurationUnit;
  333.         return $this;
  334.     }
  335. }