-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
19 - deposit money to bank account #39
Conversation
Add balance column to account table
Add Money class to Account entity. Update tests with new type. Refactor: More end-lines to files
Add initial deposit and withdraw methods to domain layer and accountAdapter with some validations.
…e throwing npe. Refactor tests to support mockK Create useCase for deposit feature
Add custom exceptions for validations
Refactor inAdapter to be in single file Refactor Account out adapter. Add DepositAccount in port and moneyDeposited event.
# Conflicts: # demo-transactions/pom.xml # demo-transactions/src/main/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/adapter/inbound/account/AccountRestInAdapter.kt # demo-transactions/src/main/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/adapter/inbound/account/mapper/AccountDtoMapper.kt # demo-transactions/src/main/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/adapter/outbound/account/jpa/AccountOutAdapter.kt # demo-transactions/src/main/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/application/port/outbound/account/AccountOutPort.kt # demo-transactions/src/main/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/application/usecase/CreateAccountUsecase.kt # demo-transactions/src/main/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/domain/model/account/Account.kt # demo-transactions/src/main/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/domain/model/account/Money.kt # demo-transactions/src/main/resources/api/api.yaml # demo-transactions/src/test/kotlin/io/holixon/cqrshexagonaldemo/demoparent/transactions/application/usecase/CreateAccountUsecaseTest.kt
Remove withdraw feature doesn't belong on this development. Fix: Fix testing to support Amount value class Add mockk version to pom
…untOutPortAdapter. Remove unused test with the refactor.
…n api test: run integration tests on verify phase feat: add logging
private val eventingOutAdapter: EventingOutAdapter | ||
) : DepositAccountInPort { | ||
|
||
override fun deposit(accountNumber: String, amount: Amount) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should already an Iban
comming in, instead of an account number. Adapters/Infrastructure components should be the only ones, who use primitives/non-domain-objects.
.../cqrshexagonaldemo/demoparent/transactions/adapter/outbound/account/jpa/AccountOutAdapter.kt
Show resolved
Hide resolved
@@ -72,6 +72,33 @@ paths: | |||
application/json: | |||
schema: | |||
$ref: '#/components/schemas/AccountCreatedResponse' | |||
/api/v1/account/deposit: | |||
put: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put is not the correct rest method here, since put calls should be idempotent. But depositing money shouldn't be idempotent, since the result each time should be an increased balance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense 🙈 since only deposit of 0 would be idempotent but it doesn't make sense to do it 😅 in the beginning i was using post request but since deposit was updating the entity it felt natural to use a put request i wasn't think of the idempotency.
This PR contains the features for Deposit money into an account.
Also more tests were added with some useCases to support not only the happy paths but also unhappy one's.