invoicing_payments_processing 1.1.72 → 1.1.78

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20c2d6fe3d2345b3468bb8d4903626e2efbde5f6
4
- data.tar.gz: 303e1555e77d60b5b8e20c4aa7a7e62c76c271ae
3
+ metadata.gz: bc29bbc8e8de50323dfb0caddff369cba7d09922
4
+ data.tar.gz: 88af63ae57bd4234fb5b51979028e1e1be901f45
5
5
  SHA512:
6
- metadata.gz: 23dad2e9670797a5ce76978577e92ada0b9c8b41c3fad46c8ad4ffe7a6443011b011b0a1bdf3aaff8e07d874a34cf236fbc5561874d368f8a0ae97a989ad90a0
7
- data.tar.gz: 2d272bdea48b9320799a7231ec9598de1fd1c6c11ae839c51a45f4b42a4d6334fd6a034aa266c971f73442f8c505667847352e719d2dbdf0ade234dfb102b4c1
6
+ metadata.gz: a5614fe05c4c50b376e0516db977d515786609d8230ee96360bf3028af6338646dd0db302b54acfb44c273c7e2860e0238cba2c8cde24bae6b2a734e1e42ac0e
7
+ data.tar.gz: 2b9107a0495003e99426ddec80512aaf072b57fb3dbdd7bf496f1d5d2d245046efd9da90c503cbf82355d6d80294ab04643a0c3fe8e8ae188de22a3aa8fe126a
@@ -41,7 +41,7 @@ module BlackStack
41
41
  "FROM client c WITH (NOLOCK) " +
42
42
  "JOIN movement m WITH (NOLOCK INDEX(IX_movement__id_client__create_time_desc)) ON ( " +
43
43
  " c.id=m.id_client AND " +
44
- " ( m.create_time > ISNULL(c.last_stat_balance_update_time, '1900-01-01') OR ISNULL(c.last_stat_balance_update_time, '2200-01-01') < DATEADD(DD,-1,GETDATE()) ) " +
44
+ " m.create_time > ISNULL(c.last_stat_balance_update_time, '1900-01-01') " +
45
45
  ") " +
46
46
  "WHERE c.id = '#{self.id}' " +
47
47
  "ORDER BY m.create_time DESC "
@@ -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
- # "from movement m with (nolock index(IX_movement__id_client__product_code)) " +
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,13 @@ module BlackStack
201
201
 
202
202
  values[:a3] = 0
203
203
  self.items.each { |i|
204
- if trial1 && i.units!=i.plan_descriptor[:trial_credits]
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='/member/record?rid=#{mov.id.to_guid}'>record:#{mov.id.to_guid}</a> because subscription renewal.") if mov.expiration_on_next_payment == true
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", payment_time, item.id).save()
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", payment_time, item.id).save()
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.", BlackStack::Movement::MOVEMENT_TYPE_REFUND_ADJUSTMENT)
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.").save()
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='/member/invoice?iid=#{self.id.to_guid}'>invoice:#{self.id.to_guid}</a>.")
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.72
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: 2020-11-14 00:00:00.000000000 Z
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.1
99
+ version: 1.1.24
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 1.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.1
109
+ version: 1.1.24
110
110
  - - ">="
111
111
  - !ruby/object:Gem::Version
112
- version: 1.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: []