invoicing_payments_processing 1.1.44 → 1.1.49
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/extend_client_by_invoicing_payments_processing.rb +1 -1
- data/lib/invoice.rb +8 -8
- data/lib/movement.rb +35 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b54f5254b078b2e18fe430630b15c7d9502fdf72
|
4
|
+
data.tar.gz: d593f97003a360802f912eb1299229ba267430c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f24b1584bcf525b37792d216078f7668bc42aa47ca5cb0e9b65f06d152c60a4e0bcec376933f2f420dab27d55992e8823ac9bebf65e8f230e49e81c59562265e
|
7
|
+
data.tar.gz: 635caf0ccb9cdec3b0a3552020c90940a01f99f9fdc8c7e16330e2f9846fe7dd54a41e12ad96a4963f5cde17ba31046fc309acf46267f6d1bcc000a3e8a41a0e
|
@@ -118,7 +118,7 @@ module BlackStack
|
|
118
118
|
total_credits = credits_paid
|
119
119
|
total_amount = amount_paid
|
120
120
|
if total_credits < 0
|
121
|
-
self.adjustment(product_code, total_amount, total_credits, 'Adjustment Because Quota Has Been Exceeded.', BlackStack::Movement::MOVEMENT_TYPE_ADJUSTMENT, o.create_time)
|
121
|
+
self. adjustment(product_code, total_amount, total_credits, 'Adjustment Because Quota Has Been Exceeded.', BlackStack::Movement::MOVEMENT_TYPE_ADJUSTMENT, o.create_time)
|
122
122
|
amount_paid = 0.to_f
|
123
123
|
credits_paid = 0.to_i
|
124
124
|
end
|
data/lib/invoice.rb
CHANGED
@@ -328,7 +328,7 @@ module BlackStack
|
|
328
328
|
#
|
329
329
|
BlackStack::Movement.where(:id_invoice_item => item.id).all { |mov|
|
330
330
|
#
|
331
|
-
mov.expire(self.billing_period_from) if mov.expiration_on_next_payment == true
|
331
|
+
mov.expire(self.billing_period_from, "Expiration of <a href='/member/record?rid=#{mov.id.to_guid}'>record:#{mov.id.to_guid}</a> because subscription renewal.") if mov.expiration_on_next_payment == true
|
332
332
|
#
|
333
333
|
DB.disconnect
|
334
334
|
GC.start
|
@@ -345,7 +345,7 @@ module BlackStack
|
|
345
345
|
# obtengo descriptor del producto
|
346
346
|
prod = BlackStack::InvoicingPaymentsProcessing.product_descriptor(plan[:product_code])
|
347
347
|
# registro el pago
|
348
|
-
BlackStack::Movement.new().parse(item, BlackStack::Movement::MOVEMENT_TYPE_ADD_PAYMENT, "
|
348
|
+
BlackStack::Movement.new().parse(item, BlackStack::Movement::MOVEMENT_TYPE_ADD_PAYMENT, "Payment of <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", payment_time, item.id).save()
|
349
349
|
# agrego los bonos de este plan
|
350
350
|
if !plan[:bonus_plans].nil?
|
351
351
|
plan[:bonus_plans].each { |h|
|
@@ -359,7 +359,7 @@ module BlackStack
|
|
359
359
|
bonus.units = plan_bonus[:credits] * item.number_of_packages # agrego los creditos del bono, multiplicado por la cantiad de paquetes
|
360
360
|
bonus.amount = 0
|
361
361
|
bonus.item_number = plan_bonus[:item_number]
|
362
|
-
BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS,
|
362
|
+
BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS, "Bonus from the <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", payment_time, item.id).save()
|
363
363
|
}
|
364
364
|
end # if !plan[:bonus_plans].nil?
|
365
365
|
#
|
@@ -624,12 +624,12 @@ module BlackStack
|
|
624
624
|
item1.detail = u.detail.to_s
|
625
625
|
item1.description = u.description.to_s
|
626
626
|
item1.save()
|
627
|
-
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE,
|
627
|
+
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Full Refund of <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
|
628
628
|
# si el balance quedo en negativo, entonces aplico otro ajuste
|
629
629
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).amount.to_f
|
630
630
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).credits.to_f
|
631
631
|
if net_amount < 0 && net_credits < 0
|
632
|
-
adjust = self.client.adjustment(u.product_code.to_s, net_amount, net_credits,
|
632
|
+
adjust = self.client.adjustment(u.product_code.to_s, net_amount, net_credits, "Adjustment for Negative Balance After Refund of <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
|
633
633
|
adjust.id_invoice_item = item1.id
|
634
634
|
adjust.save
|
635
635
|
end # if net_amount < 0
|
@@ -659,11 +659,11 @@ module BlackStack
|
|
659
659
|
item1.detail = t.detail.to_s
|
660
660
|
item1.description = t.description.to_s
|
661
661
|
item1.save()
|
662
|
-
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE,
|
662
|
+
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Partial Refund of <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
|
663
663
|
# agrego un ajuste por el redondeo a una cantidad entera de creditos
|
664
664
|
if float_units.to_f != units.to_f
|
665
665
|
adjustment_amount = unit_price.to_f * (units.to_f - float_units.to_f)
|
666
|
-
adjust = self.client.adjustment(t.product_code.to_s, adjustment_amount, 0,
|
666
|
+
adjust = self.client.adjustment(t.product_code.to_s, adjustment_amount, 0, "Adjustment for Refund of <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", BlackStack::Movement::MOVEMENT_TYPE_REFUND_ADJUSTMENT)
|
667
667
|
adjust.id_invoice_item = item1.id
|
668
668
|
adjust.save
|
669
669
|
end
|
@@ -671,7 +671,7 @@ module BlackStack
|
|
671
671
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).amount.to_f
|
672
672
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).credits.to_f
|
673
673
|
if net_amount < 0 && net_credits < 0
|
674
|
-
adjust = self.client.adjustment(t.product_code.to_s, net_amount, net_credits,
|
674
|
+
adjust = self.client.adjustment(t.product_code.to_s, net_amount, net_credits, "Adjustment for Negative Balance After Refund of <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
|
675
675
|
adjust.id_invoice_item = item1.id
|
676
676
|
adjust.save
|
677
677
|
end # if net_amount < 0
|
data/lib/movement.rb
CHANGED
@@ -15,6 +15,19 @@ module BlackStack
|
|
15
15
|
MOVEMENT_TYPE_ADJUSTMENT = 6 # it can be recalculated
|
16
16
|
MOVEMENT_TYPE_REFUND_ADJUSTMENT = 7 # it cannot be recalculated
|
17
17
|
|
18
|
+
def self.types()
|
19
|
+
[
|
20
|
+
MOVEMENT_TYPE_ADD_PAYMENT,
|
21
|
+
MOVEMENT_TYPE_ADD_BONUS,
|
22
|
+
MOVEMENT_TYPE_REASSIGN_BALANCE,
|
23
|
+
MOVEMENT_TYPE_REFUND_BALANCE,
|
24
|
+
MOVEMENT_TYPE_CANCELATION,
|
25
|
+
MOVEMENT_TYPE_EXPIRATION,
|
26
|
+
MOVEMENT_TYPE_ADJUSTMENT,
|
27
|
+
MOVEMENT_TYPE_REFUND_ADJUSTMENT
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
18
31
|
def self.typeName(t)
|
19
32
|
if (t==MOVEMENT_TYPE_ADD_PAYMENT)
|
20
33
|
return "Payment"
|
@@ -25,9 +38,13 @@ module BlackStack
|
|
25
38
|
elsif (t==MOVEMENT_TYPE_REFUND_BALANCE)
|
26
39
|
return "Refund"
|
27
40
|
elsif (t==MOVEMENT_TYPE_CANCELATION)
|
28
|
-
return "
|
41
|
+
return "Consumption"
|
29
42
|
elsif (t==MOVEMENT_TYPE_EXPIRATION)
|
30
43
|
return "Expiration"
|
44
|
+
elsif (t==MOVEMENT_TYPE_ADJUSTMENT)
|
45
|
+
return "Credit Adjustement"
|
46
|
+
elsif (t==MOVEMENT_TYPE_REFUND_ADJUSTMENT)
|
47
|
+
return "Refund Adjustement"
|
31
48
|
end
|
32
49
|
'(unknown)'
|
33
50
|
end
|
@@ -36,22 +53,30 @@ module BlackStack
|
|
36
53
|
BlackStack::Movement::typeName(self.type)
|
37
54
|
end
|
38
55
|
|
39
|
-
def typeColorName()
|
40
|
-
if (
|
56
|
+
def self.typeColorName(t)
|
57
|
+
if (t==MOVEMENT_TYPE_ADD_PAYMENT)
|
41
58
|
return "green"
|
42
|
-
elsif (
|
43
|
-
return "
|
44
|
-
elsif (
|
59
|
+
elsif (t==MOVEMENT_TYPE_ADD_BONUS)
|
60
|
+
return "green"
|
61
|
+
elsif (t==MOVEMENT_TYPE_REASSIGN_BALANCE)
|
45
62
|
return "black"
|
46
|
-
elsif (
|
63
|
+
elsif (t==MOVEMENT_TYPE_REFUND_BALANCE)
|
47
64
|
return "red"
|
48
|
-
elsif (
|
65
|
+
elsif (t==MOVEMENT_TYPE_CANCELATION)
|
49
66
|
return "blue"
|
50
|
-
elsif (
|
67
|
+
elsif (t==MOVEMENT_TYPE_EXPIRATION)
|
51
68
|
return "blue"
|
69
|
+
elsif (t==MOVEMENT_TYPE_ADJUSTMENT)
|
70
|
+
return "orange"
|
71
|
+
elsif (t==MOVEMENT_TYPE_REFUND_ADJUSTMENT)
|
72
|
+
return "orange"
|
52
73
|
end
|
53
74
|
end
|
54
|
-
|
75
|
+
|
76
|
+
def typeName()
|
77
|
+
BlackStack::Movement::typeColorName(self.type)
|
78
|
+
end
|
79
|
+
|
55
80
|
# actualiza el registro con los valores del item de una factura
|
56
81
|
# type may be either MOVEMENT_TYPE_ADD_PAYMENT or MOVEMENT_TYPE_ADD_BONUS or MOVEMENT_TYPE_REFUND_BALANCE, but not other value
|
57
82
|
def parse(item, type=MOVEMENT_TYPE_ADD_PAYMENT, description='n/a', payment_time=nil, id_item=nil)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invoicing_payments_processing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.49
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Daniel Sardi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket
|