invoicing_payments_processing 1.1.1 → 1.1.3

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: c2495e0d2257ff3cec7862dad5c29aa0ef6f374e
4
- data.tar.gz: 684caeb185db9734c8c0977ebceed61b88d3465a
3
+ metadata.gz: 1420b9edf46fb1b4e92f6d43b28a2544d0dc6cb9
4
+ data.tar.gz: f9280d1bae724cd557ffa4af2e156f3ff83dc2fb
5
5
  SHA512:
6
- metadata.gz: 89f4f7b34728ae6b95871ee58baf22dee4cf83827797cad575beab80ad46f4808f89be79b845006421e9c31ec51d29e388e8cb60efda0a4e403e67c606ca8559
7
- data.tar.gz: b42b1696f7a099a713545ab2b2075dbf0f782336a3218a94f3c3312249e71c6cca4e7952eb6219737d809865be6740f723cef6c351d45be836b491a9637abcb8
6
+ metadata.gz: 9e8a27a63d3f7e41ee6d6609ce5eb161e97c787bf021ac79c89d3c2afabc10d0deb5331580f5776acc04064c62cdf6961ec1dd5156bed034b229f79958701f1c
7
+ data.tar.gz: b31408e6e7f5a1c0ddffdc757de682f4751c9944215b9c8eac31eccba4117c3703b97e40afc9433531cd37cb01e2f30b8f52963cd0752a8fd59ef0c1de807c68
@@ -230,8 +230,8 @@ module BlackStack
230
230
  def self.process(params)
231
231
  DB.transaction do
232
232
  # verifico que no existe ya una notificacion
233
- b = BlackStack::BufferPayPalNotification.where(:id=>params[:id]).first
234
- if (b==nil)
233
+ b = BlackStack::BufferPayPalNotification.where(:id=>params['id']).first
234
+ if b.nil?
235
235
  # proceso la notificacion
236
236
  b = BlackStack::BufferPayPalNotification.create(params)
237
237
  # inserto la notificacion en la base de datos
@@ -246,7 +246,7 @@ module BlackStack
246
246
 
247
247
  # varifico que el cliente exista
248
248
  c = b.get_client
249
- if (c == nil)
249
+ if c.nil?
250
250
  raise "Client not found (payer_email=#{b.payer_email.to_s})."
251
251
  end
252
252
 
@@ -260,12 +260,12 @@ module BlackStack
260
260
  # reviso si la factura ya estaba creada.
261
261
  # la primer factura se por adelantado cuando el cliente hace signup, y antes de que se suscriba a paypal, y se le pone un ID igual a primer GUID del campo invoice del IPN
262
262
  i = BlackStack::Invoice.where(:id=>iid, :status=>BlackStack::Invoice::STATUS_UNPAID).order(:billing_period_from).first
263
- if (i == nil)
263
+ if i.nil?
264
264
  i = BlackStack::Invoice.where(:id=>iid, :status=>nil).order(:billing_period_from).first
265
265
  end
266
266
 
267
267
  # de la segunda factura en adelante, se generan con un ID diferente, pero se le guarda a subscr_id para identificar cuado llegue el pago de esa factura
268
- if (i == nil)
268
+ if i.nil?
269
269
  # busco una factura en estado UNPAID que este vinculada a esta suscripcion
270
270
  q =
271
271
  "SELECT TOP 1 i.id AS iid " +
@@ -331,10 +331,10 @@ module BlackStack
331
331
  #b.txn_type == BlackStack::BufferPayPalNotification::TXN_TYPE_SUBSCRIPTION_SUSPEND || # estos IPN traen el campo subscr_id en blanco
332
332
  #b.txn_type == BlackStack::BufferPayPalNotification::TXN_TYPE_SUBSCRIPTION_SUSPEND_DUE_MAX_FAILURES # estos IPN traen el campo subscr_id en blanco
333
333
  )
334
- s = BlackStack::PayPalSubscription.load(b)
335
- if s == nil
334
+ s = BlackStack::PayPalSubscription.load(b.to_hash)
335
+ if s.nil?
336
336
  # mensaje de error
337
- raise 'Subscription Not Found.'
337
+ raise "Subscription (#{b.subscr_id}) Not Found."
338
338
  else
339
339
  # registro la suscripcion en la base de datos
340
340
  s.active = false
data/lib/invoice.rb CHANGED
@@ -536,7 +536,7 @@ module BlackStack
536
536
  matched_items = i.items.select { |o| o.amount.to_f == -payment_gross.to_f }
537
537
 
538
538
  if total < -payment_gross
539
- raise "The refund is higher than the invoice amount"
539
+ raise "The refund is higher than the invoice amount (invoice #{id_invoice}, #{total.to_s}, #{payment_gross.to_s})"
540
540
 
541
541
  # Si el monto del reembolso es igual al total de la factura, se hace un reembolso total de todos los items. Y termina la funcion.
542
542
  # Si el monto de la factura es distinto al moneto del reembolso, entonces se levanta una excepcion.
@@ -25,7 +25,7 @@ module BlackStack
25
25
  s.last_name = params['last_name'].to_s
26
26
  s.residence_country = params['residence_country'].to_s
27
27
  s.mc_currency = params['mc_currency'].to_s
28
- s.item_name = params['item_name'].to_s
28
+ #s.item_name = params['item_name'].to_s
29
29
  s.amount1 = params['amount1'].to_s
30
30
  s.business = params['business'].to_s
31
31
  s.amount3 = params['amount3'].to_s
@@ -39,7 +39,7 @@ module BlackStack
39
39
  s.payer_id = params['payer_id'].to_s
40
40
  s.invoice = params['invoice'].to_s
41
41
  s.reattempt = params['reattempt'].to_s
42
- s.item_number = params['item_number'].to_s
42
+ #s.item_number = params['item_number'].to_s
43
43
  s.subscr_date = params['subscr_date'].to_s
44
44
  s.charset = params['charset'].to_s
45
45
  s.notify_version = params['notify_version'].to_s
@@ -69,7 +69,7 @@ module BlackStack
69
69
  ret['last_name'] = self.last_name
70
70
  ret['residence_country'] = self.residence_country
71
71
  ret['mc_currency'] = self.mc_currency
72
- ret['item_name'] = self.item_name
72
+ #ret['item_name'] = self.item_name
73
73
  ret['amount1'] = self.amount1
74
74
  ret['business'] = self.business
75
75
  ret['amount3'] = self.amount3
@@ -83,7 +83,7 @@ module BlackStack
83
83
  ret['payer_id'] = self.payer_id
84
84
  ret['invoice'] = self.invoice
85
85
  ret['reattempt'] = self.reattempt
86
- ret['item_number'] = self.item_number
86
+ #ret['item_number'] = self.item_number
87
87
  ret['subscr_date'] = self.subscr_date
88
88
  ret['charset'] = self.charset
89
89
  ret['notify_version'] = self.notify_version
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.1
4
+ version: 1.1.3
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-01-02 00:00:00.000000000 Z
11
+ date: 2020-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket