ish_models 0.0.33.100 → 0.0.33.103
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ish/invoice.rb +2 -2
- data/lib/ish/payment.rb +6 -4
- data/lib/ish_models/user_profile.rb +5 -0
- 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: 6265d6ad8a5d5e85aad412b57b2f7751ff8816ea14e1743ab34891532f6f4cf4
|
4
|
+
data.tar.gz: '08a2fa3206ca39253963aaac1ded20924328e798a5beb0e6034a80cf1b47ee4a'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92e56359fae99ccb144e90eee2e0c8d8bc19d7403528fe9f58ff90a2fe2ba4270861f33e95524597ef9e938de4c569dc8ab74feeccb1030013f81a33e733c297
|
7
|
+
data.tar.gz: f3128b3ef46bdfd56b696220a0f95a1c88c2fd012afbf80f15d1a3f0a26a9afb22b737f3efd68bd7bab8957df8c9650d3256b1bbd8fc8b2e7a860e8a6cb0898d
|
data/lib/ish/invoice.rb
CHANGED
@@ -16,10 +16,10 @@ class Ish::Invoice
|
|
16
16
|
field :number, :type => Integer
|
17
17
|
increments :number
|
18
18
|
|
19
|
-
field :amount, :type =>
|
19
|
+
field :amount, :type => Integer
|
20
20
|
|
21
21
|
has_many :payments, :class_name => 'Ish::Payment'
|
22
|
-
field :paid_amount, :type =>
|
22
|
+
field :paid_amount, :type => Integer, :default => 0
|
23
23
|
|
24
24
|
field :description, :type => String
|
25
25
|
|
data/lib/ish/payment.rb
CHANGED
@@ -2,10 +2,10 @@ class Ish::Payment
|
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
4
|
|
5
|
-
belongs_to :invoice, :class_name => 'Ish::Invoice'
|
6
|
-
|
5
|
+
belongs_to :invoice, :class_name => 'Ish::Invoice', optional: true
|
6
|
+
belongs_to :profile, :class_name => 'IshModels::UserProfile' # , :optional => true
|
7
7
|
|
8
|
-
field :amount, :type =>
|
8
|
+
field :amount, :type => Integer # in cents
|
9
9
|
field :charge, :type => Hash
|
10
10
|
field :email, :type => String
|
11
11
|
|
@@ -14,7 +14,9 @@ class Ish::Payment
|
|
14
14
|
protected
|
15
15
|
|
16
16
|
def compute_paid_invoice_amount
|
17
|
-
|
17
|
+
if self.invoice
|
18
|
+
self.invoice.update_attributes :paid_amount => self.invoice.paid_amount + self.amount
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
end
|