We are developing banking web services in spring mvc and trying to comply with Rest Uri Design principals. As you know in banking applications you can do eft(electronic funds transfer), credit card debt payments, money orders, bill payments, etc. Actually these financial operations create transactions on your bank account. So we think the URIs must be like this:
To get transactions for specific account :
GET /users/{id}/accounts/{id}/transactions
To do card debt payment :
POST /users/{id}/accounts/{id}/transactions?type=card
To do eft :
POST /users/{id}/accounts/{id}/transactions?type=eft
To do money order :
POST /users/{id}/accounts/{id}/transactions?type=moneyorder
In this case in my controller there will be only one method that serves all this different actions. This method is going to get type of the action from the RequestParam and decide the action in if/else blocks. But this is disapproved according to Java Design Principals. Because adding new transaction types is going to add additional if/else blocks in that method.
So what will be the best solution for this issue. Different approaches will be appreciated.