invoicing_payments_processing 1.1.36 → 1.1.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bufferpaypalnotification.rb +4 -1
- data/lib/invoice.rb +16 -20
- data/lib/movement.rb +13 -8
- 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: 96b6b82545bec9e8ad6436566f423590c675896b
|
4
|
+
data.tar.gz: 14c8e6fd2576d65d28d3bb47a464374140ed2b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d9d89e381365acb4bcde6021370f8486c3ede55d82821b8d4af7ded903bee26c008a7515cc2793dbd8a7c4f750921918f5964860d76e702ca49e033e163a58c
|
7
|
+
data.tar.gz: 15048cf0e56f42e72eeab5ba7a6f6ec75f40f6c3fbe8631d983eb496918e92ce27986094a488ed1e0a0e9de668c5439ed523340dfce7be03d48082f14f9fb538
|
@@ -236,6 +236,9 @@ module BlackStack
|
|
236
236
|
def self.process(params)
|
237
237
|
DB.transaction do
|
238
238
|
# verifico que no existe ya una notificacion
|
239
|
+
#puts
|
240
|
+
#puts
|
241
|
+
#puts "params2:#{params.to_s}:."
|
239
242
|
b = BlackStack::BufferPayPalNotification.where(:id=>params['id']).first
|
240
243
|
if b.nil?
|
241
244
|
# proceso la notificacion
|
@@ -299,7 +302,7 @@ module BlackStack
|
|
299
302
|
|
300
303
|
# marco la factura como pagada
|
301
304
|
# registro contable - bookkeeping
|
302
|
-
i.getPaid() if i.canBePaid?
|
305
|
+
i.getPaid(b.create_time) if i.canBePaid?
|
303
306
|
|
304
307
|
# crea una factura para el periodo siguiente (dia, semana, mes, anio)
|
305
308
|
j = BlackStack::Invoice.new()
|
data/lib/invoice.rb
CHANGED
@@ -212,7 +212,7 @@ module BlackStack
|
|
212
212
|
|
213
213
|
values[:a3] = 0
|
214
214
|
self.items.each { |i|
|
215
|
-
if
|
215
|
+
if trial1 && i.units!=i.plan_descriptor[:trial_credits]
|
216
216
|
raise 'Cannot order more than 1 package and trial in the same invoice'
|
217
217
|
elsif trial1
|
218
218
|
values[:a3] += i.plan_descriptor[:fee].to_f
|
@@ -315,6 +315,11 @@ module BlackStack
|
|
315
315
|
# marco la factura como pagada
|
316
316
|
self.status = BlackStack::Invoice::STATUS_PAID
|
317
317
|
self.delete_time = nil
|
318
|
+
if self.previous.nil? # si es la primer factura de una suscripcion, o no es una suscripcion
|
319
|
+
diff = payment_time.to_time - self.billing_period_from.to_time
|
320
|
+
self.billing_period_from = payment_time
|
321
|
+
self.billing_period_to = self.billing_period_to.to_time + diff
|
322
|
+
end
|
318
323
|
self.save
|
319
324
|
# expiracion de creditos de la factura anterior
|
320
325
|
i = self.previous
|
@@ -421,33 +426,24 @@ module BlackStack
|
|
421
426
|
self.billing_period_from = now()
|
422
427
|
#puts
|
423
428
|
#puts
|
424
|
-
# si el plan tiene un segundo trial, y
|
425
|
-
# es la primer factura, entonces:
|
426
|
-
# => se trata del segundo pago por segundo trial
|
427
|
-
if h[:trial2_fee] != nil && prev1.nil?
|
428
|
-
#puts 'b'
|
429
|
-
units = h[:trial2_credits].to_i
|
430
|
-
unit_price = h[:trial2_fee].to_f / h[:trial2_credits].to_f
|
431
|
-
billing_period_to = DB["SELECT DATEADD(#{h[:trial2_period].to_s}, +#{h[:trial2_units].to_s}, '#{self.billing_period_from.to_s}') AS [now]"].map(:now)[0].to_s
|
432
|
-
|
433
|
-
# si el plan tiene un segundo trial, y
|
434
|
-
# es la segunda factura, entonces:
|
435
|
-
# => se trata del segundo pago por segundo trial
|
436
|
-
elsif h[:trial2_fee] != nil && !prev1.nil? && prev2.nil?
|
437
|
-
#puts 'b'
|
438
|
-
units = h[:trial_credits].to_i
|
439
|
-
unit_price = h[:trial_fee].to_f / h[:trial_credits].to_f
|
440
|
-
billing_period_to = DB["SELECT DATEADD(#{h[:trial_period].to_s}, +#{h[:trial_units].to_s}, '#{self.billing_period_from.to_s}') AS [now]"].map(:now)[0].to_s
|
441
|
-
|
442
429
|
# si el plan tiene un primer trial, y
|
443
430
|
# es la primer factura, entonces:
|
444
431
|
# => se trata del primer pago por trial
|
445
|
-
|
432
|
+
if h[:trial_fee] != nil && prev1.nil? && !self.disabled_for_trial_ssm
|
446
433
|
#puts 'a'
|
447
434
|
units = h[:trial_credits].to_i
|
448
435
|
unit_price = h[:trial_fee].to_f / h[:trial_credits].to_f
|
449
436
|
billing_period_to = DB["SELECT DATEADD(#{h[:trial_period].to_s}, +#{h[:trial_units].to_s}, '#{self.billing_period_from.to_s}') AS [now]"].map(:now)[0].to_s
|
450
437
|
|
438
|
+
# si el plan tiene un segundo trial, y
|
439
|
+
# es la segunda factura, entonces:
|
440
|
+
# => se trata del segundo pago por segundo trial
|
441
|
+
elsif h[:trial2_fee] != nil && !prev1.nil? && prev2.nil?
|
442
|
+
#puts 'b'
|
443
|
+
units = h[:trial2_credits].to_i
|
444
|
+
unit_price = h[:trial2_fee].to_f / h[:trial2_credits].to_f
|
445
|
+
billing_period_to = DB["SELECT DATEADD(#{h[:trial2_period].to_s}, +#{h[:trial2_units].to_s}, '#{self.billing_period_from.to_s}') AS [now]"].map(:now)[0].to_s
|
446
|
+
|
451
447
|
# si el plan tiene un fee, y
|
452
448
|
elsif h[:fee].to_f != nil && h[:type] == BlackStack::InvoicingPaymentsProcessing::BasePlan::PAYMENT_SUBSCRIPTION
|
453
449
|
#puts 'c'
|
data/lib/movement.rb
CHANGED
@@ -15,20 +15,25 @@ 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 (
|
18
|
+
def self.typeName(t)
|
19
|
+
if (t==MOVEMENT_TYPE_ADD_PAYMENT)
|
20
20
|
return "Payment"
|
21
|
-
elsif (
|
21
|
+
elsif (t==MOVEMENT_TYPE_ADD_BONUS)
|
22
22
|
return "Bonus"
|
23
|
-
elsif (
|
23
|
+
elsif (t==MOVEMENT_TYPE_REASSIGN_BALANCE)
|
24
24
|
return "Reassignation"
|
25
|
-
elsif (
|
25
|
+
elsif (t==MOVEMENT_TYPE_REFUND_BALANCE)
|
26
26
|
return "Refund"
|
27
|
-
elsif (
|
28
|
-
return "
|
29
|
-
elsif (
|
27
|
+
elsif (t==MOVEMENT_TYPE_CANCELATION)
|
28
|
+
return "Consumption"
|
29
|
+
elsif (t==MOVEMENT_TYPE_EXPIRATION)
|
30
30
|
return "Expiration"
|
31
31
|
end
|
32
|
+
'(unknown)'
|
33
|
+
end
|
34
|
+
|
35
|
+
def typeName()
|
36
|
+
BlackStack::Movement::typeName(self.type)
|
32
37
|
end
|
33
38
|
|
34
39
|
def typeColorName()
|
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.45
|
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-
|
11
|
+
date: 2020-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket
|