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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4241892967dace95738bff32961ff87cbdba6055668d8226e31976b507ff8a0f
4
- data.tar.gz: 764aabf4e84701419b6e496f0769abe90d46369cdbd59df38d1afaefaafbb19e
3
+ metadata.gz: ec46b75bdaac4ba9a9754418733699027c774dda30ba826300e2a308a2136b51
4
+ data.tar.gz: 1af45d8e56b8fb1f1215142c59a811bf830dddd99d6ec20bcef6e2f2969c6e2a
5
5
  SHA512:
6
- metadata.gz: 426d5a4fbdc4151b15a69cc1c7c7fce9b081b8998b998a9704e9f811165c11ae2fe26e1bc5215b2f4b834018819774bd43ac26cd845448922b9415bed22496b1
7
- data.tar.gz: 40bd6da9443201f49c28430ba082bc0645cec4bd088897ecebb05cccfb7c353675d154f96dde6f4dc4eafdb715b6a93d74a3edb8f402ddc4f0c4f404e27e576c
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 = 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,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: ENV["FRONT_END_URL"] + args["success_url"],
77
- cancel_url: ENV["FRONT_END_URL"] + args["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: [{
@@ -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.19"
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.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-09 00:00:00.000000000 Z
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.17
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.17
46
+ version: 0.21.0.beta.19
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: stripe
49
49
  requirement: !ruby/object:Gem::Requirement