Skip to content

Commit

Permalink
replay create account with same payload results in ok
Browse files Browse the repository at this point in the history
  • Loading branch information
jancajthaml authored Dec 26, 2021
1 parent 353cae8 commit 213395e
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 11 deletions.
25 changes: 20 additions & 5 deletions bbtest/features/api.feature
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Feature: REST
| method | POST |
"""
{
"name": "yyy",
"name": "A",
"format": "test",
"currency": "XXX",
"isBalanceCheck": false
Expand All @@ -117,16 +117,31 @@ Feature: REST
| method | POST |
"""
{
"name": "yyy",
"name": "A",
"format": "test",
"currency": "XXX",
"isBalanceCheck": false
"isBalanceCheck": true
}
"""
Then HTTP response is
| key | value |
| status | 409 |

When I request HTTP https://127.0.0.1/account/API
| key | value |
| method | POST |
"""
{
"name": "A",
"format": "test",
"currency": "XXX",
"isBalanceCheck": false
}
"""
Then HTTP response is
| key | value |
| status | 200 |

When I request HTTP https://127.0.0.1/account/API
| key | value |
| method | POST |
Expand Down Expand Up @@ -160,7 +175,7 @@ Feature: REST
| method | POST |
"""
{
"name": "xxx",
"name": "C",
"format": "test",
"currency": "XXX",
"isBalanceCheck": false
Expand All @@ -170,7 +185,7 @@ Feature: REST
| key | value |
| status | 200 |

When I request HTTP https://127.0.0.1/account/API/xxx
When I request HTTP https://127.0.0.1/account/API/C
| key | value |
| method | GET |
Then HTTP response is
Expand Down
2 changes: 1 addition & 1 deletion services/vault-rest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/coreos/go-systemd/v22 v22.3.2
github.com/jancajthaml-openbank/actor-system v1.5.4
github.com/jancajthaml-openbank/local-fs v1.2.4
github.com/jancajthaml-openbank/local-fs v1.2.8
github.com/labstack/echo/v4 v4.6.1
github.com/rs/xid v1.3.0
github.com/rs/zerolog v1.26.1
Expand Down
4 changes: 2 additions & 2 deletions services/vault-rest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/jancajthaml-openbank/actor-system v1.5.4 h1:1Eqn4A62uBPkEPW/0k9VxwSqdCdWKUWGlRQEQG9oPtU=
github.com/jancajthaml-openbank/actor-system v1.5.4/go.mod h1:nIHD5as3cIrWQKj/YH1qJcEoGDJ9bLspb/rEfRwCv4U=
github.com/jancajthaml-openbank/local-fs v1.2.4 h1:pXzHV0T+uIHj86uSdkr7ooxjWYrHhQF7Vt0QQ2F5u9M=
github.com/jancajthaml-openbank/local-fs v1.2.4/go.mod h1:W19XcWPceSnj+ZE8UOZapMlinVIxq8xJsGogTfv80XM=
github.com/jancajthaml-openbank/local-fs v1.2.8 h1:66HspCnsoPgrrNqU/O2EShpkdcuoqDXtSOzTli3Igeo=
github.com/jancajthaml-openbank/local-fs v1.2.8/go.mod h1:W19XcWPceSnj+ZE8UOZapMlinVIxq8xJsGogTfv80XM=
github.com/labstack/echo/v4 v4.6.1 h1:OMVsrnNFzYlGSdaiYGHbgWQnr+JM7NG+B9suCPie14M=
github.com/labstack/echo/v4 v4.6.1/go.mod h1:RnjgMWNDB9g/HucVWhQYNQP9PvbYf6adqftqryo7s9k=
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
Expand Down
5 changes: 5 additions & 0 deletions services/vault-unit/actor/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func ExistAccount(s *System, state model.Account) system.ReceiverFunction {
return ExistAccount(s, state)

case CreateAccount:
if (msg.Format == state.Format && msg.Currency == state.Currency && msg.IsBalanceCheck == state.IsBalanceCheck) {
s.SendMessage(RespCreateAccount, context.Sender, context.Receiver)
log.Debug().Msgf("%s/Exist/CreateAccount Already Exist", state.Name)
return ExistAccount(s, state)
}
s.SendMessage(FatalError, context.Sender, context.Receiver)
log.Debug().Msgf("%s/Exist/CreateAccount Error", state.Name)
return ExistAccount(s, state)
Expand Down
2 changes: 1 addition & 1 deletion services/vault-unit/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/DataDog/datadog-go v4.8.3+incompatible
github.com/jancajthaml-openbank/actor-system v1.5.4
github.com/jancajthaml-openbank/local-fs v1.2.4
github.com/jancajthaml-openbank/local-fs v1.2.8
github.com/rs/zerolog v1.26.1
github.com/stretchr/testify v1.7.0
)
Expand Down
4 changes: 2 additions & 2 deletions services/vault-unit/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/jancajthaml-openbank/actor-system v1.5.4 h1:1Eqn4A62uBPkEPW/0k9VxwSqdCdWKUWGlRQEQG9oPtU=
github.com/jancajthaml-openbank/actor-system v1.5.4/go.mod h1:nIHD5as3cIrWQKj/YH1qJcEoGDJ9bLspb/rEfRwCv4U=
github.com/jancajthaml-openbank/local-fs v1.2.4 h1:pXzHV0T+uIHj86uSdkr7ooxjWYrHhQF7Vt0QQ2F5u9M=
github.com/jancajthaml-openbank/local-fs v1.2.4/go.mod h1:W19XcWPceSnj+ZE8UOZapMlinVIxq8xJsGogTfv80XM=
github.com/jancajthaml-openbank/local-fs v1.2.8 h1:66HspCnsoPgrrNqU/O2EShpkdcuoqDXtSOzTli3Igeo=
github.com/jancajthaml-openbank/local-fs v1.2.8/go.mod h1:W19XcWPceSnj+ZE8UOZapMlinVIxq8xJsGogTfv80XM=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pebbe/zmq4 v1.2.7 h1:6EaX83hdFSRUEhgzSW1E/SPoTS3JeYZgYkBvwdcrA9A=
github.com/pebbe/zmq4 v1.2.7/go.mod h1:nqnPueOapVhE2wItZ0uOErngczsJdLOGkebMxaO8r48=
Expand Down

0 comments on commit 213395e

Please sign in to comment.