invoicing_payments_processing 1.1.16 → 1.1.29
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/balance.rb +6 -2
- data/lib/bufferpaypalnotification.rb +7 -16
- data/lib/extend_client_by_invoicing_payments_processing.rb +69 -17
- data/lib/invoice.rb +61 -36
- data/lib/invoiceitem.rb +10 -0
- data/lib/movement.rb +5 -5
- data/lib/paypalsubscription.rb +1 -1
- 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: 9f79b2b37439a781dd15dbe9407f09907f890773
|
|
4
|
+
data.tar.gz: 1c99bbda030268957826baaf318a30ff3fafde7e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4c43270e3ed5d5c63729935fbb609f209ead4420b24bfb02d5b3d282d2ce68844d8b60e8eca3a0a28a08379b329ac4027b028f2426045f057c37d3b7140088ce
|
|
7
|
+
data.tar.gz: 5d4315da2fdd53ccc55149cae0e5da568ca375f055b1dba014319095179171411e81908f779b535b653c191c08e0a51bcf4c1387c0f3c8b961326a794d570157
|
data/lib/balance.rb
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
module BlackStack
|
|
2
2
|
class Balance
|
|
3
|
-
attr_accessor :client, :product_code, :amount, :credits
|
|
3
|
+
attr_accessor :client, :product_code, :amount, :credits, :up_time
|
|
4
4
|
|
|
5
|
-
def initialize(id_client, product_code)
|
|
5
|
+
def initialize(id_client, product_code, up_time=nil)
|
|
6
6
|
self.client = BlackStack::Client.where(:id => id_client).first
|
|
7
7
|
self.product_code = product_code
|
|
8
|
+
self.up_time = up_time
|
|
8
9
|
self.calculate()
|
|
9
10
|
end
|
|
10
11
|
|
|
@@ -14,6 +15,9 @@ module BlackStack
|
|
|
14
15
|
"from movement with (nolock index(IX_movement__id_client__product_code)) " +
|
|
15
16
|
"where id_client='#{self.client.id}' " +
|
|
16
17
|
"and product_code='#{self.product_code}' "
|
|
18
|
+
|
|
19
|
+
q += "and create_time < '#{self.up_time.to_time.to_sql}' " if !self.up_time.nil?
|
|
20
|
+
|
|
17
21
|
row = DB[q].first
|
|
18
22
|
self.amount = row[:amount].to_f
|
|
19
23
|
self.credits = row[:credits].to_f
|
|
@@ -331,6 +331,12 @@ module BlackStack
|
|
|
331
331
|
s.id_client = c.id
|
|
332
332
|
s.active = true
|
|
333
333
|
s.save
|
|
334
|
+
|
|
335
|
+
# obtengo la factura que se creo con esta suscripcion
|
|
336
|
+
i = BlackStack::Invoice.where(:id=>b.item_number).first
|
|
337
|
+
|
|
338
|
+
# vinculo esta suscripcion a la factura que la genero, y a todas las facturas siguientes
|
|
339
|
+
i.set_subscription(s)
|
|
334
340
|
end
|
|
335
341
|
|
|
336
342
|
elsif (
|
|
@@ -384,22 +390,7 @@ module BlackStack
|
|
|
384
390
|
k = BlackStack::Invoice.where(:id=>row[:id]).first
|
|
385
391
|
|
|
386
392
|
# creo la factura por el reembolso
|
|
387
|
-
|
|
388
|
-
i.id = guid()
|
|
389
|
-
i.id_client = c.id
|
|
390
|
-
i.create_time = now()
|
|
391
|
-
i.disabled_for_trial_ssm = c.disabled_for_trial_ssm
|
|
392
|
-
i.id_buffer_paypal_notification = b.id
|
|
393
|
-
i.status = BlackStack::Invoice::STATUS_REFUNDED
|
|
394
|
-
i.billing_period_from = b.create_time
|
|
395
|
-
i.billing_period_to = b.create_time
|
|
396
|
-
i.paypal_url = nil
|
|
397
|
-
i.disabled_for_add_remove_items = true
|
|
398
|
-
i.save()
|
|
399
|
-
|
|
400
|
-
# parseo el reeembolso - creo el registro contable
|
|
401
|
-
i.setup_refund(payment_gross, k.id)
|
|
402
|
-
|
|
393
|
+
k.refund(payment_gross)
|
|
403
394
|
end
|
|
404
395
|
else
|
|
405
396
|
# unknown
|
|
@@ -68,11 +68,11 @@ module BlackStack
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# crea un registro en la tabla movment, reduciendo la cantidad de creditos con saldo importe 0, para el producto indicado en product_code.
|
|
71
|
-
def adjustment(product_code, adjustment_amount=0, adjustment_credits=0, description=nil, type=BlackStack::Movement::MOVEMENT_TYPE_ADJUSTMENT)
|
|
71
|
+
def adjustment(product_code, adjustment_amount=0, adjustment_credits=0, description=nil, type=BlackStack::Movement::MOVEMENT_TYPE_ADJUSTMENT, registraton_time=nil)
|
|
72
72
|
adjust = BlackStack::Movement.new
|
|
73
73
|
adjust.id = guid()
|
|
74
74
|
adjust.id_client = self.id
|
|
75
|
-
adjust.create_time = now()
|
|
75
|
+
adjust.create_time = registraton_time.nil? ? now() : registraton_time
|
|
76
76
|
adjust.type = type
|
|
77
77
|
adjust.description = description.nil? ? 'Adjustment' : description
|
|
78
78
|
adjust.paypal1_amount = 0
|
|
@@ -110,18 +110,18 @@ module BlackStack
|
|
|
110
110
|
o.amount = x
|
|
111
111
|
o.profits_amount = -x
|
|
112
112
|
o.save
|
|
113
|
-
|
|
114
|
-
# if there is negative credits
|
|
115
|
-
total_credits = 0.to_f - BlackStack::Balance.new(self.id, product_code).credits.to_f
|
|
116
|
-
total_amount = 0.to_f - BlackStack::Balance.new(self.id, product_code).amount.to_f
|
|
117
|
-
sleep(2) # delay to ensure the time of the bonus movement will be later than the time of the consumption movement
|
|
118
|
-
if total_credits < 0
|
|
119
|
-
self.adjustment(product_code, total_amount, total_credits, 'Adjustment Because Quota Has Been Exceeded.')
|
|
120
|
-
end
|
|
121
|
-
|
|
122
113
|
end
|
|
123
114
|
amount_paid += 0.to_f - o.amount.to_f
|
|
124
115
|
credits_paid += 0.to_i - o.credits.to_i
|
|
116
|
+
|
|
117
|
+
# if there is negative credits
|
|
118
|
+
total_credits = credits_paid
|
|
119
|
+
total_amount = amount_paid
|
|
120
|
+
if total_credits < 0
|
|
121
|
+
self.adjustment(product_code, total_amount, total_credits, 'Adjustment Because Quota Has Been Exceeded.', BlackStack::Movement::MOVEMENT_TYPE_ADJUSTMENT, o.create_time)
|
|
122
|
+
amount_paid = 0.to_f
|
|
123
|
+
credits_paid = 0.to_i
|
|
124
|
+
end
|
|
125
125
|
}
|
|
126
126
|
end
|
|
127
127
|
|
|
@@ -162,13 +162,65 @@ module BlackStack
|
|
|
162
162
|
if from_time > to_time
|
|
163
163
|
raise "From time must be earlier than To time"
|
|
164
164
|
end
|
|
165
|
-
if to_time.prev_year > from_time
|
|
166
|
-
|
|
167
|
-
end
|
|
165
|
+
#if to_time.prev_year > from_time
|
|
166
|
+
# raise "The time frame cannot be longer than 1 year."
|
|
167
|
+
#end
|
|
168
168
|
to_time += 1
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
=begin
|
|
170
|
+
:id => movement.id,
|
|
171
|
+
:id_client => movement.id_client,
|
|
172
|
+
:product_code => movement.product_code,
|
|
173
|
+
:create_time => movement.create_time,
|
|
174
|
+
:type => movement.type.to_i,
|
|
175
|
+
:description => movement.description,
|
|
176
|
+
:paypal1_amount => movement.paypal1_amount.to_f,
|
|
177
|
+
:bonus_amount => movement.bonus_amount.to_f,
|
|
178
|
+
:amount => movement.amount.to_f,
|
|
179
|
+
:credits => movement.credits.to_f,
|
|
180
|
+
:profits_amount => movement.profits_amount.to_f,
|
|
181
|
+
:expiration_time => movement.expiration_time,
|
|
182
|
+
:expiration_description => movement.expiration_time.nil? ? '-' : ((movement.expiration_time - Time.now()).to_f / 60.to_f).to_i.to_time_spent
|
|
183
|
+
=end
|
|
184
|
+
q =
|
|
185
|
+
"SELECT " +
|
|
186
|
+
" m.id_client, " +
|
|
187
|
+
" YEAR(m.create_time) AS creation_year, " +
|
|
188
|
+
" MONTH(m.create_time) AS creation_month, " +
|
|
189
|
+
" DAY(m.create_time) AS creation_day, " +
|
|
190
|
+
" YEAR(m.expiration_time) AS expiration_year, " +
|
|
191
|
+
" MONTH(m.expiration_time) AS expiration_month, " +
|
|
192
|
+
" DAY(m.expiration_time) AS expiration_day, " +
|
|
193
|
+
" m.type, " +
|
|
194
|
+
" m.product_code, " +
|
|
195
|
+
" CAST(m.description AS VARCHAR(500)) AS description, " +
|
|
196
|
+
" CAST(m.expiration_description AS VARCHAR(500)) AS expiration_description, " +
|
|
197
|
+
" SUM(ISNULL(m.paypal1_amount,0)) AS paypal1_amount, " +
|
|
198
|
+
" SUM(ISNULL(m.bonus_amount,0)) AS bonus_amount, " +
|
|
199
|
+
" SUM(ISNULL(m.amount,0)) AS amount, " +
|
|
200
|
+
" SUM(ISNULL(m.credits,0)) AS credits, " +
|
|
201
|
+
" SUM(ISNULL(m.profits_amount,0)) AS profits_amount " +
|
|
202
|
+
"FROM movement m WITH (NOLOCK) " +
|
|
203
|
+
"WHERE m.id_client = '#{self.id}' "
|
|
204
|
+
|
|
205
|
+
q += "AND m.product_code = '#{product_code}' " if !product_code.nil?
|
|
206
|
+
|
|
207
|
+
q +=
|
|
208
|
+
"AND create_time >= '#{from_time.to_sql}' " +
|
|
209
|
+
"AND create_time <= '#{to_time.to_sql}' " +
|
|
210
|
+
"GROUP BY " +
|
|
211
|
+
" m.id_client, " +
|
|
212
|
+
" YEAR(m.create_time), " +
|
|
213
|
+
" MONTH(m.create_time), " +
|
|
214
|
+
" DAY(m.create_time), " +
|
|
215
|
+
" YEAR(m.expiration_time), " +
|
|
216
|
+
" MONTH(m.expiration_time), " +
|
|
217
|
+
" DAY(m.expiration_time), " +
|
|
218
|
+
" m.type, " +
|
|
219
|
+
" m.product_code, " +
|
|
220
|
+
" CAST(m.description AS VARCHAR(500)), " +
|
|
221
|
+
" CAST(m.expiration_description AS VARCHAR(500)) "
|
|
222
|
+
|
|
223
|
+
DB[q].all
|
|
172
224
|
end
|
|
173
225
|
|
|
174
226
|
#
|
data/lib/invoice.rb
CHANGED
|
@@ -56,7 +56,19 @@ module BlackStack
|
|
|
56
56
|
raise "Unknown Invoice Status (#{status.to_s})"
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
#
|
|
61
|
+
def set_subscription(s)
|
|
62
|
+
self.subscr_id = s.subscr_id
|
|
63
|
+
self.save
|
|
64
|
+
# aplico la mismam modificacion a todas las factuas que le siguieron a esta
|
|
65
|
+
BlackStack::Invoice.where(:id_previous_invoice=>self.id).all { |j|
|
|
66
|
+
j.set_subscription(s)
|
|
67
|
+
DB.disconnect
|
|
68
|
+
GC.start
|
|
69
|
+
}
|
|
70
|
+
end
|
|
71
|
+
|
|
60
72
|
#
|
|
61
73
|
def deserve_trial?
|
|
62
74
|
return self.disabled_for_trial_ssm == false || self.disabled_for_trial_ssm == nil
|
|
@@ -294,7 +306,7 @@ module BlackStack
|
|
|
294
306
|
#
|
|
295
307
|
BlackStack::Movement.where(:id_invoice_item => item.id).all { |mov|
|
|
296
308
|
#
|
|
297
|
-
mov.expire if mov.expiration_on_next_payment == true
|
|
309
|
+
mov.expire(self.billing_period_from) if mov.expiration_on_next_payment == true
|
|
298
310
|
#
|
|
299
311
|
DB.disconnect
|
|
300
312
|
GC.start
|
|
@@ -321,7 +333,7 @@ module BlackStack
|
|
|
321
333
|
bonus.id_invoice = self.id
|
|
322
334
|
bonus.product_code = plan_bonus[:product_code]
|
|
323
335
|
bonus.unit_price = 0
|
|
324
|
-
bonus.units = plan_bonus[:credits]
|
|
336
|
+
bonus.units = plan_bonus[:credits] * item.number_of_packages # agrego los creditos del bono, multiplicado por la cantiad de paquetes
|
|
325
337
|
bonus.amount = 0
|
|
326
338
|
bonus.item_number = plan_bonus[:item_number]
|
|
327
339
|
BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS, 'Payment Bonus', payment_time, item.id).save()
|
|
@@ -371,62 +383,52 @@ module BlackStack
|
|
|
371
383
|
end
|
|
372
384
|
end
|
|
373
385
|
end
|
|
374
|
-
|
|
386
|
+
|
|
375
387
|
# configura la factura, segun el importe que pagara el cliente, la configuracion del plan en el descriptor h, y si el clietne merece un trial o no
|
|
376
|
-
def create_item(item_number, n=1, validate_items_compatibility=true)
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
# busco el primer item de esta factura, si es que existe
|
|
381
|
-
item0 = self.items.sort_by {|obj| obj.create_time}.first
|
|
382
|
-
|
|
383
|
-
# numero de facturas previas a esta factura
|
|
384
|
-
subs = BlackStack::PayPalSubscription.where(:subscr_id=>self.subscr_id).first
|
|
385
|
-
nSubscriptionInvoices = 0 if subs.nil?
|
|
386
|
-
nSubscriptionInvoices = subs.invoices.count if !subs.nil?
|
|
387
|
-
|
|
388
|
+
def create_item(item_number, n=1, validate_items_compatibility=true)
|
|
389
|
+
prev1 = self.previous
|
|
390
|
+
prev2 = prev1.nil? ? nil : prev1.previous
|
|
391
|
+
|
|
388
392
|
# encuentro el descriptor del plan
|
|
389
393
|
# el descriptor del plan tambien es necesario para la llamada a paypal_link
|
|
390
394
|
h = self.client.plans.select { |j| j[:item_number].to_s == item_number.to_s }.first
|
|
391
395
|
|
|
392
396
|
# mapeo variables
|
|
393
|
-
c = self.client
|
|
394
397
|
amount = 0.to_f
|
|
395
398
|
unit_price = 0.to_f
|
|
396
399
|
units = 0.to_i
|
|
397
|
-
|
|
398
|
-
# decido si se trata de una suscripcion
|
|
399
|
-
isSubscription = false
|
|
400
|
-
isSubscription = true if h[:type] == "S"
|
|
401
|
-
|
|
400
|
+
|
|
402
401
|
# le seteo la fecha de hoy
|
|
403
402
|
self.billing_period_from = now()
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
#puts
|
|
404
|
+
#puts
|
|
406
405
|
# si el plan tiene un primer trial, y
|
|
407
|
-
# es primer
|
|
408
|
-
# => se trata del primer pago por trial
|
|
409
|
-
if
|
|
406
|
+
# es la primer factura, entonces:
|
|
407
|
+
# => se trata del primer pago por trial
|
|
408
|
+
if h[:trial_fee] != nil && prev1.nil? && !self.disabled_for_trial_ssm
|
|
409
|
+
#puts 'a'
|
|
410
410
|
units = h[:trial_credits].to_i
|
|
411
411
|
unit_price = h[:trial_fee].to_f / h[:trial_credits].to_f
|
|
412
412
|
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
|
|
413
413
|
|
|
414
|
-
# si es una suscripcion, y
|
|
415
414
|
# si el plan tiene un segundo trial, y
|
|
416
|
-
# es
|
|
417
|
-
# => se trata del segundo pago por trial
|
|
418
|
-
elsif
|
|
415
|
+
# es la segunda factura, entonces:
|
|
416
|
+
# => se trata del segundo pago por segundo trial
|
|
417
|
+
elsif h[:trial2_fee] != nil && !prev1.nil? && prev2.nil?
|
|
418
|
+
#puts 'b'
|
|
419
419
|
units = h[:trial2_credits].to_i
|
|
420
420
|
unit_price = h[:trial2_fee].to_f / h[:trial2_credits].to_f
|
|
421
421
|
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
|
|
422
422
|
|
|
423
423
|
# si el plan tiene un fee, y
|
|
424
|
-
elsif
|
|
424
|
+
elsif h[:fee].to_f != nil && h[:type] == BlackStack::InvoicingPaymentsProcessing::BasePlan::PAYMENT_SUBSCRIPTION
|
|
425
|
+
#puts 'c'
|
|
425
426
|
units = n.to_i * h[:credits].to_i
|
|
426
427
|
unit_price = h[:fee].to_f / h[:credits].to_f
|
|
427
428
|
billing_period_to = DB["SELECT DATEADD(#{h[:period].to_s}, +#{h[:units].to_s}, '#{self.billing_period_from.to_s}') AS [now]"].map(:now)[0].to_s
|
|
428
429
|
|
|
429
|
-
elsif
|
|
430
|
+
elsif h[:fee].to_f != nil && h[:type] == BlackStack::InvoicingPaymentsProcessing::BasePlan::PAYMENT_PAY_AS_YOU_GO
|
|
431
|
+
#puts 'd'
|
|
430
432
|
units = n.to_i * h[:credits].to_i
|
|
431
433
|
unit_price = h[:fee].to_f / h[:credits].to_f
|
|
432
434
|
billing_period_to = billing_period_from
|
|
@@ -435,7 +437,8 @@ module BlackStack
|
|
|
435
437
|
raise "Plan is specified wrong"
|
|
436
438
|
|
|
437
439
|
end
|
|
438
|
-
|
|
440
|
+
|
|
441
|
+
|
|
439
442
|
#
|
|
440
443
|
amount = units.to_f * unit_price.to_f
|
|
441
444
|
|
|
@@ -523,7 +526,7 @@ module BlackStack
|
|
|
523
526
|
self.disabled_for_add_remove_items = true
|
|
524
527
|
|
|
525
528
|
i.items.each { |t|
|
|
526
|
-
self.add_item(t.item_number)
|
|
529
|
+
self.add_item(t.item_number, t.number_of_packages)
|
|
527
530
|
#
|
|
528
531
|
DB.disconnect
|
|
529
532
|
GC.start
|
|
@@ -657,6 +660,28 @@ module BlackStack
|
|
|
657
660
|
DB.disconnect
|
|
658
661
|
GC.start
|
|
659
662
|
end # def setup_refund
|
|
660
|
-
|
|
663
|
+
|
|
664
|
+
def refund(amount)
|
|
665
|
+
c = self.client
|
|
666
|
+
# creo la factura por el reembolso
|
|
667
|
+
j = BlackStack::Invoice.new()
|
|
668
|
+
j.id = guid()
|
|
669
|
+
j.id_client = c.id
|
|
670
|
+
j.create_time = now()
|
|
671
|
+
j.disabled_for_trial_ssm = c.disabled_for_trial_ssm
|
|
672
|
+
j.id_buffer_paypal_notification = nil
|
|
673
|
+
j.status = BlackStack::Invoice::STATUS_REFUNDED
|
|
674
|
+
j.billing_period_from = self.billing_period_from
|
|
675
|
+
j.billing_period_to = self.billing_period_to
|
|
676
|
+
j.paypal_url = nil
|
|
677
|
+
j.disabled_for_add_remove_items = true
|
|
678
|
+
j.subscr_id = self.subscr_id
|
|
679
|
+
j.id_previous_invoice = self.id
|
|
680
|
+
j.save()
|
|
681
|
+
|
|
682
|
+
# parseo el reeembolso - creo el registro contable
|
|
683
|
+
j.setup_refund(amount, self.id)
|
|
684
|
+
end # refund
|
|
685
|
+
|
|
661
686
|
end # class Invoice
|
|
662
687
|
end # module BlackStack
|
data/lib/invoiceitem.rb
CHANGED
|
@@ -7,5 +7,15 @@ module BlackStack
|
|
|
7
7
|
BlackStack::InvoicingPaymentsProcessing::plan_descriptor(self.item_number)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
# Returns the number of plans ordered in this item
|
|
11
|
+
def number_of_packages()
|
|
12
|
+
plan = BlackStack::InvoicingPaymentsProcessing.plan_descriptor(self.item_number)
|
|
13
|
+
if self.amount.to_f == plan[:trial_fee].to_f || self.amount.to_f == plan[:trial2_fee].to_f
|
|
14
|
+
return 1.to_i
|
|
15
|
+
else
|
|
16
|
+
return (self.units.to_f / plan[:credits].to_f).to_i
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
10
20
|
end # class LocalInvoiceItem
|
|
11
21
|
end # module BlackStack
|
data/lib/movement.rb
CHANGED
|
@@ -153,15 +153,15 @@ module BlackStack
|
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
# credits expiration
|
|
156
|
-
def expire()
|
|
156
|
+
def expire(registraton_time=nil, desc='Expiration Because Allocation is Renewed')
|
|
157
157
|
credits_consumed = self.credits_consumed
|
|
158
158
|
#
|
|
159
159
|
self.expiration_start_time = now()
|
|
160
160
|
self.expiration_tries = self.expiration_tries.to_i + 1
|
|
161
161
|
self.save
|
|
162
162
|
#
|
|
163
|
-
total_credits = 0.to_f - BlackStack::Balance.new(self.client.id, self.product_code).credits.to_f
|
|
164
|
-
total_amount = 0.to_f - BlackStack::Balance.new(self.client.id, self.product_code).amount.to_f
|
|
163
|
+
total_credits = 0.to_f - BlackStack::Balance.new(self.client.id, self.product_code, registraton_time).credits.to_f
|
|
164
|
+
total_amount = 0.to_f - BlackStack::Balance.new(self.client.id, self.product_code, registraton_time).amount.to_f
|
|
165
165
|
#
|
|
166
166
|
credits = 0.to_i - self.credits.to_i
|
|
167
167
|
#
|
|
@@ -171,10 +171,10 @@ module BlackStack
|
|
|
171
171
|
exp = BlackStack::Movement.new
|
|
172
172
|
exp.id = guid()
|
|
173
173
|
exp.id_client = self.client.id
|
|
174
|
-
exp.create_time = now()
|
|
174
|
+
exp.create_time = registraton_time.nil? ? now() : registraton_time
|
|
175
175
|
exp.type = BlackStack::Movement::MOVEMENT_TYPE_EXPIRATION
|
|
176
176
|
exp.id_user_creator = self.id_user_creator
|
|
177
|
-
exp.description =
|
|
177
|
+
exp.description = desc
|
|
178
178
|
exp.paypal1_amount = 0
|
|
179
179
|
exp.bonus_amount = 0
|
|
180
180
|
exp.amount = amount_to_expire
|
data/lib/paypalsubscription.rb
CHANGED
|
@@ -116,7 +116,7 @@ module BlackStack
|
|
|
116
116
|
DB[
|
|
117
117
|
"SELECT DISTINCT i.id " +
|
|
118
118
|
"FROM invoice i WITH (NOLOCK) " +
|
|
119
|
-
"
|
|
119
|
+
"WHERE i.subscr_id='#{self.subscr_id.to_s}' "
|
|
120
120
|
].all { |row|
|
|
121
121
|
a << BlackStack::Invoice.where(:id=>row[:id]).first
|
|
122
122
|
# release resources
|
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.29
|
|
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-
|
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: websocket
|