invoicing_payments_processing 1.1.50 → 1.1.55

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: d1d5cea3030eeebca8abd0f7cded9898a4a08dd5
4
- data.tar.gz: cd33004f6351894488bed5230a70f563f4056a93
3
+ metadata.gz: 1294cf94b7e332d6ef0444b22134b388188e647e
4
+ data.tar.gz: 6351ac02e50156091d71ad80a3d3966247900d6d
5
5
  SHA512:
6
- metadata.gz: e031aa9fef8a49e27578d6f8394935a99b65ba3ee7493e181390dd1351c00eab3f7688ccb11453a4de830fbae625b26ff08c1f48044f0d3190a3e669136f60bc
7
- data.tar.gz: 60a4e90521009931f1f71123c424b696fceb3aec9bcaf7078bd9a8791b0586739c7caafcc17261421963e76ef2284d2914053b700f5dd529360e17704ff8aa00
6
+ metadata.gz: e0d92dba76c788bc2bd44012d55df5939290b06eb6559954dd11dcd6901dc30945a781215db9bd3e1b95b6e9b785b7012f72dbde057c2a555cf34f1b8a4c8c63
7
+ data.tar.gz: c69783fc4a9433009feaaa33feefc279e9c1e4acae1cb2ca70efb18c566d3780c7b43f6c0f341a3821671bdc17ce63e857d0fc7d556b930245abe4eb7801c618
@@ -10,14 +10,21 @@ module BlackStack
10
10
  end
11
11
 
12
12
  def calculate()
13
- q =
14
- "select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
15
- "from movement with (nolock index(IX_movement__id_client__product_code)) " +
16
- "where id_client='#{self.client.id}' " +
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
-
13
+ if !self.up_time.nil?
14
+ q =
15
+ "select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
16
+ "from movement with (nolock) " +
17
+ "where id_client='#{self.client.id}' " +
18
+ "and product_code='#{self.product_code}' " +
19
+ "and create_time < '#{self.up_time.to_time.to_sql}' "
20
+ else
21
+ q =
22
+ "select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
23
+ "from stat_balance x with (nolock) " +
24
+ "where x.id_client='#{self.client.id}' " +
25
+ "and x.product_code='#{self.product_code}' " +
26
+ end
27
+
21
28
  row = DB[q].first
22
29
  self.amount = row[:amount].to_f
23
30
  self.credits = row[:credits].to_f
@@ -41,6 +41,10 @@ module BlackStack
41
41
  # 3) haciendo coincidir el campo payer_email de alguna suscripcion existente con el BlackStack::BufferPayPalNotification.payer_email
42
42
  # 3) haciendo coincidir el primer guid en el codigo de invoice, con el id del cliente
43
43
  def get_client()
44
+ puts
45
+ puts "BlackStack::BufferPayPalNotification::get_client"
46
+ puts 'debug info:'
47
+ puts "self.invoice:#{self.invoice.to_s}:."
44
48
  # obtengo el cliente que machea con este perfil
45
49
  c = nil
46
50
  if c.nil?
@@ -49,12 +53,24 @@ module BlackStack
49
53
  c = i.client if !i.nil?
50
54
  end
51
55
  end
56
+ if c.nil?
57
+ iid = self.invoice.split(".").last.to_s
58
+ if iid.guid?
59
+ i = BlackStack::Invoice.where(:id=>iid).first
60
+ c = i.client if !i.nil?
61
+ end
62
+ end
52
63
  if c.nil?
53
64
  cid = self.invoice.split(".").first.to_s
54
65
  if cid.guid?
55
66
  c = BlackStack::Client.where(:id=>cid).first
56
67
  end
57
68
  end
69
+ =begin
70
+ # deprecated: debe obtenerse la factura (invoice), y de ahi el cliente,
71
+ # => porque un mismo cuente puede usar su cuenta paypal en varias cuantas
72
+ # => de usuario.
73
+ #
58
74
  if c.nil?
59
75
  c = BlackStack::Client.where(:paypal_email=>self.payer_email).first
60
76
  if (c == nil)
@@ -83,6 +99,7 @@ module BlackStack
83
99
  c = BlackStack::Client.where(:id=>row[:cid]).first
84
100
  end
85
101
  end
102
+ =end
86
103
  c
87
104
  end
88
105
 
@@ -338,7 +355,7 @@ module BlackStack
338
355
  s.save
339
356
 
340
357
  # obtengo la factura que se creo con esta suscripcion
341
- i = BlackStack::Invoice.where(:id=>b.item_number).first
358
+ i = BlackStack::Invoice.where(:id=>b.invoice.split(".").last.to_s).first
342
359
 
343
360
  # vinculo esta suscripcion a la factura que la genero, y a todas las facturas siguientes
344
361
  i.set_subscription(s)
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.50
4
+ version: 1.1.55
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-10-27 00:00:00.000000000 Z
11
+ date: 2020-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket