wco_models 3.1.0.111 → 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: 52d06f73743e41635eaff490caeefbe75c3bb178649069b482d395873f046539
4
- data.tar.gz: 1ee096723c2c17347c3a6f1e98f6f165ad445256eedd1aa337eaef759a44d479
3
+ metadata.gz: 4158c0482b28448ec901d1f7acf5add01d2bcc4bececc4cc726f76753d87148c
4
+ data.tar.gz: fb83c6ff40fe289f8059123a4347eb763ef833416e4a7c155a83d528a54e30b9
5
5
  SHA512:
6
- metadata.gz: 1ea0e5198bd0d8e48a35dfb6ad9ee2aa9579ff8c340282000cb5b0c726a72e51e78a48d78e7b9ae2246a4fb2fbeea00841fe0937c89053235645b60655617c88
7
- data.tar.gz: 7d4bfeb05258153700bd1ba4c2905fbd743aac91ddb09d949e83a817fd8be073938f1386b0017d0a05403aec49f030db6861c66758e7b604844a776ca140e14e
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.111
4
+ version: 3.1.0.113
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev