Exemplo n.º 1
0
 /**
  * Create a new customer.
  *
  * @param array $properties
  *
  * @return Customer
  */
 public function create(array $properties = array())
 {
     $coupon_id = null;
     if ($coupon = Arr::get($properties, 'coupon')) {
         $coupon_id = Models\Coupon::where('code', $coupon)->first()->id;
     }
     $this->local_customer = Models\Customer::create(array('description' => Arr::get($properties, 'description'), 'email' => Arr::get($properties, 'email'), 'coupon_id' => $coupon_id));
     $this->gateway->apiDelay();
     $this->id = $this->local_customer->id;
     if ($token = Arr::get($properties, 'card_token')) {
         $this->card()->create($token);
     }
     return $this;
 }