invoicing_payments_processing 1.1.73 → 1.1.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/extend_client_by_invoicing_payments_processing.rb +4 -3
- data/lib/invoice.rb +21 -13
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc4d1525e38dde0ee2bbd75d5d9e0998b8428bb
|
4
|
+
data.tar.gz: e4ced70f73f3cfd8e567d76cd46571ca74f99609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 974ae0f07fc60ef3a79aac1ba71ef318fd6243159bb11e2c94a0a4ead79ec0093473b7144dc65c1856da48231b35576596634723e4ddd57fdaf69374768bac28
|
7
|
+
data.tar.gz: 579d1efbe81561d8c93f7a2f5f6408e934e767422fbfacadb6954a34c5057dbb8f6c4efc3cae15f332f3f8b3effcca487251f2e5532b909cd0b98dc7e697cd13
|
@@ -62,8 +62,8 @@ module BlackStack
|
|
62
62
|
product_descriptors.each { |hprod|
|
63
63
|
row = DB[
|
64
64
|
"select isnull(sum(isnull(m.credits,0)),0) as credits, isnull(sum(isnull(m.amount,0)),0) as amount " +
|
65
|
-
|
66
|
-
"from movement m with (nolock) " +
|
65
|
+
"from movement m with (nolock index(IX_movement__id_client__product_code)) " +
|
66
|
+
#"from movement m with (nolock) " +
|
67
67
|
"where m.id_client='#{c.id}' " +
|
68
68
|
"and m.product_code='#{hprod[:code]}' "
|
69
69
|
].first
|
@@ -347,7 +347,8 @@ module BlackStack
|
|
347
347
|
end
|
348
348
|
|
349
349
|
q +=
|
350
|
-
"WHERE i.id_client='#{self.id}' "
|
350
|
+
"WHERE i.id_client='#{self.id}' " +
|
351
|
+
"AND i.delete_time IS NULL "
|
351
352
|
|
352
353
|
return !DB[q].first.nil?
|
353
354
|
end
|
data/lib/invoice.rb
CHANGED
@@ -201,7 +201,15 @@ module BlackStack
|
|
201
201
|
|
202
202
|
values[:a3] = 0
|
203
203
|
self.items.each { |i|
|
204
|
-
|
204
|
+
puts
|
205
|
+
puts
|
206
|
+
puts "i.id.to_s:#{i.id.to_s}:."
|
207
|
+
puts "i.id_invoice.to_s:#{i.id_invoice.to_s}:."
|
208
|
+
puts "i.units.to_i.to_s:#{i.units.to_i.to_s}:."
|
209
|
+
puts "i.plan_descriptor[:trial_credits].to_i.to_s:#{i.plan_descriptor[:trial_credits].to_i.to_s}:."
|
210
|
+
puts
|
211
|
+
puts
|
212
|
+
if trial1 && i.units.to_i!=i.plan_descriptor[:trial_credits].to_i
|
205
213
|
raise 'Cannot order more than 1 package and trial in the same invoice'
|
206
214
|
elsif trial1
|
207
215
|
values[:a3] += i.plan_descriptor[:fee].to_f
|
@@ -317,7 +325,7 @@ module BlackStack
|
|
317
325
|
#
|
318
326
|
BlackStack::Movement.where(:id_invoice_item => item.id).all { |mov|
|
319
327
|
#
|
320
|
-
mov.expire(self.billing_period_from, "Expiration of <a href='/
|
328
|
+
mov.expire(self.billing_period_from, "Expiration of <a href='/settings/record?rid=#{mov.id.to_guid}'>record:#{mov.id.to_guid}</a> because subscription renewal.") if mov.expiration_on_next_payment == true
|
321
329
|
#
|
322
330
|
DB.disconnect
|
323
331
|
GC.start
|
@@ -334,7 +342,7 @@ module BlackStack
|
|
334
342
|
# obtengo descriptor del producto
|
335
343
|
prod = BlackStack::InvoicingPaymentsProcessing.product_descriptor(plan[:product_code])
|
336
344
|
# registro el pago
|
337
|
-
BlackStack::Movement.new().parse(item, BlackStack::Movement::MOVEMENT_TYPE_ADD_PAYMENT, "Payment of <a href='/
|
345
|
+
BlackStack::Movement.new().parse(item, BlackStack::Movement::MOVEMENT_TYPE_ADD_PAYMENT, "Payment of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", payment_time, item.id).save()
|
338
346
|
# agrego los bonos de este plan
|
339
347
|
if !plan[:bonus_plans].nil?
|
340
348
|
plan[:bonus_plans].each { |h|
|
@@ -348,7 +356,7 @@ module BlackStack
|
|
348
356
|
bonus.units = plan_bonus[:credits] * item.number_of_packages # agrego los creditos del bono, multiplicado por la cantiad de paquetes
|
349
357
|
bonus.amount = 0
|
350
358
|
bonus.item_number = plan_bonus[:item_number]
|
351
|
-
BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS, "Bonus from the <a href='/
|
359
|
+
BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS, "Bonus from the <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", payment_time, item.id).save()
|
352
360
|
}
|
353
361
|
end # if !plan[:bonus_plans].nil?
|
354
362
|
#
|
@@ -615,11 +623,11 @@ module BlackStack
|
|
615
623
|
item1.save()
|
616
624
|
# hago el reembolso de este item
|
617
625
|
# si el balance quedo en negativo, entonces aplico otro ajuste
|
618
|
-
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Full Refund of <a href='/
|
626
|
+
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Full Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
|
619
627
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).amount.to_f
|
620
628
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).credits.to_f
|
621
629
|
if net_amount <= 0 && net_credits < 0
|
622
|
-
adjust = self.client.adjustment(u.product_code.to_s, net_amount, net_credits, "Adjustment for Negative Balance After Refund of <a href='/
|
630
|
+
adjust = self.client.adjustment(u.product_code.to_s, net_amount, net_credits, "Adjustment for Negative Balance After Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
|
623
631
|
adjust.id_invoice_item = item1.id
|
624
632
|
adjust.save
|
625
633
|
end # if net_amount < 0
|
@@ -640,11 +648,11 @@ module BlackStack
|
|
640
648
|
item2.detail = 'Bonus Refund'
|
641
649
|
item2.description = j[:description].to_s
|
642
650
|
item2.save()
|
643
|
-
BlackStack::Movement.new().parse(item2, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Bonus Refund of <a href='/
|
651
|
+
BlackStack::Movement.new().parse(item2, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Bonus Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
|
644
652
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).amount.to_f
|
645
653
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).credits.to_f
|
646
654
|
if net_amount <= 0 && net_credits < 0
|
647
|
-
adjust = self.client.adjustment(i[:product_code].to_s, net_amount, net_credits, "Adjustment for Negative Balance After Bonus Refund of <a href='/
|
655
|
+
adjust = self.client.adjustment(i[:product_code].to_s, net_amount, net_credits, "Adjustment for Negative Balance After Bonus Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
|
648
656
|
adjust.id_invoice_item = item1.id
|
649
657
|
adjust.save
|
650
658
|
end # if net_amount < 0
|
@@ -676,11 +684,11 @@ module BlackStack
|
|
676
684
|
item1.detail = t.detail.to_s
|
677
685
|
item1.description = t.description.to_s
|
678
686
|
item1.save()
|
679
|
-
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Partial Refund of <a href='/
|
687
|
+
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Partial Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
|
680
688
|
# agrego un ajuste por el redondeo a una cantidad entera de creditos
|
681
689
|
if float_units.to_f != units.to_f
|
682
690
|
adjustment_amount = unit_price.to_f * (units.to_f - float_units.to_f)
|
683
|
-
adjust = self.client.adjustment(t.product_code.to_s, adjustment_amount, 0, "Adjustment for Refund of <a href='/
|
691
|
+
adjust = self.client.adjustment(t.product_code.to_s, adjustment_amount, 0, "Adjustment for Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", BlackStack::Movement::MOVEMENT_TYPE_REFUND_ADJUSTMENT)
|
684
692
|
adjust.id_invoice_item = item1.id
|
685
693
|
adjust.save
|
686
694
|
end
|
@@ -688,7 +696,7 @@ module BlackStack
|
|
688
696
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).amount.to_f
|
689
697
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).credits.to_f
|
690
698
|
if net_amount < 0 && net_credits < 0
|
691
|
-
adjust = self.client.adjustment(t.product_code.to_s, net_amount, net_credits, "Adjustment for Negative Balance After Refund of <a href='/
|
699
|
+
adjust = self.client.adjustment(t.product_code.to_s, net_amount, net_credits, "Adjustment for Negative Balance After Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
|
692
700
|
adjust.id_invoice_item = item1.id
|
693
701
|
adjust.save
|
694
702
|
end # if net_amount < 0
|
@@ -714,11 +722,11 @@ module BlackStack
|
|
714
722
|
item2.detail = 'Bonus Refund'
|
715
723
|
item2.description = j[:description].to_s
|
716
724
|
item2.save()
|
717
|
-
BlackStack::Movement.new().parse(item2, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Bonus Refund of <a href='/
|
725
|
+
BlackStack::Movement.new().parse(item2, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Bonus Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
|
718
726
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).amount.to_f
|
719
727
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).credits.to_f
|
720
728
|
if net_amount <= 0 && net_credits < 0
|
721
|
-
adjust = self.client.adjustment(i[:product_code].to_s, net_amount, net_credits, "Adjustment for Negative Balance After Bonus Refund of <a href='/
|
729
|
+
adjust = self.client.adjustment(i[:product_code].to_s, net_amount, net_credits, "Adjustment for Negative Balance After Bonus Refund of <a href='/settings/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
|
722
730
|
adjust.id_invoice_item = item1.id
|
723
731
|
adjust.save
|
724
732
|
end # if net_amount < 0
|
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.79
|
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:
|
11
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket
|
@@ -96,20 +96,20 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 1.1.
|
99
|
+
version: 1.1.24
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.1.
|
102
|
+
version: 1.1.24
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.1.
|
109
|
+
version: 1.1.24
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 1.1.
|
112
|
+
version: 1.1.24
|
113
113
|
description: 'THIS GEM IS STILL IN DEVELOPMENT STAGE. Find documentation here: https://github.com/leandrosardi/invoicing_payments_processing.'
|
114
114
|
email: leandro.sardi@expandedventure.com
|
115
115
|
executables: []
|