account-client 0.0.0
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 +7 -0
- data/lib/account/client.rb +5 -0
- data/lib/account/client/controls.rb +7 -0
- data/lib/account/client/namespace.rb +7 -0
- data/lib/account_component/commands/command.rb +47 -0
- data/lib/account_component/commands/deposit.rb +34 -0
- data/lib/account_component/commands/withdraw.rb +34 -0
- data/lib/account_component/controls.rb +28 -0
- data/lib/account_component/controls/account.rb +69 -0
- data/lib/account_component/controls/commands/close.rb +16 -0
- data/lib/account_component/controls/commands/deposit.rb +24 -0
- data/lib/account_component/controls/commands/open.rb +17 -0
- data/lib/account_component/controls/commands/withdraw.rb +24 -0
- data/lib/account_component/controls/customer.rb +13 -0
- data/lib/account_component/controls/events/closed.rb +17 -0
- data/lib/account_component/controls/events/deposited.rb +21 -0
- data/lib/account_component/controls/events/opened.rb +18 -0
- data/lib/account_component/controls/events/withdrawal_rejected.rb +20 -0
- data/lib/account_component/controls/events/withdrawn.rb +21 -0
- data/lib/account_component/controls/id.rb +5 -0
- data/lib/account_component/controls/message.rb +5 -0
- data/lib/account_component/controls/money.rb +9 -0
- data/lib/account_component/controls/position.rb +9 -0
- data/lib/account_component/controls/sequence.rb +5 -0
- data/lib/account_component/controls/time.rb +62 -0
- data/lib/account_component/controls/version.rb +9 -0
- data/lib/account_component/controls/write/deposit.rb +23 -0
- data/lib/account_component/controls/write/withdraw.rb +23 -0
- data/lib/account_component/load.rb +13 -0
- data/lib/account_component/messages/commands/close.rb +12 -0
- data/lib/account_component/messages/commands/deposit.rb +14 -0
- data/lib/account_component/messages/commands/open.rb +13 -0
- data/lib/account_component/messages/commands/withdraw.rb +14 -0
- data/lib/account_component/messages/events/closed.rb +13 -0
- data/lib/account_component/messages/events/deposited.rb +16 -0
- data/lib/account_component/messages/events/opened.rb +14 -0
- data/lib/account_component/messages/events/withdrawal_rejected.rb +15 -0
- data/lib/account_component/messages/events/withdrawn.rb +16 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3e0de48935cd26c66a77a62aa9b85622261976f52d93cb5a3118eaf24fb12334
|
4
|
+
data.tar.gz: bd8953cd8100fbd206366f38d9eff46381cdf6f1c8f39c440e4b434e87244f47
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 65a907bf42091b41dbe10c0d9049dea3f03ed4777e99de5627285db5ec258c6de020394d2ee08ed68c92db69414f66ed7a1b7ed176c3971e35aa11f960910c36
|
7
|
+
data.tar.gz: b6aa1d19c1bb4500905641f495a4168d9f261910a52e70cbcd14b00b0782ba019fe7faabc6fba4fec9d3e3826f74c960cd32fd77f9160129446579c72653f3cb
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Commands
|
3
|
+
module Command
|
4
|
+
def self.included(cls)
|
5
|
+
cls.class_exec do
|
6
|
+
include Dependency
|
7
|
+
|
8
|
+
include Messaging::StreamName
|
9
|
+
include Messages::Events
|
10
|
+
|
11
|
+
extend Build
|
12
|
+
extend BuildMessage
|
13
|
+
|
14
|
+
category :account
|
15
|
+
|
16
|
+
dependency :write, Messaging::Postgres::Write
|
17
|
+
dependency :clock, Clock::UTC
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def configure
|
22
|
+
Messaging::Postgres::Write.configure(self)
|
23
|
+
Clock::UTC.configure(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
module Build
|
27
|
+
def build
|
28
|
+
instance = new
|
29
|
+
instance.configure
|
30
|
+
instance
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module BuildMessage
|
35
|
+
def build_message(message_class, previous_message)
|
36
|
+
message = message_class.new
|
37
|
+
|
38
|
+
unless previous_message.nil?
|
39
|
+
message.metadata.follow(previous_message.metadata)
|
40
|
+
end
|
41
|
+
|
42
|
+
message
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Commands
|
3
|
+
class Deposit
|
4
|
+
include Command
|
5
|
+
|
6
|
+
def self.configure(receiver, attr_name: nil)
|
7
|
+
attr_name ||= :deposit
|
8
|
+
instance = build
|
9
|
+
receiver.public_send("#{attr_name}=", instance)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.call(account_id:, amount:, deposit_id: nil, previous_message: nil)
|
13
|
+
deposit_id ||= Identifier::UUID::Random.get
|
14
|
+
instance = self.build
|
15
|
+
instance.(deposit_id: deposit_id, account_id: account_id, amount: amount, previous_message: previous_message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(deposit_id:, account_id:, amount:, previous_message: nil)
|
19
|
+
deposit = self.class.build_message(Messages::Commands::Deposit, previous_message)
|
20
|
+
|
21
|
+
deposit.deposit_id = deposit_id
|
22
|
+
deposit.account_id = account_id
|
23
|
+
deposit.amount = amount
|
24
|
+
deposit.time = clock.iso8601
|
25
|
+
|
26
|
+
stream_name = command_stream_name(account_id)
|
27
|
+
|
28
|
+
write.(deposit, stream_name)
|
29
|
+
|
30
|
+
deposit
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Commands
|
3
|
+
class Withdraw
|
4
|
+
include Command
|
5
|
+
|
6
|
+
def self.configure(receiver, attr_name: nil)
|
7
|
+
attr_name ||= :withdraw
|
8
|
+
instance = build
|
9
|
+
receiver.public_send("#{attr_name}=", instance)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.call(account_id:, amount:, withdrawal_id: nil, previous_message: nil)
|
13
|
+
withdrawal_id ||= Identifier::UUID::Random.get
|
14
|
+
instance = self.build
|
15
|
+
instance.(withdrawal_id: withdrawal_id, account_id: account_id, amount: amount, previous_message: previous_message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def call(withdrawal_id:, account_id:, amount:, previous_message: nil)
|
19
|
+
withdraw = self.class.build_message(Messages::Commands::Withdraw, previous_message)
|
20
|
+
|
21
|
+
withdraw.withdrawal_id = withdrawal_id
|
22
|
+
withdraw.account_id = account_id
|
23
|
+
withdraw.amount = amount
|
24
|
+
withdraw.time = clock.iso8601
|
25
|
+
|
26
|
+
stream_name = command_stream_name(account_id)
|
27
|
+
|
28
|
+
write.(withdraw, stream_name)
|
29
|
+
|
30
|
+
withdraw
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'clock/controls'
|
2
|
+
require 'identifier/uuid/controls'
|
3
|
+
require 'messaging/controls'
|
4
|
+
|
5
|
+
require 'account_component/controls/id'
|
6
|
+
require 'account_component/controls/time'
|
7
|
+
require 'account_component/controls/money'
|
8
|
+
require 'account_component/controls/position'
|
9
|
+
require 'account_component/controls/sequence'
|
10
|
+
require 'account_component/controls/version'
|
11
|
+
require 'account_component/controls/message'
|
12
|
+
|
13
|
+
require 'account_component/controls/commands/open'
|
14
|
+
require 'account_component/controls/commands/deposit'
|
15
|
+
require 'account_component/controls/commands/withdraw'
|
16
|
+
require 'account_component/controls/commands/close'
|
17
|
+
|
18
|
+
require 'account_component/controls/events/opened'
|
19
|
+
require 'account_component/controls/events/deposited'
|
20
|
+
require 'account_component/controls/events/withdrawn'
|
21
|
+
require 'account_component/controls/events/withdrawal_rejected'
|
22
|
+
require 'account_component/controls/events/closed'
|
23
|
+
|
24
|
+
require 'account_component/controls/write/deposit'
|
25
|
+
require 'account_component/controls/write/withdraw'
|
26
|
+
|
27
|
+
require 'account_component/controls/account'
|
28
|
+
require 'account_component/controls/customer'
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Account
|
4
|
+
def self.example(balance: nil, sequence: nil)
|
5
|
+
balance ||= self.balance
|
6
|
+
|
7
|
+
account = AccountComponent::Account.build
|
8
|
+
|
9
|
+
account.id = id
|
10
|
+
account.balance = balance
|
11
|
+
account.opened_time = Time::Effective::Raw.example
|
12
|
+
|
13
|
+
account.sequence = sequence unless sequence.nil?
|
14
|
+
|
15
|
+
account
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.id
|
19
|
+
ID.example(increment: id_increment)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.id_increment
|
23
|
+
11
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.balance
|
27
|
+
Money.example
|
28
|
+
end
|
29
|
+
|
30
|
+
module New
|
31
|
+
def self.example
|
32
|
+
AccountComponent::Account.build
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module Open
|
37
|
+
def self.example
|
38
|
+
Account.example
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
module Balance
|
43
|
+
def self.example
|
44
|
+
Account.example(balance: self.amount)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.amount
|
48
|
+
11.1
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
module Sequence
|
53
|
+
def self.example
|
54
|
+
sequence = Controls::Sequence.example
|
55
|
+
|
56
|
+
Account.example(sequence: sequence)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module Closed
|
61
|
+
def self.example
|
62
|
+
account = Account.example
|
63
|
+
account.closed_time = Time::Effective::Raw.example
|
64
|
+
account
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Commands
|
4
|
+
module Close
|
5
|
+
def self.example
|
6
|
+
close = AccountComponent::Messages::Commands::Close.build
|
7
|
+
|
8
|
+
close.account_id = Account.id
|
9
|
+
close.time = Controls::Time::Effective.example
|
10
|
+
|
11
|
+
close
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Commands
|
4
|
+
module Deposit
|
5
|
+
def self.example(id: nil, account_id: nil, amount: nil)
|
6
|
+
id ||= ID.example
|
7
|
+
account_id ||= Account.id
|
8
|
+
amount ||= Money.example
|
9
|
+
|
10
|
+
deposit = AccountComponent::Messages::Commands::Deposit.build
|
11
|
+
|
12
|
+
deposit.deposit_id = id
|
13
|
+
deposit.account_id = account_id
|
14
|
+
deposit.amount = amount
|
15
|
+
deposit.time = Controls::Time::Effective.example
|
16
|
+
|
17
|
+
deposit.metadata.global_position = Position.example
|
18
|
+
|
19
|
+
deposit
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Commands
|
4
|
+
module Open
|
5
|
+
def self.example
|
6
|
+
open = AccountComponent::Messages::Commands::Open.build
|
7
|
+
|
8
|
+
open.account_id = Account.id
|
9
|
+
open.customer_id = Customer.id
|
10
|
+
open.time = Controls::Time::Effective.example
|
11
|
+
|
12
|
+
open
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Commands
|
4
|
+
module Withdraw
|
5
|
+
def self.example(id: nil, account_id: nil, amount: nil)
|
6
|
+
id ||= ID.example
|
7
|
+
account_id ||= Account.id
|
8
|
+
amount ||= Money.example
|
9
|
+
|
10
|
+
withdraw = AccountComponent::Messages::Commands::Withdraw.build
|
11
|
+
|
12
|
+
withdraw.withdrawal_id = id
|
13
|
+
withdraw.account_id = account_id
|
14
|
+
withdraw.amount = amount
|
15
|
+
withdraw.time = Controls::Time::Effective.example
|
16
|
+
|
17
|
+
withdraw.metadata.global_position = Position.example
|
18
|
+
|
19
|
+
withdraw
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Events
|
4
|
+
module Closed
|
5
|
+
def self.example
|
6
|
+
closed = AccountComponent::Messages::Events::Closed.build
|
7
|
+
|
8
|
+
closed.account_id = Account.id
|
9
|
+
closed.time = Controls::Time::Effective.example
|
10
|
+
closed.processed_time = Controls::Time::Processed.example
|
11
|
+
|
12
|
+
closed
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Events
|
4
|
+
module Deposited
|
5
|
+
def self.example
|
6
|
+
deposited = AccountComponent::Messages::Events::Deposited.build
|
7
|
+
|
8
|
+
deposited.deposit_id = ID.example
|
9
|
+
deposited.account_id = Account.id
|
10
|
+
deposited.amount = Money.example
|
11
|
+
deposited.time = Controls::Time::Effective.example
|
12
|
+
deposited.processed_time = Controls::Time::Processed.example
|
13
|
+
|
14
|
+
deposited.sequence = Sequence.example
|
15
|
+
|
16
|
+
deposited
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Events
|
4
|
+
module Opened
|
5
|
+
def self.example
|
6
|
+
opened = AccountComponent::Messages::Events::Opened.build
|
7
|
+
|
8
|
+
opened.account_id = Account.id
|
9
|
+
opened.customer_id = Customer.id
|
10
|
+
opened.time = Controls::Time::Effective.example
|
11
|
+
opened.processed_time = Controls::Time::Processed.example
|
12
|
+
|
13
|
+
opened
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Events
|
4
|
+
module WithdrawalRejected
|
5
|
+
def self.example
|
6
|
+
withdrawal_rejected = AccountComponent::Messages::Events::WithdrawalRejected.build
|
7
|
+
|
8
|
+
withdrawal_rejected.withdrawal_id = ID.example
|
9
|
+
withdrawal_rejected.account_id = Account.id
|
10
|
+
withdrawal_rejected.amount = Money.example
|
11
|
+
withdrawal_rejected.time = Controls::Time::Effective.example
|
12
|
+
|
13
|
+
withdrawal_rejected.sequence = Sequence.example
|
14
|
+
|
15
|
+
withdrawal_rejected
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Events
|
4
|
+
module Withdrawn
|
5
|
+
def self.example
|
6
|
+
withdrawn = AccountComponent::Messages::Events::Withdrawn.build
|
7
|
+
|
8
|
+
withdrawn.withdrawal_id = ID.example
|
9
|
+
withdrawn.account_id = Account.id
|
10
|
+
withdrawn.amount = Money.example
|
11
|
+
withdrawn.time = Controls::Time::Effective.example
|
12
|
+
withdrawn.processed_time = Controls::Time::Processed.example
|
13
|
+
|
14
|
+
withdrawn.sequence = Sequence.example
|
15
|
+
|
16
|
+
withdrawn
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Time
|
4
|
+
def self.example(time=nil)
|
5
|
+
time ||= Raw.example
|
6
|
+
ISO8601.example(time)
|
7
|
+
end
|
8
|
+
|
9
|
+
module Raw
|
10
|
+
def self.example
|
11
|
+
Clock::Controls::Time::Raw.example
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module ISO8601
|
16
|
+
def self.example(time=nil)
|
17
|
+
Clock::Controls::Time::ISO8601.example(time)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.precision
|
21
|
+
3
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module Processed
|
26
|
+
def self.example(time=nil, offset_milliseconds: nil)
|
27
|
+
offset_milliseconds ||= self.offset_milliseconds
|
28
|
+
Clock::Controls::Time::Offset.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
29
|
+
end
|
30
|
+
|
31
|
+
module Raw
|
32
|
+
def self.example(time=nil, offset_milliseconds: nil)
|
33
|
+
offset_milliseconds ||= Processed.offset_milliseconds
|
34
|
+
Clock::Controls::Time::Offset::Raw.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.offset_milliseconds
|
39
|
+
11
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
module Effective
|
44
|
+
def self.example(time=nil, offset_milliseconds: nil)
|
45
|
+
offset_milliseconds ||= self.offset_milliseconds
|
46
|
+
Clock::Controls::Time::Offset.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
47
|
+
end
|
48
|
+
|
49
|
+
module Raw
|
50
|
+
def self.example(time=nil, offset_milliseconds: nil)
|
51
|
+
offset_milliseconds ||= Effective.offset_milliseconds
|
52
|
+
Clock::Controls::Time::Offset::Raw.example(offset_milliseconds, time: time, precision: ISO8601.precision)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.offset_milliseconds
|
57
|
+
1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Write
|
4
|
+
module Deposit
|
5
|
+
def self.call(id: nil, account_id: nil, amount: nil)
|
6
|
+
id ||= ID.example
|
7
|
+
account_id ||= Account.id
|
8
|
+
amount ||= Money.example
|
9
|
+
|
10
|
+
deposit = Commands::Deposit.example(
|
11
|
+
id: id,
|
12
|
+
account_id: account_id,
|
13
|
+
amount: amount
|
14
|
+
)
|
15
|
+
|
16
|
+
stream_name = Messaging::StreamName.command_stream_name(id, 'account')
|
17
|
+
|
18
|
+
Messaging::Postgres::Write.(deposit, stream_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Controls
|
3
|
+
module Write
|
4
|
+
module Withdraw
|
5
|
+
def self.call(id: nil, account_id: nil, amount: nil)
|
6
|
+
id ||= ID.example
|
7
|
+
account_id ||= Account.id
|
8
|
+
amount ||= Money.example
|
9
|
+
|
10
|
+
deposit = Commands::Withdraw.example(
|
11
|
+
id: id,
|
12
|
+
account_id: account_id,
|
13
|
+
amount: amount
|
14
|
+
)
|
15
|
+
|
16
|
+
stream_name = Messaging::StreamName.command_stream_name(id, 'account')
|
17
|
+
|
18
|
+
Messaging::Postgres::Write.(deposit, stream_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'account_component/messages/commands/open'
|
2
|
+
require 'account_component/messages/commands/deposit'
|
3
|
+
require 'account_component/messages/commands/withdraw'
|
4
|
+
require 'account_component/messages/commands/close'
|
5
|
+
require 'account_component/messages/events/opened'
|
6
|
+
require 'account_component/messages/events/deposited'
|
7
|
+
require 'account_component/messages/events/withdrawn'
|
8
|
+
require 'account_component/messages/events/withdrawal_rejected'
|
9
|
+
require 'account_component/messages/events/closed'
|
10
|
+
|
11
|
+
require 'account_component/commands/command'
|
12
|
+
require 'account_component/commands/withdraw'
|
13
|
+
require 'account_component/commands/deposit'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Messages
|
3
|
+
module Commands
|
4
|
+
class Deposit
|
5
|
+
include Messaging::Message
|
6
|
+
|
7
|
+
attribute :deposit_id, String
|
8
|
+
attribute :account_id, String
|
9
|
+
attribute :amount, Numeric
|
10
|
+
attribute :time, String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Messages
|
3
|
+
module Commands
|
4
|
+
class Withdraw
|
5
|
+
include Messaging::Message
|
6
|
+
|
7
|
+
attribute :withdrawal_id, String
|
8
|
+
attribute :account_id, String
|
9
|
+
attribute :amount, Numeric
|
10
|
+
attribute :time, String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Messages
|
3
|
+
module Events
|
4
|
+
class Deposited
|
5
|
+
include Messaging::Message
|
6
|
+
|
7
|
+
attribute :deposit_id, String
|
8
|
+
attribute :account_id, String
|
9
|
+
attribute :amount, Numeric
|
10
|
+
attribute :time, String
|
11
|
+
attribute :processed_time, String
|
12
|
+
attribute :sequence, Integer
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Messages
|
3
|
+
module Events
|
4
|
+
class Opened
|
5
|
+
include Messaging::Message
|
6
|
+
|
7
|
+
attribute :account_id, String
|
8
|
+
attribute :customer_id, String
|
9
|
+
attribute :time, String
|
10
|
+
attribute :processed_time, String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Messages
|
3
|
+
module Events
|
4
|
+
class WithdrawalRejected
|
5
|
+
include Messaging::Message
|
6
|
+
|
7
|
+
attribute :withdrawal_id, String
|
8
|
+
attribute :account_id, String
|
9
|
+
attribute :amount, Numeric
|
10
|
+
attribute :time, String
|
11
|
+
attribute :sequence, Integer
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AccountComponent
|
2
|
+
module Messages
|
3
|
+
module Events
|
4
|
+
class Withdrawn
|
5
|
+
include Messaging::Message
|
6
|
+
|
7
|
+
attribute :withdrawal_id, String
|
8
|
+
attribute :account_id, String
|
9
|
+
attribute :amount, Numeric
|
10
|
+
attribute :time, String
|
11
|
+
attribute :processed_time, String
|
12
|
+
attribute :sequence, Integer
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: account-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- The Eventide Project
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: evt-messaging-postgres
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: test_bench
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: " "
|
42
|
+
email: opensource@eventide-project.org
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/account/client.rb
|
48
|
+
- lib/account/client/controls.rb
|
49
|
+
- lib/account/client/namespace.rb
|
50
|
+
- lib/account_component/commands/command.rb
|
51
|
+
- lib/account_component/commands/deposit.rb
|
52
|
+
- lib/account_component/commands/withdraw.rb
|
53
|
+
- lib/account_component/controls.rb
|
54
|
+
- lib/account_component/controls/account.rb
|
55
|
+
- lib/account_component/controls/commands/close.rb
|
56
|
+
- lib/account_component/controls/commands/deposit.rb
|
57
|
+
- lib/account_component/controls/commands/open.rb
|
58
|
+
- lib/account_component/controls/commands/withdraw.rb
|
59
|
+
- lib/account_component/controls/customer.rb
|
60
|
+
- lib/account_component/controls/events/closed.rb
|
61
|
+
- lib/account_component/controls/events/deposited.rb
|
62
|
+
- lib/account_component/controls/events/opened.rb
|
63
|
+
- lib/account_component/controls/events/withdrawal_rejected.rb
|
64
|
+
- lib/account_component/controls/events/withdrawn.rb
|
65
|
+
- lib/account_component/controls/id.rb
|
66
|
+
- lib/account_component/controls/message.rb
|
67
|
+
- lib/account_component/controls/money.rb
|
68
|
+
- lib/account_component/controls/position.rb
|
69
|
+
- lib/account_component/controls/sequence.rb
|
70
|
+
- lib/account_component/controls/time.rb
|
71
|
+
- lib/account_component/controls/version.rb
|
72
|
+
- lib/account_component/controls/write/deposit.rb
|
73
|
+
- lib/account_component/controls/write/withdraw.rb
|
74
|
+
- lib/account_component/load.rb
|
75
|
+
- lib/account_component/messages/commands/close.rb
|
76
|
+
- lib/account_component/messages/commands/deposit.rb
|
77
|
+
- lib/account_component/messages/commands/open.rb
|
78
|
+
- lib/account_component/messages/commands/withdraw.rb
|
79
|
+
- lib/account_component/messages/events/closed.rb
|
80
|
+
- lib/account_component/messages/events/deposited.rb
|
81
|
+
- lib/account_component/messages/events/opened.rb
|
82
|
+
- lib/account_component/messages/events/withdrawal_rejected.rb
|
83
|
+
- lib/account_component/messages/events/withdrawn.rb
|
84
|
+
homepage: https://github.com/eventide-examples/account-component
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.4'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubygems_version: 3.0.3
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Account Client
|
107
|
+
test_files: []
|