invoicing_payments_processing 1.1.59 → 1.1.60

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: 18728dea987541ecbbed7da0945b9699d258d626
4
- data.tar.gz: 324265ee99c3bd89c570527250b9d5b6b7a805fd
3
+ metadata.gz: aa3e73d17b05d75e69025d7364460ee6045a46cb
4
+ data.tar.gz: 2579bdc5324a9288e41fa92c9f2f84048f0c27f2
5
5
  SHA512:
6
- metadata.gz: 7d430dad7ca8f9dabc486352d1a169b56ef994bf515784d851b70e0a556baa495b52060d3905affc26c98a0f4ee3e9be0f630c7ba48c0e616a791181fb223116
7
- data.tar.gz: 58b118d7c14d2ad05c4025996fc8b56f94e17624d00fe087998b648486e261468e60582c6b8dd85145d8b0f327317f3f9be14b53afeaa040ee951a88a6222152
6
+ metadata.gz: e3138f3c9a4721c504eba4376923717cf50af2382204020150d10fc480c3a6e536e6c09d7d56457d999aac9bcecf4b42388f2b686d91b5eb502291a4cbfed494
7
+ data.tar.gz: e3ef838af52b803608c1349a3e31b682afefb846716570e7fe38ee8070f73f96aaeecbf665b7b8d8641ae405b41859d60ccd43d1624c585ed5d2f6baa50e9074
@@ -9,8 +9,8 @@ module BlackStack
9
9
  self.calculate()
10
10
  end
11
11
 
12
- def calculate()
13
- if !self.up_time.nil?
12
+ def calculate(use_stat_balance=true)
13
+ if !self.up_time.nil? || !use_stat_balance
14
14
  q =
15
15
  "select cast(sum(cast(amount as numeric(18,12))) as numeric(18,6)) as amount, sum(credits) as credits " +
16
16
  "from movement with (nolock) " +
@@ -28,7 +28,7 @@ module BlackStack
28
28
  # update the table stat_balance with the amount and credits of this client, for each product.
29
29
  def update_stat_balance(product_code=nil)
30
30
  c = self
31
- product_descriptors = BlackStack::InvoicingPaymentsProcessing::products_descriptor
31
+ product_descriptors = BlackStack::InvoicingPaymentsProcessing::products_descriptor.clone
32
32
  product_descriptors.select! { |hprod| hprod[:code] == product_code } if !product_code.nil?
33
33
  product_descriptors.each { |hprod|
34
34
  row = DB[
@@ -190,8 +190,10 @@ module BlackStack
190
190
  self.expiration_tries = self.expiration_tries.to_i + 1
191
191
  self.save
192
192
  #
193
- total_credits = 0.to_f - BlackStack::Balance.new(self.client.id, self.product_code, registraton_time).credits.to_f
194
- total_amount = 0.to_f - BlackStack::Balance.new(self.client.id, self.product_code, registraton_time).amount.to_f
193
+ balance = BlackStack::Balance.new(self.client.id, self.product_code, registraton_time)
194
+ balance.calculate(false)
195
+ total_credits = 0.to_f - balance.credits.to_f
196
+ total_amount = 0.to_f - balance.amount.to_f
195
197
  #
196
198
  credits = 0.to_i - self.credits.to_i
197
199
  #
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.59
4
+ version: 1.1.60
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Daniel Sardi