1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use super::{CommandResponse, RequestMessage, Sender};
#[derive(Debug)]
pub struct BalanceRequest {
pub return_path: Sender<BalanceResponse>,
}
#[derive(Debug)]
pub struct BalanceResponse {
pub balance: String,
pub currency: String,
pub credit_limit: Option<String>,
pub available_credit: Option<String>,
pub credit_threshold: Option<CreditThreshold>,
}
#[derive(Debug, PartialEq)]
pub enum CreditThreshold {
Fixed(String),
Percentage(u8),
}
pub async fn balance_info(
client_sender: &mut futures::channel::mpsc::Sender<RequestMessage>,
) -> Result<CommandResponse<BalanceResponse>, super::Error> {
let (sender, receiver) = futures::channel::oneshot::channel();
super::send_epp_client_request(
client_sender,
RequestMessage::Balance(Box::new(BalanceRequest {
return_path: sender,
})),
receiver,
)
.await
}