...
This commit is contained in:
64
specs/models_marketplace/main/currency.v
Normal file
64
specs/models_marketplace/main/currency.v
Normal file
@@ -0,0 +1,64 @@
|
||||
module main
|
||||
|
||||
import freeflowuniverse.herolib.hero.models.marketplace.core
|
||||
|
||||
// Configurable currency support for any currency type
|
||||
pub struct Currency {
|
||||
core.Base
|
||||
pub mut:
|
||||
code string // USD, EUR, BTC, ETH, etc.
|
||||
name string
|
||||
symbol string
|
||||
currency_type CurrencyType
|
||||
exchange_rate_to_base f64 // Using f64 for Decimal
|
||||
is_base_currency bool
|
||||
decimal_places u8
|
||||
is_active bool
|
||||
}
|
||||
|
||||
pub enum CurrencyType {
|
||||
fiat
|
||||
cryptocurrency
|
||||
token
|
||||
points
|
||||
custom
|
||||
}
|
||||
|
||||
pub struct Price {
|
||||
pub mut:
|
||||
base_amount f64 // Using f64 for Decimal
|
||||
base_currency string
|
||||
display_currency string
|
||||
display_amount f64 // Using f64 for Decimal
|
||||
formatted_display string
|
||||
conversion_rate f64 // Using f64 for Decimal
|
||||
conversion_timestamp u64 // Unix timestamp
|
||||
}
|
||||
|
||||
pub struct MarketplaceCurrencyConfig {
|
||||
pub mut:
|
||||
base_currency string
|
||||
supported_currencies []string
|
||||
default_display_currency string
|
||||
auto_update_rates bool
|
||||
update_interval_minutes u32
|
||||
fallback_rates map[string]f64 // Using f64 for Decimal
|
||||
}
|
||||
|
||||
// Exchange rate history for tracking changes over time
|
||||
pub struct ExchangeRateHistory {
|
||||
pub mut:
|
||||
from_currency string
|
||||
to_currency string
|
||||
rate f64 // Using f64 for Decimal
|
||||
timestamp u64 // Unix timestamp
|
||||
provider string
|
||||
}
|
||||
|
||||
// User currency preferences
|
||||
pub struct UserCurrencyPreference {
|
||||
pub mut:
|
||||
user_id string
|
||||
preferred_currency string
|
||||
updated_at u64 // Unix timestamp
|
||||
}
|
Reference in New Issue
Block a user