rhino_project_subscriptions 0.21.0.beta.17 → 0.21.0.beta.19
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 -22
- 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: ec46b75bdaac4ba9a9754418733699027c774dda30ba826300e2a308a2136b51
|
4
|
+
data.tar.gz: 1af45d8e56b8fb1f1215142c59a811bf830dddd99d6ec20bcef6e2f2969c6e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a72525465d43c66b3847466872d11e9d511f67cb902337b4bccdec318286c0814ce7f8e08e48f1dc50074865aee531a3eb9ca3a96736c7acadf071e00d1ab08
|
7
|
+
data.tar.gz: 552093e54b8b66da9fa9b7e7881370e990e1722bf58ace4493f0e2fce610c75b0a89e2dbd46869a06cdb0bb915cc2481803d4cf3a2f08e4399d443e1fd30f8ba
|
@@ -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,8 +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:
|
63
|
+
success_url: args["success_url"],
|
64
|
+
cancel_url: args["cancel_url"],
|
78
65
|
payment_method_types: ["card"],
|
79
66
|
mode: "subscription",
|
80
67
|
line_items: [{
|
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.19
|
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-26 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.19
|
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.19
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: stripe
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|