Exemplo n.º 1
0
 @Asynchronous
 public void respondDepositConfMessage(
     Promise<BigDecimal> balance, Promise<BigDecimal> fee, Promise<DataSet> addr) {
   DataSet ds = addr.get();
   Withdrawal dep = (Withdrawal) ds.getPayload();
   BigDecimal bal = (dep.getBalance() != null) ? dep.getBalance() : balance.get();
   BigDecimal f = (dep.getFee() != null) ? dep.getFee() : fee.get();
   dep.setBalance(bal.subtract(f));
   msgClient.sendMessage(ds);
 }
Exemplo n.º 2
0
 @Asynchronous
 public void setConfirm(
     @NoWait Settable<DataSet> account,
     OrPromise trigger,
     Promise<Action> isConfirmed,
     DataSet data)
     throws Throwable {
   if (isConfirmed.isReady()) {
     if (null != isConfirmed.get() && isConfirmed.get() != Action.WITHDRAWAL_REQ) {
       data.setAction(isConfirmed.get());
     }
     account.set(data);
   } else {
     throw new Throwable("user did not confirm transaction.");
   }
 }
Exemplo n.º 3
0
 @Asynchronous
 public void respondTransactions(Promise<List<Transaction>> transactions, DataSet data) {
   data.setPayload(transactions.get());
   msgClient.sendMessage(data);
 }
Exemplo n.º 4
0
 @Asynchronous
 public void cacheBalance(Promise<BigDecimal> balance, DataSet data) {
   data.setPayload(new Withdrawal().setBalance(balance.get()));
   msgClient.putCache(data);
 }
Exemplo n.º 5
0
 @Asynchronous
 public void respondBalance(Promise<BigDecimal> balance, Promise<BigDecimal> fee, DataSet data) {
   data.setPayload(new Withdrawal().setBalance(balance.get().subtract(fee.get())));
   msgClient.sendMessage(data);
 }
Exemplo n.º 6
0
 @Asynchronous
 public void respondDataReq(Promise<String> bcAddress, DataSet data) {
   data.setPayload(
       new PaymentAddress().setAddress(bcAddress.get()).setAddressType(PaymentType.BTC));
   msgClient.putAddressCache(data);
 }
Exemplo n.º 7
0
 @Asynchronous
 public void createAddress(Promise<Void> done, DataSet data) {
   Promise<String> bcAddress = bcdClient.getNewAddress(data.getCn());
   respondDataReq(bcAddress, data);
 }