// File: crates/hyperswitch_connectors/src/connectors/stripe/transformers.rs
// Module: hyperswitch_connectors
// Public functions: 9
// Public structs: 106

use std::{collections::HashMap, fmt::Debug, ops::Deref};

use api_models::{self, enums as api_enums, payments};
use common_enums::{enums, AttemptStatus, PaymentChargeType, StripeChargeType};
use common_types::{
    payments::{AcceptanceType, SplitPaymentsRequest},
    primitive_wrappers,
};
use common_utils::{
    collect_missing_value_keys,
    errors::CustomResult,
    ext_traits::{ByteSliceExt, Encode, OptionExt as _},
    pii::{self, Email},
    request::{Method, RequestContent},
    types::MinorUnit,
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
    payment_method_data::{
        self, BankRedirectData, Card, CardRedirectData, GiftCardData, GooglePayWalletData,
        PayLaterData, PaymentMethodData, VoucherData, WalletData,
    },
    router_data::{
        AdditionalPaymentMethodConnectorResponse, ConnectorAuthType, ConnectorResponseData,
        ExtendedAuthorizationResponseData, PaymentMethodToken, RouterData,
    },
    router_flow_types::{Execute, RSync},
    router_request_types::{
        BrowserInformation, ChargeRefundsOptions, DestinationChargeRefund, DirectChargeRefund,
        PaymentsAuthorizeData, PaymentsCancelData, PaymentsCaptureData,
        PaymentsIncrementalAuthorizationData, ResponseId, SplitRefundsRequest,
    },
    router_response_types::{
        ConnectorCustomerResponseData, MandateReference, PaymentsResponseData,
        PreprocessingResponseId, RedirectForm, RefundsResponseData,
    },
    types::{
        ConnectorCustomerRouterData, PaymentsAuthorizeRouterData, PaymentsCancelRouterData,
        PaymentsUpdateMetadataRouterData, RefundsRouterData, SetupMandateRouterData,
        TokenizationRouterData,
    },
};
use hyperswitch_interfaces::{consts, errors::ConnectorError};
use masking::{ExposeInterface, Mask, Maskable, PeekInterface, Secret};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use time::PrimitiveDateTime;
use url::Url;

use crate::{
    constants::headers::STRIPE_COMPATIBLE_CONNECT_ACCOUNT,
    utils::{
        convert_uppercase, deserialize_zero_minor_amount_as_none, ApplePay,
        RouterData as OtherRouterData,
    },
};

#[cfg(feature = "payouts")]
pub mod connect;
#[cfg(feature = "payouts")]
pub use self::connect::*;
use crate::{
    types::{
        RefundsResponseRouterData, ResponseRouterData, SubmitEvidenceRouterData,
        UploadFileRouterData,
    },
    utils::{
        get_unimplemented_payment_method_error_message, is_payment_failure, is_refund_failure,
        PaymentsAuthorizeRequestData, SplitPaymentData,
    },
};
pub mod auth_headers {
    pub const STRIPE_API_VERSION: &str = "stripe-version";
    pub const STRIPE_VERSION: &str = "2022-11-15";
}

trait GetRequestIncrementalAuthorization {
    fn get_request_incremental_authorization(&self) -> Option<bool>;
}

impl GetRequestIncrementalAuthorization for PaymentsAuthorizeData {
    fn get_request_incremental_authorization(&self) -> Option<bool> {
        Some(self.request_incremental_authorization)
    }
}

impl GetRequestIncrementalAuthorization for PaymentsCaptureData {
    fn get_request_incremental_authorization(&self) -> Option<bool> {
        None
    }
}

impl GetRequestIncrementalAuthorization for PaymentsCancelData {
    fn get_request_incremental_authorization(&self) -> Option<bool> {
        None
    }
}

pub struct StripeAuthType {
    pub(super) api_key: Secret<String>,
}

impl TryFrom<&ConnectorAuthType> for StripeAuthType {
    type Error = error_stack::Report<ConnectorError>;
    fn try_from(item: &ConnectorAuthType) -> Result<Self, Self::Error> {
        if let ConnectorAuthType::HeaderKey { api_key } = item {
            Ok(Self {
                api_key: api_key.to_owned(),
            })
        } else {
            Err(ConnectorError::FailedToObtainAuthType.into())
        }
    }
}

#[derive(Debug, Default, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum StripeCaptureMethod {
    Manual,
    #[default]
    Automatic,
}

impl From<Option<enums::CaptureMethod>> for StripeCaptureMethod {
    fn from(item: Option<enums::CaptureMethod>) -> Self {
        match item {
            Some(p) => match p {
                enums::CaptureMethod::ManualMultiple => Self::Manual,
                enums::CaptureMethod::Manual => Self::Manual,
                enums::CaptureMethod::Automatic | enums::CaptureMethod::SequentialAutomatic => {
                    Self::Automatic
                }
                enums::CaptureMethod::Scheduled => Self::Manual,
            },
            None => Self::Automatic,
        }
    }
}

#[derive(Debug, Default, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Auth3ds {
    #[default]
    Automatic,
    Any,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum StripeCardNetwork {
    CartesBancaires,
    Mastercard,
    Visa,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(
    rename_all = "snake_case",
    tag = "mandate_data[customer_acceptance][type]"
)]
pub enum StripeMandateType {
    Online {
        #[serde(rename = "mandate_data[customer_acceptance][online][ip_address]")]
        ip_address: Secret<String, pii::IpAddress>,
        #[serde(rename = "mandate_data[customer_acceptance][online][user_agent]")]
        user_agent: String,
    },
    Offline,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeMandateRequest {
    #[serde(flatten)]
    mandate_type: StripeMandateType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ExpandableObjects {
    LatestCharge,
    Customer,
    LatestAttempt,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeBrowserInformation {
    #[serde(rename = "payment_method_data[ip]")]
    pub ip_address: Option<Secret<String, pii::IpAddress>>,
    #[serde(rename = "payment_method_data[user_agent]")]
    pub user_agent: Option<String>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct PaymentIntentRequest {
    pub amount: MinorUnit, //amount in cents, hence passed as integer
    pub currency: String,
    pub statement_descriptor_suffix: Option<String>,
    pub statement_descriptor: Option<String>,
    #[serde(flatten)]
    pub meta_data: HashMap<String, String>,
    pub return_url: String,
    pub confirm: bool,
    pub payment_method: Option<Secret<String>>,
    pub customer: Option<Secret<String>>,
    #[serde(flatten)]
    pub setup_mandate_details: Option<StripeMandateRequest>,
    pub description: Option<String>,
    #[serde(flatten)]
    pub shipping: Option<StripeShippingAddress>,
    #[serde(flatten)]
    pub billing: StripeBillingAddress,
    #[serde(flatten)]
    pub payment_data: Option<StripePaymentMethodData>,
    pub capture_method: StripeCaptureMethod,
    #[serde(flatten)]
    pub payment_method_options: Option<StripePaymentMethodOptions>, // For mandate txns using network_txns_id, needs to be validated
    pub setup_future_usage: Option<enums::FutureUsage>,
    pub off_session: Option<bool>,
    #[serde(rename = "payment_method_types[0]")]
    pub payment_method_types: Option<StripePaymentMethodType>,
    #[serde(rename = "expand[0]")]
    pub expand: Option<ExpandableObjects>,
    #[serde(flatten)]
    pub browser_info: Option<StripeBrowserInformation>,
    #[serde(flatten)]
    pub charges: Option<IntentCharges>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct IntentCharges {
    pub application_fee_amount: Option<MinorUnit>,
    #[serde(
        rename = "transfer_data[destination]",
        skip_serializing_if = "Option::is_none"
    )]
    pub destination_account_id: Option<String>,
}

// Field rename is required only in case of serialization as it is passed in the request to the connector.
// Deserialization is happening only in case of webhooks, where fields name should be used as defined in the struct.
// Whenever adding new fields, Please ensure it doesn't break the webhook flow
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
pub struct StripeMetadata {
    // merchant_reference_id
    #[serde(rename(serialize = "metadata[order_id]"))]
    pub order_id: Option<String>,
    // to check whether the order_id is refund_id or payment_id
    // before deployment, order id is set to payment_id in refunds but now it is set as refund_id
    // it is set as string instead of bool because stripe pass it as string even if we set it as bool
    #[serde(rename(serialize = "metadata[is_refund_id_as_reference]"))]
    pub is_refund_id_as_reference: Option<String>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct SetupIntentRequest {
    pub confirm: bool,
    pub usage: Option<enums::FutureUsage>,
    pub customer: Option<Secret<String>>,
    pub off_session: Option<bool>,
    pub return_url: Option<String>,
    #[serde(flatten)]
    pub payment_data: StripePaymentMethodData,
    pub payment_method_options: Option<StripePaymentMethodOptions>, // For mandate txns using network_txns_id, needs to be validated
    #[serde(flatten)]
    pub meta_data: Option<HashMap<String, String>>,
    #[serde(rename = "payment_method_types[0]")]
    pub payment_method_types: Option<StripePaymentMethodType>,
    #[serde(rename = "expand[0]")]
    pub expand: Option<ExpandableObjects>,
    #[serde(flatten)]
    pub browser_info: Option<StripeBrowserInformation>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeCardData {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_data[card][number]")]
    pub payment_method_data_card_number: cards::CardNumber,
    #[serde(rename = "payment_method_data[card][exp_month]")]
    pub payment_method_data_card_exp_month: Secret<String>,
    #[serde(rename = "payment_method_data[card][exp_year]")]
    pub payment_method_data_card_exp_year: Secret<String>,
    #[serde(rename = "payment_method_data[card][cvc]")]
    pub payment_method_data_card_cvc: Option<Secret<String>>,
    #[serde(rename = "payment_method_options[card][request_three_d_secure]")]
    pub payment_method_auth_type: Option<Auth3ds>,
    #[serde(rename = "payment_method_options[card][network]")]
    pub payment_method_data_card_preferred_network: Option<StripeCardNetwork>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "payment_method_options[card][request_incremental_authorization]")]
    pub request_incremental_authorization: Option<StripeRequestIncrementalAuthorization>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "payment_method_options[card][request_extended_authorization]")]
    request_extended_authorization: Option<StripeRequestExtendedAuthorization>,
    #[serde(rename = "payment_method_options[card][request_overcapture]")]
    pub request_overcapture: Option<StripeRequestOvercaptureBool>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum StripeRequestIncrementalAuthorization {
    IfAvailable,
    Never,
}

#[derive(Debug, Eq, PartialEq, Serialize, Deserialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum StripeRequestExtendedAuthorization {
    IfAvailable,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum StripeRequestOvercaptureBool {
    IfAvailable,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripePayLaterData {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct TokenRequest {
    #[serde(flatten)]
    pub token_data: StripePaymentMethodData,
}

#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct StripeTokenResponse {
    pub id: Secret<String>,
    pub object: String,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct CustomerRequest {
    pub description: Option<String>,
    pub email: Option<Email>,
    pub phone: Option<Secret<String>>,
    pub name: Option<Secret<String>>,
    pub source: Option<Secret<String>>,
}

#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct StripeCustomerResponse {
    pub id: String,
    pub description: Option<String>,
    pub email: Option<Email>,
    pub phone: Option<Secret<String>>,
    pub name: Option<Secret<String>>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct ChargesRequest {
    pub amount: MinorUnit,
    pub currency: String,
    pub customer: Secret<String>,
    pub source: Secret<String>,
    #[serde(flatten)]
    pub meta_data: Option<HashMap<String, String>>,
}

#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
pub struct ChargesResponse {
    pub id: String,
    pub amount: MinorUnit,
    pub amount_captured: MinorUnit,
    pub currency: String,
    pub status: StripePaymentStatus,
    pub source: StripeSourceResponse,
    pub failure_code: Option<String>,
    pub failure_message: Option<String>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
pub enum StripeBankName {
    Eps {
        #[serde(rename = "payment_method_data[eps][bank]")]
        bank_name: Option<StripeBankNames>,
    },
    Ideal {
        #[serde(rename = "payment_method_data[ideal][bank]")]
        ideal_bank_name: Option<StripeBankNames>,
    },
    Przelewy24 {
        #[serde(rename = "payment_method_data[p24][bank]")]
        bank_name: Option<StripeBankNames>,
    },
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
pub enum StripeBankRedirectData {
    StripeGiropay(Box<StripeGiropay>),
    StripeIdeal(Box<StripeIdeal>),
    StripeBancontactCard(Box<StripeBancontactCard>),
    StripePrezelewy24(Box<StripePrezelewy24>),
    StripeEps(Box<StripeEps>),
    StripeBlik(Box<StripeBlik>),
    StripeOnlineBankingFpx(Box<StripeOnlineBankingFpx>),
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeGiropay {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeIdeal {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_data[ideal][bank]")]
    ideal_bank_name: Option<StripeBankNames>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeBancontactCard {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripePrezelewy24 {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_data[p24][bank]")]
    bank_name: Option<StripeBankNames>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeEps {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_data[eps][bank]")]
    bank_name: Option<StripeBankNames>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeBlik {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_options[blik][code]")]
    pub code: Secret<String>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeOnlineBankingFpx {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct AchTransferData {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_options[customer_balance][bank_transfer][type]")]
    pub bank_transfer_type: StripeCreditTransferTypes,
    #[serde(rename = "payment_method_types[0]")]
    pub payment_method_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_options[customer_balance][funding_type]")]
    pub balance_funding_type: BankTransferType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct MultibancoTransferData {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripeCreditTransferTypes,
    #[serde(rename = "payment_method_types[0]")]
    pub payment_method_type: StripeCreditTransferTypes,
    #[serde(rename = "payment_method_data[billing_details][email]")]
    pub email: Email,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct BacsBankTransferData {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_options[customer_balance][bank_transfer][type]")]
    pub bank_transfer_type: BankTransferType,
    #[serde(rename = "payment_method_options[customer_balance][funding_type]")]
    pub balance_funding_type: BankTransferType,
    #[serde(rename = "payment_method_types[0]")]
    pub payment_method_type: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct SepaBankTransferData {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_options[customer_balance][bank_transfer][type]")]
    pub bank_transfer_type: BankTransferType,
    #[serde(rename = "payment_method_options[customer_balance][funding_type]")]
    pub balance_funding_type: BankTransferType,
    #[serde(rename = "payment_method_types[0]")]
    pub payment_method_type: StripePaymentMethodType,
    #[serde(
        rename = "payment_method_options[customer_balance][bank_transfer][eu_bank_transfer][country]"
    )]
    pub country: enums::CountryAlpha2,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
pub enum StripeCreditTransferSourceRequest {
    AchBankTansfer(AchCreditTransferSourceRequest),
    MultibancoBankTansfer(MultibancoCreditTransferSourceRequest),
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct AchCreditTransferSourceRequest {
    #[serde(rename = "type")]
    pub transfer_type: StripeCreditTransferTypes,
    #[serde(flatten)]
    pub payment_method_data: AchTransferData,
    pub currency: enums::Currency,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct MultibancoCreditTransferSourceRequest {
    #[serde(rename = "type")]
    pub transfer_type: StripeCreditTransferTypes,
    #[serde(flatten)]
    pub payment_method_data: MultibancoTransferData,
    pub currency: enums::Currency,
    pub amount: Option<MinorUnit>,
    #[serde(rename = "redirect[return_url]")]
    pub return_url: Option<String>,
}

// Remove untagged when Deserialize is added
#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
pub enum StripePaymentMethodData {
    CardToken(StripeCardToken),
    Card(StripeCardData),
    PayLater(StripePayLaterData),
    Wallet(StripeWallet),
    BankRedirect(StripeBankRedirectData),
    BankDebit(StripeBankDebitData),
    BankTransfer(StripeBankTransferData),
}

#[derive(Debug, Clone, Default, Eq, PartialEq, Serialize)]
pub struct StripeBillingAddressCardToken {
    #[serde(rename = "billing_details[name]")]
    pub name: Option<Secret<String>>,
    #[serde(rename = "billing_details[email]")]
    pub email: Option<Email>,
    #[serde(rename = "billing_details[phone]")]
    pub phone: Option<Secret<String>>,
    #[serde(rename = "billing_details[address][line1]")]
    pub address_line1: Option<Secret<String>>,
    #[serde(rename = "billing_details[address][line2]")]
    pub address_line2: Option<Secret<String>>,
    #[serde(rename = "billing_details[address][state]")]
    pub state: Option<Secret<String>>,
    #[serde(rename = "billing_details[address][city]")]
    pub city: Option<String>,
}
// Struct to call the Stripe tokens API to create a PSP token for the card details provided
#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeCardToken {
    #[serde(rename = "type")]
    pub payment_method_type: Option<StripePaymentMethodType>,
    #[serde(rename = "card[number]")]
    pub token_card_number: cards::CardNumber,
    #[serde(rename = "card[exp_month]")]
    pub token_card_exp_month: Secret<String>,
    #[serde(rename = "card[exp_year]")]
    pub token_card_exp_year: Secret<String>,
    #[serde(rename = "card[cvc]")]
    pub token_card_cvc: Secret<String>,
    #[serde(flatten)]
    pub billing: StripeBillingAddressCardToken,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(tag = "payment_method_data[type]")]
pub enum BankDebitData {
    #[serde(rename = "us_bank_account")]
    Ach {
        #[serde(rename = "payment_method_data[us_bank_account][account_holder_type]")]
        account_holder_type: String,
        #[serde(rename = "payment_method_data[us_bank_account][account_number]")]
        account_number: Secret<String>,
        #[serde(rename = "payment_method_data[us_bank_account][routing_number]")]
        routing_number: Secret<String>,
    },
    #[serde(rename = "sepa_debit")]
    Sepa {
        #[serde(rename = "payment_method_data[sepa_debit][iban]")]
        iban: Secret<String>,
    },
    #[serde(rename = "au_becs_debit")]
    Becs {
        #[serde(rename = "payment_method_data[au_becs_debit][account_number]")]
        account_number: Secret<String>,
        #[serde(rename = "payment_method_data[au_becs_debit][bsb_number]")]
        bsb_number: Secret<String>,
    },
    #[serde(rename = "bacs_debit")]
    Bacs {
        #[serde(rename = "payment_method_data[bacs_debit][account_number]")]
        account_number: Secret<String>,
        #[serde(rename = "payment_method_data[bacs_debit][sort_code]")]
        sort_code: Secret<String>,
    },
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeBankDebitData {
    #[serde(flatten)]
    pub bank_specific_data: BankDebitData,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct BankTransferData {
    pub email: Email,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
pub enum StripeBankTransferData {
    AchBankTransfer(Box<AchTransferData>),
    SepaBankTransfer(Box<SepaBankTransferData>),
    BacsBankTransfers(Box<BacsBankTransferData>),
    MultibancoBankTransfers(Box<MultibancoTransferData>),
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(untagged)]
pub enum StripeWallet {
    ApplepayToken(StripeApplePay),
    GooglepayToken(GooglePayToken),
    ApplepayPayment(ApplepayPayment),
    AmazonpayPayment(AmazonpayPayment),
    WechatpayPayment(WechatpayPayment),
    AlipayPayment(AlipayPayment),
    Cashapp(CashappPayment),
    RevolutPay(RevolutpayPayment),
    ApplePayPredecryptToken(Box<StripeApplePayPredecrypt>),
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeApplePayPredecrypt {
    #[serde(rename = "card[number]")]
    number: cards::CardNumber,
    #[serde(rename = "card[exp_year]")]
    exp_year: Secret<String>,
    #[serde(rename = "card[exp_month]")]
    exp_month: Secret<String>,
    #[serde(rename = "card[cryptogram]")]
    cryptogram: Secret<String>,
    #[serde(rename = "card[eci]")]
    eci: Option<String>,
    #[serde(rename = "card[tokenization_method]")]
    tokenization_method: String,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct StripeApplePay {
    pub pk_token: Secret<String>,
    pub pk_token_instrument_name: String,
    pub pk_token_payment_network: String,
    pub pk_token_transaction_id: Secret<String>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct GooglePayToken {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_data[card][token]")]
    pub token: Secret<String>,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct ApplepayPayment {
    #[serde(rename = "payment_method_data[card][token]")]
    pub token: Secret<String>,
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_types: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct AmazonpayPayment {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_types: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct RevolutpayPayment {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_types: StripePaymentMethodType,
}
#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct AlipayPayment {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct CashappPayment {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct WechatpayPayment {
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_data_type: StripePaymentMethodType,
    #[serde(rename = "payment_method_options[wechat_pay][client]")]
    pub client: WechatClient,
}

#[derive(Debug, Eq, PartialEq, Serialize, Clone, Copy)]
#[serde(rename_all = "snake_case")]
pub enum WechatClient {
    Web,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
pub struct GooglepayPayment {
    #[serde(rename = "payment_method_data[card][token]")]
    pub token: Secret<String>,
    #[serde(rename = "payment_method_data[type]")]
    pub payment_method_types: StripePaymentMethodType,
}

// All supported payment_method_types in stripe
// This enum goes in payment_method_types[] field in stripe request body
// https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_types
#[derive(Eq, PartialEq, Serialize, Clone, Debug, Copy)]
#[serde(rename_all = "snake_case")]
pub enum StripePaymentMethodType {
    Affirm,
    AfterpayClearpay,
    Alipay,
    #[serde(rename = "amazon_pay")]
    AmazonPay,
    #[serde(rename = "au_becs_debit")]
    Becs,
    #[serde(rename = "bacs_debit")]
    Bacs,
    Bancontact,
    Blik,
    Card,
    CustomerBalance,
    Eps,
    Giropay,
    Ideal,
    Klarna,
    #[serde(rename = "p24")]
    Przelewy24,
    #[serde(rename = "sepa_debit")]
    Sepa,
    Sofort,
    #[serde(rename = "us_bank_account")]
    Ach,
    #[serde(rename = "wechat_pay")]
    Wechatpay,
    #[serde(rename = "cashapp")]
    Cashapp,
    RevolutPay,
}

#[derive(Debug, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
#[allow(dead_code)]
pub enum StripeCreditTransferTypes {
    #[serde(rename = "us_bank_transfer")]
    AchCreditTransfer,
    Multibanco,
    Blik,
}

impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
    type Error = error_stack::Report<ConnectorError>;
    fn try_from(value: enums::PaymentMethodType) -> Result<Self, Self::Error> {
        match value {
            enums::PaymentMethodType::Credit => Ok(Self::Card),
            enums::PaymentMethodType::Debit => Ok(Self::Card),
            #[cfg(feature = "v2")]
            enums::PaymentMethodType::Card => Ok(Self::Card),
            enums::PaymentMethodType::Klarna => Ok(Self::Klarna),
            enums::PaymentMethodType::Affirm => Ok(Self::Affirm),
            enums::PaymentMethodType::AfterpayClearpay => Ok(Self::AfterpayClearpay),
            enums::PaymentMethodType::Eps => Ok(Self::Eps),
            enums::PaymentMethodType::Giropay => Ok(Self::Giropay),
            enums::PaymentMethodType::Ideal => Ok(Self::Ideal),
            enums::PaymentMethodType::Sofort => Ok(Self::Sofort),
            enums::PaymentMethodType::AmazonPay => Ok(Self::AmazonPay),
            enums::PaymentMethodType::ApplePay => Ok(Self::Card),
            enums::PaymentMethodType::Ach => Ok(Self::Ach),
            enums::PaymentMethodType::Sepa => Ok(Self::Sepa),
            enums::PaymentMethodType::Becs => Ok(Self::Becs),
            enums::PaymentMethodType::Bacs => Ok(Self::Bacs),
            enums::PaymentMethodType::BancontactCard => Ok(Self::Bancontact),
            enums::PaymentMethodType::WeChatPay => Ok(Self::Wechatpay),
            enums::PaymentMethodType::Blik => Ok(Self::Blik),
            enums::PaymentMethodType::AliPay => Ok(Self::Alipay),
            enums::PaymentMethodType::Przelewy24 => Ok(Self::Przelewy24),
            enums::PaymentMethodType::RevolutPay => Ok(Self::RevolutPay),
            // Stripe expects PMT as Card for Recurring Mandates Payments
            enums::PaymentMethodType::GooglePay => Ok(Self::Card),
            enums::PaymentMethodType::Boleto
            | enums::PaymentMethodType::Paysera
            | enums::PaymentMethodType::Skrill
            | enums::PaymentMethodType::CardRedirect
            | enums::PaymentMethodType::CryptoCurrency
            | enums::PaymentMethodType::Multibanco
            | enums::PaymentMethodType::OnlineBankingFpx
            | enums::PaymentMethodType::Paypal
            | enums::PaymentMethodType::BhnCardNetwork
            | enums::PaymentMethodType::Pix
            | enums::PaymentMethodType::UpiCollect
            | enums::PaymentMethodType::UpiIntent
            | enums::PaymentMethodType::Cashapp
            | enums::PaymentMethodType::Bluecode
            | enums::PaymentMethodType::Oxxo => Err(ConnectorError::NotImplemented(
                get_unimplemented_payment_method_error_message("stripe"),
            )
            .into()),
            enums::PaymentMethodType::AliPayHk
            | enums::PaymentMethodType::Atome
            | enums::PaymentMethodType::Bizum
            | enums::PaymentMethodType::Alma
            | enums::PaymentMethodType::ClassicReward
            | enums::PaymentMethodType::Dana
            | enums::PaymentMethodType::DirectCarrierBilling
            | enums::PaymentMethodType::Efecty
            | enums::PaymentMethodType::Eft
            | enums::PaymentMethodType::Evoucher
            | enums::PaymentMethodType::GoPay
            | enums::PaymentMethodType::Gcash
            | enums::PaymentMethodType::Interac
            | enums::PaymentMethodType::KakaoPay
            | enums::PaymentMethodType::LocalBankRedirect
            | enums::PaymentMethodType::MbWay
            | enums::PaymentMethodType::MobilePay
            | enums::PaymentMethodType::Momo
            | enums::PaymentMethodType::MomoAtm
            | enums::PaymentMethodType::OnlineBankingThailand
            | enums::PaymentMethodType::OnlineBankingCzechRepublic
            | enums::PaymentMethodType::OnlineBankingFinland
            | enums::PaymentMethodType::OnlineBankingPoland
            | enums::PaymentMethodType::OnlineBankingSlovakia
            | enums::PaymentMethodType::OpenBankingUk
            | enums::PaymentMethodType::OpenBankingPIS
            | enums::PaymentMethodType::PagoEfectivo
            | enums::PaymentMethodType::PayBright
            | enums::PaymentMethodType::Pse
            | enums::PaymentMethodType::RedCompra
            | enums::PaymentMethodType::RedPagos
            | enums::PaymentMethodType::SamsungPay
            | enums::PaymentMethodType::Swish
            | enums::PaymentMethodType::TouchNGo
            | enums::PaymentMethodType::Trustly
            | enums::PaymentMethodType::Twint
            | enums::PaymentMethodType::Vipps
            | enums::PaymentMethodType::Venmo
            | enums::PaymentMethodType::Alfamart
            | enums::PaymentMethodType::BcaBankTransfer
            | enums::PaymentMethodType::BniVa
            | enums::PaymentMethodType::CimbVa
            | enums::PaymentMethodType::BriVa
            | enums::PaymentMethodType::DanamonVa
            | enums::PaymentMethodType::Indomaret
            | enums::PaymentMethodType::MandiriVa
            | enums::PaymentMethodType::PermataBankTransfer
            | enums::PaymentMethodType::PaySafeCard
            | enums::PaymentMethodType::Paze
            | enums::PaymentMethodType::Givex
            | enums::PaymentMethodType::Benefit
            | enums::PaymentMethodType::Knet
            | enums::PaymentMethodType::SevenEleven
            | enums::PaymentMethodType::Lawson
            | enums::PaymentMethodType::MiniStop
            | enums::PaymentMethodType::FamilyMart
            | enums::PaymentMethodType::Seicomart
            | enums::PaymentMethodType::PayEasy
            | enums::PaymentMethodType::LocalBankTransfer
            | enums::PaymentMethodType::InstantBankTransfer
            | enums::PaymentMethodType::InstantBankTransferFinland
            | enums::PaymentMethodType::InstantBankTransferPoland
            | enums::PaymentMethodType::SepaBankTransfer
            | enums::PaymentMethodType::Walley
            | enums::PaymentMethodType::Fps
            | enums::PaymentMethodType::DuitNow
            | enums::PaymentMethodType::PromptPay
            | enums::PaymentMethodType::VietQr
            | enums::PaymentMethodType::IndonesianBankTransfer
            | enums::PaymentMethodType::Flexiti
            | enums::PaymentMethodType::Mifinity
            | enums::PaymentMethodType::Breadpay => Err(ConnectorError::NotImplemented(
                get_unimplemented_payment_method_error_message("stripe"),
            )
            .into()),
        }
    }
}

#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum BankTransferType {
    GbBankTransfer,
    EuBankTransfer,
    #[serde(rename = "bank_transfer")]
    BankTransfers,
}

#[derive(Debug, Eq, PartialEq, Serialize, Clone)]
#[serde(rename_all = "snake_case")]
pub enum StripeBankNames {
    AbnAmro,
    ArzteUndApothekerBank,
    AsnBank,
    AustrianAnadiBankAg,
    BankAustria,
    BankhausCarlSpangler,
    BankhausSchelhammerUndSchatteraAg,
    BawagPskAg,
    BksBankAg,
    BrullKallmusBankAg,
    BtvVierLanderBank,
    Bunq,
    CapitalBankGraweGruppeAg,
    CitiHandlowy,
    Dolomitenbank,
    EasybankAg,
    ErsteBankUndSparkassen,
    Handelsbanken,
    HypoAlpeadriabankInternationalAg,
    HypoNoeLbFurNiederosterreichUWien,
    HypoOberosterreichSalzburgSteiermark,
    HypoTirolBankAg,
    HypoVorarlbergBankAg,
    HypoBankBurgenlandAktiengesellschaft,
    Ing,
    Knab,
    MarchfelderBank,
    OberbankAg,
    RaiffeisenBankengruppeOsterreich,
    SchoellerbankAg,
    SpardaBankWien,
    VolksbankGruppe,
    VolkskreditbankAg,
    VrBankBraunau,
    Moneyou,
    Rabobank,
    Regiobank,
    Revolut,
    SnsBank,
    TriodosBank,
    VanLanschot,
    PlusBank,
    EtransferPocztowy24,
    BankiSpbdzielcze,
    BankNowyBfgSa,
    GetinBank,
    Blik,
    NoblePay,
    #[serde(rename = "ideabank")]
    IdeaBank,


// Struct: RefundSyncResponse
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct RefundSyncResponse


// Function: new
// File: crates/router/src/types/domain/user/decision_manager.rs
// Module: router

pub fn new(
        token: auth::UserFromSinglePurposeToken,
        current_flow: UserFlow,
    ) -> UserResult<Self>


// Struct: SerializeStructVariant
// File: crates/masking/src/serde.rs
// Module: masking
// Implementations: 0

pub struct SerializeStructVariant<T: Serializer>


// Implementation: impl api::RefundSync for for Archipel
// File: crates/hyperswitch_connectors/src/connectors/archipel.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::RefundSync for for Archipel


// Implementation: impl BillingConnectorPaymentsSyncFlowRouterData
// File: crates/router/src/core/webhooks/recovery_incoming.rs
// Module: router
// Methods: 2 total (0 public)

impl BillingConnectorPaymentsSyncFlowRouterData


// Function: get_irrelevant_id
// File: crates/common_utils/src/id_type/payment.rs
// Module: common_utils

// Documentation: Get payment id in the format of irrelevant_payment_id_in_{flow}

pub fn get_irrelevant_id(flow: &str) -> Self


// Struct: SamsungPayTokenizedCard
// File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct SamsungPayTokenizedCard


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

pub struct BankOfAmericaRefundResponse


// Function: generic_find_one_optional
// File: crates/diesel_models/src/query/generics.rs
// Module: diesel_models

pub fn generic_find_one_optional<T, P, R>(
    conn: &PgPooledConn,
    predicate: P,
) -> StorageResult<Option<R>>
where
    T: FilterDsl<P> + HasTable<Table = T> + Table + 'static,
    Filter<T, P>: LoadQuery<'static, PgConnection, R> + QueryFragment<Pg> + Send + 'static,
    R: Send + 'static,


// Function: update_subscription_entry
// File: crates/diesel_models/src/query/subscription.rs
// Module: diesel_models

pub fn update_subscription_entry(
        conn: &PgPooledConn,
        merchant_id: &common_utils::id_type::MerchantId,
        id: String,
        subscription_update: SubscriptionUpdate,
    ) -> StorageResult<Self>


// Function: mock_call_to_locker_hs
// File: crates/router/src/core/payment_methods/cards.rs
// Module: router

// Documentation: Mock api for local testing

pub fn mock_call_to_locker_hs(
    db: &dyn db::StorageInterface,
    card_id: &str,
    payload: &payment_methods::StoreLockerReq,
    card_cvc: Option<String>,
    payment_method_id: Option<String>,
    customer_id: Option<&id_type::CustomerId>,
) -> errors::CustomResult<payment_methods::StoreCardResp, errors::VaultError>


// Struct: StaxTokenResponse
// File: crates/hyperswitch_connectors/src/connectors/stax/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct StaxTokenResponse


// Function: set_metadata
// File: crates/router/src/core/user/dashboard_metadata.rs
// Module: router

pub fn set_metadata(
    state: SessionState,
    user: UserFromToken,
    request: api::SetMetaDataRequest,
    _req_state: ReqState,
) -> UserResponse<()>


// Function: list_blocklist_entries_for_merchant
// File: crates/router/src/core/blocklist/utils.rs
// Module: router

pub fn list_blocklist_entries_for_merchant(
    state: &SessionState,
    merchant_id: &common_utils::id_type::MerchantId,
    query: api_blocklist::ListBlocklistQuery,
) -> RouterResult<Vec<api_blocklist::BlocklistResponse>>


// Function: call_frm_before_connector_call
// File: crates/router/src/core/fraud_check.rs
// Module: router

pub fn call_frm_before_connector_call<F, Req, D>(
    operation: &BoxedOperation<'_, F, Req, D>,
    merchant_context: &domain::MerchantContext,
    payment_data: &mut D,
    state: &SessionState,
    frm_info: &mut Option<FrmInfo<F, D>>,
    customer: &Option<domain::Customer>,
    should_continue_transaction: &mut bool,
    should_continue_capture: &mut bool,
) -> RouterResult<Option<FrmConfigsObject>>
where
    F: Send + Clone,
    D: payments::OperationSessionGetters<F>
        + payments::OperationSessionSetters<F>
        + Send
        + Sync
        + Clone,


// Struct: ConfirmSubscriptionRequest
// File: crates/api_models/src/subscription.rs
// Module: api_models
// Implementations: 2
// Traits: ApiEventMetric

pub struct ConfirmSubscriptionRequest


// Struct: PaysafeCard
// File: crates/hyperswitch_connectors/src/connectors/paysafe/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct PaysafeCard


// Function: new
// File: crates/external_services/src/email.rs
// Module: external_services

// Documentation: Create a new Instance of IntermediateString using a string

pub fn new(inner: String) -> Self


// Implementation: impl api::ConnectorAccessToken for for Payu
// File: crates/hyperswitch_connectors/src/connectors/payu.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::ConnectorAccessToken for for Payu


// Struct: AmazonPayWalletData
// File: crates/hyperswitch_domain_models/src/payment_method_data.rs
// Module: hyperswitch_domain_models
// Implementations: 0

pub struct AmazonPayWalletData


// Implementation: impl fmt::Display for for BokuPaymentType
// File: crates/hyperswitch_connectors/src/connectors/boku/transformers.rs
// Module: hyperswitch_connectors
// Methods: 1 total (0 public)

impl fmt::Display for for BokuPaymentType


// Struct: OpayoPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/opayo/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct OpayoPaymentsRequest


// Struct: MifinityPaymentsRequest
// File: crates/hyperswitch_connectors/src/connectors/mifinity/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct MifinityPaymentsRequest


// Function: save_payout_data_to_locker
// File: crates/router/src/core/payouts/helpers.rs
// Module: router

pub fn save_payout_data_to_locker(
    state: &SessionState,
    payout_data: &mut PayoutData,
    customer_id: &id_type::CustomerId,
    payout_method_data: &api::PayoutMethodData,
    connector_mandate_details: Option<serde_json::Value>,
    merchant_context: &domain::MerchantContext,
) -> RouterResult<()>


// Implementation: impl PaymentResourceUpdateStatus
// File: crates/common_enums/src/enums.rs
// Module: common_enums
// Methods: 1 total (1 public)

impl PaymentResourceUpdateStatus


// Struct: ThreedsecureioPostAuthenticationRequest
// File: crates/hyperswitch_connectors/src/connectors/threedsecureio/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct ThreedsecureioPostAuthenticationRequest


// Implementation: impl MerchantReferenceIdForCustomer
// File: crates/router/src/core/customers.rs
// Module: router
// Methods: 2 total (0 public)

impl MerchantReferenceIdForCustomer


// Struct: GetnetCaptureResponse
// File: crates/hyperswitch_connectors/src/connectors/getnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct GetnetCaptureResponse


// File: crates/router/src/services/jwt.rs
// Module: router
// Public functions: 2

use common_utils::errors::CustomResult;
use error_stack::ResultExt;
use jsonwebtoken::{encode, EncodingKey, Header};
use masking::PeekInterface;

use crate::{configs::Settings, core::errors::UserErrors};

pub fn generate_exp(
    exp_duration: std::time::Duration,
) -> CustomResult<std::time::Duration, UserErrors> {
    std::time::SystemTime::now()
        .checked_add(exp_duration)
        .ok_or(UserErrors::InternalServerError)?
        .duration_since(std::time::UNIX_EPOCH)
        .change_context(UserErrors::InternalServerError)
}

pub async fn generate_jwt<T>(
    claims_data: &T,
    settings: &Settings,
) -> CustomResult<String, UserErrors>
where
    T: serde::ser::Serialize,
{
    let jwt_secret = &settings.secrets.get_inner().jwt_secret;
    encode(
        &Header::default(),
        claims_data,
        &EncodingKey::from_secret(jwt_secret.peek().as_bytes()),
    )
    .change_context(UserErrors::InternalServerError)
}


// Implementation: impl api::PaymentSession for for Bitpay
// File: crates/hyperswitch_connectors/src/connectors/bitpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::PaymentSession for for Bitpay


// Struct: PaymentMethodUpdateInternal
// File: crates/diesel_models/src/payment_method.rs
// Module: diesel_models
// Implementations: 2

pub struct PaymentMethodUpdateInternal


// Struct: NexixpayMandateResponse
// File: crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct NexixpayMandateResponse


// Implementation: impl api::Refund for for Bluecode
// File: crates/hyperswitch_connectors/src/connectors/bluecode.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::Refund for for Bluecode


// Function: create_payment_method_proxy_card_core
// File: crates/router/src/core/payment_methods.rs
// Module: router

pub fn create_payment_method_proxy_card_core(
    state: &SessionState,
    req: api::PaymentMethodCreate,
    merchant_context: &domain::MerchantContext,
    profile: &domain::Profile,
    merchant_id: &id_type::MerchantId,
    customer_id: &id_type::GlobalCustomerId,
    payment_method_id: id_type::GlobalPaymentMethodId,
    payment_method_billing_address: Option<
        Encryptable<hyperswitch_domain_models::address::Address>,
    >,
) -> RouterResult<(api::PaymentMethodResponse, domain::PaymentMethod)>


// Function: get_entity_id
// File: crates/router/src/services/email/types.rs
// Module: router

pub fn get_entity_id(&self) -> &str


// Implementation: impl GetCaptureMethod for for PaymentsCancelData
// File: crates/hyperswitch_connectors/src/connectors/aci/transformers.rs
// Module: hyperswitch_connectors
// Methods: 1 total (0 public)

impl GetCaptureMethod for for PaymentsCancelData


// Function: supports_create_recipient
// File: crates/common_enums/src/connector_enums.rs
// Module: common_enums

pub fn supports_create_recipient(self, payout_method: Option<PayoutType>) -> bool


                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BacsBankDebitAccountNumber.to_tuple(),
                            RequiredField::BacsBankDebitSortCode.to_tuple(),
                        ]),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::Becs,
            connectors(vec![
                (
                    Connector::Stripe,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "owner_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BecsBankDebitAccountNumber.to_tuple(),
                            RequiredField::BecsBankDebitBsbNumber.to_tuple(),
                            RequiredField::BillingEmail.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Adyen,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingFirstName(
                                "owner_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "owner_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BecsBankDebitAccountNumber.to_tuple(),
                            RequiredField::BecsBankDebitSortCode.to_tuple(),
                        ]),
                    },
                ),
            ]),
        ),
    ])
}

#[cfg(feature = "v1")]
fn get_bank_transfer_required_fields() -> HashMap<enums::PaymentMethodType, ConnectorFields> {
    HashMap::from([
        (
            enums::PaymentMethodType::Multibanco,
            connectors(vec![(
                Connector::Stripe,
                fields(vec![], vec![RequiredField::BillingEmail], vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::LocalBankTransfer,
            connectors(vec![(
                Connector::Zsl,
                fields(
                    vec![],
                    vec![
                        RequiredField::BillingAddressCountries(vec!["CN"]),
                        RequiredField::BillingAddressCity,
                    ],
                    vec![],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::Ach,
            connectors(vec![(
                Connector::Checkbook,
                fields(
                    vec![],
                    vec![],
                    vec![
                        RequiredField::BillingUserFirstName,
                        RequiredField::BillingUserLastName,
                        RequiredField::BillingEmail,
                        RequiredField::Description,
                    ],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::Pix,
            connectors(vec![
                (
                    Connector::Itaubank,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::PixKey.to_tuple(),
                            RequiredField::PixCnpj.to_tuple(),
                            RequiredField::PixCpf.to_tuple(),
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                        ]),
                    },
                ),
                (Connector::Adyen, fields(vec![], vec![], vec![])),
                (
                    Connector::Santander,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Bluecode,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                            RequiredField::BillingCountries(vec![
                                "AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE",
                                "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT",
                                "RO", "SK", "SI", "ES", "SE", "IS", "LI", "NO",
                            ])
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Facilitapay,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::PixSourceBankAccountId.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["BR"]).to_tuple(),
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                            RequiredField::PixCpf.to_tuple(),
                        ]),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::PermataBankTransfer,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::BcaBankTransfer,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::BniVa,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::BriVa,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::CimbVa,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::DanamonVa,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::MandiriVa,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::SepaBankTransfer,
            connectors(vec![
                (
                    Connector::Stripe,
                    fields(
                        vec![],
                        vec![],
                        vec![
                            RequiredField::BillingEmail,
                            RequiredField::BillingUserFirstName,
                            RequiredField::BillingUserLastName,
                            RequiredField::BillingAddressCountries(vec![
                                "BE", "DE", "ES", "FR", "IE", "NL",
                            ]),
                        ],
                    ),
                ),
                (
                    Connector::Trustpay,
                    fields(
                        vec![],
                        vec![],
                        vec![
                            RequiredField::Email,
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            ),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            ),
                            RequiredField::BillingAddressLine1,
                            RequiredField::BillingAddressCity,
                            RequiredField::BillingAddressZip,
                            RequiredField::BillingAddressCountries(vec!["ALL"]),
                        ],
                    ),
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::InstantBankTransfer,
            connectors(vec![(
                Connector::Trustpay,
                fields(
                    vec![],
                    vec![],
                    vec![
                        RequiredField::Email,
                        RequiredField::BillingFirstName(
                            "billing_first_name",
                            FieldType::UserBillingName,
                        ),
                        RequiredField::BillingLastName(
                            "billing_last_name",
                            FieldType::UserBillingName,
                        ),
                        RequiredField::BillingAddressLine1,
                        RequiredField::BillingAddressCity,
                        RequiredField::BillingAddressZip,
                        RequiredField::BillingAddressCountries(vec!["ALL"]),
                    ],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::InstantBankTransferFinland,
            connectors(vec![(
                Connector::Trustpay,
                fields(
                    vec![],
                    vec![],
                    vec![
                        RequiredField::Email,
                        RequiredField::BillingFirstName(
                            "billing_first_name",
                            FieldType::UserBillingName,
                        ),
                        RequiredField::BillingLastName(
                            "billing_last_name",
                            FieldType::UserBillingName,
                        ),
                        RequiredField::BillingAddressLine1,
                        RequiredField::BillingAddressCity,
                        RequiredField::BillingAddressZip,
                        RequiredField::BillingAddressCountries(vec!["FI"]),
                    ],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::InstantBankTransferPoland,
            connectors(vec![(
                Connector::Trustpay,
                fields(
                    vec![],
                    vec![],
                    vec![
                        RequiredField::Email,
                        RequiredField::BillingFirstName(
                            "billing_first_name",
                            FieldType::UserBillingName,
                        ),
                        RequiredField::BillingLastName(
                            "billing_last_name",
                            FieldType::UserBillingName,
                        ),
                        RequiredField::BillingAddressLine1,
                        RequiredField::BillingAddressCity,
                        RequiredField::BillingAddressZip,
                        RequiredField::BillingAddressCountries(vec!["PL"]),
                    ],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::Bacs,
            connectors(vec![(
                Connector::Stripe,
                fields(vec![], vec![], billing_email_name()),
            )]),
        ),
    ])
}

#[test]
fn test_required_fields_to_json() {
    #![allow(clippy::unwrap_used)]

    // Test billing fields
    let billing_fields = get_billing_required_fields();
    // let billing_json = serde_json::to_string_pretty(&billing_fields)?;

    // Verify billing fields have expected entries
    assert!(billing_fields.contains_key("billing.address.first_name"));
    assert!(billing_fields.contains_key("billing.address.last_name"));
    assert!(billing_fields.contains_key("billing.address.city"));
    assert!(billing_fields.contains_key("billing.address.zip"));
    assert!(billing_fields.contains_key("billing.email"));

    // Verify specific billing field properties
    let billing_first_name = billing_fields.get("billing.address.first_name").unwrap();
    assert_eq!(billing_first_name.display_name, "billing_first_name");
    assert!(matches!(
        billing_first_name.field_type,
        FieldType::UserBillingName
    ));

    // Test shipping fields
    let shipping_fields = get_shipping_required_fields();
    // let shipping_json = serde_json::to_string_pretty(&shipping_fields)?;

    // Verify shipping fields have expected entries
    assert!(shipping_fields.contains_key("shipping.address.first_name"));
    assert!(shipping_fields.contains_key("shipping.address.last_name"));
    assert!(shipping_fields.contains_key("shipping.address.city"));
    assert!(shipping_fields.contains_key("shipping.address.zip"));
    assert!(shipping_fields.contains_key("shipping.email"));

    // Verify specific shipping field properties
    let shipping_address_line1 = shipping_fields.get("shipping.address.line1").unwrap();
    assert_eq!(shipping_address_line1.display_name, "line1");
    assert!(matches!(
        shipping_address_line1.field_type,
        FieldType::UserShippingAddressLine1
    ));

    #[cfg(feature = "v1")]
    {
        let default_fields = RequiredFields::default();
        // let default_json = serde_json::to_string_pretty(&default_fields.0)?;

        // Check default fields for payment methods
        assert!(default_fields.0.contains_key(&enums::PaymentMethod::Card));
        assert!(default_fields.0.contains_key(&enums::PaymentMethod::Wallet));

        // Verify card payment method types
        if let Some(card_method) = default_fields.0.get(&enums::PaymentMethod::Card) {
            assert!(card_method
                .0
                .contains_key(&enums::PaymentMethodType::Credit));
            assert!(card_method.0.contains_key(&enums::PaymentMethodType::Debit));
        }

        // Verify specific connector fields
        if let Some(card_method) = default_fields.0.get(&enums::PaymentMethod::Card) {
            if let Some(credit_type) = card_method.0.get(&enums::PaymentMethodType::Credit) {
                // Check if Stripe connector exists
                assert!(credit_type.fields.contains_key(&Connector::Stripe));

                // Verify Stripe required fields
                if let Some(stripe_fields) = credit_type.fields.get(&Connector::Stripe) {
                    // Check that card_basic fields are in "common" fields for Stripe
                    assert!(stripe_fields
                        .common
                        .contains_key("payment_method_data.card.card_number"));
                    assert!(stripe_fields
                        .common
                        .contains_key("payment_method_data.card.card_exp_month"));
                    assert!(stripe_fields
                        .common
                        .contains_key("payment_method_data.card.card_exp_year"));
                    assert!(stripe_fields
                        .common
                        .contains_key("payment_method_data.card.card_cvc"));
                }
            }
        }
        // print the result of default required fields as json in new file
        serde_json::to_writer_pretty(
            std::fs::File::create("default_required_fields.json").unwrap(),
            &default_fields,
        )
        .unwrap();
    }
}


// Struct: FacilitapayWebhookBody
// File: crates/hyperswitch_connectors/src/connectors/facilitapay/responses.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct FacilitapayWebhookBody


// Implementation: impl ConnectorValidation for for Sift
// File: crates/hyperswitch_connectors/src/connectors/sift.rs
// Module: hyperswitch_connectors
// Methods: 2 total (0 public)

impl ConnectorValidation for for Sift


// Struct: RedsysOperationsResponse
// File: crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct RedsysOperationsResponse


// Struct: ParentInfo
// File: crates/api_models/src/user_role.rs
// Module: api_models
// Implementations: 0

pub struct ParentInfo


// Function: server
// File: crates/router/src/routes/app.rs
// Module: router

pub fn server(state: AppState) -> Scope


// Implementation: impl ProcessTrackerNew
// File: crates/diesel_models/src/query/process_tracker.rs
// Module: diesel_models
// Methods: 1 total (0 public)

impl ProcessTrackerNew


// Struct: VersionData
// File: crates/hyperswitch_connectors/src/connectors/redsys/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct VersionData


// Implementation: impl Responder
// File: crates/router/src/routes/payments.rs
// Module: router
// Methods: 0 total (0 public)

impl Responder


// Implementation: impl ConnectorCommon for for Placetopay
// File: crates/hyperswitch_connectors/src/connectors/placetopay.rs
// Module: hyperswitch_connectors
// Methods: 5 total (0 public)

impl ConnectorCommon for for Placetopay


// Function: from_bytes
// File: crates/hyperswitch_connectors/src/connectors/tokenio/transformers.rs
// Module: hyperswitch_connectors

pub fn from_bytes(bytes: &[u8]) -> Self


// Struct: Avs
// File: crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct Avs


// Implementation: impl api::Refund for for Loonio
// File: crates/hyperswitch_connectors/src/connectors/loonio.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::Refund for for Loonio


// Struct: VantivDisputeErrors
// File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct VantivDisputeErrors


impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for VaultConnectorFlowData {
    fn from_old_router_data(
        old_router_data: &RouterData<T, Req, Resp>,
    ) -> CustomResult<RouterDataV2<T, Self, Req, Resp>, ConnectorError>
    where
        Self: Sized,
    {
        let resource_common_data = Self {
            merchant_id: old_router_data.merchant_id.clone(),
        };
        Ok(RouterDataV2 {
            flow: std::marker::PhantomData,
            tenant_id: old_router_data.tenant_id.clone(),
            resource_common_data,
            connector_auth_type: old_router_data.connector_auth_type.clone(),
            request: old_router_data.request.clone(),
            response: old_router_data.response.clone(),
        })
    }

    fn to_old_router_data(
        new_router_data: RouterDataV2<T, Self, Req, Resp>,
    ) -> CustomResult<RouterData<T, Req, Resp>, ConnectorError>
    where
        Self: Sized,
    {
        let router_data = get_default_router_data(
            new_router_data.tenant_id.clone(),
            "VaultConnector",
            new_router_data.request,
            new_router_data.response,
        );
        Ok(RouterData {
            connector_auth_type: new_router_data.connector_auth_type.clone(),
            ..router_data
        })
    }
}

impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for ExternalVaultProxyFlowData {
    fn from_old_router_data(
        old_router_data: &RouterData<T, Req, Resp>,
    ) -> CustomResult<RouterDataV2<T, Self, Req, Resp>, ConnectorError>
    where
        Self: Sized,
    {
        let resource_common_data = Self {
            merchant_id: old_router_data.merchant_id.clone(),
            customer_id: old_router_data.customer_id.clone(),
            connector_customer: old_router_data.connector_customer.clone(),
            payment_id: old_router_data.payment_id.clone(),
            attempt_id: old_router_data.attempt_id.clone(),
            status: old_router_data.status,
            payment_method: old_router_data.payment_method,
            description: old_router_data.description.clone(),
            address: old_router_data.address.clone(),
            auth_type: old_router_data.auth_type,
            connector_meta_data: old_router_data.connector_meta_data.clone(),
            amount_captured: old_router_data.amount_captured,
            minor_amount_captured: old_router_data.minor_amount_captured,
            access_token: old_router_data.access_token.clone(),
            session_token: old_router_data.session_token.clone(),
            reference_id: old_router_data.reference_id.clone(),
            payment_method_token: old_router_data.payment_method_token.clone(),
            recurring_mandate_payment_data: old_router_data.recurring_mandate_payment_data.clone(),
            preprocessing_id: old_router_data.preprocessing_id.clone(),
            payment_method_balance: old_router_data.payment_method_balance.clone(),
            connector_api_version: old_router_data.connector_api_version.clone(),
            connector_request_reference_id: old_router_data.connector_request_reference_id.clone(),
            test_mode: old_router_data.test_mode,
            connector_http_status_code: old_router_data.connector_http_status_code,
            external_latency: old_router_data.external_latency,
            apple_pay_flow: old_router_data.apple_pay_flow.clone(),
            connector_response: old_router_data.connector_response.clone(),
            payment_method_status: old_router_data.payment_method_status,
        };
        Ok(RouterDataV2 {
            flow: std::marker::PhantomData,
            tenant_id: old_router_data.tenant_id.clone(),
            resource_common_data,
            connector_auth_type: old_router_data.connector_auth_type.clone(),
            request: old_router_data.request.clone(),
            response: old_router_data.response.clone(),
        })
    }

    fn to_old_router_data(
        new_router_data: RouterDataV2<T, Self, Req, Resp>,
    ) -> CustomResult<RouterData<T, Req, Resp>, ConnectorError>
    where
        Self: Sized,
    {
        let Self {
            merchant_id,
            customer_id,
            connector_customer,
            payment_id,
            attempt_id,
            status,
            payment_method,
            description,
            address,
            auth_type,
            connector_meta_data,
            amount_captured,
            minor_amount_captured,
            access_token,
            session_token,
            reference_id,
            payment_method_token,
            recurring_mandate_payment_data,
            preprocessing_id,
            payment_method_balance,
            connector_api_version,
            connector_request_reference_id,
            test_mode,
            connector_http_status_code,
            external_latency,
            apple_pay_flow,
            connector_response,
            payment_method_status,
        } = new_router_data.resource_common_data;
        let mut router_data = get_default_router_data(
            new_router_data.tenant_id.clone(),
            "external vault proxy",
            new_router_data.request,
            new_router_data.response,
        );
        router_data.merchant_id = merchant_id;
        router_data.customer_id = customer_id;
        router_data.connector_customer = connector_customer;
        router_data.payment_id = payment_id;
        router_data.attempt_id = attempt_id;
        router_data.status = status;
        router_data.payment_method = payment_method;
        router_data.description = description;
        router_data.address = address;
        router_data.auth_type = auth_type;
        router_data.connector_meta_data = connector_meta_data;
        router_data.amount_captured = amount_captured;
        router_data.minor_amount_captured = minor_amount_captured;
        router_data.access_token = access_token;
        router_data.session_token = session_token;
        router_data.reference_id = reference_id;
        router_data.payment_method_token = payment_method_token;
        router_data.recurring_mandate_payment_data = recurring_mandate_payment_data;
        router_data.preprocessing_id = preprocessing_id;
        router_data.payment_method_balance = payment_method_balance;
        router_data.connector_api_version = connector_api_version;
        router_data.connector_request_reference_id = connector_request_reference_id;
        router_data.test_mode = test_mode;
        router_data.connector_http_status_code = connector_http_status_code;
        router_data.external_latency = external_latency;
        router_data.apple_pay_flow = apple_pay_flow;
        router_data.connector_response = connector_response;
        router_data.payment_method_status = payment_method_status;
        Ok(router_data)
    }
}


// Function: from_config
// File: crates/storage_impl/src/lib.rs
// Module: storage_impl

pub fn from_config(
        db_conf: T::Config,
        tenant_config: &dyn config::TenantConfig,
        encryption_key: StrongSecret<Vec<u8>>,
        cache_store: Arc<RedisStore>,
        inmemory_cache_stream: &str,
    ) -> error_stack::Result<Self, StorageError>


// Struct: CryptopayAuthType
// File: crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct CryptopayAuthType


// Struct: WorldlineAuthType
// File: crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct WorldlineAuthType


// Implementation: impl CustomerUpdateInternal
// File: crates/diesel_models/src/customers.rs
// Module: diesel_models
// Methods: 1 total (1 public)

impl CustomerUpdateInternal


// Struct: RuleRequest
// File: crates/router/src/services/authentication/decision.rs
// Module: router
// Implementations: 0

pub struct RuleRequest


// File: crates/diesel_models/src/query/reverse_lookup.rs
// Module: diesel_models
// Public functions: 3

use diesel::{associations::HasTable, ExpressionMethods};

use super::generics;
use crate::{
    reverse_lookup::{ReverseLookup, ReverseLookupNew},
    schema::reverse_lookup::dsl,
    PgPooledConn, StorageResult,
};

impl ReverseLookupNew {
    pub async fn insert(self, conn: &PgPooledConn) -> StorageResult<ReverseLookup> {
        generics::generic_insert(conn, self).await
    }

    pub async fn batch_insert(
        reverse_lookups: Vec<Self>,
        conn: &PgPooledConn,
    ) -> StorageResult<()> {
        generics::generic_insert::<_, _, ReverseLookup>(conn, reverse_lookups).await?;
        Ok(())
    }
}
impl ReverseLookup {
    pub async fn find_by_lookup_id(lookup_id: &str, conn: &PgPooledConn) -> StorageResult<Self> {
        generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
            conn,
            dsl::lookup_id.eq(lookup_id.to_owned()),
        )
        .await
    }
}


// Struct: UserRoleUpdateInternal
// File: crates/diesel_models/src/user_role.rs
// Module: diesel_models
// Implementations: 0

pub struct UserRoleUpdateInternal


// Implementation: impl api::RefundExecute for for Getnet
// File: crates/hyperswitch_connectors/src/connectors/getnet.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::RefundExecute for for Getnet


// Trait: PaymentFilterAnalytics
// File: crates/analytics/src/payments/filters.rs
// Module: analytics

pub trait PaymentFilterAnalytics: LoadRow<PaymentFilterRow>


// Implementation: impl ConnectorSpecifications for for Paytm
// File: crates/hyperswitch_connectors/src/connectors/paytm.rs
// Module: hyperswitch_connectors
// Methods: 3 total (0 public)

impl ConnectorSpecifications for for Paytm


// Struct: AuthReversal
// File: crates/hyperswitch_connectors/src/connectors/worldpayvantiv/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct AuthReversal


// Struct: BillTo
// File: crates/hyperswitch_connectors/src/connectors/barclaycard/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct BillTo


// Struct: PaypalVault
// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct PaypalVault


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

impl api::Refund for for Nordea


// Implementation: impl api::PaymentAuthorize for for Mifinity
// File: crates/hyperswitch_connectors/src/connectors/mifinity.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::PaymentAuthorize for for Mifinity