invoicing_payments_processing 1.1.4 → 1.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34bca7e013f48b4303f62310d10af93adb0150d5
4
- data.tar.gz: d5be57777768cf864a273d34c87350fc7b48e124
3
+ metadata.gz: 05607ccf6270087041f4204da5d1175f4cbb69ad
4
+ data.tar.gz: 178616b62e1baf3a71a768f03050219f28dcc019
5
5
  SHA512:
6
- metadata.gz: dc65a5b539e09a60dbdcc71ebf4cc1ff4c718f8235bbd6c7fe989b34fbd3daf4e32bd5ef9b053cf842e4e75855295d8185c5da1b8e86052c0a18a7fd915d84fd
7
- data.tar.gz: d71ff8365ca5a3142faee45b8da1de7a11b6c0a42b1169e7c493b9b38cd21e6b167676dc99aa2a499670aa03bfa615fd1c9b98af0b583218076ff9c720ec04d2
6
+ metadata.gz: 59d53d7c5420dd4b7faefa1cc9e97a53672d46fd9520e9403026487577bab9dff54bd1341a2f5910e1d9f0096d87e197945bb9b7649e6516c5e71643055d8f99
7
+ data.tar.gz: 394faf0fa9d17fd5a317505077923f25eb426e4c13be69334fc65b52568faa2ca32a77ab4b5c184c3b76423c1eeba67acec75950e2554856ccc0282a5768ae8f
@@ -363,6 +363,19 @@ module BlackStack
363
363
  raise 'Invoice already exists.'
364
364
  end
365
365
 
366
+ # obtengo la ultima factura pagada, vinculada a un IPN con el mismo codigo invoice
367
+ row = DB[
368
+ "SELECT TOP 1 i.id " +
369
+ "FROM buffer_paypal_notification b " +
370
+ "JOIN invoice i ON ( b.id=i.id_buffer_paypal_notification AND i.status=#{BlackStack::Invoice::STATUS_PAID.to_s} ) " +
371
+ "WHERE b.invoice='#{b.invoice}' " +
372
+ "ORDER BY i.create_time DESC "
373
+ ].first
374
+ if row.nil?
375
+ raise 'Previous Paid Invoice not found.'
376
+ end
377
+ k = BlackStack::Invoice.where(:id=>row[:id]).first
378
+
366
379
  # creo la factura por el reembolso
367
380
  i = BlackStack::Invoice.new()
368
381
  i.id = guid()
@@ -378,7 +391,7 @@ module BlackStack
378
391
  i.save()
379
392
 
380
393
  # parseo el reeembolso - creo el registro contable
381
- i.setup_refund(payment_gross, iid)
394
+ i.setup_refund(payment_gross, k.id)
382
395
 
383
396
  end
384
397
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invoicing_payments_processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi