mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
1504 lines
30 KiB
Rust
1504 lines
30 KiB
Rust
use router_derive;
|
|
use serde::{Deserialize, Serialize};
|
|
use utoipa::ToSchema;
|
|
#[doc(hidden)]
|
|
pub mod diesel_exports {
|
|
pub use super::{
|
|
DbAttemptStatus as AttemptStatus, DbAuthenticationType as AuthenticationType,
|
|
DbCaptureMethod as CaptureMethod, DbConnectorType as ConnectorType,
|
|
DbCountryAlpha2 as CountryAlpha2, DbCurrency as Currency, DbDisputeStage as DisputeStage,
|
|
DbDisputeStatus as DisputeStatus, DbEventType as EventType, DbFutureUsage as FutureUsage,
|
|
DbIntentStatus as IntentStatus, DbMandateStatus as MandateStatus,
|
|
DbPaymentMethodIssuerCode as PaymentMethodIssuerCode, DbRefundStatus as RefundStatus,
|
|
};
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Default,
|
|
Eq,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumVariantNames,
|
|
strum::EnumIter,
|
|
strum::EnumString,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumVariantNames,
|
|
strum::EnumIter,
|
|
strum::EnumString,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
strum::EnumVariantNames,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
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,
|
|
VND,
|
|
YER,
|
|
ZAR,
|
|
}
|
|
|
|
impl Currency {
|
|
pub fn iso_4217(&self) -> &'static str {
|
|
match *self {
|
|
Self::AED => "784",
|
|
Self::ALL => "008",
|
|
Self::AMD => "051",
|
|
Self::ANG => "532",
|
|
Self::ARS => "032",
|
|
Self::AUD => "036",
|
|
Self::AWG => "533",
|
|
Self::AZN => "944",
|
|
Self::BBD => "052",
|
|
Self::BDT => "050",
|
|
Self::BHD => "048",
|
|
Self::BMD => "060",
|
|
Self::BND => "096",
|
|
Self::BOB => "068",
|
|
Self::BRL => "986",
|
|
Self::BSD => "044",
|
|
Self::BWP => "072",
|
|
Self::BZD => "084",
|
|
Self::CAD => "124",
|
|
Self::CHF => "756",
|
|
Self::COP => "170",
|
|
Self::CRC => "188",
|
|
Self::CUP => "192",
|
|
Self::CZK => "203",
|
|
Self::DKK => "208",
|
|
Self::DOP => "214",
|
|
Self::DZD => "012",
|
|
Self::EGP => "818",
|
|
Self::ETB => "230",
|
|
Self::EUR => "978",
|
|
Self::FJD => "242",
|
|
Self::GBP => "826",
|
|
Self::GHS => "936",
|
|
Self::GIP => "292",
|
|
Self::GMD => "270",
|
|
Self::GTQ => "320",
|
|
Self::GYD => "328",
|
|
Self::HKD => "344",
|
|
Self::HNL => "340",
|
|
Self::HTG => "332",
|
|
Self::HUF => "348",
|
|
Self::HRK => "191",
|
|
Self::IDR => "360",
|
|
Self::ILS => "376",
|
|
Self::INR => "356",
|
|
Self::JMD => "388",
|
|
Self::JOD => "400",
|
|
Self::JPY => "392",
|
|
Self::KES => "404",
|
|
Self::KGS => "417",
|
|
Self::KHR => "116",
|
|
Self::KRW => "410",
|
|
Self::KWD => "414",
|
|
Self::KYD => "136",
|
|
Self::KZT => "398",
|
|
Self::LAK => "418",
|
|
Self::LBP => "422",
|
|
Self::LKR => "144",
|
|
Self::LRD => "430",
|
|
Self::LSL => "426",
|
|
Self::MAD => "504",
|
|
Self::MDL => "498",
|
|
Self::MKD => "807",
|
|
Self::MMK => "104",
|
|
Self::MNT => "496",
|
|
Self::MOP => "446",
|
|
Self::MUR => "480",
|
|
Self::MVR => "462",
|
|
Self::MWK => "454",
|
|
Self::MXN => "484",
|
|
Self::MYR => "458",
|
|
Self::NAD => "516",
|
|
Self::NGN => "566",
|
|
Self::NIO => "558",
|
|
Self::NOK => "578",
|
|
Self::NPR => "524",
|
|
Self::NZD => "554",
|
|
Self::OMR => "512",
|
|
Self::PEN => "604",
|
|
Self::PGK => "598",
|
|
Self::PHP => "608",
|
|
Self::PKR => "586",
|
|
Self::PLN => "985",
|
|
Self::QAR => "634",
|
|
Self::RON => "946",
|
|
Self::CNY => "156",
|
|
Self::RUB => "643",
|
|
Self::SAR => "682",
|
|
Self::SCR => "690",
|
|
Self::SEK => "752",
|
|
Self::SGD => "702",
|
|
Self::SLL => "694",
|
|
Self::SOS => "706",
|
|
Self::SSP => "728",
|
|
Self::SVC => "222",
|
|
Self::SZL => "748",
|
|
Self::THB => "764",
|
|
Self::TRY => "949",
|
|
Self::TTD => "780",
|
|
Self::TWD => "901",
|
|
Self::TZS => "834",
|
|
Self::USD => "840",
|
|
Self::UYU => "858",
|
|
Self::UZS => "860",
|
|
Self::VND => "704",
|
|
Self::YER => "886",
|
|
Self::ZAR => "710",
|
|
}
|
|
}
|
|
|
|
pub fn is_zero_decimal_currency(self) -> bool {
|
|
match self {
|
|
Self::JPY | Self::KRW => true,
|
|
Self::AED
|
|
| Self::ALL
|
|
| Self::AMD
|
|
| Self::ANG
|
|
| Self::ARS
|
|
| Self::AUD
|
|
| Self::AWG
|
|
| Self::AZN
|
|
| Self::BBD
|
|
| Self::BDT
|
|
| Self::BHD
|
|
| Self::BMD
|
|
| Self::BND
|
|
| Self::BOB
|
|
| Self::BRL
|
|
| Self::BSD
|
|
| Self::BWP
|
|
| Self::BZD
|
|
| Self::CAD
|
|
| Self::CHF
|
|
| Self::CNY
|
|
| Self::COP
|
|
| Self::CRC
|
|
| Self::CUP
|
|
| Self::CZK
|
|
| Self::DKK
|
|
| Self::DOP
|
|
| Self::DZD
|
|
| Self::EGP
|
|
| Self::ETB
|
|
| Self::EUR
|
|
| Self::FJD
|
|
| Self::GBP
|
|
| Self::GHS
|
|
| Self::GIP
|
|
| Self::GMD
|
|
| Self::GTQ
|
|
| Self::GYD
|
|
| Self::HKD
|
|
| Self::HNL
|
|
| Self::HRK
|
|
| Self::HTG
|
|
| Self::HUF
|
|
| Self::IDR
|
|
| Self::ILS
|
|
| Self::INR
|
|
| Self::JMD
|
|
| Self::JOD
|
|
| Self::KES
|
|
| Self::KGS
|
|
| Self::KHR
|
|
| Self::KWD
|
|
| Self::KYD
|
|
| Self::KZT
|
|
| Self::LAK
|
|
| Self::LBP
|
|
| Self::LKR
|
|
| Self::LRD
|
|
| Self::LSL
|
|
| Self::MAD
|
|
| Self::MDL
|
|
| Self::MKD
|
|
| Self::MMK
|
|
| Self::MNT
|
|
| Self::MOP
|
|
| Self::MUR
|
|
| Self::MVR
|
|
| Self::MWK
|
|
| Self::MXN
|
|
| Self::MYR
|
|
| Self::NAD
|
|
| Self::NGN
|
|
| Self::NIO
|
|
| Self::NOK
|
|
| Self::NPR
|
|
| Self::NZD
|
|
| Self::OMR
|
|
| Self::PEN
|
|
| Self::PGK
|
|
| Self::PHP
|
|
| Self::PKR
|
|
| Self::PLN
|
|
| Self::QAR
|
|
| Self::RON
|
|
| Self::RUB
|
|
| Self::SAR
|
|
| Self::SCR
|
|
| Self::SEK
|
|
| Self::SGD
|
|
| Self::SLL
|
|
| Self::SOS
|
|
| Self::SSP
|
|
| Self::SVC
|
|
| Self::SZL
|
|
| Self::THB
|
|
| Self::TRY
|
|
| Self::TTD
|
|
| Self::TWD
|
|
| Self::TZS
|
|
| Self::USD
|
|
| Self::UYU
|
|
| Self::UZS
|
|
| Self::VND
|
|
| Self::YER
|
|
| Self::ZAR => false,
|
|
}
|
|
}
|
|
|
|
pub fn is_three_decimal_currency(self) -> bool {
|
|
match self {
|
|
Self::BHD | Self::JOD | Self::KWD | Self::OMR => true,
|
|
Self::AED
|
|
| Self::ALL
|
|
| Self::AMD
|
|
| Self::ANG
|
|
| Self::ARS
|
|
| Self::AUD
|
|
| Self::AWG
|
|
| Self::AZN
|
|
| Self::BBD
|
|
| Self::BDT
|
|
| Self::BMD
|
|
| Self::BND
|
|
| Self::BOB
|
|
| Self::BRL
|
|
| Self::BSD
|
|
| Self::BWP
|
|
| Self::BZD
|
|
| Self::CAD
|
|
| Self::CHF
|
|
| Self::CNY
|
|
| Self::COP
|
|
| Self::CRC
|
|
| Self::CUP
|
|
| Self::CZK
|
|
| Self::DKK
|
|
| Self::DOP
|
|
| Self::DZD
|
|
| Self::EGP
|
|
| Self::ETB
|
|
| Self::EUR
|
|
| Self::FJD
|
|
| Self::GBP
|
|
| Self::GHS
|
|
| Self::GIP
|
|
| Self::GMD
|
|
| Self::GTQ
|
|
| Self::GYD
|
|
| Self::HKD
|
|
| Self::HNL
|
|
| Self::HRK
|
|
| Self::HTG
|
|
| Self::HUF
|
|
| Self::IDR
|
|
| Self::ILS
|
|
| Self::INR
|
|
| Self::JMD
|
|
| Self::JPY
|
|
| Self::KES
|
|
| Self::KGS
|
|
| Self::KHR
|
|
| Self::KRW
|
|
| Self::KYD
|
|
| Self::KZT
|
|
| Self::LAK
|
|
| Self::LBP
|
|
| Self::LKR
|
|
| Self::LRD
|
|
| Self::LSL
|
|
| Self::MAD
|
|
| Self::MDL
|
|
| Self::MKD
|
|
| Self::MMK
|
|
| Self::MNT
|
|
| Self::MOP
|
|
| Self::MUR
|
|
| Self::MVR
|
|
| Self::MWK
|
|
| Self::MXN
|
|
| Self::MYR
|
|
| Self::NAD
|
|
| Self::NGN
|
|
| Self::NIO
|
|
| Self::NOK
|
|
| Self::NPR
|
|
| Self::NZD
|
|
| Self::PEN
|
|
| Self::PGK
|
|
| Self::PHP
|
|
| Self::PKR
|
|
| Self::PLN
|
|
| Self::QAR
|
|
| Self::RON
|
|
| Self::RUB
|
|
| Self::SAR
|
|
| Self::SCR
|
|
| Self::SEK
|
|
| Self::SGD
|
|
| Self::SLL
|
|
| Self::SOS
|
|
| Self::SSP
|
|
| Self::SVC
|
|
| Self::SZL
|
|
| Self::THB
|
|
| Self::TRY
|
|
| Self::TTD
|
|
| Self::TWD
|
|
| Self::TZS
|
|
| Self::USD
|
|
| Self::UYU
|
|
| Self::UZS
|
|
| Self::VND
|
|
| Self::YER
|
|
| Self::ZAR => false,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Eq,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
Hash,
|
|
PartialEq,
|
|
ToSchema,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[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,
|
|
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,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Eq,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumVariantNames,
|
|
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,
|
|
AliPay,
|
|
AliPayHk,
|
|
Alma,
|
|
ApplePay,
|
|
Atome,
|
|
Bacs,
|
|
BancontactCard,
|
|
Becs,
|
|
Blik,
|
|
Bizum,
|
|
#[serde(rename = "classic")]
|
|
ClassicReward,
|
|
Credit,
|
|
CryptoCurrency,
|
|
Dana,
|
|
Debit,
|
|
Eps,
|
|
Evoucher,
|
|
Giropay,
|
|
GooglePay,
|
|
GoPay,
|
|
Gcash,
|
|
Ideal,
|
|
Interac,
|
|
Klarna,
|
|
KakaoPay,
|
|
MbWay,
|
|
MobilePay,
|
|
Momo,
|
|
Multibanco,
|
|
OnlineBankingThailand,
|
|
OnlineBankingCzechRepublic,
|
|
OnlineBankingFinland,
|
|
OnlineBankingFpx,
|
|
OnlineBankingPoland,
|
|
OnlineBankingSlovakia,
|
|
PayBright,
|
|
Paypal,
|
|
Pix,
|
|
Przelewy24,
|
|
SamsungPay,
|
|
Sepa,
|
|
Sofort,
|
|
Swish,
|
|
TouchNGo,
|
|
Trustly,
|
|
Twint,
|
|
UpiCollect,
|
|
Vipps,
|
|
Walley,
|
|
WeChatPay,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Default,
|
|
Eq,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumVariantNames,
|
|
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,
|
|
PayLater,
|
|
Wallet,
|
|
BankRedirect,
|
|
BankTransfer,
|
|
Crypto,
|
|
BankDebit,
|
|
Reward,
|
|
Upi,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Default,
|
|
Eq,
|
|
Hash,
|
|
PartialEq,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
serde::Serialize,
|
|
serde::Deserialize,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[strum(serialize_all = "snake_case")]
|
|
pub enum RefundStatus {
|
|
Failure,
|
|
ManualReview,
|
|
#[default]
|
|
Pending,
|
|
Success,
|
|
TransactionFailure,
|
|
}
|
|
|
|
/// 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,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[strum(serialize_all = "snake_case")]
|
|
pub enum MandateStatus {
|
|
#[default]
|
|
Active,
|
|
Inactive,
|
|
Pending,
|
|
Revoked,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Debug,
|
|
Eq,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumVariantNames,
|
|
strum::EnumIter,
|
|
strum::EnumString,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "text")]
|
|
pub enum CardNetwork {
|
|
Visa,
|
|
Mastercard,
|
|
AmericanExpress,
|
|
JCB,
|
|
DinersClub,
|
|
Discover,
|
|
CartesBancaires,
|
|
UnionPay,
|
|
Interac,
|
|
RuPay,
|
|
Maestro,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Default,
|
|
Debug,
|
|
Eq,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[strum(serialize_all = "snake_case")]
|
|
pub enum DisputeStage {
|
|
PreDispute,
|
|
#[default]
|
|
Dispute,
|
|
PreArbitration,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Debug,
|
|
Copy,
|
|
Default,
|
|
Eq,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[strum(serialize_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,
|
|
Eq,
|
|
Default,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
utoipa::ToSchema,
|
|
Copy
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[rustfmt::skip]
|
|
pub enum CountryAlpha2 {
|
|
AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT,
|
|
AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BQ, BA, BW,
|
|
BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL,
|
|
CN, CX, CC, CO, KM, CG, CD, CK, CR, CI, HR, CU, CW, CY, CZ,
|
|
DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI,
|
|
FR, GF, PF, TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU,
|
|
GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR,
|
|
IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW,
|
|
KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, MO, MK, MG, MW, MY,
|
|
MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS,
|
|
MA, MZ, MM, NA, NR, NP, NL, NC, NZ, NI, NE, NG, NU, NF, MP,
|
|
NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA,
|
|
RE, RO, RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA,
|
|
SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, ES, LK,
|
|
SD, SR, SJ, SZ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO,
|
|
TT, TN, TR, TM, TC, TV, UG, UA, AE, GB, UM, UY, UZ, VU,
|
|
VE, VN, VG, VI, WF, EH, YE, ZM, ZW,
|
|
#[default]
|
|
US
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
|
#[rustfmt::skip]
|
|
pub enum CountryAlpha3 {
|
|
AFG, ALA, ALB, DZA, ASM, AND, AGO, AIA, ATA, ATG, ARG, ARM, ABW, AUS, AUT,
|
|
AZE, BHS, BHR, BGD, BRB, BLR, BEL, BLZ, BEN, BMU, BTN, BOL, BES, BIH, BWA,
|
|
BVT, BRA, IOT, BRN, BGR, BFA, BDI, CPV, KHM, CMR, CAN, CYM, CAF, TCD, CHL,
|
|
CHN, CXR, CCK, COL, COM, COG, COD, COK, CRI, CIV, HRV, CUB, CUW, CYP, CZE,
|
|
DNK, DJI, DMA, DOM, ECU, EGY, SLV, GNQ, ERI, EST, ETH, FLK, FRO, FJI, FIN,
|
|
FRA, GUF, PYF, ATF, GAB, GMB, GEO, DEU, GHA, GIB, GRC, GRL, GRD, GLP, GUM,
|
|
GTM, GGY, GIN, GNB, GUY, HTI, HMD, VAT, HND, HKG, HUN, ISL, IND, IDN, IRN,
|
|
IRQ, IRL, IMN, ISR, ITA, JAM, JPN, JEY, JOR, KAZ, KEN, KIR, PRK, KOR, KWT,
|
|
KGZ, LAO, LVA, LBN, LSO, LBR, LBY, LIE, LTU, LUX, MAC, MKD, MDG, MWI, MYS,
|
|
MDV, MLI, MLT, MHL, MTQ, MRT, MUS, MYT, MEX, FSM, MDA, MCO, MNG, MNE, MSR,
|
|
MAR, MOZ, MMR, NAM, NRU, NPL, NLD, NCL, NZL, NIC, NER, NGA, NIU, NFK, MNP,
|
|
NOR, OMN, PAK, PLW, PSE, PAN, PNG, PRY, PER, PHL, PCN, POL, PRT, PRI, QAT,
|
|
REU, ROU, RUS, RWA, BLM, SHN, KNA, LCA, MAF, SPM, VCT, WSM, SMR, STP, SAU,
|
|
SEN, SRB, SYC, SLE, SGP, SXM, SVK, SVN, SLB, SOM, ZAF, SGS, SSD, ESP, LKA,
|
|
SDN, SUR, SJM, SWZ, SWE, CHE, SYR, TWN, TJK, TZA, THA, TLS, TGO, TKL, TON,
|
|
TTO, TUN, TUR, TKM, TCA, TUV, UGA, UKR, ARE, GBR, USA, UMI, URY, UZB, VUT,
|
|
VEN, VNM, VGB, VIR, WLF, ESH, YEM, ZMB, ZWE
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
PartialEq,
|
|
Eq,
|
|
Hash,
|
|
strum::Display,
|
|
strum::EnumVariantNames,
|
|
strum::EnumIter,
|
|
strum::EnumString,
|
|
Deserialize,
|
|
Serialize,
|
|
)]
|
|
pub enum Country {
|
|
Afghanistan,
|
|
AlandIslands,
|
|
Albania,
|
|
Algeria,
|
|
AmericanSamoa,
|
|
Andorra,
|
|
Angola,
|
|
Anguilla,
|
|
Antarctica,
|
|
AntiguaAndBarbuda,
|
|
Argentina,
|
|
Armenia,
|
|
Aruba,
|
|
Australia,
|
|
Austria,
|
|
Azerbaijan,
|
|
Bahamas,
|
|
Bahrain,
|
|
Bangladesh,
|
|
Barbados,
|
|
Belarus,
|
|
Belgium,
|
|
Belize,
|
|
Benin,
|
|
Bermuda,
|
|
Bhutan,
|
|
BoliviaPlurinationalState,
|
|
BonaireSintEustatiusAndSaba,
|
|
BosniaAndHerzegovina,
|
|
Botswana,
|
|
BouvetIsland,
|
|
Brazil,
|
|
BritishIndianOceanTerritory,
|
|
BruneiDarussalam,
|
|
Bulgaria,
|
|
BurkinaFaso,
|
|
Burundi,
|
|
CaboVerde,
|
|
Cambodia,
|
|
Cameroon,
|
|
Canada,
|
|
CaymanIslands,
|
|
CentralAfricanRepublic,
|
|
Chad,
|
|
Chile,
|
|
China,
|
|
ChristmasIsland,
|
|
CocosKeelingIslands,
|
|
Colombia,
|
|
Comoros,
|
|
Congo,
|
|
CongoDemocraticRepublic,
|
|
CookIslands,
|
|
CostaRica,
|
|
CotedIvoire,
|
|
Croatia,
|
|
Cuba,
|
|
Curacao,
|
|
Cyprus,
|
|
Czechia,
|
|
Denmark,
|
|
Djibouti,
|
|
Dominica,
|
|
DominicanRepublic,
|
|
Ecuador,
|
|
Egypt,
|
|
ElSalvador,
|
|
EquatorialGuinea,
|
|
Eritrea,
|
|
Estonia,
|
|
Ethiopia,
|
|
FalklandIslandsMalvinas,
|
|
FaroeIslands,
|
|
Fiji,
|
|
Finland,
|
|
France,
|
|
FrenchGuiana,
|
|
FrenchPolynesia,
|
|
FrenchSouthernTerritories,
|
|
Gabon,
|
|
Gambia,
|
|
Georgia,
|
|
Germany,
|
|
Ghana,
|
|
Gibraltar,
|
|
Greece,
|
|
Greenland,
|
|
Grenada,
|
|
Guadeloupe,
|
|
Guam,
|
|
Guatemala,
|
|
Guernsey,
|
|
Guinea,
|
|
GuineaBissau,
|
|
Guyana,
|
|
Haiti,
|
|
HeardIslandAndMcDonaldIslands,
|
|
HolySee,
|
|
Honduras,
|
|
HongKong,
|
|
Hungary,
|
|
Iceland,
|
|
India,
|
|
Indonesia,
|
|
IranIslamicRepublic,
|
|
Iraq,
|
|
Ireland,
|
|
IsleOfMan,
|
|
Israel,
|
|
Italy,
|
|
Jamaica,
|
|
Japan,
|
|
Jersey,
|
|
Jordan,
|
|
Kazakhstan,
|
|
Kenya,
|
|
Kiribati,
|
|
KoreaDemocraticPeoplesRepublic,
|
|
KoreaRepublic,
|
|
Kuwait,
|
|
Kyrgyzstan,
|
|
LaoPeoplesDemocraticRepublic,
|
|
Latvia,
|
|
Lebanon,
|
|
Lesotho,
|
|
Liberia,
|
|
Libya,
|
|
Liechtenstein,
|
|
Lithuania,
|
|
Luxembourg,
|
|
Macao,
|
|
MacedoniaTheFormerYugoslavRepublic,
|
|
Madagascar,
|
|
Malawi,
|
|
Malaysia,
|
|
Maldives,
|
|
Mali,
|
|
Malta,
|
|
MarshallIslands,
|
|
Martinique,
|
|
Mauritania,
|
|
Mauritius,
|
|
Mayotte,
|
|
Mexico,
|
|
MicronesiaFederatedStates,
|
|
MoldovaRepublic,
|
|
Monaco,
|
|
Mongolia,
|
|
Montenegro,
|
|
Montserrat,
|
|
Morocco,
|
|
Mozambique,
|
|
Myanmar,
|
|
Namibia,
|
|
Nauru,
|
|
Nepal,
|
|
Netherlands,
|
|
NewCaledonia,
|
|
NewZealand,
|
|
Nicaragua,
|
|
Niger,
|
|
Nigeria,
|
|
Niue,
|
|
NorfolkIsland,
|
|
NorthernMarianaIslands,
|
|
Norway,
|
|
Oman,
|
|
Pakistan,
|
|
Palau,
|
|
PalestineState,
|
|
Panama,
|
|
PapuaNewGuinea,
|
|
Paraguay,
|
|
Peru,
|
|
Philippines,
|
|
Pitcairn,
|
|
Poland,
|
|
Portugal,
|
|
PuertoRico,
|
|
Qatar,
|
|
Reunion,
|
|
Romania,
|
|
RussianFederation,
|
|
Rwanda,
|
|
SaintBarthelemy,
|
|
SaintHelenaAscensionAndTristandaCunha,
|
|
SaintKittsAndNevis,
|
|
SaintLucia,
|
|
SaintMartinFrenchpart,
|
|
SaintPierreAndMiquelon,
|
|
SaintVincentAndTheGrenadines,
|
|
Samoa,
|
|
SanMarino,
|
|
SaoTomeAndPrincipe,
|
|
SaudiArabia,
|
|
Senegal,
|
|
Serbia,
|
|
Seychelles,
|
|
SierraLeone,
|
|
Singapore,
|
|
SintMaartenDutchpart,
|
|
Slovakia,
|
|
Slovenia,
|
|
SolomonIslands,
|
|
Somalia,
|
|
SouthAfrica,
|
|
SouthGeorgiaAndTheSouthSandwichIslands,
|
|
SouthSudan,
|
|
Spain,
|
|
SriLanka,
|
|
Sudan,
|
|
Suriname,
|
|
SvalbardAndJanMayen,
|
|
Swaziland,
|
|
Sweden,
|
|
Switzerland,
|
|
SyrianArabRepublic,
|
|
TaiwanProvinceOfChina,
|
|
Tajikistan,
|
|
TanzaniaUnitedRepublic,
|
|
Thailand,
|
|
TimorLeste,
|
|
Togo,
|
|
Tokelau,
|
|
Tonga,
|
|
TrinidadAndTobago,
|
|
Tunisia,
|
|
Turkey,
|
|
Turkmenistan,
|
|
TurksAndCaicosIslands,
|
|
Tuvalu,
|
|
Uganda,
|
|
Ukraine,
|
|
UnitedArabEmirates,
|
|
UnitedKingdomOfGreatBritainAndNorthernIreland,
|
|
UnitedStatesOfAmerica,
|
|
UnitedStatesMinorOutlyingIslands,
|
|
Uruguay,
|
|
Uzbekistan,
|
|
Vanuatu,
|
|
VenezuelaBolivarianRepublic,
|
|
Vietnam,
|
|
VirginIslandsBritish,
|
|
VirginIslandsUS,
|
|
WallisAndFutuna,
|
|
WesternSahara,
|
|
Yemen,
|
|
Zambia,
|
|
Zimbabwe,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Eq,
|
|
PartialEq,
|
|
Default,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "text")]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[strum(serialize_all = "snake_case")]
|
|
pub enum FileUploadProvider {
|
|
#[default]
|
|
Router,
|
|
Stripe,
|
|
Checkout,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, strum::Display)]
|
|
pub enum UsStatesAbbreviation {
|
|
AL,
|
|
AK,
|
|
AS,
|
|
AZ,
|
|
AR,
|
|
CA,
|
|
CO,
|
|
CT,
|
|
DE,
|
|
DC,
|
|
FM,
|
|
FL,
|
|
GA,
|
|
GU,
|
|
HI,
|
|
ID,
|
|
IL,
|
|
IN,
|
|
IA,
|
|
KS,
|
|
KY,
|
|
LA,
|
|
ME,
|
|
MH,
|
|
MD,
|
|
MA,
|
|
MI,
|
|
MN,
|
|
MS,
|
|
MO,
|
|
MT,
|
|
NE,
|
|
NV,
|
|
NH,
|
|
NJ,
|
|
NM,
|
|
NY,
|
|
NC,
|
|
ND,
|
|
MP,
|
|
OH,
|
|
OK,
|
|
OR,
|
|
PW,
|
|
PA,
|
|
PR,
|
|
RI,
|
|
SC,
|
|
SD,
|
|
TN,
|
|
TX,
|
|
UT,
|
|
VT,
|
|
VI,
|
|
VA,
|
|
WA,
|
|
WV,
|
|
WI,
|
|
WY,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, strum::Display)]
|
|
pub enum CanadaStatesAbbreviation {
|
|
AB,
|
|
BC,
|
|
MB,
|
|
NB,
|
|
NL,
|
|
NT,
|
|
NS,
|
|
NU,
|
|
ON,
|
|
PE,
|
|
QC,
|
|
SK,
|
|
YT,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Default,
|
|
Eq,
|
|
PartialEq,
|
|
ToSchema,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[strum(serialize_all = "snake_case")]
|
|
pub enum PayoutStatus {
|
|
Success,
|
|
Failed,
|
|
Cancelled,
|
|
Pending,
|
|
Ineligible,
|
|
#[default]
|
|
RequiresCreation,
|
|
RequiresPayoutMethodData,
|
|
RequiresFulfillment,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Default,
|
|
Eq,
|
|
PartialEq,
|
|
ToSchema,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "pg_enum")]
|
|
#[serde(rename_all = "snake_case")]
|
|
#[strum(serialize_all = "snake_case")]
|
|
pub enum PayoutType {
|
|
#[default]
|
|
Card,
|
|
Bank,
|
|
}
|
|
|
|
#[derive(
|
|
Clone,
|
|
Copy,
|
|
Debug,
|
|
Default,
|
|
Eq,
|
|
Hash,
|
|
PartialEq,
|
|
serde::Deserialize,
|
|
serde::Serialize,
|
|
strum::Display,
|
|
strum::EnumString,
|
|
ToSchema,
|
|
)]
|
|
#[router_derive::diesel_enum(storage_type = "text")]
|
|
#[serde(rename_all = "PascalCase")]
|
|
#[strum(serialize_all = "PascalCase")]
|
|
pub enum PayoutEntityType {
|
|
/// Adyen
|
|
#[default]
|
|
Individual,
|
|
Company,
|
|
NonProfit,
|
|
PublicSector,
|
|
|
|
/// Wise
|
|
#[strum(serialize = "lowercase")]
|
|
#[serde(rename = "lowercase")]
|
|
Business,
|
|
Personal,
|
|
}
|