invoicing_payments_processing 1.1.67 → 1.1.68
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/invoice.rb +25 -23
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36b5fd6212a599f4855cbfce22cf021275bef49c
|
4
|
+
data.tar.gz: 98bf47011621c2518e1f377a80cadfbb3114d786
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff41e764185ebcc320595801cbddf48aecc34fc28dc48b8f82bdceb4660d63a74d88b25c51b53c93895685397dd38524fa023443fe040bcfab4300019ffb31b7
|
7
|
+
data.tar.gz: e6f2aa52eeb41fdd00f9f4b1635d81d73d5982f737312868615c1a076ac5a3dbf5b09da0658e2e0e92febf0fc7d6424fc90214e82f764d5efb7e7f9faf5d8fc5
|
data/lib/invoice.rb
CHANGED
@@ -625,29 +625,31 @@ module BlackStack
|
|
625
625
|
end # if net_amount < 0
|
626
626
|
# hago el reembolso de cada bono de este item
|
627
627
|
# si el balance quedo en negativo, entonces aplico otro ajuste
|
628
|
-
h[:bonus_plans].
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
628
|
+
if !h[:bonus_plans].nil?
|
629
|
+
h[:bonus_plans].each { |bonus|
|
630
|
+
i = BlackStack::InvoicingPaymentsProcessing::plans_descriptor.select { |obj| obj[:item_number] == bonus[:item_number] }.first
|
631
|
+
j = BlackStack::InvoicingPaymentsProcessing::products_descriptor.select { |obj| obj[:code] == i[:product_code] }.first
|
632
|
+
item2 = BlackStack::InvoiceItem.new()
|
633
|
+
item2.id = guid()
|
634
|
+
item2.id_invoice = self.id
|
635
|
+
item2.unit_price = 0
|
636
|
+
item2.units = -i[:credits]
|
637
|
+
item2.amount = 0
|
638
|
+
item2.product_code = i[:product_code].to_s
|
639
|
+
item2.item_number = i[:item_number].to_s
|
640
|
+
item2.detail = 'Bonus Refund'
|
641
|
+
item2.description = j[:description].to_s
|
642
|
+
item2.save()
|
643
|
+
BlackStack::Movement.new().parse(item2, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, "Bonus Refund of <a href='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
|
644
|
+
net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).amount.to_f
|
645
|
+
net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).credits.to_f
|
646
|
+
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
|
648
|
+
adjust.id_invoice_item = item1.id
|
649
|
+
adjust.save
|
650
|
+
end # if net_amount < 0
|
651
|
+
}
|
652
|
+
end # if !h[:bonus_plans].nil?
|
651
653
|
# release resources
|
652
654
|
DB.disconnect
|
653
655
|
GC.start
|