bullet_train-integrations-stripe 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/app/assets/config/bullet_train_integrations_stripe_manifest.js +0 -0
- data/app/controllers/account/integrations/stripe_installations_controller.rb +80 -0
- data/app/controllers/account/oauth/stripe_accounts_controller.rb +60 -0
- data/app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb +22 -0
- data/app/models/integrations/stripe_installation.rb +29 -0
- data/app/models/oauth/stripe_account.rb +53 -0
- data/app/models/webhooks/incoming/oauth/stripe_account_webhook.rb +33 -0
- data/app/views/account/integrations/stripe_installations/_breadcrumbs.html.erb +8 -0
- data/app/views/account/integrations/stripe_installations/_form.html.erb +18 -0
- data/app/views/account/integrations/stripe_installations/_index.html.erb +59 -0
- data/app/views/account/integrations/stripe_installations/_list.html.erb +34 -0
- data/app/views/account/integrations/stripe_installations/_menu_item.html.erb +10 -0
- data/app/views/account/integrations/stripe_installations/_stripe_installation.json.jbuilder +8 -0
- data/app/views/account/integrations/stripe_installations/edit.html.erb +12 -0
- data/app/views/account/integrations/stripe_installations/index.html.erb +6 -0
- data/app/views/account/integrations/stripe_installations/index.json.jbuilder +1 -0
- data/app/views/account/integrations/stripe_installations/new.html.erb +12 -0
- data/app/views/account/integrations/stripe_installations/show.html.erb +27 -0
- data/app/views/account/integrations/stripe_installations/show.json.jbuilder +1 -0
- data/app/views/account/oauth/stripe_accounts/_breadcrumbs.html.erb +8 -0
- data/app/views/account/oauth/stripe_accounts/_form.html.erb +14 -0
- data/app/views/account/oauth/stripe_accounts/_index.html.erb +52 -0
- data/app/views/account/oauth/stripe_accounts/_menu_item.html.erb +10 -0
- data/app/views/account/oauth/stripe_accounts/_oauth_stripe_account.json.jbuilder +7 -0
- data/app/views/account/oauth/stripe_accounts/edit.html.erb +12 -0
- data/app/views/account/oauth/stripe_accounts/index.html.erb +6 -0
- data/app/views/account/oauth/stripe_accounts/index.json.jbuilder +1 -0
- data/app/views/account/oauth/stripe_accounts/show.html.erb +19 -0
- data/app/views/account/oauth/stripe_accounts/show.json.jbuilder +1 -0
- data/app/views/devise/shared/oauth/_stripe.html.erb +8 -0
- data/config/locales/en/integrations/stripe_installations.en.yml +90 -0
- data/config/locales/en/oauth/stripe_accounts.en.yml +66 -0
- data/config/routes.rb +26 -0
- data/db/migrate/20180706214509_create_oauth_stripe_accounts.rb +12 -0
- data/db/migrate/20190310235546_create_webhooks_incoming_stripe_webhooks.rb +11 -0
- data/db/migrate/20190330195809_create_webhooks_incoming_oauth_stripe_account_webhooks.rb +12 -0
- data/db/migrate/20210316215919_create_integrations_stripe_installations.rb +11 -0
- data/db/migrate/20210316220614_migrate_team_connected_oauth_stripe_accounts.rb +13 -0
- data/db/migrate/20210316220615_remove_team_id_from_oauth_stripe_account.rb +5 -0
- data/db/migrate/20210317150916_add_uid_uniqueness_to_oauth_stripe_accounts.rb +5 -0
- data/db/migrate/20211018173808_drop_webhooks_incoming_stripe_webhooks.rb +11 -0
- data/lib/bullet_train/integrations/stripe/engine.rb +8 -0
- data/lib/bullet_train/integrations/stripe/version.rb +7 -0
- data/lib/bullet_train/integrations/stripe.rb +10 -0
- data/lib/tasks/bullet_train/integrations/stripe_tasks.rake +4 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 601ccfba8cfe6ad2c8291a15d288076eae7936ac68184672cac9bc141652f181
|
4
|
+
data.tar.gz: 3b2e87456e3693a997a93f549bbb834341a4d8eabaf21367b5ec2d4e75ca80d8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b7098328420c44ed0eedd22dc400fdc29663c149d9b59131965e397a8f4cb27efba901b0e6f7433bce515abb2a8f9aa596e4b984ebdecd6418ed26b03f9ffa01
|
7
|
+
data.tar.gz: ea5411f17822836316a664c21db3ff6e170fb96747536a42617c759909d8e299762721796caa1fc233670effd5e1000f213784f406d6e1d2217728d52e4f749a
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2022 Andrew Culver
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# BulletTrain::Integrations::Stripe
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem "bullet_train-integrations-stripe"
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install bullet_train-integrations-stripe
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,80 @@
|
|
1
|
+
class Account::Integrations::StripeInstallationsController < Account::ApplicationController
|
2
|
+
account_load_and_authorize_resource :stripe_installation, through: :team, through_association: :integrations_stripe_installations
|
3
|
+
|
4
|
+
# GET /account/teams/:team_id/integrations/stripe_installations
|
5
|
+
# GET /account/teams/:team_id/integrations/stripe_installations.json
|
6
|
+
def index
|
7
|
+
# if you only want these objects shown on their parent's show page, uncomment this:
|
8
|
+
# redirect_to [:account, @team]
|
9
|
+
end
|
10
|
+
|
11
|
+
# GET /account/integrations/stripe_installations/:id
|
12
|
+
# GET /account/integrations/stripe_installations/:id.json
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
# GET /account/teams/:team_id/integrations/stripe_installations/new
|
17
|
+
def new
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /account/integrations/stripe_installations/:id/edit
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST /account/teams/:team_id/integrations/stripe_installations
|
25
|
+
# POST /account/teams/:team_id/integrations/stripe_installations.json
|
26
|
+
def create
|
27
|
+
respond_to do |format|
|
28
|
+
if @stripe_installation.save
|
29
|
+
format.html { redirect_to [:account, @team, :integrations_stripe_installations], notice: I18n.t("integrations/stripe_installations.notifications.created") }
|
30
|
+
format.json { render :show, status: :created, location: [:account, @stripe_installation] }
|
31
|
+
else
|
32
|
+
format.html { render :new, status: :unprocessable_entity }
|
33
|
+
format.json { render json: @stripe_installation.errors, status: :unprocessable_entity }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# PATCH/PUT /account/integrations/stripe_installations/:id
|
39
|
+
# PATCH/PUT /account/integrations/stripe_installations/:id.json
|
40
|
+
def update
|
41
|
+
respond_to do |format|
|
42
|
+
if @stripe_installation.update(stripe_installation_params)
|
43
|
+
format.html { redirect_to [:account, @stripe_installation], notice: I18n.t("integrations/stripe_installations.notifications.updated") }
|
44
|
+
format.json { render :show, status: :ok, location: [:account, @stripe_installation] }
|
45
|
+
else
|
46
|
+
format.html { render :edit, status: :unprocessable_entity }
|
47
|
+
format.json { render json: @stripe_installation.errors, status: :unprocessable_entity }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# DELETE /account/integrations/stripe_installations/:id
|
53
|
+
# DELETE /account/integrations/stripe_installations/:id.json
|
54
|
+
def destroy
|
55
|
+
@stripe_installation.destroy
|
56
|
+
respond_to do |format|
|
57
|
+
format.html { redirect_to params[:return_to] || [:account, @team, :integrations_stripe_installations], notice: I18n.t("integrations/stripe_installations.notifications.destroyed") }
|
58
|
+
format.json { head :no_content }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
65
|
+
def stripe_installation_params
|
66
|
+
strong_params = params.require(:integrations_stripe_installation).permit(
|
67
|
+
:name,
|
68
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
69
|
+
multiple_button_values: [],
|
70
|
+
multiple_super_select_values: [],
|
71
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
72
|
+
)
|
73
|
+
|
74
|
+
assign_checkboxes(strong_params, :multiple_button_values)
|
75
|
+
assign_select_options(strong_params, :multiple_super_select_values)
|
76
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
77
|
+
|
78
|
+
strong_params
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class Account::Oauth::StripeAccountsController < Account::ApplicationController
|
2
|
+
account_load_and_authorize_resource :stripe_account, through: :user, through_association: :oauth_stripe_accounts
|
3
|
+
|
4
|
+
# GET /account/users/:user_id/oauth/stripe_accounts
|
5
|
+
# GET /account/users/:user_id/oauth/stripe_accounts.json
|
6
|
+
def index
|
7
|
+
redirect_to [:edit, :account, @user]
|
8
|
+
end
|
9
|
+
|
10
|
+
# GET /account/oauth/stripe_accounts/:id
|
11
|
+
# GET /account/oauth/stripe_accounts/:id.json
|
12
|
+
def show
|
13
|
+
unless @stripe_account.integrations_stripe_installations.any?
|
14
|
+
redirect_to [:edit, :account, @user]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /account/users/:user_id/oauth/stripe_accounts/new
|
19
|
+
def new
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /account/oauth/stripe_accounts/:id/edit
|
23
|
+
def edit
|
24
|
+
end
|
25
|
+
|
26
|
+
# PATCH/PUT /account/oauth/stripe_accounts/:id
|
27
|
+
# PATCH/PUT /account/oauth/stripe_accounts/:id.json
|
28
|
+
def update
|
29
|
+
respond_to do |format|
|
30
|
+
if @stripe_account.update(stripe_account_params)
|
31
|
+
format.html { redirect_to [:account, @stripe_account], notice: I18n.t("oauth/stripe_accounts.notifications.updated") }
|
32
|
+
format.json { render :show, status: :ok, location: [:account, @stripe_account] }
|
33
|
+
else
|
34
|
+
format.html { render :edit, status: :unprocessable_entity }
|
35
|
+
format.json { render json: @stripe_account.errors, status: :unprocessable_entity }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# DELETE /account/oauth/stripe_accounts/:id
|
41
|
+
# DELETE /account/oauth/stripe_accounts/:id.json
|
42
|
+
def destroy
|
43
|
+
@stripe_account.update(user: nil)
|
44
|
+
respond_to do |format|
|
45
|
+
format.html { redirect_to [:account, @user, :oauth, :stripe_accounts], notice: I18n.t("oauth/stripe_accounts.notifications.destroyed") }
|
46
|
+
format.json { head :no_content }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
53
|
+
def stripe_account_params
|
54
|
+
params.require(:oauth_stripe_account).permit
|
55
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
56
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
57
|
+
|
58
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Webhooks::Incoming::Oauth::StripeAccountWebhooksController < Webhooks::Incoming::WebhooksController
|
2
|
+
def create
|
3
|
+
# we have to validate stripe webhooks based on the text content of their payload,
|
4
|
+
# so we have to do it before we convert it to json in the database.
|
5
|
+
payload = request.body.read
|
6
|
+
|
7
|
+
# this throws an exception if the signature is invalid.
|
8
|
+
Stripe::Webhook.construct_event(
|
9
|
+
payload,
|
10
|
+
request.env["HTTP_STRIPE_SIGNATURE"],
|
11
|
+
ENV["STRIPE_WEBHOOKS_ACCOUNTS_ENDPOINT_SECRET"]
|
12
|
+
)
|
13
|
+
|
14
|
+
Webhooks::Incoming::Oauth::StripeAccountWebhook.create(
|
15
|
+
data: JSON.parse(payload),
|
16
|
+
# we can mark this webhook as verified because we authenticated it earlier in this controller.
|
17
|
+
verified_at: Time.zone.now
|
18
|
+
).process_async
|
19
|
+
|
20
|
+
render json: {status: "OK"}, status: :created
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Integrations::StripeInstallation < ApplicationRecord
|
2
|
+
# 🚅 add concerns above.
|
3
|
+
|
4
|
+
belongs_to :team
|
5
|
+
belongs_to :oauth_stripe_account, class_name: "Oauth::StripeAccount"
|
6
|
+
# 🚅 add belongs_to associations above.
|
7
|
+
|
8
|
+
# 🚅 add has_many associations above.
|
9
|
+
|
10
|
+
# 🚅 add has_one associations above.
|
11
|
+
|
12
|
+
# 🚅 add scopes above.
|
13
|
+
|
14
|
+
validates :name, presence: true
|
15
|
+
# 🚅 add validations above.
|
16
|
+
|
17
|
+
# 🚅 add callbacks above.
|
18
|
+
|
19
|
+
# 🚅 add delegations above.
|
20
|
+
|
21
|
+
def process_webhook(webhook)
|
22
|
+
# consider using transactions here. if an error occurs in the processing of a webhook, it's not like user-facing
|
23
|
+
# errors on the web where they see a red screen of death. instead, sidekiq will reattempt the processing of the
|
24
|
+
# entire webhook, which means that earlier portions of your logic will be run more than once unless you're careful
|
25
|
+
# to avoid it.
|
26
|
+
end
|
27
|
+
|
28
|
+
# 🚅 add methods above.
|
29
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class Oauth::StripeAccount < ApplicationRecord
|
2
|
+
# 🚅 add concerns above.
|
3
|
+
|
4
|
+
belongs_to :user, optional: true
|
5
|
+
# 🚅 add belongs_to associations above.
|
6
|
+
|
7
|
+
has_many :webhooks_incoming_oauth_stripe_account_webhooks, class_name: "Webhooks::Incoming::Oauth::StripeAccountWebhook", foreign_key: "oauth_stripe_account_id"
|
8
|
+
has_many :integrations_stripe_installations, class_name: "Integrations::StripeInstallation", foreign_key: "oauth_stripe_account_id"
|
9
|
+
# 🚅 add has_many associations above.
|
10
|
+
|
11
|
+
# 🚅 add has_one associations above.
|
12
|
+
|
13
|
+
# 🚅 add scopes above.
|
14
|
+
|
15
|
+
validates :uid, presence: true
|
16
|
+
# 🚅 add validations above.
|
17
|
+
|
18
|
+
# 🚅 add callbacks above.
|
19
|
+
|
20
|
+
# 🚅 add delegations above.
|
21
|
+
|
22
|
+
def label_string
|
23
|
+
name
|
24
|
+
end
|
25
|
+
|
26
|
+
# TODO You should update this with an implementation appropriate for the provider you're integrating with.
|
27
|
+
# This must return _something_, otherwise new installations won't save.
|
28
|
+
def name
|
29
|
+
data.dig("info", "name").presence || "Stripe Account"
|
30
|
+
rescue
|
31
|
+
"Stripe Account"
|
32
|
+
end
|
33
|
+
|
34
|
+
def name_was
|
35
|
+
name
|
36
|
+
end
|
37
|
+
|
38
|
+
def update_from_oauth(auth)
|
39
|
+
self.uid = auth.uid
|
40
|
+
self.data = auth
|
41
|
+
save
|
42
|
+
end
|
43
|
+
|
44
|
+
# webhooks received for this account will be routed here asynchronously for processing on a worker.
|
45
|
+
def process_webhook(webhook)
|
46
|
+
# we delegate processing to any active installations.
|
47
|
+
integrations_stripe_installations.order(:id).each do |installation|
|
48
|
+
installation.process_webhook(webhook)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# 🚅 add methods above.
|
53
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Webhooks::Incoming::Oauth::StripeAccountWebhook < ApplicationRecord
|
2
|
+
include Webhooks::Incoming::Webhook
|
3
|
+
|
4
|
+
belongs_to :oauth_stripe_account, class_name: "Oauth::StripeAccount", optional: true
|
5
|
+
|
6
|
+
def process
|
7
|
+
# if this is a stripe connect webhook ..
|
8
|
+
if data["account"]
|
9
|
+
|
10
|
+
# if we're able to find an account in our system that this webhook should be routed to ..
|
11
|
+
if (self.oauth_stripe_account = Oauth::StripeAccount.find_by(uid: data["account"]))
|
12
|
+
|
13
|
+
# save the reference to the account.
|
14
|
+
save
|
15
|
+
|
16
|
+
# delegate processing to that account.
|
17
|
+
oauth_stripe_account.process_webhook(self)
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
# if we didn't find an account for the webhook, they've probably deleted their account. we'll just ignore it for
|
22
|
+
# now, but it's still in our database for debugging purposes. we'll probably want to send a request to stripe
|
23
|
+
# in order to disconnect their account from our application so we stop receiving webhooks.
|
24
|
+
|
25
|
+
else
|
26
|
+
|
27
|
+
# it's possible we're receiving a general webhook that isn't specific to an account.
|
28
|
+
# however, we want to know about these, so raise an error.
|
29
|
+
raise "received a webhook we weren't expecting"
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% stripe_installation ||= @stripe_installation %>
|
2
|
+
<% team ||= @team || stripe_installation&.team %>
|
3
|
+
<%= render 'account/teams/breadcrumbs', team: team %>
|
4
|
+
<%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, team, :integrations_stripe_installations] %>
|
5
|
+
<% if stripe_installation&.persisted? %>
|
6
|
+
<%= render 'account/shared/breadcrumb', label: stripe_installation.label_string, url: [:account, stripe_installation] %>
|
7
|
+
<% end %>
|
8
|
+
<%= render 'account/shared/breadcrumbs/actions', only_for: 'integrations/stripe_installations' %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= form_with model: stripe_installation, url: (stripe_installation.persisted? ? [:account, stripe_installation] : [:account, @team, :integrations_stripe_installations]), local: true, class: 'form' do |form| %>
|
2
|
+
<%= render 'account/shared/forms/errors', form: form %>
|
3
|
+
|
4
|
+
<% with_field_settings form: form do %>
|
5
|
+
<%= render 'shared/fields/text_field', method: :name, options: {autofocus: true} %>
|
6
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<div class="buttons">
|
10
|
+
<%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
|
11
|
+
<% if form.object.persisted? %>
|
12
|
+
<%= link_to t('global.buttons.cancel'), [:account, stripe_installation], class: "button-secondary" %>
|
13
|
+
<% else %>
|
14
|
+
<%= link_to t('global.buttons.cancel'), [:account, @team, :integrations_stripe_installations], class: "button-secondary" %>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% end %>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<% team = @team || @team %>
|
2
|
+
<% context ||= team %>
|
3
|
+
<% collection ||= :integrations_stripe_installations %>
|
4
|
+
<% hide_actions ||= false %>
|
5
|
+
<% hide_back ||= false %>
|
6
|
+
|
7
|
+
<%= render 'account/shared/box' do |p| %>
|
8
|
+
<% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
|
9
|
+
<% p.content_for :description do %>
|
10
|
+
<%= t(".contexts.#{context.class.name.underscore}.description") %>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% p.content_for :body do %>
|
14
|
+
<% if stripe_installations.any? %>
|
15
|
+
<div class="space-y-0 border border-gray-200 shadow-sm rounded-md divide-y divide-gray-200">
|
16
|
+
<% stripe_installations.each do |stripe_installation| %>
|
17
|
+
<div class="flex py-1.5 px-3 items-center">
|
18
|
+
<div class="flex-1 min-w-0">
|
19
|
+
<%= stripe_installation.name %>
|
20
|
+
</div>
|
21
|
+
<div class="flex flex-0 min-w-0 space-x-2 items-center">
|
22
|
+
<% if can? :edit, stripe_installation %>
|
23
|
+
<%= link_to t('.buttons.shorthand.edit'), [:edit, :account, stripe_installation], class: 'button-secondary button-smaller' %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<% if can? :destroy, stripe_installation %>
|
27
|
+
<%= link_to [:account, stripe_installation, return_to: request.path], method: :delete, data: { confirm: t('.buttons.confirmations.destroy_from_user', team_name: stripe_installation.team.label_string) }, class: 'inline-block text-gray-300 hover:text-gray-400 hover:no-underline text-lg' do %>
|
28
|
+
<i class="ti ti-close"></i>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<% p.content_for :actions do %>
|
39
|
+
<% unless hide_actions %>
|
40
|
+
<% if context == team %>
|
41
|
+
<% if can? :create, Integrations::StripeInstallation.new(team: team) %>
|
42
|
+
<span data-turbo="false">
|
43
|
+
<%= button_to user_stripe_connect_omniauth_authorize_path(team_id: team.id), class: "#{first_button_primary(:integrations_stripe_installation)} new" do %>
|
44
|
+
<%= t('.buttons.new') %>
|
45
|
+
<% end %>
|
46
|
+
</span>
|
47
|
+
<% end %>
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
<% unless hide_back %>
|
51
|
+
<%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary(:integrations_stripe_installation)} back" %>
|
52
|
+
<% end %>
|
53
|
+
<% end %>
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
<% p.content_for :footer do %>
|
57
|
+
<%= raw t(".contexts.team.authentication_note", authentication_url: url_for([:edit, :account, current_user])) %>
|
58
|
+
<% end %>
|
59
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<% context ||= @user %>
|
2
|
+
<% collection ||= :integrations_stripe_installations %>
|
3
|
+
|
4
|
+
<%= render 'account/shared/box' do |p| %>
|
5
|
+
<% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
|
6
|
+
<% p.content_for :description do %>
|
7
|
+
<%= t(".contexts.#{context.class.name.underscore}.description") %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% p.content_for :body do %>
|
11
|
+
<% if stripe_installations.any? %>
|
12
|
+
<div class="space-y-0 border border-gray-200 shadow-sm rounded-md divide-y divide-gray-200">
|
13
|
+
<% stripe_installations.each do |stripe_installation| %>
|
14
|
+
<div class="flex py-1.5 px-3 items-center">
|
15
|
+
<div class="flex-1 min-w-0">
|
16
|
+
<% if can? :show, stripe_installation.team %>
|
17
|
+
<%= link_to stripe_installation.team.name, [:account, stripe_installation.team, :integrations, :stripe_installations] %>
|
18
|
+
<% else %>
|
19
|
+
<%= stripe_installation.team.name %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
<div class="flex-0 min-w-0 space-x-2 text-lg">
|
23
|
+
<% if can? :destroy, stripe_installation %>
|
24
|
+
<%= link_to [:account, stripe_installation, return_to: request.path], method: :delete, data: { confirm: t('.buttons.confirmations.destroy_from_user', team_name: stripe_installation.team.label_string) }, class: 'inline-block text-gray-300 hover:text-gray-400 hover:no-underline' do %>
|
25
|
+
<i class="ti ti-close"></i>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if can? :read, Integrations::StripeInstallation.new(team: current_team) %>
|
2
|
+
<%= render 'account/shared/menu/item', {
|
3
|
+
url: main_app.polymorphic_path([:account, current_team, :integrations_stripe_installations]),
|
4
|
+
label: t('integrations/stripe_installations.navigation.label'),
|
5
|
+
} do |p| %>
|
6
|
+
<% p.content_for :icon do %>
|
7
|
+
<i class="<%= t('integrations/stripe_installations.navigation.icon') %>"></i>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= render 'account/shared/box', divider: true do |p| %>
|
5
|
+
<% p.content_for :title, t('.header') %>
|
6
|
+
<% p.content_for :description, t('.description') %>
|
7
|
+
<% p.content_for :body do %>
|
8
|
+
<%= render 'form', stripe_installation: @stripe_installation %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.array! @stripe_installations, partial: "integrations/stripe_installations/stripe_installation", as: :stripe_installation
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= render 'account/shared/box', divider: true do |p| %>
|
5
|
+
<% p.content_for :title, t('.header') %>
|
6
|
+
<% p.content_for :description, t('.description') %>
|
7
|
+
<% p.content_for :body do %>
|
8
|
+
<%= render 'form', stripe_installation: @stripe_installation %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= render 'account/shared/box', divider: true do |p| %>
|
5
|
+
<% p.content_for :title, t('.header') %>
|
6
|
+
<% p.content_for :description do %>
|
7
|
+
<%= t('.description') %>
|
8
|
+
<%= t('.manage_description') if can? :manage, @stripe_installation %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% p.content_for :body do %>
|
12
|
+
<% with_attribute_settings object: @stripe_installation, strategy: :label do %>
|
13
|
+
<%= render 'shared/attributes/text', attribute: :name %>
|
14
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% p.content_for :actions do %>
|
19
|
+
<%= link_to t('.buttons.edit'), [:edit, :account, @stripe_installation], class: first_button_primary if can? :edit, @stripe_installation %>
|
20
|
+
<%= button_to t('.buttons.destroy'), [:account, @stripe_installation], method: :delete, class: first_button_primary, data: { confirm: t('.buttons.confirmations.destroy', model_locales(@stripe_installation)) } if can? :destroy, @stripe_installation %>
|
21
|
+
<%= link_to t('global.buttons.back'), [:account, @team, :integrations_stripe_installations], class: first_button_primary %>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%# 🚅 super scaffolding will insert new children above this line. %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! "integrations/stripe_installations/stripe_installation", stripe_installation: @stripe_installation
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% stripe_account ||= @stripe_account %>
|
2
|
+
<% user ||= @user || stripe_account&.user %>
|
3
|
+
<%= render 'account/users/breadcrumbs', user: user %>
|
4
|
+
<%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, user, :oauth, :stripe_accounts] %>
|
5
|
+
<% if stripe_account&.persisted? %>
|
6
|
+
<%= render 'account/shared/breadcrumb', label: stripe_account.label_string, url: [:account, stripe_account] %>
|
7
|
+
<% end %>
|
8
|
+
<%= render 'account/shared/breadcrumbs/actions', only_for: 'oauth/stripe_accounts' %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%= form_with model: [:account, (@user unless stripe_account.persisted?), stripe_account], local: true, class: 'form' do |form| %>
|
2
|
+
<%= render 'account/shared/forms/errors', form: form %>
|
3
|
+
|
4
|
+
<%= render 'account/shared/alert' do %>
|
5
|
+
There are no configurable settings for this Stripe accounts by default, but you might want to add some!
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
9
|
+
|
10
|
+
<div class="buttons">
|
11
|
+
<%= form.submit 'Save Settings', class: "button" %>
|
12
|
+
<%= link_to 'Cancel', [:account, stripe_account], class: "button-secondary" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<% context ||= @user %>
|
2
|
+
<% hide_actions ||= false %>
|
3
|
+
|
4
|
+
<%= render 'account/shared/box' do |p| %>
|
5
|
+
<% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
|
6
|
+
<% p.content_for :description do %>
|
7
|
+
<%= raw t(".contexts.#{context.class.name.underscore}.#{stripe_accounts.any? ? 'description' : 'description_empty'}") %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% p.content_for :body do %>
|
11
|
+
<% if stripe_accounts.any? %>
|
12
|
+
<div class="space-y-0 border border-gray-200 shadow-sm rounded-md divide-y divide-gray-200">
|
13
|
+
<% stripe_accounts.each do |stripe_account| %>
|
14
|
+
<div class="flex py-1.5 px-3 items-center">
|
15
|
+
<div class="flex-1 min-w-0">
|
16
|
+
<% if stripe_account.integrations_stripe_installations.any? %>
|
17
|
+
<%= link_to stripe_account.name, [:account, stripe_account] %>
|
18
|
+
<% else %>
|
19
|
+
<%= stripe_account.name %>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
<div class="flex-0 min-w-0 space-x-2 text-lg">
|
23
|
+
<% if can? :destroy, stripe_account %>
|
24
|
+
<%= link_to [:account, stripe_account], method: :delete, data: { confirm: t('.buttons.confirmations.destroy', model_locales(stripe_account)) }, class: 'inline-block text-gray-300 hover:text-gray-400 hover:no-underline' do %>
|
25
|
+
<i class="ti ti-close"></i>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
<% end %>
|
34
|
+
|
35
|
+
<% unless hide_actions %>
|
36
|
+
<% p.content_for :actions do %>
|
37
|
+
<% if can? :create, Oauth::StripeAccount.new(user: @user) %>
|
38
|
+
<span data-turbo="false">
|
39
|
+
<%= button_to user_stripe_connect_omniauth_authorize_path, class: "#{first_button_primary(:integrations_stripe_installation)} new" do %>
|
40
|
+
<%= stripe_accounts.empty? ? t('.buttons.new') : t('.buttons.another') %>
|
41
|
+
<% end %>
|
42
|
+
</span>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
<% p.content_for :footer do %>
|
48
|
+
<% if current_team %>
|
49
|
+
<%= raw t(".contexts.user.integration_note", integration_url: url_for([:account, current_team, :integrations_stripe_installations])) %>
|
50
|
+
<% end %>
|
51
|
+
<% end %>
|
52
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if can? :read, Oauth::StripeAccount.new(user: current_user) %>
|
2
|
+
<%= render 'account/shared/menu/item', {
|
3
|
+
url: main_app.polymorphic_path([:account, current_user, :oauth_stripe_accounts]),
|
4
|
+
label: t('oauth/stripe_accounts.navigation.label'),
|
5
|
+
} do |p| %>
|
6
|
+
<% p.content_for :icon do %>
|
7
|
+
<i class="<%= t('oauth/stripe_accounts.navigation.icon') %>"></i>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= render 'account/shared/box', divider: true do |p| %>
|
5
|
+
<% p.content_for :title, t('.header') %>
|
6
|
+
<% p.content_for :description, t('.description') %>
|
7
|
+
<% p.content_for :body do %>
|
8
|
+
<%= render 'form', stripe_account: @stripe_account %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.array! @oauth_stripe_accounts, partial: "oauth/stripe_accounts/oauth_stripe_account", as: :oauth_stripe_account
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= render 'account/shared/box' do |p| %>
|
5
|
+
<% p.content_for :title, t('.header') %>
|
6
|
+
<% p.content_for :description, t('.description') %>
|
7
|
+
|
8
|
+
<% p.content_for :actions do %>
|
9
|
+
<%= link_to t('.buttons.edit'), [:edit, :account, @stripe_account], class: first_button_primary if can? :edit, @stripe_account %>
|
10
|
+
<%= button_to t('.buttons.destroy'), [:account, @stripe_account], method: :delete, class: first_button_primary, data: { confirm: t('.buttons.confirmations.destroy', model_locales(@stripe_account)) } if can? :destroy, @stripe_account %>
|
11
|
+
<%= link_to t('global.buttons.back'), [:account, @user, :oauth_stripe_accounts], class: first_button_primary %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= render 'account/integrations/stripe_installations/list', context: @user, stripe_installations: @stripe_account.integrations_stripe_installations %>
|
16
|
+
<%# 🚅 super scaffolding will insert new children above this line. %>
|
17
|
+
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! "oauth_stripe_accounts/oauth_stripe_account", oauth_stripe_account: @oauth_stripe_account
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div>
|
2
|
+
<%= button_to user_stripe_connect_omniauth_authorize_path, class: 'button-alternative block w-full', form_class: 'block w-full', id: 'sign_in_with_stripe' do %>
|
3
|
+
<div class="full">
|
4
|
+
<i class="text-lg leading-5 mr-3 <%= t('oauth/stripe_accounts.navigation.icon') %>"></i>
|
5
|
+
<span class="group-hover:underline"><%= verb %> with Stripe</span>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
en:
|
2
|
+
integrations/stripe_installations: &stripe_installations
|
3
|
+
label: &label Stripe Installations
|
4
|
+
breadcrumbs:
|
5
|
+
label: *label
|
6
|
+
navigation:
|
7
|
+
label: *label
|
8
|
+
icon: fab fa-stripe-s ti ti-money
|
9
|
+
buttons: &buttons
|
10
|
+
new: Add New Stripe Installation
|
11
|
+
create: Create Stripe Installation
|
12
|
+
edit: Edit Stripe Settings
|
13
|
+
update: Update Installation Settings
|
14
|
+
destroy: Remove Stripe Installation
|
15
|
+
shorthand:
|
16
|
+
edit: Settings
|
17
|
+
destroy: Delete
|
18
|
+
confirmations:
|
19
|
+
# TODO customize for your use-case.
|
20
|
+
destroy: Are you sure you want to disconnect %{stripe_installation_name} from %{team_name}? This won't remove this Stripe account from any connections it has to a user account for single sign-on. This will remove any data associated with this installation on %{team_name}. This can't be undone.
|
21
|
+
destroy_from_user: Are you sure you want to disconnect this Stripe account from %{team_name}? This will remove any data associated with this installation on %{team_name}. This can't be undone.
|
22
|
+
fields: &fields
|
23
|
+
name:
|
24
|
+
_: &name Name
|
25
|
+
label: *name
|
26
|
+
heading: *name
|
27
|
+
|
28
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
29
|
+
created_at:
|
30
|
+
_: &created_at Added
|
31
|
+
label: *created_at
|
32
|
+
heading: *created_at
|
33
|
+
updated_at:
|
34
|
+
_: &updated_at Updated
|
35
|
+
label: *updated_at
|
36
|
+
heading: *updated_at
|
37
|
+
list:
|
38
|
+
section: "Stripe Installations"
|
39
|
+
contexts:
|
40
|
+
user:
|
41
|
+
header: Integration Installations
|
42
|
+
description: Since you are the registered owner of this Stripe account, you have the ability to disconnect it from any Teams where it's currently installed as an integration.
|
43
|
+
description_empty: This Stripe account hasn't been installed as an integration on any Teams.
|
44
|
+
authentication_note: "You can also <a href=\"%{authentication_url}\">connect and manage Stripe accounts for single sign-on authentication</a>."
|
45
|
+
fields: *fields
|
46
|
+
buttons: *buttons
|
47
|
+
index:
|
48
|
+
section: "%{teams_possessive} Stripe Installations"
|
49
|
+
contexts:
|
50
|
+
team:
|
51
|
+
header: Stripe Installations
|
52
|
+
description: Below is a list of Stripe Installations that have been added for %{team_name}.
|
53
|
+
description_empty: No Stripe Installations have been added for %{team_name}.
|
54
|
+
authentication_note: "You can also <a href=\"%{authentication_url}\">connect and manage Stripe accounts for single sign-on authentication</a>."
|
55
|
+
fields: *fields
|
56
|
+
buttons: *buttons
|
57
|
+
show:
|
58
|
+
section: "%{stripe_installation_name}"
|
59
|
+
header: Stripe Installation Details
|
60
|
+
description: Below are the details we have for %{stripe_installation_name}.
|
61
|
+
manage_description: You'll also find options for updating these details or removing %{stripe_installation_name} from %{team_name} entirely.
|
62
|
+
fields: *fields
|
63
|
+
buttons: *buttons
|
64
|
+
form: &form
|
65
|
+
buttons: *buttons
|
66
|
+
fields: *fields
|
67
|
+
new:
|
68
|
+
section: "New Stripe Installation for %{team_name}"
|
69
|
+
header: New Stripe Installation Details
|
70
|
+
description: Please provide the details of the new Stripe Installation you'd like to add to %{team_name}.
|
71
|
+
form: *form
|
72
|
+
edit:
|
73
|
+
section: "%{stripe_installation_name}"
|
74
|
+
header: Edit Stripe Installation Details
|
75
|
+
description: You can update the details or settings for %{stripe_installation_name} below.
|
76
|
+
form: *form
|
77
|
+
notifications:
|
78
|
+
created: Stripe Installation was successfully created.
|
79
|
+
updated: Stripe Installation was successfully updated.
|
80
|
+
destroyed: Stripe Installation was successfully removed.
|
81
|
+
account:
|
82
|
+
integrations:
|
83
|
+
stripe_installations: *stripe_installations
|
84
|
+
activerecord:
|
85
|
+
attributes:
|
86
|
+
integrations/stripe_installation:
|
87
|
+
name: *name
|
88
|
+
# 🚅 super scaffolding will insert new activerecord attributes above this line.
|
89
|
+
created_at: *created_at
|
90
|
+
updated_at: *updated_at
|
@@ -0,0 +1,66 @@
|
|
1
|
+
en:
|
2
|
+
oauth/stripe_accounts: &stripe_accounts
|
3
|
+
label: &label Stripe Accounts
|
4
|
+
breadcrumbs:
|
5
|
+
label: *label
|
6
|
+
navigation:
|
7
|
+
label: *label
|
8
|
+
icon: fab fa-stripe-s ti ti-money
|
9
|
+
buttons: &buttons
|
10
|
+
new: Connect Stripe Account
|
11
|
+
another: Connect Another Stripe Account
|
12
|
+
edit: Settings
|
13
|
+
update: Save Settings
|
14
|
+
destroy: Disconnect
|
15
|
+
shorthand:
|
16
|
+
edit: Settings
|
17
|
+
destroy: Disconnect
|
18
|
+
confirmations:
|
19
|
+
# TODO customize for your use-case.
|
20
|
+
destroy: Are you sure you want to disconnect the %{stripe_account_name} Stripe account from your user account? This will only disconnect it for use as a single-sign on option. It may still be connected as an integration elsewhere.
|
21
|
+
fields: &fields
|
22
|
+
name:
|
23
|
+
name: &name Name
|
24
|
+
label: *name
|
25
|
+
heading: *name
|
26
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
27
|
+
created_at:
|
28
|
+
name: &created_at Connected
|
29
|
+
heading: *created_at
|
30
|
+
index:
|
31
|
+
section: '%{users_possessive} Stripe Accounts'
|
32
|
+
contexts:
|
33
|
+
user:
|
34
|
+
header: Connected Stripe Accounts
|
35
|
+
description: You can sign into your account with any of the following Stripe Accounts. You can also manage where these accounts are used as integrations.
|
36
|
+
description_empty: "You can connect a Stripe account to your user account for single sign-on below."
|
37
|
+
integration_note: "You can also <a href=\"%{integration_url}\">install Stripe as an integration</a>."
|
38
|
+
fields: *fields
|
39
|
+
buttons: *buttons
|
40
|
+
show:
|
41
|
+
section: "%{stripe_account_name}"
|
42
|
+
header: Connected Stripe Account
|
43
|
+
description: "Your %{stripe_account_name} Stripe account is currently connected for single sign-on authentication."
|
44
|
+
fields: *fields
|
45
|
+
buttons: *buttons
|
46
|
+
form: &form
|
47
|
+
buttons: *buttons
|
48
|
+
fields: *fields
|
49
|
+
edit:
|
50
|
+
section: "%{stripe_account_name}"
|
51
|
+
header: Stripe Account Settings
|
52
|
+
description: You may not need this page if your Stripe integration doesn't have any configurable settings, but we leave the page here by default in case you need it.
|
53
|
+
form: *form
|
54
|
+
notifications:
|
55
|
+
created: Great! We've added that Stripe account to your account!
|
56
|
+
updated: Stripe account settings were successfully updated.
|
57
|
+
destroyed: We've disconnected that Stripe account from your account.
|
58
|
+
account:
|
59
|
+
oauth:
|
60
|
+
stripe_accounts: *stripe_accounts
|
61
|
+
activerecord:
|
62
|
+
attributes:
|
63
|
+
oauth/stripe_account:
|
64
|
+
name: *name
|
65
|
+
# 🚅 super scaffolding will insert new activerecord attributes above this line.
|
66
|
+
created_at: *created_at
|
data/config/routes.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
namespace :webhooks do
|
3
|
+
namespace :incoming do
|
4
|
+
namespace :oauth do
|
5
|
+
resources :stripe_account_webhooks
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :account do
|
11
|
+
shallow do
|
12
|
+
# user specific resources.
|
13
|
+
resources :users do
|
14
|
+
namespace :oauth do
|
15
|
+
resources :stripe_accounts
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
resources :teams do
|
20
|
+
namespace :integrations do
|
21
|
+
resources :stripe_installations
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateOauthStripeAccounts < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :oauth_stripe_accounts do |t|
|
4
|
+
t.string :uid
|
5
|
+
t.jsonb :data
|
6
|
+
t.references :team, foreign_key: true
|
7
|
+
t.references :user, foreign_key: true
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateWebhooksIncomingOauthStripeAccountWebhooks < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :webhooks_incoming_oauth_stripe_account_webhooks do |t|
|
4
|
+
t.jsonb :data
|
5
|
+
t.datetime :processed_at
|
6
|
+
t.datetime :verified_at
|
7
|
+
t.references :oauth_stripe_account, optional: true, index: {name: "index_stripe_webhooks_on_stripe_account_id"}
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateIntegrationsStripeInstallations < ActiveRecord::Migration[6.1]
|
2
|
+
def change
|
3
|
+
create_table :integrations_stripe_installations do |t|
|
4
|
+
t.references :team, null: false, foreign_key: true
|
5
|
+
t.references :oauth_stripe_account, null: false, foreign_key: true, index: {name: "index_stripe_installations_on_stripe_account_id"}
|
6
|
+
t.string :name
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class MigrateTeamConnectedOauthStripeAccounts < ActiveRecord::Migration[6.1]
|
2
|
+
def up
|
3
|
+
Oauth::StripeAccount.find_each do |oauth_stripe_account|
|
4
|
+
if (team = oauth_stripe_account.team)
|
5
|
+
team.integrations_stripe_installations.find_or_create_by(oauth_stripe_account: oauth_stripe_account)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
raise ActiveRecord::IrreversibleMigration
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bullet_train-integrations-stripe
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Culver
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 7.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 7.0.0
|
27
|
+
description: Example Stripe platform integration for Bullet Train applications.
|
28
|
+
email:
|
29
|
+
- andrew.culver@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- app/assets/config/bullet_train_integrations_stripe_manifest.js
|
38
|
+
- app/controllers/account/integrations/stripe_installations_controller.rb
|
39
|
+
- app/controllers/account/oauth/stripe_accounts_controller.rb
|
40
|
+
- app/controllers/webhooks/incoming/oauth/stripe_account_webhooks_controller.rb
|
41
|
+
- app/models/integrations/stripe_installation.rb
|
42
|
+
- app/models/oauth/stripe_account.rb
|
43
|
+
- app/models/webhooks/incoming/oauth/stripe_account_webhook.rb
|
44
|
+
- app/views/account/integrations/stripe_installations/_breadcrumbs.html.erb
|
45
|
+
- app/views/account/integrations/stripe_installations/_form.html.erb
|
46
|
+
- app/views/account/integrations/stripe_installations/_index.html.erb
|
47
|
+
- app/views/account/integrations/stripe_installations/_list.html.erb
|
48
|
+
- app/views/account/integrations/stripe_installations/_menu_item.html.erb
|
49
|
+
- app/views/account/integrations/stripe_installations/_stripe_installation.json.jbuilder
|
50
|
+
- app/views/account/integrations/stripe_installations/edit.html.erb
|
51
|
+
- app/views/account/integrations/stripe_installations/index.html.erb
|
52
|
+
- app/views/account/integrations/stripe_installations/index.json.jbuilder
|
53
|
+
- app/views/account/integrations/stripe_installations/new.html.erb
|
54
|
+
- app/views/account/integrations/stripe_installations/show.html.erb
|
55
|
+
- app/views/account/integrations/stripe_installations/show.json.jbuilder
|
56
|
+
- app/views/account/oauth/stripe_accounts/_breadcrumbs.html.erb
|
57
|
+
- app/views/account/oauth/stripe_accounts/_form.html.erb
|
58
|
+
- app/views/account/oauth/stripe_accounts/_index.html.erb
|
59
|
+
- app/views/account/oauth/stripe_accounts/_menu_item.html.erb
|
60
|
+
- app/views/account/oauth/stripe_accounts/_oauth_stripe_account.json.jbuilder
|
61
|
+
- app/views/account/oauth/stripe_accounts/edit.html.erb
|
62
|
+
- app/views/account/oauth/stripe_accounts/index.html.erb
|
63
|
+
- app/views/account/oauth/stripe_accounts/index.json.jbuilder
|
64
|
+
- app/views/account/oauth/stripe_accounts/show.html.erb
|
65
|
+
- app/views/account/oauth/stripe_accounts/show.json.jbuilder
|
66
|
+
- app/views/devise/shared/oauth/_stripe.html.erb
|
67
|
+
- config/locales/en/integrations/stripe_installations.en.yml
|
68
|
+
- config/locales/en/oauth/stripe_accounts.en.yml
|
69
|
+
- config/routes.rb
|
70
|
+
- db/migrate/20180706214509_create_oauth_stripe_accounts.rb
|
71
|
+
- db/migrate/20190310235546_create_webhooks_incoming_stripe_webhooks.rb
|
72
|
+
- db/migrate/20190330195809_create_webhooks_incoming_oauth_stripe_account_webhooks.rb
|
73
|
+
- db/migrate/20210316215919_create_integrations_stripe_installations.rb
|
74
|
+
- db/migrate/20210316220614_migrate_team_connected_oauth_stripe_accounts.rb
|
75
|
+
- db/migrate/20210316220615_remove_team_id_from_oauth_stripe_account.rb
|
76
|
+
- db/migrate/20210317150916_add_uid_uniqueness_to_oauth_stripe_accounts.rb
|
77
|
+
- db/migrate/20211018173808_drop_webhooks_incoming_stripe_webhooks.rb
|
78
|
+
- lib/bullet_train/integrations/stripe.rb
|
79
|
+
- lib/bullet_train/integrations/stripe/engine.rb
|
80
|
+
- lib/bullet_train/integrations/stripe/version.rb
|
81
|
+
- lib/tasks/bullet_train/integrations/stripe_tasks.rake
|
82
|
+
homepage: https://github.com/bullet-train-co/bullet_train-integrations-stripe
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata:
|
86
|
+
homepage_uri: https://github.com/bullet-train-co/bullet_train-integrations-stripe
|
87
|
+
source_code_uri: https://github.com/bullet-train-co/bullet_train-integrations-stripe
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubygems_version: 3.2.22
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Example Stripe platform integration for Bullet Train applications.
|
107
|
+
test_files: []
|