bitsy-bitcoin 0.7.0 → 0.7.1

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: 6dc9926eed4195fdde26c052f88bd3847dd612c6
4
- data.tar.gz: c2501edd14c431e09ccc0d052dd56bf0193ab283
3
+ metadata.gz: 6d5b039fc91c6f09e4a500db7a110f4741d68aaa
4
+ data.tar.gz: 16c38e374670e1bed10d219391779b2a7d604297
5
5
  SHA512:
6
- metadata.gz: 78e4d71e5000101667f18299f2fba3dc23e9cbc242b8cb4582a18fb32e65391fb81fc230266c9f3e65f74576f95e17872bf3c47b97bbed8e6710bcce7e53251e
7
- data.tar.gz: 25b02015f4e2b296618d5e653f4015a19cbfa2c1c0964c65c6f3cadea15ae26b003ced797228f4adc77bd8ad78e46edb635f6aff76a8af328d7db160e93d8983
6
+ metadata.gz: 1f9c83f0c335597e422ef0ee6bcd817167a0b911979d5063f63ec44099dcc7a38b2a60e510636634555a5bd4b0b781a383eba81b9c6c7b0df306ccac5a8ebe2e
7
+ data.tar.gz: ae93a6e7e89cea9c91f90d123474226660ae81d08113f37c16e7398bfe62843397bccb010a83b72c920bd7e23b230bd28de900c77e252657e1aea78096e24a92
@@ -9,6 +9,14 @@ module Bitsy
9
9
  after_initialize :set_uuid
10
10
  scope :with_balance, -> { where('balance_cache > 0.0') }
11
11
  scope :checked_at_is_past, -> { where(arel_table[:checked_at].lt(Time.now)) }
12
+ scope :received_at_least_minimum, -> do
13
+ min_payment = arel_table[:min_payment]
14
+ total_received_amount_cache = arel_table[:total_received_amount_cache]
15
+ where(min_payment.lteq(total_received_amount_cache))
16
+ end
17
+ scope :for_manual_checking, -> do
18
+ checked_at_is_past.received_at_least_minimum
19
+ end
12
20
  validates(
13
21
  :initial_tax_rate,
14
22
  inclusion: {
@@ -6,7 +6,7 @@ module Bitsy
6
6
  def self.execute
7
7
  reduce(
8
8
  GetLatestBlock,
9
- CheckPaymentDepotTransactions,
9
+ CheckPaymentDepotsTransactions,
10
10
  )
11
11
  end
12
12
 
@@ -2,15 +2,18 @@ module Bitsy
2
2
  class CheckPaymentDepotTransactions
3
3
 
4
4
  include LightService::Action
5
- expects :latest_block, :payment_depots
5
+ expects :latest_block, :payment_depot
6
6
 
7
7
  executed do |ctx|
8
- ctx.payment_depots.each do |payment_depot|
9
- CheckPaymentDepotTransaction.execute(
10
- payment_depot: payment_depot,
8
+ blockchain_address = Blockchain.get_address(ctx.payment_depot.address)
9
+ blockchain_address.txs.each do |tx|
10
+ ProcessBlockchainBlockexplorerTransaction.execute(
11
+ payment_depot: ctx.payment_depot,
11
12
  latest_block: ctx.latest_block,
13
+ blockchain_transaction: tx,
12
14
  )
13
15
  end
16
+ ctx.payment_depot.reset_checked_at!
14
17
  end
15
18
 
16
19
  end
@@ -0,0 +1,17 @@
1
+ module Bitsy
2
+ class CheckPaymentDepotsTransactions
3
+
4
+ include LightService::Action
5
+ expects :latest_block
6
+
7
+ executed do |ctx|
8
+ PaymentDepot.for_manual_checking.find_each do |payment_depot|
9
+ CheckPaymentDepotTransactions.execute(
10
+ payment_depot: payment_depot,
11
+ latest_block: ctx.latest_block,
12
+ )
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Bitsy
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitsy-bitcoin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-13 00:00:00.000000000 Z
11
+ date: 2014-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -328,8 +328,8 @@ files:
328
328
  - app/services/bitsy/build_send_many_hash_for_transaction.rb
329
329
  - app/services/bitsy/build_send_many_hash_with_transaction_fee.rb
330
330
  - app/services/bitsy/check_for_payments.rb
331
- - app/services/bitsy/check_payment_depot_transaction.rb
332
331
  - app/services/bitsy/check_payment_depot_transactions.rb
332
+ - app/services/bitsy/check_payment_depots_transactions.rb
333
333
  - app/services/bitsy/compute_amount_for_splitting.rb
334
334
  - app/services/bitsy/create_payment_depot.rb
335
335
  - app/services/bitsy/forward_payments.rb
@@ -1,19 +0,0 @@
1
- module Bitsy
2
- class CheckPaymentDepotTransaction
3
-
4
- include LightService::Action
5
- expects :latest_block, :payment_depot
6
-
7
- executed do |ctx|
8
- blockchain_address = Blockchain.get_address(ctx.payment_depot.address)
9
- blockchain_address.txs.each do |tx|
10
- ProcessBlockchainBlockexplorerTransaction.execute(
11
- payment_depot: ctx.payment_depot,
12
- latest_block: ctx.latest_block,
13
- blockchain_transaction: tx,
14
- )
15
- end
16
- end
17
-
18
- end
19
- end