paystack/models/domain_models.rs
1//! Domain
2//! ======
3//! This file constians the domain options for the integration in the paystack API.
4
5use std::fmt;
6
7use serde::{Deserialize, Serialize};
8
9/// An enum of options for the paystack integration domain
10#[derive(Debug, Serialize, Deserialize, Clone, Default)]
11#[serde(rename_all = "lowercase")]
12pub enum Domain {
13 /// Integration in the test environment
14 // Defaulting to test here for less danger
15 #[default]
16 Test,
17 /// Integration in the live environment
18 Live,
19}
20
21impl fmt::Display for Domain {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 let domain = match self {
24 Domain::Test => "test",
25 Domain::Live => "live",
26 };
27 write!(f, "{domain}")
28 }
29}