op_cart 0.5.4 → 0.6.0
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 +4 -4
- data/app/models/op_cart/order.rb +6 -1
- data/app/models/op_cart/subscription.rb +5 -5
- data/lib/op_cart/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b3f63a006094e5d32cc7a4def31e9ebff2ea42b
|
4
|
+
data.tar.gz: d16646e931c1e6c3cae3919b46ee9bc4b7204fc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec51a4e9afeb2076c0c74fb2b51e5af79441b245a2123fcbcb6c74e30ab43004b1e59f16dac594142a1aef133a0c0cbd177d333632fc60128064d0c0e61cdf4f
|
7
|
+
data.tar.gz: 4eccb7a658c896fda9e50e7140f6352ad944ca682f7240af8dc0c74fbd49f16e81300e3a52172954cd926f27330a356a555c4bf2c1f46fac5c828049bdead220
|
data/app/models/op_cart/order.rb
CHANGED
@@ -81,7 +81,12 @@ module OpCart
|
|
81
81
|
def create_subscriptions
|
82
82
|
line_items.each do |li|
|
83
83
|
if li.sellable.is_a? Plan
|
84
|
-
|
84
|
+
es = existing_subscription = customer.subscriptions.where(plan: li.sellable).first
|
85
|
+
if existing_subscription.present?
|
86
|
+
es.update_attributes quantity: es.quantity + li.quantity
|
87
|
+
else
|
88
|
+
subscriptions.new customer: customer, plan: li.sellable, quantity: li.quantity
|
89
|
+
end
|
85
90
|
end
|
86
91
|
end
|
87
92
|
end
|
@@ -37,11 +37,11 @@ module OpCart
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def update_subscription
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
update_local_object
|
40
|
+
subscription = customer.processor_object.subscriptions.retrieve(processor_token)
|
41
|
+
subscription.quantity = quantity if quantity_changed?
|
42
|
+
subscription.trial_end = trial_ended_at.to_i if trial_ended_at_changed?
|
43
|
+
subscription.plan = plan.processor_token if plan_id_changed?
|
44
|
+
update_local_object subscription.save
|
45
45
|
rescue Stripe::InvalidRequestError => e
|
46
46
|
if e.param
|
47
47
|
self.errors.add e.param, e.message
|
data/lib/op_cart/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: op_cart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Boehs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|