/** * Update a customer. * * @param array $properties * * @return Customer */ public function update(array $properties = array()) { $this->info(); if (!empty($properties['description'])) { $this->local_customer->description = $properties['description']; } if (!empty($properties['email'])) { $this->local_customer->email = $properties['email']; } if (!empty($properties['coupon'])) { if ($coupon_model = Models\Coupon::where('code', $properties['coupon'])->first()) { $this->local_customer->coupon_id = $coupon_model->id; } } $this->local_customer->save(); if (!empty($properties['card_token'])) { $token = $properties['card_token']; if ($card = $this->local_customer->cards->first()) { $this->card($card)->update(json_decode($token, true)); } else { $this->card()->create($token); } } $this->gateway->apiDelay(); $this->local_subscription = null; return $this; }