invoicing_payments_processing 1.1.43 → 1.1.48

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 140493643f70cd83e346ae581dc3a8008f32d000
4
- data.tar.gz: 80ea68be7f8cf7bacdbb937513a1a6c958b2e3c7
3
+ metadata.gz: f4e47e64797dda88bd7b65fe1a51b7c6ad5deb71
4
+ data.tar.gz: df21c11687542c76574d1e0c838232415af5ef34
5
5
  SHA512:
6
- metadata.gz: 54a7d6e151c012c5b9ce42e40cf4522f9f3f90d375b10781aafbb4e2e377f466cc16fed06dee1df74ff2b87c24a2f1c6547fb3204dded209926fd26bfb7db392
7
- data.tar.gz: 0f192df5ad0552d02daf1151dd73a802ec34507a9eb79fe50f3a79fb09f217839c5293ac6ed027ae241af36478686178f2a8058f610ed301b9e88d163d6886bb
6
+ metadata.gz: c032c751ad2c959c876afe5de690913a9435da9050c17ceca83ddcddf49857938b1805047788b9c8c0a536ef06beefedbfb21ae779b44cc80c67f05372b66ca2
7
+ data.tar.gz: 76541dcf86cf8bd60fdc61622504f3fd2e672f45f2e7c1b00a94620537f5f95442fafb61154586835d1692983a17f920a9ff9c096c648426640626cfe26b2dc4
@@ -118,7 +118,7 @@ module BlackStack
118
118
  total_credits = credits_paid
119
119
  total_amount = amount_paid
120
120
  if total_credits < 0
121
- self.adjustment(product_code, total_amount, total_credits, 'Adjustment Because Quota Has Been Exceeded.', BlackStack::Movement::MOVEMENT_TYPE_ADJUSTMENT, o.create_time)
121
+ self. adjustment(product_code, total_amount, total_credits, 'Adjustment Because Quota Has Been Exceeded.', BlackStack::Movement::MOVEMENT_TYPE_ADJUSTMENT, o.create_time)
122
122
  amount_paid = 0.to_f
123
123
  credits_paid = 0.to_i
124
124
  end
@@ -328,7 +328,7 @@ module BlackStack
328
328
  #
329
329
  BlackStack::Movement.where(:id_invoice_item => item.id).all { |mov|
330
330
  #
331
- mov.expire(self.billing_period_from) if mov.expiration_on_next_payment == true
331
+ 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
332
332
  #
333
333
  DB.disconnect
334
334
  GC.start
@@ -345,7 +345,7 @@ module BlackStack
345
345
  # obtengo descriptor del producto
346
346
  prod = BlackStack::InvoicingPaymentsProcessing.product_descriptor(plan[:product_code])
347
347
  # registro el pago
348
- BlackStack::Movement.new().parse(item, BlackStack::Movement::MOVEMENT_TYPE_ADD_PAYMENT, "Invoice Payment", payment_time, item.id).save()
348
+ 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()
349
349
  # agrego los bonos de este plan
350
350
  if !plan[:bonus_plans].nil?
351
351
  plan[:bonus_plans].each { |h|
@@ -359,7 +359,7 @@ module BlackStack
359
359
  bonus.units = plan_bonus[:credits] * item.number_of_packages # agrego los creditos del bono, multiplicado por la cantiad de paquetes
360
360
  bonus.amount = 0
361
361
  bonus.item_number = plan_bonus[:item_number]
362
- BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS, 'Payment Bonus', payment_time, item.id).save()
362
+ 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()
363
363
  }
364
364
  end # if !plan[:bonus_plans].nil?
365
365
  #
@@ -624,12 +624,12 @@ module BlackStack
624
624
  item1.detail = u.detail.to_s
625
625
  item1.description = u.description.to_s
626
626
  item1.save()
627
- BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, 'Full Refund').save()
627
+ 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()
628
628
  # si el balance quedo en negativo, entonces aplico otro ajuste
629
629
  net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).amount.to_f
630
630
  net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, u.product_code.to_s).credits.to_f
631
631
  if net_amount < 0 && net_credits < 0
632
- adjust = self.client.adjustment(u.product_code.to_s, net_amount, net_credits, 'Adjustment for Negative Balance after Refund')
632
+ 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>.")
633
633
  adjust.id_invoice_item = item1.id
634
634
  adjust.save
635
635
  end # if net_amount < 0
@@ -659,11 +659,11 @@ module BlackStack
659
659
  item1.detail = t.detail.to_s
660
660
  item1.description = t.description.to_s
661
661
  item1.save()
662
- BlackStack::Movement.new().parse(item1, BlackStack::Movement::MOVEMENT_TYPE_REFUND_BALANCE, 'Partial Refund').save()
662
+ 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()
663
663
  # agrego un ajuste por el redondeo a una cantidad entera de creditos
664
664
  if float_units.to_f != units.to_f
665
665
  adjustment_amount = unit_price.to_f * (units.to_f - float_units.to_f)
666
- adjust = self.client.adjustment(t.product_code.to_s, adjustment_amount, 0, 'Adjustment for Partial Refund', BlackStack::Movement::MOVEMENT_TYPE_REFUND_ADJUSTMENT)
666
+ 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)
667
667
  adjust.id_invoice_item = item1.id
668
668
  adjust.save
669
669
  end
@@ -671,7 +671,7 @@ module BlackStack
671
671
  net_amount = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).amount.to_f
672
672
  net_credits = 0.to_f - BlackStack::Balance.new(self.client.id, t.product_code.to_s).credits.to_f
673
673
  if net_amount < 0 && net_credits < 0
674
- adjust = self.client.adjustment(t.product_code.to_s, net_amount, net_credits, 'Adjustment for Negative Balance')
674
+ 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>.")
675
675
  adjust.id_invoice_item = item1.id
676
676
  adjust.save
677
677
  end # if net_amount < 0
@@ -15,38 +15,68 @@ module BlackStack
15
15
  MOVEMENT_TYPE_ADJUSTMENT = 6 # it can be recalculated
16
16
  MOVEMENT_TYPE_REFUND_ADJUSTMENT = 7 # it cannot be recalculated
17
17
 
18
- def typeName()
19
- if (self.type==MOVEMENT_TYPE_ADD_PAYMENT)
18
+ def self.types()
19
+ [
20
+ MOVEMENT_TYPE_ADD_PAYMENT,
21
+ MOVEMENT_TYPE_ADD_BONUS,
22
+ MOVEMENT_TYPE_REASSIGN_BALANCE,
23
+ MOVEMENT_TYPE_REFUND_BALANCE,
24
+ MOVEMENT_TYPE_CANCELATION,
25
+ MOVEMENT_TYPE_EXPIRATION,
26
+ MOVEMENT_TYPE_ADJUSTMENT,
27
+ MOVEMENT_TYPE_REFUND_ADJUSTMENT
28
+ ]
29
+ end
30
+
31
+ def self.typeName(t)
32
+ if (t==MOVEMENT_TYPE_ADD_PAYMENT)
20
33
  return "Payment"
21
- elsif (self.type==MOVEMENT_TYPE_ADD_BONUS)
34
+ elsif (t==MOVEMENT_TYPE_ADD_BONUS)
22
35
  return "Bonus"
23
- elsif (self.type==MOVEMENT_TYPE_REASSIGN_BALANCE)
36
+ elsif (t==MOVEMENT_TYPE_REASSIGN_BALANCE)
24
37
  return "Reassignation"
25
- elsif (self.type==MOVEMENT_TYPE_REFUND_BALANCE)
38
+ elsif (t==MOVEMENT_TYPE_REFUND_BALANCE)
26
39
  return "Refund"
27
- elsif (self.type==MOVEMENT_TYPE_CANCELATION)
28
- return "Service"
29
- elsif (self.type==MOVEMENT_TYPE_EXPIRATION)
40
+ elsif (t==MOVEMENT_TYPE_CANCELATION)
41
+ return "Consumption"
42
+ elsif (t==MOVEMENT_TYPE_EXPIRATION)
30
43
  return "Expiration"
44
+ elsif (t==MOVEMENT_TYPE_ADJUSTMENT)
45
+ return "Credit Adjustement"
46
+ elsif (t==MOVEMENT_TYPE_REFUND_ADJUSTMENT)
47
+ return "Refund Adjustement"
31
48
  end
49
+ '(unknown)'
50
+ end
51
+
52
+ def typeName()
53
+ BlackStack::Movement::typeName(self.type)
32
54
  end
33
55
 
34
- def typeColorName()
35
- if (self.type==MOVEMENT_TYPE_ADD_PAYMENT)
56
+ def self.typeColorName(t)
57
+ if (t==MOVEMENT_TYPE_ADD_PAYMENT)
36
58
  return "green"
37
- elsif (self.type==MOVEMENT_TYPE_ADD_BONUS)
38
- return "orange"
39
- elsif (self.type==MOVEMENT_TYPE_REASSIGN_BALANCE)
59
+ elsif (t==MOVEMENT_TYPE_ADD_BONUS)
60
+ return "green"
61
+ elsif (t==MOVEMENT_TYPE_REASSIGN_BALANCE)
40
62
  return "black"
41
- elsif (self.type==MOVEMENT_TYPE_REFUND_BALANCE)
63
+ elsif (t==MOVEMENT_TYPE_REFUND_BALANCE)
42
64
  return "red"
43
- elsif (self.type==MOVEMENT_TYPE_CANCELATION)
65
+ elsif (t==MOVEMENT_TYPE_CANCELATION)
44
66
  return "blue"
45
- elsif (self.type==MOVEMENT_TYPE_EXPIRATION)
67
+ elsif (t==MOVEMENT_TYPE_EXPIRATION)
46
68
  return "blue"
69
+ elsif (t==MOVEMENT_TYPE_ADJUSTMENT)
70
+ return "orange"
71
+ elsif (t==MOVEMENT_TYPE_REFUND_ADJUSTMENT)
72
+ return "orange"
47
73
  end
48
74
  end
49
-
75
+
76
+ def typeName()
77
+ BlackStack::Movement::typeColorName(self.type)
78
+ end
79
+
50
80
  # actualiza el registro con los valores del item de una factura
51
81
  # type may be either MOVEMENT_TYPE_ADD_PAYMENT or MOVEMENT_TYPE_ADD_BONUS or MOVEMENT_TYPE_REFUND_BALANCE, but not other value
52
82
  def parse(item, type=MOVEMENT_TYPE_ADD_PAYMENT, description='n/a', payment_time=nil, id_item=nil)
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.43
4
+ version: 1.1.48
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-10-22 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket