From 3623325cab81a342a7a9056183840e680755fb30 Mon Sep 17 00:00:00 2001 From: Steve Pettitt Date: Mon, 5 Sep 2016 19:31:40 +0100 Subject: [PATCH] Add missing files --- app/helpers/admin/stripe_helper.rb | 19 +++++++++++++++++++ app/models/stripe_account.rb | 5 +++++ 2 files changed, 24 insertions(+) create mode 100644 app/helpers/admin/stripe_helper.rb create mode 100644 app/models/stripe_account.rb diff --git a/app/helpers/admin/stripe_helper.rb b/app/helpers/admin/stripe_helper.rb new file mode 100644 index 0000000000..1ec28e7bf0 --- /dev/null +++ b/app/helpers/admin/stripe_helper.rb @@ -0,0 +1,19 @@ +module StripeHelper + class << self + attr_accessor :client, :options + end + @options = { + :site => 'https://connect.stripe.com', + :authorize_url => '/oauth/authorize', + :token_url => '/oauth/token' + } + @client = OAuth2::Client.new( + ENV['STRIPE_CLIENT_ID'], + ENV['STRIPE_INSTANCE_SECRET_KEY'], + options + ) + + def get_token(code, options={params: {scope: 'read_write'}}) + @client.get_token(code, options) + end +end diff --git a/app/models/stripe_account.rb b/app/models/stripe_account.rb new file mode 100644 index 0000000000..b97e8f632f --- /dev/null +++ b/app/models/stripe_account.rb @@ -0,0 +1,5 @@ +class StripeAccount < ActiveRecord::Base + belongs_to :enterprise + valdates_presence_of :stripe_user_id, :stripe_publishable_key + validates_uniqueness_of :stripe_user_id +end