invoicing_payments_processing 1.1.29 → 1.1.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/invoice.rb +22 -14
- 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: 212a2966346ed12f4de648a737a3ddeaea9b4886
|
4
|
+
data.tar.gz: 891852dc15b535c8eff5bfbdcc1f5b79b3f209b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1630c612e2036f822aa5d8540a86a9279f337b93fee1419899cd56c119d165474b765b9c75a52eee8b4b3d94ba4a5e8d1c61ba7c0a7ad9eac02b14d058604781
|
7
|
+
data.tar.gz: 9e26f1b23afa365b8a09aea64d166affab51e9d15cf9e3228fa121072c3869c18a6ac75d9714e5e10c74280cd4cc18b5a106767769393282ef5e1ae6ee94c781
|
data/lib/invoice.rb
CHANGED
@@ -246,6 +246,11 @@ module BlackStack
|
|
246
246
|
def canBePaid?
|
247
247
|
self.status == nil || self.status == BlackStack::Invoice::STATUS_UNPAID
|
248
248
|
end
|
249
|
+
|
250
|
+
# retorna true si el estado de la factura sea NULL o UNPAID
|
251
|
+
def canBeDeleted?
|
252
|
+
self.status == nil || self.status == BlackStack::Invoice::STATUS_UNPAID
|
253
|
+
end
|
249
254
|
|
250
255
|
# actualiza el registro en la tabla invoice segun los parametros.
|
251
256
|
# en este caso la factura se genera antes del pago.
|
@@ -298,6 +303,7 @@ module BlackStack
|
|
298
303
|
end
|
299
304
|
# marco la factura como pagada
|
300
305
|
self.status = BlackStack::Invoice::STATUS_PAID
|
306
|
+
self.delete_time = nil
|
301
307
|
self.save
|
302
308
|
# expiracion de creditos de la factura anterior
|
303
309
|
i = self.previous
|
@@ -325,19 +331,21 @@ module BlackStack
|
|
325
331
|
# registro el pago
|
326
332
|
BlackStack::Movement.new().parse(item, BlackStack::Movement::MOVEMENT_TYPE_ADD_PAYMENT, "Invoice Payment", payment_time, item.id).save()
|
327
333
|
# agrego los bonos de este plan
|
328
|
-
plan[:bonus_plans].
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
334
|
+
if !plan[:bonus_plans].nil?
|
335
|
+
plan[:bonus_plans].each { |h|
|
336
|
+
plan_bonus = BlackStack::InvoicingPaymentsProcessing.plan_descriptor(h[:item_number])
|
337
|
+
raise "bonus plan not found" if plan_bonus.nil?
|
338
|
+
bonus = BlackStack::InvoiceItem.new
|
339
|
+
bonus.id = guid()
|
340
|
+
bonus.id_invoice = self.id
|
341
|
+
bonus.product_code = plan_bonus[:product_code]
|
342
|
+
bonus.unit_price = 0
|
343
|
+
bonus.units = plan_bonus[:credits] * item.number_of_packages # agrego los creditos del bono, multiplicado por la cantiad de paquetes
|
344
|
+
bonus.amount = 0
|
345
|
+
bonus.item_number = plan_bonus[:item_number]
|
346
|
+
BlackStack::Movement.new().parse(bonus, BlackStack::Movement::MOVEMENT_TYPE_ADD_BONUS, 'Payment Bonus', payment_time, item.id).save()
|
347
|
+
}
|
348
|
+
end # if !plan[:bonus_plans].nil?
|
341
349
|
#
|
342
350
|
DB.disconnect
|
343
351
|
GC.start
|
@@ -524,7 +532,7 @@ module BlackStack
|
|
524
532
|
self.id_previous_invoice = i.id
|
525
533
|
self.subscr_id = i.subscr_id
|
526
534
|
self.disabled_for_add_remove_items = true
|
527
|
-
|
535
|
+
|
528
536
|
i.items.each { |t|
|
529
537
|
self.add_item(t.item_number, t.number_of_packages)
|
530
538
|
#
|
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.30
|
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-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket
|