Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(common): make diesel optional across common_enums, common_utils, common_types (#14852)
Hrithikesh814ab0228b47
diff --git a/Cargo.lock b/Cargo.lockindex 53aab39307..2ffa8dc819 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3550,7 +3550,6 @@ dependencies = ["common_enums","common_utils","criterion",- "diesel","euclid_macros","hyperswitch_constraint_graph","nom 7.1.3",@@ -8625,7 +8624,6 @@ name = "router_derive"version = "0.1.0"dependencies = ["common_utils",- "diesel","error-stack 0.4.1","indexmap 2.9.0","proc-macro2",diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.jsonindex 0a0d8d6f2f..76e99df6a2 100644--- a/api-reference/v1/openapi_spec_v1.json+++ b/api-reference/v1/openapi_spec_v1.json@@ -25707,7 +25707,7 @@},"FutureUsage": {"type": "string",- "description": "Specifies how the payment method can be used for future payments.\n- `off_session`: The payment method can be used for future payments when the customer is not present.\n- `on_session`: The payment method is intended for use only when the customer is present during checkout.\nIf omitted, defaults to `on_session`.",+ "description": "Specifies how the payment method can be used for future payments.\n- `off_session`: The payment method can be used for future payments when the customer is not present.\n- `on_session`: The payment method is intended for use only when the customer is present during checkout.\n\nIf omitted, defaults to `on_session`.","enum": ["off_session","on_session"diff --git a/api-reference/v2/openapi_spec_v2.json b/api-reference/v2/openapi_spec_v2.jsonindex 98a0e518a3..4b10a56f14 100644--- a/api-reference/v2/openapi_spec_v2.json+++ b/api-reference/v2/openapi_spec_v2.json@@ -16834,7 +16834,7 @@},"FutureUsage": {"type": "string",- "description": "Specifies how the payment method can be used for future payments.\n- `off_session`: The payment method can be used for future payments when the customer is not present.\n- `on_session`: The payment method is intended for use only when the customer is present during checkout.\nIf omitted, defaults to `on_session`.",+ "description": "Specifies how the payment method can be used for future payments.\n- `off_session`: The payment method can be used for future payments when the customer is not present.\n- `on_session`: The payment method is intended for use only when the customer is present during checkout.\n\nIf omitted, defaults to `on_session`.","enum": ["off_session","on_session"diff --git a/crates/common_enums/Cargo.toml b/crates/common_enums/Cargo.tomlindex f20ea31395..4a5403d9e8 100644--- a/crates/common_enums/Cargo.toml+++ b/crates/common_enums/Cargo.toml@@ -8,13 +8,14 @@ readme = "README.md"license.workspace = true[features]+diesel = ["dep:diesel"]dummy_connector = []openapi = []payouts = []v2 = [][dependencies]-diesel = { version = "2.3.12", features = ["postgres", "128-column-tables"] }+diesel = { version = "2.3.12", features = ["postgres"], optional = true }serde = { version = "1.0.219", features = ["derive"] }serde_json = "1.0.140"strum = { version = "0.26", features = ["derive"] }diff --git a/crates/common_enums/src/connector_enums.rs b/crates/common_enums/src/connector_enums.rsindex 329ac9ef86..5662f9a0ac 100644--- a/crates/common_enums/src/connector_enums.rs+++ b/crates/common_enums/src/connector_enums.rs@@ -25,7 +25,7 @@ pub use crate::PaymentMethodType;Hash,SmithyModel,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -583,7 +583,7 @@ impl Connector {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum InvoiceStatus {diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 86578dd2fc..217ad5b085 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -12,6 +12,7 @@ pub use accounts::{MerchantAccountRequestType, MerchantAccountType, MerchantIntegrationType, MerchantProductType,OrganizationType, ResourceRequestorType, ResourceType,};+#[cfg(feature = "diesel")]use diesel::{backend::Backend,deserialize::FromSql,@@ -28,6 +29,7 @@ use utoipa::ToSchema;pub use super::connector_enums::InvoiceStatus;#[doc(hidden)]+#[cfg(feature = "diesel")]pub mod diesel_exports {pub use super::{DbApiVersion as ApiVersion, DbAttemptStatus as AttemptStatus,@@ -139,7 +141,10 @@ impl From<std::io::Error> for ApplicationError {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -309,7 +314,10 @@ impl AttemptStatus {strum::EnumIter,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ApplePayPaymentMethodType {@@ -337,7 +345,10 @@ pub enum ApplePayPaymentMethodType {strum::VariantNames,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -363,7 +374,10 @@ pub enum CardDiscovery {strum::EnumIter,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum RevenueRecoveryAlgorithmType {@@ -450,7 +464,7 @@ pub enum ApiKeyType {)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]pub enum RecommendedAction {DoNotRetry,#[serde(rename = "retry_after_10_days")]@@ -487,7 +501,7 @@ pub enum RecommendedAction {)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]pub enum GsmFeature {Retry,}@@ -505,7 +519,7 @@ pub enum GsmFeature {)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]pub enum StandardisedCode {AccountClosedOrInvalid,AuthenticationFailed,@@ -577,7 +591,10 @@ pub enum StandardisedCode {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -608,7 +625,10 @@ impl AuthenticationType {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]pub enum FraudCheckStatus {Fraud,@@ -650,7 +670,10 @@ pub enum PreFrmFailureMode {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -680,7 +703,7 @@ pub enum CaptureStatus {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -706,7 +729,7 @@ pub enum AuthorizationStatus {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum PaymentResourceUpdateStatus {@@ -735,7 +758,10 @@ impl PaymentResourceUpdateStatus {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum BlocklistDataKind {@@ -844,7 +870,10 @@ impl BlockReason {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -875,7 +904,10 @@ pub enum CaptureMethod {serde::Serialize,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum ConnectorType {@@ -925,7 +957,7 @@ pub enum ConnectorType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum SurchargeStrategy {@@ -986,7 +1018,10 @@ pub enum IncomingWebhookEventType {ToSchema,SmithyModel,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub enum Currency {AED,@@ -1881,7 +1916,7 @@ impl Currency {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum EventRecipient {@@ -1900,7 +1935,10 @@ pub enum EventRecipient {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum EventObjectType {@@ -1926,7 +1964,10 @@ pub enum EventObjectType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum EventClass {@@ -2000,7 +2041,10 @@ impl EventClass {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]// Reminder: Whenever an EventType variant is added or removed, make sure to update the `event_types` method in `EventClass`@@ -2078,7 +2122,10 @@ impl SurchargeEventMapper for EventType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum WebhookDeliveryAttempt {@@ -2124,7 +2171,10 @@ pub enum OutgoingWebhookEndpointStatus {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum MerchantStorageScheme {@@ -2151,7 +2201,10 @@ pub enum MerchantStorageScheme {strum::EnumIter,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -2268,7 +2321,10 @@ impl IntentStatus {strum::EnumIter,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum RecoveryStatus {@@ -2308,6 +2364,7 @@ pub enum RecoveryStatus {/// Specifies how the payment method can be used for future payments./// - `off_session`: The payment method can be used for future payments when the customer is not present./// - `on_session`: The payment method is intended for use only when the customer is present during checkout.+////// If omitted, defaults to `on_session`.#[derive(Clone,@@ -2326,7 +2383,10 @@ pub enum RecoveryStatus {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -2366,7 +2426,10 @@ impl FutureUsage {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum PaymentMethodIssuerCode {@@ -2397,7 +2460,7 @@ pub enum PaymentMethodIssuerCode {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -2481,7 +2544,7 @@ impl PaymentMethodStatus {Default,SmithyModel,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -2562,7 +2625,7 @@ pub enum SamsungPayCardBrand {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -2881,7 +2944,7 @@ impl hyperswitch_masking::SerializableSecret for PaymentMethodType {}strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3006,7 +3069,7 @@ impl PaymentMethod {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum GatewaySystem {@@ -3033,7 +3096,7 @@ pub enum GatewaySystem {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]/// Indicates the execution path through which the payment is processed.@@ -3080,7 +3143,7 @@ impl ExecutionPath {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum UcsAvailability {@@ -3159,7 +3222,7 @@ pub enum EventDestination {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ConnectorIntegrationType {@@ -3184,7 +3247,10 @@ pub enum ConnectorIntegrationType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3212,7 +3278,10 @@ pub enum PaymentType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3240,7 +3309,7 @@ pub enum ScaExemptionType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3268,7 +3337,7 @@ pub enum PaymentChannel {ToSchema,SmithyModel,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3293,7 +3362,10 @@ pub enum CtpServiceProvider {serde::Serialize,serde::Deserialize,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum RefundStatus {@@ -3331,7 +3403,10 @@ impl RefundStatus {serde::Deserialize,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum RelayStatus {@@ -3391,7 +3466,10 @@ impl RelayStatus {serde::Deserialize,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum RelayType {@@ -3416,7 +3494,10 @@ pub enum RelayType {serde::Serialize,serde::Deserialize,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]pub enum FrmTransactionType {#[default]@@ -3441,7 +3522,10 @@ pub enum FrmTransactionType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3469,7 +3553,7 @@ pub enum MandateStatus {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub enum CardNetwork {#[serde(alias = "VISA")]@@ -3550,7 +3634,10 @@ pub enum CardNetwork {strum::EnumString,utoipa::ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]pub enum RegulatedName {#[serde(rename = "GOVERNMENT NON-EXEMPT INTERCHANGE FEE (WITH FRAUD)")]@@ -3576,7 +3663,7 @@ pub enum RegulatedName {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "lowercase")]pub enum PanOrToken {@@ -3598,7 +3685,7 @@ pub enum PanOrToken {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "UPPERCASE")]#[strum(serialize_all = "UPPERCASE")]pub enum FundingSource {@@ -3649,7 +3736,10 @@ pub enum CardSegmentType {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "UPPERCASE")]#[serde(rename_all = "snake_case")]pub enum CardType {@@ -3784,7 +3874,7 @@ impl CardNetwork {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]pub enum CoBadgedCardNetwork {#[serde(alias = "RUPAY")]RuPay,@@ -3833,7 +3923,10 @@ pub enum CoBadgedCardNetwork {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3863,7 +3956,10 @@ pub enum DisputeStage {strum::EnumIter,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -3880,13 +3976,14 @@ pub enum DisputeStatus {DisputeLost,}-#[derive(Debug, Clone, AsExpression, PartialEq, ToSchema, Eq)]+#[derive(Debug, Clone, PartialEq, ToSchema, Eq)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]#[schema(value_type = String,title = "4 digit Merchant category code (MCC)",example = "5411")]-#[diesel(sql_type = Text)]+#[cfg_attr(feature = "diesel", diesel(sql_type = Text))]pub struct MerchantCategoryCode(String);impl MerchantCategoryCode {@@ -3972,6 +4069,7 @@ impl MerchantCategoryCode {}}+#[cfg(feature = "diesel")]impl<DB> ToSql<Text, DB> for MerchantCategoryCodewhereDB: Backend,@@ -3981,6 +4079,7 @@ whereself.0.to_sql(out)}}+#[cfg(feature = "diesel")]impl<DB: Backend> FromSql<Text, DB> for MerchantCategoryCodewhereString: FromSql<Text, DB>,@@ -4079,7 +4178,7 @@ pub struct MerchantCategoryCodeWithName {Copy,SmithyModel,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "db_enum"))]#[rustfmt::skip]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub enum CountryAlpha2 {@@ -4118,7 +4217,10 @@ pub enum CountryAlpha2 {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum RequestIncrementalAuthorization {@@ -4142,7 +4244,7 @@ pub enum RequestIncrementalAuthorization {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum SplitTxnsEnabled {@@ -4165,7 +4267,7 @@ pub enum SplitTxnsEnabled {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum AutoFallbackCaptureMethod {@@ -4216,7 +4318,7 @@ impl From<bool> for AutoFallbackCaptureMethod {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ActiveAttemptIDType {@@ -4526,7 +4628,7 @@ pub enum Country {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum FileUploadProvider {@@ -9118,7 +9220,7 @@ pub enum BrazilStatesAbbreviation {strum::EnumIter,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum PayoutExecutionKind {@@ -9142,7 +9244,10 @@ pub enum PayoutExecutionKind {strum::EnumIter,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum PayoutStatus {@@ -9212,7 +9317,10 @@ impl PayoutStatus {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum PayoutType {@@ -9238,7 +9346,7 @@ pub enum PayoutType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "PascalCase")]#[strum(serialize_all = "PascalCase")]pub enum PayoutEntityType {@@ -9271,7 +9379,7 @@ pub enum PayoutEntityType {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum PayoutSendPriority {@@ -9297,7 +9405,10 @@ pub enum PayoutSendPriority {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum PaymentSource {@@ -9350,7 +9461,7 @@ impl PaymentSource {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]pub enum MerchantDecision {Approved,@@ -9371,7 +9482,7 @@ pub enum MerchantDecision {strum::EnumIter,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -9416,7 +9527,10 @@ pub enum FrmSuggestion {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ReconStatus {@@ -9522,7 +9636,7 @@ pub enum VaultSdk {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum Tokenization {@@ -9547,7 +9661,7 @@ pub enum Tokenization {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -9591,7 +9705,7 @@ impl AuthenticationStatus {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -9615,7 +9729,7 @@ pub enum DecoupledAuthenticationType {utoipa::ToSchema,Copy,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum AuthenticationLifecycleStatus {@@ -9638,7 +9752,10 @@ pub enum AuthenticationLifecycleStatus {ToSchema,Default,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum ConnectorStatus {@@ -9660,7 +9777,10 @@ pub enum ConnectorStatus {ToSchema,Default,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum TransactionType {@@ -9688,7 +9808,10 @@ impl TransactionType {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum RoleScope {@@ -9721,7 +9844,7 @@ impl From<RoleScope> for EntityType {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]pub enum TransactionStatus {/// Authentication/ Account Verification Successful#[serde(rename = "Y")]@@ -9792,7 +9915,7 @@ impl From<TransactionStatus> for DecoupledAuthenticationType {strum::EnumString,strum::EnumIter,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum PermissionGroup {@@ -10799,7 +10922,10 @@ pub enum BankHolderType {strum::VariantNames,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum GenericLinkType {@@ -10839,7 +10965,7 @@ pub enum TokenPurpose {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum UserAuthType {@@ -10860,7 +10986,7 @@ pub enum UserAuthType {strum::Display,strum::EnumString,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum Owner {@@ -10881,7 +11007,10 @@ pub enum Owner {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum ApiVersion {@@ -10905,7 +11034,7 @@ pub enum ApiVersion {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum EntityType {@@ -10936,7 +11065,10 @@ pub enum PayoutRetryType {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum OrderFulfillmentTimeOrigin {@@ -10957,7 +11089,10 @@ pub enum OrderFulfillmentTimeOrigin {ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum UIWidgetFormLayout {@@ -10978,7 +11113,10 @@ pub enum UIWidgetFormLayout {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum DeleteStatus {@@ -11001,7 +11139,10 @@ pub enum DeleteStatus {)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]pub enum SuccessBasedRoutingConclusiveState {// pc: payment connector// sc: success based routing outcome/first connector@@ -11303,7 +11444,7 @@ impl From<ConnectorTokenStatus> for ConnectorMandateStatus {PartialOrd,Ord,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ErrorCategory {@@ -11344,7 +11485,7 @@ impl ErrorCategory {PartialOrd,Ord,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[allow(non_camel_case_types)]pub enum UnifiedCode {/// Customer Error - Issue with payment method details@@ -11556,7 +11697,7 @@ pub enum GooglePayAuthMethod {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -11633,7 +11774,10 @@ pub enum PaymentConnectorTransmission {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum TriggeredBy {@@ -11658,7 +11802,7 @@ pub enum TriggeredBy {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -11686,7 +11830,10 @@ pub enum MitCategory {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ProcessTrackerStatus {@@ -11753,7 +11900,7 @@ pub enum ProcessTrackerRunner {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ApplicationSource {@@ -11780,7 +11927,10 @@ pub enum CryptoPadding {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum TokenizationFlag {@@ -11818,7 +11968,10 @@ pub enum TokenDataType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum RoutingApproach {@@ -11862,7 +12015,7 @@ impl RoutingApproach {)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]pub enum CallbackMapperIdType {NetworkTokenRequestorReferenceID,}@@ -11881,7 +12034,7 @@ pub enum CallbackMapperIdType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum VaultType {@@ -11905,7 +12058,7 @@ pub enum VaultType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum ExternalVaultEnabled {@@ -12059,7 +12212,10 @@ pub enum ExemptionIndicator {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum VaultTokenType {@@ -12100,7 +12256,7 @@ pub enum VaultTokenType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum StorageType {@@ -12122,7 +12278,7 @@ pub enum StorageType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum AcknowledgementStatus {@@ -12153,7 +12309,7 @@ impl From<AcknowledgementStatus> for PaymentMethodStatus {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum RetryType {@@ -12240,10 +12396,9 @@ pub enum ExpiryType {Scheduled,}-#[derive(- Debug, Clone, PartialEq, Eq, Deserialize, Serialize, diesel::FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = diesel::sql_types::Json)]+#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(diesel::FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Json))]#[serde(tag = "type", content = "value", rename_all = "snake_case")]pub enum PixKey {#[schema(value_type = String)]@@ -12304,7 +12459,10 @@ pub enum ConnectorWebhookEventType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[strum(serialize_all = "snake_case")]pub enum WebhookRegistrationStatus {// Webhook registration is successful@@ -12355,7 +12513,7 @@ pub enum WebhookSecretGenerationStatus {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -12406,7 +12564,7 @@ pub enum VaultEnv {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum BlocklistTransactionType {@@ -12427,7 +12585,7 @@ pub enum BlocklistTransactionType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum BatchBlocklistJobStatus {@@ -12450,7 +12608,7 @@ pub enum BatchBlocklistJobStatus {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum BatchBlocklistJobType {diff --git a/crates/common_enums/src/enums/accounts.rs b/crates/common_enums/src/enums/accounts.rsindex 105022434b..085811e6fb 100644--- a/crates/common_enums/src/enums/accounts.rs+++ b/crates/common_enums/src/enums/accounts.rs@@ -13,7 +13,7 @@ use utoipa::ToSchema;ToSchema,Hash,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]pub enum MerchantProductType {@@ -39,7 +39,7 @@ pub enum MerchantProductType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum MerchantAccountType {@@ -88,7 +88,7 @@ pub enum MerchantIntegrationType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum OrganizationType {@@ -110,7 +110,7 @@ pub enum OrganizationType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "text")]+#[cfg_attr(feature = "diesel", router_derive::diesel_enum(storage_type = "text"))]#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum MerchantAccountRequestType {diff --git a/crates/common_enums/src/enums/ui.rs b/crates/common_enums/src/enums/ui.rsindex 4811cffa4c..d3ae6f0f6f 100644--- a/crates/common_enums/src/enums/ui.rs+++ b/crates/common_enums/src/enums/ui.rs@@ -17,7 +17,10 @@ use utoipa::ToSchema;strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "lowercase")]pub enum ElementPosition {Left,@@ -37,7 +40,10 @@ pub enum ElementPosition {}#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, strum::Display, strum::EnumString, ToSchema)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]pub enum ElementSize {Variants(SizeVariants),Percentage(u32),@@ -58,7 +64,10 @@ pub enum ElementSize {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "lowercase")]#[strum(serialize_all = "lowercase")]pub enum SizeVariants {@@ -81,7 +90,10 @@ pub enum SizeVariants {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "lowercase")]#[strum(serialize_all = "lowercase")]pub enum PaymentLinkDetailsLayout {@@ -104,7 +116,10 @@ pub enum PaymentLinkDetailsLayout {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "lowercase")]#[strum(serialize_all = "lowercase")]pub enum PaymentLinkSdkLabelType {@@ -128,7 +143,10 @@ pub enum PaymentLinkSdkLabelType {strum::EnumString,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]+#[cfg_attr(+ feature = "diesel",+ router_derive::diesel_enum(storage_type = "db_enum")+)]#[serde(rename_all = "lowercase")]#[strum(serialize_all = "lowercase")]pub enum PaymentLinkShowSdkTerms {diff --git a/crates/common_types/Cargo.toml b/crates/common_types/Cargo.tomlindex ba2bc7107d..0a0d970e2b 100644--- a/crates/common_types/Cargo.toml+++ b/crates/common_types/Cargo.toml@@ -8,12 +8,13 @@ license.workspace = true[features]default = []+diesel = ["dep:diesel", "common_utils/diesel", "common_enums/diesel"]v1 = ["common_utils/v1"]v2 = ["common_utils/v2"]tokenization_v2 = ["common_utils/tokenization_v2"][dependencies]-diesel = "2.3.12"+diesel = { version = "2.3.12", optional = true }serde = { version = "1.0.219", features = ["derive"] }serde_json = "1.0.140"utoipa = { version = "4.2.3", features = ["preserve_order", "preserve_path_order"] }diff --git a/crates/common_types/src/callback_mapper.rs b/crates/common_types/src/callback_mapper.rsindex 142aeb4d59..9180b528fd 100644--- a/crates/common_types/src/callback_mapper.rs+++ b/crates/common_types/src/callback_mapper.rs@@ -1,10 +1,10 @@use common_utils::id_type;+#[cfg(feature = "diesel")]use diesel::{AsExpression, FromSqlRow};-#[derive(- Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, AsExpression, FromSqlRow,-)]-#[diesel(sql_type = diesel::sql_types::Jsonb)]+#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Jsonb))]/// Represents the data associated with a callback mapper.pub enum CallbackMapperData {/// data variant used while processing the network token webhook@@ -37,4 +37,5 @@ impl CallbackMapperData {}}+#[cfg(feature = "diesel")]common_utils::impl_to_sql_from_sql_json!(CallbackMapperData);diff --git a/crates/common_types/src/customers.rs b/crates/common_types/src/customers.rsindex caee09205b..c7746dca7f 100644--- a/crates/common_types/src/customers.rs+++ b/crates/common_types/src/customers.rs@@ -5,8 +5,9 @@ use cpf_cnpj::{cnpj, cpf};use utoipa::ToSchema;/// HashMap containing MerchantConnectorAccountId and corresponding customer id#[cfg(feature = "v2")]-#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize, diesel::AsExpression)]-#[diesel(sql_type = diesel::sql_types::Jsonb)]+#[derive(Clone, Debug, Default, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(diesel::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Jsonb))]#[serde(transparent)]pub struct ConnectorCustomerMap(std::collections::HashMap<common_utils::id_type::MerchantConnectorAccountId, String>,@@ -23,6 +24,7 @@ impl ConnectorCustomerMap {}#[cfg(feature = "v2")]+#[cfg(feature = "diesel")]common_utils::impl_to_sql_from_sql_json!(ConnectorCustomerMap);#[cfg(feature = "v2")]diff --git a/crates/common_types/src/disputes.rs b/crates/common_types/src/disputes.rsindex 93eb463ef2..fa65a06bfe 100644--- a/crates/common_types/src/disputes.rs+++ b/crates/common_types/src/disputes.rs@@ -1,6 +1,8 @@//! Dispute related types+#[cfg(feature = "diesel")]use common_utils::impl_to_sql_from_sql_json;+#[cfg(feature = "diesel")]use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};use serde::{Deserialize, Serialize};use smithy::SmithyModel;@@ -9,25 +11,16 @@ use utoipa::ToSchema;use crate::primitive_wrappers::RapidDisputeResolutionAppliedBool;/// Additional details of a dispute, stored as jsonb-#[derive(- Debug,- Clone,- PartialEq,- Eq,- Serialize,- Deserialize,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct AdditionalDetails {/// Network specific details of the dispute#[smithy(value_type = "Option<DisputeNetworkDetails>")]pub network_details: Option<DisputeNetworkDetails>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(AdditionalDetails);/// Card network specific details of a disputediff --git a/crates/common_types/src/domain.rs b/crates/common_types/src/domain.rsindex 4960950478..7eb8f18bb3 100644--- a/crates/common_types/src/domain.rs+++ b/crates/common_types/src/domain.rs@@ -3,7 +3,10 @@use std::collections::HashMap;use common_enums::enums;-use common_utils::{impl_to_sql_from_sql_json, types::MinorUnit};+#[cfg(feature = "diesel")]+use common_utils::impl_to_sql_from_sql_json;+use common_utils::types::MinorUnit;+#[cfg(feature = "diesel")]use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};#[cfg(feature = "v2")]use hyperswitch_masking::Secret;@@ -11,19 +14,9 @@ use serde::{Deserialize, Serialize};use smithy::SmithyModel;use utoipa::ToSchema;-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]/// Fee information for Split Payments to be charged on the payment being collected for Adyen@@ -35,21 +28,12 @@ pub struct AdyenSplitData {#[smithy(value_type = "Vec<AdyenSplitItem>")]pub split_items: Vec<AdyenSplitItem>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(AdyenSplitData);-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]/// Data for the split items@@ -72,22 +56,13 @@ pub struct AdyenSplitItem {#[smithy(value_type = "Option<String>")]pub description: Option<String>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(AdyenSplitItem);/// Fee information to be charged on the payment being collected for sub-merchant via xendit-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct XenditSplitSubMerchantData {@@ -95,6 +70,7 @@ pub struct XenditSplitSubMerchantData {#[smithy(value_type = "String")]pub for_user_id: String,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(XenditSplitSubMerchantData);/// Acquirer configuration@@ -123,8 +99,9 @@ pub struct AcquirerConfig {pub acquirer_country_code: Option<String>,}-#[derive(Serialize, Deserialize, Debug, Clone, FromSqlRow, AsExpression, ToSchema)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// Acquirer config buckets: each ProfileAcquirerId maps to an array of per-network configspub struct AcquirerConfigBucket {/// The default acquirer config id@@ -146,6 +123,7 @@ pub struct AcquirerConfigBucket {pub configs: HashMap<common_utils::id_type::ProfileAcquirerId, Vec<AcquirerConfig>>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(AcquirerConfigBucket);/// Merchant connector details@@ -174,8 +152,9 @@ pub struct ConnectorResponseData {pub raw_connector_response: Option<Secret<String>>,}-#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, AsExpression, ToSchema)]-#[diesel(sql_type = Jsonb)]+#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(rename_all = "snake_case")]/// Contains the data relevant to the specified GSM feature, if applicable./// For example, if the `feature` is `Retry`, this will include configuration@@ -186,8 +165,9 @@ pub enum GsmFeatureData {}/// Represents the data associated with a retry feature in GSM.-#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, AsExpression, ToSchema)]-#[diesel(sql_type = Jsonb)]+#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct RetryFeatureData {/// indicates if step_up retry is possiblepub step_up_possible: bool,@@ -200,7 +180,9 @@ pub struct RetryFeatureData {pub decision: common_enums::GsmDecision,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(GsmFeatureData);+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(RetryFeatureData);impl GsmFeatureData {diff --git a/crates/common_types/src/payment_methods.rs b/crates/common_types/src/payment_methods.rsindex cf922adfed..0e23b48b05 100644--- a/crates/common_types/src/payment_methods.rs+++ b/crates/common_types/src/payment_methods.rs@@ -1,5 +1,6 @@//! Common types to be used in payment methods+#[cfg(feature = "diesel")]use diesel::{backend::Backend,deserialize,@@ -17,9 +18,10 @@ use utoipa::ToSchema;// This is a performance optimization to avoid json validation at database level.// jsonb enables faster querying on json columns, but it doesn't justify here since we are not querying on this column.// https://docs.rs/diesel/latest/diesel/sql_types/struct.Jsonb.html-#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, AsExpression)]+#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]#[serde(deny_unknown_fields)]-#[diesel(sql_type = Json)]+#[cfg_attr(feature = "diesel", diesel(sql_type = Json))]pub struct PaymentMethodsEnabled {/// Type of payment method.#[schema(value_type = PaymentMethod,example = "card")]@@ -30,6 +32,7 @@ pub struct PaymentMethodsEnabled {}// Custom FromSql implementation to handle deserialization of v1 data format+#[cfg(feature = "diesel")]impl FromSql<Json, diesel::pg::Pg> for PaymentMethodsEnabled {fn from_sql(bytes: <diesel::pg::Pg as Backend>::RawValue<'_>) -> deserialize::Result<Self> {let helper: PaymentMethodsEnabledHelper = serde_json::from_slice(bytes.as_bytes())@@ -39,6 +42,7 @@ impl FromSql<Json, diesel::pg::Pg> for PaymentMethodsEnabled {}// In this ToSql implementation, we are directly serializing the PaymentMethodsEnabled struct to JSON+#[cfg(feature = "diesel")]impl ToSql<Json, diesel::pg::Pg> for PaymentMethodsEnabled {fn to_sql<'b>(&'b self,@@ -234,6 +238,7 @@ pub enum AcceptedCurrencies {AllAccepted,}+#[cfg(feature = "diesel")]impl<DB> Queryable<Jsonb, DB> for PaymentMethodsEnabledwhereDB: Backend,diff --git a/crates/common_types/src/payments.rs b/crates/common_types/src/payments.rsindex 31af3846e6..ea0db6b70e 100644--- a/crates/common_types/src/payments.rs+++ b/crates/common_types/src/payments.rs@@ -5,10 +5,12 @@ use std::{};use common_enums::enums;+#[cfg(feature = "diesel")]+use common_utils::impl_to_sql_from_sql_json;use common_utils::{- consts, date_time, errors, events, ext_traits::OptionExt, impl_to_sql_from_sql_json, pii,- types::MinorUnit,+ consts, date_time, errors, events, ext_traits::OptionExt, pii, types::MinorUnit,};+#[cfg(feature = "diesel")]use diesel::{sql_types::{Jsonb, Text},AsExpression, FromSqlRow,@@ -32,19 +34,9 @@ use crate::{consts::PERCENTAGE_BASE,domain::{AdyenSplitData, PostCaptureVoidData, XenditSplitSubMerchantData},};-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(rename_all = "snake_case")]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -63,21 +55,12 @@ pub enum SplitPaymentsRequest {#[smithy(value_type = "PayloadSplitPaymentRequest")]PayloadSplitPayment(PayloadSplitPaymentRequest),}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(SplitPaymentsRequest);-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[smithy(namespace = "com.hyperswitch.smithy.types")]/// Fee information for Split Payments to be charged on the payment being collected for Stripepub struct StripeSplitPaymentRequest {@@ -100,21 +83,12 @@ pub struct StripeSplitPaymentRequest {#[smithy(value_type = "Option<String>")]pub on_behalf_of: Option<String>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(StripeSplitPaymentRequest);-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[smithy(namespace = "com.hyperswitch.smithy.types")]/// A single ledger entry distributing payment to one receiver for Payload split paymentspub struct PayloadLedgerItem {@@ -126,21 +100,12 @@ pub struct PayloadLedgerItem {#[smithy(value_type = "String")]pub receiver_id: String,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(PayloadLedgerItem);-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[smithy(namespace = "com.hyperswitch.smithy.types")]/// Split payment configuration for Payload — distributes a payment across multiple receivers via ledger entriespub struct PayloadSplitPaymentRequest {@@ -148,17 +113,18 @@ pub struct PayloadSplitPaymentRequest {#[smithy(value_type = "Vec<PayloadLedgerItem>")]pub ledger: Vec<PayloadLedgerItem>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(PayloadSplitPaymentRequest);-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]/// Hashmap to store mca_id's with product namespub struct AuthenticationConnectorAccountMap(HashMap<enums::AuthenticationProduct, common_utils::id_type::MerchantConnectorAccountId>,);+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(AuthenticationConnectorAccountMap);impl AuthenticationConnectorAccountMap {@@ -180,10 +146,9 @@ impl AuthenticationConnectorAccountMap {////// This type stores a country code as a string and provides methods to validate it/// and convert it to a `Country` enum variant.-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Text)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Text))]#[serde(deny_unknown_fields)]pub struct MerchantCountryCode(String);@@ -223,6 +188,7 @@ impl MerchantCountryCode {}}+#[cfg(feature = "diesel")]impl diesel::serialize::ToSql<Text, diesel::pg::Pg> for MerchantCountryCode {fn to_sql<'b>(&'b self,@@ -232,6 +198,7 @@ impl diesel::serialize::ToSql<Text, diesel::pg::Pg> for MerchantCountryCode {}}+#[cfg(feature = "diesel")]impl diesel::deserialize::FromSql<Text, diesel::pg::Pg> for MerchantCountryCode {fn from_sql(bytes: diesel::pg::PgValue<'_>) -> diesel::deserialize::Result<Self> {let s = <String as diesel::deserialize::FromSql<Text, diesel::pg::Pg>>::from_sql(bytes)?;@@ -239,10 +206,9 @@ impl diesel::deserialize::FromSql<Text, diesel::pg::Pg> for MerchantCountryCode}}-#[derive(- Serialize, Default, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Default, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// ConditionalConfigspub struct ConditionalConfigs {/// Override 3DS@@ -263,6 +229,7 @@ impl EuclidDirFilter for ConditionalConfigs {];}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(ConditionalConfigs);/// This "CustomerAcceptance" object is passed during Payments-Confirm request, it enlists the type, time, and mode of acceptance properties related to an acceptance done by the customer. The customer_acceptance sub object is usually passed by the SDK or client.@@ -274,12 +241,12 @@ impl_to_sql_from_sql_json!(ConditionalConfigs);serde::Deserialize,serde::Serialize,Clone,- AsExpression,ToSchema,SmithyModel,)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]#[serde(deny_unknown_fields)]-#[diesel(sql_type = Jsonb)]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct CustomerAcceptance {/// Type of acceptance provided by the@@ -296,6 +263,7 @@ pub struct CustomerAcceptance {pub online: Option<OnlineMandate>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(CustomerAcceptance);impl CustomerAcceptance {@@ -349,14 +317,14 @@ pub enum AcceptanceType {Debug,serde::Deserialize,serde::Serialize,- AsExpression,Clone,ToSchema,SmithyModel,)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]#[serde(deny_unknown_fields)]/// Details of online mandate-#[diesel(sql_type = Jsonb)]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct OnlineMandate {/// Ip address of the customer machine from which the mandate was created@@ -368,10 +336,12 @@ pub struct OnlineMandate {pub user_agent: String,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(OnlineMandate);-#[derive(Serialize, Deserialize, Debug, Clone, FromSqlRow, AsExpression, ToSchema)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// DecisionManagerRecordpub struct DecisionManagerRecord {/// Name of the Decision Manager@@ -387,25 +357,16 @@ impl events::ApiEventMetric for DecisionManagerRecord {Some(events::ApiEventsType::Routing)}}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(DecisionManagerRecord);/// DecisionManagerResponsepub type DecisionManagerResponse = DecisionManagerRecord;/// Fee information to be charged on the payment being collected via Stripe-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct StripeChargeResponseData {/// Identifier for charge created for the payment@@ -431,22 +392,13 @@ pub struct StripeChargeResponseData {#[smithy(value_type = "Option<String>")]pub on_behalf_of: Option<String>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(StripeChargeResponseData);/// Charge Information-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(rename_all = "snake_case")]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -465,22 +417,13 @@ pub enum ConnectorChargeResponseData {PayloadSplitPayment(PayloadSplitPaymentRequest),}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(ConnectorChargeResponseData);/// Fee information to be charged on the payment being collected via xendit-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct XenditSplitRoute {@@ -501,22 +444,13 @@ pub struct XenditSplitRoute {#[smithy(value_type = "String")]pub reference_id: String,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(XenditSplitRoute);/// Fee information to be charged on the payment being collected via xendit-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct XenditMultipleSplitRequest {@@ -533,22 +467,13 @@ pub struct XenditMultipleSplitRequest {#[smithy(value_type = "Vec<XenditSplitRoute>")]pub routes: Vec<XenditSplitRoute>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(XenditMultipleSplitRequest);/// Xendit Charge Request-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(rename_all = "snake_case")]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -561,22 +486,13 @@ pub enum XenditSplitRequest {SingleSplit(XenditSplitSubMerchantData),}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(XenditSplitRequest);/// Charge Information-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(rename_all = "snake_case")]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -589,22 +505,13 @@ pub enum XenditChargeResponseData {SingleSplit(XenditSplitSubMerchantData),}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(XenditChargeResponseData);/// Fee information charged on the payment being collected via xendit-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]pub struct XenditMultipleSplitResponse {@@ -624,6 +531,7 @@ pub struct XenditMultipleSplitResponse {#[smithy(value_type = "Vec<XenditSplitRoute>")]pub routes: Vec<XenditSplitRoute>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(XenditMultipleSplitResponse);#[derive(@@ -1093,10 +1001,9 @@ impl From<RecoveryTransactionStatus> for common_enums::AttemptStatus {}/// Billing Descriptor information to be sent to the payment gateway-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct BillingDescriptor {/// name to be put in billing description#[schema(value_type = Option<String>, example = "The Online Retailer")]@@ -1115,13 +1022,13 @@ pub struct BillingDescriptor {pub reference: Option<String>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(BillingDescriptor);/// Information identifying partner / external platform details-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct PartnerApplicationDetails {/// Name of the partner/external platform#[schema(value_type = Option<String>)]@@ -1133,13 +1040,13 @@ pub struct PartnerApplicationDetails {#[schema(value_type = Option<String>)]pub integrator: Option<String>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(PartnerApplicationDetails);/// Information identifying merchant details-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct MerchantApplicationDetails {/// Name of the the merchant application#[schema(value_type = Option<String>)]@@ -1148,13 +1055,13 @@ pub struct MerchantApplicationDetails {#[schema(value_type = Option<String>)]pub version: Option<String>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(MerchantApplicationDetails);/// Information identifying partner and merchant application initiating the request-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct PartnerMerchantIdentifierDetails {/// Information identifying partner/external platform details#[schema(value_type = Option<PartnerApplicationDetails>)]@@ -1164,22 +1071,13 @@ pub struct PartnerMerchantIdentifierDetails {pub merchant_details: Option<MerchantApplicationDetails>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(PartnerMerchantIdentifierDetails);/// Additional metadata for payment intent state containing refunded and disputed amounts-#[derive(- Default,- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- AsExpression,- FromSqlRow,- utoipa::ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq, utoipa::ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct PaymentIntentStateMetadata {/// Shows up the total refunded amount for a paymentpub total_refunded_amount: Option<MinorUnit>,@@ -1190,10 +1088,9 @@ pub struct PaymentIntentStateMetadata {}/// Additional metadata for payment intent state containing refunded and disputed amounts-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, utoipa::ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, utoipa::ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct PostCaptureVoidResponse {/// Status of post capture void#[schema(value_type = PostCaptureVoidStatus)]@@ -1278,6 +1175,7 @@ impl PaymentIntentStateMetadata {}}+#[cfg(feature = "diesel")]common_utils::impl_to_sql_from_sql_json!(PaymentIntentStateMetadata);/// List of custom T&C messages grouped by payment method@@ -1706,33 +1604,17 @@ pub struct InstallmentOption {}/// A list of installment options stored as a single JSONB column value.-#[derive(- Debug,- Clone,- serde::Serialize,- serde::Deserialize,- ToSchema,- PartialEq,- FromSqlRow,- AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct InstallmentOptions(pub Vec<InstallmentOption>);+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(InstallmentOptions);/// Installment selection made by the customer during payment confirmation.-#[derive(- Debug,- Clone,- serde::Serialize,- serde::Deserialize,- ToSchema,- PartialEq,- Eq,- FromSqlRow,- AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema, PartialEq, Eq)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct InstallmentData {/// Number of installments chosen by the customer#[schema(value_type = u8)]@@ -1742,6 +1624,7 @@ pub struct InstallmentData {/// Total interest amount applied for this installment planpub installment_interest: Option<MinorUnit>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(InstallmentData);#[derive(@@ -1758,17 +1641,9 @@ pub enum TokenSource {}/// External surcharge details from InterPayments (stored as JSONB)-#[derive(- Clone,- Debug,- serde::Deserialize,- Eq,- ToSchema,- PartialEq,- serde::Serialize,- diesel::AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Clone, Debug, serde::Deserialize, Eq, ToSchema, PartialEq, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(diesel::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct ExternalSurchargeDetails {/// sTxId from InterPayments (the last one received before confirm)pub external_surcharge_id: String,@@ -1795,21 +1670,14 @@ impl ExternalSurchargeDetails {}}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(ExternalSurchargeDetails);/// Applied-offer details from Offer Engine `/apply`, persisted on `payment_attempt`/// as JSONB. Versioned (tagged by `version`) for forward-compatible schema evolution.-#[derive(- Clone,- Debug,- serde::Deserialize,- Eq,- ToSchema,- PartialEq,- serde::Serialize,- diesel::AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Clone, Debug, serde::Deserialize, Eq, ToSchema, PartialEq, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(diesel::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(tag = "version", rename_all = "snake_case")]pub enum AppliedOfferDetails {/// Version 1 of the applied-offer details.@@ -1850,16 +1718,17 @@ pub struct AppliedOfferDetailsV1 {pub currency: enums::Currency,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(AppliedOfferDetails);/// Values the router applied to a payment attempt in place of what was requested (stored as JSONB)-#[derive(- Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, diesel::AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(diesel::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct AppliedOverrides {/// Capture method actually sent to the connector for this attemptpub capture_method_applied: Option<enums::CaptureMethod>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(AppliedOverrides);diff --git a/crates/common_types/src/payouts.rs b/crates/common_types/src/payouts.rsindex 52527a1e08..47ecc6f77e 100644--- a/crates/common_types/src/payouts.rs+++ b/crates/common_types/src/payouts.rs@@ -1,15 +1,16 @@//! Payout related types.+#[cfg(feature = "diesel")]use common_utils::impl_to_sql_from_sql_json;+#[cfg(feature = "diesel")]use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};use serde::{Deserialize, Serialize};use utoipa::ToSchema;/// Billing descriptor information for a payout.-#[derive(- Serialize, Deserialize, Debug, Clone, PartialEq, Eq, AsExpression, FromSqlRow, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct PayoutsBillingDescriptor {/// Reference displayed on the beneficiary's bank statement.pub reference: Option<String>,@@ -17,4 +18,5 @@ pub struct PayoutsBillingDescriptor {pub statement_descriptor: Option<String>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(PayoutsBillingDescriptor);diff --git a/crates/common_types/src/primitive_wrappers.rs b/crates/common_types/src/primitive_wrappers.rsindex 4e8a794bee..40f00bfedb 100644--- a/crates/common_types/src/primitive_wrappers.rs+++ b/crates/common_types/src/primitive_wrappers.rs@@ -7,10 +7,9 @@ mod bool_wrappers {use serde::{Deserialize, Serialize};/// Bool that represents if Extended Authorization is Applied or not- #[derive(- Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, diesel::expression::AsExpression,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct ExtendedAuthorizationAppliedBool(bool);impl Deref for ExtendedAuthorizationAppliedBool {type Target = bool;@@ -24,6 +23,7 @@ mod bool_wrappers {Self(value)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for ExtendedAuthorizationAppliedBoolwhereDB: diesel::backend::Backend,@@ -36,6 +36,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for ExtendedAuthorizationAppliedBoolwhere@@ -48,10 +49,9 @@ mod bool_wrappers {}/// Bool that represents if Extended Authorization is Requested or not- #[derive(- Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, diesel::expression::AsExpression,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct RequestExtendedAuthorizationBool(bool);impl Deref for RequestExtendedAuthorizationBool {type Target = bool;@@ -71,6 +71,7 @@ mod bool_wrappers {self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for RequestExtendedAuthorizationBoolwhereDB: diesel::backend::Backend,@@ -83,6 +84,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for RequestExtendedAuthorizationBoolwhere@@ -95,10 +97,9 @@ mod bool_wrappers {}/// Bool that represents if Enable Partial Authorization is Requested or not- #[derive(- Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, diesel::expression::AsExpression,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct EnablePartialAuthorizationBool(bool);impl Deref for EnablePartialAuthorizationBool {type Target = bool;@@ -118,6 +119,7 @@ mod bool_wrappers {self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for EnablePartialAuthorizationBoolwhereDB: diesel::backend::Backend,@@ -130,6 +132,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for EnablePartialAuthorizationBoolwhere@@ -142,10 +145,9 @@ mod bool_wrappers {}/// Bool that represents if Extended Authorization is always Requested or not- #[derive(- Clone, Copy, Debug, Eq, PartialEq, diesel::expression::AsExpression, Serialize, Deserialize,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct AlwaysRequestExtendedAuthorization(bool);impl Deref for AlwaysRequestExtendedAuthorization {type Target = bool;@@ -154,6 +156,7 @@ mod bool_wrappers {&self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB>for AlwaysRequestExtendedAuthorizationwhere@@ -167,6 +170,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for AlwaysRequestExtendedAuthorizationwhere@@ -178,10 +182,9 @@ mod bool_wrappers {}}/// Bool that represents if Cvv should be collected during payment or not. Default is true- #[derive(- Clone, Copy, Debug, Eq, PartialEq, diesel::expression::AsExpression, Serialize, Deserialize,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct ShouldCollectCvvDuringPayment(bool);impl Deref for ShouldCollectCvvDuringPayment {type Target = bool;@@ -190,6 +193,7 @@ mod bool_wrappers {&self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for ShouldCollectCvvDuringPaymentwhereDB: diesel::backend::Backend,@@ -202,6 +206,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB> for ShouldCollectCvvDuringPaymentwhereDB: diesel::backend::Backend,@@ -220,10 +225,9 @@ mod bool_wrappers {}/// Bool that represents if overcapture should always be requested- #[derive(- Clone, Copy, Debug, Eq, PartialEq, diesel::expression::AsExpression, Serialize, Deserialize,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct AlwaysEnableOvercaptureBool(bool);impl AlwaysEnableOvercaptureBool {/// returns the inner bool value@@ -231,6 +235,7 @@ mod bool_wrappers {self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for AlwaysEnableOvercaptureBoolwhereDB: diesel::backend::Backend,@@ -243,6 +248,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB> for AlwaysEnableOvercaptureBoolwhereDB: diesel::backend::Backend,@@ -261,10 +267,9 @@ mod bool_wrappers {}/// Bool that represents if overcapture is requested for this payment- #[derive(- Clone, Copy, Debug, Eq, PartialEq, diesel::expression::AsExpression, Serialize, Deserialize,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct EnableOvercaptureBool(bool);impl From<bool> for EnableOvercaptureBool {@@ -286,6 +291,7 @@ mod bool_wrappers {&self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for EnableOvercaptureBoolwhereDB: diesel::backend::Backend,@@ -298,6 +304,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB> for EnableOvercaptureBoolwhereDB: diesel::backend::Backend,@@ -316,10 +323,9 @@ mod bool_wrappers {}/// Bool that represents if overcapture is applied for a payment by the connector- #[derive(- Clone, Copy, Debug, Eq, PartialEq, diesel::expression::AsExpression, Serialize, Deserialize,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct OvercaptureEnabledBool(bool);impl OvercaptureEnabledBool {@@ -343,6 +349,7 @@ mod bool_wrappers {&self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for OvercaptureEnabledBoolwhereDB: diesel::backend::Backend,@@ -355,6 +362,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB> for OvercaptureEnabledBoolwhereDB: diesel::backend::Backend,@@ -366,10 +374,9 @@ mod bool_wrappers {}/// Bool that represents if Rapid Dispute Resolution is applied for a dispute- #[derive(- Clone, Copy, Debug, Eq, PartialEq, diesel::expression::AsExpression, Serialize, Deserialize,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct RapidDisputeResolutionAppliedBool(bool);impl RapidDisputeResolutionAppliedBool {@@ -379,6 +386,7 @@ mod bool_wrappers {}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for RapidDisputeResolutionAppliedBoolwhereDB: diesel::backend::Backend,@@ -391,6 +399,7 @@ mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for RapidDisputeResolutionAppliedBoolwhere@@ -440,8 +449,9 @@ mod u32_wrappers {DEFAULT_DISPUTE_POLLING_INTERVAL_IN_HOURS, MAX_DISPUTE_POLLING_INTERVAL_IN_HOURS,};/// Time interval in hours for polling disputes- #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, diesel::expression::AsExpression)]- #[diesel(sql_type = diesel::sql_types::Integer)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Integer))]pub struct DisputePollingIntervalInHours(i32);impl Deref for DisputePollingIntervalInHours {@@ -472,6 +482,7 @@ mod u32_wrappers {}}+ #[cfg(feature = "diesel")]impl diesel::deserialize::FromSql<diesel::sql_types::Integer, diesel::pg::Pg>for DisputePollingIntervalInHours{@@ -480,6 +491,7 @@ mod u32_wrappers {}}+ #[cfg(feature = "diesel")]impl diesel::serialize::ToSql<diesel::sql_types::Integer, diesel::pg::Pg>for DisputePollingIntervalInHours{@@ -638,6 +650,7 @@ mod safe_string {impl SerializableSecret for SafeString {}// Diesel implementations for database operations+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Text, DB> for SafeStringwhereDB: diesel::backend::Backend,@@ -651,6 +664,7 @@ mod safe_string {}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Text, DB> for SafeStringwhereDB: diesel::backend::Backend,diff --git a/crates/common_types/src/refunds.rs b/crates/common_types/src/refunds.rsindex 2b98637657..6d9c4edd1f 100644--- a/crates/common_types/src/refunds.rs+++ b/crates/common_types/src/refunds.rs@@ -1,6 +1,8 @@//! Refund related types+#[cfg(feature = "diesel")]use common_utils::impl_to_sql_from_sql_json;+#[cfg(feature = "diesel")]use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};use serde::{Deserialize, Serialize};use smithy::SmithyModel;@@ -8,19 +10,9 @@ use utoipa::ToSchema;use crate::domain::{AdyenSplitData, XenditSplitSubMerchantData};-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(rename_all = "snake_case")]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]@@ -36,21 +28,12 @@ pub enum SplitRefund {#[smithy(value_type = "XenditSplitSubMerchantData")]XenditSplitRefund(XenditSplitSubMerchantData),}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(SplitRefund);-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- SmithyModel,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema, SmithyModel)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]#[smithy(namespace = "com.hyperswitch.smithy.types")]/// Charge specific fields for controlling the revert of funds from either platform or connected account for Stripe. Check sub-fields for more details.@@ -65,4 +48,5 @@ pub struct StripeSplitRefundRequest {#[smithy(value_type = "Option<bool>")]pub revert_transfer: Option<bool>,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(StripeSplitRefundRequest);diff --git a/crates/common_types/src/three_ds_decision_rule_engine.rs b/crates/common_types/src/three_ds_decision_rule_engine.rsindex cd20036295..703ebea6c1 100644--- a/crates/common_types/src/three_ds_decision_rule_engine.rs+++ b/crates/common_types/src/three_ds_decision_rule_engine.rs@@ -1,24 +1,15 @@+#[cfg(feature = "diesel")]use common_utils::impl_to_sql_from_sql_json;+#[cfg(feature = "diesel")]use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};use euclid::frontend::dir::{DirKeyKind, EuclidDirFilter};use serde::{Deserialize, Serialize};use utoipa::ToSchema;/// Enum representing the possible outcomes of the 3DS Decision Rule Engine.-#[derive(- Serialize,- Deserialize,- Debug,- Clone,- Copy,- PartialEq,- Eq,- FromSqlRow,- AsExpression,- ToSchema,- Default,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, ToSchema, Default)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(rename_all = "snake_case")]pub enum ThreeDSDecision {/// No 3DS authentication required@@ -37,6 +28,7 @@ pub enum ThreeDSDecision {/// No challenge requested by merchant (e.g., delegated authentication)IssuerThreeDsExemptionRequested,}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(ThreeDSDecision);impl ThreeDSDecision {@@ -47,10 +39,9 @@ impl ThreeDSDecision {}/// Struct representing the output configuration for the 3DS Decision Rule Engine.-#[derive(- Serialize, Default, Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, Default, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct ThreeDSDecisionRule {/// The decided 3DS action based on the rulespub decision: ThreeDSDecision,@@ -63,6 +54,7 @@ impl ThreeDSDecisionRule {}}+#[cfg(feature = "diesel")]impl_to_sql_from_sql_json!(ThreeDSDecisionRule);impl EuclidDirFilter for ThreeDSDecisionRule {diff --git a/crates/common_utils/Cargo.toml b/crates/common_utils/Cargo.tomlindex 5e65195f1b..cd07268d4a 100644--- a/crates/common_utils/Cargo.toml+++ b/crates/common_utils/Cargo.toml@@ -9,6 +9,7 @@ license.workspace = true[features]default = []+diesel = ["dep:diesel", "hyperswitch_masking/diesel"]keymanager = ["dep:router_env"]keymanager_mtls = ["reqwest/rustls-tls"]encryption_service = ["dep:router_env"]@@ -31,7 +32,7 @@ base64 = "0.22.1"base64-serde = "0.8.0"blake3 = { version = "1.8.2", features = ["serde"] }bytes = { version = "1.10.1", features = ["serde"] }-diesel = "2.3.12"+diesel = { version = "2.3.12", features = ["postgres"], optional = true }deja = { git = "https://github.com/juspay/deja", rev = "6ace82f8d37c7c5703f9636a608dd8d85a8f6953", optional = true, default-features = false }error-stack = "0.4.1"futures = { version = "0.3.31", optional = true }@@ -61,7 +62,7 @@ serde_urlencoded = "0.7.1"signal-hook = { version = "0.3.18", optional = true }strum = { version = "0.26.3", features = ["derive"] }thiserror = "1.0.69"-time = { version = "0.3.41", features = ["serde", "serde-well-known", "std"] }+time = { version = "0.3.41", features = ["serde", "serde-well-known", "std", "macros"] }tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread"], optional = true }url = { version = "2.5.4", features = ["serde"] }urlencoding = "2.1.3"@@ -71,7 +72,7 @@ ammonia = "3.3"# First party cratescommon_enums = { version = "0.1.0", path = "../common_enums" }-hyperswitch_masking = { version = "0.0.1", features = ["diesel", "serde", "time"] }+hyperswitch_masking = { version = "0.0.1", features = ["serde", "time"] }router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"], optional = true, default-features = false }[target.'cfg(target_arch = "wasm32")'.dependencies.uuid]diff --git a/crates/common_utils/src/encryption.rs b/crates/common_utils/src/encryption.rsindex eb6df269c3..da5fc3a5a4 100644--- a/crates/common_utils/src/encryption.rs+++ b/crates/common_utils/src/encryption.rs@@ -1,3 +1,4 @@+#[cfg(feature = "diesel")]use diesel::{backend::Backend,deserialize::{self, FromSql, Queryable},@@ -9,6 +10,7 @@ use hyperswitch_masking::Secret;use crate::{crypto::Encryptable, pii::EncryptionStrategy};+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Binary, DB> for EncryptionwhereDB: Backend,@@ -19,6 +21,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Binary, DB> for EncryptionwhereDB: Backend,@@ -32,6 +35,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Binary, DB> for EncryptionwhereDB: Backend,@@ -43,8 +47,9 @@ where}}-#[derive(Debug, AsExpression, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq)]-#[diesel(sql_type = sql_types::Binary)]+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Binary))]#[repr(transparent)]pub struct Encryption {inner: Secret<Vec<u8>, EncryptionStrategy>,diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rsindex d1373f4554..897405ea85 100644--- a/crates/common_utils/src/id_type.rs+++ b/crates/common_utils/src/id_type.rs@@ -26,6 +26,7 @@ mod webhook_endpoint;use std::{borrow::Cow, fmt::Debug};+#[cfg(feature = "diesel")]use diesel::{backend::Backend,deserialize::FromSql,@@ -130,8 +131,9 @@ impl AlphaNumericId {}/// A common type of id that can be used for reference ids with length constraint-#[derive(Debug, Clone, Serialize, Hash, PartialEq, Eq, AsExpression)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, Serialize, Hash, PartialEq, Eq)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub(crate) struct LengthId<const MAX_LENGTH: u8, const MIN_LENGTH: u8>(AlphaNumericId);/// Error generated from violation of constraints for MerchantReferenceId@@ -221,6 +223,7 @@ impl<'de, const MAX_LENGTH: u8, const MIN_LENGTH: u8> Deserialize<'de>}}+#[cfg(feature = "diesel")]impl<DB, const MAX_LENGTH: u8, const MIN_LENGTH: u8> ToSql<sql_types::Text, DB>for LengthId<MAX_LENGTH, MIN_LENGTH>where@@ -232,6 +235,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB, const MAX_LENGTH: u8, const MIN_LENGTH: u8> FromSql<sql_types::Text, DB>for LengthId<MAX_LENGTH, MIN_LENGTH>wherediff --git a/crates/common_utils/src/id_type/api_key.rs b/crates/common_utils/src/id_type/api_key.rsindex f252846e6a..a5dc010793 100644--- a/crates/common_utils/src/id_type/api_key.rs+++ b/crates/common_utils/src/id_type/api_key.rs@@ -9,7 +9,9 @@ crate::impl_debug_id_type!(ApiKeyId);crate::impl_try_from_cow_str_id_type!(ApiKeyId, "key_id");crate::impl_serializable_secret_id_type!(ApiKeyId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(ApiKeyId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(ApiKeyId);impl ApiKeyId {diff --git a/crates/common_utils/src/id_type/authentication.rs b/crates/common_utils/src/id_type/authentication.rsindex 257331d799..7aa0e4e0ee 100644--- a/crates/common_utils/src/id_type/authentication.rs+++ b/crates/common_utils/src/id_type/authentication.rs@@ -9,7 +9,9 @@ crate::impl_debug_id_type!(AuthenticationId);crate::impl_try_from_cow_str_id_type!(AuthenticationId, "authentication_id");crate::impl_serializable_secret_id_type!(AuthenticationId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(AuthenticationId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(AuthenticationId);impl AuthenticationId {diff --git a/crates/common_utils/src/id_type/card_issuer.rs b/crates/common_utils/src/id_type/card_issuer.rsindex 39fa961928..88d8802c9f 100644--- a/crates/common_utils/src/id_type/card_issuer.rs+++ b/crates/common_utils/src/id_type/card_issuer.rs@@ -18,7 +18,9 @@ crate::impl_debug_id_type!(CardIssuerId);crate::impl_try_from_cow_str_id_type!(CardIssuerId, "card_issuer_id");crate::impl_serializable_secret_id_type!(CardIssuerId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(CardIssuerId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(CardIssuerId,diesel::sql_types::Text,diff --git a/crates/common_utils/src/id_type/client_secret.rs b/crates/common_utils/src/id_type/client_secret.rsindex b9d7f2e09e..5f9de6384e 100644--- a/crates/common_utils/src/id_type/client_secret.rs+++ b/crates/common_utils/src/id_type/client_secret.rs@@ -10,7 +10,9 @@ crate::impl_try_from_cow_str_id_type!(ClientSecretId, "key_id");crate::impl_generate_id_id_type!(ClientSecretId, "csi");crate::impl_serializable_secret_id_type!(ClientSecretId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(ClientSecretId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(ClientSecretId);#[cfg(feature = "v2")]diff --git a/crates/common_utils/src/id_type/customer.rs b/crates/common_utils/src/id_type/customer.rsindex 795050a1bb..bcd7f1bfb5 100644--- a/crates/common_utils/src/id_type/customer.rs+++ b/crates/common_utils/src/id_type/customer.rs@@ -13,7 +13,9 @@ crate::impl_try_from_cow_str_id_type!(CustomerId, "customer_id");crate::impl_generate_id_id_type!(CustomerId, "cus");crate::impl_serializable_secret_id_type!(CustomerId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(CustomerId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(CustomerId);#[cfg(feature = "v1")]diff --git a/crates/common_utils/src/id_type/global_id.rs b/crates/common_utils/src/id_type/global_id.rsindex 744f9aa7bf..cada698c3a 100644--- a/crates/common_utils/src/id_type/global_id.rs+++ b/crates/common_utils/src/id_type/global_id.rs@@ -8,6 +8,7 @@ pub(super) mod refunds;#[cfg(feature = "v2")]pub(super) mod token;+#[cfg(feature = "diesel")]use diesel::{backend::Backend, deserialize::FromSql, serialize::ToSql, sql_types};use error_stack::ResultExt;use thiserror::Error;@@ -171,6 +172,7 @@ impl GlobalId {}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for GlobalIdwhereDB: Backend,@@ -184,6 +186,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for GlobalIdwhereDB: Backend,diff --git a/crates/common_utils/src/id_type/global_id/customer.rs b/crates/common_utils/src/id_type/global_id/customer.rsindex 9c096777cb..445390b274 100644--- a/crates/common_utils/src/id_type/global_id/customer.rs+++ b/crates/common_utils/src/id_type/global_id/customer.rs@@ -5,17 +5,20 @@ use crate::errors;/// The format will be `<cell_id>_<entity_prefix>_<time_ordered_id>`.////// Example: `0a_cus_uu1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p`-#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, diesel::expression::AsExpression)]-#[diesel(sql_type = diesel::sql_types::Text)]+#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Text))]pub struct GlobalCustomerId(super::GlobalId);// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(GlobalCustomerId);// NOTE: We intentionally do NOT use `impl_to_sql_from_sql_global_id_type!` here because that// macro generates a strict `FromSql` that validates GlobalId format. During the V1/V2 coexistence// period, V1-created rows may store a V1-format CustomerId (e.g. `cus_xxx`).// We use `new_unchecked` to accept any string value.+#[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Text, DB> for GlobalCustomerIdwhereDB: diesel::backend::Backend,@@ -29,6 +32,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Text, DB> for GlobalCustomerIdwhereDB: diesel::backend::Backend,diff --git a/crates/common_utils/src/id_type/global_id/payment.rs b/crates/common_utils/src/id_type/global_id/payment.rsindex fc83b5287c..ed88033757 100644--- a/crates/common_utils/src/id_type/global_id/payment.rs+++ b/crates/common_utils/src/id_type/global_id/payment.rs@@ -13,7 +13,9 @@ Example: `0a_pay_uu1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p`");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(GlobalPaymentId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_global_id_type!(GlobalPaymentId);impl GlobalPaymentId {@@ -68,7 +70,9 @@ crate::global_id_type!();// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(GlobalAttemptId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_global_id_type!(GlobalAttemptId);impl GlobalAttemptId {@@ -111,7 +115,9 @@ crate::global_id_type!();// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(GlobalAttemptGroupId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_global_id_type!(GlobalAttemptGroupId);impl GlobalAttemptGroupId {diff --git a/crates/common_utils/src/id_type/global_id/payment_methods.rs b/crates/common_utils/src/id_type/global_id/payment_methods.rsindex 2133b8a1b1..697be22b1e 100644--- a/crates/common_utils/src/id_type/global_id/payment_methods.rs+++ b/crates/common_utils/src/id_type/global_id/payment_methods.rs@@ -6,22 +6,15 @@ use crate::{};/// A global id that can be used to identify a payment method-#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, diesel::expression::AsExpression)]-#[diesel(sql_type = diesel::sql_types::Text)]+#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Text))]pub struct GlobalPaymentMethodId(GlobalId);/// A global id that can be used to identify a payment method session-#[derive(- Debug,- Clone,- Hash,- PartialEq,- Eq,- serde::Serialize,- serde::Deserialize,- diesel::expression::AsExpression,-)]-#[diesel(sql_type = diesel::sql_types::Text)]+#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, serde::Deserialize)]+#[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Text))]pub struct GlobalPaymentMethodSessionId(GlobalId);#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]@@ -120,6 +113,7 @@ impl<'de> serde::Deserialize<'de> for GlobalPaymentMethodId {}}+#[cfg(feature = "diesel")]impl<DB> diesel::Queryable<diesel::sql_types::Text, DB> for GlobalPaymentMethodIdwhereDB: diesel::backend::Backend,@@ -131,6 +125,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Text, DB> for GlobalPaymentMethodIdwhereDB: diesel::backend::Backend,@@ -144,6 +139,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Text, DB> for GlobalPaymentMethodIdwhereDB: diesel::backend::Backend,@@ -155,6 +151,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> diesel::Queryable<diesel::sql_types::Text, DB> for GlobalPaymentMethodSessionIdwhereDB: diesel::backend::Backend,@@ -166,6 +163,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Text, DB> for GlobalPaymentMethodSessionIdwhereDB: diesel::backend::Backend,@@ -179,6 +177,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Text, DB> for GlobalPaymentMethodSessionIdwhereDB: diesel::backend::Backend,diff --git a/crates/common_utils/src/id_type/global_id/refunds.rs b/crates/common_utils/src/id_type/global_id/refunds.rsindex d7d451e772..a6af6f3698 100644--- a/crates/common_utils/src/id_type/global_id/refunds.rs+++ b/crates/common_utils/src/id_type/global_id/refunds.rs@@ -3,20 +3,13 @@ use error_stack::ResultExt;use crate::errors;/// A global id that can be used to identify a refund-#[derive(- Debug,- Clone,- Hash,- PartialEq,- Eq,- serde::Serialize,- serde::Deserialize,- diesel::expression::AsExpression,-)]-#[diesel(sql_type = diesel::sql_types::Text)]+#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, serde::Deserialize)]+#[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Text))]pub struct GlobalRefundId(super::GlobalId);// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(GlobalRefundId);impl GlobalRefundId {@@ -46,6 +39,7 @@ impl TryFrom<std::borrow::Cow<'static, str>> for GlobalRefundId {}// TODO: refactor the macro to include this id use case as well+#[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Text, DB> for GlobalRefundIdwhereDB: diesel::backend::Backend,@@ -59,6 +53,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Text, DB> for GlobalRefundIdwhereDB: diesel::backend::Backend,diff --git a/crates/common_utils/src/id_type/global_id/token.rs b/crates/common_utils/src/id_type/global_id/token.rsindex ae37a579ce..0b7384853c 100644--- a/crates/common_utils/src/id_type/global_id/token.rs+++ b/crates/common_utils/src/id_type/global_id/token.rs@@ -14,7 +14,9 @@ Example: `0a_tok_uu1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p`");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(GlobalTokenId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_global_id_type!(GlobalTokenId);impl GlobalTokenId {diff --git a/crates/common_utils/src/id_type/invoice.rs b/crates/common_utils/src/id_type/invoice.rsindex 9cf0289e2e..11c80b8f12 100644--- a/crates/common_utils/src/id_type/invoice.rs+++ b/crates/common_utils/src/id_type/invoice.rs@@ -11,7 +11,9 @@ crate::impl_try_from_cow_str_id_type!(InvoiceId, "invoice_id");crate::impl_generate_id_id_type!(InvoiceId, "invoice");crate::impl_serializable_secret_id_type!(InvoiceId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(InvoiceId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(InvoiceId);impl crate::events::ApiEventMetric for InvoiceId {diff --git a/crates/common_utils/src/id_type/merchant.rs b/crates/common_utils/src/id_type/merchant.rsindex f23db0f84c..1b9a9735d8 100644--- a/crates/common_utils/src/id_type/merchant.rs+++ b/crates/common_utils/src/id_type/merchant.rs@@ -25,7 +25,9 @@ crate::impl_try_from_cow_str_id_type!(MerchantId, "merchant_id");crate::impl_generate_id_id_type!(MerchantId, "mer");crate::impl_serializable_secret_id_type!(MerchantId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(MerchantId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(MerchantId);// This is implemented so that we can use merchant id directly as attribute in metricsdiff --git a/crates/common_utils/src/id_type/merchant_connector_account.rs b/crates/common_utils/src/id_type/merchant_connector_account.rsindex d3255bf7a9..adaa20f093 100644--- a/crates/common_utils/src/id_type/merchant_connector_account.rs+++ b/crates/common_utils/src/id_type/merchant_connector_account.rs@@ -14,7 +14,9 @@ crate::impl_generate_id_id_type!(MerchantConnectorAccountId, "mca");crate::impl_try_from_cow_str_id_type!(MerchantConnectorAccountId, "merchant_connector_id");crate::impl_serializable_secret_id_type!(MerchantConnectorAccountId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(MerchantConnectorAccountId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(MerchantConnectorAccountId);impl MerchantConnectorAccountId {diff --git a/crates/common_utils/src/id_type/organization.rs b/crates/common_utils/src/id_type/organization.rsindex 5c4f90c371..9e6ed0a361 100644--- a/crates/common_utils/src/id_type/organization.rs+++ b/crates/common_utils/src/id_type/organization.rs@@ -15,7 +15,9 @@ crate::impl_try_from_cow_str_id_type!(OrganizationId, "organization_id");crate::impl_generate_id_id_type!(OrganizationId, "org");crate::impl_serializable_secret_id_type!(OrganizationId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(OrganizationId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(OrganizationId);impl OrganizationId {diff --git a/crates/common_utils/src/id_type/payment.rs b/crates/common_utils/src/id_type/payment.rsindex 8d21cb8cb6..9d17ac9b42 100644--- a/crates/common_utils/src/id_type/payment.rs+++ b/crates/common_utils/src/id_type/payment.rs@@ -16,7 +16,9 @@ crate::impl_default_id_type!(PaymentId, "pay");crate::impl_try_from_cow_str_id_type!(PaymentId, "payment_id");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(PaymentId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(PaymentId);impl PaymentId {@@ -108,7 +110,9 @@ crate::impl_debug_id_type!(PaymentReferenceId);crate::impl_try_from_cow_str_id_type!(PaymentReferenceId, "payment_reference_id");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(PaymentReferenceId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(PaymentReferenceId);crate::id_type!(PaymentResourceId, "A type for payment_resource_id");@@ -119,7 +123,9 @@ crate::impl_debug_id_type!(PaymentResourceId);crate::impl_try_from_cow_str_id_type!(PaymentResourceId, "payment_resource_id");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(PaymentResourceId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(PaymentResourceId);// This is implemented so that we can use payment id directly as attribute in metricsdiff --git a/crates/common_utils/src/id_type/payout.rs b/crates/common_utils/src/id_type/payout.rsindex 644e29bf71..464cf12cac 100644--- a/crates/common_utils/src/id_type/payout.rs+++ b/crates/common_utils/src/id_type/payout.rs@@ -8,7 +8,9 @@ crate::impl_id_type_methods!(PayoutId, "payout_id");crate::impl_debug_id_type!(PayoutId);crate::impl_try_from_cow_str_id_type!(PayoutId, "payout_id");crate::impl_generate_id_id_type!(PayoutId, "payout");+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(PayoutId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(PayoutId);crate::id_type!(PayoutResourceId, "A type for payout_resource_id");@@ -19,7 +21,9 @@ crate::impl_debug_id_type!(PayoutResourceId);crate::impl_try_from_cow_str_id_type!(PayoutResourceId, "payout_resource_id");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(PayoutResourceId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(PayoutResourceId);crate::id_type!(PayoutReferenceId, "A type for payout_reference_id");@@ -30,7 +34,9 @@ crate::impl_debug_id_type!(PayoutReferenceId);crate::impl_try_from_cow_str_id_type!(PayoutReferenceId, "payout_reference_id");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(PayoutReferenceId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(PayoutReferenceId);impl std::str::FromStr for PayoutReferenceId {diff --git a/crates/common_utils/src/id_type/profile.rs b/crates/common_utils/src/id_type/profile.rsindex 0dc3ef0161..bda295d188 100644--- a/crates/common_utils/src/id_type/profile.rs+++ b/crates/common_utils/src/id_type/profile.rs@@ -11,7 +11,9 @@ crate::impl_debug_id_type!(ProfileId);crate::impl_try_from_cow_str_id_type!(ProfileId, "profile_id");crate::impl_generate_id_id_type!(ProfileId, "pro");crate::impl_serializable_secret_id_type!(ProfileId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(ProfileId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(ProfileId);impl crate::events::ApiEventMetric for ProfileId {diff --git a/crates/common_utils/src/id_type/profile_acquirer.rs b/crates/common_utils/src/id_type/profile_acquirer.rsindex 8541e04dee..2373fe67b9 100644--- a/crates/common_utils/src/id_type/profile_acquirer.rs+++ b/crates/common_utils/src/id_type/profile_acquirer.rs@@ -12,7 +12,9 @@ crate::impl_try_from_cow_str_id_type!(ProfileAcquirerId, "profile_acquirer_id");crate::impl_generate_id_id_type!(ProfileAcquirerId, "pro_acq");crate::impl_serializable_secret_id_type!(ProfileAcquirerId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(ProfileAcquirerId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(ProfileAcquirerId);impl Ord for ProfileAcquirerId {diff --git a/crates/common_utils/src/id_type/refunds.rs b/crates/common_utils/src/id_type/refunds.rsindex 478ff03380..12f573e371 100644--- a/crates/common_utils/src/id_type/refunds.rs+++ b/crates/common_utils/src/id_type/refunds.rs@@ -6,5 +6,7 @@ crate::impl_debug_id_type!(RefundReferenceId);crate::impl_try_from_cow_str_id_type!(RefundReferenceId, "refund_reference_id");// Database related implementations so that this field can be used directly in the database tables+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(RefundReferenceId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(RefundReferenceId);diff --git a/crates/common_utils/src/id_type/relay.rs b/crates/common_utils/src/id_type/relay.rsindex c818671e0e..27eea74b49 100644--- a/crates/common_utils/src/id_type/relay.rs+++ b/crates/common_utils/src/id_type/relay.rs@@ -9,7 +9,9 @@ crate::impl_id_type_methods!(RelayId, "relay_id");crate::impl_try_from_cow_str_id_type!(RelayId, "relay_id");crate::impl_generate_id_id_type!(RelayId, "relay");crate::impl_serializable_secret_id_type!(RelayId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(RelayId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(RelayId);crate::impl_debug_id_type!(RelayId);diff --git a/crates/common_utils/src/id_type/resource.rs b/crates/common_utils/src/id_type/resource.rsindex b4ecc705eb..d848023f63 100644--- a/crates/common_utils/src/id_type/resource.rs+++ b/crates/common_utils/src/id_type/resource.rs@@ -11,5 +11,7 @@ crate::impl_try_from_cow_str_id_type!(ResourceId, "resource_id");crate::impl_generate_id_id_type!(ResourceId, "res");crate::impl_serializable_secret_id_type!(ResourceId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(ResourceId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(ResourceId);diff --git a/crates/common_utils/src/id_type/routing.rs b/crates/common_utils/src/id_type/routing.rsindex cb6597174a..01671ca358 100644--- a/crates/common_utils/src/id_type/routing.rs+++ b/crates/common_utils/src/id_type/routing.rs@@ -11,7 +11,9 @@ crate::impl_try_from_cow_str_id_type!(RoutingId, "routing_id");crate::impl_generate_id_id_type!(RoutingId, "routing");crate::impl_serializable_secret_id_type!(RoutingId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(RoutingId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(RoutingId);impl crate::events::ApiEventMetric for RoutingId {diff --git a/crates/common_utils/src/id_type/subscription.rs b/crates/common_utils/src/id_type/subscription.rsindex abccf71178..ed4ae9a201 100644--- a/crates/common_utils/src/id_type/subscription.rs+++ b/crates/common_utils/src/id_type/subscription.rs@@ -11,7 +11,9 @@ crate::impl_try_from_cow_str_id_type!(SubscriptionId, "subscription_id");crate::impl_generate_id_id_type!(SubscriptionId, "sub");crate::impl_serializable_secret_id_type!(SubscriptionId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(SubscriptionId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(SubscriptionId);impl crate::events::ApiEventMetric for SubscriptionId {diff --git a/crates/common_utils/src/id_type/tenant.rs b/crates/common_utils/src/id_type/tenant.rsindex 882229371a..83beaa9e8f 100644--- a/crates/common_utils/src/id_type/tenant.rs+++ b/crates/common_utils/src/id_type/tenant.rs@@ -14,7 +14,9 @@ crate::impl_debug_id_type!(TenantId);crate::impl_try_from_cow_str_id_type!(TenantId, "tenant_id");crate::impl_serializable_secret_id_type!(TenantId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(TenantId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(TenantId);impl TenantId {diff --git a/crates/common_utils/src/id_type/webhook_endpoint.rs b/crates/common_utils/src/id_type/webhook_endpoint.rsindex 7e8f59c988..adaca5af78 100644--- a/crates/common_utils/src/id_type/webhook_endpoint.rs+++ b/crates/common_utils/src/id_type/webhook_endpoint.rs@@ -13,7 +13,9 @@ crate::impl_debug_id_type!(WebhookEndpointId);crate::impl_try_from_cow_str_id_type!(WebhookEndpointId, "webhook_endpoint_id");crate::impl_serializable_secret_id_type!(WebhookEndpointId);+#[cfg(feature = "diesel")]crate::impl_queryable_id_type!(WebhookEndpointId);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_id_type!(WebhookEndpointId);impl WebhookEndpointId {diff --git a/crates/common_utils/src/link_utils.rs b/crates/common_utils/src/link_utils.rsindex a2c2237b83..574336036f 100644--- a/crates/common_utils/src/link_utils.rs+++ b/crates/common_utils/src/link_utils.rs@@ -3,6 +3,7 @@use std::{collections::HashSet, primitive::i64};use common_enums::{enums, UIWidgetFormLayout};+#[cfg(feature = "diesel")]use diesel::{backend::Backend,deserialize,@@ -11,6 +12,7 @@ use diesel::{sql_types::Jsonb,AsExpression, FromSqlRow,};+#[cfg(feature = "diesel")]use error_stack::{report, ResultExt};use hyperswitch_masking::Secret;use regex::Regex;@@ -19,13 +21,14 @@ use router_env::logger;use serde::Serialize;use utoipa::ToSchema;-use crate::{consts, errors::ParsingError, id_type, types::MinorUnit};+#[cfg(feature = "diesel")]+use crate::errors::ParsingError;+use crate::{consts, id_type, types::MinorUnit};-#[derive(- Serialize, serde::Deserialize, Debug, Clone, Eq, PartialEq, FromSqlRow, AsExpression, ToSchema,-)]+#[derive(Serialize, serde::Deserialize, Debug, Clone, Eq, PartialEq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]#[serde(rename_all = "snake_case", tag = "type", content = "value")]-#[diesel(sql_type = Jsonb)]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// Link status enumpub enum GenericLinkStatus {/// Status variants for payment method collect link@@ -40,13 +43,13 @@ impl Default for GenericLinkStatus {}}+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(GenericLinkStatus);-#[derive(- Serialize, serde::Deserialize, Debug, Clone, Eq, PartialEq, FromSqlRow, AsExpression, ToSchema,-)]+#[derive(Serialize, serde::Deserialize, Debug, Clone, Eq, PartialEq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]#[serde(rename_all = "snake_case")]-#[diesel(sql_type = Jsonb)]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// Status variants for payment method collect linkspub enum PaymentMethodCollectStatus {/// Link was initialized@@ -57,6 +60,7 @@ pub enum PaymentMethodCollectStatus {Submitted,}+#[cfg(feature = "diesel")]impl<DB: Backend> FromSql<Jsonb, DB> for PaymentMethodCollectStatuswhereserde_json::Value: FromSql<Jsonb, DB>,@@ -74,6 +78,7 @@ where}}+#[cfg(feature = "diesel")]impl ToSql<Jsonb, diesel::pg::Pg> for PaymentMethodCollectStatuswhereserde_json::Value: ToSql<Jsonb, diesel::pg::Pg>,@@ -91,11 +96,10 @@ where}}-#[derive(- Serialize, serde::Deserialize, Debug, Clone, Eq, PartialEq, FromSqlRow, AsExpression, ToSchema,-)]+#[derive(Serialize, serde::Deserialize, Debug, Clone, Eq, PartialEq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]#[serde(rename_all = "snake_case")]-#[diesel(sql_type = Jsonb)]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// Status variants for payout linkspub enum PayoutLinkStatus {/// Link was initialized@@ -106,6 +110,7 @@ pub enum PayoutLinkStatus {Submitted,}+#[cfg(feature = "diesel")]impl<DB: Backend> FromSql<Jsonb, DB> for PayoutLinkStatuswhereserde_json::Value: FromSql<Jsonb, DB>,@@ -123,6 +128,7 @@ where}}+#[cfg(feature = "diesel")]impl ToSql<Jsonb, diesel::pg::Pg> for PayoutLinkStatuswhereserde_json::Value: ToSql<Jsonb, diesel::pg::Pg>,@@ -140,8 +146,9 @@ where}}-#[derive(Serialize, serde::Deserialize, Debug, Clone, FromSqlRow, AsExpression, ToSchema)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, serde::Deserialize, Debug, Clone, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// Payout link objectpub struct PayoutLinkData {/// Identifier for the payout link@@ -173,6 +180,7 @@ pub struct PayoutLinkData {pub test_mode: Option<bool>,}+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(PayoutLinkData);/// Object for GenericLinkUiConfigdiff --git a/crates/common_utils/src/macros.rs b/crates/common_utils/src/macros.rsindex c42d77c324..494cf987b4 100644--- a/crates/common_utils/src/macros.rs+++ b/crates/common_utils/src/macros.rs@@ -103,6 +103,7 @@ macro_rules! collect_missing_value_keys {/// Implements the `ToSql` and `FromSql` traits on a type to allow it to be serialized/deserialized/// to/from JSON data in the database.+#[cfg(feature = "diesel")]#[macro_export]macro_rules! impl_to_sql_from_sql_json {($type:ty, $diesel_type:ty) => {@@ -150,16 +151,10 @@ mod id_type {($type:ident, $doc:literal, $diesel_type:ty, $max_length:expr, $min_length:expr) => {#[doc = $doc]#[derive(- Clone,- Hash,- PartialEq,- Eq,- serde::Serialize,- serde::Deserialize,- diesel::expression::AsExpression,- utoipa::ToSchema,+ Clone, Hash, PartialEq, Eq, serde::Serialize, serde::Deserialize, utoipa::ToSchema,)]- #[diesel(sql_type = $diesel_type)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = $diesel_type))]#[schema(value_type = String)]pub struct $type($crate::id_type::LengthId<$max_length, $min_length>);};@@ -180,17 +175,9 @@ mod id_type {macro_rules! global_id_type {($type:ident, $doc:literal) => {#[doc = $doc]- #[derive(- Debug,- Clone,- Hash,- PartialEq,- Eq,- serde::Serialize,- serde::Deserialize,- diesel::expression::AsExpression,- )]- #[diesel(sql_type = diesel::sql_types::Text)]+ #[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, serde::Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Text))]pub struct $type($crate::id_type::global_id::GlobalId);};}@@ -283,6 +270,7 @@ mod id_type {}/// Implements the `ToSql` and `FromSql` traits on the specified ID type.+ #[cfg(feature = "diesel")]#[macro_export]macro_rules! impl_to_sql_from_sql_id_type {($type:ty, $diesel_type:ty, $max_length:expr, $min_length:expr) => {@@ -321,7 +309,7 @@ mod id_type {};}- #[cfg(feature = "v2")]+ #[cfg(all(feature = "v2", feature = "diesel"))]/// Implements the `ToSql` and `FromSql` traits on the specified Global ID type.#[macro_export]macro_rules! impl_to_sql_from_sql_global_id_type {@@ -356,6 +344,7 @@ mod id_type {}/// Implements the `Queryable` trait on the specified ID type.+ #[cfg(feature = "diesel")]#[macro_export]macro_rules! impl_queryable_id_type {($type:ty, $diesel_type:ty) => {diff --git a/crates/common_utils/src/payout_method_utils.rs b/crates/common_utils/src/payout_method_utils.rsindex d179314861..c7b2ab6b28 100644--- a/crates/common_utils/src/payout_method_utils.rs+++ b/crates/common_utils/src/payout_method_utils.rs@@ -1,5 +1,6 @@//! This module has common utilities for payout method data in HyperSwitch+#[cfg(feature = "diesel")]use diesel::{sql_types::Jsonb, AsExpression, FromSqlRow};use hyperswitch_masking::Secret;use serde::{Deserialize, Serialize};@@ -11,10 +12,9 @@ use crate::new_type::{};/// Masked payout method details for storing in db-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub enum AdditionalPayoutMethodData {/// Additional data for card payout methodCard(Box<CardAdditionalData>),@@ -28,13 +28,13 @@ pub enum AdditionalPayoutMethodData {Passthrough(Box<PassthroughAdditionalData>),}+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(AdditionalPayoutMethodData);/// Masked payout method details for card payout method-#[derive(- Eq, PartialEq, Clone, Debug, Serialize, Deserialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct CardAdditionalData {/// Issuer of the cardpub card_issuer: Option<String>,@@ -75,10 +75,9 @@ pub struct CardAdditionalData {}/// Masked payout method details for bank payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(untagged)]pub enum BankAdditionalData {/// Additional data for ach bank transfer payout method@@ -101,13 +100,13 @@ pub enum BankAdditionalData {Ted(Box<TedBankTransferAdditionalData>),}+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(BankAdditionalData);/// Masked payout method details for ach bank transfer payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct AchBankTransferAdditionalData {/// Partially masked account number for ach bank debit payment#[schema(value_type = String, example = "0001****3456")]@@ -135,10 +134,9 @@ pub struct AchBankTransferAdditionalData {}/// Masked payout method details for bacs bank transfer payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct BacsBankTransferAdditionalData {/// Partially masked sort code for Bacs payment method#[schema(value_type = String, example = "108800")]@@ -166,10 +164,9 @@ pub struct BacsBankTransferAdditionalData {}/// Masked payout method details for sepa bank transfer payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct SepaBankTransferAdditionalData {/// Partially masked international bank account number (iban) for SEPA#[schema(value_type = String, example = "DE8937******013000")]@@ -197,10 +194,9 @@ pub struct SepaBankTransferAdditionalData {}/// Masked payout method details for pix bank transfer payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct PixBankTransferAdditionalData {/// Partially masked unique key for pix transfer#[schema(value_type = String, example = "a1f4102e ****** 6fa48899c1d1")]@@ -244,10 +240,9 @@ pub struct PixBankTransferAdditionalData {}/// Masked payout method details for PayShap bank transfer payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]pub struct PayshapBankTransferAdditionalData {/// Bank account number is a unique identifier assigned by a bank to a customer.@@ -264,10 +259,9 @@ pub struct PayshapBankTransferAdditionalData {}/// Masked payout method details for PayShap proxy bank transfer payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(deny_unknown_fields)]pub struct PayshapProxyBankTransferAdditionalData {/// Cellphone proxy.@@ -280,10 +274,9 @@ pub struct PayshapProxyBankTransferAdditionalData {}/// Masked payout method details for TED bank transfer payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct TedBankTransferAdditionalData {/// Partially masked bank account number#[schema(value_type = Option<String>, example = "0001****3456")]@@ -315,10 +308,9 @@ pub struct TedBankTransferAdditionalData {}/// Masked payout method details for Trustly bank transfer payout method-#[derive(- Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct TrustlyBankTransferAdditionalData {/// International Bank Account Number (iban) - used in many countries for identifying a bank along with it's customer.#[schema(value_type = String, example = "token_12345")]@@ -335,10 +327,9 @@ pub struct TrustlyBankTransferAdditionalData {}/// Masked payout method details for wallet payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(untagged)]pub enum WalletAdditionalData {/// Additional data for Apple pay decrypt wallet payout method@@ -354,10 +345,9 @@ pub enum WalletAdditionalData {}/// Masked payout method details for a MiFinity wallet payout.-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct MifinityAdditionalData {/// Recipient email address or MiFinity account number.#[schema(value_type = String, example = "[email protected]")]@@ -365,10 +355,9 @@ pub struct MifinityAdditionalData {}/// Masked payout method details for paypal wallet payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(tag = "field_type", rename_all = "snake_case")]pub enum PaypalAdditionalData {// Exactly one of the three identifiers will always be present@@ -393,10 +382,9 @@ pub enum PaypalAdditionalData {}/// Masked payout method details for venmo wallet payout method-#[derive(- Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct VenmoAdditionalData {/// mobile number linked to venmo account#[schema(value_type = Option<String>, example = "******* 3349")]@@ -404,10 +392,9 @@ pub struct VenmoAdditionalData {}/// Masked payout method details for Apple pay decrypt wallet payout method-#[derive(- Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct ApplePayDecryptAdditionalData {/// Card expiry month#[schema(value_type = String, example = "01")]@@ -423,10 +410,9 @@ pub struct ApplePayDecryptAdditionalData {}/// Masked payout method details for Google pay decrypt wallet payout method-#[derive(- Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct GooglePayDecryptAdditionalData {/// Card expiry month#[schema(value_type = String, example = "01")]@@ -442,10 +428,9 @@ pub struct GooglePayDecryptAdditionalData {}/// Masked payout method details for wallet payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[serde(untagged)]pub enum BankRedirectAdditionalData {/// Additional data for OpenBankingUK bank redirect payout method@@ -455,10 +440,9 @@ pub enum BankRedirectAdditionalData {}/// Masked payout method details for interac bank redirect payout method-#[derive(- Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct InteracAdditionalData {/// Email linked with interac account#[schema(value_type = Option<String>, example = "[email protected]")]@@ -466,10 +450,9 @@ pub struct InteracAdditionalData {}/// Masked payout method details for OpenBankingUK bank redirect payout method-#[derive(- Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct OpenBankingUkAdditionalData {/// Account holder name#[schema(value_type = String, example = "John Doe")]@@ -480,10 +463,9 @@ pub struct OpenBankingUkAdditionalData {}/// Masked payout method details for OpenBanking bank transfer payout method-#[derive(- Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Default, Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct OpenBankingAdditionalData {/// Account holder name#[schema(value_type = String, example = "John Doe")]@@ -494,10 +476,9 @@ pub struct OpenBankingAdditionalData {}/// additional payout method details for passthrough payout method-#[derive(- Eq, PartialEq, Clone, Debug, Deserialize, Serialize, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Eq, PartialEq, Clone, Debug, Deserialize, Serialize, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct PassthroughAdditionalData {/// Psp_token of the passthrough flow#[schema(value_type = String, example = "token_12345")]diff --git a/crates/common_utils/src/pii.rs b/crates/common_utils/src/pii.rsindex d42191d8f0..ac4fded2fb 100644--- a/crates/common_utils/src/pii.rs+++ b/crates/common_utils/src/pii.rs@@ -2,6 +2,7 @@use std::{convert::AsRef, fmt, ops, str::FromStr};+#[cfg(feature = "diesel")]use diesel::{backend::Backend,deserialize,@@ -86,6 +87,7 @@ impl ops::DerefMut for PhoneNumber {}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for PhoneNumberwhereDB: Backend,@@ -98,6 +100,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for PhoneNumberwhereDB: Backend,@@ -109,6 +112,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for PhoneNumberwhereDB: Backend,@@ -235,10 +239,9 @@ where}}/// Email address-#[derive(- serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Default, AsExpression,-)]-#[diesel(sql_type = sql_types::Text)]+#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, Default)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]#[serde(try_from = "String")]pub struct Email(Secret<String, EmailStrategy>);@@ -276,6 +279,7 @@ impl ops::DerefMut for Email {}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for EmailwhereDB: Backend,@@ -288,6 +292,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for EmailwhereDB: Backend,@@ -299,6 +304,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for EmailwhereDB: Backend,diff --git a/crates/common_utils/src/types.rs b/crates/common_utils/src/types.rsindex e4bc05ff8c..840c588d1e 100644--- a/crates/common_utils/src/types.rs+++ b/crates/common_utils/src/types.rs@@ -23,6 +23,7 @@ use std::{};use common_enums::enums;+#[cfg(feature = "diesel")]use diesel::{backend::Backend,deserialize,@@ -201,8 +202,9 @@ pub enum Surcharge {}/// This struct lets us represent a semantic version type-#[derive(Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, Ord, PartialOrd)]-#[diesel(sql_type = Jsonb)]+#[derive(Debug, Clone, PartialEq, Eq, Ord, PartialOrd)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]#[derive(Serialize, serde::Deserialize)]pub struct SemanticVersion(#[serde(with = "Version")] Version);@@ -238,6 +240,7 @@ impl FromStr for SemanticVersion {}}+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(SemanticVersion);/// Amount convertor trait for connector@@ -376,7 +379,6 @@ impl AmountConvertor for MinorUnitForConnector {Default,Debug,serde::Deserialize,- AsExpression,serde::Serialize,Clone,Copy,@@ -387,7 +389,8 @@ impl AmountConvertor for MinorUnitForConnector {PartialOrd,Ord,)]-#[diesel(sql_type = sql_types::BigInt)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::BigInt))]pub struct MinorUnit(i64);impl MinorUnit {@@ -468,6 +471,7 @@ impl Display for MinorUnit {}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::BigInt, DB> for MinorUnitwhereDB: Backend,@@ -479,6 +483,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::BigInt, DB> for MinorUnitwhereDB: Backend,@@ -489,6 +494,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::BigInt, DB> for MinorUnitwhereDB: Backend,@@ -542,7 +548,6 @@ impl Sum for MinorUnit {Default,Debug,serde::Deserialize,- AsExpression,serde::Serialize,Clone,PartialEq,@@ -551,7 +556,8 @@ impl Sum for MinorUnit {ToSchema,PartialOrd,)]-#[diesel(sql_type = sql_types::Text)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub struct StringMinorUnit(String);impl StringMinorUnit {@@ -581,6 +587,7 @@ impl Display for StringMinorUnit {}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for StringMinorUnitwhereDB: Backend,@@ -592,6 +599,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for StringMinorUnitwhereDB: Backend,@@ -602,6 +610,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for StringMinorUnitwhereDB: Backend,@@ -705,18 +714,10 @@ impl StringMajorUnit {}#[derive(- Debug,- serde::Deserialize,- AsExpression,- serde::Serialize,- Clone,- PartialEq,- Eq,- Hash,- ToSchema,- PartialOrd,+ Debug, serde::Deserialize, serde::Serialize, Clone, PartialEq, Eq, Hash, ToSchema, PartialOrd,)]-#[diesel(sql_type = sql_types::Text)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]/// This domain type can be used for any urlpub struct Url(url::Url);@@ -748,6 +749,7 @@ impl Url {}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for UrlwhereDB: Backend,@@ -759,6 +761,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for UrlwhereDB: Backend,@@ -892,10 +895,9 @@ mod amount_conversion_tests {}// Charges structs-#[derive(- Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, FromSqlRow, AsExpression, ToSchema,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]/// Charge specific fields for controlling the revert of funds from either platform or connected account. Check sub-fields for more details.pub struct ChargeRefunds {/// Identifier for charge created for the payment@@ -910,11 +912,13 @@ pub struct ChargeRefunds {pub revert_transfer: Option<bool>,}+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(ChargeRefunds);/// A common type of domain type that can be used for fields that contain a string with restriction of length-#[derive(Debug, Clone, Serialize, Hash, PartialEq, Eq, AsExpression)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, Serialize, Hash, PartialEq, Eq)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub(crate) struct LengthString<const MAX_LENGTH: u16, const MIN_LENGTH: u16>(String);/// Error generated from violation of constraints for MerchantReferenceId@@ -964,6 +968,7 @@ impl<'de, const MAX_LENGTH: u16, const MIN_LENGTH: u16> Deserialize<'de>}}+#[cfg(feature = "diesel")]impl<DB, const MAX_LENGTH: u16, const MIN_LENGTH: u16> FromSql<sql_types::Text, DB>for LengthString<MAX_LENGTH, MIN_LENGTH>where@@ -976,6 +981,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB, const MAX_LENGTH: u16, const MIN_LENGTH: u16> ToSql<sql_types::Text, DB>for LengthString<MAX_LENGTH, MIN_LENGTH>where@@ -987,6 +993,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB, const MAX_LENGTH: u16, const MIN_LENGTH: u16> Queryable<sql_types::Text, DB>for LengthString<MAX_LENGTH, MIN_LENGTH>where@@ -1000,8 +1007,9 @@ where}/// Domain type for description-#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, AsExpression)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub struct Description(LengthString<MAX_DESCRIPTION_LENGTH, 1>);impl Description {@@ -1018,8 +1026,9 @@ impl Description {}/// Domain type for Statement Descriptor-#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, AsExpression)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub struct StatementDescriptor(LengthString<MAX_STATEMENT_DESCRIPTOR_LENGTH, 1>);/// Domain type for a blocklist lookup value - a card BIN or a locker fingerprint id.@@ -1036,6 +1045,7 @@ impl BlocklistLookupData {}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for DescriptionwhereDB: Backend,@@ -1048,6 +1058,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for DescriptionwhereDB: Backend,@@ -1059,6 +1070,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for DescriptionwhereDB: Backend,@@ -1069,6 +1081,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for StatementDescriptorwhereDB: Backend,@@ -1081,6 +1094,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for StatementDescriptorwhereDB: Backend,@@ -1092,6 +1106,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for StatementDescriptorwhereDB: Backend,@@ -1103,10 +1118,9 @@ where}/// Domain type for unified code-#[derive(- Debug, Clone, PartialEq, Eq, Queryable, serde::Deserialize, serde::Serialize, AsExpression,-)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(Queryable, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub struct UnifiedCode(pub String);impl TryFrom<String> for UnifiedCode {@@ -1122,6 +1136,7 @@ impl TryFrom<String> for UnifiedCode {}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for UnifiedCodewhereDB: Backend,@@ -1133,6 +1148,7 @@ whereOk(row)}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for UnifiedCodewhereDB: Backend,@@ -1144,6 +1160,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for UnifiedCodewhereDB: Backend,@@ -1155,10 +1172,9 @@ where}/// Domain type for unified messages-#[derive(- Debug, Clone, PartialEq, Eq, Queryable, serde::Deserialize, serde::Serialize, AsExpression,-)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(Queryable, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub struct UnifiedMessage(pub String);impl TryFrom<String> for UnifiedMessage {@@ -1174,6 +1190,7 @@ impl TryFrom<String> for UnifiedMessage {}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for UnifiedMessagewhereDB: Backend,@@ -1185,6 +1202,7 @@ whereOk(row)}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for UnifiedMessagewhereDB: Backend,@@ -1196,6 +1214,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for UnifiedMessagewhereDB: Backend,@@ -1209,17 +1228,9 @@ where#[cfg(feature = "v2")]/// Browser information to be used for 3DS 2.0// If any of the field is PII, then we can make them as secret-#[derive(- ToSchema,- Debug,- Clone,- serde::Deserialize,- serde::Serialize,- Eq,- PartialEq,- diesel::AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(ToSchema, Debug, Clone, serde::Deserialize, serde::Serialize, Eq, PartialEq)]+#[cfg_attr(feature = "diesel", derive(diesel::AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct BrowserInformation {/// Color depth supported by the browserpub color_depth: Option<u8>,@@ -1272,6 +1283,7 @@ pub struct BrowserInformation {}#[cfg(feature = "v2")]+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(BrowserInformation);/// A single co-badge / secondary network entry enriched from the Pagos BIN data.@@ -1309,20 +1321,12 @@ pub struct SecondaryNetwork {/// Co-badged card networks for a card BIN, stored as a JSONB array of [`SecondaryNetwork`] objects/// in the `co_badged_card_networks` column of `cards_info`. The newtype is serde-transparent, so it/// serializes/deserializes as a plain JSON array.-#[derive(- Clone,- Debug,- Default,- PartialEq,- Eq,- serde::Serialize,- serde::Deserialize,- FromSqlRow,- AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct CoBadgedCardNetworkMetadata(pub Vec<SecondaryNetwork>);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(CoBadgedCardNetworkMetadata);/// A single interchange cap entry within the [`CardCost`] array. All values are kept as strings.@@ -1355,20 +1359,12 @@ pub struct InterchangeCap {}/// The `cost` column of `cards_info` — a JSON array of interchange caps.-#[derive(- Clone,- Debug,- Default,- PartialEq,- Eq,- serde::Serialize,- serde::Deserialize,- FromSqlRow,- AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct CardCost(pub Vec<InterchangeCap>);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(CardCost);/// A single customer-authentication requirement within the [`CardAuthentication`] array.@@ -1382,20 +1378,12 @@ pub struct AuthenticationInfo {}/// The `authentication` column of `cards_info` — a JSON array of required authentication programs.-#[derive(- Clone,- Debug,- Default,- PartialEq,- Eq,- serde::Serialize,- serde::Deserialize,- FromSqlRow,- AsExpression,-)]-#[diesel(sql_type = Jsonb)]+#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]+#[cfg_attr(feature = "diesel", derive(FromSqlRow, AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = Jsonb))]pub struct CardAuthentication(pub Vec<AuthenticationInfo>);+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(CardAuthentication);/// Domain type for connector_transaction_id@@ -1404,8 +1392,9 @@ crate::impl_to_sql_from_sql_json!(CardAuthentication);/// the hash value of such identifiers will be stored as connector_transaction_id./// The actual connector's identifier will be stored in a separate column -/// processor_transaction_data or something with a similar name.-#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, AsExpression)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub enum ConnectorTransactionId {/// Actual transaction identifierTxnId(String),@@ -1476,6 +1465,7 @@ impl From<String> for ConnectorTransactionId {}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for ConnectorTransactionIdwhereDB: Backend,@@ -1488,6 +1478,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for ConnectorTransactionIdwhereDB: Backend,@@ -1499,6 +1490,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for ConnectorTransactionIdwhereDB: Backend,@@ -1532,8 +1524,9 @@ pub trait ConnectorTransactionIdTrait {}/// Domain type for PublishableKey-#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize, AsExpression)]-#[diesel(sql_type = sql_types::Text)]+#[derive(Debug, Clone, PartialEq, Eq, serde::Deserialize, serde::Serialize)]+#[cfg_attr(feature = "diesel", derive(AsExpression))]+#[cfg_attr(feature = "diesel", diesel(sql_type = sql_types::Text))]pub struct PublishableKey(LengthString<PUBLISHABLE_KEY_LENGTH, PUBLISHABLE_KEY_LENGTH>);impl PublishableKey {@@ -1549,6 +1542,7 @@ impl PublishableKey {}}+#[cfg(feature = "diesel")]impl<DB> Queryable<sql_types::Text, DB> for PublishableKeywhereDB: Backend,@@ -1561,6 +1555,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> FromSql<sql_types::Text, DB> for PublishableKeywhereDB: Backend,@@ -1572,6 +1567,7 @@ where}}+#[cfg(feature = "diesel")]impl<DB> ToSql<sql_types::Text, DB> for PublishableKeywhereDB: Backend,diff --git a/crates/common_utils/src/types/primitive_wrappers.rs b/crates/common_utils/src/types/primitive_wrappers.rsindex 850f6a7cb5..2a09fdf4ea 100644--- a/crates/common_utils/src/types/primitive_wrappers.rs+++ b/crates/common_utils/src/types/primitive_wrappers.rs@@ -2,16 +2,16 @@ pub(crate) mod bool_wrappers {use serde::{Deserialize, Serialize};/// Bool that represents if Extended Authorization is Applied or not- #[derive(- Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, diesel::expression::AsExpression,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct ExtendedAuthorizationAppliedBool(bool);impl From<bool> for ExtendedAuthorizationAppliedBool {fn from(value: bool) -> Self {Self(value)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for ExtendedAuthorizationAppliedBoolwhereDB: diesel::backend::Backend,@@ -24,6 +24,7 @@ pub(crate) mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for ExtendedAuthorizationAppliedBoolwhere@@ -36,10 +37,9 @@ pub(crate) mod bool_wrappers {}/// Bool that represents if Extended Authorization is Requested or not- #[derive(- Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, diesel::expression::AsExpression,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct RequestExtendedAuthorizationBool(bool);impl From<bool> for RequestExtendedAuthorizationBool {fn from(value: bool) -> Self {@@ -52,6 +52,7 @@ pub(crate) mod bool_wrappers {self.0}}+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB> for RequestExtendedAuthorizationBoolwhereDB: diesel::backend::Backend,@@ -64,6 +65,7 @@ pub(crate) mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for RequestExtendedAuthorizationBoolwhere@@ -76,11 +78,11 @@ pub(crate) mod bool_wrappers {}/// Bool that represents if Extended Authorization is always Requested or not- #[derive(- Clone, Copy, Debug, Eq, PartialEq, diesel::expression::AsExpression, Serialize, Deserialize,- )]- #[diesel(sql_type = diesel::sql_types::Bool)]+ #[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]+ #[cfg_attr(feature = "diesel", derive(diesel::expression::AsExpression))]+ #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Bool))]pub struct AlwaysRequestExtendedAuthorization(bool);+ #[cfg(feature = "diesel")]impl<DB> diesel::serialize::ToSql<diesel::sql_types::Bool, DB>for AlwaysRequestExtendedAuthorizationwhere@@ -94,6 +96,7 @@ pub(crate) mod bool_wrappers {self.0.to_sql(out)}}+ #[cfg(feature = "diesel")]impl<DB> diesel::deserialize::FromSql<diesel::sql_types::Bool, DB>for AlwaysRequestExtendedAuthorizationwherediff --git a/crates/common_utils/src/types/user/core.rs b/crates/common_utils/src/types/user/core.rsindex 6bdecb1283..2c64f63497 100644--- a/crates/common_utils/src/types/user/core.rs+++ b/crates/common_utils/src/types/user/core.rs@@ -1,10 +1,12 @@+#[cfg(feature = "diesel")]use diesel::{deserialize::FromSqlRow, expression::AsExpression};use crate::id_type;/// Struct for lineageContext-#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, AsExpression, FromSqlRow)]-#[diesel(sql_type = diesel::sql_types::Jsonb)]+#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]+#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))]+#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Jsonb))]pub struct LineageContext {/// user_id: Stringpub user_id: String,@@ -25,4 +27,5 @@ pub struct LineageContext {pub tenant_id: id_type::TenantId,}+#[cfg(feature = "diesel")]crate::impl_to_sql_from_sql_json!(LineageContext);diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.tomlindex 00be7b947a..eb725611e0 100644--- a/crates/diesel_models/Cargo.toml+++ b/crates/diesel_models/Cargo.toml@@ -28,9 +28,9 @@ thiserror = "1.0.69"time = { version = "0.3.41", features = ["serde", "serde-well-known", "std"] }# First party crates-common_enums = { version = "0.1.0", path = "../common_enums" }-common_utils = { version = "0.1.0", path = "../common_utils" }-common_types = { version = "0.1.0", path = "../common_types" }+common_enums = { version = "0.1.0", path = "../common_enums", features = ["diesel"] }+common_utils = { version = "0.1.0", path = "../common_utils", features = ["diesel"] }+common_types = { version = "0.1.0", path = "../common_types", features = ["diesel"] }hyperswitch_masking = "0.0.1"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"] }diff --git a/crates/drainer/Cargo.toml b/crates/drainer/Cargo.tomlindex b3fcd821ef..5f30c5f9c0 100644--- a/crates/drainer/Cargo.toml+++ b/crates/drainer/Cargo.toml@@ -41,7 +41,7 @@ thiserror = "1.0.69"tokio = { version = "1.48.0", features = ["macros", "rt-multi-thread"] }# First Party Crates-common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals"] }+common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "diesel"] }diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"], default-features = false }external_services = { version = "0.1.0", path = "../external_services" }hyperswitch_interfaces = { version = "0.1.0", path = "../hyperswitch_interfaces" }diff --git a/crates/euclid/Cargo.toml b/crates/euclid/Cargo.tomlindex b1d4b932fe..86e73b4f2e 100644--- a/crates/euclid/Cargo.toml+++ b/crates/euclid/Cargo.toml@@ -14,7 +14,6 @@ serde_json = "1.0.140"strum = { version = "0.26", features = ["derive"] }thiserror = "1.0.69"utoipa = { version = "4.2.3", features = ["preserve_order", "preserve_path_order"] }-diesel = { version = "2.3.12", features = ["postgres", "128-column-tables"] }# First party dependenciescommon_enums = { version = "0.1.0", path = "../common_enums" }diff --git a/crates/euclid/src/enums.rs b/crates/euclid/src/enums.rsindex cc9dc823c5..bfb2b21042 100644--- a/crates/euclid/src/enums.rs+++ b/crates/euclid/src/enums.rs@@ -187,7 +187,6 @@ pub enum PayoutType {strum::VariantNames,ToSchema,)]-#[router_derive::diesel_enum(storage_type = "db_enum")]#[serde(rename_all = "snake_case")]#[strum(serialize_all = "snake_case")]/// RoutableConnectors are the subset of Connectors that are eligible for payments routingdiff --git a/crates/router/Cargo.toml b/crates/router/Cargo.tomlindex de346834a3..ccc6c5e8c9 100644--- a/crates/router/Cargo.toml+++ b/crates/router/Cargo.toml@@ -300,15 +300,16 @@ api_models = { version = "0.1.0", path = "../api_models", features = ["control_center_theme",] }cards = { version = "0.1.0", path = "../cards" }-common_enums = { version = "0.1.0", path = "../common_enums" }+common_enums = { version = "0.1.0", path = "../common_enums", features = ["diesel"] }common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals","async_ext","logs","metrics","keymanager",+ "diesel",] }-common_types = { version = "0.1.0", path = "../common_types" }+common_types = { version = "0.1.0", path = "../common_types", features = ["diesel"] }deja = { git = "https://github.com/juspay/deja", rev = "6ace82f8d37c7c5703f9636a608dd8d85a8f6953", optional = true, default-features = false }deja-core = { git = "https://github.com/juspay/deja", rev = "6ace82f8d37c7c5703f9636a608dd8d85a8f6953", optional = true }connector_configs = { version = "0.1.0", path = "../connector_configs" }diff --git a/crates/router_derive/Cargo.toml b/crates/router_derive/Cargo.tomlindex 199fc6e9ef..45d437ec5d 100644--- a/crates/router_derive/Cargo.toml+++ b/crates/router_derive/Cargo.toml@@ -20,7 +20,6 @@ strum = { version = "0.26.3", features = ["derive"] }syn = { version = "2.0.101", features = ["full", "extra-traits"] } # the full feature does not seem to encompass all the features[dev-dependencies]-diesel = { version = "2.3.12", features = ["postgres"] }error-stack = "0.4.1"serde = { version = "1.0.219", features = ["derive"] }serde_json = "1.0.140"diff --git a/crates/storage_impl/Cargo.toml b/crates/storage_impl/Cargo.tomlindex 5aeee0af51..6abe517103 100644--- a/crates/storage_impl/Cargo.toml+++ b/crates/storage_impl/Cargo.toml@@ -26,9 +26,9 @@ redis-rs = ["redis_interface/redis-rs"][dependencies]# First Party dependenciesapi_models = { version = "0.1.0", path = "../api_models" }-common_enums = { version = "0.1.0", path = "../common_enums" }-common_utils = { version = "0.1.0", path = "../common_utils" }-common_types = { version = "0.1.0", path = "../common_types" }+common_enums = { version = "0.1.0", path = "../common_enums", features = ["diesel"] }+common_utils = { version = "0.1.0", path = "../common_utils", features = ["diesel"] }+common_types = { version = "0.1.0", path = "../common_types", features = ["diesel"] }deja = { git = "https://github.com/juspay/deja", rev = "6ace82f8d37c7c5703f9636a608dd8d85a8f6953", optional = true, default-features = false }diesel_models = { version = "0.1.0", path = "../diesel_models", default-features = false }hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false }