stellar_base-rails 0.9.5 → 0.9.6

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
  SHA256:
3
- metadata.gz: 7d46d85f2dc7b2aae1b07e4a4a8e14438492daed928984280164d555e14dd867
4
- data.tar.gz: 75f22ebee9475714b891fa8bfc3c76bfe224d5236b81ac82a0be403117f4d8b3
3
+ metadata.gz: f22e8f6b9721b27567e7d2e62fd51c8e2c6b629b070d96e29206604731bdf246
4
+ data.tar.gz: e000fba74f9233ca242dd4c30b9c140257e8b7f349525a61dace689372a077f4
5
5
  SHA512:
6
- metadata.gz: 00af460fe3e90e786c68e8854b877eb8b74ded926238f00feccbde764c8c8cd05ec26083b079e922227342cddfd6f8f6ea32f866a989567292cd1b110fcf75a8
7
- data.tar.gz: 63701fb3cbb3bc43c7c92f4b20d6efda1c0cc6b13fcaa8173fadeaecca0105273de7745776ab55e8d7dac4aa49a0ede6b71d40373e56feee2b7c212aa4524a28
6
+ metadata.gz: f9113f82ff8dc5152c0a32c26ffec2b483f1e2ad4cdd3bcd05328d0ac7d8863cb76c9e164c75b25982b4acdad0880068db2a684400db38a2f029663e66c2cf14
7
+ data.tar.gz: 27b0f46b04509a9d526f9e5399059b64cbb1d4d735dffa3c9c8007b8d1316da137c37f10229b9946d5d9f43c7845f70851efab31e01741486c9654a9b3e13838
@@ -0,0 +1,28 @@
1
+ module StellarBase
2
+ module DepositRequests
3
+ class FindOrCreateDeposit
4
+
5
+ extend LightService::Action
6
+
7
+ expects :deposit_request, :tx_id, :amount
8
+ promises :deposit
9
+
10
+ executed do |c|
11
+ c.deposit = Deposit.find_or_create_by(
12
+ deposit_request_id: c.deposit_request.id,
13
+ tx_id: c.tx_id,
14
+ ) do |deposit|
15
+ deposit.amount = c.amount
16
+ end
17
+
18
+ stellar_tx_id = c.deposit.stellar_tx_id
19
+
20
+ if stellar_tx_id.present?
21
+ c.skip_remaining! "Deposit previously made: stellar_tx_id " \
22
+ "#{stellar_tx_id}, skipping"
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -17,8 +17,7 @@ module StellarBase
17
17
  [
18
18
  FindConfig,
19
19
  FindDepositRequest,
20
- FindDeposit,
21
- CreateDeposit,
20
+ FindOrCreateDeposit,
22
21
  InitStellarClient,
23
22
  InitStellarIssuerAccount,
24
23
  InitStellarRecipientAccount,
@@ -26,7 +25,7 @@ module StellarBase
26
25
  InitStellarAsset,
27
26
  InitStellarAmount,
28
27
  SendAsset,
29
- UpdateDeposit, # save the stellar operation id on it
28
+ UpdateDeposit,
30
29
  ]
31
30
  end
32
31
 
@@ -1,3 +1,3 @@
1
1
  module StellarBase
2
- VERSION = "0.9.5".freeze
2
+ VERSION = "0.9.6".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stellar_base-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Subido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
11
+ date: 2018-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: disposable
@@ -394,12 +394,11 @@ files:
394
394
  - app/services/stellar_base/bridge_callbacks/process.rb
395
395
  - app/services/stellar_base/bridge_callbacks/verify_mac_payload.rb
396
396
  - app/services/stellar_base/configured_class_runner.rb
397
- - app/services/stellar_base/deposit_requests/create_deposit.rb
398
397
  - app/services/stellar_base/deposit_requests/determine_how.rb
399
398
  - app/services/stellar_base/deposit_requests/find_config.rb
400
- - app/services/stellar_base/deposit_requests/find_deposit.rb
401
399
  - app/services/stellar_base/deposit_requests/find_deposit_request.rb
402
400
  - app/services/stellar_base/deposit_requests/find_depositable_asset.rb
401
+ - app/services/stellar_base/deposit_requests/find_or_create_deposit.rb
403
402
  - app/services/stellar_base/deposit_requests/init_stellar_amount.rb
404
403
  - app/services/stellar_base/deposit_requests/init_stellar_asset.rb
405
404
  - app/services/stellar_base/deposit_requests/init_stellar_distribution_account.rb
@@ -464,7 +463,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
464
463
  version: '0'
465
464
  requirements: []
466
465
  rubyforge_project:
467
- rubygems_version: 2.7.7
466
+ rubygems_version: 2.7.6
468
467
  signing_key:
469
468
  specification_version: 4
470
469
  summary: Mountable Stellar API Endpoints for Rails
@@ -1,19 +0,0 @@
1
- module StellarBase
2
- module DepositRequests
3
- class CreateDeposit
4
-
5
- extend LightService::Action
6
- expects :tx_id, :amount, :deposit_request
7
- promises :deposit
8
-
9
- executed do |c|
10
- c.deposit = Deposit.create!(
11
- tx_id: c.tx_id,
12
- amount: c.amount,
13
- deposit_request_id: c.deposit_request.id,
14
- )
15
- end
16
-
17
- end
18
- end
19
- end
@@ -1,23 +0,0 @@
1
- module StellarBase
2
- module DepositRequests
3
- class FindDeposit
4
-
5
- extend LightService::Action
6
-
7
- expects :deposit_request, :tx_id
8
- promises :deposit
9
-
10
- executed do |c|
11
- c.deposit = Deposit.find_by(
12
- deposit_request_id: c.deposit_request.id,
13
- tx_id: c.tx_id,
14
- )
15
-
16
- if c.deposit.present?
17
- c.skip_remaining!("Deposit trigger previously made, skipping")
18
- end
19
- end
20
-
21
- end
22
- end
23
- end