removed transferStates from AccountInfo

cannot reproduce issue #37
This commit is contained in:
dartpopikyardo
2016-09-07 18:09:38 +03:00
parent 732581a3cb
commit 8b5b54ed01
3 changed files with 5 additions and 12 deletions

View File

@@ -18,7 +18,6 @@ public class AccountInfo {
private long balance;
private List<AccountChangeInfo> changes;
private Map<String, AccountTransactionInfo> transactions;
private Map<String, TransferState> transferStates;
private String version;
private Date date;
@@ -77,12 +76,4 @@ public class AccountInfo {
public Date getDate() {
return date;
}
public Map<String, TransferState> getTransferStates() {
return transferStates;
}
public void setTransferStates(Map<String, TransferState> transferStates) {
this.transferStates = transferStates;
}
}

View File

@@ -55,10 +55,12 @@ public class AccountInfoUpdateService {
public void addTransaction(String accountId, AccountTransactionInfo ti) {
System.out.println("Start addTransaction for: "+ti.toString());
mongoTemplate.upsert(new Query(where("id").is(accountId)),
new Update().
set("transactions." + ti.getTransactionId(), ti),
AccountInfo.class);
System.out.println("End addTransaction for: "+ti.toString());
}
@@ -72,9 +74,11 @@ public class AccountInfoUpdateService {
}
public void updateTransactionStatus(String accountId, String transactionId, TransferState status) {
System.out.println("Start updateTransactionStatus "+accountId +" "+transactionId+" "+status);
mongoTemplate.upsert(new Query(where("id").is(accountId)),
new Update().
set("transferStates." + transactionId, status),
set("transactions." + transactionId + ".status", status),
AccountInfo.class);
System.out.println("End updateTransactionStatus "+accountId +" "+transactionId+" "+status);
}
}

View File

@@ -15,8 +15,6 @@ public class AccountQueryService {
if (account == null)
throw new AccountNotFoundException(accountId);
else
if(account.getTransferStates()!=null)
account.getTransactions().stream().forEach(ati -> ati.setStatus(account.getTransferStates().get(ati.getTransactionId())));
return account;
}