mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
enhance(core): replace string with enum for country (#735)
This commit is contained in:
@ -25,6 +25,7 @@ time = { version = "0.3.20", features = ["serde", "serde-well-known", "std"] }
|
||||
|
||||
# First party crates
|
||||
common_utils = { version = "0.1.0", path = "../common_utils" }
|
||||
common_enums = {path = "../common_enums"}
|
||||
masking = { version = "0.1.0", path = "../masking" }
|
||||
router_derive = { version = "0.1.0", path = "../router_derive" }
|
||||
router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] }
|
||||
|
||||
@ -4,7 +4,7 @@ use masking::Secret;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use time::{OffsetDateTime, PrimitiveDateTime};
|
||||
|
||||
use crate::schema::address;
|
||||
use crate::{enums, schema::address};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, Insertable, router_derive::DebugAsDisplay)]
|
||||
#[diesel(table_name = address)]
|
||||
@ -12,7 +12,7 @@ use crate::schema::address;
|
||||
pub struct AddressNew {
|
||||
pub address_id: String,
|
||||
pub city: Option<String>,
|
||||
pub country: Option<String>,
|
||||
pub country: Option<enums::CountryCode>,
|
||||
pub line1: Option<Secret<String>>,
|
||||
pub line2: Option<Secret<String>>,
|
||||
pub line3: Option<Secret<String>>,
|
||||
@ -34,7 +34,7 @@ pub struct Address {
|
||||
#[serde(skip_serializing)]
|
||||
pub address_id: String,
|
||||
pub city: Option<String>,
|
||||
pub country: Option<String>,
|
||||
pub country: Option<enums::CountryCode>,
|
||||
pub line1: Option<Secret<String>>,
|
||||
pub line2: Option<Secret<String>>,
|
||||
pub line3: Option<Secret<String>>,
|
||||
@ -58,7 +58,7 @@ pub struct Address {
|
||||
pub enum AddressUpdate {
|
||||
Update {
|
||||
city: Option<String>,
|
||||
country: Option<String>,
|
||||
country: Option<enums::CountryCode>,
|
||||
line1: Option<Secret<String>>,
|
||||
line2: Option<Secret<String>>,
|
||||
line3: Option<Secret<String>>,
|
||||
@ -75,7 +75,7 @@ pub enum AddressUpdate {
|
||||
#[diesel(table_name = address)]
|
||||
pub struct AddressUpdateInternal {
|
||||
city: Option<String>,
|
||||
country: Option<String>,
|
||||
country: Option<enums::CountryCode>,
|
||||
line1: Option<Secret<String>>,
|
||||
line2: Option<Secret<String>>,
|
||||
line3: Option<Secret<String>>,
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
pub mod diesel_exports {
|
||||
pub use super::{
|
||||
DbAttemptStatus as AttemptStatus, DbAuthenticationType as AuthenticationType,
|
||||
DbCaptureMethod as CaptureMethod, DbConnectorType as ConnectorType, DbCurrency as Currency,
|
||||
DbDisputeStage as DisputeStage, DbDisputeStatus as DisputeStatus,
|
||||
DbEventClass as EventClass, DbEventObjectType as EventObjectType, DbEventType as EventType,
|
||||
DbCaptureMethod as CaptureMethod, DbConnectorType as ConnectorType,
|
||||
DbCountryCode as CountryCode, DbCurrency as Currency, DbDisputeStage as DisputeStage,
|
||||
DbDisputeStatus as DisputeStatus, DbEventClass as EventClass,
|
||||
DbEventObjectType as EventObjectType, DbEventType as EventType,
|
||||
DbFutureUsage as FutureUsage, DbIntentStatus as IntentStatus,
|
||||
DbMandateStatus as MandateStatus, DbMandateType as MandateType,
|
||||
DbMerchantStorageScheme as MerchantStorageScheme,
|
||||
@ -14,6 +15,8 @@ pub mod diesel_exports {
|
||||
};
|
||||
}
|
||||
|
||||
pub use common_enums::*;
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
|
||||
@ -8,7 +8,7 @@ diesel::table! {
|
||||
id -> Int4,
|
||||
address_id -> Varchar,
|
||||
city -> Nullable<Varchar>,
|
||||
country -> Nullable<Varchar>,
|
||||
country -> Nullable<CountryCode>,
|
||||
line1 -> Nullable<Varchar>,
|
||||
line2 -> Nullable<Varchar>,
|
||||
line3 -> Nullable<Varchar>,
|
||||
|
||||
Reference in New Issue
Block a user