invoicing_payments_processing 1.1.33 → 1.1.43
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 +9 -4
- 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: 140493643f70cd83e346ae581dc3a8008f32d000
|
4
|
+
data.tar.gz: 80ea68be7f8cf7bacdbb937513a1a6c958b2e3c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54a7d6e151c012c5b9ce42e40cf4522f9f3f90d375b10781aafbb4e2e377f466cc16fed06dee1df74ff2b87c24a2f1c6547fb3204dded209926fd26bfb7db392
|
7
|
+
data.tar.gz: 0f192df5ad0552d02daf1151dd73a802ec34507a9eb79fe50f3a79fb09f217839c5293ac6ed027ae241af36478686178f2a8058f610ed301b9e88d163d6886bb
|
@@ -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
@@ -211,7 +211,7 @@ module BlackStack
|
|
211
211
|
trial2 = allow_trials && plan_descriptor[:trial2_fee]!=nil && plan_descriptor[:trial2_period]!=nil && plan_descriptor[:trial2_units]!=nil
|
212
212
|
|
213
213
|
values[:a3] = 0
|
214
|
-
self.items.each { |i|
|
214
|
+
self.items.each { |i|
|
215
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
|
@@ -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
|
@@ -420,7 +425,7 @@ module BlackStack
|
|
420
425
|
# le seteo la fecha de hoy
|
421
426
|
self.billing_period_from = now()
|
422
427
|
#puts
|
423
|
-
#puts
|
428
|
+
#puts
|
424
429
|
# si el plan tiene un primer trial, y
|
425
430
|
# es la primer factura, entonces:
|
426
431
|
# => se trata del primer pago por trial
|
@@ -429,7 +434,7 @@ module BlackStack
|
|
429
434
|
units = h[:trial_credits].to_i
|
430
435
|
unit_price = h[:trial_fee].to_f / h[:trial_credits].to_f
|
431
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
|
432
|
-
|
437
|
+
|
433
438
|
# si el plan tiene un segundo trial, y
|
434
439
|
# es la segunda factura, entonces:
|
435
440
|
# => se trata del segundo pago por segundo trial
|
@@ -438,7 +443,7 @@ module BlackStack
|
|
438
443
|
units = h[:trial2_credits].to_i
|
439
444
|
unit_price = h[:trial2_fee].to_f / h[:trial2_credits].to_f
|
440
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
|
441
|
-
|
446
|
+
|
442
447
|
# si el plan tiene un fee, y
|
443
448
|
elsif h[:fee].to_f != nil && h[:type] == BlackStack::InvoicingPaymentsProcessing::BasePlan::PAYMENT_SUBSCRIPTION
|
444
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.43
|
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
|