class Wco::Leadset

def customer_id

def customer_id
  if self[:customer_id].blank?
    return nil if !email.present?
    existing = Stripe::Customer.search({ query: "email: '#{email}'" })
    if existing.data.present?
      update_attributes( customer_id: existing.data[0][:id] )
    else
      customer = Stripe::Customer.create({ email: email })
      update_attributes( customer_id: customer[:id] )
    end
  end
  self[:customer_id]
end