rhino_project_subscriptions 0.21.0.beta.21 → 0.21.0.beta.23

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: ba2c051cfb8bb9c19e836a493d4b304e077abded14ec5efc71529ea2ed3dd250
4
- data.tar.gz: 13794726f62575d2d413677a72613e54c41ba6efd385d78955956e8a87a823fa
3
+ metadata.gz: 7bba9aea5d1e84bec02c06053c40047a9e81fdf909173b08eccd510ac0f1b278
4
+ data.tar.gz: 9b2c4bb400e186146931454a9b5a1a8cf1923ac4fd9545382e643e6d560db945
5
5
  SHA512:
6
- metadata.gz: bea5097c5f3ddeb2dff6c34e1eed425bd042d1a20b6475eafe6260f82c9b994928319caf4ee1d73dec707ee693d676ea149c850dce503baa7738fedb9154dc5e
7
- data.tar.gz: 6e892ee2e1e70e661865d37e40b51ad591232880efdf876d0c748db2dcff9848679c7ec6ef86d298157418427779aad7f97626c6b6c5607d1528185b93d97efa
6
+ metadata.gz: f594f1036bd59d48632bc9f54e256cd5f622d52f2c83990e580488317480313712a58b527ddf250d740d18598a3e989bf0c378d1e7ba538e4c90831991284787
7
+ data.tar.gz: 6c9e96c7a2b6818db05a8c05f0e708358038e4717b3d797c13cb66f66f3e2deae7dd09ae6cb817d49d92c629c68cc3a9980c1dc80a5e6850a789a77e8bc9c70d
@@ -25,6 +25,18 @@ module Rhino
25
25
  }
26
26
  end
27
27
 
28
+ def cancel
29
+ stripe_customer = Rhino::StripeCustomer.find_by(base_owner_id: params["base_owner_id"])
30
+ return render json: {} unless stripe_customer
31
+
32
+ subscriptions = ::Stripe::Subscription.list({ customer: stripe_customer["customer_id"] })
33
+ subscriptions.each do |subscription|
34
+ ::Stripe::Subscription.delete(subscription.id)
35
+ end
36
+
37
+ render json: {}
38
+ end
39
+
28
40
  def customer
29
41
  stripe_customer = Rhino::StripeCustomer.find_by(base_owner_id: params["base_owner_id"])
30
42
  if stripe_customer
data/config/routes.rb CHANGED
@@ -6,6 +6,7 @@ Rails.application.routes.draw do
6
6
  post 'subscription/customer' ,to: 'rhino/stripe#customer'
7
7
  get 'subscription/subscriptions' ,to: 'rhino/stripe#subscriptions'
8
8
  post 'subscription/create-checkout-session' ,to: 'rhino/stripe#create_checkout_session'
9
+ post 'subscription/cancel' ,to: 'rhino/stripe#cancel'
9
10
  get 'subscription/check_session_id' ,to: 'rhino/stripe#check_session_id'
10
11
 
11
12
  end
@@ -10,7 +10,7 @@ module RhinoSubscriptions
10
10
  MAJOR = 0
11
11
  MINOR = 21
12
12
  TINY = 0
13
- PRE = "beta.21"
13
+ PRE = "beta.23"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.21
4
+ version: 0.21.0.beta.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Rosevear
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 0.21.0.beta.21
39
+ version: 0.21.0.beta.23
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.21
46
+ version: 0.21.0.beta.23
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: stripe
49
49
  requirement: !ruby/object:Gem::Requirement