wco_models 3.1.0.112 → 3.1.0.113

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: 36cb41329f3fa93a254a01e4ecff57309e74e147d04d94293e7ef56a44b23a88
4
- data.tar.gz: 60dbca9b78bc68838bf08fe613f0c847fc98431411aa46f25f0d677c8b941019
3
+ metadata.gz: 4158c0482b28448ec901d1f7acf5add01d2bcc4bececc4cc726f76753d87148c
4
+ data.tar.gz: fb83c6ff40fe289f8059123a4347eb763ef833416e4a7c155a83d528a54e30b9
5
5
  SHA512:
6
- metadata.gz: 1510b1021b837c69a2dd1af705ae581d170735ce90c1f58224f6ce999435f94982422a743c2c998cc88510e00e9dea46c94729a0029c5a0dde8cd28adf3a4659
7
- data.tar.gz: 6a351a518796b6345772135938e098ad8f8570303d54361f878d7acae7901797ff63d8477002a6db19359b7376b3d9468d8960b1c0de5a09636274dfd982bc6c
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
- attr_accessor :tmp_price_cents
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.112
4
+ version: 3.1.0.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev