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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/invoice.rb +25 -23
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2017f7ce80ba1e39b308c00c9a771c4b310fb753
4
- data.tar.gz: f085954e5f6fe93aee0dad9c32ff0f1ad1ca1953
3
+ metadata.gz: 36b5fd6212a599f4855cbfce22cf021275bef49c
4
+ data.tar.gz: 98bf47011621c2518e1f377a80cadfbb3114d786
5
5
  SHA512:
6
- metadata.gz: 8adc9a2686330b4361a774257fad71305957d2a9e6a7a5f082f4d1ede26edaade1475bd0251230e173720e2611b23aa4730db3fe9293ab61714e5e7405532852
7
- data.tar.gz: a72f0bb3d39581d8a99bf9a0dcb6d52428cdc021685a60d19c0e0412cd2b85092d0583d3155e6011ca21c4bd1c87e15292d94cede5f4b869fa2757a71bda7e0d
6
+ metadata.gz: ff41e764185ebcc320595801cbddf48aecc34fc28dc48b8f82bdceb4660d63a74d88b25c51b53c93895685397dd38524fa023443fe040bcfab4300019ffb31b7
7
+ data.tar.gz: e6f2aa52eeb41fdd00f9f4b1635d81d73d5982f737312868615c1a076ac5a3dbf5b09da0658e2e0e92febf0fc7d6424fc90214e82f764d5efb7e7f9faf5d8fc5
@@ -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].each { |bonus|
629
- i = BlackStack::InvoicingPaymentsProcessing::plans_descriptor.select { |obj| obj[:item_number] == bonus[:item_number] }.first
630
- j = BlackStack::InvoicingPaymentsProcessing::products_descriptor.select { |obj| obj[:code] == i[:product_code] }.first
631
- item2 = BlackStack::InvoiceItem.new()
632
- item2.id = guid()
633
- item2.id_invoice = self.id
634
- item2.unit_price = 0
635
- item2.units = -i[:credits]
636
- item2.amount = 0
637
- item2.product_code = i[:product_code].to_s
638
- item2.item_number = i[:item_number].to_s
639
- item2.detail = 'Bonus Refund'
640
- item2.description = j[:description].to_s
641
- item2.save()
642
- 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()
643
- net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).amount.to_f
644
- net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, i[:product_code].to_s).credits.to_f
645
- if net_amount <= 0 && net_credits < 0
646
- 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>.")
647
- adjust.id_invoice_item = item1.id
648
- adjust.save
649
- end # if net_amount < 0
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invoicing_payments_processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.67
4
+ version: 1.1.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi