ish_models 0.0.33.224 → 0.0.33.225

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: 50675cc51e51d76bc4b1b20396f6aaa5cc21d44f8517a9f419ba64651ab47f3a
4
- data.tar.gz: '08e520ea0df95f8fb0ae157d4b8ca1658d1d144bb02533fa14f4e11ecad35fa7'
3
+ metadata.gz: dcf6779d3d2bafd20719969eb3a2c13681784ce9a6486e444fd8407299b68b10
4
+ data.tar.gz: 5a0de640fd761b5af8709aae17be40572284c3462fb214849b26dfb440595d7e
5
5
  SHA512:
6
- metadata.gz: 49900207ca24ec6708fa9842a284d761e4d4b095dc0ce36374a14ed4a0014ba858461c5f6febc0813350fc5195f1c31c0bc3e577e0aed6ef7a8db4e4bdd370e1
7
- data.tar.gz: fbaab4658c3c2d6370b71156543b4ee592b341c55862e9c708fdd8eec1071de4ca191211c23243c11c5fe8863e7eba92f84039db31bca50746c02145ebb82e87
6
+ metadata.gz: bb445008b52c1d966e8b190241ff6621e3799d0a242221c0b618d1cbd24a75a6f8ddfac7f3f3f39e0815b0dbc849c02d8f107bb16ce915786afd18f3adbaa129
7
+ data.tar.gz: a6d9882e974666522ec2358b443f0c4deac2fda3b20ac0a8b68f9adabf606fcc02264b5876003f803129a69a609c1cd758d644dfb83e2050eca6f959a8d13014
data/lib/ish/payment.rb CHANGED
@@ -14,7 +14,11 @@ class Ish::Payment
14
14
  field :client_secret
15
15
  field :payment_intent_id
16
16
 
17
- field :status, type: Symbol
17
+ STATUS_CONFIRMED = 'confirmed'
18
+ STATUS_PENDING = 'pending'
19
+ STATUSES = %w| active pending |
20
+ field :status, type: Symbol, default: STATUS_PENDING
21
+ scope :confirmed, ->{ where( status: STATUS_CONFIRMED ) }
18
22
 
19
23
  after_create :compute_paid_invoice_amount
20
24
  def compute_paid_invoice_amount
@@ -69,7 +69,7 @@ class Ish::UserProfile
69
69
  has_many :payments, :class_name => '::Ish::Payment'
70
70
 
71
71
  def has_premium_purchase item
72
- payments.where( item: item ).exists?
72
+ payments.confirmed.where( item: item ).exists?
73
73
  end
74
74
 
75
75
  field :is_purchasing, type: Boolean, default: false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.224
4
+ version: 0.0.33.225
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox