wco_models 3.1.0.112 → 3.1.0.113
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/wco_hosting/appliance_tmpl.rb +1 -42
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4158c0482b28448ec901d1f7acf5add01d2bcc4bececc4cc726f76753d87148c
|
|
4
|
+
data.tar.gz: fb83c6ff40fe289f8059123a4347eb763ef833416e4a7c155a83d528a54e30b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d91c3749a77326adbf809850bf18fa5ff9e4ae09c6b305726ed8fbc0acbe3a8e06067ad490219135fac0c22b96087e21185945b80024d81100a61fb18c14b07
|
|
7
|
+
data.tar.gz: e25ac611e88c6bcbc8fda228708f73dbda55d244fd6f2e9208afc03e2b78748d2e4f3229d09ee540988c4c39d9cd2e8cfda8402485c7120b0d3b813232702c60
|
|
@@ -63,52 +63,11 @@ class WcoHosting::ApplianceTmpl
|
|
|
63
63
|
# belongs_to :price, class_name: 'Wco::Price', foreign_key: :wco_price_id
|
|
64
64
|
|
|
65
65
|
field :price_id # stripe
|
|
66
|
-
|
|
67
|
-
attr_accessor :tmp_price_interval
|
|
66
|
+
|
|
68
67
|
before_validation :set_stripe_product_price, on: :create
|
|
69
68
|
def set_stripe_product_price
|
|
70
69
|
stripe_product = Stripe::Product.create({ name: "Appliance #{self}" })
|
|
71
70
|
self.product_id = stripe_product.id
|
|
72
|
-
|
|
73
|
-
wco_price = Wco::Price.create!({
|
|
74
|
-
amount_cents: tmp_price_cents,
|
|
75
|
-
interval: tmp_price_interval,
|
|
76
|
-
product_id: stripe_product.id,
|
|
77
|
-
product: self,
|
|
78
|
-
})
|
|
79
|
-
self.prices.push wco_price
|
|
80
|
-
price_hash = {
|
|
81
|
-
product: stripe_product.id,
|
|
82
|
-
unit_amount: tmp_price_cents,
|
|
83
|
-
currency: 'usd',
|
|
84
|
-
recurring: {
|
|
85
|
-
interval: tmp_price_interval,
|
|
86
|
-
},
|
|
87
|
-
}
|
|
88
|
-
stripe_price = Stripe::Price.create( price_hash )
|
|
89
|
-
self.price_id = stripe_price.id
|
|
90
|
-
end
|
|
91
|
-
before_validation :update_stripe_product_price, on: :update
|
|
92
|
-
def update_stripe_product_price
|
|
93
|
-
if tmp_price_cents.present?
|
|
94
|
-
price_hash = {
|
|
95
|
-
product: product_id,
|
|
96
|
-
unit_amount: tmp_price_cents,
|
|
97
|
-
currency: 'usd',
|
|
98
|
-
recurring: {
|
|
99
|
-
interval: tmp_price_interval,
|
|
100
|
-
},
|
|
101
|
-
}
|
|
102
|
-
stripe_price = Stripe::Price.create( price_hash )
|
|
103
|
-
wco_price = Wco::Price.create!({
|
|
104
|
-
amount_cents: tmp_price_cents,
|
|
105
|
-
interval: tmp_price_interval,
|
|
106
|
-
price_id: stripe_price.id,
|
|
107
|
-
product_id: product_id,
|
|
108
|
-
product: self,
|
|
109
|
-
})
|
|
110
|
-
self.prices.push wco_price
|
|
111
|
-
end
|
|
112
71
|
end
|
|
113
72
|
|
|
114
73
|
|