rhino_project_subscriptions 0.23.0.beta.0 → 0.23.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/rhino/stripe_controller.rb +12 -3
- data/lib/generators/rhino_subscriptions/install/install_generator.rb +1 -0
- data/lib/generators/rhino_subscriptions/install/templates/rhino_subscriptions.rb.tt +9 -0
- data/lib/rhino_project_subscriptions.rb +17 -1
- data/lib/rhino_subscriptions/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b66208b1cecf4097f2c36916731a7cedb352f9183717326db2a6235328dcf087
|
4
|
+
data.tar.gz: a19390402db00a240892fec2f514189cdca951536c3be2ffabaf0819d8670d4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4728309c25ed5936501dba4a5dae7cf1d2d3a5d2e13f6e8c06cc2e3b7a5cf8bdbabf263d93c0112749d6bd3edf8f74f5129d0ed775692962ee2dfadf0d2c7fe
|
7
|
+
data.tar.gz: eb006d0a9b14bc0f2dc5efdfb266c18a48b86620827f20b13b1a538524f869ce53e90f3eeaf4b6635041fb99643513d3365e7a3875ab81792f27ddfdfaf1c0f4
|
@@ -9,8 +9,17 @@ module Rhino
|
|
9
9
|
include Rhino::Authenticated
|
10
10
|
|
11
11
|
def prices
|
12
|
-
|
13
|
-
|
12
|
+
# Unfortunately we can't use the search API here because you can't do AND and OR together
|
13
|
+
# And parentheses don't work either https://docs.stripe.com/search#query-structure-and-terminology
|
14
|
+
list = if RhinoSubscriptions.products == :all
|
15
|
+
::Stripe::Price.list({ active: true, limit: 5, expand: ["data.product"] })["data"]
|
16
|
+
else
|
17
|
+
RhinoSubscriptions.products.flat_map do |product|
|
18
|
+
::Stripe::Price.list({ product:, active: true, limit: 5, expand: ["data.product"] })["data"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
render json: { prices: list }
|
14
23
|
end
|
15
24
|
|
16
25
|
def create_checkout_session
|
@@ -81,7 +90,7 @@ module Rhino
|
|
81
90
|
price: args["price"]
|
82
91
|
}],
|
83
92
|
customer: customer_id,
|
84
|
-
payment_method_collection:
|
93
|
+
payment_method_collection: RhinoSubscriptions.payment_method_collection
|
85
94
|
)
|
86
95
|
end
|
87
96
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RhinoSubscriptions.setup do |config|
|
4
|
+
# Products to show pricing for
|
5
|
+
# config.products = ["prod_3893aadf", "prod_33aa44adf"]
|
6
|
+
|
7
|
+
# https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-payment_method_collection
|
8
|
+
# config.payment_method_collection = :if_required
|
9
|
+
end
|
@@ -4,5 +4,21 @@ require "rhino_subscriptions/engine"
|
|
4
4
|
# require 'active_support'
|
5
5
|
|
6
6
|
module RhinoSubscriptions
|
7
|
-
#
|
7
|
+
# The list of products to show on the subscription page
|
8
|
+
mattr_accessor :products, default: :all
|
9
|
+
|
10
|
+
mattr_accessor :payment_method_collection, default: :always
|
11
|
+
|
12
|
+
def self.products=(products)
|
13
|
+
@@products = Array.wrap(products)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.payment_method_collection=(payment_method_collection)
|
17
|
+
@@payment_method_collection = payment_method_collection
|
18
|
+
end
|
19
|
+
|
20
|
+
# Default way to set up Rhino Subscriptions
|
21
|
+
def self.setup
|
22
|
+
yield self
|
23
|
+
end
|
8
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhino_project_subscriptions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.0.beta.
|
4
|
+
version: 0.23.0.beta.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,28 +36,28 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - '='
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.23.0.beta.
|
39
|
+
version: 0.23.0.beta.2
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - '='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.23.0.beta.
|
46
|
+
version: 0.23.0.beta.2
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: stripe
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - '='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 13.3.1
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - '='
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: 13.3.1
|
61
61
|
description: ''
|
62
62
|
email:
|
63
63
|
- jp@codalio.com
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- db/migrate/20210302208003_rhino_create_stripe_customers.rb
|
78
78
|
- db/migrate/20210302299092_rhino_alter_stripe_customers.rb
|
79
79
|
- lib/generators/rhino_subscriptions/install/install_generator.rb
|
80
|
+
- lib/generators/rhino_subscriptions/install/templates/rhino_subscriptions.rb.tt
|
80
81
|
- lib/rhino_project_subscriptions.rb
|
81
82
|
- lib/rhino_subscriptions/engine.rb
|
82
83
|
- lib/rhino_subscriptions/version.rb
|