-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbe2bfc
commit 8fa7626
Showing
1 changed file
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,43 @@ | ||
#[cfg(test)] | ||
mod tests { | ||
#[test] | ||
fn it_works() { | ||
assert_eq!(2 + 2, 4); | ||
} | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub enum Tag { | ||
#[serde(rename = "withdrawalRequest")] | ||
WithdrawalRequest, | ||
} | ||
|
||
/// Withdrawal is a withdrawal resource. | ||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Withdrawal { | ||
/// A default withdrawal invoice description | ||
#[serde(rename = "defaultDescription")] | ||
pub default_description: String, | ||
/// a second-level url which would accept a withdrawal | ||
/// lightning invoice as query parameter | ||
pub callback: String, | ||
/// an ephemeral secret which would allow user to withdraw funds | ||
pub k1: String, | ||
/// max withdrawable amount for a given user on a given service | ||
#[serde(rename = "maxWithdrawable")] | ||
pub max_withdrawable: u64, | ||
/// An optional field, defaults to 1 MilliSatoshi if not present, | ||
/// can not be less than 1 or more than `maxWithdrawable` | ||
#[serde(rename = "minWithdrawable")] | ||
pub min_withdrawable: Option<u64>, | ||
/// tag of the request | ||
pub tag: Tag, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub enum ResponseStatus { | ||
ERROR, | ||
OK, | ||
} | ||
|
||
/// Response is the response format returned by Service. | ||
/// Example: `{\"status\":\"ERROR\",\"reason\":\"error detail...\"}"` | ||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct Response { | ||
pub status: ResponseStatus, | ||
pub reason: Option<String>, | ||
} |