The business center will be in charge of the business operations such as transfer, query transactions, balance, history, which is the middleman between user and account center. It will receive request from user, and validate token from user center, and perform action to ensure seperation of concerns from accounting and business logic.
| Term | Description |
|---|---|
| transfer | User enters their name, phone number, password, confirm password |
| transferConfirm | When there is a transfer over limit, verifyOTP is required |
| queryTransactionDetails | User enters their phone number and password. |
| queryTransactionHistory | User enters the OTP sent to their phone number to confirm payments over the threshold. |
| queryBalance | after user enters the otp values, we verify it with the OTP stored in cache |
| topUp | allows user to connect to their bank account or car and deposit some amount to their e-wallet account |
To take note :
if there are two users performing transfer operation on the same person’s record, there will be concurrent updates. — not atomic. does not have idempotency
Or if he press the transfer button two times, and passes the validation check, it deducts the money from his account twice. — race condition.
to solve, add idempotency table insert, when the user clicks on transfer.
it should be inserted when user clicks on transfer and is prompted to enter the password
So, we frontend needs to generate a unique idempotency key when the user enters the password page, then this key is passed into the request and creates a new idempotent record, so two retries will still pass the same idempotent key, so once the first is created, the second is discarded.
Only the very last confirmation do you need to have the same idempotency key passed in the request.
We need to have an idemptency key table to ensure the transaction can be retried at a later time in case of a failure.

The main goal is to develop system where when user presses transfer confirm, it will display the enter pin pop up, that should not create a new transaction, rather to issue a jwt token with expiry and verify it later after user entered their password
So in transferInit, just issue a JwtToken .
transferInit