rhino_project_subscriptions 0.21.0.beta.16 → 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: 5e4d37c1cbb90111cfdd8436011c5ec740364706221b4a7375422e9032d476e4
4
- data.tar.gz: 2997b64e53a625475ddf37ee301de564578d0670fd112b3734eb3bd2506687e6
3
+ metadata.gz: ec46b75bdaac4ba9a9754418733699027c774dda30ba826300e2a308a2136b51
4
+ data.tar.gz: 1af45d8e56b8fb1f1215142c59a811bf830dddd99d6ec20bcef6e2f2969c6e2a
5
5
  SHA512:
6
- metadata.gz: c9cb8bf35a8209450dc8565965175d03dc24f0405519788f5a00da7b4f220cd1d7e449271c144233521d9263fbf1cd4c1e3599c73fcc856385ebbfe8e436c255
7
- data.tar.gz: 89cd9ef61b3af3cfdda90142c1d99349900ac9a8634915818bd656bd98304f08556c7c22f4a158d329fd4301b349528f107593708c3653e4e53f96b6a62882b9
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.16"
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.16
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.16
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.16
46
+ version: 0.21.0.beta.19
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: stripe
49
49
  requirement: !ruby/object:Gem::Requirement