Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

17.9 KB
Raw Blame
use router_env::Flow;

#[derive(Clone, Debug, strum::Display)]
#[strum(serialize_all = "snake_case")]
pub enum ApiIdentifier {
    Payments,
    Refunds,
    Webhooks,
    Organization,
    MerchantAccount,
    MerchantConnector,
    MerchantConnectorWebhookManagement,
    Configs,
    Customers,
    ClientSecret,
    Health,
    Mandates,
    PaymentMethods,
    PaymentMethodAuth,
    Payouts,
    Disputes,
    CardsInfo,
    Files,
    Cache,
    Profile,
    Verification,
    ApiKeys,
    PaymentLink,
    Routing,
    Subscription,
    Blocklist,
    Forex,
    RustLockerMigration,
    Gsm,
    Role,
    User,
    UserRole,
    ConnectorOnboarding,
    Poll,
    ApplePayCertificatesMigration,
    Relay,
    Documentation,
    CardNetworkTokenization,
    Hypersense,
    ExternalServiceAuth,
    OfferEngine,
    PaymentMethodSession,
    ProcessTracker,
    Authentication,
    Proxy,
    ProfileAcquirer,
    ThreeDsDecisionRule,
    GenericTokenization,
    RecoveryRecovery,
    Superposition,
    CardIssuers,
    HierarchicalResources,
}

impl From<Flow> for ApiIdentifier {
    fn from(flow: Flow) -> Self {
        match flow {
            Flow::MerchantsAccountCreate
            | Flow::MerchantsAccountRetrieve
            | Flow::MerchantsAccountUpdate
            | Flow::MerchantsAccountDelete
            | Flow::MerchantTransferKey
            | Flow::MerchantAccountList
            | Flow::EnablePlatformAccount => Self::MerchantAccount,
            Flow::OrganizationCreate
            | Flow::OrganizationRetrieve
            | Flow::OrganizationUpdate
            | Flow::ConvertOrganizationToPlatform => Self::Organization,
            Flow::HierarchicalResourcesGenerate
            | Flow::HierarchicalResourcesUpload
            | Flow::HierarchicalResourcesList
            | Flow::HierarchicalResourcesLink => Self::HierarchicalResources,
            Flow::RoutingCreateConfig
            | Flow::RoutingLinkConfig
            | Flow::RoutingUnlinkConfig
            | Flow::RoutingRetrieveConfig
            | Flow::DecisionEngineSsoRedirect
            | Flow::RoutingRetrieveActiveConfig
            | Flow::RoutingRetrieveDefaultConfig
            | Flow::RoutingRetrieveDictionary
            | Flow::RoutingUpdateConfig
            | Flow::RoutingUpdateDefaultConfig
            | Flow::RoutingDeleteConfig
            | Flow::DecisionManagerDeleteConfig
            | Flow::DecisionManagerRetrieveConfig
            | Flow::ToggleDynamicRouting
            | Flow::CreateDynamicRoutingConfig
            | Flow::UpdateDynamicRoutingConfigs
            | Flow::DecisionManagerUpsertConfig
            | Flow::DecisionEngineRuleMigration
            | Flow::DecisionEngineMigrationStatus
            | Flow::VolumeSplitOnRoutingType => Self::Routing,
            Flow::CreateSubscription
            | Flow::ConfirmSubscription
            | Flow::CreateAndConfirmSubscription
            | Flow::GetSubscription
            | Flow::UpdateSubscription
            | Flow::GetSubscriptionEstimate
            | Flow::GetSubscriptionItemsForSubscription
            | Flow::PauseSubscription
            | Flow::ResumeSubscription
            | Flow::CancelSubscription => Self::Subscription,
            Flow::RetrieveForexFlow => Self::Forex,
            Flow::AddToBlocklist => Self::Blocklist,
            Flow::DeleteFromBlocklist => Self::Blocklist,
            Flow::ListBlocklist => Self::Blocklist,
            Flow::ToggleBlocklistGuard => Self::Blocklist,
            Flow::BatchBlocklistUpload => Self::Blocklist,
            Flow::GetBatchBlocklistJobStatus => Self::Blocklist,
            Flow::ListBatchBlocklistJobs => Self::Blocklist,
            Flow::GetBlocklistCount => Self::Blocklist,
            Flow::LookupBlocklistEntry => Self::Blocklist,
            Flow::CreateBlocklistExport => Self::Blocklist,
            Flow::CloneBlocklistEntries => Self::Blocklist,
            Flow::MerchantConnectorsCreate
            | Flow::MerchantConnectorsRetrieve
            | Flow::MerchantConnectorsUpdate
            | Flow::MerchantConnectorsDelete
            | Flow::MerchantConnectorsList => Self::MerchantConnector,
            Flow::ConfigKeyCreate
            | Flow::ConfigKeyFetch
            | Flow::ConfigKeyUpdate
            | Flow::ConfigKeyDelete
            | Flow::CreateConfigKey
            | Flow::UnifiedConnectorServiceKillSwitchStatus
            | Flow::UnifiedConnectorServiceKillSwitchReset => Self::Configs,
            Flow::CustomersCreate
            | Flow::CustomersRetrieve
            | Flow::CustomersRetrieveByReferenceId
            | Flow::CustomersUpdate
            | Flow::CustomersDelete
            | Flow::CustomersGetMandates
            | Flow::CustomersGlobalIdMigration
            | Flow::CustomersList
            | Flow::CustomersListWithConstraints => Self::Customers,
            Flow::ClientSecretCreate | Flow::ClientSecretDelete => Self::ClientSecret,
            Flow::DeepHealthCheck | Flow::HealthCheck => Self::Health,
            Flow::OfferEngineConnectivityCheck => Self::Health,
            Flow::OfferEngineBrowseOffers => Self::OfferEngine,
            Flow::MandatesRetrieve | Flow::MandatesRevoke | Flow::MandatesList => Self::Mandates,
            Flow::PaymentMethodsCreate
            | Flow::PaymentMethodsMigrate
            | Flow::ModularPaymentMethodsMigrate
            | Flow::PaymentMethodsBatchUpdate
            | Flow::PaymentMethodsBatchRetrieve
            | Flow::PaymentMethodsList
            | Flow::CustomerPaymentMethodsList
            | Flow::GetPaymentMethodTokenData
            | Flow::PaymentMethodsRetrieve
            | Flow::PaymentMethodsRetrieveOlap
            | Flow::PaymentMethodsUpdate
            | Flow::PaymentMethodsDelete
            | Flow::NetworkTokenStatusCheck
            | Flow::PaymentMethodCollectLink
            | Flow::ValidatePaymentMethod
            | Flow::ListCountriesCurrencies
            | Flow::DefaultPaymentMethodsSet
            | Flow::PaymentMethodSave
            | Flow::TotalPaymentMethodCount
            | Flow::PaymentMethodGetTokenDetails => Self::PaymentMethods,
            Flow::PmAuthLinkTokenCreate | Flow::PmAuthExchangeToken => Self::PaymentMethodAuth,
            Flow::PaymentsCreate
            | Flow::PaymentsRetrieve
            | Flow::PaymentsRetrieveForceSync
            | Flow::PaymentsUpdate
            | Flow::PaymentsConfirm
            | Flow::PaymentsCapture
            | Flow::PaymentsCancel
            | Flow::PaymentsCancelPostCapture
            | Flow::PaymentsApprove
            | Flow::PaymentsReject
            | Flow::PaymentsSessionToken
            | Flow::PaymentsStart
            | Flow::PaymentsList
            | Flow::PlatformPaymentsList
            | Flow::PlatformPaymentsFilters
            | Flow::PaymentsFilters
            | Flow::PaymentsAggregate
            | Flow::PaymentsRedirect
            | Flow::PaymentsIncrementalAuthorization
            | Flow::PaymentsExtendAuthorization
            | Flow::PaymentsExternalAuthentication
            | Flow::PaymentsAuthorize
            | Flow::GetExtendedCardInfo
            | Flow::PaymentsCompleteAuthorize
            | Flow::PaymentsManualUpdate
            | Flow::PaymentsManualStatusUpdate
            | Flow::PaymentsManualStatusUpdateEligibleStatuses
            | Flow::SessionUpdateTaxCalculation
            | Flow::PaymentsConfirmIntent
            | Flow::PaymentsCreateIntent
            | Flow::PaymentsGetIntent
            | Flow::PaymentMethodBalanceCheck
            | Flow::ApplyPaymentMethodData
            | Flow::PaymentsPostSessionTokens
            | Flow::PaymentsUpdateMetadata
            | Flow::PaymentsUpdateIntent
            | Flow::PaymentsCreateAndConfirmIntent
            | Flow::PaymentStartRedirection
            | Flow::ProxyConfirmIntent
            | Flow::PaymentsRetrieveUsingMerchantReferenceId
            | Flow::PaymentAttemptsList
            | Flow::RecoveryPaymentsCreate
            | Flow::PaymentsSubmitCheckEligibility
            | Flow::PaymentsSubmitEligibility
            // PaymentLinkCreate creates a payment intent, so it uses the Payments lock namespace
            | Flow::PaymentLinkCreate
            | Flow::PaymentsCancelPostCaptureSync
            // A telephone order adapter creates and confirms a payment, so it belongs in the
            // Payments lock namespace
            | Flow::TelephoneOrderCharge => Self::Payments,
            Flow::PayoutsCreate
            | Flow::PayoutsRetrieve
            | Flow::PayoutsUpdate
            | Flow::PayoutsCancel
            | Flow::PayoutsFulfill
            | Flow::PayoutsList
            | Flow::PayoutsFilter
            | Flow::PayoutsAccounts
            | Flow::PayoutsConfirm
            | Flow::PayoutsManualUpdate
            | Flow::PayoutLinkInitiate
            | Flow::PayoutsAggregate => Self::Payouts,
            Flow::RefundsCreate
            | Flow::RefundsRetrieve
            | Flow::RefundsRetrieveForceSync
            | Flow::RefundsUpdate
            | Flow::RefundsReverse
            | Flow::RefundsList
            | Flow::PlatformRefundsList
            | Flow::PlatformRefundsFilters
            | Flow::RefundsFilters
            | Flow::RefundsAggregate
            | Flow::RefundsManualUpdate => Self::Refunds,
            Flow::Relay | Flow::RelayRetrieve | Flow::RelayUnreferencedRefund => Self::Relay,
            Flow::FrmFulfillment
            | Flow::IncomingWebhookReceive
            | Flow::IncomingRelayWebhookReceive
            | Flow::WebhookEventInitialDeliveryAttemptList
            | Flow::WebhookEventDeliveryAttemptList
            | Flow::WebhookEventDeliveryRetry
            | Flow::RecoveryIncomingWebhookReceive
            | Flow::IncomingNetworkTokenWebhookReceive => Self::Webhooks,
            Flow::ApiKeyCreate
            | Flow::ApiKeyRetrieve
            | Flow::ApiKeyUpdate
            | Flow::ApiKeyRevoke
            | Flow::ApiKeyList => Self::ApiKeys,
            Flow::DisputesRetrieve
            | Flow::DisputesList
            | Flow::DisputesFilters
            | Flow::PlatformDisputesList
            | Flow::PlatformDisputesFilters
            | Flow::DisputesEvidenceSubmit
            | Flow::AttachDisputeEvidence
            | Flow::RetrieveDisputeEvidence
            | Flow::DisputesAggregate
            | Flow::DeleteDisputeEvidence => Self::Disputes,
            Flow::CardsInfo
            | Flow::CardsInfoCreate
            | Flow::CardsInfoUpdate
            | Flow::CardsInfoMigrate => Self::CardsInfo,
            Flow::CreateFile | Flow::DeleteFile | Flow::RetrieveFile => Self::Files,
            Flow::CacheInvalidate => Self::Cache,
            Flow::ProfileCreate
            | Flow::ProfileUpdate
            | Flow::ProfileRetrieve
            | Flow::ProfileDelete
            | Flow::ProfileList
            | Flow::ToggleExtendedCardInfo
            | Flow::ToggleConnectorAgnosticMit => Self::Profile,
            Flow::PaymentLinkRetrieve
            | Flow::PaymentLinkInitiate
            | Flow::PaymentSecureLinkInitiate
            | Flow::PaymentLinkList
            | Flow::PaymentLinkStatus => Self::PaymentLink,
            Flow::Verification => Self::Verification,
            Flow::RustLockerMigration => Self::RustLockerMigration,
            Flow::GsmRuleCreate
            | Flow::GsmRuleRetrieve
            | Flow::GsmRuleUpdate
            | Flow::GsmRuleDelete => Self::Gsm,
            Flow::ApplePayCertificatesMigration => Self::ApplePayCertificatesMigration,
            Flow::UserConnectAccount
            | Flow::UserSignUp
            | Flow::UserSignIn
            | Flow::Signout
            | Flow::ChangePassword
            | Flow::SetDashboardMetadata
            | Flow::GetMultipleDashboardMetadata
            | Flow::VerifyPaymentConnector
            | Flow::InternalUserSignup
            | Flow::TenantUserCreate
            | Flow::SwitchOrg
            | Flow::SwitchMerchantV2
            | Flow::SwitchProfile
            | Flow::CreatePlatformAccount
            | Flow::UserOrgMerchantCreate
            | Flow::UserMerchantAccountCreate
            | Flow::GenerateSampleData
            | Flow::DeleteSampleData
            | Flow::GetUserDetails
            | Flow::GetUserRoleDetails
            | Flow::ForgotPassword
            | Flow::ResetPassword
            | Flow::RotatePassword
            | Flow::InviteMultipleUser
            | Flow::ReInviteUser
            | Flow::UserSignUpWithMerchantId
            | Flow::VerifyEmail
            | Flow::AcceptInviteFromEmail
            | Flow::VerifyEmailRequest
            | Flow::UpdateUserAccountDetails
            | Flow::TotpBegin
            | Flow::TotpReset
            | Flow::TotpVerify
            | Flow::TotpUpdate
            | Flow::RecoveryCodeVerify
            | Flow::RecoveryCodesGenerate
            | Flow::TerminateTwoFactorAuth
            | Flow::TwoFactorAuthStatus
            | Flow::CreateUserAuthenticationMethod
            | Flow::UpdateUserAuthenticationMethod
            | Flow::ListUserAuthenticationMethods
            | Flow::UserTransferKey
            | Flow::GetSsoAuthUrl
            | Flow::SignInWithSso
            | Flow::OidcDiscovery
            | Flow::OidcJwks
            | Flow::OidcAuthorize
            | Flow::OidcToken
            | Flow::ListOrgForUser
            | Flow::ListMerchantsForUserInOrg
            | Flow::GetUserMerchantDetails
            | Flow::ListProfileForUserInOrgAndMerchant
            | Flow::ListInvitationsForUser
            | Flow::AuthSelect
            | Flow::GetThemeUsingLineage
            | Flow::GetThemeUsingThemeId
            | Flow::UploadFileToThemeStorage
            | Flow::CreateTheme
            | Flow::UpdateTheme
            | Flow::DeleteTheme
            | Flow::CreateUserTheme
            | Flow::UpdateUserTheme
            | Flow::DeleteUserTheme
            | Flow::GetUserThemeUsingThemeId
            | Flow::GetUserThemeConfigVersion
            | Flow::UploadFileToUserThemeStorage
            | Flow::GetUserThemeUsingLineage
            | Flow::ListAllThemesInLineage
            | Flow::CloneConnector
            | Flow::EmbeddedTokenInfo
            | Flow::GetEmbeddedToken
            | Flow::GetUserDetailsInternal
            | Flow::ListUsersInternal
            | Flow::ListMembersForEntity
            | Flow::LaunchSage => Self::User,

            Flow::ListRolesV2
            | Flow::ListInvitableRolesAtEntityLevel
            | Flow::ListUpdatableRolesAtEntityLevel
            | Flow::GetRole
            | Flow::GetRoleV2
            | Flow::GetRoleFromToken
            | Flow::GetRoleFromTokenV2
            | Flow::GetParentGroupsInfoForRoleFromToken
            | Flow::UpdateUserRole
            | Flow::GetAuthorizationInfo
            | Flow::GetRolesInfo
            | Flow::GetParentGroupInfo
            | Flow::AcceptInvitationsV2
            | Flow::AcceptInvitationsPreAuth
            | Flow::DeleteUserRole
            | Flow::CreateRole
            | Flow::CreateRoleV2
            | Flow::UpdateRole
            | Flow::UserFromEmail
            | Flow::ListUsersInLineage
            | Flow::AuthorizeUserToken => Self::UserRole,
            Flow::GetActionUrl | Flow::SyncOnboardingStatus | Flow::ResetTrackingId => {
                Self::ConnectorOnboarding
            }
            Flow::RetrievePollStatus => Self::Poll,
            Flow::FeatureMatrix => Self::Documentation,
            Flow::TokenizeCard
            | Flow::TokenizeCardUsingPaymentMethodId
            | Flow::TokenizeCardBatch => Self::CardNetworkTokenization,
            Flow::HypersenseTokenRequest
            | Flow::HypersenseVerifyToken
            | Flow::HypersenseSignoutToken => Self::Hypersense,
            Flow::ExternalServiceValidateToken => Self::ExternalServiceAuth,
            Flow::PaymentMethodSessionCreate
            | Flow::PaymentMethodSessionRetrieve
            | Flow::PaymentMethodSessionConfirm
            | Flow::PaymentMethodSessionUpdateSavedPaymentMethod
            | Flow::PaymentMethodSessionDeleteSavedPaymentMethod
            | Flow::PaymentMethodSessionUpdate => Self::PaymentMethodSession,
            Flow::RevenueRecoveryRetrieve | Flow::RevenueRecoveryResume => Self::ProcessTracker,
            Flow::AuthenticationCreate
            | Flow::AuthenticationEligibility
            | Flow::AuthenticationSync
            | Flow::AuthenticationSyncPostUpdate
            | Flow::AuthenticationAuthenticate
            | Flow::AuthenticationSessionToken
            | Flow::AuthenticationEligibilityCheck
            | Flow::AuthenticationRetrieveEligibilityCheck => Self::Authentication,
            Flow::Proxy => Self::Proxy,
            Flow::ProfileAcquirerCreate | Flow::ProfileAcquirerUpdate => Self::ProfileAcquirer,
            Flow::ThreeDsDecisionRuleExecute => Self::ThreeDsDecisionRule,
            Flow::TokenizationCreate
            | Flow::TokenizationRetrieve
            | Flow::TokenizationDelete
            | Flow::NetworkTokenEligibilityCheck => Self::GenericTokenization,

            Flow::RecoveryDataBackfill
            | Flow::RecoveryRetryStatsMigration
            | Flow::RevenueRecoveryRedis
            | Flow::RevenueRecoveryCancel => Self::RecoveryRecovery,
            Flow::GetSuperpositionSdkConfig
            | Flow::SuperpositionListContexts
            | Flow::SuperpositionListDefaultConfigs
            | Flow::SuperpositionListDimensions
            | Flow::SuperpositionGetDimension
            | Flow::SuperpositionGetDefaultConfig
            | Flow::SuperpositionCreateContext
            | Flow::SuperpositionResolveDetailedConfig
            | Flow::SuperpositionResolveConfigExplanation
            | Flow::SuperpositionListAuditLogs => Self::Superposition,
            Flow::MerchantConnectorWebhookRegister
            | Flow::MerchantConnectorWebhookList
            | Flow::MerchantConnectorWebhookGenerateSecret => {
                Self::MerchantConnectorWebhookManagement
            }
            Flow::AddCardIssuer
            | Flow::UpdateCardIssuer
            | Flow::DeleteCardIssuer
            | Flow::ListCardIssuers => Self::CardIssuers,
        }
    }
}