    headers
        .get(&key)
        .map(|source_str| {
            source_str
                .to_str()
                .change_context(errors::ApiErrorResponse::InternalServerError)
                .attach_printable(format!(
                    "Failed to convert header value to string for header key: {key}",
                ))
        })
        .transpose()
}
pub fn get_id_type_by_key_from_headers<T: FromStr>(
    key: String,
    headers: &HeaderMap,
) -> RouterResult<Option<T>> {
    get_header_value_by_key(key.clone(), headers)?
        .map(|str_value| T::from_str(str_value))
        .transpose()
        .map_err(|_err| {
            error_stack::report!(errors::ApiErrorResponse::InvalidDataFormat {
                field_name: key,
                expected_format: "Valid Id String".to_string(),
            })
        })
}

pub fn get_jwt_from_authorization_header(headers: &HeaderMap) -> RouterResult<&str> {
    headers
        .get(headers::AUTHORIZATION)
        .get_required_value(headers::AUTHORIZATION)?
        .to_str()
        .change_context(errors::ApiErrorResponse::InternalServerError)
        .attach_printable("Failed to convert JWT token to string")?
        .strip_prefix("Bearer ")
        .ok_or(errors::ApiErrorResponse::InvalidJwtToken.into())
}

pub fn get_cookie_from_header(headers: &HeaderMap) -> RouterResult<&str> {
    let cookie = headers
        .get(cookies::get_cookie_header())
        .ok_or(report!(errors::ApiErrorResponse::CookieNotFound))?;

    cookie
        .to_str()
        .change_context(errors::ApiErrorResponse::InvalidCookie)
}

pub fn strip_jwt_token(token: &str) -> RouterResult<&str> {
    token
        .strip_prefix("Bearer ")
        .ok_or_else(|| errors::ApiErrorResponse::InvalidJwtToken.into())
}

pub fn auth_type<'a, T, A>(
    default_auth: &'a dyn AuthenticateAndFetch<T, A>,
    jwt_auth_type: &'a dyn AuthenticateAndFetch<T, A>,
    headers: &HeaderMap,
) -> &'a dyn AuthenticateAndFetch<T, A>
where
{
    if is_jwt_auth(headers) {
        return jwt_auth_type;
    }
    default_auth
}

#[cfg(feature = "recon")]
#[async_trait]
impl<A> AuthenticateAndFetch<AuthenticationDataWithUser, A> for JWTAuth
where
    A: SessionStateInfo + Sync,
{
    async fn authenticate_and_fetch(
        &self,
        request_headers: &HeaderMap,
        state: &A,
    ) -> RouterResult<(AuthenticationDataWithUser, AuthenticationType)> {
        let payload = parse_jwt_payload::<A, AuthToken>(request_headers, state).await?;
        if payload.check_in_blacklist(state).await? {
            return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
        }
        authorization::check_tenant(
            payload.tenant_id.clone(),
            &state.session_state().tenant.tenant_id,
        )?;
        let role_info = authorization::get_role_info(state, &payload).await?;
        authorization::check_permission(self.permission, &role_info)?;

        let key_manager_state = &(&state.session_state()).into();
        let key_store = state
            .store()
            .get_merchant_key_store_by_merchant_id(
                key_manager_state,
                &payload.merchant_id,
                &state.store().get_master_key().to_vec().into(),
            )
            .await
            .to_not_found_response(errors::ApiErrorResponse::InvalidJwtToken)
            .attach_printable("Failed to fetch merchant key store for the merchant id")?;

        let merchant = state
            .store()
            .find_merchant_account_by_merchant_id(
                key_manager_state,
                &payload.merchant_id,
                &key_store,
            )
            .await
            .to_not_found_response(errors::ApiErrorResponse::InvalidJwtToken)
            .attach_printable("Failed to fetch merchant account for the merchant id")?;

        let user_id = payload.user_id;

        let user = state
            .session_state()
            .global_store
            .find_user_by_id(&user_id)
            .await
            .to_not_found_response(errors::ApiErrorResponse::InvalidJwtToken)
            .attach_printable("Failed to fetch user for the user id")?;

        let auth = AuthenticationDataWithUser {
            merchant_account: merchant,
            key_store,
            profile_id: payload.profile_id.clone(),
            user,
        };

        let auth_type = AuthenticationType::MerchantJwt {
            merchant_id: auth.merchant_account.get_id().clone(),
            user_id: Some(user_id),
        };

        Ok((auth, auth_type))
    }
}

async fn get_connected_merchant_account<A>(
    state: &A,
    connected_merchant_id: id_type::MerchantId,
    platform_org_id: id_type::OrganizationId,
) -> RouterResult<domain::MerchantAccount>
where
    A: SessionStateInfo + Sync,
{
    let key_manager_state = &(&state.session_state()).into();
    let key_store = state
        .store()
        .get_merchant_key_store_by_merchant_id(
            key_manager_state,
            &connected_merchant_id,
            &state.store().get_master_key().to_vec().into(),
        )
        .await
        .to_not_found_response(errors::ApiErrorResponse::InvalidPlatformOperation)
        .attach_printable("Failed to fetch merchant key store for the merchant id")?;

    let connected_merchant_account = state
        .store()
        .find_merchant_account_by_merchant_id(key_manager_state, &connected_merchant_id, &key_store)
        .await
        .to_not_found_response(errors::ApiErrorResponse::InvalidPlatformOperation)
        .attach_printable("Failed to fetch merchant account for the merchant id")?;

    if platform_org_id != connected_merchant_account.organization_id {
        return Err(errors::ApiErrorResponse::InvalidPlatformOperation)
            .attach_printable("Access for merchant id Unauthorized");
    }

    Ok(connected_merchant_account)
}

async fn get_platform_merchant_account<A>(
    state: &A,
    request_headers: &HeaderMap,
    merchant_account: domain::MerchantAccount,
) -> RouterResult<(domain::MerchantAccount, Option<domain::MerchantAccount>)>
where
    A: SessionStateInfo + Sync,
{
    let connected_merchant_id =
        get_and_validate_connected_merchant_id(request_headers, &merchant_account)?;

    match connected_merchant_id {
        Some(merchant_id) => {
            let connected_merchant_account = get_connected_merchant_account(
                state,
                merchant_id,
                merchant_account.organization_id.clone(),
            )
            .await?;
            Ok((connected_merchant_account, Some(merchant_account)))
        }
        None => Ok((merchant_account, None)),
    }
}

fn get_and_validate_connected_merchant_id(
    request_headers: &HeaderMap,
    merchant_account: &domain::MerchantAccount,
) -> RouterResult<Option<id_type::MerchantId>> {
    HeaderMapStruct::new(request_headers)
        .get_id_type_from_header_if_present::<id_type::MerchantId>(
            headers::X_CONNECTED_MERCHANT_ID,
        )?
        .map(|merchant_id| {
            (merchant_account.is_platform_account())
                .then_some(merchant_id)
                .ok_or(errors::ApiErrorResponse::InvalidPlatformOperation)
        })
        .transpose()
        .attach_printable("Non platform_merchant_account using X_CONNECTED_MERCHANT_ID header")
}

fn throw_error_if_platform_merchant_authentication_required(
    request_headers: &HeaderMap,
) -> RouterResult<()> {
    HeaderMapStruct::new(request_headers)
        .get_id_type_from_header_if_present::<id_type::MerchantId>(
            headers::X_CONNECTED_MERCHANT_ID,
        )?
        .map_or(Ok(()), |_| {
            Err(errors::ApiErrorResponse::PlatformAccountAuthNotSupported.into())
        })
}

#[cfg(feature = "recon")]
#[async_trait]
impl<A> AuthenticateAndFetch<UserFromTokenWithRoleInfo, A> for JWTAuth
where
    A: SessionStateInfo + Sync,
{
    async fn authenticate_and_fetch(
        &self,
        request_headers: &HeaderMap,
        state: &A,
    ) -> RouterResult<(UserFromTokenWithRoleInfo, AuthenticationType)> {
        let payload = parse_jwt_payload::<A, AuthToken>(request_headers, state).await?;
        if payload.check_in_blacklist(state).await? {
            return Err(errors::ApiErrorResponse::InvalidJwtToken.into());
        }
        authorization::check_tenant(
            payload.tenant_id.clone(),
            &state.session_state().tenant.tenant_id,
        )?;
        let role_info = authorization::get_role_info(state, &payload).await?;
        authorization::check_permission(self.permission, &role_info)?;

        let user = UserFromToken {
            user_id: payload.user_id.clone(),
            merchant_id: payload.merchant_id.clone(),
            org_id: payload.org_id,
            role_id: payload.role_id,
            profile_id: payload.profile_id,
            tenant_id: payload.tenant_id,
        };

        Ok((
            UserFromTokenWithRoleInfo { user, role_info },
            AuthenticationType::MerchantJwt {
                merchant_id: payload.merchant_id,
                user_id: Some(payload.user_id),
            },
        ))
    }
}

#[cfg(feature = "recon")]
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ReconToken {
    pub user_id: String,
    pub merchant_id: id_type::MerchantId,
    pub role_id: String,
    pub exp: u64,
    pub org_id: id_type::OrganizationId,
    pub profile_id: id_type::ProfileId,
    pub tenant_id: Option<id_type::TenantId>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub acl: Option<String>,
}

#[cfg(all(feature = "olap", feature = "recon"))]
impl ReconToken {
    pub async fn new_token(
        user_id: String,
        merchant_id: id_type::MerchantId,
        settings: &Settings,
        org_id: id_type::OrganizationId,
        profile_id: id_type::ProfileId,
        tenant_id: Option<id_type::TenantId>,
        role_info: authorization::roles::RoleInfo,
    ) -> UserResult<String> {
        let exp_duration = std::time::Duration::from_secs(consts::JWT_TOKEN_TIME_IN_SECS);
        let exp = jwt::generate_exp(exp_duration)?.as_secs();
        let acl = role_info.get_recon_acl();
        let optional_acl_str = serde_json::to_string(&acl)
            .inspect_err(|err| logger::error!("Failed to serialize acl to string: {}", err))
            .change_context(errors::UserErrors::InternalServerError)
            .attach_printable("Failed to serialize acl to string. Using empty ACL")
            .ok();
        let token_payload = Self {
            user_id,
            merchant_id,
            role_id: role_info.get_role_id().to_string(),
            exp,
            org_id,
            profile_id,
            tenant_id,
            acl: optional_acl_str,
        };
        jwt::generate_jwt(&token_payload, settings).await
    }
}
#[derive(serde::Serialize, serde::Deserialize)]
pub struct ExternalToken {
    pub user_id: String,
    pub merchant_id: id_type::MerchantId,
    pub exp: u64,
    pub external_service_type: ExternalServiceType,
}

impl ExternalToken {
    pub async fn new_token(
        user_id: String,
        merchant_id: id_type::MerchantId,
        settings: &Settings,
        external_service_type: ExternalServiceType,
    ) -> UserResult<String> {
        let exp_duration = std::time::Duration::from_secs(consts::JWT_TOKEN_TIME_IN_SECS);
        let exp = jwt::generate_exp(exp_duration)?.as_secs();

        let token_payload = Self {
            user_id,
            merchant_id,
            exp,
            external_service_type,
        };
        jwt::generate_jwt(&token_payload, settings).await
    }

    pub fn check_service_type(
        &self,
        required_service_type: &ExternalServiceType,
    ) -> RouterResult<()> {
        Ok(fp_utils::when(
            &self.external_service_type != required_service_type,
            || {
                Err(errors::ApiErrorResponse::AccessForbidden {
                    resource: required_service_type.to_string(),
                })
            },
        )?)
    }
}


// Struct: Card
// File: crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct Card


// Function: get_role_name
// File: crates/router/src/services/authorization/roles.rs
// Module: router

pub fn get_role_name(&self) -> &str


// Struct: PaymentService
// File: crates/hyperswitch_connectors/src/connectors/worldpayxml/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct PaymentService


// Function: get_disputes_filters_profile
// File: crates/router/src/routes/disputes.rs
// Module: router

pub fn get_disputes_filters_profile(
    state: web::Data<AppState>,
    req: HttpRequest,
) -> HttpResponse


// Function: make_dsl_input_for_payouts
// File: crates/router/src/core/payments/routing.rs
// Module: router

pub fn make_dsl_input_for_payouts(
    payout_data: &payouts::PayoutData,
) -> RoutingResult<dsl_inputs::BackendInput>


// Function: update_payout_link
// File: crates/diesel_models/src/query/generic_link.rs
// Module: diesel_models

pub fn update_payout_link(
        self,
        conn: &PgPooledConn,
        payout_link_update: PayoutLinkUpdate,
    ) -> StorageResult<Self>


// Function: add_certificate
// File: crates/common_utils/src/request.rs
// Module: common_utils

pub fn add_certificate(&mut self, certificate: Option<Secret<String>>)


// Implementation: impl ApiEventMetric for for ApplicationResponse
// File: crates/hyperswitch_domain_models/src/api.rs
// Module: hyperswitch_domain_models
// Methods: 1 total (0 public)

impl ApiEventMetric for for ApplicationResponse


// Struct: ConnectorPostAuthenticationRequestData
// File: crates/hyperswitch_domain_models/src/router_request_types/authentication.rs
// Module: hyperswitch_domain_models
// Implementations: 0

pub struct ConnectorPostAuthenticationRequestData


// Struct: NoonApplePaymentData
// File: crates/hyperswitch_connectors/src/connectors/noon/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct NoonApplePaymentData


// Implementation: impl api::MandateSetup for for Nordea
// File: crates/hyperswitch_connectors/src/connectors/nordea.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::MandateSetup for for Nordea


    connectors::Deutschebank,
    connectors::Digitalvirgo,
    connectors::Dlocal,
    connectors::Dwolla,
    connectors::Ebanx,
    connectors::Elavon,
    connectors::Facilitapay,
    connectors::Finix,
    connectors::Fiserv,
    connectors::Fiservemea,
    connectors::Fiuu,
    connectors::Flexiti,
    connectors::Forte,
    connectors::Getnet,
    connectors::Gigadat,
    connectors::Globalpay,
    connectors::Globepay,
    connectors::Gocardless,
    connectors::Gpayments,
    connectors::Helcim,
    connectors::Hipay,
    connectors::Iatapay,
    connectors::Inespay,
    connectors::Itaubank,
    connectors::Juspaythreedsserver,
    connectors::Katapult,
    connectors::Jpmorgan,
    connectors::Klarna,
    connectors::Loonio,
    connectors::Netcetera,
    connectors::Nordea,
    connectors::Nomupay,
    connectors::Nmi,
    connectors::Noon,
    connectors::Novalnet,
    connectors::Nexinets,
    connectors::Nexixpay,
    connectors::Nuvei,
    connectors::Opayo,
    connectors::Opennode,
    connectors::Payeezy,
    connectors::Payload,
    connectors::Paystack,
    connectors::Paytm,
    connectors::Payu,
    connectors::Peachpayments,
    connectors::Phonepe,
    connectors::Paypal,
    connectors::Paysafe,
    connectors::Plaid,
    connectors::Powertranz,
    connectors::Prophetpay,
    connectors::Mifinity,
    connectors::Mollie,
    connectors::Moneris,
    connectors::Mpgs,
    connectors::Multisafepay,
    connectors::Paybox,
    connectors::Payme,
    connectors::Payone,
    connectors::Placetopay,
    connectors::Rapyd,
    connectors::Razorpay,
    connectors::Recurly,
    connectors::Redsys,
    connectors::Riskified,
    connectors::Santander,
    connectors::Signifyd,
    connectors::Shift4,
    connectors::Sift,
    connectors::Silverflow,
    connectors::Stax,
    connectors::Stripe,
    connectors::Stripebilling,
    connectors::Square,
    connectors::Taxjar,
    connectors::Tesouro,
    connectors::Threedsecureio,
    connectors::Thunes,
    connectors::Tokenex,
    connectors::Tokenio,
    connectors::Trustpay,
    connectors::Trustpayments,
    connectors::Tsys,
    connectors::UnifiedAuthenticationService,
    connectors::Wise,
    connectors::Worldline,
    connectors::Worldpay,
    connectors::Worldpayvantiv,
    connectors::Worldpayxml,
    connectors::Wellsfargo,
    connectors::Wellsfargopayout,
    connectors::Vgs,
    connectors::Volt,
    connectors::Xendit,
    connectors::Zen,
    connectors::Zsl
);

macro_rules! default_imp_for_connector_authentication_token {
    ($($path:ident::$connector:ident),*) => {
        $(
            impl ConnectorAuthenticationToken for $path::$connector {}
            impl
            ConnectorIntegration<
            AccessTokenAuthentication,
            AccessTokenAuthenticationRequestData,
            AccessTokenAuthenticationResponse,
        > for $path::$connector
        {}
    )*
    };
}

default_imp_for_connector_authentication_token!(
    connectors::Aci,
    connectors::Adyen,
    connectors::Adyenplatform,
    connectors::Affirm,
    connectors::Airwallex,
    connectors::Amazonpay,
    connectors::Archipel,
    connectors::Authipay,
    connectors::Authorizedotnet,
    connectors::Barclaycard,
    connectors::Bambora,
    connectors::Bamboraapac,
    connectors::Bankofamerica,
    connectors::Billwerk,
    connectors::Bitpay,
    connectors::Bluecode,
    connectors::Bluesnap,
    connectors::Blackhawknetwork,
    connectors::Boku,
    connectors::Braintree,
    connectors::Breadpay,
    connectors::Cashtocode,
    connectors::Celero,
    connectors::Chargebee,
    connectors::Checkbook,
    connectors::Checkout,
    connectors::Coinbase,
    connectors::Coingate,
    connectors::Cryptopay,
    connectors::CtpMastercard,
    connectors::Custombilling,
    connectors::Cybersource,
    connectors::Datatrans,
    connectors::Deutschebank,
    connectors::Digitalvirgo,
    connectors::Dlocal,
    connectors::Dwolla,
    connectors::Ebanx,
    connectors::Elavon,
    connectors::Facilitapay,
    connectors::Finix,
    connectors::Fiserv,
    connectors::Fiservemea,
    connectors::Fiuu,
    connectors::Flexiti,
    connectors::Forte,
    connectors::Getnet,
    connectors::Gigadat,
    connectors::Globalpay,
    connectors::Globepay,
    connectors::Gocardless,
    connectors::Gpayments,
    connectors::Helcim,
    connectors::Hipay,
    connectors::HyperswitchVault,
    connectors::Hyperwallet,
    connectors::Iatapay,
    connectors::Inespay,
    connectors::Itaubank,
    connectors::Juspaythreedsserver,
    connectors::Jpmorgan,
    connectors::Katapult,
    connectors::Klarna,
    connectors::Loonio,
    connectors::Mpgs,
    connectors::Netcetera,
    connectors::Nomupay,
    connectors::Nmi,
    connectors::Noon,
    connectors::Novalnet,
    connectors::Nexinets,
    connectors::Nexixpay,
    connectors::Nuvei,
    connectors::Opayo,
    connectors::Opennode,
    connectors::Payeezy,
    connectors::Payload,
    connectors::Paystack,
    connectors::Paytm,
    connectors::Payu,
    connectors::Peachpayments,
    connectors::Phonepe,
    connectors::Paypal,
    connectors::Paysafe,
    connectors::Plaid,
    connectors::Powertranz,
    connectors::Prophetpay,
    connectors::Mifinity,
    connectors::Mollie,
    connectors::Moneris,
    connectors::Multisafepay,
    connectors::Paybox,
    connectors::Payme,
    connectors::Payone,
    connectors::Placetopay,
    connectors::Rapyd,
    connectors::Razorpay,
    connectors::Recurly,
    connectors::Redsys,
    connectors::Riskified,
    connectors::Santander,
    connectors::Sift,
    connectors::Signifyd,
    connectors::Shift4,
    connectors::Silverflow,
    connectors::Stax,
    connectors::Stripe,
    connectors::Stripebilling,
    connectors::Square,
    connectors::Taxjar,
    connectors::Tesouro,
    connectors::Threedsecureio,
    connectors::Thunes,
    connectors::Tokenex,
    connectors::Tokenio,
    connectors::Trustpay,
    connectors::Trustpayments,
    connectors::Tsys,
    connectors::UnifiedAuthenticationService,
    connectors::Wise,
    connectors::Worldline,
    connectors::Worldpay,
    connectors::Worldpayvantiv,
    connectors::Worldpayxml,
    connectors::Wellsfargo,
    connectors::Vgs,
    connectors::Volt,
    connectors::Xendit,
    connectors::Zen,
    connectors::Zsl
);

macro_rules! default_imp_for_external_vault_proxy_payments_create {
    ($($path:ident::$connector:ident),*) => {
        $(
            impl ExternalVaultProxyPaymentsCreateV1 for $path::$connector {}
            impl
            ConnectorIntegration<
            ExternalVaultProxy,
            ExternalVaultProxyPaymentsData,
            PaymentsResponseData,
        > for $path::$connector
        {}
    )*
    };
}

default_imp_for_external_vault_proxy_payments_create!(
    connectors::Aci,
    connectors::Adyen,
    connectors::Adyenplatform,
    connectors::Affirm,
    connectors::Airwallex,
    connectors::Amazonpay,
    connectors::Archipel,
    connectors::Authipay,
    connectors::Authorizedotnet,
    connectors::Bambora,
    connectors::Bamboraapac,
    connectors::Bankofamerica,
    connectors::Barclaycard,
    connectors::Billwerk,
    connectors::Bitpay,
    connectors::Blackhawknetwork,
    connectors::Bluecode,
    connectors::Bluesnap,
    connectors::Braintree,
    connectors::Breadpay,
    connectors::Boku,
    connectors::Cashtocode,
    connectors::Celero,
    connectors::Chargebee,
    connectors::Checkbook,
    connectors::Checkout,
    connectors::Coinbase,
    connectors::Coingate,
    connectors::Cryptopay,
    connectors::Custombilling,
    connectors::Cybersource,
    connectors::Datatrans,
    connectors::Deutschebank,
    connectors::Digitalvirgo,
    connectors::Dlocal,
    connectors::Dwolla,
    connectors::Ebanx,
    connectors::Elavon,
    connectors::Facilitapay,
    connectors::Finix,
    connectors::Fiserv,
    connectors::Fiservemea,
    connectors::Fiuu,
    connectors::Flexiti,
    connectors::Forte,
    connectors::Getnet,
    connectors::Gigadat,
    connectors::Globalpay,
    connectors::Globepay,
    connectors::Gocardless,
    connectors::Gpayments,
    connectors::Hipay,
    connectors::Helcim,
    connectors::HyperswitchVault,
    connectors::Hyperwallet,
    connectors::Iatapay,
    connectors::Inespay,
    connectors::Itaubank,
    connectors::Jpmorgan,
    connectors::Juspaythreedsserver,
    connectors::Katapult,
    connectors::Klarna,
    connectors::Loonio,
    connectors::Mifinity,
    connectors::Mollie,
    connectors::Moneris,
    connectors::Mpgs,
    connectors::Multisafepay,
    connectors::Netcetera,
    connectors::Nmi,
    connectors::Nomupay,
    connectors::Noon,
    connectors::Nordea,
    connectors::Novalnet,
    connectors::Nexinets,
    connectors::Nexixpay,
    connectors::Opayo,
    connectors::Opennode,
    connectors::Nuvei,
    connectors::Paybox,
    connectors::Payeezy,
    connectors::Payload,
    connectors::Payme,
    connectors::Payone,
    connectors::Paypal,
    connectors::Paysafe,
    connectors::Paystack,
    connectors::Paytm,
    connectors::Payu,
    connectors::Peachpayments,
    connectors::Phonepe,
    connectors::Placetopay,
    connectors::Plaid,
    connectors::Powertranz,
    connectors::Prophetpay,
    connectors::Rapyd,
    connectors::Razorpay,
    connectors::Recurly,
    connectors::Redsys,
    connectors::Riskified,
    connectors::Santander,
    connectors::Shift4,
    connectors::Sift,
    connectors::Silverflow,
    connectors::Signifyd,
    connectors::Stax,
    connectors::Square,
    connectors::Stripe,
    connectors::Stripebilling,
    connectors::Taxjar,
    connectors::Tesouro,
    connectors::Threedsecureio,
    connectors::Thunes,
    connectors::Tokenex,
    connectors::Tokenio,
    connectors::Trustpay,
    connectors::Trustpayments,
    connectors::Tsys,
    connectors::UnifiedAuthenticationService,
    connectors::Wise,
    connectors::Worldline,
    connectors::Worldpay,
    connectors::Worldpayvantiv,
    connectors::Worldpayxml,
    connectors::Wellsfargo,
    connectors::Wellsfargopayout,
    connectors::Vgs,
    connectors::Volt,
    connectors::Xendit,
    connectors::Zen,
    connectors::Zsl,
    connectors::CtpMastercard
);

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentsCompleteAuthorize for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<CompleteAuthorize, CompleteAuthorizeData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorVerifyWebhookSource for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        VerifyWebhookSource,
        VerifyWebhookSourceRequestData,
        VerifyWebhookSourceResponseData,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorCustomer for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<CreateConnectorCustomer, ConnectorCustomerData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorRedirectResponse for connectors::DummyConnector<T> {
    fn get_flow_type(
        &self,
        _query_params: &str,
        _json_payload: Option<serde_json::Value>,
        _action: PaymentAction,
    ) -> CustomResult<CallConnectorAction, ConnectorError> {
        Ok(CallConnectorAction::Trigger)
    }
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorTransactionId for connectors::DummyConnector<T> {}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> Dispute for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> AcceptDispute for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Accept, AcceptDisputeRequestData, AcceptDisputeResponse>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> FileUpload for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> UploadFile for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Upload, UploadFileRequestData, UploadFileResponse>
    for connectors::DummyConnector<T>
{
}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> RetrieveFile for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Retrieve, RetrieveFileRequestData, RetrieveFileResponse>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> SubmitEvidence for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Evidence, SubmitEvidenceRequestData, SubmitEvidenceResponse>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> DefendDispute for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Defend, DefendDisputeRequestData, DefendDisputeResponse>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> FetchDisputes for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Fetch, FetchDisputesRequestData, FetchDisputesResponse>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> DisputeSync for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Dsync, DisputeSyncData, DisputeSyncResponse>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentsGiftCardBalanceCheck for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        GiftCardBalanceCheck,
        GiftCardBalanceCheckRequestData,
        GiftCardBalanceCheckResponseData,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentsPreProcessing for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<PreProcessing, PaymentsPreProcessingData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentsPostProcessing for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<PostProcessing, PaymentsPostProcessingData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> api::Payouts for connectors::DummyConnector<T> {}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutCreate for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoCreate, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutSync for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoSync, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutEligibility for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoEligibility, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutFulfill for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoFulfill, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutCancel for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoCancel, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutQuote for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoQuote, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutRecipient for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoRecipient, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> PayoutRecipientAccount for connectors::DummyConnector<T> {}
#[cfg(feature = "payouts")]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<PoRecipientAccount, PayoutsData, PayoutsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentApprove for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Approve, PaymentsApproveData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentReject for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<Reject, PaymentsRejectData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}
#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> FraudCheck for connectors::DummyConnector<T> {}

#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> FraudCheckSale for connectors::DummyConnector<T> {}
#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> ConnectorIntegration<Sale, FraudCheckSaleData, FraudCheckResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> FraudCheckCheckout for connectors::DummyConnector<T> {}
#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> ConnectorIntegration<Checkout, FraudCheckCheckoutData, FraudCheckResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> FraudCheckTransaction for connectors::DummyConnector<T> {}
#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8>
    ConnectorIntegration<Transaction, FraudCheckTransactionData, FraudCheckResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> FraudCheckFulfillment for connectors::DummyConnector<T> {}
#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8>
    ConnectorIntegration<Fulfillment, FraudCheckFulfillmentData, FraudCheckResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8> FraudCheckRecordReturn for connectors::DummyConnector<T> {}
#[cfg(all(feature = "frm", feature = "dummy_connector"))]
impl<const T: u8>
    ConnectorIntegration<RecordReturn, FraudCheckRecordReturnData, FraudCheckResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentIncrementalAuthorization for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        IncrementalAuthorization,
        PaymentsIncrementalAuthorizationData,
        PaymentsResponseData,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorMandateRevoke for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<MandateRevoke, MandateRevokeRequestData, MandateRevokeResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ExternalAuthentication for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorPreAuthentication for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorPreAuthenticationVersionCall for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorAuthentication for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorPostAuthentication for connectors::DummyConnector<T> {}

#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        Authentication,
        ConnectorAuthenticationRequestData,
        AuthenticationResponseData,
    > for connectors::DummyConnector<T>
{
}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<PreAuthentication, PreAuthNRequestData, AuthenticationResponseData>
    for connectors::DummyConnector<T>
{
}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        PreAuthenticationVersionCall,
        PreAuthNRequestData,
        AuthenticationResponseData,
    > for connectors::DummyConnector<T>
{
}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        PostAuthentication,
        ConnectorPostAuthenticationRequestData,
        AuthenticationResponseData,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentAuthorizeSessionToken for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<AuthorizeSessionToken, AuthorizeSessionTokenData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> TaxCalculation for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<CalculateTax, PaymentsTaxCalculationData, TaxCalculationResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentSessionUpdate for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<SdkSessionUpdate, SdkPaymentsSessionUpdateData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentPostSessionTokens for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<PostSessionTokens, PaymentsPostSessionTokensData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentsCreateOrder for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<CreateOrder, CreateOrderRequestData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentUpdateMetadata for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<UpdateMetadata, PaymentsUpdateMetadataData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> PaymentPostCaptureVoid for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<PostCaptureVoid, PaymentsCancelPostCaptureData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> UasPreAuthentication for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> UnifiedAuthenticationService for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        PreAuthenticate,
        UasPreAuthenticationRequestData,
        UasAuthenticationResponseData,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> UasPostAuthentication for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        PostAuthenticate,
        UasPostAuthenticationRequestData,
        UasAuthenticationResponseData,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> UasAuthenticationConfirmation for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        AuthenticationConfirmation,
        UasConfirmationRequestData,
        UasAuthenticationResponseData,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> UasAuthentication for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<Authenticate, UasAuthenticationRequestData, UasAuthenticationResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> RevenueRecovery for connectors::DummyConnector<T> {}

#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> api::revenue_recovery::BillingConnectorPaymentsSyncIntegration
    for connectors::DummyConnector<T>
{
}
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        BillingConnectorPaymentsSync,
        BillingConnectorPaymentsSyncRequest,
        BillingConnectorPaymentsSyncResponse,
    > for connectors::DummyConnector<T>
{
}

#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> api::revenue_recovery::RevenueRecoveryRecordBack
    for connectors::DummyConnector<T>
{
}
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<InvoiceRecordBack, InvoiceRecordBackRequest, InvoiceRecordBackResponse>
    for connectors::DummyConnector<T>
{
}

#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
impl<const T: u8> BillingConnectorInvoiceSyncIntegration for connectors::DummyConnector<T> {}
#[cfg(all(feature = "v2", feature = "revenue_recovery"))]
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        BillingConnectorInvoiceSync,
        BillingConnectorInvoiceSyncRequest,
        BillingConnectorInvoiceSyncResponse,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ExternalVault for connectors::DummyConnector<T> {}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ExternalVaultInsert for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<ExternalVaultInsertFlow, VaultRequestData, VaultResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ExternalVaultRetrieve for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<ExternalVaultRetrieveFlow, VaultRequestData, VaultResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ExternalVaultDelete for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<ExternalVaultDeleteFlow, VaultRequestData, VaultResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ExternalVaultCreate for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorIntegration<ExternalVaultCreateFlow, VaultRequestData, VaultResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ConnectorAuthenticationToken for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        AccessTokenAuthentication,
        AccessTokenAuthenticationRequestData,
        AccessTokenAuthenticationResponse,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> ExternalVaultProxyPaymentsCreateV1 for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<ExternalVaultProxy, ExternalVaultProxyPaymentsData, PaymentsResponseData>
    for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> Subscriptions for connectors::DummyConnector<T> {}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> GetSubscriptionPlanPricesFlow for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        GetSubscriptionPlanPrices,
        GetSubscriptionPlanPricesRequest,
        GetSubscriptionPlanPricesResponse,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> GetSubscriptionPlansFlow for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        GetSubscriptionPlans,
        GetSubscriptionPlansRequest,
        GetSubscriptionPlansResponse,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> SubscriptionCreate for connectors::DummyConnector<T> {}

#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        SubscriptionCreateFlow,
        SubscriptionCreateRequest,
        SubscriptionCreateResponse,
    > for connectors::DummyConnector<T>
{
}

#[cfg(feature = "dummy_connector")]
impl<const T: u8> GetSubscriptionEstimateFlow for connectors::DummyConnector<T> {}
#[cfg(feature = "dummy_connector")]
impl<const T: u8>
    ConnectorIntegration<
        GetSubscriptionEstimate,
        GetSubscriptionEstimateRequest,
        GetSubscriptionEstimateResponse,
    > for connectors::DummyConnector<T>
{
}


// Implementation: impl PartialEq for for PaymentIntentMetricsBucketIdentifier
// File: crates/api_models/src/analytics/payment_intents.rs
// Module: api_models
// Methods: 1 total (0 public)

impl PartialEq for for PaymentIntentMetricsBucketIdentifier


// Struct: DieselArray
// File: crates/diesel_models/src/lib.rs
// Module: diesel_models
// Implementations: 0

pub struct DieselArray<T>


// File: crates/hyperswitch_connectors/src/connectors/nordea/responses.rs
// Module: hyperswitch_connectors
// Public structs: 16

use common_enums::CountryAlpha2;
use common_utils::types::StringMajorUnit;
use masking::Secret;
use serde::{Deserialize, Serialize};

use super::requests::{
    CreditorAccount, DebitorAccount, InstructedAmount, PaymentsUrgency, RecurringInformation,
    ThirdPartyMessages,
};

// OAuth token response structure
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct NordeaOAuthExchangeResponse {
    pub access_token: Option<Secret<String>>,
    pub expires_in: Option<i64>,
    pub refresh_token: Option<Secret<String>>,
    pub token_type: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub enum NordeaPaymentStatus {
    #[default]
    PendingConfirmation,
    PendingSecondConfirmation,
    PendingUserApproval,
    OnHold,
    Confirmed,
    Rejected,
    Paid,
    InsufficientFunds,
    LimitExceeded,
    UserApprovalFailed,
    UserApprovalTimeout,
    UserApprovalCancelled,
    Unknown,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaGroupHeader {
    /// Response creation time. Format: date-time.
    pub creation_date_time: Option<String>,
    /// HTTP code for response. Format: int32.
    pub http_code: Option<i32>,
    /// Original request id for correlation purposes
    pub message_identification: Option<String>,
    /// Details of paginated response
    pub message_pagination: Option<MessagePagination>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaResponseLinks {
    /// Describes the nature of the link, e.g. 'details' for a link to the detailed information of a listed resource.
    pub rel: Option<String>,
    /// Relative path to the linked resource
    pub href: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum FeesType {
    Additional,
    Standard,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct TransactionFee {
    /// Monetary amount
    pub amount: InstructedAmount,
    pub description: Option<String>,
    pub excluded_from_total_fee: Option<bool>,
    pub percentage: Option<bool>,
    #[serde(rename = "type")]
    pub fees_type: Option<FeesType>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct BankFee {
    /// Example 'domestic_transaction' only for DK domestic payments
    #[serde(rename = "_type")]
    pub bank_fee_type: Option<String>,
    /// Country code according to ISO Alpha-2
    pub country_code: Option<CountryAlpha2>,
    /// Currency code according to ISO 4217
    pub currency_code: Option<api_models::enums::Currency>,
    /// Value of the fee.
    pub value: Option<StringMajorUnit>,
    pub fees: Option<Vec<TransactionFee>>,
    /// Monetary amount
    pub total_fee_amount: InstructedAmount,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum ChargeBearer {
    Shar,
    Debt,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct ExchangeRate {
    pub base_currency: Option<api_models::enums::Currency>,
    pub exchange_currency: Option<api_models::enums::Currency>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct MessagePagination {
    /// Resource listing may return a continuationKey if there's more results available.
    /// Request may be retried with the continuationKey, but otherwise same parameters, in order to get more results.
    pub continuation_key: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaPaymentsInitiateResponseData {
    /// Unique payment identifier assigned for new payment
    #[serde(rename = "_id")]
    pub payment_id: String,
    /// HATEOAS inspired links: 'rel' and 'href'. Context specific link (only GET supported)
    #[serde(rename = "_links")]
    pub links: Option<Vec<NordeaResponseLinks>>,
    /// Marked as required field in the docs, but connector does not send amount in payment_response.amount
    pub amount: Option<StringMajorUnit>,
    /// Bearer of charges. shar = The Debtor (sender of the payment) will pay all fees charged by the sending bank.
    /// The Creditor (recipient of the payment) will pay all fees charged by the receiving bank.
    /// debt = The Debtor (sender of the payment) will bear all of the payment transaction fees.
    /// The creditor (beneficiary) will receive the full amount of the payment.
    pub charge_bearer: Option<ChargeBearer>,
    /// Creditor of the payment
    #[serde(rename = "creditor")]
    pub creditor_account: CreditorAccount,
    pub currency: Option<api_models::enums::Currency>,
    /// Debtor of the payment
    #[serde(rename = "debtor")]
    pub debitor_account: Option<DebitorAccount>,
    /// Timestamp of payment creation. ISO 8601 format yyyy-mm-ddThh:mm:ss.fffZ. Format:date-time.
    pub entry_date_time: Option<String>,
    /// Unique identification as assigned by a partner to identify the payment.
    pub external_id: Option<String>,
    /// An amount the bank will charge for executing the payment
    pub fee: Option<BankFee>,
    pub indicative_exchange_rate: Option<ExchangeRate>,
    /// It is mentioned as `number`. It can be an integer or a decimal number.
    pub rate: Option<f32>,
    /// Monetary amount
    pub instructed_amount: Option<InstructedAmount>,
    /// Indication of cross border payment to own account
    pub is_own_account_transfer: Option<bool>,
    /// OTP Challenge
    pub otp_challenge: Option<String>,
    /// Status of the payment
    pub payment_status: NordeaPaymentStatus,
    /// Planned execution date will indicate the day the payment will be finalized. If the payment has been pushed due to cut-off, it will be indicated in planned execution date. Format:date.
    pub planned_execution_date: Option<String>,
    /// Recurring information
    pub recurring: Option<RecurringInformation>,
    /// Choose a preferred execution date (or leave blank for today's date).
    /// This should be a valid bank day, and depending on the country the date will either be pushed to the next valid bank day,
    /// or return an error if a non-banking day date was supplied (all dates accepted in sandbox).
    /// SEPA: max +5 years from yesterday, Domestic: max. +1 year from yesterday. NB: Not supported for Own transfer Non-Recurring Norway.
    /// Format:date.
    pub requested_execution_date: Option<String>,
    /// Timestamp of payment creation. ISO 8601 format yyyy-mm-ddThh:mm:ss.fffZ Format:date-time.
    pub timestamp: Option<String>,
    /// Additional messages for third parties
    pub tpp_messages: Option<Vec<ThirdPartyMessages>>,
    pub transaction_fee: Option<Vec<BankFee>>,
    /// Currency that the cross border payment will be transferred in.
    /// This field is only supported for cross border payments for DK.
    /// If this field is not supplied then the payment will use the currency specified for the currency field of instructed_amount.
    pub transfer_currency: Option<api_models::enums::Currency>,
    /// Urgency of the payment. NB: This field is supported for DK Domestic ('standard' and 'express') and NO Domestic bank transfer payments ('standard' and 'express').
    /// Use 'express' for Straksbetaling (Instant payment).
    /// All other payment types ignore this input.
    /// For further details on urgencies and cut-offs, refer to the Nordea website.
    /// Value 'sameday' is marked as deprecated and will be removed in the future.
    pub urgency: Option<PaymentsUrgency>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaPaymentsInitiateResponse {
    /// Payment information
    #[serde(rename = "response")]
    pub payments_response: Option<NordeaPaymentsInitiateResponseData>,
    /// External response header
    pub group_header: Option<NordeaGroupHeader>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaPaymentsConfirmErrorObject {
    /// Error message
    pub error: Option<String>,
    /// Description of the error
    pub error_description: Option<String>,
    /// Payment id of the payment, the error is associated with
    pub payment_id: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaPaymentsResponseWrapper {
    pub payments: Vec<NordeaPaymentsInitiateResponseData>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaPaymentsConfirmResponse {
    /// HATEOAS inspired links: 'rel' and 'href'
    #[serde(rename = "_links")]
    pub links: Option<Vec<NordeaResponseLinks>>,
    /// Error description
    pub errors: Option<Vec<NordeaPaymentsConfirmErrorObject>>,
    /// External response header
    pub group_header: Option<NordeaGroupHeader>,
    /// OTP Challenge
    pub otp_challenge: Option<String>,
    #[serde(rename = "response")]
    pub nordea_payments_response: Option<NordeaPaymentsResponseWrapper>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaOriginalRequest {
    /// Original request url
    #[serde(rename = "url")]
    pub nordea_url: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaFailures {
    /// Failure code
    pub code: Option<String>,
    /// Failure description
    pub description: Option<String>,
    /// JSON path of the failing element if applicable
    pub path: Option<String>,
    /// Type of the validation error, e.g. NotNull
    #[serde(rename = "type")]
    pub failure_type: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaErrorBody {
    // Serde JSON because connector returns an `(item)` object in failures array object
    /// More details on the occurred error: Validation error
    #[serde(rename = "failures")]
    pub nordea_failures: Option<Vec<NordeaFailures>>,
    /// Original request information
    #[serde(rename = "request")]
    pub nordea_request: Option<NordeaOriginalRequest>,
}

#[derive(Debug, Serialize, Deserialize, PartialEq)]
pub struct NordeaErrorResponse {
    /// Error response body
    pub error: Option<NordeaErrorBody>,
    /// External response header
    pub group_header: Option<NordeaGroupHeader>,
    #[serde(rename = "httpCode")]
    pub http_code: Option<String>,
    #[serde(rename = "moreInformation")]
    pub more_information: Option<String>,
}

// Nordea does not support refunds in Private APIs. Only Corporate APIs support Refunds


// Function: generate_default_totp
// File: crates/router/src/utils/user/two_factor_auth.rs
// Module: router

pub fn generate_default_totp(
    email: pii::Email,
    secret: Option<masking::Secret<String>>,
    issuer: String,
) -> UserResult<TOTP>


// Function: get_connector_name
// File: crates/api_models/src/admin.rs
// Module: api_models

pub fn get_connector_name(&self) -> String


// File: crates/hyperswitch_connectors/src/connectors/tesouro/transformers.rs
// Module: hyperswitch_connectors
// Public structs: 8

use common_enums::enums;
use common_utils::types::FloatMajorUnit;
use hyperswitch_domain_models::{
    payment_method_data::PaymentMethodData,
    router_data::{ConnectorAuthType, RouterData},
    router_flow_types::refunds::{Execute, RSync},
    router_request_types::ResponseId,
    router_response_types::{PaymentsResponseData, RefundsResponseData},
    types::{PaymentsAuthorizeRouterData, RefundsRouterData},
};
use hyperswitch_interfaces::errors;
use masking::Secret;
use serde::{Deserialize, Serialize};

use crate::types::{RefundsResponseRouterData, ResponseRouterData};

//TODO: Fill the struct with respective fields
pub struct TesouroRouterData<T> {
    pub amount: FloatMajorUnit, // The type of amount that a connector accepts, for example, String, i64, f64, etc.
    pub router_data: T,
}

impl<T> From<(FloatMajorUnit, T)> for TesouroRouterData<T> {
    fn from((amount, item): (FloatMajorUnit, T)) -> Self {
        //Todo :  use utils to convert the amount to the type of amount that a connector accepts
        Self {
            amount,
            router_data: item,
        }
    }
}

//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, PartialEq)]
pub struct TesouroPaymentsRequest {
    amount: FloatMajorUnit,
    card: TesouroCard,
}

#[derive(Default, Debug, Serialize, Eq, PartialEq)]
pub struct TesouroCard {
    number: cards::CardNumber,
    expiry_month: Secret<String>,
    expiry_year: Secret<String>,
    cvc: Secret<String>,
    complete: bool,
}

impl TryFrom<&TesouroRouterData<&PaymentsAuthorizeRouterData>> for TesouroPaymentsRequest {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(
        item: &TesouroRouterData<&PaymentsAuthorizeRouterData>,
    ) -> Result<Self, Self::Error> {
        match item.router_data.request.payment_method_data.clone() {
            PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
                "Card payment method not implemented".to_string(),
            )
            .into()),
            _ => Err(errors::ConnectorError::NotImplemented("Payment method".to_string()).into()),
        }
    }
}

//TODO: Fill the struct with respective fields
// Auth Struct
pub struct TesouroAuthType {
    pub(super) api_key: Secret<String>,
}

impl TryFrom<&ConnectorAuthType> for TesouroAuthType {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(auth_type: &ConnectorAuthType) -> Result<Self, Self::Error> {
        match auth_type {
            ConnectorAuthType::HeaderKey { api_key } => Ok(Self {
                api_key: api_key.to_owned(),
            }),
            _ => Err(errors::ConnectorError::FailedToObtainAuthType.into()),
        }
    }
}
// PaymentsResponse
//TODO: Append the remaining status flags
#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum TesouroPaymentStatus {
    Succeeded,
    Failed,
    #[default]
    Processing,
}

impl From<TesouroPaymentStatus> for common_enums::AttemptStatus {
    fn from(item: TesouroPaymentStatus) -> Self {
        match item {
            TesouroPaymentStatus::Succeeded => Self::Charged,
            TesouroPaymentStatus::Failed => Self::Failure,
            TesouroPaymentStatus::Processing => Self::Authorizing,
        }
    }
}

//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TesouroPaymentsResponse {
    status: TesouroPaymentStatus,
    id: String,
}

impl<F, T> TryFrom<ResponseRouterData<F, TesouroPaymentsResponse, T, PaymentsResponseData>>
    for RouterData<F, T, PaymentsResponseData>
{
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(
        item: ResponseRouterData<F, TesouroPaymentsResponse, T, PaymentsResponseData>,
    ) -> Result<Self, Self::Error> {
        Ok(Self {
            status: common_enums::AttemptStatus::from(item.response.status),
            response: Ok(PaymentsResponseData::TransactionResponse {
                resource_id: ResponseId::ConnectorTransactionId(item.response.id),
                redirection_data: Box::new(None),
                mandate_reference: Box::new(None),
                connector_metadata: None,
                network_txn_id: None,
                connector_response_reference_id: None,
                incremental_authorization_allowed: None,
                charges: None,
            }),
            ..item.data
        })
    }
}

//TODO: Fill the struct with respective fields
// REFUND :
// Type definition for RefundRequest
#[derive(Default, Debug, Serialize)]
pub struct TesouroRefundRequest {
    pub amount: FloatMajorUnit,
}

impl<F> TryFrom<&TesouroRouterData<&RefundsRouterData<F>>> for TesouroRefundRequest {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(item: &TesouroRouterData<&RefundsRouterData<F>>) -> Result<Self, Self::Error> {
        Ok(Self {
            amount: item.amount.to_owned(),
        })
    }
}

// Type definition for Refund Response

#[allow(dead_code)]
#[derive(Debug, Copy, Serialize, Default, Deserialize, Clone)]
pub enum RefundStatus {
    Succeeded,
    Failed,
    #[default]
    Processing,
}

impl From<RefundStatus> for enums::RefundStatus {
    fn from(item: RefundStatus) -> Self {
        match item {
            RefundStatus::Succeeded => Self::Success,
            RefundStatus::Failed => Self::Failure,
            RefundStatus::Processing => Self::Pending,
            //TODO: Review mapping
        }
    }
}

//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct RefundResponse {
    id: String,
    status: RefundStatus,
}

impl TryFrom<RefundsResponseRouterData<Execute, RefundResponse>> for RefundsRouterData<Execute> {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(
        item: RefundsResponseRouterData<Execute, RefundResponse>,
    ) -> Result<Self, Self::Error> {
        Ok(Self {
            response: Ok(RefundsResponseData {
                connector_refund_id: item.response.id.to_string(),
                refund_status: enums::RefundStatus::from(item.response.status),
            }),
            ..item.data
        })
    }
}

impl TryFrom<RefundsResponseRouterData<RSync, RefundResponse>> for RefundsRouterData<RSync> {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn try_from(
        item: RefundsResponseRouterData<RSync, RefundResponse>,
    ) -> Result<Self, Self::Error> {
        Ok(Self {
            response: Ok(RefundsResponseData {
                connector_refund_id: item.response.id.to_string(),
                refund_status: enums::RefundStatus::from(item.response.status),
            }),
            ..item.data
        })
    }
}

//TODO: Fill the struct with respective fields
#[derive(Default, Debug, Serialize, Deserialize, PartialEq)]
pub struct TesouroErrorResponse {
    pub status_code: u16,
    pub code: String,
    pub message: String,
    pub reason: Option<String>,
    pub network_advice_code: Option<String>,
    pub network_decline_code: Option<String>,
    pub network_error_message: Option<String>,
}


// Struct: Instruction
// File: crates/hyperswitch_connectors/src/connectors/worldpay/requests.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct Instruction


// Struct: ErrorDistributionAccumulator
// File: crates/analytics/src/payments/accumulator.rs
// Module: analytics
// Implementations: 1
// Traits: PaymentDistributionAccumulator

pub struct ErrorDistributionAccumulator


// Struct: PaymentResponse
// File: crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct PaymentResponse