@Test public void testWithdraw() { TradingCurrency currency = TradingCurrency.Bitcoin; BigDecimal amount = BigDecimal.valueOf(0.2); String destination = "0x00"; when(restTemplate.exchange( requestCaptor.capture(), eq(HttpMethod.POST), entity.capture(), eq(Object.class) )).thenReturn(new ResponseEntity<>(new Object(), HttpStatus.OK)); hitbtcRestService.withdraw(currency, amount, destination); assertThat(requestCaptor.getValue()).isEqualTo(BASE + "/account/crypto/withdraw"); }
@SneakyThrows @Override public void withdraw(TradingCurrency currency, BigDecimal amount, String destination) { HitbtcWithdrawRequestDto requestDto = new HitbtcWithdrawRequestDto(destination, amount, currency.toString()); cfg.getRestTemplate() .exchange( cfg.getRestBase() + WITHDRAWAL, HttpMethod.POST, new HttpEntity<>(requestDto, signer.restHeaders()), Object.class); }
HitbtcRestService implements ManageOrders, Withdraw, Account { @SneakyThrows @Override public void withdraw(TradingCurrency currency, BigDecimal amount, String destination) { HitbtcWithdrawRequestDto requestDto = new HitbtcWithdrawRequestDto(destination, amount, currency.toString()); cfg.getRestTemplate() .exchange( cfg.getRestBase() + WITHDRAWAL, HttpMethod.POST, new HttpEntity<>(requestDto, signer.restHeaders()), Object.class); } }
HitbtcRestService implements ManageOrders, Withdraw, Account { @SneakyThrows @Override public void withdraw(TradingCurrency currency, BigDecimal amount, String destination) { HitbtcWithdrawRequestDto requestDto = new HitbtcWithdrawRequestDto(destination, amount, currency.toString()); cfg.getRestTemplate() .exchange( cfg.getRestBase() + WITHDRAWAL, HttpMethod.POST, new HttpEntity<>(requestDto, signer.restHeaders()), Object.class); }  }
HitbtcRestService implements ManageOrders, Withdraw, Account { @SneakyThrows @Override public void withdraw(TradingCurrency currency, BigDecimal amount, String destination) { HitbtcWithdrawRequestDto requestDto = new HitbtcWithdrawRequestDto(destination, amount, currency.toString()); cfg.getRestTemplate() .exchange( cfg.getRestBase() + WITHDRAWAL, HttpMethod.POST, new HttpEntity<>(requestDto, signer.restHeaders()), Object.class); }  @Override Optional<OrderDto> get(String id); @Override List<OrderDto> getOpen(TradingCurrency from, TradingCurrency to); @Override void cancel(String id); @Override Map<TradingCurrency, BigDecimal> balances(); @SneakyThrows @Override void withdraw(TradingCurrency currency, BigDecimal amount, String destination); @Override @IgnoreRateLimited String name(); }
HitbtcRestService implements ManageOrders, Withdraw, Account { @SneakyThrows @Override public void withdraw(TradingCurrency currency, BigDecimal amount, String destination) { HitbtcWithdrawRequestDto requestDto = new HitbtcWithdrawRequestDto(destination, amount, currency.toString()); cfg.getRestTemplate() .exchange( cfg.getRestBase() + WITHDRAWAL, HttpMethod.POST, new HttpEntity<>(requestDto, signer.restHeaders()), Object.class); }  @Override Optional<OrderDto> get(String id); @Override List<OrderDto> getOpen(TradingCurrency from, TradingCurrency to); @Override void cancel(String id); @Override Map<TradingCurrency, BigDecimal> balances(); @SneakyThrows @Override void withdraw(TradingCurrency currency, BigDecimal amount, String destination); @Override @IgnoreRateLimited String name();  }