mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor(enums): move enums from storage_models and api_models crates to common_enums crate (#1265)
This commit is contained in:
@ -1,534 +1,6 @@
|
||||
pub use common_enums::*;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum AttemptStatus {
|
||||
Started,
|
||||
AuthenticationFailed,
|
||||
RouterDeclined,
|
||||
AuthenticationPending,
|
||||
AuthenticationSuccessful,
|
||||
Authorized,
|
||||
AuthorizationFailed,
|
||||
Charged,
|
||||
Authorizing,
|
||||
CodInitiated,
|
||||
Voided,
|
||||
VoidInitiated,
|
||||
CaptureInitiated,
|
||||
CaptureFailed,
|
||||
VoidFailed,
|
||||
AutoRefunded,
|
||||
PartialCharged,
|
||||
Unresolved,
|
||||
#[default]
|
||||
Pending,
|
||||
Failure,
|
||||
PaymentMethodAwaited,
|
||||
ConfirmationAwaited,
|
||||
DeviceDataCollectionPending,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum AuthenticationType {
|
||||
/// If the card is enrolled for 3DS authentication, the 3DS based authentication will be activated. The liability of chargeback shift to the issuer
|
||||
ThreeDs,
|
||||
/// 3DS based authentication will not be activated. The liability of chargeback stays with the merchant.
|
||||
#[default]
|
||||
NoThreeDs,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum CaptureMethod {
|
||||
/// Post the payment authorization, the capture will be executed on the full amount immediately
|
||||
#[default]
|
||||
Automatic,
|
||||
/// The capture will happen only if the merchant triggers a Capture API request
|
||||
Manual,
|
||||
/// The capture will happen only if the merchant triggers a Capture API request
|
||||
ManualMultiple,
|
||||
/// The capture can be scheduled to automatically get triggered at a specific date & time
|
||||
Scheduled,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
PartialEq,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ConnectorType {
|
||||
/// PayFacs, Acquirers, Gateways, BNPL etc
|
||||
PaymentProcessor,
|
||||
/// Fraud, Currency Conversion, Crypto etc
|
||||
PaymentVas,
|
||||
/// Accounting, Billing, Invoicing, Tax etc
|
||||
FinOperations,
|
||||
/// Inventory, ERP, CRM, KYC etc
|
||||
FizOperations,
|
||||
/// Payment Networks like Visa, MasterCard etc
|
||||
Networks,
|
||||
/// All types of banks including corporate / commercial / personal / neo banks
|
||||
BankingEntities,
|
||||
/// All types of non-banking financial institutions including Insurance, Credit / Lending etc
|
||||
NonBankingFinance,
|
||||
}
|
||||
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
strum::EnumIter,
|
||||
ToSchema,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
pub enum Currency {
|
||||
AED,
|
||||
ALL,
|
||||
AMD,
|
||||
ANG,
|
||||
ARS,
|
||||
AUD,
|
||||
AWG,
|
||||
AZN,
|
||||
BBD,
|
||||
BDT,
|
||||
BHD,
|
||||
BMD,
|
||||
BND,
|
||||
BOB,
|
||||
BRL,
|
||||
BSD,
|
||||
BWP,
|
||||
BZD,
|
||||
CAD,
|
||||
CHF,
|
||||
CNY,
|
||||
COP,
|
||||
CRC,
|
||||
CUP,
|
||||
CZK,
|
||||
DKK,
|
||||
DOP,
|
||||
DZD,
|
||||
EGP,
|
||||
ETB,
|
||||
EUR,
|
||||
FJD,
|
||||
GBP,
|
||||
GHS,
|
||||
GIP,
|
||||
GMD,
|
||||
GTQ,
|
||||
GYD,
|
||||
HKD,
|
||||
HNL,
|
||||
HRK,
|
||||
HTG,
|
||||
HUF,
|
||||
IDR,
|
||||
ILS,
|
||||
INR,
|
||||
JMD,
|
||||
JOD,
|
||||
JPY,
|
||||
KES,
|
||||
KGS,
|
||||
KHR,
|
||||
KRW,
|
||||
KWD,
|
||||
KYD,
|
||||
KZT,
|
||||
LAK,
|
||||
LBP,
|
||||
LKR,
|
||||
LRD,
|
||||
LSL,
|
||||
MAD,
|
||||
MDL,
|
||||
MKD,
|
||||
MMK,
|
||||
MNT,
|
||||
MOP,
|
||||
MUR,
|
||||
MVR,
|
||||
MWK,
|
||||
MXN,
|
||||
MYR,
|
||||
NAD,
|
||||
NGN,
|
||||
NIO,
|
||||
NOK,
|
||||
NPR,
|
||||
NZD,
|
||||
OMR,
|
||||
PEN,
|
||||
PGK,
|
||||
PHP,
|
||||
PKR,
|
||||
PLN,
|
||||
QAR,
|
||||
RON,
|
||||
RUB,
|
||||
SAR,
|
||||
SCR,
|
||||
SEK,
|
||||
SGD,
|
||||
SLL,
|
||||
SOS,
|
||||
SSP,
|
||||
SVC,
|
||||
SZL,
|
||||
THB,
|
||||
TRY,
|
||||
TTD,
|
||||
TWD,
|
||||
TZS,
|
||||
#[default]
|
||||
USD,
|
||||
UYU,
|
||||
UZS,
|
||||
YER,
|
||||
ZAR,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum EventType {
|
||||
PaymentSucceeded,
|
||||
PaymentFailed,
|
||||
PaymentProcessing,
|
||||
ActionRequired,
|
||||
RefundSucceeded,
|
||||
RefundFailed,
|
||||
DisputeOpened,
|
||||
DisputeExpired,
|
||||
DisputeAccepted,
|
||||
DisputeCancelled,
|
||||
DisputeChallenged,
|
||||
DisputeWon,
|
||||
DisputeLost,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
PartialEq,
|
||||
ToSchema,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum IntentStatus {
|
||||
Succeeded,
|
||||
Failed,
|
||||
Cancelled,
|
||||
Processing,
|
||||
RequiresCustomerAction,
|
||||
RequiresMerchantAction,
|
||||
RequiresPaymentMethod,
|
||||
#[default]
|
||||
RequiresConfirmation,
|
||||
RequiresCapture,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum FutureUsage {
|
||||
#[default]
|
||||
OffSession,
|
||||
OnSession,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PaymentMethodIssuerCode {
|
||||
JpHdfc,
|
||||
JpIcici,
|
||||
JpGooglepay,
|
||||
JpApplepay,
|
||||
JpPhonepay,
|
||||
JpWechat,
|
||||
JpSofort,
|
||||
JpGiropay,
|
||||
JpSepa,
|
||||
JpBacs,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Eq,
|
||||
PartialEq,
|
||||
Hash,
|
||||
Copy,
|
||||
Clone,
|
||||
Debug,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
strum::Display,
|
||||
ToSchema,
|
||||
Default,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
#[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,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
ToSchema,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum PaymentMethodType {
|
||||
Ach,
|
||||
Affirm,
|
||||
AfterpayClearpay,
|
||||
AliPay,
|
||||
AliPayHk,
|
||||
ApplePay,
|
||||
Bacs,
|
||||
BancontactCard,
|
||||
Becs,
|
||||
Blik,
|
||||
#[serde(rename = "classic")]
|
||||
ClassicReward,
|
||||
Credit,
|
||||
CryptoCurrency,
|
||||
Debit,
|
||||
Eps,
|
||||
Evoucher,
|
||||
Giropay,
|
||||
GooglePay,
|
||||
Ideal,
|
||||
Interac,
|
||||
Klarna,
|
||||
MbWay,
|
||||
MobilePay,
|
||||
Multibanco,
|
||||
OnlineBankingCzechRepublic,
|
||||
OnlineBankingFinland,
|
||||
OnlineBankingPoland,
|
||||
OnlineBankingSlovakia,
|
||||
PayBright,
|
||||
Paypal,
|
||||
Przelewy24,
|
||||
SamsungPay,
|
||||
Sepa,
|
||||
Sofort,
|
||||
Swish,
|
||||
Trustly,
|
||||
UpiCollect,
|
||||
Walley,
|
||||
WeChatPay,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
ToSchema,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum PaymentMethod {
|
||||
#[default]
|
||||
Card,
|
||||
PayLater,
|
||||
Wallet,
|
||||
BankRedirect,
|
||||
BankTransfer,
|
||||
Crypto,
|
||||
BankDebit,
|
||||
Reward,
|
||||
Upi,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
ToSchema,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[strum(serialize_all = "lowercase")]
|
||||
pub enum WalletIssuer {
|
||||
GooglePay,
|
||||
ApplePay,
|
||||
Paypal,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum RefundStatus {
|
||||
Failure,
|
||||
ManualReview,
|
||||
#[default]
|
||||
Pending,
|
||||
Success,
|
||||
TransactionFailure,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
@ -540,7 +12,6 @@ pub enum RefundStatus {
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
ToSchema,
|
||||
frunk::LabelledGeneric,
|
||||
)]
|
||||
|
||||
/// The routing algorithm to be used to process the incoming request from merchant to outgoing payment processor or payment method. The default is 'Custom'
|
||||
@ -554,31 +25,6 @@ pub enum RoutingAlgorithm {
|
||||
Custom,
|
||||
}
|
||||
|
||||
/// The status of the mandate, which indicates whether it can be used to initiate a payment
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
PartialEq,
|
||||
Default,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum MandateStatus {
|
||||
#[default]
|
||||
Active,
|
||||
Inactive,
|
||||
Pending,
|
||||
Revoked,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
@ -588,9 +34,10 @@ pub enum MandateStatus {
|
||||
ToSchema,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::EnumVariantNames,
|
||||
strum::EnumIter,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
Hash,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
@ -697,7 +144,8 @@ impl Connector {
|
||||
serde::Deserialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
strum::EnumIter,
|
||||
strum::EnumVariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
@ -784,7 +232,6 @@ pub enum RoutableConnectors {
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
@ -894,91 +341,7 @@ pub enum BankNames {
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
pub enum CardNetwork {
|
||||
Visa,
|
||||
Mastercard,
|
||||
AmericanExpress,
|
||||
JCB,
|
||||
DinersClub,
|
||||
Discover,
|
||||
CartesBancaires,
|
||||
UnionPay,
|
||||
Interac,
|
||||
RuPay,
|
||||
Maestro,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Default,
|
||||
Debug,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum DisputeStage {
|
||||
PreDispute,
|
||||
#[default]
|
||||
Dispute,
|
||||
PreArbitration,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
Default,
|
||||
Eq,
|
||||
Hash,
|
||||
PartialEq,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum DisputeStatus {
|
||||
#[default]
|
||||
DisputeOpened,
|
||||
DisputeExpired,
|
||||
DisputeAccepted,
|
||||
DisputeCancelled,
|
||||
DisputeChallenged,
|
||||
// dispute has been successfully challenged by the merchant
|
||||
DisputeWon,
|
||||
// dispute has been unsuccessfully challenged
|
||||
DisputeLost,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display, strum::EnumString, ToSchema,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
@ -989,14 +352,7 @@ pub enum FrmAction {
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Debug,
|
||||
serde::Deserialize,
|
||||
serde::Serialize,
|
||||
strum::Display,
|
||||
strum::EnumString,
|
||||
frunk::LabelledGeneric,
|
||||
ToSchema,
|
||||
Clone, Debug, serde::Deserialize, serde::Serialize, strum::Display, strum::EnumString, ToSchema,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
|
||||
Reference in New Issue
Block a user