mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Starting Stripe integration
This commit is contained in:
committed by
Rob Harrington
parent
1db0bbef09
commit
df18329233
2
Gemfile
2
Gemfile
@@ -14,6 +14,8 @@ gem 'spree', github: 'openfoodfoundation/spree', branch: 'step-6-adjustment-stat
|
||||
gem 'spree_i18n', github: 'spree/spree_i18n', branch: '1-3-stable'
|
||||
gem 'spree_auth_devise', github: 'openfoodfoundation/spree_auth_devise', branch: 'spree-upgrade-intermediate'
|
||||
|
||||
gem 'oauth2', '~> 1.2.0' # Used for Stripe Connect
|
||||
|
||||
# Our branch contains two changes
|
||||
# - Pass customer email and phone number to PayPal (merged to upstream master)
|
||||
# - Change type of password from string to password to hide it in the form
|
||||
|
||||
13
Gemfile.lock
13
Gemfile.lock
@@ -285,6 +285,8 @@ GEM
|
||||
factory_girl_rails (3.3.0)
|
||||
factory_girl (~> 3.3.0)
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffaker (1.15.0)
|
||||
ffi (1.9.3)
|
||||
figaro (0.7.0)
|
||||
@@ -454,7 +456,8 @@ GEM
|
||||
json_spec (1.1.1)
|
||||
multi_json (~> 1.0)
|
||||
rspec (~> 2.0)
|
||||
kaminari (0.13.0)
|
||||
jwt (1.5.4)
|
||||
kaminari (0.14.1)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
railties (>= 3.0.0)
|
||||
@@ -484,10 +487,17 @@ GEM
|
||||
i18n (~> 0.6.0)
|
||||
multi_json (1.12.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
netrc (0.11.0)
|
||||
newrelic_rpm (3.12.0.288)
|
||||
nokogiri (1.6.8.1)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
oauth2 (1.2.0)
|
||||
faraday (>= 0.8, < 0.10)
|
||||
jwt (~> 1.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
oj (2.1.2)
|
||||
orm_adapter (0.5.0)
|
||||
paper_trail (3.0.8)
|
||||
@@ -747,6 +757,7 @@ DEPENDENCIES
|
||||
momentjs-rails
|
||||
newrelic_rpm
|
||||
nokogiri (>= 1.6.7.1)
|
||||
oauth2 (~> 1.2.0)
|
||||
ofn-qz!
|
||||
oj
|
||||
paper_trail (~> 3.0.8)
|
||||
|
||||
@@ -38,6 +38,22 @@ class EnterprisesController < BaseController
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def stripe_connect
|
||||
if params["code"]
|
||||
# Get the deets from Stripe
|
||||
|
||||
stripe_account = StripeAccount.new(stripe_user_id: params["stripe_user_id"], stripe_publishable_key: params["stripe_publishable_key"], enterprise: self)
|
||||
if stripe_account.save
|
||||
render_json stripe_account
|
||||
else
|
||||
render text "Failed to save Stripe token", status: 500
|
||||
end
|
||||
else
|
||||
render text params["error_description"], status: 500
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def clean_permalink
|
||||
|
||||
@@ -42,6 +42,7 @@ class Enterprise < ActiveRecord::Base
|
||||
has_many :billable_periods
|
||||
has_many :inventory_items
|
||||
has_many :tag_rules
|
||||
has_many :stripe_accounts
|
||||
|
||||
delegate :latitude, :longitude, :city, :state_name, :to => :address
|
||||
|
||||
@@ -365,6 +366,7 @@ class Enterprise < ActiveRecord::Base
|
||||
abn.present?
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
def devise_mailer
|
||||
|
||||
@@ -65,6 +65,8 @@ Openfoodnetwork::Application.routes.draw do
|
||||
post 'embedded_shopfront/enable', to: 'application#enable_embedded_styles'
|
||||
post 'embedded_shopfront/disable', to: 'application#disable_embedded_styles'
|
||||
|
||||
get '/stripe/callback', :to => 'enterprise#stripe_connect'
|
||||
|
||||
resources :enterprises do
|
||||
collection do
|
||||
post :search
|
||||
|
||||
Reference in New Issue
Block a user