Compare commits
2 Commits
2bec3d5734
...
979c6932ba
| Author | SHA1 | Date | |
|---|---|---|---|
| 979c6932ba | |||
| 42acf37000 |
@ -12,9 +12,9 @@ import java.util.HashMap;
|
||||
public class MoneyTransferController {
|
||||
|
||||
// Global accounts variable
|
||||
private static final Map<String, Map<String, Double>> accounts = new HashMap<String, Map<String, Double>>() {{
|
||||
put("1", new HashMap<String, Double>() {{ put("amount", 1000.0); }});
|
||||
put("2", new HashMap<String, Double>() {{ put("amount", 1000.0); }});
|
||||
private static final Map<String, Account> accounts = new HashMap<String, Account>() {{
|
||||
put("1", new Account("1", 1000.0));
|
||||
put("2", new Account("2", 1000.0));
|
||||
}};
|
||||
|
||||
@PostMapping("/transfer")
|
||||
@ -33,6 +33,17 @@ public class MoneyTransferController {
|
||||
);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Account {
|
||||
private String id;
|
||||
private Double amount;
|
||||
|
||||
public Account(String id, Double amount) {
|
||||
this.id = id;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class TransferRequest {
|
||||
private Double amount;
|
||||
|
||||
Reference in New Issue
Block a user