saas_payments 0.0.2
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 +146 -0
- data/Rakefile +32 -0
- data/app/assets/config/saas_payments_manifest.js +2 -0
- data/app/assets/javascripts/saas_payments/application.js +15 -0
- data/app/assets/javascripts/saas_payments/elements.js +146 -0
- data/app/assets/stylesheets/saas_payments/application.css +15 -0
- data/app/assets/stylesheets/saas_payments/elements.css +31 -0
- data/app/controllers/concerns/saas_payments/subscription_concerns.rb +173 -0
- data/app/controllers/concerns/saas_payments/webhook_concerns.rb +22 -0
- data/app/controllers/saas_payments/application_controller.rb +17 -0
- data/app/controllers/saas_payments/webhook_controller.rb +10 -0
- data/app/helpers/saas_payments/application_helper.rb +4 -0
- data/app/jobs/saas_payments/application_job.rb +4 -0
- data/app/lib/saas_payments/products_service.rb +25 -0
- data/app/lib/saas_payments/webhook/customer_event.rb +29 -0
- data/app/lib/saas_payments/webhook/plan_event.rb +25 -0
- data/app/lib/saas_payments/webhook/product_event.rb +25 -0
- data/app/lib/saas_payments/webhook/session_event.rb +6 -0
- data/app/lib/saas_payments/webhook/subscription_event.rb +25 -0
- data/app/lib/saas_payments/webhook_service.rb +39 -0
- data/app/mailers/saas_payments/application_mailer.rb +6 -0
- data/app/models/concerns/saas_payments/stripe_model.rb +32 -0
- data/app/models/saas_payments/application_record.rb +5 -0
- data/app/models/saas_payments/customer.rb +42 -0
- data/app/models/saas_payments/plan.rb +28 -0
- data/app/models/saas_payments/product.rb +24 -0
- data/app/models/saas_payments/subscription.rb +31 -0
- data/app/views/saas_payments/_scripts.html.erb +5 -0
- data/app/views/saas_payments/_stripe_elements.html.erb +26 -0
- data/config/initializers/stripe.rb +0 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20190818184232_create_saas_payments_subscriptions.rb +28 -0
- data/db/migrate/20190820040835_create_saas_payments_products.rb +19 -0
- data/db/migrate/20190820040959_create_saas_payments_plans.rb +25 -0
- data/db/migrate/20190823023237_create_saas_payments_customers.rb +19 -0
- data/lib/saas_payments.rb +15 -0
- data/lib/saas_payments/config.rb +9 -0
- data/lib/saas_payments/engine.rb +18 -0
- data/lib/saas_payments/errors.rb +3 -0
- data/lib/saas_payments/version.rb +3 -0
- data/lib/tasks/products.rake +6 -0
- data/lib/tasks/saas_payments_tasks.rake +4 -0
- metadata +184 -0
File without changes
|
data/config/routes.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
class CreateSaasPaymentsSubscriptions < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :saas_payments_subscriptions do |t|
|
4
|
+
# String ids from stripe
|
5
|
+
t.string :plan_id
|
6
|
+
t.string :customer_id
|
7
|
+
t.string :stripe_id
|
8
|
+
|
9
|
+
t.datetime :cancel_at
|
10
|
+
t.datetime :canceled_at
|
11
|
+
t.datetime :current_period_end
|
12
|
+
t.datetime :current_period_start
|
13
|
+
t.boolean :cancel_at_period_end
|
14
|
+
t.boolean :livemode
|
15
|
+
t.text :metadata
|
16
|
+
t.datetime :start
|
17
|
+
t.datetime :start_date
|
18
|
+
t.string :status
|
19
|
+
t.datetime :trial_end
|
20
|
+
t.datetime :trial_start
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index :saas_payments_subscriptions, :stripe_id, unique: true
|
26
|
+
add_index :saas_payments_subscriptions, :customer_id
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateSaasPaymentsProducts < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :saas_payments_products do |t|
|
4
|
+
t.string :stripe_id
|
5
|
+
|
6
|
+
t.boolean :active
|
7
|
+
t.string :caption
|
8
|
+
t.boolean :livemode
|
9
|
+
t.text :metadata
|
10
|
+
t.string :name
|
11
|
+
t.string :type
|
12
|
+
t.string :unit_label
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :saas_payments_products, :stripe_id, unique: true
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateSaasPaymentsPlans < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :saas_payments_plans do |t|
|
4
|
+
# String ids from stripe
|
5
|
+
t.string :stripe_id
|
6
|
+
t.string :product_id
|
7
|
+
|
8
|
+
t.boolean :active
|
9
|
+
t.integer :amount
|
10
|
+
t.string :amount_decimal
|
11
|
+
t.string :currency
|
12
|
+
t.string :interval
|
13
|
+
t.integer :interval_count
|
14
|
+
t.boolean :livemode
|
15
|
+
t.text :metadata # hash
|
16
|
+
t.string :nickname
|
17
|
+
t.integer :trial_period_days
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
|
22
|
+
add_index :saas_payments_plans, :stripe_id, unique: true
|
23
|
+
add_index :saas_payments_plans, [:stripe_id, :product_id], unique: true
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateSaasPaymentsCustomers < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
create_table :saas_payments_customers do |t|
|
4
|
+
t.belongs_to :user
|
5
|
+
t.string :stripe_id
|
6
|
+
t.boolean :delinquent
|
7
|
+
t.string :description
|
8
|
+
t.text :discount
|
9
|
+
t.string :email
|
10
|
+
t.boolean :livemode
|
11
|
+
t.text :metadata
|
12
|
+
t.string :name
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :saas_payments_customers, :stripe_id, unique: true
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative './errors'
|
2
|
+
|
3
|
+
module SaasPayments
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
isolate_namespace SaasPayments
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.included(base)
|
9
|
+
base.extend(ClassMethods)
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def configure
|
14
|
+
yield(self)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: saas_payments
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cody
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-03 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: 5.2.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.2.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: stripe
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.24.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.24.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sqlite3
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: stripe-ruby-mock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.5.8
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.5.8
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: database_cleaner
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: factory_bot_rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Manage plans for your SAAS app
|
112
|
+
email:
|
113
|
+
- callahanrts@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- MIT-LICENSE
|
119
|
+
- README.md
|
120
|
+
- Rakefile
|
121
|
+
- app/assets/config/saas_payments_manifest.js
|
122
|
+
- app/assets/javascripts/saas_payments/application.js
|
123
|
+
- app/assets/javascripts/saas_payments/elements.js
|
124
|
+
- app/assets/stylesheets/saas_payments/application.css
|
125
|
+
- app/assets/stylesheets/saas_payments/elements.css
|
126
|
+
- app/controllers/concerns/saas_payments/subscription_concerns.rb
|
127
|
+
- app/controllers/concerns/saas_payments/webhook_concerns.rb
|
128
|
+
- app/controllers/saas_payments/application_controller.rb
|
129
|
+
- app/controllers/saas_payments/webhook_controller.rb
|
130
|
+
- app/helpers/saas_payments/application_helper.rb
|
131
|
+
- app/jobs/saas_payments/application_job.rb
|
132
|
+
- app/lib/saas_payments/products_service.rb
|
133
|
+
- app/lib/saas_payments/webhook/customer_event.rb
|
134
|
+
- app/lib/saas_payments/webhook/plan_event.rb
|
135
|
+
- app/lib/saas_payments/webhook/product_event.rb
|
136
|
+
- app/lib/saas_payments/webhook/session_event.rb
|
137
|
+
- app/lib/saas_payments/webhook/subscription_event.rb
|
138
|
+
- app/lib/saas_payments/webhook_service.rb
|
139
|
+
- app/mailers/saas_payments/application_mailer.rb
|
140
|
+
- app/models/concerns/saas_payments/stripe_model.rb
|
141
|
+
- app/models/saas_payments/application_record.rb
|
142
|
+
- app/models/saas_payments/customer.rb
|
143
|
+
- app/models/saas_payments/plan.rb
|
144
|
+
- app/models/saas_payments/product.rb
|
145
|
+
- app/models/saas_payments/subscription.rb
|
146
|
+
- app/views/saas_payments/_scripts.html.erb
|
147
|
+
- app/views/saas_payments/_stripe_elements.html.erb
|
148
|
+
- config/initializers/stripe.rb
|
149
|
+
- config/routes.rb
|
150
|
+
- db/migrate/20190818184232_create_saas_payments_subscriptions.rb
|
151
|
+
- db/migrate/20190820040835_create_saas_payments_products.rb
|
152
|
+
- db/migrate/20190820040959_create_saas_payments_plans.rb
|
153
|
+
- db/migrate/20190823023237_create_saas_payments_customers.rb
|
154
|
+
- lib/saas_payments.rb
|
155
|
+
- lib/saas_payments/config.rb
|
156
|
+
- lib/saas_payments/engine.rb
|
157
|
+
- lib/saas_payments/errors.rb
|
158
|
+
- lib/saas_payments/version.rb
|
159
|
+
- lib/tasks/products.rake
|
160
|
+
- lib/tasks/saas_payments_tasks.rake
|
161
|
+
homepage: https://github.com/callahanrts/saas_payments
|
162
|
+
licenses:
|
163
|
+
- MIT
|
164
|
+
metadata: {}
|
165
|
+
post_install_message:
|
166
|
+
rdoc_options: []
|
167
|
+
require_paths:
|
168
|
+
- lib
|
169
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
179
|
+
requirements: []
|
180
|
+
rubygems_version: 3.0.4
|
181
|
+
signing_key:
|
182
|
+
specification_version: 4
|
183
|
+
summary: Manage plans for your SAAS app
|
184
|
+
test_files: []
|