            "phrae" => Ok(Self::Phrae),
            "phuket" => Ok(Self::Phuket),
            "prachinburi" => Ok(Self::PrachinBuri),
            "phranakhonsiayutthaya" => Ok(Self::PhraNakhonSiAyutthaya),
            "prachuapkhirikhan" => Ok(Self::PrachuapKhiriKhan),
            "ranong" => Ok(Self::Ranong),
            "ratchaburi" => Ok(Self::Ratchaburi),
            "rayong" => Ok(Self::Rayong),
            "roiet" => Ok(Self::RoiEt),
            "sakaeo" => Ok(Self::SaKaeo),
            "sakonnakhon" => Ok(Self::SakonNakhon),
            "samutprakan" => Ok(Self::SamutPrakan),
            "samutsakhon" => Ok(Self::SamutSakhon),
            "samutsongkhram" => Ok(Self::SamutSongkhram),
            "saraburi" => Ok(Self::Saraburi),
            "satun" => Ok(Self::Satun),
            "sisaket" => Ok(Self::SiSaKet),
            "singburi" => Ok(Self::SingBuri),
            "songkhla" => Ok(Self::Songkhla),
            "sukhothai" => Ok(Self::Sukhothai),
            "suphanburi" => Ok(Self::SuphanBuri),
            "suratthani" => Ok(Self::SuratThani),
            "surin" => Ok(Self::Surin),
            "tak" => Ok(Self::Tak),
            "trang" => Ok(Self::Trang),
            "trat" => Ok(Self::Trat),
            "ubonratchathani" => Ok(Self::UbonRatchathani),
            "udonthani" => Ok(Self::UdonThani),
            "uthaithani" => Ok(Self::UthaiThani),
            "uttaradit" => Ok(Self::Uttaradit),
            "yala" => Ok(Self::Yala),
            "yasothon" => Ok(Self::Yasothon),
            _ => Err(errors::ConnectorError::InvalidDataFormat {
                field_name: "address.state",
            }
            .into()),
        }
    }
}

impl ForeignTryFrom<String> for NorwayStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "NorwayStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Akershus" => Ok(Self::Akershus),
                "Buskerud" => Ok(Self::Buskerud),
                "Finnmark" => Ok(Self::Finnmark),
                "Hedmark" => Ok(Self::Hedmark),
                "Hordaland" => Ok(Self::Hordaland),
                "Jan Mayen" => Ok(Self::JanMayen),
                "Møre og Romsdal" => Ok(Self::MoreOgRomsdal),
                "Nord-Trøndelag" => Ok(Self::NordTrondelag),
                "Nordland" => Ok(Self::Nordland),
                "Oppland" => Ok(Self::Oppland),
                "Oslo" => Ok(Self::Oslo),
                "Rogaland" => Ok(Self::Rogaland),
                "Sogn og Fjordane" => Ok(Self::SognOgFjordane),
                "Svalbard" => Ok(Self::Svalbard),
                "Sør-Trøndelag" => Ok(Self::SorTrondelag),
                "Telemark" => Ok(Self::Telemark),
                "Troms" => Ok(Self::Troms),
                "Trøndelag" => Ok(Self::Trondelag),
                "Vest-Agder" => Ok(Self::VestAgder),
                "Vestfold" => Ok(Self::Vestfold),
                "Østfold" => Ok(Self::Ostfold),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for AlbaniaStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "AlbaniaStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Berat" => Ok(Self::Berat),
                "Dibër" => Ok(Self::Diber),
                "Durrës" => Ok(Self::Durres),
                "Elbasan" => Ok(Self::Elbasan),
                "Fier" => Ok(Self::Fier),
                "Gjirokastër" => Ok(Self::Gjirokaster),
                "Korçë" => Ok(Self::Korce),
                "Kukës" => Ok(Self::Kukes),
                "Lezhë" => Ok(Self::Lezhe),
                "Shkodër" => Ok(Self::Shkoder),
                "Tiranë" => Ok(Self::Tirane),
                "Vlorë" => Ok(Self::Vlore),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for AndorraStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "AndorraStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Andorra la Vella" => Ok(Self::AndorraLaVella),
                "Canillo" => Ok(Self::Canillo),
                "Encamp" => Ok(Self::Encamp),
                "Escaldes-Engordany" => Ok(Self::EscaldesEngordany),
                "La Massana" => Ok(Self::LaMassana),
                "Ordino" => Ok(Self::Ordino),
                "Sant Julià de Lòria" => Ok(Self::SantJuliaDeLoria),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for AustriaStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "AustriaStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Burgenland" => Ok(Self::Burgenland),
                "Carinthia" => Ok(Self::Carinthia),
                "Lower Austria" => Ok(Self::LowerAustria),
                "Salzburg" => Ok(Self::Salzburg),
                "Styria" => Ok(Self::Styria),
                "Tyrol" => Ok(Self::Tyrol),
                "Upper Austria" => Ok(Self::UpperAustria),
                "Vienna" => Ok(Self::Vienna),
                "Vorarlberg" => Ok(Self::Vorarlberg),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for RomaniaStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "RomaniaStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Alba" => Ok(Self::Alba),
                "Arad County" => Ok(Self::AradCounty),
                "Argeș" => Ok(Self::Arges),
                "Bacău County" => Ok(Self::BacauCounty),
                "Bihor County" => Ok(Self::BihorCounty),
                "Bistrița-Năsăud County" => Ok(Self::BistritaNasaudCounty),
                "Botoșani County" => Ok(Self::BotosaniCounty),
                "Brăila" => Ok(Self::Braila),
                "Brașov County" => Ok(Self::BrasovCounty),
                "Bucharest" => Ok(Self::Bucharest),
                "Buzău County" => Ok(Self::BuzauCounty),
                "Caraș-Severin County" => Ok(Self::CarasSeverinCounty),
                "Cluj County" => Ok(Self::ClujCounty),
                "Constanța County" => Ok(Self::ConstantaCounty),
                "Covasna County" => Ok(Self::CovasnaCounty),
                "Călărași County" => Ok(Self::CalarasiCounty),
                "Dolj County" => Ok(Self::DoljCounty),
                "Dâmbovița County" => Ok(Self::DambovitaCounty),
                "Galați County" => Ok(Self::GalatiCounty),
                "Giurgiu County" => Ok(Self::GiurgiuCounty),
                "Gorj County" => Ok(Self::GorjCounty),
                "Harghita County" => Ok(Self::HarghitaCounty),
                "Hunedoara County" => Ok(Self::HunedoaraCounty),
                "Ialomița County" => Ok(Self::IalomitaCounty),
                "Iași County" => Ok(Self::IasiCounty),
                "Ilfov County" => Ok(Self::IlfovCounty),
                "Mehedinți County" => Ok(Self::MehedintiCounty),
                "Mureș County" => Ok(Self::MuresCounty),
                "Neamț County" => Ok(Self::NeamtCounty),
                "Olt County" => Ok(Self::OltCounty),
                "Prahova County" => Ok(Self::PrahovaCounty),
                "Satu Mare County" => Ok(Self::SatuMareCounty),
                "Sibiu County" => Ok(Self::SibiuCounty),
                "Suceava County" => Ok(Self::SuceavaCounty),
                "Sălaj County" => Ok(Self::SalajCounty),
                "Teleorman County" => Ok(Self::TeleormanCounty),
                "Timiș County" => Ok(Self::TimisCounty),
                "Tulcea County" => Ok(Self::TulceaCounty),
                "Vaslui County" => Ok(Self::VasluiCounty),
                "Vrancea County" => Ok(Self::VranceaCounty),
                "Vâlcea County" => Ok(Self::ValceaCounty),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for PortugalStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "PortugalStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Aveiro District" => Ok(Self::AveiroDistrict),
                "Azores" => Ok(Self::Azores),
                "Beja District" => Ok(Self::BejaDistrict),
                "Braga District" => Ok(Self::BragaDistrict),
                "Bragança District" => Ok(Self::BragancaDistrict),
                "Castelo Branco District" => Ok(Self::CasteloBrancoDistrict),
                "Coimbra District" => Ok(Self::CoimbraDistrict),
                "Faro District" => Ok(Self::FaroDistrict),
                "Guarda District" => Ok(Self::GuardaDistrict),
                "Leiria District" => Ok(Self::LeiriaDistrict),
                "Lisbon District" => Ok(Self::LisbonDistrict),
                "Madeira" => Ok(Self::Madeira),
                "Portalegre District" => Ok(Self::PortalegreDistrict),
                "Porto District" => Ok(Self::PortoDistrict),
                "Santarém District" => Ok(Self::SantaremDistrict),
                "Setúbal District" => Ok(Self::SetubalDistrict),
                "Viana do Castelo District" => Ok(Self::VianaDoCasteloDistrict),
                "Vila Real District" => Ok(Self::VilaRealDistrict),
                "Viseu District" => Ok(Self::ViseuDistrict),
                "Évora District" => Ok(Self::EvoraDistrict),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for SwitzerlandStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "SwitzerlandStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Aargau" => Ok(Self::Aargau),
                "Appenzell Ausserrhoden" => Ok(Self::AppenzellAusserrhoden),
                "Appenzell Innerrhoden" => Ok(Self::AppenzellInnerrhoden),
                "Basel-Landschaft" => Ok(Self::BaselLandschaft),
                "Canton of Fribourg" => Ok(Self::CantonOfFribourg),
                "Canton of Geneva" => Ok(Self::CantonOfGeneva),
                "Canton of Jura" => Ok(Self::CantonOfJura),
                "Canton of Lucerne" => Ok(Self::CantonOfLucerne),
                "Canton of Neuchâtel" => Ok(Self::CantonOfNeuchatel),
                "Canton of Schaffhausen" => Ok(Self::CantonOfSchaffhausen),
                "Canton of Solothurn" => Ok(Self::CantonOfSolothurn),
                "Canton of St. Gallen" => Ok(Self::CantonOfStGallen),
                "Canton of Valais" => Ok(Self::CantonOfValais),
                "Canton of Vaud" => Ok(Self::CantonOfVaud),
                "Canton of Zug" => Ok(Self::CantonOfZug),
                "Glarus" => Ok(Self::Glarus),
                "Graubünden" => Ok(Self::Graubunden),
                "Nidwalden" => Ok(Self::Nidwalden),
                "Obwalden" => Ok(Self::Obwalden),
                "Schwyz" => Ok(Self::Schwyz),
                "Thurgau" => Ok(Self::Thurgau),
                "Ticino" => Ok(Self::Ticino),
                "Uri" => Ok(Self::Uri),
                "canton of Bern" => Ok(Self::CantonOfBern),
                "canton of Zürich" => Ok(Self::CantonOfZurich),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for NorthMacedoniaStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "NorthMacedoniaStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Aerodrom Municipality" => Ok(Self::AerodromMunicipality),
                "Aračinovo Municipality" => Ok(Self::AracinovoMunicipality),
                "Berovo Municipality" => Ok(Self::BerovoMunicipality),
                "Bitola Municipality" => Ok(Self::BitolaMunicipality),
                "Bogdanci Municipality" => Ok(Self::BogdanciMunicipality),
                "Bogovinje Municipality" => Ok(Self::BogovinjeMunicipality),
                "Bosilovo Municipality" => Ok(Self::BosilovoMunicipality),
                "Brvenica Municipality" => Ok(Self::BrvenicaMunicipality),
                "Butel Municipality" => Ok(Self::ButelMunicipality),
                "Centar Municipality" => Ok(Self::CentarMunicipality),
                "Centar Župa Municipality" => Ok(Self::CentarZupaMunicipality),
                "Debarca Municipality" => Ok(Self::DebarcaMunicipality),
                "Delčevo Municipality" => Ok(Self::DelcevoMunicipality),
                "Demir Hisar Municipality" => Ok(Self::DemirHisarMunicipality),
                "Demir Kapija Municipality" => Ok(Self::DemirKapijaMunicipality),
                "Dojran Municipality" => Ok(Self::DojranMunicipality),
                "Dolneni Municipality" => Ok(Self::DolneniMunicipality),
                "Drugovo Municipality" => Ok(Self::DrugovoMunicipality),
                "Gazi Baba Municipality" => Ok(Self::GaziBabaMunicipality),
                "Gevgelija Municipality" => Ok(Self::GevgelijaMunicipality),
                "Gjorče Petrov Municipality" => Ok(Self::GjorcePetrovMunicipality),
                "Gostivar Municipality" => Ok(Self::GostivarMunicipality),
                "Gradsko Municipality" => Ok(Self::GradskoMunicipality),
                "Greater Skopje" => Ok(Self::GreaterSkopje),
                "Ilinden Municipality" => Ok(Self::IlindenMunicipality),
                "Jegunovce Municipality" => Ok(Self::JegunovceMunicipality),
                "Karbinci" => Ok(Self::Karbinci),
                "Karpoš Municipality" => Ok(Self::KarposMunicipality),
                "Kavadarci Municipality" => Ok(Self::KavadarciMunicipality),
                "Kisela Voda Municipality" => Ok(Self::KiselaVodaMunicipality),
                "Kičevo Municipality" => Ok(Self::KicevoMunicipality),
                "Konče Municipality" => Ok(Self::KonceMunicipality),
                "Kočani Municipality" => Ok(Self::KocaniMunicipality),
                "Kratovo Municipality" => Ok(Self::KratovoMunicipality),
                "Kriva Palanka Municipality" => Ok(Self::KrivaPalankaMunicipality),
                "Krivogaštani Municipality" => Ok(Self::KrivogastaniMunicipality),
                "Kruševo Municipality" => Ok(Self::KrusevoMunicipality),
                "Kumanovo Municipality" => Ok(Self::KumanovoMunicipality),
                "Lipkovo Municipality" => Ok(Self::LipkovoMunicipality),
                "Lozovo Municipality" => Ok(Self::LozovoMunicipality),
                "Makedonska Kamenica Municipality" => Ok(Self::MakedonskaKamenicaMunicipality),
                "Makedonski Brod Municipality" => Ok(Self::MakedonskiBrodMunicipality),
                "Mavrovo and Rostuša Municipality" => Ok(Self::MavrovoAndRostusaMunicipality),
                "Mogila Municipality" => Ok(Self::MogilaMunicipality),
                "Negotino Municipality" => Ok(Self::NegotinoMunicipality),
                "Novaci Municipality" => Ok(Self::NovaciMunicipality),
                "Novo Selo Municipality" => Ok(Self::NovoSeloMunicipality),
                "Ohrid Municipality" => Ok(Self::OhridMunicipality),
                "Oslomej Municipality" => Ok(Self::OslomejMunicipality),
                "Pehčevo Municipality" => Ok(Self::PehcevoMunicipality),
                "Petrovec Municipality" => Ok(Self::PetrovecMunicipality),
                "Plasnica Municipality" => Ok(Self::PlasnicaMunicipality),
                "Prilep Municipality" => Ok(Self::PrilepMunicipality),
                "Probištip Municipality" => Ok(Self::ProbishtipMunicipality),
                "Radoviš Municipality" => Ok(Self::RadovisMunicipality),
                "Rankovce Municipality" => Ok(Self::RankovceMunicipality),
                "Resen Municipality" => Ok(Self::ResenMunicipality),
                "Rosoman Municipality" => Ok(Self::RosomanMunicipality),
                "Saraj Municipality" => Ok(Self::SarajMunicipality),
                "Sopište Municipality" => Ok(Self::SopisteMunicipality),
                "Staro Nagoričane Municipality" => Ok(Self::StaroNagoricaneMunicipality),
                "Struga Municipality" => Ok(Self::StrugaMunicipality),
                "Strumica Municipality" => Ok(Self::StrumicaMunicipality),
                "Studeničani Municipality" => Ok(Self::StudenicaniMunicipality),
                "Sveti Nikole Municipality" => Ok(Self::SvetiNikoleMunicipality),
                "Tearce Municipality" => Ok(Self::TearceMunicipality),
                "Tetovo Municipality" => Ok(Self::TetovoMunicipality),
                "Valandovo Municipality" => Ok(Self::ValandovoMunicipality),
                "Vasilevo Municipality" => Ok(Self::VasilevoMunicipality),
                "Veles Municipality" => Ok(Self::VelesMunicipality),
                "Vevčani Municipality" => Ok(Self::VevcaniMunicipality),
                "Vinica Municipality" => Ok(Self::VinicaMunicipality),
                "Vraneštica Municipality" => Ok(Self::VranesticaMunicipality),
                "Vrapčište Municipality" => Ok(Self::VrapcisteMunicipality),
                "Zajas Municipality" => Ok(Self::ZajasMunicipality),
                "Zelenikovo Municipality" => Ok(Self::ZelenikovoMunicipality),
                "Zrnovci Municipality" => Ok(Self::ZrnovciMunicipality),
                "Čair Municipality" => Ok(Self::CairMunicipality),
                "Čaška Municipality" => Ok(Self::CaskaMunicipality),
                "Češinovo-Obleševo Municipality" => Ok(Self::CesinovoOblesevoMunicipality),
                "Čučer-Sandevo Municipality" => Ok(Self::CucerSandevoMunicipality),
                "Štip Municipality" => Ok(Self::StipMunicipality),
                "Šuto Orizari Municipality" => Ok(Self::ShutoOrizariMunicipality),
                "Želino Municipality" => Ok(Self::ZelinoMunicipality),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for MontenegroStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "MontenegroStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Andrijevica Municipality" => Ok(Self::AndrijevicaMunicipality),
                "Bar Municipality" => Ok(Self::BarMunicipality),
                "Berane Municipality" => Ok(Self::BeraneMunicipality),
                "Bijelo Polje Municipality" => Ok(Self::BijeloPoljeMunicipality),
                "Budva Municipality" => Ok(Self::BudvaMunicipality),
                "Danilovgrad Municipality" => Ok(Self::DanilovgradMunicipality),
                "Gusinje Municipality" => Ok(Self::GusinjeMunicipality),
                "Kolašin Municipality" => Ok(Self::KolasinMunicipality),
                "Kotor Municipality" => Ok(Self::KotorMunicipality),
                "Mojkovac Municipality" => Ok(Self::MojkovacMunicipality),
                "Nikšić Municipality" => Ok(Self::NiksicMunicipality),
                "Petnjica Municipality" => Ok(Self::PetnjicaMunicipality),
                "Plav Municipality" => Ok(Self::PlavMunicipality),
                "Pljevlja Municipality" => Ok(Self::PljevljaMunicipality),
                "Plužine Municipality" => Ok(Self::PlužineMunicipality),
                "Podgorica Municipality" => Ok(Self::PodgoricaMunicipality),
                "Rožaje Municipality" => Ok(Self::RožajeMunicipality),
                "Tivat Municipality" => Ok(Self::TivatMunicipality),
                "Ulcinj Municipality" => Ok(Self::UlcinjMunicipality),
                "Žabljak Municipality" => Ok(Self::ŽabljakMunicipality),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for MonacoStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "MonacoStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Monaco" => Ok(Self::Monaco),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for NetherlandsStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state_abbreviation_check =
            StringExt::<Self>::parse_enum(value.clone(), "NetherlandsStatesAbbreviation");
        match state_abbreviation_check {
            Ok(state_abbreviation) => Ok(state_abbreviation),
            Err(_) => match value.as_str() {
                "Bonaire" => Ok(Self::Bonaire),
                "Drenthe" => Ok(Self::Drenthe),
                "Flevoland" => Ok(Self::Flevoland),
                "Friesland" => Ok(Self::Friesland),
                "Gelderland" => Ok(Self::Gelderland),
                "Groningen" => Ok(Self::Groningen),
                "Limburg" => Ok(Self::Limburg),
                "North Brabant" => Ok(Self::NorthBrabant),
                "North Holland" => Ok(Self::NorthHolland),
                "Overijssel" => Ok(Self::Overijssel),
                "Saba" => Ok(Self::Saba),
                "Sint Eustatius" => Ok(Self::SintEustatius),
                "South Holland" => Ok(Self::SouthHolland),
                "Utrecht" => Ok(Self::Utrecht),
                "Zeeland" => Ok(Self::Zeeland),
                _ => Err(errors::ConnectorError::InvalidDataFormat {
                    field_name: "address.state",
                }
                .into()),
            },
        }
    }
}

impl ForeignTryFrom<String> for NewZealandStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state =
            parse_state_enum::<Self>(value, "NewZealandStatesAbbreviation", "address.state")?;
        match state.as_str() {
            "auckland" | "tamakimakaurau" => Ok(Self::Auckland),
            "bayofplenty" | "toimoana" => Ok(Self::BayOfPlenty),
            "canterbury" | "waitaha" => Ok(Self::Canterbury),
            "chathamislandsterritory" | "wharekauri" => Ok(Self::ChathamIslandsTerritory),
            "gisborne" | "tetairawhiti" => Ok(Self::Gisborne),
            "hawkesbay" | "tematauamaui" => Ok(Self::HawkesBay),
            "manawatuwanganui" => Ok(Self::ManawatūWhanganui),
            "marlborough" => Ok(Self::Marlborough),
            "nelson" | "whakatu" => Ok(Self::Nelson),
            "northland" | "tetaitokerau" => Ok(Self::Northland),
            "otago" | "otakou" => Ok(Self::Otago),
            "southland" | "tetaiaotonga" => Ok(Self::Southland),
            "taranaki" => Ok(Self::Taranaki),
            "tasman" | "tetaioaorere" => Ok(Self::Tasman),
            "waikato" => Ok(Self::Waikato),
            "greaterwellington" | "tepanematuataiao" => Ok(Self::GreaterWellington),
            "westcoast" | "tetaiopoutini" => Ok(Self::WestCoast),
            _ => Err(errors::ConnectorError::InvalidDataFormat {
                field_name: "address.state",
            }
            .into()),
        }
    }
}

impl ForeignTryFrom<String> for SingaporeStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state =
            parse_state_enum::<Self>(value, "SingaporeStatesAbbreviation", "address.state")?;
        match state.as_str() {
            "centralsingapore" => Ok(Self::CentralSingapore),
            "northeast" => Ok(Self::NorthEast),
            "northwest" => Ok(Self::NorthWest),
            "southeast" => Ok(Self::SouthEast),
            "southwest" => Ok(Self::SouthWest),
            _ => Err(errors::ConnectorError::InvalidDataFormat {
                field_name: "address.state",
            }
            .into()),
        }
    }
}

impl ForeignTryFrom<String> for PhilippinesStatesAbbreviation {
    type Error = error_stack::Report<errors::ConnectorError>;
    fn foreign_try_from(value: String) -> Result<Self, Self::Error> {
        let state =
            parse_state_enum::<Self>(value, "PhilippinesStatesAbbreviation", "address.state")?;
        match state.as_str() {
            "abra" => Ok(Self::Abra),
            "agusandelnorte" | "hilagangagusan" => Ok(Self::AgusanDelNorte),
            "agusandelsur" | "timogagusan" => Ok(Self::AgusanDelSur),
            "aklan" => Ok(Self::Aklan),
            "albay" => Ok(Self::Albay),
            "antique" | "antike" => Ok(Self::Antique),
            "apayao" | "apayaw" => Ok(Self::Apayao),
            "aurora" => Ok(Self::Aurora),
            "autonomousregioninmuslimmindanao" | "nagsasarilingrehiyonngmuslimsamindanaw" => {
                Ok(Self::AutonomousRegionInMuslimMindanao)
            }
            "basilan" => Ok(Self::Basilan),
            "bataan" => Ok(Self::Bataan),
            "batanes" => Ok(Self::Batanes),
            "batangas" => Ok(Self::Batangas),
            "benguet" | "benget" => Ok(Self::Benguet),
            "bicol" | "rehiyonngbikol" => Ok(Self::Bicol),
            "biliran" => Ok(Self::Biliran),
            "bohol" => Ok(Self::Bohol),
            "bukidnon" => Ok(Self::Bukidnon),
            "bulacan" | "bulakan" => Ok(Self::Bulacan),
            "cagayan" | "kagayan" => Ok(Self::Cagayan),
            "cagayanvalley" | "rehiyonnglambakngkagayan" => Ok(Self::CagayanValley),
            "calabarzon" | "rehiyonngcalabarzon" => Ok(Self::Calabarzon),
            "camarinesnorte" | "hilagangkamarines" => Ok(Self::CamarinesNorte),
            "camarinessur" | "timogkamarines" => Ok(Self::CamarinesSur),
            "camiguin" | "kamigin" => Ok(Self::Camiguin),
            "capiz" | "kapis" => Ok(Self::Capiz),
            "caraga" | "rehiyonngkaraga" => Ok(Self::Caraga),
            "catanduanes" | "katanduanes" => Ok(Self::Catanduanes),
            "cavite" | "kabite" => Ok(Self::Cavite),
            "cebu" | "sebu" => Ok(Self::Cebu),
            "centralluzon" | "rehiyonnggitnangluzon" => Ok(Self::CentralLuzon),
            "centralvisayas" | "rehiyonnggitnangbisaya" => Ok(Self::CentralVisayas),
            "cordilleraadministrativeregion" | "rehiyonngadministratibongkordilyera" => {
                Ok(Self::CordilleraAdministrativeRegion)
            }
            "cotabato" | "kotabato" => Ok(Self::Cotabato),
            "davao" | "rehiyonngdabaw" => Ok(Self::Davao),
            "davaooccidental" | "kanlurangdabaw" => Ok(Self::DavaoOccidental),
            "davaooriental" | "silangangdabaw" => Ok(Self::DavaoOriental),
            "davaodeoro" => Ok(Self::DavaoDeOro),
            "davaodelnorte" | "hilagangdabaw" => Ok(Self::DavaoDelNorte),
            "davaodelsur" | "timogdabaw" => Ok(Self::DavaoDelSur),
            "dinagatislands" | "pulongdinagat" => Ok(Self::DinagatIslands),
            "easternsamar" | "silangangsamar" => Ok(Self::EasternSamar),
            "easternvisayas" | "rehiyonngsilangangbisaya" => Ok(Self::EasternVisayas),
            "guimaras" | "gimaras" => Ok(Self::Guimaras),
            "hilagangiloko" | "ilocosnorte" => Ok(Self::HilagangIloko),
            "hilaganglanaw" | "lanaodelnorte" => Ok(Self::HilagangLanaw),


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

pub struct ProcessingInformationResponse


// Module Structure
// File: crates/hyperswitch_connectors/src/connectors/riskified.rs
// Module: hyperswitch_connectors

// Public submodules:
pub mod transformers;


// Implementation: impl State for for CardTokenized
// File: crates/router/src/core/payment_methods/tokenize/card_executor.rs
// Module: router
// Methods: 0 total (0 public)

impl State for for CardTokenized


// Implementation: impl api::Payment for for Trustpay
// File: crates/hyperswitch_connectors/src/connectors/trustpay.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::Payment for for Trustpay


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

pub struct PaypalThreeDsResponse


// Implementation: impl api::PayoutCreate for for Wise
// File: crates/hyperswitch_connectors/src/connectors/wise.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::PayoutCreate for for Wise


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

pub fn get_token_from_tokenization_service(
    state: &routes::SessionState,
    network_token_requestor_ref_id: String,
    pm_data: &domain::PaymentMethod,
) -> errors::RouterResult<domain::NetworkTokenData>


// Function: api_key_retrieve
// File: crates/router/src/routes/api_keys.rs
// Module: router

pub fn api_key_retrieve(
    state: web::Data<AppState>,
    req: HttpRequest,
    path: web::Path<common_utils::id_type::ApiKeyId>,
) -> impl Responder


// Struct: FiservemeaPaymentCardResponse
// File: crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct FiservemeaPaymentCardResponse


// File: crates/router/src/core/payments.rs
// Module: router
// Public functions: 98
// Public structs: 16

pub mod access_token;
pub mod conditional_configs;
pub mod customers;
pub mod flows;
pub mod helpers;
pub mod operations;

#[cfg(feature = "retry")]
pub mod retry;
pub mod routing;
#[cfg(feature = "v2")]
pub mod session_operation;
pub mod tokenization;
pub mod transformers;
pub mod types;
#[cfg(feature = "v2")]
pub mod vault_session;
#[cfg(feature = "olap")]
use std::collections::HashMap;
use std::{
    collections::HashSet, fmt::Debug, marker::PhantomData, ops::Deref, str::FromStr, time::Instant,
    vec::IntoIter,
};

use external_services::grpc_client;

#[cfg(feature = "v2")]
pub mod payment_methods;

use std::future;

#[cfg(feature = "olap")]
use api_models::admin::MerchantConnectorInfo;
use api_models::{
    self, enums,
    mandates::RecurringDetails,
    payments::{self as payments_api},
};
pub use common_enums::enums::{CallConnectorAction, GatewaySystem};
use common_types::payments as common_payments_types;
use common_utils::{
    ext_traits::{AsyncExt, StringExt},
    id_type, pii,
    types::{AmountConvertor, MinorUnit, Surcharge},
};
use diesel_models::{ephemeral_key, fraud_check::FraudCheck, refund as diesel_refund};
use error_stack::{report, ResultExt};
use events::EventInfo;
use futures::future::join_all;
use helpers::{decrypt_paze_token, ApplePayData};
#[cfg(feature = "v2")]
use hyperswitch_domain_models::payments::{
    PaymentAttemptListData, PaymentCancelData, PaymentCaptureData, PaymentConfirmData,
    PaymentIntentData, PaymentStatusData,
};
#[cfg(feature = "v2")]
use hyperswitch_domain_models::router_response_types::RedirectForm;
pub use hyperswitch_domain_models::{
    mandates::MandateData,
    payment_address::PaymentAddress,
    payments::{self as domain_payments, HeaderPayload},
    router_data::{PaymentMethodToken, RouterData},
    router_request_types::CustomerDetails,
};
use hyperswitch_domain_models::{
    payments::{self, payment_intent::CustomerData, ClickToPayMetaData},
    router_data::AccessToken,
};
use masking::{ExposeInterface, PeekInterface, Secret};
#[cfg(feature = "v2")]
use operations::ValidateStatusForOperation;
use redis_interface::errors::RedisError;
use router_env::{instrument, tracing};
#[cfg(feature = "olap")]
use router_types::transformers::ForeignFrom;
use rustc_hash::FxHashMap;
use scheduler::utils as pt_utils;
#[cfg(feature = "v2")]
pub use session_operation::payments_session_core;
#[cfg(feature = "olap")]
use strum::IntoEnumIterator;
use time;

#[cfg(feature = "v1")]
pub use self::operations::{
    PaymentApprove, PaymentCancel, PaymentCancelPostCapture, PaymentCapture, PaymentConfirm,
    PaymentCreate, PaymentIncrementalAuthorization, PaymentPostSessionTokens, PaymentReject,
    PaymentSession, PaymentSessionUpdate, PaymentStatus, PaymentUpdate, PaymentUpdateMetadata,
};
use self::{
    conditional_configs::perform_decision_management,
    flows::{ConstructFlowSpecificData, Feature},
    operations::{BoxedOperation, Operation, PaymentResponse},
    routing::{self as self_routing, SessionFlowRoutingInput},
};
#[cfg(feature = "v1")]
use super::unified_connector_service::update_gateway_system_in_feature_metadata;
use super::{
    errors::StorageErrorExt, payment_methods::surcharge_decision_configs, routing::TransactionData,
    unified_connector_service::should_call_unified_connector_service,
};
#[cfg(feature = "v1")]
use crate::core::debit_routing;
#[cfg(feature = "frm")]
use crate::core::fraud_check as frm_core;
#[cfg(feature = "v2")]
use crate::core::payment_methods::vault;
#[cfg(feature = "v1")]
use crate::core::routing::helpers as routing_helpers;
#[cfg(all(feature = "v1", feature = "dynamic_routing"))]
use crate::types::api::convert_connector_data_to_routable_connectors;
use crate::{
    configs::settings::{
        ApplePayPreDecryptFlow, GooglePayPreDecryptFlow, PaymentFlow, PaymentMethodTypeTokenFilter,
    },
    consts,
    core::{
        errors::{self, CustomResult, RouterResponse, RouterResult},
        payment_methods::{cards, network_tokenization},
        payouts,
        routing::{self as core_routing},
        unified_authentication_service::types::{ClickToPay, UnifiedAuthenticationService},
        utils::{self as core_utils},
    },
    db::StorageInterface,
    logger,
    routes::{app::ReqState, metrics, payment_methods::ParentPaymentMethodToken, SessionState},
    services::{self, api::Authenticate, ConnectorRedirectResponse},
    types::{
        self as router_types,
        api::{self, ConnectorCallType, ConnectorCommon},
        domain,
        storage::{self, enums as storage_enums, payment_attempt::PaymentAttemptExt},
        transformers::ForeignTryInto,
    },
    utils::{
        self, add_apple_pay_flow_metrics, add_connector_http_status_code_metrics, Encode,
        OptionExt, ValueExt,
    },
    workflows::payment_sync,
};
#[cfg(feature = "v1")]
use crate::{
    core::authentication as authentication_core,
    types::{api::authentication, BrowserInformation},
};

#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn payments_operation_core<F, Req, Op, FData, D>(
    state: &SessionState,
    req_state: ReqState,
    merchant_context: domain::MerchantContext,
    profile: &domain::Profile,
    operation: Op,
    req: Req,
    get_tracker_response: operations::GetTrackerResponse<D>,
    call_connector_action: CallConnectorAction,
    header_payload: HeaderPayload,
) -> RouterResult<(
    D,
    Req,
    Option<domain::Customer>,
    Option<u16>,
    Option<u128>,
    common_types::domain::ConnectorResponseData,
)>
where
    F: Send + Clone + Sync,
    Req: Send + Sync + Authenticate,
    Op: Operation<F, Req, Data = D> + Send + Sync,
    D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,

    // To create connector flow specific interface data
    D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
    RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,

    // To construct connector flow specific api
    dyn api::Connector:
        services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,

    RouterData<F, FData, router_types::PaymentsResponseData>:
        hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>,

    // To perform router related operation for PaymentResponse
    PaymentResponse: Operation<F, FData, Data = D>,
    FData: Send + Sync + Clone,
{
    let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);

    // Get the trackers related to track the state of the payment
    let operations::GetTrackerResponse { mut payment_data } = get_tracker_response;

    operation
        .to_domain()?
        .create_or_fetch_payment_method(state, &merchant_context, profile, &mut payment_data)
        .await?;

    let (_operation, customer) = operation
        .to_domain()?
        .get_customer_details(
            state,
            &mut payment_data,
            merchant_context.get_merchant_key_store(),
            merchant_context.get_merchant_account().storage_scheme,
        )
        .await
        .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
        .attach_printable("Failed while fetching/creating customer")?;

    operation
        .to_domain()?
        .run_decision_manager(state, &mut payment_data, profile)
        .await
        .change_context(errors::ApiErrorResponse::InternalServerError)
        .attach_printable("Failed to run decision manager")?;

    let connector = operation
        .to_domain()?
        .perform_routing(&merchant_context, profile, state, &mut payment_data)
        .await?;

    let mut connector_http_status_code = None;
    let (payment_data, connector_response_data) = match connector {
        ConnectorCallType::PreDetermined(connector_data) => {
            let (mca_type_details, updated_customer, router_data, tokenization_action) =
                call_connector_service_prerequisites(
                    state,
                    req_state.clone(),
                    &merchant_context,
                    connector_data.connector_data.clone(),
                    &operation,
                    &mut payment_data,
                    &customer,
                    call_connector_action.clone(),
                    None,
                    header_payload.clone(),
                    None,
                    profile,
                    false,
                    false, //should_retry_with_pan is set to false in case of PreDetermined ConnectorCallType
                    req.should_return_raw_response(),
                )
                .await?;

            let router_data = decide_unified_connector_service_call(
                state,
                req_state.clone(),
                &merchant_context,
                connector_data.connector_data.clone(),
                &operation,
                &mut payment_data,
                &customer,
                call_connector_action.clone(),
                None, // schedule_time is not used in PreDetermined ConnectorCallType
                header_payload.clone(),
                #[cfg(feature = "frm")]
                None,
                profile,
                false,
                false, //should_retry_with_pan is set to false in case of PreDetermined ConnectorCallType
                req.should_return_raw_response(),
                mca_type_details,
                router_data,
                updated_customer,
                tokenization_action,
            )
            .await?;

            let connector_response_data = common_types::domain::ConnectorResponseData {
                raw_connector_response: router_data.raw_connector_response.clone(),
            };

            let payments_response_operation = Box::new(PaymentResponse);

            connector_http_status_code = router_data.connector_http_status_code;
            add_connector_http_status_code_metrics(connector_http_status_code);

            payments_response_operation
                .to_post_update_tracker()?
                .save_pm_and_mandate(
                    state,
                    &router_data,
                    &merchant_context,
                    &mut payment_data,
                    profile,
                )
                .await?;

            let payment_data = payments_response_operation
                .to_post_update_tracker()?
                .update_tracker(
                    state,
                    payment_data,
                    router_data,
                    merchant_context.get_merchant_key_store(),
                    merchant_context.get_merchant_account().storage_scheme,
                )
                .await?;

            (payment_data, connector_response_data)
        }
        ConnectorCallType::Retryable(connectors) => {
            let mut connectors = connectors.clone().into_iter();
            let connector_data = get_connector_data(&mut connectors)?;

            let (mca_type_details, updated_customer, router_data, tokenization_action) =
                call_connector_service_prerequisites(
                    state,
                    req_state.clone(),
                    &merchant_context,
                    connector_data.connector_data.clone(),
                    &operation,
                    &mut payment_data,
                    &customer,
                    call_connector_action.clone(),
                    None,
                    header_payload.clone(),
                    None,
                    profile,
                    false,
                    false, //should_retry_with_pan is set to false in case of Retryable ConnectorCallType
                    req.should_return_raw_response(),
                )
                .await?;

            let router_data = decide_unified_connector_service_call(
                state,
                req_state.clone(),
                &merchant_context,
                connector_data.connector_data.clone(),
                &operation,
                &mut payment_data,
                &customer,
                call_connector_action.clone(),
                None, // schedule_time is not used in Retryable ConnectorCallType
                header_payload.clone(),
                #[cfg(feature = "frm")]
                None,
                profile,
                true,
                false, //should_retry_with_pan is set to false in case of PreDetermined ConnectorCallType
                req.should_return_raw_response(),
                mca_type_details,
                router_data,
                updated_customer,
                tokenization_action,
            )
            .await?;

            let connector_response_data = common_types::domain::ConnectorResponseData {
                raw_connector_response: router_data.raw_connector_response.clone(),
            };

            let payments_response_operation = Box::new(PaymentResponse);

            connector_http_status_code = router_data.connector_http_status_code;
            add_connector_http_status_code_metrics(connector_http_status_code);

            payments_response_operation
                .to_post_update_tracker()?
                .save_pm_and_mandate(
                    state,
                    &router_data,
                    &merchant_context,
                    &mut payment_data,
                    profile,
                )
                .await?;

            let payment_data = payments_response_operation
                .to_post_update_tracker()?
                .update_tracker(
                    state,
                    payment_data,
                    router_data,
                    merchant_context.get_merchant_key_store(),
                    merchant_context.get_merchant_account().storage_scheme,
                )
                .await?;

            (payment_data, connector_response_data)
        }
        ConnectorCallType::SessionMultiple(vec) => todo!(),
        ConnectorCallType::Skip => (
            payment_data,
            common_types::domain::ConnectorResponseData {
                raw_connector_response: None,
            },
        ),
    };

    let payment_intent_status = payment_data.get_payment_intent().status;

    // Delete the tokens after payment
    payment_data
        .get_payment_attempt()
        .payment_token
        .as_ref()
        .zip(Some(payment_data.get_payment_attempt().payment_method_type))
        .map(ParentPaymentMethodToken::return_key_for_token)
        .async_map(|key_for_token| async move {
            let _ = vault::delete_payment_token(state, &key_for_token, payment_intent_status)
                .await
                .inspect_err(|err| logger::error!("Failed to delete payment_token: {:?}", err));
        })
        .await;

    Ok((
        payment_data,
        req,
        customer,
        connector_http_status_code,
        None,
        connector_response_data,
    ))
}

#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn internal_payments_operation_core<F, Req, Op, FData, D>(
    state: &SessionState,
    req_state: ReqState,
    merchant_context: domain::MerchantContext,
    profile: &domain::Profile,
    operation: Op,
    req: Req,
    get_tracker_response: operations::GetTrackerResponse<D>,
    call_connector_action: CallConnectorAction,
    header_payload: HeaderPayload,
) -> RouterResult<(
    D,
    Req,
    Option<u16>,
    Option<u128>,
    common_types::domain::ConnectorResponseData,
)>
where
    F: Send + Clone + Sync,
    Req: Send + Sync + Authenticate,
    Op: Operation<F, Req, Data = D> + Send + Sync,
    D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,

    // To create connector flow specific interface data
    D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
    RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,

    // To construct connector flow specific api
    dyn api::Connector:
        services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,

    RouterData<F, FData, router_types::PaymentsResponseData>:
        hyperswitch_domain_models::router_data::TrackerPostUpdateObjects<F, FData, D>,

    // To perform router related operation for PaymentResponse
    PaymentResponse: Operation<F, FData, Data = D>,
    FData: Send + Sync + Clone,
{
    let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);

    // Get the trackers related to track the state of the payment
    let operations::GetTrackerResponse { mut payment_data } = get_tracker_response;

    let connector_data = operation
        .to_domain()?
        .get_connector_from_request(state, &req, &mut payment_data)
        .await?;

    let merchant_connector_account = payment_data
        .get_merchant_connector_details()
        .map(domain::MerchantConnectorAccountTypeDetails::MerchantConnectorDetails)
        .ok_or_else(|| {
            error_stack::report!(errors::ApiErrorResponse::InternalServerError)
                .attach_printable("Merchant connector details not found in payment data")
        })?;

    operation
        .to_domain()?
        .populate_payment_data(
            state,
            &mut payment_data,
            &merchant_context,
            profile,
            &connector_data,
        )
        .await?;

    let router_data = connector_service_decider(
        state,
        req_state.clone(),
        &merchant_context,
        connector_data.clone(),
        &operation,
        &mut payment_data,
        call_connector_action.clone(),
        header_payload.clone(),
        profile,
        req.should_return_raw_response(),
        merchant_connector_account,
    )
    .await?;

    let connector_response_data = common_types::domain::ConnectorResponseData {
        raw_connector_response: router_data.raw_connector_response.clone(),
    };

    let payments_response_operation = Box::new(PaymentResponse);

    let connector_http_status_code = router_data.connector_http_status_code;
    add_connector_http_status_code_metrics(connector_http_status_code);

    let payment_data = payments_response_operation
        .to_post_update_tracker()?
        .update_tracker(
            state,
            payment_data,
            router_data,
            merchant_context.get_merchant_key_store(),
            merchant_context.get_merchant_account().storage_scheme,
        )
        .await?;

    Ok((
        payment_data,
        req,
        connector_http_status_code,
        None,
        connector_response_data,
    ))
}

#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn payments_operation_core<F, Req, Op, FData, D>(
    state: &SessionState,
    req_state: ReqState,
    merchant_context: &domain::MerchantContext,
    profile_id_from_auth_layer: Option<id_type::ProfileId>,
    operation: Op,
    req: Req,
    call_connector_action: CallConnectorAction,
    auth_flow: services::AuthFlow,
    eligible_connectors: Option<Vec<common_enums::RoutableConnectors>>,
    header_payload: HeaderPayload,
) -> RouterResult<(D, Req, Option<domain::Customer>, Option<u16>, Option<u128>)>
where
    F: Send + Clone + Sync,
    Req: Authenticate + Clone,
    Op: Operation<F, Req, Data = D> + Send + Sync,
    D: OperationSessionGetters<F> + OperationSessionSetters<F> + Send + Sync + Clone,

    // To create connector flow specific interface data
    D: ConstructFlowSpecificData<F, FData, router_types::PaymentsResponseData>,
    RouterData<F, FData, router_types::PaymentsResponseData>: Feature<F, FData>,

    // To construct connector flow specific api
    dyn api::Connector:
        services::api::ConnectorIntegration<F, FData, router_types::PaymentsResponseData>,

    // To perform router related operation for PaymentResponse
    PaymentResponse: Operation<F, FData, Data = D>,
    FData: Send + Sync + Clone + router_types::Capturable,
{
    let operation: BoxedOperation<'_, F, Req, D> = Box::new(operation);

    tracing::Span::current().record(
        "merchant_id",
        merchant_context
            .get_merchant_account()
            .get_id()
            .get_string_repr(),
    );
    let (operation, validate_result) = operation
        .to_validate_request()?
        .validate_request(&req, merchant_context)?;

    tracing::Span::current().record("payment_id", format!("{}", validate_result.payment_id));
    // get profile from headers
    let operations::GetTrackerResponse {
        operation,
        customer_details,
        mut payment_data,
        business_profile,
        mandate_type,
    } = operation
        .to_get_tracker()?
        .get_trackers(
            state,
            &validate_result.payment_id,
            &req,
            merchant_context,
            auth_flow,
            &header_payload,
        )
        .await?;

    operation
        .to_get_tracker()?
        .validate_request_with_state(state, &req, &mut payment_data, &business_profile)
        .await?;

    core_utils::validate_profile_id_from_auth_layer(
        profile_id_from_auth_layer,
        &payment_data.get_payment_intent().clone(),
    )?;

    let (operation, customer) = operation
        .to_domain()?
        // get_customer_details
        .get_or_create_customer_details(
            state,
            &mut payment_data,
            customer_details,
            merchant_context.get_merchant_key_store(),
            merchant_context.get_merchant_account().storage_scheme,
        )
        .await
        .to_not_found_response(errors::ApiErrorResponse::CustomerNotFound)
        .attach_printable("Failed while fetching/creating customer")?;

    let authentication_type =
        call_decision_manager(state, merchant_context, &business_profile, &payment_data).await?;

    payment_data.set_authentication_type_in_attempt(authentication_type);

    let connector = get_connector_choice(
        &operation,
        state,
        &req,
        merchant_context,
        &business_profile,
        &mut payment_data,
        eligible_connectors,
        mandate_type,
    )
    .await?;

    let payment_method_token = get_decrypted_wallet_payment_method_token(
        &operation,
        state,
        merchant_context,
        &mut payment_data,
        connector.as_ref(),
    )
    .await?;

    payment_method_token.map(|token| payment_data.set_payment_method_token(Some(token)));

    let (connector, debit_routing_output) = debit_routing::perform_debit_routing(
        &operation,
        state,
        &business_profile,
        &mut payment_data,
        connector,
    )
    .await;

    operation
        .to_domain()?
        .apply_three_ds_authentication_strategy(state, &mut payment_data, &business_profile)
        .await?;

    let should_add_task_to_process_tracker = should_add_task_to_process_tracker(&payment_data);

    let locale = header_payload.locale.clone();

    payment_data = tokenize_in_router_when_confirm_false_or_external_authentication(
        state,
        &operation,
        &mut payment_data,
        &validate_result,
        merchant_context.get_merchant_key_store(),
        &customer,
        &business_profile,
    )
    .await?;

    let mut connector_http_status_code = None;
    let mut external_latency = None;
    if let Some(connector_details) = connector {
        // Fetch and check FRM configs
        #[cfg(feature = "frm")]
        let mut frm_info = None;
        #[allow(unused_variables, unused_mut)]
        let mut should_continue_transaction: bool = true;
        #[cfg(feature = "frm")]
        let mut should_continue_capture: bool = true;
        #[cfg(feature = "frm")]
        let frm_configs = if state.conf.frm.enabled {
            Box::pin(frm_core::call_frm_before_connector_call(
                &operation,
                merchant_context,
                &mut payment_data,
                state,
                &mut frm_info,
                &customer,
                &mut should_continue_transaction,
                &mut should_continue_capture,
            ))
            .await?
        } else {
            None
        };
        #[cfg(feature = "frm")]
        logger::debug!(
            "frm_configs: {:?}\nshould_continue_transaction: {:?}\nshould_continue_capture: {:?}",
            frm_configs,
            should_continue_transaction,
            should_continue_capture,
        );

        let is_eligible_for_uas = helpers::is_merchant_eligible_authentication_service(
            merchant_context.get_merchant_account().get_id(),
            state,
        )
        .await?;

        if is_eligible_for_uas {
            operation
                .to_domain()?
                .call_unified_authentication_service_if_eligible(
                    state,
                    &mut payment_data,
                    &mut should_continue_transaction,
                    &connector_details,
                    &business_profile,
                    merchant_context.get_merchant_key_store(),
                    mandate_type,
                )
                .await?;
        } else {
            logger::info!(
                "skipping authentication service call since the merchant is not eligible."
            );

            operation
                .to_domain()?
                .call_external_three_ds_authentication_if_eligible(
                    state,
                    &mut payment_data,
                    &mut should_continue_transaction,
                    &connector_details,
                    &business_profile,
                    merchant_context.get_merchant_key_store(),
                    mandate_type,
                )
                .await?;
        };

        operation
            .to_domain()?
            .payments_dynamic_tax_calculation(
                state,
                &mut payment_data,
                &connector_details,
                &business_profile,
                merchant_context,
            )
            .await?;

        if should_continue_transaction {
            #[cfg(feature = "frm")]
            match (
                should_continue_capture,
                payment_data.get_payment_attempt().capture_method,
            ) {
                (
                    false,
                    Some(storage_enums::CaptureMethod::Automatic)
                    | Some(storage_enums::CaptureMethod::SequentialAutomatic),
                )
                | (false, Some(storage_enums::CaptureMethod::Scheduled)) => {
                    if let Some(info) = &mut frm_info {
                        if let Some(frm_data) = &mut info.frm_data {
                            frm_data.fraud_check.payment_capture_method =
                                payment_data.get_payment_attempt().capture_method;
                        }
                    }
                    payment_data
                        .set_capture_method_in_attempt(storage_enums::CaptureMethod::Manual);
                    logger::debug!("payment_id : {:?} capture method has been changed to manual, since it has configured Post FRM flow",payment_data.get_payment_attempt().payment_id);
                }
                _ => (),
            };

            payment_data = match connector_details {
                ConnectorCallType::PreDetermined(ref connector) => {
                    #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                    let routable_connectors = convert_connector_data_to_routable_connectors(
                        std::slice::from_ref(connector),
                    )
                    .map_err(|e| logger::error!(routable_connector_error=?e))
                    .unwrap_or_default();
                    let schedule_time = if should_add_task_to_process_tracker {
                        payment_sync::get_sync_process_schedule_time(
                            &*state.store,
                            connector.connector_data.connector.id(),
                            merchant_context.get_merchant_account().get_id(),
                            0,
                        )
                        .await
                        .change_context(errors::ApiErrorResponse::InternalServerError)
                        .attach_printable("Failed while getting process schedule time")?
                    } else {
                        None
                    };

                    let (merchant_connector_account, router_data, tokenization_action) =
                        call_connector_service_prerequisites(
                            state,
                            merchant_context,
                            connector.connector_data.clone(),
                            &operation,
                            &mut payment_data,
                            &customer,
                            &validate_result,
                            &business_profile,
                            false,
                            None,
                        )
                        .await?;

                    let (router_data, mca) = decide_unified_connector_service_call(
                        state,
                        req_state.clone(),
                        merchant_context,
                        connector.connector_data.clone(),
                        &operation,
                        &mut payment_data,
                        &customer,
                        call_connector_action.clone(),
                        &validate_result,
                        schedule_time,
                        header_payload.clone(),
                        #[cfg(feature = "frm")]
                        frm_info.as_ref().and_then(|fi| fi.suggested_action),
                        #[cfg(not(feature = "frm"))]
                        None,
                        &business_profile,
                        false,
                        <Req as Authenticate>::should_return_raw_response(&req),
                        merchant_connector_account,
                        router_data,
                        tokenization_action,
                    )
                    .await?;

                    let op_ref = &operation;
                    let should_trigger_post_processing_flows = is_operation_confirm(&operation);

                    let operation = Box::new(PaymentResponse);

                    connector_http_status_code = router_data.connector_http_status_code;
                    external_latency = router_data.external_latency;
                    //add connector http status code metrics
                    add_connector_http_status_code_metrics(connector_http_status_code);

                    operation
                        .to_post_update_tracker()?
                        .save_pm_and_mandate(
                            state,
                            &router_data,
                            merchant_context,
                            &mut payment_data,
                            &business_profile,
                        )
                        .await?;

                    let mut payment_data = operation
                        .to_post_update_tracker()?
                        .update_tracker(
                            state,
                            payment_data,
                            router_data,
                            merchant_context.get_merchant_key_store(),
                            merchant_context.get_merchant_account().storage_scheme,
                            &locale,
                            #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                            routable_connectors,
                            #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                            &business_profile,
                        )
                        .await?;

                    if should_trigger_post_processing_flows {
                        complete_postprocessing_steps_if_required(
                            state,
                            merchant_context,
                            &customer,
                            &mca,
                            &connector.connector_data,
                            &mut payment_data,
                            op_ref,
                            Some(header_payload.clone()),
                        )
                        .await?;
                    }

                    if is_eligible_for_uas {
                        complete_confirmation_for_click_to_pay_if_required(
                            state,
                            merchant_context,
                            &payment_data,
                        )
                        .await?;
                    }

                    payment_data
                }

                ConnectorCallType::Retryable(ref connectors) => {
                    #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                    let routable_connectors =
                        convert_connector_data_to_routable_connectors(connectors)
                            .map_err(|e| logger::error!(routable_connector_error=?e))
                            .unwrap_or_default();

                    let mut connectors = connectors.clone().into_iter();

                    let (connector_data, routing_decision) =
                        get_connector_data_with_routing_decision(
                            &mut connectors,
                            &business_profile,
                            debit_routing_output,
                        )?;

                    let schedule_time = if should_add_task_to_process_tracker {
                        payment_sync::get_sync_process_schedule_time(
                            &*state.store,
                            connector_data.connector.id(),
                            merchant_context.get_merchant_account().get_id(),
                            0,
                        )
                        .await
                        .change_context(errors::ApiErrorResponse::InternalServerError)
                        .attach_printable("Failed while getting process schedule time")?
                    } else {
                        None
                    };

                    let (merchant_connector_account, router_data, tokenization_action) =
                        call_connector_service_prerequisites(
                            state,
                            merchant_context,
                            connector_data.clone(),
                            &operation,
                            &mut payment_data,
                            &customer,
                            &validate_result,
                            &business_profile,
                            false,
                            routing_decision,
                        )
                        .await?;

                    let (router_data, mca) = decide_unified_connector_service_call(
                        state,
                        req_state.clone(),
                        merchant_context,
                        connector_data.clone(),
                        &operation,
                        &mut payment_data,
                        &customer,
                        call_connector_action.clone(),
                        &validate_result,
                        schedule_time,
                        header_payload.clone(),
                        #[cfg(feature = "frm")]
                        frm_info.as_ref().and_then(|fi| fi.suggested_action),
                        #[cfg(not(feature = "frm"))]
                        None,
                        &business_profile,
                        false,
                        <Req as Authenticate>::should_return_raw_response(&req),
                        merchant_connector_account,
                        router_data,
                        tokenization_action,
                    )
                    .await?;

                    #[cfg(all(feature = "retry", feature = "v1"))]
                    let mut router_data = router_data;
                    #[cfg(all(feature = "retry", feature = "v1"))]
                    {
                        use crate::core::payments::retry::{self, GsmValidation};
                        let config_bool = retry::config_should_call_gsm(
                            &*state.store,
                            merchant_context.get_merchant_account().get_id(),
                            &business_profile,
                        )
                        .await;

                        if config_bool && router_data.should_call_gsm() {
                            router_data = retry::do_gsm_actions(
                                state,
                                req_state.clone(),
                                &mut payment_data,
                                connectors,
                                &connector_data,
                                router_data,
                                merchant_context,
                                &operation,
                                &customer,
                                &validate_result,
                                schedule_time,
                                #[cfg(feature = "frm")]
                                frm_info.as_ref().and_then(|fi| fi.suggested_action),
                                #[cfg(not(feature = "frm"))]
                                None,
                                &business_profile,
                            )
                            .await?;
                        };
                    }

                    let op_ref = &operation;
                    let should_trigger_post_processing_flows = is_operation_confirm(&operation);

                    let operation = Box::new(PaymentResponse);
                    connector_http_status_code = router_data.connector_http_status_code;
                    external_latency = router_data.external_latency;
                    //add connector http status code metrics
                    add_connector_http_status_code_metrics(connector_http_status_code);

                    operation
                        .to_post_update_tracker()?
                        .save_pm_and_mandate(
                            state,
                            &router_data,
                            merchant_context,
                            &mut payment_data,
                            &business_profile,
                        )
                        .await?;

                    let mut payment_data = operation
                        .to_post_update_tracker()?
                        .update_tracker(
                            state,
                            payment_data,
                            router_data,
                            merchant_context.get_merchant_key_store(),
                            merchant_context.get_merchant_account().storage_scheme,
                            &locale,
                            #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                            routable_connectors,
                            #[cfg(all(feature = "dynamic_routing", feature = "v1"))]
                            &business_profile,
                        )
                        .await?;

                    if should_trigger_post_processing_flows {
                        complete_postprocessing_steps_if_required(
                            state,
                            merchant_context,
                            &customer,
                            &mca,
                            &connector_data,
                            &mut payment_data,
                            op_ref,
                            Some(header_payload.clone()),
                        )
                        .await?;
                    }

                    if is_eligible_for_uas {
                        complete_confirmation_for_click_to_pay_if_required(
                            state,
                            merchant_context,
                            &payment_data,
                        )
                        .await?;
                    }

                    payment_data
                }

                ConnectorCallType::SessionMultiple(connectors) => {
                    let session_surcharge_details =
                        call_surcharge_decision_management_for_session_flow(
                            state,
                            merchant_context,
                            &business_profile,
                            payment_data.get_payment_attempt(),
                            payment_data.get_payment_intent(),
                            payment_data.get_billing_address(),
                            &connectors,
                        )
                        .await?;
                    Box::pin(call_multiple_connectors_service(
                        state,
                        merchant_context,
                        connectors,
                        &operation,
                        payment_data,
                        &customer,
                        session_surcharge_details,
                        &business_profile,
                        header_payload.clone(),
                        <Req as Authenticate>::should_return_raw_response(&req),
                    ))
                    .await?
                }
            };

            #[cfg(feature = "frm")]
            if let Some(fraud_info) = &mut frm_info {
                #[cfg(feature = "v1")]
                Box::pin(frm_core::post_payment_frm_core(
                    state,
                    req_state,
                    merchant_context,
                    &mut payment_data,
                    fraud_info,
                    frm_configs
                        .clone()
                        .ok_or(errors::ApiErrorResponse::MissingRequiredField {
                            field_name: "frm_configs",
                        })
                        .attach_printable("Frm configs label not found")?,
                    &customer,
                    &mut should_continue_capture,
                ))
                .await?;
            }
        } else {
            (_, payment_data) = operation
                .to_update_tracker()?
                .update_trackers(
                    state,
                    req_state,
                    payment_data.clone(),
                    customer.clone(),
                    validate_result.storage_scheme,
                    None,
                    merchant_context.get_merchant_key_store(),
                    #[cfg(feature = "frm")]
                    frm_info.and_then(|info| info.suggested_action),
                    #[cfg(not(feature = "frm"))]
                    None,
                    header_payload.clone(),
                )
                .await?;
        }

        let payment_intent_status = payment_data.get_payment_intent().status;

        payment_data
            .get_payment_attempt()
            .payment_token
            .as_ref()
            .zip(payment_data.get_payment_attempt().payment_method)
            .map(ParentPaymentMethodToken::create_key_for_token)
            .async_map(|key_for_hyperswitch_token| async move {
                if key_for_hyperswitch_token
                    .should_delete_payment_method_token(payment_intent_status)
                {
                    let _ = key_for_hyperswitch_token.delete(state).await;
                }
            })
            .await;
    } else {
        (_, payment_data) = operation
            .to_update_tracker()?
            .update_trackers(
                state,
                req_state,
                payment_data.clone(),
                customer.clone(),
                validate_result.storage_scheme,
                None,
                merchant_context.get_merchant_key_store(),
                None,
                header_payload.clone(),
            )
            .await?;
    }

    let cloned_payment_data = payment_data.clone();
    let cloned_customer = customer.clone();

    #[cfg(feature = "v1")]
    operation
        .to_domain()?
        .store_extended_card_info_temporarily(
            state,
            payment_data.get_payment_intent().get_id(),
            &business_profile,
            payment_data.get_payment_method_data(),
        )
        .await?;

    utils::trigger_payments_webhook(
        merchant_context.clone(),
        business_profile,
        cloned_payment_data,
        cloned_customer,
        state,
        operation,
    )
    .await
    .map_err(|error| logger::warn!(payments_outgoing_webhook_error=?error))
    .ok();

    Ok((
        payment_data,
        req,
        customer,
        connector_http_status_code,
        external_latency,
    ))
}

#[cfg(feature = "v1")]
// This function is intended for use when the feature being implemented is not aligned with the
// core payment operations.
#[allow(clippy::too_many_arguments, clippy::type_complexity)]
#[instrument(skip_all, fields(payment_id, merchant_id))]
pub async fn proxy_for_payments_operation_core<F, Req, Op, FData, D>(
    state: &SessionState,
    req_state: ReqState,
    merchant_context: domain::MerchantContext,
    profile_id_from_auth_layer: Option<id_type::ProfileId>,
    operation: Op,
    req: Req,


// Implementation: impl EmailClient for for SmtpServer
// File: crates/external_services/src/email/smtp.rs
// Module: external_services
// Methods: 2 total (0 public)

impl EmailClient for for SmtpServer


// File: crates/analytics/src/disputes/metrics/total_amount_disputed.rs
// Module: analytics

use std::collections::HashSet;

use api_models::analytics::{
    disputes::{DisputeDimensions, DisputeFilters, DisputeMetricsBucketIdentifier},
    Granularity, TimeRange,
};
use common_utils::errors::ReportSwitchExt;
use error_stack::ResultExt;
use time::PrimitiveDateTime;

use super::DisputeMetricRow;
use crate::{
    enums::AuthInfo,
    query::{Aggregate, GroupByClause, QueryBuilder, QueryFilter, SeriesBucket, ToSql, Window},
    types::{AnalyticsCollection, AnalyticsDataSource, MetricsError, MetricsResult},
};
#[derive(Default)]
pub(super) struct TotalAmountDisputed {}

#[async_trait::async_trait]
impl<T> super::DisputeMetric<T> for TotalAmountDisputed
where
    T: AnalyticsDataSource + super::DisputeMetricAnalytics,
    PrimitiveDateTime: ToSql<T>,
    AnalyticsCollection: ToSql<T>,
    Granularity: GroupByClause<T>,
    Aggregate<&'static str>: ToSql<T>,
    Window<&'static str>: ToSql<T>,
{
    async fn load_metrics(
        &self,
        dimensions: &[DisputeDimensions],
        auth: &AuthInfo,
        filters: &DisputeFilters,
        granularity: Option<Granularity>,
        time_range: &TimeRange,
        pool: &T,
    ) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
    where
        T: AnalyticsDataSource + super::DisputeMetricAnalytics,
    {
        let mut query_builder: QueryBuilder<T> = QueryBuilder::new(AnalyticsCollection::Dispute);

        for dim in dimensions {
            query_builder.add_select_column(dim).switch()?;
        }

        query_builder
            .add_select_column(Aggregate::Sum {
                field: "dispute_amount",
                alias: Some("total"),
            })
            .switch()?;
        query_builder
            .add_select_column(Aggregate::Min {
                field: "created_at",
                alias: Some("start_bucket"),
            })
            .switch()?;
        query_builder
            .add_select_column(Aggregate::Max {
                field: "created_at",
                alias: Some("end_bucket"),
            })
            .switch()?;

        filters.set_filter_clause(&mut query_builder).switch()?;

        auth.set_filter_clause(&mut query_builder).switch()?;

        time_range
            .set_filter_clause(&mut query_builder)
            .attach_printable("Error filtering time range")
            .switch()?;

        for dim in dimensions.iter() {
            query_builder.add_group_by_clause(dim).switch()?;
        }

        if let Some(granularity) = granularity {
            granularity
                .set_group_by_clause(&mut query_builder)
                .switch()?;
        }
        query_builder
            .add_filter_clause("dispute_status", "dispute_won")
            .switch()?;

        query_builder
            .execute_query::<DisputeMetricRow, _>(pool)
            .await
            .change_context(MetricsError::QueryBuildingError)?
            .change_context(MetricsError::QueryExecutionFailure)?
            .into_iter()
            .map(|i| {
                Ok((
                    DisputeMetricsBucketIdentifier::new(
                        i.dispute_stage.as_ref().map(|i| i.0),
                        i.connector.clone(),
                        i.currency.as_ref().map(|i| i.0),
                        TimeRange {
                            start_time: match (granularity, i.start_bucket) {
                                (Some(g), Some(st)) => g.clip_to_start(st)?,
                                _ => time_range.start_time,
                            },
                            end_time: granularity.as_ref().map_or_else(
                                || Ok(time_range.end_time),
                                |g| i.end_bucket.map(|et| g.clip_to_end(et)).transpose(),
                            )?,
                        },
                    ),
                    i,
                ))
            })
            .collect::<error_stack::Result<HashSet<_>, crate::query::PostProcessingError>>()
            .change_context(MetricsError::PostProcessingFailure)
    }
}


// Struct: RedisStore
// File: crates/storage_impl/src/redis.rs
// Module: storage_impl
// Implementations: 3
// Traits: std::fmt::Debug, RedisConnInterface

pub struct RedisStore


// Struct: NovalnetSyncRequest
// File: crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct NovalnetSyncRequest


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

pub fn get_card_detail(
    _pm: &domain::PaymentMethod,
    response: Card,
) -> CustomResult<api::CardDetailFromLocker, errors::VaultError>


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

pub fn create_recipient_disburse_account(
    state: &SessionState,
    merchant_context: &domain::MerchantContext,
    connector_data: &api::ConnectorData,
    payout_data: &mut PayoutData,
) -> RouterResult<()>


// Struct: KafkaRefundEvent
// File: crates/router/src/services/kafka/refund_event.rs
// Module: router
// Implementations: 4
// Traits: super::KafkaMessage, super::KafkaMessage

pub struct KafkaRefundEvent<'a>


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

impl api::ConnectorAccessToken for for Redsys


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

pub struct StaxCustomerResponse


// Implementation: impl api::PaymentSync for for Coingate
// File: crates/hyperswitch_connectors/src/connectors/coingate.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::PaymentSync for for Coingate


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

pub struct GetnetCancelRequest


// Function: create_profile_from_merchant_account
// File: crates/router/src/types/api/admin.rs
// Module: router

pub fn create_profile_from_merchant_account(
    state: &SessionState,
    merchant_account: domain::MerchantAccount,
    request: ProfileCreate,
    key_store: &MerchantKeyStore,
) -> Result<domain::Profile, error_stack::Report<errors::ApiErrorResponse>>


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

pub fn get_merchant_account_from_db(
        &self,
        state: SessionState,
    ) -> UserResult<MerchantAccount>


// Struct: Processor
// File: crates/hyperswitch_connectors/src/connectors/authipay/transformers.rs
// Module: hyperswitch_connectors
// Implementations: 0

pub struct Processor