add: transfer refunds
This commit is contained in:
parent
95cb889080
commit
fdaae8d977
10 changed files with 340 additions and 26 deletions
|
@ -16,6 +16,29 @@ pub enum ProductFulfillmentMethod {
|
|||
ProfileStyle,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct ProductUploads {
|
||||
/// Promotional thumbnails shown on the product page.
|
||||
///
|
||||
/// Maximum of 4 with a maximum upload size of 2 MiB.
|
||||
#[serde(default)]
|
||||
pub thumbnails: Vec<usize>,
|
||||
/// Reward given to users through active configurations after they purchase the product.
|
||||
//
|
||||
// Maximum upload size of 4 MiB.
|
||||
#[serde(default)]
|
||||
pub reward: usize,
|
||||
}
|
||||
|
||||
impl Default for ProductUploads {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
thumbnails: Vec::new(),
|
||||
reward: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct Product {
|
||||
pub id: usize,
|
||||
|
@ -34,9 +57,14 @@ pub struct Product {
|
|||
/// A negative stock means the product has unlimited stock.
|
||||
pub stock: i32,
|
||||
/// If this product is limited to one purchase per person.
|
||||
#[serde(default)]
|
||||
pub single_use: bool,
|
||||
/// Data for this product. Only used by snippets.
|
||||
#[serde(default)]
|
||||
pub data: String,
|
||||
/// Uploads for this product.
|
||||
#[serde(default)]
|
||||
pub uploads: ProductUploads,
|
||||
}
|
||||
|
||||
impl Product {
|
||||
|
@ -54,6 +82,7 @@ impl Product {
|
|||
stock: 0,
|
||||
single_use: true,
|
||||
data: String::new(),
|
||||
uploads: ProductUploads::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +94,7 @@ pub enum CoinTransferMethod {
|
|||
Purchase(usize),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum CoinTransferSource {
|
||||
/// An unknown source, such as a transfer request.
|
||||
General,
|
||||
|
@ -73,6 +102,8 @@ pub enum CoinTransferSource {
|
|||
Sale,
|
||||
/// A purchase of coins through Stripe.
|
||||
Purchase,
|
||||
/// A refund of coins.
|
||||
Refund,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue