Skip to content
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

Merged
merged 12 commits into from
Apr 19, 2024

Conversation

rafaelcp94
Copy link
Contributor

@rafaelcp94 rafaelcp94 commented Apr 12, 2024

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.

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.
@rafaelcp94 rafaelcp94 self-assigned this Apr 12, 2024
@rafaelcp94 rafaelcp94 linked an issue Apr 12, 2024 that may be closed by this pull request
private val eventingOutAdapter: EventingOutAdapter
) : DepositAccountInPort {

override fun deposit(accountNumber: String, amount: Amount) {
Copy link
Contributor

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.

@@ -72,6 +72,33 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/AccountCreatedResponse'
/api/v1/account/deposit:
put:
Copy link
Contributor

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.

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.

@mmiikkkkaa mmiikkkkaa merged commit 4047281 into develop Apr 19, 2024
2 checks passed
@mmiikkkkaa mmiikkkkaa deleted the 19-deposit-money-to-bank-account branch April 19, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deposit money to bank account
3 participants