Sha256: a107ebb12206dbf39c5fe1d6cf1192e36f438d7bf2200c386a432563e534d58b

Contents?: true

Size: 380 Bytes

Versions: 10

Compression:

Stored size: 380 Bytes

Contents

Spree::User.class_eval do
  has_many :subscriptions

  def find_or_create_stripe_customer(token)
    return api_customer if stripe_customer_id?
    customer = Stripe::Customer.create(description: email, email: email, card: token)
    update_column(:stripe_customer_id, customer.id)
    customer
  end

  def api_customer
    Stripe::Customer.retrieve(stripe_customer_id)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_account_recurring-1.0.5 app/models/spree/user_decorator.rb
spree_account_recurring-1.1.3 app/models/spree/user_decorator.rb
spree_account_recurring-1.1.2 app/models/spree/user_decorator.rb
spree_account_recurring-1.0.4 app/models/spree/user_decorator.rb
spree_account_recurring-1.0.3 app/models/spree/user_decorator.rb
spree_account_recurring-1.0.2 app/models/spree/user_decorator.rb
spree_account_recurring-1.1.1 app/models/spree/user_decorator.rb
spree_account_recurring-1.1.0 app/models/spree/user_decorator.rb
spree_account_recurring-1.0.1 app/models/spree/user_decorator.rb
spree_account_recurring-1.0.0 app/models/spree/user_decorator.rb