mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 20:23:43 +08:00
enhance(core): replace string with enum for country (#735)
This commit is contained in:
15
crates/common_enums/Cargo.toml
Normal file
15
crates/common_enums/Cargo.toml
Normal file
@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "common_enums"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.155", features = [ "derive" ] }
|
||||
strum = { version = "0.24.1", features = [ "derive" ] }
|
||||
utoipa = { version = "3.2.0", features = ["preserve_order"] }
|
||||
diesel = { version = "2.0.3", features = ["postgres"] }
|
||||
|
||||
# First party crates
|
||||
router_derive = { version = "0.1.0", path = "../router_derive" }
|
||||
39
crates/common_enums/src/enums.rs
Normal file
39
crates/common_enums/src/enums.rs
Normal file
@ -0,0 +1,39 @@
|
||||
use router_derive;
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
Eq,
|
||||
Default,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
utoipa::ToSchema,
|
||||
Copy
|
||||
)]
|
||||
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
||||
#[rustfmt::skip]
|
||||
pub enum CountryCode {
|
||||
AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT,
|
||||
AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BQ, BA, BW,
|
||||
BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL,
|
||||
CN, CX, CC, CO, KM, CG, CD, CK, CR, CI, HR, CU, CW, CY, CZ,
|
||||
DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI,
|
||||
FR, GF, PF, TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU,
|
||||
GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR,
|
||||
IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW,
|
||||
KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, MO, MK, MG, MW, MY,
|
||||
MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS,
|
||||
MA, MZ, MM, NA, NR, NP, NL, NC, NZ, NI, NE, NG, NU, NF, MP,
|
||||
NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA,
|
||||
RE, RO, RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA,
|
||||
SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, ES, LK,
|
||||
SD, SR, SJ, SZ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO,
|
||||
TT, TN, TR, TM, TC, TV, UG, UA, AE, GB, UM, UY, UZ, VU,
|
||||
VE, VN, VG, VI, WF, EH, YE, ZM, ZW,
|
||||
#[default]
|
||||
US
|
||||
}
|
||||
2
crates/common_enums/src/lib.rs
Normal file
2
crates/common_enums/src/lib.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub mod enums;
|
||||
pub use enums::*;
|
||||
Reference in New Issue
Block a user