invoicing_payments_processing 1.1.36 → 1.1.41

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: 965a8f6366881eb0e4bc2bfc47bc1afe2ce09e11
4
- data.tar.gz: a9b9c23cfed343171d9e815574cb56659e652bf4
3
+ metadata.gz: 8b262508f5bb5461883af0c385256bc6011ed4aa
4
+ data.tar.gz: f57520e8d02e50ecdd5638d5392680223bb0e77c
5
5
  SHA512:
6
- metadata.gz: 261a8ac7175609664b8580f69259a96e39cc8f495ed448ed6dcc4d8e1ad8e87e7f9f297e1b4ff461b21c0d95ea92a9f958b39199977ff9c73c11a0448a08ae9a
7
- data.tar.gz: aee9ab4c785dcc5072b008ed1547debd27763a5283b6088dc7013f9f92649cc7856a79cd1be54446e92115dfc333e91e09bc0635e2634172c7143f180e879170
6
+ metadata.gz: be69442d3cb147180d5a373f3bf1a71e81221de43957440df516751e954a1cdcd859da86685b8e76ab95fada8f63cd43044fec24dbc469b0c2daf33c866353b4
7
+ data.tar.gz: 9c6ee401ce0094ba5c08f8476a65e10f3720ac0350dcf43cd627f78e0b326897b2cd9c8c8d1d3f283e0a0ce81c9e3f89edc5199467f5e04ca92982a86f9b6802
@@ -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.getPaidb.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()
@@ -212,7 +212,7 @@ module BlackStack
212
212
 
213
213
  values[:a3] = 0
214
214
  self.items.each { |i|
215
- if ( !trial2 && trial1 && i.units!=i.plan_descriptor[:trial_credits] ) || ( trial2 && trial1 && i.units!=i.plan_descriptor[:trial2_credits] )
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 - self.billing_period_from
320
+ self.billing_period_from = payment_time
321
+ self.billing_period_to += 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
- elsif h[:trial_fee] != nil && prev1.nil? && !self.disabled_for_trial_ssm
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'
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.36
4
+ version: 1.1.41
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-21 00:00:00.000000000 Z
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket