effective_orders 4.5.2 → 4.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2216991c7430e4902a33b35ee0d8d4ea9e637c927a587b1dbedf1eaf4cf57fe
|
4
|
+
data.tar.gz: a51f8b35bfebb1e375664ee006e24717cec9ddac464f17e008296a87e2883c81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b5a07d109578b5bc7654ca5eaa6ec3f18b7cd89841b15e7f0a5a1128089e9715cd9b317c884ef0afb6cb4a9fed7f0934b7693f7e0b3ba4648544769a00ef3be
|
7
|
+
data.tar.gz: e94f3d309875b26bbf6f185990e80e1d1911ae0d320050550915dd7970f025a07645c402aa1b6422e114f1e1563b1d86420cba3a8d8058123ce437650c900269
|
@@ -67,6 +67,12 @@ module ActsAsSubscribable
|
|
67
67
|
subscribed? && subscription_status == EffectiveOrders::PAST_DUE
|
68
68
|
end
|
69
69
|
|
70
|
+
# If we do use stripe
|
71
|
+
def subscription_trialing?
|
72
|
+
subscribed? && subscription_status == EffectiveOrders::TRIALING
|
73
|
+
end
|
74
|
+
|
75
|
+
# If we don't use stripe
|
70
76
|
def trialing?
|
71
77
|
subscription_status.blank?
|
72
78
|
end
|
@@ -126,7 +126,13 @@ module Effective
|
|
126
126
|
return false unless subscription.stripe_subscription.blank?
|
127
127
|
|
128
128
|
Rails.logger.info "[STRIPE] create subscription: #{items}"
|
129
|
-
|
129
|
+
|
130
|
+
stripe_subscription = Stripe::Subscription.create(
|
131
|
+
customer: customer.stripe_customer_id,
|
132
|
+
items: items,
|
133
|
+
metadata: metadata,
|
134
|
+
trial_from_plan: true
|
135
|
+
)
|
130
136
|
|
131
137
|
subscription.update!(
|
132
138
|
stripe_subscription: stripe_subscription,
|
data/lib/effective_orders.rb
CHANGED
@@ -14,9 +14,10 @@ module EffectiveOrders
|
|
14
14
|
# Subscription statuses (as per stripe)
|
15
15
|
ACTIVE = 'active'.freeze
|
16
16
|
PAST_DUE = 'past_due'.freeze
|
17
|
+
TRIALING = 'trialing'.freeze
|
17
18
|
CANCELED = 'canceled'.freeze
|
18
19
|
|
19
|
-
STATUSES = { ACTIVE => ACTIVE, PAST_DUE => PAST_DUE, CANCELED => CANCELED }
|
20
|
+
STATUSES = { ACTIVE => ACTIVE, PAST_DUE => PAST_DUE, CANCELED => CANCELED, TRIALING => TRIALING }
|
20
21
|
|
21
22
|
# The following are all valid config keys
|
22
23
|
mattr_accessor :orders_table_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|