Skip to content

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

31.2 KB
Raw Blame
pub mod oidc;
pub mod opensearch;
#[cfg(feature = "olap")]
pub mod user;
pub mod user_role;
use std::{collections::HashSet, str::FromStr, sync};

use api_models::enums::Country;
use common_utils::{consts, id_type};
pub use hyperswitch_domain_models::consts::{
    CONNECTOR_MANDATE_REQUEST_REFERENCE_ID_LENGTH, ROUTING_ENABLED_PAYMENT_METHODS,
    ROUTING_ENABLED_PAYMENT_METHOD_TYPES,
};
pub use hyperswitch_interfaces::consts::{NO_ERROR_CODE, NO_ERROR_MESSAGE};

// ID generation
pub(crate) const ID_LENGTH: usize = 20;
pub(crate) const MAX_ID_LENGTH: usize = 64;
#[rustfmt::skip]
pub(crate) const ALPHABETS: [char; 62] = [
    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
    'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
    'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
];
/// API client request timeout (in seconds)
pub const REQUEST_TIME_OUT: u64 = 30;
pub const REQUEST_TIMEOUT_PAYMENT_NOT_FOUND: &str = "Timed out ,payment not found";
pub const REQUEST_TIMEOUT_ERROR_MESSAGE_FROM_PSYNC: &str =
    "This Payment has been moved to failed as there is no response from the connector";

///Payment intent fulfillment default timeout (in seconds)
pub const DEFAULT_FULFILLMENT_TIME: i64 = 15 * 60;

/// Payment intent default client secret expiry (in seconds)
pub const DEFAULT_SESSION_EXPIRY: i64 = 15 * 60;

/// The length of a merchant fingerprint secret
pub const FINGERPRINT_SECRET_LENGTH: usize = 64;

pub const DEFAULT_LIST_API_LIMIT: u16 = 10;

pub const MULTIPART_MEMORY_LIMIT: usize = 6 * 1024 * 1024;

// String literals
pub(crate) const UNSUPPORTED_ERROR_MESSAGE: &str = "Unsupported response type";

// General purpose base64 engines

pub(crate) const BASE64_ENGINE: base64::engine::GeneralPurpose = consts::BASE64_ENGINE;

pub(crate) const API_KEY_LENGTH: usize = 64;

pub(crate) const PAYMENT_RESPONSE_HASH_KEY_PREFIX_LEN: usize = 4;

// OID (Object Identifier) for the merchant ID field extension.
pub(crate) const MERCHANT_ID_FIELD_EXTENSION_ID: &str = "1.2.840.113635.100.6.32";

pub const MAX_ROUTING_CONFIGS_PER_MERCHANT: usize = 100;
pub const ROUTING_CONFIG_ID_LENGTH: usize = 10;

pub const LOCKER_REDIS_PREFIX: &str = "LOCKER_PM_TOKEN";
pub const LOCKER_REDIS_EXPIRY_SECONDS: u32 = 60 * 15; // 15 minutes

pub const JWT_TOKEN_TIME_IN_SECS: u64 = 60 * 60 * 24 * 2; // 2 days
pub const JWT_EMBEDDED_TOKEN_TIME_IN_SECS: u64 = 60 * 60 * 3; // 3 hours

// This should be one day, but it is causing issue while checking token in blacklist.
// TODO: This should be fixed in future.
pub const SINGLE_PURPOSE_TOKEN_TIME_IN_SECS: u64 = 60 * 60 * 24 * 2; // 2 days

pub const JWT_TOKEN_COOKIE_NAME: &str = "login_token";

pub const USER_BLACKLIST_PREFIX: &str = "BU_";

pub const ROLE_BLACKLIST_PREFIX: &str = "BR_";

pub const USER_IDLE_SESSION_PREFIX: &str = "IS_";
pub const MIN_IDLE_SESSION_TIMEOUT_IN_SECS: u32 = 60;

#[cfg(feature = "email")]
pub const EMAIL_TOKEN_BLACKLIST_PREFIX: &str = "BET_";

pub const EMAIL_SUBJECT_API_KEY_EXPIRY: &str = "API Key Expiry Notice";
pub const EMAIL_SUBJECT_DASHBOARD_FEATURE_REQUEST: &str = "Dashboard Pro Feature Request by";
pub const EMAIL_SUBJECT_APPROVAL_RECON_REQUEST: &str =
    "Approval of Recon Request - Access Granted to Recon Dashboard";

pub const ROLE_INFO_CACHE_PREFIX: &str = "CR_INFO_";

pub const CARD_IP_BLOCKING_CACHE_KEY_PREFIX: &str = "CARD_IP_BLOCKING";

pub const GUEST_USER_CARD_BLOCKING_CACHE_KEY_PREFIX: &str = "GUEST_USER_CARD_BLOCKING";

pub const CUSTOMER_ID_BLOCKING_PREFIX: &str = "CUSTOMER_ID_BLOCKING";

pub const GUEST_IP_BLOCKING_CACHE_KEY_PREFIX: &str = "GUEST_IP_BLOCKING";

#[cfg(feature = "olap")]
pub const VERIFY_CONNECTOR_ID_PREFIX: &str = "conn_verify";
#[cfg(feature = "olap")]
pub const VERIFY_CONNECTOR_MERCHANT_ID: &str = "test_merchant";

#[cfg(feature = "olap")]
pub const CONNECTOR_ONBOARDING_CONFIG_PREFIX: &str = "onboarding";

/// Max payment session expiry
pub const MAX_SESSION_EXPIRY: u32 = 7890000;

/// Min payment session expiry
pub const MIN_SESSION_EXPIRY: u32 = 60;

/// Max payment intent fulfillment expiry
pub const MAX_INTENT_FULFILLMENT_EXPIRY: u32 = 1800;

/// Min payment intent fulfillment expiry
pub const MIN_INTENT_FULFILLMENT_EXPIRY: u32 = 60;

pub const LOCKER_HEALTH_CALL_PATH: &str = "/health";
pub const LOCKER_ADD_CARD_PATH: &str = "/cards/add";
pub const LOCKER_RETRIEVE_CARD_PATH: &str = "/cards/retrieve";
pub const LOCKER_DELETE_CARD_PATH: &str = "/cards/delete";

pub const AUTHENTICATION_ID_PREFIX: &str = "authn";

// URL for checking the outgoing call
pub const OUTGOING_CALL_URL: &str = "https://api.stripe.com/healthcheck";

// 15 minutes = 900 seconds
pub const POLL_ID_TTL: i64 = 900;

// 15 minutes = 900 seconds
pub const AUTHENTICATION_ELIGIBILITY_CHECK_DATA_TTL: i64 = 900;

// TTL for external surcharge details stored in Redis (15 minutes)
pub const EXTERNAL_SURCHARGE_TTL: i64 = 900;

// Prefix key for storing authentication eligibility check data in redis
pub const AUTHENTICATION_ELIGIBILITY_CHECK_DATA_KEY: &str = "AUTH_ELIGIBILITY_CHECK_DATA_";

// Default Poll Config
pub const DEFAULT_POLL_DELAY_IN_SECS: i8 = 2;
pub const DEFAULT_POLL_FREQUENCY: i8 = 5;

// Number of seconds to subtract from access token expiry
pub(crate) const REDUCE_ACCESS_TOKEN_EXPIRY_TIME: u8 = 15;
pub const CONNECTOR_CREDS_TOKEN_TTL: i64 = 900;

//max_amount allowed is 999999999 in minor units
pub const MAX_ALLOWED_AMOUNT: i64 = 999999999;

//payment attempt default unified error code and unified error message
pub const DEFAULT_UNIFIED_ERROR_CODE: &str = "UE_9000";
pub const DEFAULT_UNIFIED_ERROR_MESSAGE: &str = "Something went wrong";

// Recon's feature tag
pub const RECON_FEATURE_TAG: &str = "RECONCILIATION AND SETTLEMENT";

/// Default allowed domains for payment links
pub const DEFAULT_ALLOWED_DOMAINS: Option<HashSet<String>> = None;

/// Default hide card nickname field
pub const DEFAULT_HIDE_CARD_NICKNAME_FIELD: bool = false;

/// Show card form by default for payment links
pub const DEFAULT_SHOW_CARD_FORM: bool = true;

/// Default bool for Display sdk only
pub const DEFAULT_DISPLAY_SDK_ONLY: bool = false;

/// Default bool to enable saved payment method
pub const DEFAULT_ENABLE_SAVED_PAYMENT_METHOD: bool = false;

/// [PaymentLink] Default bool for enabling button only when form is ready
pub const DEFAULT_ENABLE_BUTTON_ONLY_ON_FORM_READY: bool = false;

/// Default Payment Link Background color
pub const DEFAULT_BACKGROUND_COLOR: &str = "#212E46";

/// Default product Img Link
pub const DEFAULT_PRODUCT_IMG: &str =
    "https://live.hyperswitch.io/payment-link-assets/cart_placeholder.png";

/// Show merchant name by default for payment links
pub const DEFAULT_SHOW_MERCHANT_NAME: bool = true;

/// Default SDK Layout
pub const DEFAULT_SDK_LAYOUT: &str = "tabs";

/// Vault Add request url
pub const V2_ADD_VAULT_REQUEST_URL: &str = "/api/v2/vault/add";

/// Vault Get Fingerprint request url
pub const V2_VAULT_FINGERPRINT_REQUEST_URL: &str = "/api/v2/vault/fingerprint";

/// Label for the vault fingerprint in a batched vault fingerprint request
pub const VAULT_FINGERPRINT_LABEL: &str = "vault";

/// Label for the auxiliary fingerprint in a batched vault fingerprint request
pub const AUXILIARY_FINGERPRINT_LABEL: &str = "auxiliary";

/// Label for the merchant fingerprint in a batched vault fingerprint request
pub const MERCHANT_FINGERPRINT_LABEL: &str = "merchant";

/// Vault Retrieve request url
pub const V2_VAULT_RETRIEVE_REQUEST_URL: &str = "/api/v2/vault/retrieve";

/// Vault Delete request url
pub const V2_VAULT_DELETE_REQUEST_URL: &str = "/api/v2/vault/delete";

/// Vault Header content type
pub const V2_VAULT_HEADER_CONTENT_TYPE: &str = "application/json";

/// Header asking the vault for a plain (unencrypted) fingerprint response; the vault echoes it
/// when honoured
pub const V2_VAULT_FP_RESPONSE_ENCODING_HEADER: &str = "x-fp-response-encoding";

/// `x-fp-response-encoding` value for a plain JSON response
pub const V2_VAULT_FP_RESPONSE_ENCODING_PLAIN: &str = "plain";

/// Vault Add flow type
pub const V2_VAULT_ADD_FLOW_TYPE: &str = "add_to_vault";

/// Vault Retrieve flow type
pub const V2_VAULT_RETRIEVE_FLOW_TYPE: &str = "retrieve_from_vault";

/// Vault Delete flow type
pub const V2_VAULT_DELETE_FLOW_TYPE: &str = "delete_from_vault";

/// Vault Fingerprint fetch flow type
pub const V2_VAULT_GET_FINGERPRINT_FLOW_TYPE: &str = "get_fingerprint_vault";

/// Locker entity create request url
pub const LOCKER_ENTITY_CREATE_REQUEST_URL: &str = "/entity";

/// Locker entity create flow type
pub const LOCKER_ENTITY_CREATE_FLOW_TYPE: &str = "create_entity";

/// Max volume split for Dynamic routing
pub const DYNAMIC_ROUTING_MAX_VOLUME: u8 = 100;

/// Click To Pay
pub const CLICK_TO_PAY: &str = "click_to_pay";

/// Merchant eligible for authentication service config
pub const AUTHENTICATION_SERVICE_ELIGIBLE_CONFIG: &str =
    "merchants_eligible_for_authentication_service";

/// Payment flow identifier used for performing GSM operations
pub const PAYMENT_FLOW_STR: &str = "Payment";

/// Redis key prefix for client session storage
pub(crate) const CLIENT_SESSION_KEY_PREFIX: &str = "client_session";

/// Default subflow identifier used for performing GSM operations
pub const DEFAULT_SUBFLOW_STR: &str = "sub_flow";

/// Refund flow identifier used for performing GSM operations
pub const REFUND_FLOW_STR: &str = "refund_flow";

/// Minimum IBAN length (country-dependent), as per ISO 13616 standard
pub const IBAN_MIN_LENGTH: usize = 15;

/// Maximum IBAN length defined by the ISO 13616 standard (standard max)
pub const IBAN_MAX_LENGTH: usize = 34;

/// Minimum UK BACS account number length in digits
pub const BACS_MIN_ACCOUNT_NUMBER_LENGTH: usize = 6;

/// Maximum UK BACS account number length in digits
pub const BACS_MAX_ACCOUNT_NUMBER_LENGTH: usize = 8;

/// Fixed length of UK BACS sort code in digits (always 6)
pub const BACS_SORT_CODE_LENGTH: usize = 6;

/// Exact length of Polish Elixir system domestic account number (NRB) in digits
pub const ELIXIR_ACCOUNT_NUMBER_LENGTH: usize = 26;

/// Total length of Polish IBAN including country code and checksum (28 characters)
pub const ELIXIR_IBAN_LENGTH: usize = 28;

/// Minimum length of Swedish Bankgiro number in digits
pub const BANKGIRO_MIN_LENGTH: usize = 7;

/// Maximum length of Swedish Bankgiro number in digits
pub const BANKGIRO_MAX_LENGTH: usize = 8;

/// Minimum length of Swedish Plusgiro number in digits
pub const PLUSGIRO_MIN_LENGTH: usize = 2;

/// Maximum length of Swedish Plusgiro number in digits
pub const PLUSGIRO_MAX_LENGTH: usize = 8;

/// Default payment method session expiry
pub const DEFAULT_PAYMENT_METHOD_SESSION_EXPIRY: u32 = 15 * 60; // 15 minutes

/// Authorize flow identifier used for performing GSM operations
pub const AUTHORIZE_FLOW_STR: &str = "Authorize";

/// Protocol Version for encrypted Google Pay Token
pub(crate) const PROTOCOL: &str = "ECv2";

/// Sender ID for Google Pay Decryption
pub(crate) const SENDER_ID: &[u8] = b"Google";

/// Prefix of the recipient identifier Google signs a gateway tokenized card against, i.e.
/// `gateway:<gateway id>`. Used by the `INTERNAL_GATEWAY` google pay flow, which derives the
/// recipient from configuration instead of taking it from the merchant.
pub(crate) const GOOGLE_PAY_GATEWAY_RECIPIENT_PREFIX: &str = "gateway:";

/// Default value for the number of attempts to retry fetching forex rates
pub const DEFAULT_ANALYTICS_FOREX_RETRY_ATTEMPTS: u64 = 3;

/// Default payment intent id
pub const IRRELEVANT_PAYMENT_INTENT_ID: &str = "irrelevant_payment_intent_id";

/// Default payment attempt id
pub const IRRELEVANT_PAYMENT_ATTEMPT_ID: &str = "irrelevant_payment_attempt_id";

pub static PROFILE_ID_UNAVAILABLE: sync::LazyLock<id_type::ProfileId> = sync::LazyLock::new(|| {
    #[allow(clippy::expect_used)]
    id_type::ProfileId::from_str("PROFILE_ID_UNAVAILABLE")
        .expect("Failed to parse PROFILE_ID_UNAVAILABLE")
});

/// Default payment attempt id
pub const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID: &str =
    "irrelevant_connector_request_reference_id";

// Default payment method storing TTL in redis in seconds
pub const DEFAULT_PAYMENT_METHOD_STORE_TTL: i64 = 86400; // 1 day

/// Redis key prefix for the merchant-scoped card fingerprint, which is never persisted
pub const MERCHANT_FINGERPRINT_REDIS_PREFIX: &str = "merchant_fingerprint";

/// How long a merchant-scoped card fingerprint stays retrievable after the card was last vaulted
pub const MERCHANT_FINGERPRINT_TTL: i64 = 86400; // 1 day

// Countries and separately encoded territories where PSD2 or the equivalent UK
// strong customer authentication rules apply.
pub const SCA_MANDATED_COUNTRIES: [Country; 39] = [
    Country::Austria,
    Country::Belgium,
    Country::Bulgaria,
    Country::Croatia,
    Country::Cyprus,
    Country::Czechia,
    Country::Denmark,
    Country::Estonia,
    Country::Finland,
    Country::France,
    Country::Germany,
    Country::Greece,
    Country::Hungary,
    Country::Ireland,
    Country::Italy,
    Country::Latvia,
    Country::Lithuania,
    Country::Luxembourg,
    Country::Malta,
    Country::Netherlands,
    Country::Poland,
    Country::Portugal,
    Country::Romania,
    Country::Slovakia,
    Country::Slovenia,
    Country::Spain,
    Country::Sweden,
    // EEA/EFTA states where PSD2 applies
    Country::Iceland,
    Country::Liechtenstein,
    Country::Norway,
    // EU territories represented separately by the Country enum
    Country::AlandIslands,
    Country::FrenchGuiana,
    Country::Guadeloupe,
    Country::Martinique,
    Country::Mayotte,
    Country::Reunion,
    Country::SaintMartinFrenchpart,
    // Jurisdictions covered by the equivalent UK SCA regime
    Country::UnitedKingdomOfGreatBritainAndNorthernIreland,
    Country::Gibraltar,
];

// Rollout percentage config prefix
pub const UCS_ROLLOUT_PERCENT_CONFIG_PREFIX: &str = "ucs_rollout_config";

// Sentinel value cached when a rollout config key is absent, so subsequent lookups
// skip the DB entirely instead of hitting it on every cache miss.
pub const UCS_ROLLOUT_CONFIG_NOT_CONFIGURED: &str = "not_configured";

// UCS feature enabled config
pub const UCS_ENABLED: &str = "ucs_enabled";

// Prefix of the redis key holding a kill switch trip. Absent until a scope trips.
pub const UCS_KILL_SWITCH_REDIS_PREFIX: &str = "ucs_kill_switch";

// Lifetime of a trip, in seconds. A trip is meant to be cleared by an operator, but
// `redis_interface` has no setter that writes a key without an expiry, so it is spelled as a
// bound rather than left open. A week outlives a long weekend; a still-broken scope trips again
// on its next request.
pub const UCS_KILL_SWITCH_TTL_IN_SECONDS: i64 = 7 * 24 * 60 * 60;
/// Global request-failure counter shared by all shadow traffic and pods.
pub const UCS_SHADOW_KILL_SWITCH_REDIS_KEY: &str = "ucs_shadow_killed";
/// Shadow failures expire 24 hours after the latest counter increment.
pub const UCS_SHADOW_KILL_SWITCH_TTL_IN_SECONDS: i64 = 24 * 60 * 60;

/// Header value indicating that signature-key-based authentication is used.
pub const UCS_AUTH_SIGNATURE_KEY: &str = "signature-key";

/// Header value indicating that body-key-based authentication is used.
pub const UCS_AUTH_BODY_KEY: &str = "body-key";

/// Header value indicating that header-key-based authentication is used.
pub const UCS_AUTH_HEADER_KEY: &str = "header-key";

/// Header value indicating that multi-key-based authentication is used.
pub const UCS_AUTH_MULTI_KEY: &str = "multi-auth-key";

/// Header value indicating that currency-auth-key-based authentication is used.
pub const UCS_AUTH_CURRENCY_AUTH_KEY: &str = "currency-auth-key";

/// Header value indicating that no credentials are required (e.g. external-3DS
/// over VGS where mTLS is handled on the outbound proxy route, not by UCS).
pub const UCS_AUTH_NO_KEY: &str = "no-key";

/// Form field name for challenge request during creq submission
pub const CREQ_CHALLENGE_REQUEST_KEY: &str = "creq";

/// `RedirectForm::Form.form_fields` keys UCS's Netcetera integration uses to carry 3DS Method
/// (DDC) data — there's no typed proto slot for it, so connector-service stuffs it into the same
/// generic form-fields map used for the challenge (see its `netcetera/transformers.rs`, the
/// `form_fields.insert("threeDsMethodData"/"threeDsMethodUrl", ...)` call).
pub const UCS_DDC_METHOD_DATA_KEY: &str = "threeDsMethodData";
pub const UCS_DDC_METHOD_URL_KEY: &str = "threeDsMethodUrl";

/// Superposition configuration keys
pub mod superposition {
    /// Offer Engine master gate key: boolean, `false` (default) disables all Offer Engine calls.
    pub const OFFER_ENGINE_ENABLED: &str = "offer_engine.enabled";
    /// Offer Engine credential source key: `"none"` skips Offer Engine, `"application"` uses the static app config, `"merchant"` uses per-merchant credentials.
    pub const OFFER_ENGINE_CREDENTIAL_SOURCE: &str = "offer_engine.credential_source";
    /// Merchant integration type key: `"client"` (default), `"server"` or `"client_and_server"`. The `X-Integration-Type` header on payment requests must match it.
    pub const MERCHANT_INTEGRATION_TYPE: &str = "system.payment_integration_type";
    /// Account Updater master gate key: `false` (default) disables all Account Updater calls.
    pub const ACCOUNT_UPDATER_ENABLED: &str = "account_updater.enabled";
    /// Account Updater credential source key: `"none"` skips Account Updater, `"application"` uses the static application config.
    pub const ACCOUNT_UPDATER_CREDENTIAL_SOURCE: &str = "account_updater.credential_source";
    /// CVV requirement configuration key
    pub const REQUIRES_CVV: &str = "payments.requires_cvv";
    /// Allow payment method data to be collected internally for follow-up payment operations
    pub const ALLOW_PAYMENT_METHOD_DATA_COLLECTION: &str =
        "system.allow_payment_method_data_collection";
    /// implicit customer update configuration key
    pub const IMPLICIT_CUSTOMER_UPDATE: &str = "payments.implicit_customer_update";
    /// Blocklist guard configuration key: when true, payments are screened against the merchant's blocklist
    pub const PAYMENT_BLOCKLIST_GUARD: &str = "payments.payment_blocklist_guard";
    /// Card testing guard configuration key
    pub const CARD_TESTING_GUARD_CONFIG: &str = "payments.card_testing_guard_config";
    /// Organization-scoped block implicit customer creation configuration key
    pub const BLOCK_IMPLICIT_CUSTOMER_CREATION: &str = "payments.block_implicit_customer_creation";
    /// Resolve the `customer_id` of a payments request through the `merchant_reference_id` of the
    /// customer (created via the v2 customers API) instead of the `customer_id` column
    pub const USE_MERCHANT_REFERENCE_ID_AS_CUSTOMER_ID: &str =
        "payments.use_merchant_reference_id_as_customer_id";
    /// Fingerprint secret configuration key retained for migration fallback
    pub const FINGERPRINT_SECRET: &str = "vaulting.fingerprint_secret";
    /// Poll config for external 3DS authentication key
    pub const POLL_CONFIG_EXTERNAL_THREE_DS: &str = "payments.poll_config_external_three_ds";
    /// Outgoing webhook retry process tracker mapping key
    pub const PT_MAPPING_OUTGOING_WEBHOOKS: &str = "process_tracker.pt_mapping_outgoing_webhooks";
    /// Outgoing connector webhook retry process tracker mapping key
    pub const PT_MAPPING_OUTGOING_CONNECTOR_WEBHOOKS: &str =
        "pt_mapping_outgoing_connector_webhooks";
    /// PCR (Revenue Recovery) payments retry process tracker mapping key
    pub const PT_MAPPING_PCR_RETRIES: &str = "process_tracker.pt_mapping_pcr_retries";
    /// Static ladder process tracker mapping used by the adaptive revenue recovery retry
    /// algorithm, kept separate from the cascading ladder so the two can be tuned independently
    pub const PT_MAPPING_ADAPTIVE_RETRIES: &str = "process_tracker.pt_mapping_adaptive_retries";
    /// Revenue Recovery retry-stats key. Enables recording of retry outcome stats
    pub const REVREC_RETRY_STATS_ENABLED: &str = "revenue_recovery.retry_stats.enabled";
    /// Whether the adaptive revenue recovery retry algorithm — static ladder combined with
    /// the smart algorithm — replaces the decider-based smart retry implementation
    pub const ADAPTIVE_RETRY_ENABLED: &str = "revenue_recovery.adaptive_retry_enabled";
    /// Whether a retry may be made with any of the customer's cards stored in redis, rather than
    /// only the card the invoice last used — whichever algorithm decides when it runs
    pub const CARD_SWITCHING_ENABLED: &str = "revenue_recovery.card_switching_enabled";
    /// Whether A/B routing decides which retry implementation an invoice runs.
    pub const REVENUE_RECOVERY_AB_ENABLED: &str = "revenue_recovery.ab_enabled";
    /// Which retry implementation inside the `Smart` arm an invoice runs under A/B routing.
    pub const REVENUE_RECOVERY_AB_ALGORITHM: &str = "revenue_recovery.ab_algorithm";
    /// Days from the first attempt during which an invoice may still be retried
    pub const RECOVERY_GRACE_PERIOD_DAYS: &str = "revenue_recovery.grace_period_days";
    /// Total retries an invoice is allowed across its whole recovery lifecycle
    pub const RECOVERY_MAX_RETRY_COUNT: &str = "revenue_recovery.max_retry_count";
    /// Positions on the static ladder available to an invoice under the hybrid static + adaptive
    /// scheme. Controlled internally rather than by merchants, for both trigger models
    pub const RECOVERY_MAX_HYBRID_CASCADING_RETRY_COUNT: &str =
        "revenue_recovery.max_hybrid_cascading_retry_count";
    /// Payment sync (psync) retry process tracker mapping key
    pub const PT_MAPPING_PAYMENT_SYNC: &str = "process_tracker.pt_mapping_payment_sync";
    /// Refund sync retry process tracker mapping key
    pub const PT_MAPPING_REFUND_SYNC: &str = "process_tracker.pt_mapping_refund_sync";
    /// Dispute sync retry process tracker mapping key
    pub const PT_MAPPING_DISPUTE_SYNC: &str = "process_tracker.pt_mapping_dispute_sync";
    /// GSM (Global Status Map) call configuration key
    pub const SHOULD_CALL_GSM: &str = "payments.should_call_gsm";
    /// Eligibility check configuration key
    pub const SHOULD_PERFORM_ELIGIBILITY: &str = "payments.should_perform_eligibility";
    /// MIT with limited card data configuration key
    pub const SHOULD_ENABLE_MIT_WITH_LIMITED_CARD_DATA: &str =
        "payments.should_enable_mit_with_limited_card_data";
    /// Prefer the request's billing address over the billing stored on a saved payment method
    pub const SHOULD_PREFER_REQUEST_BILLING_OVER_SAVED_PM_BILLING: &str =
        "payments.should_prefer_request_billing_over_saved_pm_billing";
    /// Store eligibility check data for authentication configuration key
    pub const SHOULD_STORE_ELIGIBILITY_CHECK_DATA_FOR_AUTHENTICATION: &str =
        "payments.should_store_eligibility_check_data_for_authentication";
    /// Extended card BIN configuration key
    pub const ENABLE_EXTENDED_CARD_BIN: &str = "payments.enable_extended_card_bin";
    /// Max auto payout retries configuration key
    pub const MAX_AUTO_PAYOUT_RETRIES: &str = "payouts.max_auto_payout_retries";
    /// Stops payout creation, confirmation, update, cancellation, and fulfillment at OMP scope.
    pub const PAYOUT_KILL_SWITCH: &str = "payouts.kill_switch";
    /// Minimum allowed payout amount configuration key
    pub const PAYOUT_MIN_AMOUNT: &str = "payouts.min_amount";
    /// Maximum allowed payout amount configuration key
    pub const PAYOUT_MAX_AMOUNT: &str = "payouts.max_amount";
    /// GSM payout call configuration key (scoped by merchant, profile, and payout retry type)
    pub const GSM_PAYOUT_CALL: &str = "payouts.gsm_payout_call";
    /// Disable vault tokenization configuration key
    pub const SHOULD_DISABLE_VAULT_TOKENIZATION: &str =
        "vaulting.should_disable_vault_tokenization";
    /// Authentication service eligibility configuration key (org and merchant scoped, org takes precedence)
    pub const SHOULD_ENABLE_AUTHENTICATION_SERVICE: &str =
        "system.should_enable_authentication_service";
    /// Return raw payment method details configuration key
    pub const SHOULD_RETURN_RAW_PAYMENT_METHOD_DETAILS: &str =
        "payments.should_return_raw_payment_method_details";
    /// Call PM modular service configuration key
    pub const SHOULD_CALL_PM_MODULAR_SERVICE: &str = "system.should_call_pm_modular_service";
    /// Schedule PM modular forward compatibility PT configuration key
    pub const SHOULD_SCHEDULE_MODULAR_FORWARD_COMPAT: &str =
        "system.should_schedule_modular_forward_compat";
    /// Schedule PM modular backward compatibility PT configuration key
    pub const SHOULD_SCHEDULE_MODULAR_BACKWARD_COMPAT: &str =
        "system.should_schedule_modular_backward_compat";
    /// Trigger PM modular backward compatibility inline configuration key
    pub const SHOULD_TRIGGER_BACKWARDS_COMPATIBILITY_INLINE: &str =
        "system.should_trigger_backwards_compatibility_inline";
    /// Payment method integration type configuration key
    pub const PAYMENT_METHOD_INTEGRATION_TYPE: &str = "system.payment_method_integration_type";
    /// Trigger fingerprint migration configuration key
    pub const SHOULD_TRIGGER_FINGERPRINT_MIGRATION: &str =
        "vaulting.should_trigger_fingerprint_migration";
    /// Merchant-scoped payment method fingerprint configuration key (org and merchant scoped).
    /// When enabled, vaulting a card also derives a merchant-keyed fingerprint for it.
    pub const SHOULD_GENERATE_MERCHANT_SCOPED_PAYMENT_METHOD_FINGERPRINT: &str =
        "vaulting.should_generate_merchant_scoped_payment_method_fingerprint";
    /// Timeout (in seconds) for fetching a network token from the tokenization service during a
    /// payment configuration key
    pub const NETWORK_TOKEN_FETCH_TIMEOUT_IN_SECS: &str =
        "payments.network_token_fetch_timeout_in_secs";
    /// Perform SDK vaulting action configuration key. Acts as a merchant level override on top of
    /// `should_call_pm_modular_service`: defaults to `true` for all merchants and can be set to
    /// `false` for specific merchants to force the SDK to skip tokenization.
    pub const SHOULD_PERFORM_SDK_VAULTING: &str = "vaulting.should_perform_sdk_vaulting";
    /// Override applied future usage for merchant and payment method scoped contexts.
    pub const SHOULD_OVERRIDE_SETUP_FUTURE_USAGE_TO_OFF_SESSION: &str =
        "payments.should_override_setup_future_usage_to_off_session";
    /// dynamic fields configuration key for sdk config
    pub const DYNAMIC_FIELDS: &str = "dynamic_fields";
    /// payout sync tracker configuration key
    pub const PAYOUT_TRACKER_MAPPING: &str = "payouts.payout_tracker_mapping";
    /// client session validation enabled configuration key
    pub const CLIENT_SESSION_VALIDATION_ENABLED: &str = "client_session_validation_enabled";
    /// routing result source configuration key (selects between Hyperswitch and Decision Engine)
    pub const ROUTING_RESULT_SOURCE: &str = "routing.routing_result_source";
    /// 3DS routing region configuration key for UAS
    pub const THREEDS_ROUTING_REGION_UAS: &str = "routing.threeds_routing_region_uas";
    /// disabled webhook events configuration key per merchant and connector
    pub const INCOMING_WEBHOOK_DISABLED_EVENTS: &str = "webhooks.incoming_webhook_disabled_events";
    /// Allowed incoming webhook source IPs/CIDRs, keyed by connector.
    pub const INCOMING_WEBHOOK_ALLOWED_IP_RANGES: &str =
        "webhooks.incoming_webhooks_allowed_ip_ranges";
    /// Global incoming webhook IP verification kill switch, defaults to `false`.
    pub const INCOMING_WEBHOOK_IP_VERIFICATION_ENABLED: &str =
        "webhooks.incoming_webhooks_ip_verification_enabled";
    /// Whether incoming webhook mTLS verification is enabled, defaults to `false`.
    pub const INCOMING_WEBHOOK_MTLS_VERIFICATION_ENABLED: &str =
        "incoming_webhooks.mtls_verification_enabled";
    /// Whether unverified webhook rate limiting is enabled, defaults to `false`
    pub const UNVERIFIED_WEBHOOK_RATE_LIMIT_ENABLED: &str =
        "webhooks.unverified_webhook_rate_limit_enabled";
    /// Fixed window, in seconds, over which unverified webhooks are counted
    pub const UNVERIFIED_WEBHOOK_RATE_LIMIT_WINDOW_IN_SECS: &str =
        "webhooks.unverified_webhook_rate_limit_window_in_secs";
    /// Maximum unverified webhooks per merchant per window, defaults to 60, `0` disables the merchant level
    pub const UNVERIFIED_WEBHOOK_MERCHANT_RATE_LIMIT: &str =
        "webhooks.unverified_webhook_merchant_rate_limit";
    /// Maximum unverified webhooks per profile per window, `0` disables the profile level
    pub const UNVERIFIED_WEBHOOK_PROFILE_RATE_LIMIT: &str =
        "webhooks.unverified_webhook_profile_rate_limit";
    /// Maximum unverified webhooks per merchant connector account per window, `0` disables the merchant connector account level
    pub const UNVERIFIED_WEBHOOK_MERCHANT_CONNECTOR_ACCOUNT_RATE_LIMIT: &str =
        "webhooks.unverified_webhook_merchant_connector_account_rate_limit";
    /// save wallet decrypted data in locker
    pub const SAVE_WALLET_DECRYPTED_DATA: &str = "vaulting.save_wallet_decrypted_data";
    /// UCS rollout configuration key (contains RolloutConfig with percentage, URLs, etc.)
    pub const UCS_ROLLOUT_CONFIG: &str = "ucs.rollout_config";
    /// Global request-failure threshold for the UCS shadow kill switch.
    pub const UCS_SHADOW_KILL_SWITCH_THRESHOLD: &str = "ucs.shadow_kill_switch_threshold";
    /// UCS enabled configuration key (controls UCS mode: disabled, enabled, shadow_disabled)
    pub const UCS_ENABLED: &str = "ucs.enabled";
    /// checkout sdk configuration
    pub const CHECKOUT_SDK: &str = "checkout_sdk";
    /// Pre-FRM failure handling mode
    pub const PRE_FRM_FAILURE_MODE: &str = "frm.pre_frm_failure_mode";
    /// Payout FRM call configuration key
    pub const PAYOUT_FRM_CALL: &str = "payouts.payout_frm_call";
    /// Whether to rerun payout FRM before automatic retries, overridable by connector
    pub const RERUN_PAYOUT_FRM_BEFORE_AUTO_RETRY: &str =
        "payouts.rerun_payout_frm_before_auto_retry";
    /// Maximum number of card issuers a list request reads
    pub const CARD_ISSUER_LIST_MAX_LIMIT: &str = "card_issuer.list_max_limit";
    /// Preferred-connector routing enablement configuration key per profile
    pub const PREFERRED_CONNECTORS_ROUTING_ENABLED: &str =
        "routing.preferred_connectors_routing_enabled";
    /// Payment method types eligible for preferred-connectors routing (comma-separated)
    pub const PREFERRED_CONNECTORS_ENABLED_PAYMENT_METHOD_TYPES: &str =
        "routing.preferred_connectors_enabled_payment_method_types";
    /// Payout blocklist guard configuration key
    pub const PAYOUT_BLOCKLIST_GUARD: &str = "payouts.payout_blocklist_guard";
    /// Accept connector payment amount mismatch configuration key (scoped by processor merchant
    /// and payment method type). When enabled, a connector-reported payment amount that differs
    /// from the requested amount does not fail the integrity check. Refunds are not affected.
    pub const ACCEPT_PAYMENT_AMOUNT_MISMATCH: &str = "payments.accept_payment_amount_mismatch";
}

/// The value substituted for sensitive webhook header values in event retrieval responses.
pub const REDACTED_HEADER_VALUE: &str = "*** ***";

#[cfg(test)]
mod tests {
    #[test]
    fn test_profile_id_unavailable_initialization() {
        // Just access the lazy static to ensure it doesn't panic during initialization
        let _profile_id = super::PROFILE_ID_UNAVAILABLE.clone();
        // If we get here without panicking, the test passes
    }
}