rhino_project_subscriptions 0.30.0.alpha.7 → 0.30.0.alpha.14
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 +13 -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 +12 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b157176a74a38c4b225527981d48dcbbb43b40d942d3f23dfb52886aeccda43
|
4
|
+
data.tar.gz: 8b12023b3923aaf01c3d83a1e4d34bee50ef10c9d5440c5ca6409e80d8eda77b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e52977f243fb15bec7233daff95812d8523fb2259bbc788df9a33a66996cd3f6b23f6e0ec29db517aae60a7e8aff44d741e25404ca7e1e048c5f390b205a80
|
7
|
+
data.tar.gz: 70af26a3efd1ae6b249777263c665cdc38c0275583d8a47ad277af155069e217c5b2a1c7791d678cb63802455298018e87bd74f3b368307c995ee49f0355b9ab
|
@@ -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
|
@@ -80,7 +89,8 @@ module Rhino
|
|
80
89
|
quantity: 1,
|
81
90
|
price: args["price"]
|
82
91
|
}],
|
83
|
-
customer: customer_id
|
92
|
+
customer: customer_id,
|
93
|
+
payment_method_collection: RhinoSubscriptions.payment_method_collection
|
84
94
|
)
|
85
95
|
end
|
86
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,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhino_project_subscriptions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.30.0.alpha.
|
4
|
+
version: 0.30.0.alpha.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-01 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rails
|
@@ -16,48 +15,48 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
18
|
+
version: 8.0.0
|
20
19
|
- - ">="
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
21
|
+
version: 8.0.0
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
26
25
|
requirements:
|
27
26
|
- - "~>"
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
28
|
+
version: 8.0.0
|
30
29
|
- - ">="
|
31
30
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
31
|
+
version: 8.0.0
|
33
32
|
- !ruby/object:Gem::Dependency
|
34
33
|
name: rhino_project_core
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
36
35
|
requirements:
|
37
36
|
- - '='
|
38
37
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.30.0.alpha.
|
38
|
+
version: 0.30.0.alpha.14
|
40
39
|
type: :runtime
|
41
40
|
prerelease: false
|
42
41
|
version_requirements: !ruby/object:Gem::Requirement
|
43
42
|
requirements:
|
44
43
|
- - '='
|
45
44
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.30.0.alpha.
|
45
|
+
version: 0.30.0.alpha.14
|
47
46
|
- !ruby/object:Gem::Dependency
|
48
47
|
name: stripe
|
49
48
|
requirement: !ruby/object:Gem::Requirement
|
50
49
|
requirements:
|
51
50
|
- - '='
|
52
51
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
52
|
+
version: 13.3.1
|
54
53
|
type: :runtime
|
55
54
|
prerelease: false
|
56
55
|
version_requirements: !ruby/object:Gem::Requirement
|
57
56
|
requirements:
|
58
57
|
- - '='
|
59
58
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
59
|
+
version: 13.3.1
|
61
60
|
description: ''
|
62
61
|
email:
|
63
62
|
- jp@codalio.com
|
@@ -77,6 +76,7 @@ files:
|
|
77
76
|
- db/migrate/20210302208003_rhino_create_stripe_customers.rb
|
78
77
|
- db/migrate/20210302299092_rhino_alter_stripe_customers.rb
|
79
78
|
- lib/generators/rhino_subscriptions/install/install_generator.rb
|
79
|
+
- lib/generators/rhino_subscriptions/install/templates/rhino_subscriptions.rb.tt
|
80
80
|
- lib/rhino_project_subscriptions.rb
|
81
81
|
- lib/rhino_subscriptions/engine.rb
|
82
82
|
- lib/rhino_subscriptions/version.rb
|
@@ -85,7 +85,6 @@ homepage: ''
|
|
85
85
|
licenses:
|
86
86
|
- MIT
|
87
87
|
metadata: {}
|
88
|
-
post_install_message:
|
89
88
|
rdoc_options: []
|
90
89
|
require_paths:
|
91
90
|
- lib
|
@@ -100,8 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
99
|
- !ruby/object:Gem::Version
|
101
100
|
version: '0'
|
102
101
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
-
signing_key:
|
102
|
+
rubygems_version: 3.6.2
|
105
103
|
specification_version: 4
|
106
104
|
summary: ''
|
107
105
|
test_files: []
|