invoicing_payments_processing 1.1.76 → 1.1.78
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/invoice.rb +19 -13
- 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: bc29bbc8e8de50323dfb0caddff369cba7d09922
|
4
|
+
data.tar.gz: 88af63ae57bd4234fb5b51979028e1e1be901f45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5614fe05c4c50b376e0516db977d515786609d8230ee96360bf3028af6338646dd0db302b54acfb44c273c7e2860e0238cba2c8cde24bae6b2a734e1e42ac0e
|
7
|
+
data.tar.gz: 2b9107a0495003e99426ddec80512aaf072b57fb3dbdd7bf496f1d5d2d245046efd9da90c503cbf82355d6d80294ab04643a0c3fe8e8ae188de22a3aa8fe126a
|
data/lib/invoice.rb
CHANGED
@@ -201,7 +201,13 @@ module BlackStack
|
|
201
201
|
|
202
202
|
values[:a3] = 0
|
203
203
|
self.items.each { |i|
|
204
|
-
|
204
|
+
puts
|
205
|
+
puts
|
206
|
+
puts "i.units.to_i.to_s:#{i.units.to_i.to_s}:."
|
207
|
+
puts "i.plan_descriptor[:trial_credits].to_i.to_s:#{i.plan_descriptor[:trial_credits].to_i.to_s}:."
|
208
|
+
puts
|
209
|
+
puts
|
210
|
+
if trial1 && i.units.to_i!=i.plan_descriptor[:trial_credits].to_i
|
205
211
|
raise 'Cannot order more than 1 package and trial in the same invoice'
|
206
212
|
elsif trial1
|
207
213
|
values[:a3] += i.plan_descriptor[:fee].to_f
|
@@ -317,7 +323,7 @@ module BlackStack
|
|
317
323
|
#
|
318
324
|
BlackStack::Movement.where(:id_invoice_item => item.id).all { |mov|
|
319
325
|
#
|
320
|
-
mov.expire(self.billing_period_from, "Expiration of <a href='/
|
326
|
+
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
327
|
#
|
322
328
|
DB.disconnect
|
323
329
|
GC.start
|
@@ -334,7 +340,7 @@ module BlackStack
|
|
334
340
|
# obtengo descriptor del producto
|
335
341
|
prod = BlackStack::InvoicingPaymentsProcessing.product_descriptor(plan[:product_code])
|
336
342
|
# registro el pago
|
337
|
-
BlackStack::Movement.new().parse(item, BlackStack::Movement::MOVEMENT_TYPE_ADD_PAYMENT, "Payment of <a href='/
|
343
|
+
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
344
|
# agrego los bonos de este plan
|
339
345
|
if !plan[:bonus_plans].nil?
|
340
346
|
plan[:bonus_plans].each { |h|
|
@@ -348,7 +354,7 @@ module BlackStack
|
|
348
354
|
bonus.units = plan_bonus[:credits] * item.number_of_packages # agrego los creditos del bono, multiplicado por la cantiad de paquetes
|
349
355
|
bonus.amount = 0
|
350
356
|
bonus.item_number = plan_bonus[:item_number]
|
351
|
-
BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS, "Bonus from the <a href='/
|
357
|
+
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
358
|
}
|
353
359
|
end # if !plan[:bonus_plans].nil?
|
354
360
|
#
|
@@ -615,11 +621,11 @@ module BlackStack
|
|
615
621
|
item1.save()
|
616
622
|
# hago el reembolso de este item
|
617
623
|
# 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='/
|
624
|
+
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
625
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).amount.to_f
|
620
626
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).credits.to_f
|
621
627
|
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='/
|
628
|
+
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
629
|
adjust.id_invoice_item = item1.id
|
624
630
|
adjust.save
|
625
631
|
end # if net_amount < 0
|
@@ -640,11 +646,11 @@ module BlackStack
|
|
640
646
|
item2.detail = 'Bonus Refund'
|
641
647
|
item2.description = j[:description].to_s
|
642
648
|
item2.save()
|
643
|
-
BlackStack::Movement.new().parse(item2, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Bonus Refund of <a href='/
|
649
|
+
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
650
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).amount.to_f
|
645
651
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).credits.to_f
|
646
652
|
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='/
|
653
|
+
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
654
|
adjust.id_invoice_item = item1.id
|
649
655
|
adjust.save
|
650
656
|
end # if net_amount < 0
|
@@ -676,11 +682,11 @@ module BlackStack
|
|
676
682
|
item1.detail = t.detail.to_s
|
677
683
|
item1.description = t.description.to_s
|
678
684
|
item1.save()
|
679
|
-
BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Partial Refund of <a href='/
|
685
|
+
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
686
|
# agrego un ajuste por el redondeo a una cantidad entera de creditos
|
681
687
|
if float_units.to_f != units.to_f
|
682
688
|
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='/
|
689
|
+
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
690
|
adjust.id_invoice_item = item1.id
|
685
691
|
adjust.save
|
686
692
|
end
|
@@ -688,7 +694,7 @@ module BlackStack
|
|
688
694
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).amount.to_f
|
689
695
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).credits.to_f
|
690
696
|
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='/
|
697
|
+
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
698
|
adjust.id_invoice_item = item1.id
|
693
699
|
adjust.save
|
694
700
|
end # if net_amount < 0
|
@@ -714,11 +720,11 @@ module BlackStack
|
|
714
720
|
item2.detail = 'Bonus Refund'
|
715
721
|
item2.description = j[:description].to_s
|
716
722
|
item2.save()
|
717
|
-
BlackStack::Movement.new().parse(item2, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Bonus Refund of <a href='/
|
723
|
+
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
724
|
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).amount.to_f
|
719
725
|
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).credits.to_f
|
720
726
|
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='/
|
727
|
+
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
728
|
adjust.id_invoice_item = item1.id
|
723
729
|
adjust.save
|
724
730
|
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.78
|
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
|