rhino_project_subscriptions 0.21.0.beta.17 → 0.21.0.beta.20
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 +9 -23
- data/lib/rhino_subscriptions/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19dfe5e5159f5d038e9f7e47ef3b61d1315d377e3a0f3cf772d3e644cba3a5c8
|
4
|
+
data.tar.gz: 8b0c535f091abd1266dbb707f926807812aa6418bd0831321bf7242eacae5a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96310132712ccbb705cb65e847c3a54b6e88d12ceaaf4b33f70edf33dd68a37beea22d7afa7a0a8ee9170cc2bc6f9586b97101e1af5a29e8dc5ed979def30d72
|
7
|
+
data.tar.gz: 2107b0268ebb2289c9973ef007bce14043eb8b35bd1848594dfab19c2c6d200151ec7a376a1869eb47c2b0402f91cbda05ac642a3159638843a854d1ac39160f
|
@@ -9,14 +9,8 @@ module Rhino
|
|
9
9
|
include Rhino::Authenticated
|
10
10
|
|
11
11
|
def prices
|
12
|
-
list = ::Stripe::Price.list({ limit: 5 })
|
13
|
-
prices
|
14
|
-
{ id: column["id"], name: column["nickname"], amount: column["unit_amount"] }
|
15
|
-
end
|
16
|
-
render json: {
|
17
|
-
publishableKey: ENV["STRIPE_PUBLISHABLE_KEY"],
|
18
|
-
prices:
|
19
|
-
}
|
12
|
+
list = ::Stripe::Price.list({ active: true, limit: 5, expand: ["data.product"] })
|
13
|
+
render json: { prices: list["data"] }
|
20
14
|
end
|
21
15
|
|
22
16
|
def create_checkout_session
|
@@ -47,20 +41,13 @@ module Rhino
|
|
47
41
|
|
48
42
|
def subscriptions
|
49
43
|
stripe_customer = Rhino::StripeCustomer.find_by(base_owner_id: params["base_owner_id"])
|
44
|
+
return render json: {} unless stripe_customer
|
50
45
|
|
51
|
-
|
52
|
-
customer = ::Stripe::Customer.retrieve({
|
53
|
-
id: stripe_customer["customer_id"],
|
54
|
-
expand: ["subscriptions"]
|
55
|
-
})
|
56
|
-
|
57
|
-
render json: {
|
58
|
-
subscriptions: customer.subscriptions.data
|
59
|
-
}
|
46
|
+
subscriptions = ::Stripe::Subscription.list({ customer: stripe_customer["customer_id"], expand: ["data.plan.product"] })
|
60
47
|
|
61
|
-
|
62
|
-
|
63
|
-
|
48
|
+
render json: {
|
49
|
+
subscriptions: subscriptions.data
|
50
|
+
}
|
64
51
|
end
|
65
52
|
|
66
53
|
def check_session_id
|
@@ -73,9 +60,8 @@ module Rhino
|
|
73
60
|
private
|
74
61
|
def checkout_session(customer_id, args)
|
75
62
|
::Stripe::Checkout::Session.create(
|
76
|
-
success_url:
|
77
|
-
cancel_url:
|
78
|
-
payment_method_types: ["card"],
|
63
|
+
success_url: args["success_url"],
|
64
|
+
cancel_url: args["cancel_url"],
|
79
65
|
mode: "subscription",
|
80
66
|
line_items: [{
|
81
67
|
quantity: 1,
|
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.21.0.beta.
|
4
|
+
version: 0.21.0.beta.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Rosevear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - '='
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.21.0.beta.
|
39
|
+
version: 0.21.0.beta.20
|
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.21.0.beta.
|
46
|
+
version: 0.21.0.beta.20
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: stripe
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|