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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4241892967dace95738bff32961ff87cbdba6055668d8226e31976b507ff8a0f
4
- data.tar.gz: 764aabf4e84701419b6e496f0769abe90d46369cdbd59df38d1afaefaafbb19e
3
+ metadata.gz: 19dfe5e5159f5d038e9f7e47ef3b61d1315d377e3a0f3cf772d3e644cba3a5c8
4
+ data.tar.gz: 8b0c535f091abd1266dbb707f926807812aa6418bd0831321bf7242eacae5a45
5
5
  SHA512:
6
- metadata.gz: 426d5a4fbdc4151b15a69cc1c7c7fce9b081b8998b998a9704e9f811165c11ae2fe26e1bc5215b2f4b834018819774bd43ac26cd845448922b9415bed22496b1
7
- data.tar.gz: 40bd6da9443201f49c28430ba082bc0645cec4bd088897ecebb05cccfb7c353675d154f96dde6f4dc4eafdb715b6a93d74a3edb8f402ddc4f0c4f404e27e576c
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 = list["data"].map do |column|
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
- if stripe_customer
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
- else
62
- render json: {}
63
- end
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: ENV["FRONT_END_URL"] + args["success_url"],
77
- cancel_url: ENV["FRONT_END_URL"] + args["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,
@@ -10,7 +10,7 @@ module RhinoSubscriptions
10
10
  MAJOR = 0
11
11
  MINOR = 21
12
12
  TINY = 0
13
- PRE = "beta.17"
13
+ PRE = "beta.20"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  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.21.0.beta.17
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-09 00:00:00.000000000 Z
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.17
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.17
46
+ version: 0.21.0.beta.20
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: stripe
49
49
  requirement: !ruby/object:Gem::Requirement