invoicing_payments_processing 1.1.32 → 1.1.42
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/bufferpaypalnotification.rb +4 -1
- data/lib/invoice.rb +11 -5
- 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: 1e99d9449019c41677d5240d9a75a4168b7bb07a
|
4
|
+
data.tar.gz: 196f3334037f74d2e7bacd0840e494836e36ab75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f30ded4f49409106d514b75857d27e4495ac5db0397372c14be7c7aeccec2f27c0e495d37674b83d938c05879439cb3ab948d496ac129bdb281e4d109da970
|
7
|
+
data.tar.gz: 71328dd57a681c5d2aa9e9fd4b43e5c83fef1d35e43f5e03d27491700b7e2da19104d7275b6f12061a70addbe863248281fb0f6e57e11c7a9636b5b2512fca34
|
@@ -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
@@ -17,7 +17,7 @@ module BlackStack
|
|
17
17
|
def paypal_subscription
|
18
18
|
return nil if self.subscr_id.nil?
|
19
19
|
return nil if self.subscr_id.to_s.size == 0
|
20
|
-
return BlackStack::PayPalSubscription.where(:
|
20
|
+
return BlackStack::PayPalSubscription.where(:subscr_id=>self.subscr_id.to_s).first
|
21
21
|
end
|
22
22
|
|
23
23
|
# compara 2 planes, y retorna TRUE si ambos pueden coexistir en una misma facutra, con un mismo enlace de PayPal
|
@@ -66,6 +66,7 @@ module BlackStack
|
|
66
66
|
#
|
67
67
|
def set_subscription(s)
|
68
68
|
self.subscr_id = s.subscr_id
|
69
|
+
self.delete_time = nil
|
69
70
|
self.save
|
70
71
|
# aplico la mismam modificacion a todas las factuas que le siguieron a esta
|
71
72
|
BlackStack::Invoice.where(:id_previous_invoice=>self.id).all { |j|
|
@@ -210,7 +211,7 @@ module BlackStack
|
|
210
211
|
trial2 = allow_trials && plan_descriptor[:trial2_fee]!=nil && plan_descriptor[:trial2_period]!=nil && plan_descriptor[:trial2_units]!=nil
|
211
212
|
|
212
213
|
values[:a3] = 0
|
213
|
-
self.items.each { |i|
|
214
|
+
self.items.each { |i|
|
214
215
|
if trial1 && i.units!=i.plan_descriptor[:trial_credits]
|
215
216
|
raise 'Cannot order more than 1 package and trial in the same invoice'
|
216
217
|
elsif trial1
|
@@ -314,6 +315,11 @@ module BlackStack
|
|
314
315
|
# marco la factura como pagada
|
315
316
|
self.status = BlackStack::Invoice::STATUS_PAID
|
316
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 - self.billing_period_from
|
320
|
+
self.billing_period_from = payment_time
|
321
|
+
self.billing_period_to += diff
|
322
|
+
end
|
317
323
|
self.save
|
318
324
|
# expiracion de creditos de la factura anterior
|
319
325
|
i = self.previous
|
@@ -419,7 +425,7 @@ module BlackStack
|
|
419
425
|
# le seteo la fecha de hoy
|
420
426
|
self.billing_period_from = now()
|
421
427
|
#puts
|
422
|
-
#puts
|
428
|
+
#puts
|
423
429
|
# si el plan tiene un primer trial, y
|
424
430
|
# es la primer factura, entonces:
|
425
431
|
# => se trata del primer pago por trial
|
@@ -428,7 +434,7 @@ module BlackStack
|
|
428
434
|
units = h[:trial_credits].to_i
|
429
435
|
unit_price = h[:trial_fee].to_f / h[:trial_credits].to_f
|
430
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
|
431
|
-
|
437
|
+
|
432
438
|
# si el plan tiene un segundo trial, y
|
433
439
|
# es la segunda factura, entonces:
|
434
440
|
# => se trata del segundo pago por segundo trial
|
@@ -437,7 +443,7 @@ module BlackStack
|
|
437
443
|
units = h[:trial2_credits].to_i
|
438
444
|
unit_price = h[:trial2_fee].to_f / h[:trial2_credits].to_f
|
439
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
|
440
|
-
|
446
|
+
|
441
447
|
# si el plan tiene un fee, y
|
442
448
|
elsif h[:fee].to_f != nil && h[:type] == BlackStack::InvoicingPaymentsProcessing::BasePlan::PAYMENT_SUBSCRIPTION
|
443
449
|
#puts 'c'
|
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.42
|
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
|