rhino_project_subscriptions 0.21.0.beta.20 → 0.21.0.beta.22
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 +13 -0
- data/config/routes.rb +1 -0
- data/lib/rhino_subscriptions/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8ad6075c0c68ed176dc2120efa881bb145cc50f603ba7daff61472853aa194b
|
4
|
+
data.tar.gz: d2d6dc2d8e7ac10c0d423794ac0bc67f1a821d1730d5fd20ca7d560a3daf6fbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c35b0e8decbce2df00426c73536ef48c236a6549ae5d5b83f78ad2fda23e64568b2d2ea3db910128246a72d2d93e7899a460f9423fe9ed386f554b0212ed6ec2
|
7
|
+
data.tar.gz: 2cf044126c94f90e6d09453819b804f85fdf338629c8b7487f3750e90f47836c4e0a50cc3417cb7dff1182fbf74d03f953c4ea6f164ab4b790cd287c5a2d41e2
|
@@ -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
|
@@ -63,6 +75,7 @@ module Rhino
|
|
63
75
|
success_url: args["success_url"],
|
64
76
|
cancel_url: args["cancel_url"],
|
65
77
|
mode: "subscription",
|
78
|
+
allow_promotion_codes: true,
|
66
79
|
line_items: [{
|
67
80
|
quantity: 1,
|
68
81
|
price: args["price"]
|
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
|
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.
|
4
|
+
version: 0.21.0.beta.22
|
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.
|
39
|
+
version: 0.21.0.beta.22
|
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.22
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: stripe
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|