                    fields(
                        vec![],
                        vec![],
                        vec![
                            RequiredField::BillingEmail,
                            RequiredField::BillingCountries(vec!["ALL"]),
                            RequiredField::BillingFirstName("first_name", FieldType::UserFullName),
                            RequiredField::BillingLastName("last_name", FieldType::UserFullName),
                        ],
                    ),
                ),
                (
                    Connector::Bankofamerica,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::Email.to_tuple(),
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Cybersource,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingEmail.to_tuple(),
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Novalnet,
                    fields(vec![], vec![], vec![RequiredField::BillingEmail]),
                ),
                (
                    Connector::Paysafe,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Wellsfargo,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::Email.to_tuple(),
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                            RequiredField::ShippingFirstName.to_tuple(),
                            RequiredField::ShippingLastName.to_tuple(),
                            RequiredField::ShippingAddressCity.to_tuple(),
                            RequiredField::ShippingAddressState.to_tuple(),
                            RequiredField::ShippingAddressZip.to_tuple(),
                            RequiredField::ShippingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::ShippingAddressLine1.to_tuple(),
                        ]),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::SamsungPay,
            connectors(vec![(
                Connector::Cybersource,
                RequiredFieldFinal {
                    mandate: HashMap::new(),
                    non_mandate: HashMap::new(),
                    common: HashMap::from([
                        RequiredField::BillingEmail.to_tuple(),
                        RequiredField::BillingFirstName(
                            "billing_first_name",
                            FieldType::UserBillingName,
                        )
                        .to_tuple(),
                        RequiredField::BillingLastName(
                            "billing_last_name",
                            FieldType::UserBillingName,
                        )
                        .to_tuple(),
                        RequiredField::BillingAddressCity.to_tuple(),
                        RequiredField::BillingAddressState.to_tuple(),
                        RequiredField::BillingAddressZip.to_tuple(),
                        RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                        RequiredField::BillingAddressLine1.to_tuple(),
                    ]),
                },
            )]),
        ),
        (
            enums::PaymentMethodType::GooglePay,
            connectors(vec![
                (Connector::Adyen, fields(vec![], vec![], vec![])),
                (
                    Connector::Bankofamerica,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::Email.to_tuple(),
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Barclaycard,
                    fields(vec![], vec![], [full_name(), billing_address()].concat()),
                ),
                (Connector::Bluesnap, fields(vec![], vec![], vec![])),
                (Connector::Noon, fields(vec![], vec![], vec![])),
                (
                    Connector::Novalnet,
                    fields(vec![], vec![], vec![RequiredField::BillingEmail]),
                ),
                (
                    Connector::Nuvei,
                    fields(
                        vec![],
                        vec![],
                        vec![
                            RequiredField::BillingEmail,
                            RequiredField::BillingCountries(vec!["ALL"]),
                            RequiredField::BillingFirstName("first_name", FieldType::UserFullName),
                            RequiredField::BillingLastName("last_name", FieldType::UserFullName),
                        ],
                    ),
                ),
                (Connector::Airwallex, fields(vec![], vec![], vec![])),
                (Connector::Authorizedotnet, fields(vec![], vec![], vec![])),
                (Connector::Checkout, fields(vec![], vec![], vec![])),
                (Connector::Globalpay, fields(vec![], vec![], vec![])),
                (
                    Connector::Multisafepay,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                            RequiredField::BillingAddressLine2.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Cybersource,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingEmail.to_tuple(),
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                        ]),
                    },
                ),
                (Connector::Payu, fields(vec![], vec![], vec![])),
                (Connector::Rapyd, fields(vec![], vec![], vec![])),
                (Connector::Stripe, fields(vec![], vec![], vec![])),
                (Connector::Trustpay, fields(vec![], vec![], vec![])),
                (
                    Connector::Wellsfargo,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::Email.to_tuple(),
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                            RequiredField::ShippingFirstName.to_tuple(),
                            RequiredField::ShippingLastName.to_tuple(),
                            RequiredField::ShippingAddressCity.to_tuple(),
                            RequiredField::ShippingAddressState.to_tuple(),
                            RequiredField::ShippingAddressZip.to_tuple(),
                            RequiredField::ShippingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::ShippingAddressLine1.to_tuple(),
                        ]),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::WeChatPay,
            connectors(vec![
                (Connector::Stripe, fields(vec![], vec![], vec![])),
                (Connector::Adyen, fields(vec![], vec![], vec![])),
            ]),
        ),
        (
            enums::PaymentMethodType::AliPay,
            connectors(vec![
                (Connector::Stripe, fields(vec![], vec![], vec![])),
                (Connector::Adyen, fields(vec![], vec![], vec![])),
            ]),
        ),
        (
            enums::PaymentMethodType::AliPayHk,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::AmazonPay,
            connectors(vec![
                (Connector::Stripe, fields(vec![], vec![], vec![])),
                (
                    Connector::Amazonpay,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::ShippingFirstName.to_tuple(),
                            RequiredField::ShippingLastName.to_tuple(),
                            RequiredField::ShippingAddressLine1.to_tuple(),
                            RequiredField::ShippingAddressCity.to_tuple(),
                            RequiredField::ShippingAddressState.to_tuple(),
                            RequiredField::ShippingAddressZip.to_tuple(),
                            RequiredField::ShippingPhone.to_tuple(),
                        ]),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::Cashapp,
            connectors(vec![(Connector::Stripe, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::MbWay,
            connectors(vec![(
                Connector::Adyen,
                fields(
                    vec![],
                    vec![
                        RequiredField::BillingPhone,
                        RequiredField::BillingPhoneCountryCode,
                    ],
                    vec![],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::KakaoPay,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::Twint,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::Gcash,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::Vipps,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::Dana,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::Momo,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::Swish,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::TouchNGo,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            // Added shipping fields for the SDK flow to accept it from wallet directly,
            // this won't show up in SDK in payment's sheet but will be used in the background
            enums::PaymentMethodType::Paypal,
            connectors(vec![
                (
                    Connector::Adyen,
                    fields(vec![], vec![], vec![RequiredField::BillingEmail]),
                ),
                (Connector::Braintree, fields(vec![], vec![], vec![])),
                (
                    Connector::Novalnet,
                    fields(vec![], vec![], vec![RequiredField::BillingEmail]),
                ),
                (
                    Connector::Paypal,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::ShippingFirstName.to_tuple(),
                            RequiredField::ShippingLastName.to_tuple(),
                            RequiredField::ShippingAddressCity.to_tuple(),
                            RequiredField::ShippingAddressState.to_tuple(),
                            RequiredField::ShippingAddressZip.to_tuple(),
                            RequiredField::ShippingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::ShippingAddressLine1.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Airwallex,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::Mifinity,
            connectors(vec![(
                Connector::Mifinity,
                fields(
                    vec![],
                    vec![],
                    vec![
                        RequiredField::MifinityDateOfBirth,
                        RequiredField::BillingAddressLine1,
                        RequiredField::BillingAddressCity,
                        RequiredField::BillingFirstName("first_name", FieldType::UserFullName),
                        RequiredField::BillingLastName("last_name", FieldType::UserFullName),
                        RequiredField::BillingPhone,
                        RequiredField::BillingPhoneCountryCode,
                        RequiredField::BillingCountries(vec![
                            "BR", "CN", "SG", "MY", "DE", "CH", "DK", "GB", "ES", "AD", "GI", "FI",
                            "FR", "GR", "HR", "IT", "JP", "MX", "AR", "CO", "CL", "PE", "VE", "UY",
                            "PY", "BO", "EC", "GT", "HN", "SV", "NI", "CR", "PA", "DO", "CU", "PR",
                            "NL", "NO", "PL", "PT", "SE", "RU", "TR", "TW", "HK", "MO", "AX", "AL",
                            "DZ", "AS", "AO", "AI", "AG", "AM", "AW", "AU", "AT", "AZ", "BS", "BH",
                            "BD", "BB", "BE", "BZ", "BJ", "BM", "BT", "BQ", "BA", "BW", "IO", "BN",
                            "BG", "BF", "BI", "KH", "CM", "CA", "CV", "KY", "CF", "TD", "CX", "CC",
                            "KM", "CG", "CK", "CI", "CW", "CY", "CZ", "DJ", "DM", "EG", "GQ", "ER",
                            "EE", "ET", "FK", "FO", "FJ", "GF", "PF", "TF", "GA", "GM", "GE", "GH",
                            "GL", "GD", "GP", "GU", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "IS",
                            "IN", "ID", "IE", "IM", "IL", "JE", "JO", "KZ", "KE", "KI", "KW", "KG",
                            "LA", "LV", "LB", "LS", "LI", "LT", "LU", "MK", "MG", "MW", "MV", "ML",
                            "MT", "MH", "MQ", "MR", "MU", "YT", "FM", "MD", "MC", "MN", "ME", "MS",
                            "MA", "MZ", "NA", "NR", "NP", "NC", "NZ", "NE", "NG", "NU", "NF", "MP",
                            "OM", "PK", "PW", "PS", "PG", "PH", "PN", "QA", "RE", "RO", "RW", "BL",
                            "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS",
                            "SC", "SL", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "KR", "LK", "SR",
                            "SJ", "SZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TM", "TC", "TV",
                            "UG", "UA", "AE", "UZ", "VU", "VN", "VG", "VI", "WF", "EH", "ZM",
                        ]),
                        RequiredField::BillingEmail,
                        RequiredField::MifinityLanguagePreference(vec![
                            "BR", "PT_BR", "CN", "ZH_CN", "DE", "DK", "DA", "DA_DK", "EN", "ES",
                            "FI", "FR", "GR", "EL", "EL_GR", "HR", "IT", "JP", "JA", "JA_JP", "LA",
                            "ES_LA", "NL", "NO", "PL", "PT", "RU", "SV", "SE", "SV_SE", "ZH", "TW",
                            "ZH_TW",
                        ]),
                    ],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::Skrill,
            connectors(vec![
                (
                    Connector::Airwallex,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingEmail.to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
                (
                    Connector::Paysafe,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingEmail.to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
            ]),
        ),
    ])
}

#[cfg(feature = "v1")]
fn get_pay_later_required_fields() -> HashMap<enums::PaymentMethodType, ConnectorFields> {
    HashMap::from([
        (
            enums::PaymentMethodType::AfterpayClearpay,
            connectors(vec![
                (
                    Connector::Stripe,
                    fields(
                        vec![],
                        vec![
                            RequiredField::BillingEmail,
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            ),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            ),
                            RequiredField::BillingAddressLine1,
                            RequiredField::BillingAddressCity,
                            RequiredField::BillingAddressZip,
                            RequiredField::BillingAddressCountries(vec![
                                "GB", "AU", "CA", "US", "NZ",
                            ]),
                            RequiredField::BillingAddressState,
                            RequiredField::ShippingFirstName,
                            RequiredField::ShippingLastName,
                            RequiredField::ShippingAddressCity,
                            RequiredField::ShippingAddressState,
                            RequiredField::ShippingAddressZip,
                            RequiredField::ShippingAddressCountries(vec!["ALL"]),
                            RequiredField::ShippingAddressLine1,
                        ],
                        vec![],
                    ),
                ),
                (
                    Connector::Adyen,
                    fields(
                        vec![],
                        vec![
                            RequiredField::BillingEmail,
                            RequiredField::BillingFirstName(
                                "billing_first_name",
                                FieldType::UserBillingName,
                            ),
                            RequiredField::BillingLastName(
                                "billing_last_name",
                                FieldType::UserBillingName,
                            ),
                            RequiredField::BillingAddressLine1,
                            RequiredField::BillingAddressLine2,
                            RequiredField::BillingAddressCity,
                            RequiredField::BillingAddressZip,
                            RequiredField::BillingAddressCountries(vec![
                                "GB", "AU", "CA", "US", "NZ",
                            ]),
                            RequiredField::BillingAddressState,
                            RequiredField::ShippingAddressCity,
                            RequiredField::ShippingAddressZip,
                            RequiredField::ShippingAddressCountries(vec![
                                "GB", "AU", "CA", "US", "NZ",
                            ]),
                            RequiredField::ShippingAddressLine1,
                            RequiredField::ShippingAddressLine2,
                        ],
                        vec![],
                    ),
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::Flexiti,
            connectors(vec![(
                Connector::Flexiti,
                RequiredFieldFinal {
                    mandate: HashMap::new(),
                    non_mandate: HashMap::from([
                        RequiredField::BillingUserFirstName.to_tuple(),
                        RequiredField::BillingUserLastName.to_tuple(),
                        RequiredField::BillingAddressCity.to_tuple(),
                        RequiredField::BillingAddressState.to_tuple(),
                        RequiredField::BillingAddressZip.to_tuple(),
                        RequiredField::BillingAddressLine1.to_tuple(),
                        RequiredField::BillingAddressLine2.to_tuple(),
                        RequiredField::BillingAddressState.to_tuple(),
                        RequiredField::ShippingFirstName.to_tuple(),
                        RequiredField::ShippingLastName.to_tuple(),
                        RequiredField::ShippingAddressLine1.to_tuple(),
                        RequiredField::ShippingAddressLine2.to_tuple(),
                        RequiredField::ShippingAddressZip.to_tuple(),
                        RequiredField::ShippingAddressCity.to_tuple(),
                        RequiredField::ShippingAddressState.to_tuple(),
                    ]),
                    common: HashMap::new(),
                },
            )]),
        ),
        (
            enums::PaymentMethodType::Klarna,
            connectors(vec![
                (
                    Connector::Stripe,
                    fields(
                        vec![],
                        vec![
                            RequiredField::BillingAddressCountries(vec![
                                "AU", "AT", "BE", "CA", "CZ", "DK", "FI", "FR", "GR", "DE", "IE",
                                "IT", "NL", "NZ", "NO", "PL", "PT", "RO", "ES", "SE", "CH", "GB",
                                "US",
                            ]),
                            RequiredField::BillingEmail,
                        ],
                        vec![],
                    ),
                ),
                (
                    Connector::Adyen,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::new(),
                        common: HashMap::from([
                            RequiredField::BillingAddressCountries(vec!["ALL"]).to_tuple(),
                            RequiredField::BillingEmail.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Klarna,
                    fields(
                        vec![],
                        vec![],
                        vec![RequiredField::BillingAddressCountries(vec![
                            "AU", "AT", "BE", "CA", "CZ", "DK", "FI", "FR", "DE", "GR", "IE", "IT",
                            "NL", "NZ", "NO", "PL", "PT", "ES", "SE", "CH", "GB", "US",
                        ])],
                    ),
                ),
                (
                    Connector::Airwallex,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([RequiredField::BillingAddressCountries(vec![
                            "AT", "BE", "FI", "FR", "DE", "GR", "IE", "IT", "NL", "PT", "ES", "DK",
                            "NO", "PL", "SE", "CH", "GB", "CZ", "US",
                        ])
                        .to_tuple()]),
                        common: HashMap::new(),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::Affirm,
            connectors(vec![
                (Connector::Stripe, fields(vec![], vec![], vec![])),
                (
                    Connector::Adyen,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["US"]).to_tuple(),
                            RequiredField::BillingPhone.to_tuple(),
                            RequiredField::BillingPhoneCountryCode.to_tuple(),
                            RequiredField::BillingEmail.to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                            RequiredField::BillingAddressLine2.to_tuple(),
                            RequiredField::ShippingAddressLine1.to_tuple(),
                            RequiredField::ShippingAddressLine2.to_tuple(),
                            RequiredField::ShippingAddressZip.to_tuple(),
                            RequiredField::ShippingAddressCity.to_tuple(),
                            RequiredField::ShippingCountries(vec!["US"]).to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::PayBright,
            connectors(vec![(
                Connector::Adyen,
                RequiredFieldFinal {
                    mandate: HashMap::new(),
                    non_mandate: HashMap::from([
                        RequiredField::BillingUserFirstName.to_tuple(),
                        RequiredField::BillingUserLastName.to_tuple(),
                        RequiredField::BillingAddressCity.to_tuple(),
                        RequiredField::BillingAddressState.to_tuple(),
                        RequiredField::BillingAddressZip.to_tuple(),
                        RequiredField::BillingAddressCountries(vec!["CA"]).to_tuple(),
                        RequiredField::BillingPhone.to_tuple(),
                        RequiredField::BillingPhoneCountryCode.to_tuple(),
                        RequiredField::BillingEmail.to_tuple(),
                        RequiredField::BillingAddressLine1.to_tuple(),
                        RequiredField::BillingAddressLine2.to_tuple(),
                        RequiredField::ShippingAddressCity.to_tuple(),
                        RequiredField::ShippingAddressZip.to_tuple(),
                        RequiredField::ShippingAddressCountries(vec!["ALL"]).to_tuple(),
                        RequiredField::ShippingAddressLine1.to_tuple(),
                        RequiredField::ShippingAddressLine2.to_tuple(),
                    ]),
                    common: HashMap::new(),
                },
            )]),
        ),
        (
            enums::PaymentMethodType::Walley,
            connectors(vec![(
                Connector::Adyen,
                fields(
                    vec![],
                    vec![
                        RequiredField::BillingPhone,
                        RequiredField::BillingAddressCountries(vec!["DK", "FI", "NO", "SE"]),
                        RequiredField::BillingPhoneCountryCode,
                        RequiredField::BillingEmail,
                    ],
                    vec![],
                ),
            )]),
        ),
        (
            enums::PaymentMethodType::Alma,
            connectors(vec![(
                Connector::Adyen,
                RequiredFieldFinal {
                    mandate: HashMap::new(),
                    non_mandate: HashMap::from([
                        RequiredField::BillingFirstName(
                            "billing_first_name",
                            FieldType::UserBillingName,
                        )
                        .to_tuple(),
                        RequiredField::BillingLastName(
                            "billing_last_name",
                            FieldType::UserBillingName,
                        )
                        .to_tuple(),
                        RequiredField::BillingAddressCity.to_tuple(),
                        RequiredField::BillingAddressState.to_tuple(),
                        RequiredField::BillingAddressZip.to_tuple(),
                        RequiredField::BillingAddressCountries(vec!["FR"]).to_tuple(),
                        RequiredField::BillingPhone.to_tuple(),
                        RequiredField::BillingPhoneCountryCode.to_tuple(),
                        RequiredField::BillingEmail.to_tuple(),
                        RequiredField::BillingAddressLine1.to_tuple(),
                        RequiredField::BillingAddressLine2.to_tuple(),
                    ]),
                    common: HashMap::new(),
                },
            )]),
        ),
        (
            enums::PaymentMethodType::Atome,
            connectors(vec![
                (
                    Connector::Adyen,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["MY", "SG"]).to_tuple(),
                            RequiredField::BillingPhone.to_tuple(),
                            RequiredField::BillingPhoneCountryCode.to_tuple(),
                            RequiredField::BillingEmail.to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                            RequiredField::BillingAddressLine2.to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
                (
                    Connector::Airwallex,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BillingPhone.to_tuple(),
                            RequiredField::BillingPhoneCountryCode.to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
            ]),
        ),
    ])
}

#[cfg(feature = "v1")]
fn get_voucher_required_fields() -> HashMap<enums::PaymentMethodType, ConnectorFields> {
    HashMap::from([
        (
            enums::PaymentMethodType::Boleto,
            connectors(vec![
                (
                    Connector::Adyen,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BoletoSocialSecurityNumber.to_tuple(),
                            RequiredField::BillingUserFirstName.to_tuple(),
                            RequiredField::BillingUserLastName.to_tuple(),
                            RequiredField::BillingAddressCity.to_tuple(),
                            RequiredField::BillingAddressState.to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["BR"]).to_tuple(),
                            RequiredField::BillingAddressLine1.to_tuple(),
                            RequiredField::BillingAddressLine2.to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
                (Connector::Zen, fields(vec![], vec![], vec![])),
            ]),
        ),
        (
            enums::PaymentMethodType::Alfamart,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::Indomaret,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::Oxxo,
            connectors(vec![(Connector::Adyen, fields(vec![], vec![], vec![]))]),
        ),
        (
            enums::PaymentMethodType::SevenEleven,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name_phone(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::Lawson,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name_phone(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::MiniStop,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name_phone(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::FamilyMart,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name_phone(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::Seicomart,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name_phone(), vec![]),
            )]),
        ),
        (
            enums::PaymentMethodType::PayEasy,
            connectors(vec![(
                Connector::Adyen,
                fields(vec![], billing_email_billing_name_phone(), vec![]),
            )]),
        ),
    ])
}

#[cfg(feature = "v1")]
fn get_bank_debit_required_fields() -> HashMap<enums::PaymentMethodType, ConnectorFields> {
    HashMap::from([
        (
            enums::PaymentMethodType::Ach,
            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::AchBankDebitAccountNumber.to_tuple(),
                            RequiredField::AchBankDebitRoutingNumber.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::AchBankDebitAccountNumber.to_tuple(),
                            RequiredField::AchBankDebitRoutingNumber.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Dwolla,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),
                        non_mandate: HashMap::from([
                            RequiredField::BillingFirstName(
                                "first_name",
                                FieldType::UserBillingName,
                            )
                            .to_tuple(),
                            RequiredField::BillingLastName("last_name", FieldType::UserBillingName)
                                .to_tuple(),
                            RequiredField::AchBankDebitAccountNumber.to_tuple(),
                            RequiredField::AchBankDebitRoutingNumber.to_tuple(),
                            RequiredField::AchBankDebitBankAccountHolderName.to_tuple(),
                            RequiredField::AchBankDebitBankType(vec![
                                enums::BankType::Checking,
                                enums::BankType::Savings,
                            ])
                            .to_tuple(),
                        ]),
                        common: HashMap::new(),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::Sepa,
            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::SepaBankDebitIban.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::SepaBankDebitIban.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Deutschebank,
                    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::BillingEmail.to_tuple(),
                            RequiredField::SepaBankDebitIban.to_tuple(),
                        ]),
                    },
                ),
                (
                    Connector::Inespay,
                    fields(vec![], vec![], vec![RequiredField::SepaBankDebitIban]),
                ),
                (
                    Connector::Nordea,
                    RequiredFieldFinal {
                        mandate: HashMap::new(),

                        non_mandate: HashMap::new(),

                        common: HashMap::from([
                            RequiredField::BillingAddressCountries(vec!["DK,FI,NO,SE"]).to_tuple(),
                            RequiredField::SepaBankDebitIban.to_tuple(),
                        ]),
                    },
                ),
            ]),
        ),
        (
            enums::PaymentMethodType::Bacs,
            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::BacsBankDebitAccountNumber.to_tuple(),
                            RequiredField::BacsBankDebitSortCode.to_tuple(),
                            RequiredField::BillingAddressCountries(vec!["UK"]).to_tuple(),
                            RequiredField::BillingAddressZip.to_tuple(),
                            RequiredField::BillingAddressLine1.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::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(


// Function: set_dashboard_metadata
// File: crates/router/src/routes/user.rs
// Module: router

pub fn set_dashboard_metadata(
    state: web::Data<AppState>,
    req: HttpRequest,
    json_payload: web::Json<user_api::dashboard_metadata::SetMetaDataRequest>,
) -> HttpResponse


// Implementation: impl api::PaymentCapture for for Stripebilling
// File: crates/hyperswitch_connectors/src/connectors/stripebilling.rs
// Module: hyperswitch_connectors
// Methods: 0 total (0 public)

impl api::PaymentCapture for for Stripebilling


// Struct: TaxData
// File: crates/router/src/core/payments.rs
// Module: router
// Implementations: 0

pub struct TaxData


            | Self::CLP
            | Self::CNY
            | Self::COP
            | Self::CRC
            | Self::CUC
            | Self::CUP
            | Self::CVE
            | Self::CZK
            | Self::DJF
            | Self::DKK
            | Self::DOP
            | Self::DZD
            | Self::EGP
            | Self::ERN
            | Self::ETB
            | Self::EUR
            | Self::FJD
            | Self::FKP
            | Self::GBP
            | Self::GEL
            | Self::GHS
            | Self::GIP
            | Self::GMD
            | Self::GNF
            | Self::GTQ
            | Self::GYD
            | Self::HKD
            | Self::HNL
            | Self::HRK
            | Self::HTG
            | Self::HUF
            | Self::IDR
            | Self::ILS
            | Self::INR
            | Self::IRR
            | Self::ISK
            | Self::JMD
            | Self::JPY
            | Self::KES
            | Self::KGS
            | Self::KHR
            | Self::KMF
            | Self::KPW
            | Self::KRW
            | Self::KYD
            | Self::KZT
            | Self::LAK
            | Self::LBP
            | Self::LKR
            | Self::LRD
            | Self::LSL
            | Self::MAD
            | Self::MDL
            | Self::MGA
            | Self::MKD
            | Self::MMK
            | Self::MNT
            | Self::MOP
            | Self::MRU
            | Self::MUR
            | Self::MVR
            | Self::MWK
            | Self::MXN
            | Self::MYR
            | Self::MZN
            | Self::NAD
            | Self::NGN
            | Self::NIO
            | Self::NOK
            | Self::NPR
            | Self::NZD
            | Self::PAB
            | Self::PEN
            | Self::PGK
            | Self::PHP
            | Self::PKR
            | Self::PLN
            | Self::PYG
            | Self::QAR
            | Self::RON
            | Self::RSD
            | Self::RUB
            | Self::RWF
            | Self::SAR
            | Self::SBD
            | Self::SCR
            | Self::SDG
            | Self::SEK
            | Self::SGD
            | Self::SHP
            | Self::SLE
            | Self::SLL
            | Self::SOS
            | Self::SRD
            | Self::SSP
            | Self::STD
            | Self::STN
            | Self::SVC
            | Self::SYP
            | Self::SZL
            | Self::THB
            | Self::TJS
            | Self::TMT
            | Self::TOP
            | Self::TRY
            | Self::TTD
            | Self::TWD
            | Self::TZS
            | Self::UAH
            | Self::UGX
            | Self::USD
            | Self::UYU
            | Self::UZS
            | Self::VES
            | Self::VND
            | Self::VUV
            | Self::WST
            | Self::XAF
            | Self::XCD
            | Self::XPF
            | Self::XOF
            | Self::YER
            | Self::ZAR
            | Self::ZMW
            | Self::ZWL => false,
        }
    }

    pub fn is_four_decimal_currency(self) -> bool {
        match self {
            Self::CLF => true,
            Self::AED
            | Self::AFN
            | Self::ALL
            | Self::AMD
            | Self::AOA
            | Self::ANG
            | Self::ARS
            | Self::AUD
            | Self::AWG
            | Self::AZN
            | Self::BAM
            | Self::BBD
            | Self::BDT
            | Self::BGN
            | Self::BHD
            | Self::BIF
            | Self::BMD
            | Self::BND
            | Self::BOB
            | Self::BRL
            | Self::BSD
            | Self::BTN
            | Self::BWP
            | Self::BYN
            | Self::BZD
            | Self::CAD
            | Self::CDF
            | Self::CHF
            | Self::CLP
            | Self::CNY
            | Self::COP
            | Self::CRC
            | Self::CUC
            | Self::CUP
            | Self::CVE
            | Self::CZK
            | Self::DJF
            | Self::DKK
            | Self::DOP
            | Self::DZD
            | Self::EGP
            | Self::ERN
            | Self::ETB
            | Self::EUR
            | Self::FJD
            | Self::FKP
            | Self::GBP
            | Self::GEL
            | Self::GHS
            | Self::GIP
            | Self::GMD
            | Self::GNF
            | Self::GTQ
            | Self::GYD
            | Self::HKD
            | Self::HNL
            | Self::HRK
            | Self::HTG
            | Self::HUF
            | Self::IDR
            | Self::ILS
            | Self::INR
            | Self::IQD
            | Self::IRR
            | Self::ISK
            | Self::JMD
            | Self::JOD
            | Self::JPY
            | Self::KES
            | Self::KGS
            | Self::KHR
            | Self::KMF
            | Self::KPW
            | Self::KRW
            | Self::KWD
            | Self::KYD
            | Self::KZT
            | Self::LAK
            | Self::LBP
            | Self::LKR
            | Self::LRD
            | Self::LSL
            | Self::LYD
            | Self::MAD
            | Self::MDL
            | Self::MGA
            | Self::MKD
            | Self::MMK
            | Self::MNT
            | Self::MOP
            | Self::MRU
            | Self::MUR
            | Self::MVR
            | Self::MWK
            | Self::MXN
            | Self::MYR
            | Self::MZN
            | Self::NAD
            | Self::NGN
            | Self::NIO
            | Self::NOK
            | Self::NPR
            | Self::NZD
            | Self::OMR
            | Self::PAB
            | Self::PEN
            | Self::PGK
            | Self::PHP
            | Self::PKR
            | Self::PLN
            | Self::PYG
            | Self::QAR
            | Self::RON
            | Self::RSD
            | Self::RUB
            | Self::RWF
            | Self::SAR
            | Self::SBD
            | Self::SCR
            | Self::SDG
            | Self::SEK
            | Self::SGD
            | Self::SHP
            | Self::SLE
            | Self::SLL
            | Self::SOS
            | Self::SRD
            | Self::SSP
            | Self::STD
            | Self::STN
            | Self::SVC
            | Self::SYP
            | Self::SZL
            | Self::THB
            | Self::TJS
            | Self::TMT
            | Self::TND
            | Self::TOP
            | Self::TRY
            | Self::TTD
            | Self::TWD
            | Self::TZS
            | Self::UAH
            | Self::UGX
            | Self::USD
            | Self::UYU
            | Self::UZS
            | Self::VES
            | Self::VND
            | Self::VUV
            | Self::WST
            | Self::XAF
            | Self::XCD
            | Self::XPF
            | Self::XOF
            | Self::YER
            | Self::ZAR
            | Self::ZMW
            | Self::ZWL => false,
        }
    }

    pub fn number_of_digits_after_decimal_point(self) -> u8 {
        if self.is_zero_decimal_currency() {
            0
        } else if self.is_three_decimal_currency() {
            3
        } else if self.is_four_decimal_currency() {
            4
        } else {
            2
        }
    }
}

#[derive(
    Clone,
    Copy,
    Debug,
    Hash,
    Eq,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum EventClass {
    Payments,
    Refunds,
    Disputes,
    Mandates,
    #[cfg(feature = "payouts")]
    Payouts,
}

impl EventClass {
    #[inline]
    pub fn event_types(self) -> HashSet<EventType> {
        match self {
            Self::Payments => HashSet::from([
                EventType::PaymentSucceeded,
                EventType::PaymentFailed,
                EventType::PaymentProcessing,
                EventType::PaymentCancelled,
                EventType::PaymentCancelledPostCapture,
                EventType::PaymentAuthorized,
                EventType::PaymentCaptured,
                EventType::PaymentExpired,
                EventType::ActionRequired,
            ]),
            Self::Refunds => HashSet::from([EventType::RefundSucceeded, EventType::RefundFailed]),
            Self::Disputes => HashSet::from([
                EventType::DisputeOpened,
                EventType::DisputeExpired,
                EventType::DisputeAccepted,
                EventType::DisputeCancelled,
                EventType::DisputeChallenged,
                EventType::DisputeWon,
                EventType::DisputeLost,
            ]),
            Self::Mandates => HashSet::from([EventType::MandateActive, EventType::MandateRevoked]),
            #[cfg(feature = "payouts")]
            Self::Payouts => HashSet::from([
                EventType::PayoutSuccess,
                EventType::PayoutFailed,
                EventType::PayoutInitiated,
                EventType::PayoutProcessing,
                EventType::PayoutCancelled,
                EventType::PayoutExpired,
                EventType::PayoutReversed,
            ]),
        }
    }
}

#[derive(
    Clone,
    Copy,
    Debug,
    Hash,
    Eq,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
// Reminder: Whenever an EventType variant is added or removed, make sure to update the `event_types` method in `EventClass`
pub enum EventType {
    /// Authorize + Capture success
    PaymentSucceeded,
    /// Authorize + Capture failed
    PaymentFailed,
    PaymentProcessing,
    PaymentCancelled,
    PaymentCancelledPostCapture,
    PaymentAuthorized,
    PaymentPartiallyAuthorized,
    PaymentCaptured,
    PaymentExpired,
    ActionRequired,
    RefundSucceeded,
    RefundFailed,
    DisputeOpened,
    DisputeExpired,
    DisputeAccepted,
    DisputeCancelled,
    DisputeChallenged,
    DisputeWon,
    DisputeLost,
    MandateActive,
    MandateRevoked,
    #[cfg(feature = "payouts")]
    PayoutSuccess,
    #[cfg(feature = "payouts")]
    PayoutFailed,
    #[cfg(feature = "payouts")]
    PayoutInitiated,
    #[cfg(feature = "payouts")]
    PayoutProcessing,
    #[cfg(feature = "payouts")]
    PayoutCancelled,
    #[cfg(feature = "payouts")]
    PayoutExpired,
    #[cfg(feature = "payouts")]
    PayoutReversed,
}

#[derive(
    Clone,
    Copy,
    Debug,
    Eq,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum WebhookDeliveryAttempt {
    InitialAttempt,
    AutomaticRetry,
    ManualRetry,
}

// TODO: This decision about using KV mode or not,
// should be taken at a top level rather than pushing it down to individual functions via an enum.
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum MerchantStorageScheme {
    #[default]
    PostgresOnly,
    RedisKv,
}

/// Represents the overall status of a payment intent.
/// The status transitions through various states depending on the payment method, confirmation, capture method, and any subsequent actions (like customer authentication or manual capture).
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    Hash,
    PartialEq,
    ToSchema,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumIter,
    strum::EnumString,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum IntentStatus {
    /// The payment has succeeded. Refunds and disputes can be initiated.
    /// Manual retries are not allowed to be performed.
    Succeeded,
    /// The payment has failed. Refunds and disputes cannot be initiated.
    /// This payment can be retried manually with a new payment attempt.
    Failed,
    /// This payment has been cancelled.
    Cancelled,
    /// This payment has been cancelled post capture.
    CancelledPostCapture,
    /// This payment is still being processed by the payment processor.
    /// The status update might happen through webhooks or polling with the connector.
    Processing,
    /// The payment is waiting on some action from the customer.
    RequiresCustomerAction,
    /// The payment is waiting on some action from the merchant
    /// This would be in case of manual fraud approval
    RequiresMerchantAction,
    /// The payment is waiting to be confirmed with the payment method by the customer.
    RequiresPaymentMethod,
    #[default]
    RequiresConfirmation,
    /// The payment has been authorized, and it waiting to be captured.
    RequiresCapture,
    /// The payment has been captured partially. The remaining amount is cannot be captured.
    PartiallyCaptured,
    /// The payment has been captured partially and the remaining amount is capturable
    PartiallyCapturedAndCapturable,
    /// The payment has been authorized for a partial amount and requires capture
    PartiallyAuthorizedAndRequiresCapture,
    /// There has been a discrepancy between the amount/currency sent in the request and the amount/currency received by the processor
    Conflicted,
    /// The payment expired before it could be captured.
    Expired,
}

impl IntentStatus {
    /// Indicates whether the payment intent is in terminal state or not
    pub fn is_in_terminal_state(self) -> bool {
        match self {
            Self::Succeeded
            | Self::Failed
            | Self::Cancelled
            | Self::CancelledPostCapture
            | Self::PartiallyCaptured
            | Self::Expired => true,
            Self::Processing
            | Self::RequiresCustomerAction
            | Self::RequiresMerchantAction
            | Self::RequiresPaymentMethod
            | Self::RequiresConfirmation
            | Self::RequiresCapture
            | Self::PartiallyCapturedAndCapturable
            | Self::PartiallyAuthorizedAndRequiresCapture
            | Self::Conflicted => false,
        }
    }

    /// Indicates whether the syncing with the connector should be allowed or not
    pub fn should_force_sync_with_connector(self) -> bool {
        match self {
            // Confirm has not happened yet
            Self::RequiresConfirmation
            | Self::RequiresPaymentMethod
            // Once the status is success, failed or cancelled need not force sync with the connector
            | Self::Succeeded
            | Self::Failed
            | Self::Cancelled
            | Self::CancelledPostCapture
            |  Self::PartiallyCaptured
            |  Self::RequiresCapture | Self::Conflicted | Self::Expired=> false,
            Self::Processing
            | Self::RequiresCustomerAction
            | Self::RequiresMerchantAction
            | Self::PartiallyCapturedAndCapturable
            | Self::PartiallyAuthorizedAndRequiresCapture => true,
        }
    }
}

/// Specifies how the payment method can be used for future payments.
/// - `off_session`: The payment method can be used for future payments when the customer is not present.
/// - `on_session`: The payment method is intended for use only when the customer is present during checkout.
/// If omitted, defaults to `on_session`.
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    Hash,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::VariantNames,
    strum::EnumIter,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum FutureUsage {
    OffSession,
    #[default]
    OnSession,
}

impl FutureUsage {
    /// Indicates whether the payment method should be saved for future use or not
    pub fn is_off_session(self) -> bool {
        match self {
            Self::OffSession => true,
            Self::OnSession => false,
        }
    }
}

#[derive(
    Clone,
    Copy,
    Debug,
    Eq,
    Hash,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum PaymentMethodIssuerCode {
    JpHdfc,
    JpIcici,
    JpGooglepay,
    JpApplepay,
    JpPhonepay,
    JpWechat,
    JpSofort,
    JpGiropay,
    JpSepa,
    JpBacs,
}

/// Payment Method Status
#[derive(
    Clone,
    Copy,
    Debug,
    PartialEq,
    Eq,
    Hash,
    serde::Serialize,
    serde::Deserialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum PaymentMethodStatus {
    /// Indicates that the payment method is active and can be used for payments.
    Active,
    /// Indicates that the payment method is not active and hence cannot be used for payments.
    Inactive,
    /// Indicates that the payment method is awaiting some data or action before it can be marked
    /// as 'active'.
    Processing,
    /// Indicates that the payment method is awaiting some data before changing state to active
    AwaitingData,
}

impl From<AttemptStatus> for PaymentMethodStatus {
    fn from(attempt_status: AttemptStatus) -> Self {
        match attempt_status {
            AttemptStatus::Failure
            | AttemptStatus::Voided
            | AttemptStatus::VoidedPostCharge
            | AttemptStatus::Started
            | AttemptStatus::Pending
            | AttemptStatus::Unresolved
            | AttemptStatus::CodInitiated
            | AttemptStatus::Authorizing
            | AttemptStatus::VoidInitiated
            | AttemptStatus::AuthorizationFailed
            | AttemptStatus::RouterDeclined
            | AttemptStatus::AuthenticationSuccessful
            | AttemptStatus::PaymentMethodAwaited
            | AttemptStatus::AuthenticationFailed
            | AttemptStatus::AuthenticationPending
            | AttemptStatus::CaptureInitiated
            | AttemptStatus::CaptureFailed
            | AttemptStatus::VoidFailed
            | AttemptStatus::AutoRefunded
            | AttemptStatus::PartialCharged
            | AttemptStatus::PartialChargedAndChargeable
            | AttemptStatus::PartiallyAuthorized
            | AttemptStatus::ConfirmationAwaited
            | AttemptStatus::DeviceDataCollectionPending
            | AttemptStatus::IntegrityFailure
            | AttemptStatus::Expired => Self::Inactive,
            AttemptStatus::Charged | AttemptStatus::Authorized => Self::Active,
        }
    }
}

/// To indicate the type of payment experience that the customer would go through
#[derive(
    Eq,
    strum::EnumString,
    PartialEq,
    Hash,
    Copy,
    Clone,
    Debug,
    serde::Serialize,
    serde::Deserialize,
    strum::Display,
    ToSchema,
    Default,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum PaymentExperience {
    /// The URL to which the customer needs to be redirected for completing the payment.
    #[default]
    RedirectToUrl,
    /// Contains the data for invoking the sdk client for completing the payment.
    InvokeSdkClient,
    /// The QR code data to be displayed to the customer.
    DisplayQrCode,
    /// Contains data to finish one click payment.
    OneClick,
    /// Redirect customer to link wallet
    LinkWallet,
    /// Contains the data for invoking the sdk client for completing the payment.
    InvokePaymentApp,
    /// Contains the data for displaying wait screen
    DisplayWaitScreen,
    /// Represents that otp needs to be collect and contains if consent is required
    CollectOtp,
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display)]
#[serde(rename_all = "lowercase")]
pub enum SamsungPayCardBrand {
    Visa,
    MasterCard,
    Amex,
    Discover,
    Unknown,
}

/// Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay' for wallets.
#[derive(
    Clone,
    Copy,
    Debug,
    Eq,
    Ord,
    Hash,
    PartialOrd,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::VariantNames,
    strum::EnumIter,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum PaymentMethodType {
    Ach,
    Affirm,
    AfterpayClearpay,
    Alfamart,
    AliPay,
    AliPayHk,
    Alma,
    AmazonPay,
    Paysera,
    ApplePay,
    Atome,
    Bacs,
    BancontactCard,
    Becs,
    Benefit,
    Bizum,
    Blik,
    Bluecode,
    Boleto,
    BcaBankTransfer,
    BniVa,
    Breadpay,
    BriVa,
    BhnCardNetwork,
    #[cfg(feature = "v2")]
    Card,
    CardRedirect,
    CimbVa,
    #[serde(rename = "classic")]
    ClassicReward,
    Credit,
    CryptoCurrency,
    Cashapp,
    Dana,
    DanamonVa,
    Debit,
    DuitNow,
    Efecty,
    Eft,
    Eps,
    Flexiti,
    Fps,
    Evoucher,
    Giropay,
    Givex,
    GooglePay,
    GoPay,
    Gcash,
    Ideal,
    Interac,
    Indomaret,
    Klarna,
    KakaoPay,
    LocalBankRedirect,
    MandiriVa,
    Knet,
    MbWay,
    MobilePay,
    Momo,
    MomoAtm,
    Multibanco,
    OnlineBankingThailand,
    OnlineBankingCzechRepublic,
    OnlineBankingFinland,
    OnlineBankingFpx,
    OnlineBankingPoland,
    OnlineBankingSlovakia,
    Oxxo,
    PagoEfectivo,
    PermataBankTransfer,
    OpenBankingUk,
    PayBright,
    Paypal,
    Paze,
    Pix,
    PaySafeCard,
    Przelewy24,
    PromptPay,
    Pse,
    RedCompra,
    RedPagos,
    SamsungPay,
    Sepa,
    SepaBankTransfer,
    Skrill,
    Sofort,
    Swish,
    TouchNGo,
    Trustly,
    Twint,
    UpiCollect,
    UpiIntent,
    Vipps,
    VietQr,
    Venmo,
    Walley,
    WeChatPay,
    SevenEleven,
    Lawson,
    MiniStop,
    FamilyMart,
    Seicomart,
    PayEasy,
    LocalBankTransfer,
    Mifinity,
    #[serde(rename = "open_banking_pis")]
    OpenBankingPIS,
    DirectCarrierBilling,
    InstantBankTransfer,
    InstantBankTransferFinland,
    InstantBankTransferPoland,
    RevolutPay,
    IndonesianBankTransfer,
}

impl PaymentMethodType {
    pub fn should_check_for_customer_saved_payment_method_type(self) -> bool {
        matches!(
            self,
            Self::ApplePay | Self::GooglePay | Self::SamsungPay | Self::Paypal | Self::Klarna
        )
    }
    pub fn to_display_name(&self) -> String {
        let display_name = match self {
            Self::Ach => "ACH Direct Debit",
            Self::Bacs => "BACS Direct Debit",
            Self::Affirm => "Affirm",
            Self::AfterpayClearpay => "Afterpay Clearpay",
            Self::Alfamart => "Alfamart",
            Self::AliPay => "Alipay",
            Self::AliPayHk => "AlipayHK",
            Self::Alma => "Alma",
            Self::AmazonPay => "Amazon Pay",
            Self::Paysera => "Paysera",
            Self::ApplePay => "Apple Pay",
            Self::Atome => "Atome",
            Self::BancontactCard => "Bancontact Card",
            Self::Becs => "BECS Direct Debit",
            Self::Benefit => "Benefit",
            Self::Bizum => "Bizum",
            Self::Blik => "BLIK",
            Self::Bluecode => "Bluecode",
            Self::Boleto => "Boleto Bancário",
            Self::BcaBankTransfer => "BCA Bank Transfer",
            Self::BniVa => "BNI Virtual Account",
            Self::Breadpay => "Breadpay",
            Self::BriVa => "BRI Virtual Account",
            Self::BhnCardNetwork => "BHN Card Network",
            Self::CardRedirect => "Card Redirect",
            Self::CimbVa => "CIMB Virtual Account",
            Self::ClassicReward => "Classic Reward",
            #[cfg(feature = "v2")]
            Self::Card => "Card",
            Self::Credit => "Credit Card",
            Self::CryptoCurrency => "Crypto",
            Self::Cashapp => "Cash App",
            Self::Dana => "DANA",
            Self::DanamonVa => "Danamon Virtual Account",
            Self::Debit => "Debit Card",
            Self::DuitNow => "DuitNow",
            Self::Efecty => "Efecty",
            Self::Eft => "EFT",
            Self::Eps => "EPS",
            Self::Flexiti => "Flexiti",
            Self::Fps => "FPS",
            Self::Evoucher => "Evoucher",
            Self::Giropay => "Giropay",
            Self::Givex => "Givex",
            Self::GooglePay => "Google Pay",
            Self::GoPay => "GoPay",
            Self::Gcash => "GCash",
            Self::Ideal => "iDEAL",
            Self::Interac => "Interac",
            Self::Indomaret => "Indomaret",
            Self::InstantBankTransfer => "Instant Bank Transfer",
            Self::InstantBankTransferFinland => "Instant Bank Transfer Finland",
            Self::InstantBankTransferPoland => "Instant Bank Transfer Poland",
            Self::Klarna => "Klarna",
            Self::KakaoPay => "KakaoPay",
            Self::LocalBankRedirect => "Local Bank Redirect",
            Self::MandiriVa => "Mandiri Virtual Account",
            Self::Knet => "KNET",
            Self::MbWay => "MB WAY",
            Self::MobilePay => "MobilePay",
            Self::Momo => "MoMo",
            Self::MomoAtm => "MoMo ATM",
            Self::Multibanco => "Multibanco",
            Self::OnlineBankingThailand => "Online Banking Thailand",
            Self::OnlineBankingCzechRepublic => "Online Banking Czech Republic",
            Self::OnlineBankingFinland => "Online Banking Finland",
            Self::OnlineBankingFpx => "Online Banking FPX",
            Self::OnlineBankingPoland => "Online Banking Poland",
            Self::OnlineBankingSlovakia => "Online Banking Slovakia",
            Self::Oxxo => "OXXO",
            Self::PagoEfectivo => "PagoEfectivo",
            Self::PermataBankTransfer => "Permata Bank Transfer",
            Self::OpenBankingUk => "Open Banking UK",
            Self::PayBright => "PayBright",
            Self::Paypal => "PayPal",
            Self::Paze => "Paze",
            Self::Pix => "Pix",
            Self::PaySafeCard => "PaySafeCard",
            Self::Przelewy24 => "Przelewy24",
            Self::PromptPay => "PromptPay",
            Self::Pse => "PSE",
            Self::RedCompra => "RedCompra",
            Self::RedPagos => "RedPagos",
            Self::SamsungPay => "Samsung Pay",
            Self::Sepa => "SEPA Direct Debit",
            Self::SepaBankTransfer => "SEPA Bank Transfer",
            Self::Sofort => "Sofort",
            Self::Skrill => "Skrill",
            Self::Swish => "Swish",
            Self::TouchNGo => "Touch 'n Go",
            Self::Trustly => "Trustly",
            Self::Twint => "TWINT",
            Self::UpiCollect => "UPI Collect",
            Self::UpiIntent => "UPI Intent",
            Self::Vipps => "Vipps",
            Self::VietQr => "VietQR",
            Self::Venmo => "Venmo",
            Self::Walley => "Walley",
            Self::WeChatPay => "WeChat Pay",
            Self::SevenEleven => "7-Eleven",
            Self::Lawson => "Lawson",
            Self::MiniStop => "Mini Stop",
            Self::FamilyMart => "FamilyMart",
            Self::Seicomart => "Seicomart",
            Self::PayEasy => "PayEasy",
            Self::LocalBankTransfer => "Local Bank Transfer",
            Self::Mifinity => "MiFinity",
            Self::OpenBankingPIS => "Open Banking PIS",
            Self::DirectCarrierBilling => "Direct Carrier Billing",
            Self::RevolutPay => "RevolutPay",
            Self::IndonesianBankTransfer => "Indonesian Bank Transfer",
        };
        display_name.to_string()
    }
}

impl masking::SerializableSecret for PaymentMethodType {}

/// Indicates the type of payment method. Eg: 'card', 'wallet', etc.
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::VariantNames,
    strum::EnumIter,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum PaymentMethod {
    #[default]
    Card,
    CardRedirect,
    PayLater,
    Wallet,
    BankRedirect,
    BankTransfer,
    Crypto,
    BankDebit,
    Reward,
    RealTimePayment,
    Upi,
    Voucher,
    GiftCard,
    OpenBanking,
    MobilePayment,
}

/// Indicates the gateway system through which the payment is processed.
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::VariantNames,
    strum::EnumIter,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum GatewaySystem {
    #[default]
    Direct,
    UnifiedConnectorService,
}

/// The type of the payment that differentiates between normal and various types of mandate payments. Use 'setup_mandate' in case of zero auth flow.
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum PaymentType {
    #[default]
    Normal,
    NewMandate,
    SetupMandate,
    RecurringMandate,
}

/// SCA Exemptions types available for authentication
#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum ScaExemptionType {
    #[default]
    LowValue,
    TransactionRiskAnalysis,
}

#[derive(
    Clone,
    Debug,
    Default,
    Eq,
    PartialOrd,
    Ord,
    Hash,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::VariantNames,
    strum::EnumIter,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
/// Describes the channel through which the payment was initiated.
pub enum PaymentChannel {
    #[default]
    Ecommerce,
    MailOrder,
    TelephoneOrder,
    #[serde(untagged)]
    #[strum(default)]
    Other(String),
}

#[derive(
    Clone,
    Copy,
    Debug,
    Eq,
    PartialEq,
    serde::Deserialize,
    serde::Serialize,
    strum::Display,
    strum::EnumString,
    ToSchema,
)]
#[router_derive::diesel_enum(storage_type = "text")]
#[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")]
pub enum CtpServiceProvider {
    Visa,
    Mastercard,
}

#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    Hash,
    PartialEq,
    strum::Display,
    strum::EnumString,
    strum::EnumIter,
    serde::Serialize,
    serde::Deserialize,
)]
#[router_derive::diesel_enum(storage_type = "db_enum")]
#[strum(serialize_all = "snake_case")]
#[serde(rename_all = "snake_case")]
pub enum RefundStatus {
    #[serde(alias = "Failure")]
    Failure,
    #[serde(alias = "ManualReview")]
    ManualReview,
    #[default]
    #[serde(alias = "Pending")]
    Pending,
    #[serde(alias = "Success")]
    Success,
    #[serde(alias = "TransactionFailure")]
    TransactionFailure,
}

#[derive(
    Clone,
    Copy,
    Debug,
    Default,
    Eq,
    Hash,
    PartialEq,
    strum::Display,
    strum::EnumString,
    strum::EnumIter,
    serde::Serialize,
    serde::Deserialize,
    ToSchema,
)]


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

impl api::Payment for for Hyperwallet


// Implementation: impl Deref for for UserEmail
// File: crates/router/src/types/domain/user.rs
// Module: router
// Methods: 1 total (0 public)

impl Deref for for UserEmail