invoicing_payments_processing 1.1.33 → 1.1.34
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/invoice.rb +21 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f6d8cf264ed1fc60388ab5c360b3cfbb8fb9bbb
|
|
4
|
+
data.tar.gz: 7809b0efc41be10f4db464c4a37860abd6ebba02
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ed2466965d78a825e7f4d991f62a8a57a61775d59f6fffc2dc0bffe53204312e676059607668463a6b6a558a52c68b4a3859e49587ea1c343ee8f41943d5323c
|
|
7
|
+
data.tar.gz: ba1ef476b3106b96f6957c02e85421f719dc1b224fae248d144b1f282841e3c5fe5a05534c9aece1ac84fcba7ab7613b662cd31811e497ff77ae7b840bab130c
|
data/lib/invoice.rb
CHANGED
|
@@ -420,25 +420,34 @@ module BlackStack
|
|
|
420
420
|
# le seteo la fecha de hoy
|
|
421
421
|
self.billing_period_from = now()
|
|
422
422
|
#puts
|
|
423
|
-
#puts
|
|
423
|
+
#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
|
+
if 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
|
+
|
|
424
442
|
# si el plan tiene un primer trial, y
|
|
425
443
|
# es la primer factura, entonces:
|
|
426
444
|
# => se trata del primer pago por trial
|
|
427
|
-
|
|
445
|
+
elsif h[:trial_fee] != nil && prev1.nil? && !self.disabled_for_trial_ssm
|
|
428
446
|
#puts 'a'
|
|
429
447
|
units = h[:trial_credits].to_i
|
|
430
448
|
unit_price = h[:trial_fee].to_f / h[:trial_credits].to_f
|
|
431
449
|
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
|
-
|
|
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[:trial2_credits].to_i
|
|
439
|
-
unit_price = h[:trial2_fee].to_f / h[:trial2_credits].to_f
|
|
440
|
-
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
|
-
|
|
450
|
+
|
|
442
451
|
# si el plan tiene un fee, y
|
|
443
452
|
elsif h[:fee].to_f != nil && h[:type] == BlackStack::InvoicingPaymentsProcessing::BasePlan::PAYMENT_SUBSCRIPTION
|
|
444
453
|
#puts 'c'
|