Ejemplo n.º 1
0
 public function __construct($json)
 {
     parent::__construct($json);
     if ($this->hasDataProperty('coupon')) {
         $this->setDataProperty('coupon', new Coupon(json_encode($this->getDataProperty('coupon'))));
     }
     $this->period = new Period(json_encode(array('start' => $this->getDataProperty('start'), 'end' => $this->getDataProperty('end'))));
 }
Ejemplo n.º 2
0
 public function __construct($json)
 {
     parent::__construct($json);
     $this->items = new ArrayCollection();
     if ($this->hasDataProperty('data')) {
         foreach ($this->getDataProperty('data') as $item) {
             $this->items->add(Factory::create(json_encode($item)));
         }
     }
 }
Ejemplo n.º 3
0
 public function __construct($json)
 {
     parent::__construct($json);
     if ($this->hasDataProperty('plan')) {
         $this->setDataProperty('plan', new Plan(json_encode($this->getDataProperty('plan'))));
     }
     if ($this->hasDataProperty('trial_start')) {
         $this->trialPeriod = new Period(json_encode(array('start' => $this->getDataProperty('trial_start'), 'end' => $this->getDataProperty('trial_end'))));
     }
     $this->currentPeriod = new Period(json_encode(array('start' => $this->getDataProperty('current_period_start'), 'end' => $this->getDataProperty('current_period_end'))));
 }
Ejemplo n.º 4
0
 public function __construct($json)
 {
     parent::__construct($json);
     if ($this->hasDataProperty('lines')) {
         $this->setDataProperty('lines', new ObjectList(json_encode($this->getDataProperty('lines'))));
     }
     if ($this->hasDataProperty('discount')) {
         $this->setDataProperty('discount', new Discount(json_encode($this->getDataProperty('discount'))));
     }
     $this->period = new Period($json);
 }
Ejemplo n.º 5
0
 public function __construct($json)
 {
     parent::__construct($json);
     if ($this->hasDataProperty('subscription')) {
         $this->setDataProperty('subscription', new Subscription(json_encode($this->getDataProperty('subscription'))));
     }
     if ($this->hasDataProperty('discount')) {
         $this->setDataProperty('discount', new Discount(json_encode($this->getDataProperty('discount'))));
     }
     $this->subscriptions = new ObjectList(json_encode($this->getDataProperty('subscriptions')));
     if ($this->hasDataProperty('active_card')) {
         $this->setDataProperty('active_card', new Card(json_encode($this->getDataProperty('active_card'))));
     }
     $this->cards = new ObjectList(json_encode($this->getDataProperty('cards')));
 }
Ejemplo n.º 6
0
 public function __construct($json)
 {
     parent::__construct($json);
     $this->setDataProperty('object', ObjectFactory::create(json_encode($this->getDataProperty('object'))));
     if ($this->hasPreviousAttributes()) {
         $previousAttributesCollection = new ArrayCollection();
         foreach ($this->getPreviousAttributes() as $key => $value) {
             if ($value instanceof \stdClass && isset($value->object) && ObjectFactory::isKnownEntityType($value->object)) {
                 $value = ObjectFactory::create(json_encode($value));
             }
             $previousAttributesCollection->set($key, $value);
         }
         $this->setDataProperty('previous_attributes', $previousAttributesCollection);
     }
 }
Ejemplo n.º 7
0
 public function __construct($json)
 {
     parent::__construct($json);
     $this->setDataProperty('data', new Data(json_encode($this->getDataProperty('data'))));
 }