mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix: remove and/or resolve fixmes & todos in stripe compatibility (#218)
This commit is contained in:
@ -157,138 +157,142 @@ pub enum StripeErrorCode {
|
||||
},
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "", message = "The mandate information is invalid. {message}")]
|
||||
PaymentIntentMandateInvalid { message: String },
|
||||
// TODO: Some day implement all stripe error codes https://stripe.com/docs/error-codes
|
||||
// AccountCountryInvalidAddress,
|
||||
// AccountErrorCountryChangeRequiresAdditionalSteps,
|
||||
// AccountInformationMismatch,
|
||||
// AccountInvalid,
|
||||
// AccountNumberInvalid,
|
||||
// AcssDebitSessionIncomplete,
|
||||
// AlipayUpgradeRequired,
|
||||
// AmountTooLarge,
|
||||
// AmountTooSmall,
|
||||
// ApiKeyExpired,
|
||||
// AuthenticationRequired,
|
||||
// BalanceInsufficient,
|
||||
// BankAccountBadRoutingNumbers,
|
||||
// BankAccountDeclined,
|
||||
// BankAccountExists,
|
||||
// BankAccountUnusable,
|
||||
// BankAccountUnverified,
|
||||
// BankAccountVerificationFailed,
|
||||
// BillingInvalidMandate,
|
||||
// BitcoinUpgradeRequired,
|
||||
// CardDeclineRateLimitExceeded,
|
||||
// CardDeclined,
|
||||
// CardholderPhoneNumberRequired,
|
||||
// ChargeAlreadyCaptured,
|
||||
// ChargeAlreadyRefunded,
|
||||
// ChargeDisputed,
|
||||
// ChargeExceedsSourceLimit,
|
||||
// ChargeExpiredForCapture,
|
||||
// ChargeInvalidParameter,
|
||||
// ClearingCodeUnsupported,
|
||||
// CountryCodeInvalid,
|
||||
// CountryUnsupported,
|
||||
// CouponExpired,
|
||||
// CustomerMaxPaymentMethods,
|
||||
// CustomerMaxSubscriptions,
|
||||
// DebitNotAuthorized,
|
||||
// EmailInvalid,
|
||||
// ExpiredCard,
|
||||
// IdempotencyKeyInUse,
|
||||
// IncorrectAddress,
|
||||
// IncorrectCvc,
|
||||
// IncorrectNumber,
|
||||
// IncorrectZip,
|
||||
// InstantPayoutsConfigDisabled,
|
||||
// InstantPayoutsCurrencyDisabled,
|
||||
// InstantPayoutsLimitExceeded,
|
||||
// InstantPayoutsUnsupported,
|
||||
// InsufficientFunds,
|
||||
// IntentInvalidState,
|
||||
// IntentVerificationMethodMissing,
|
||||
// InvalidCardType,
|
||||
// InvalidCharacters,
|
||||
// InvalidChargeAmount,
|
||||
// InvalidCvc,
|
||||
// InvalidExpiryMonth,
|
||||
// InvalidExpiryYear,
|
||||
// InvalidNumber,
|
||||
// InvalidSourceUsage,
|
||||
// InvoiceNoCustomerLineItems,
|
||||
// InvoiceNoPaymentMethodTypes,
|
||||
// InvoiceNoSubscriptionLineItems,
|
||||
// InvoiceNotEditable,
|
||||
// InvoiceOnBehalfOfNotEditable,
|
||||
// InvoicePaymentIntentRequiresAction,
|
||||
// InvoiceUpcomingNone,
|
||||
// LivemodeMismatch,
|
||||
// LockTimeout,
|
||||
// Missing,
|
||||
// NoAccount,
|
||||
// NotAllowedOnStandardAccount,
|
||||
// OutOfInventory,
|
||||
// ParameterInvalidEmpty,
|
||||
// ParameterInvalidInteger,
|
||||
// ParameterInvalidStringBlank,
|
||||
// ParameterInvalidStringEmpty,
|
||||
// ParametersExclusive,
|
||||
// PaymentIntentActionRequired,
|
||||
// PaymentIntentIncompatiblePaymentMethod,
|
||||
// PaymentIntentInvalidParameter,
|
||||
// PaymentIntentKonbiniRejectedConfirmationNumber,
|
||||
// PaymentIntentPaymentAttemptExpired,
|
||||
// PaymentIntentUnexpectedState,
|
||||
// PaymentMethodBankAccountAlreadyVerified,
|
||||
// PaymentMethodBankAccountBlocked,
|
||||
// PaymentMethodBillingDetailsAddressMissing,
|
||||
// PaymentMethodCurrencyMismatch,
|
||||
// PaymentMethodInvalidParameter,
|
||||
// PaymentMethodInvalidParameterTestmode,
|
||||
// PaymentMethodMicrodepositFailed,
|
||||
// PaymentMethodMicrodepositVerificationAmountsInvalid,
|
||||
// PaymentMethodMicrodepositVerificationAmountsMismatch,
|
||||
// PaymentMethodMicrodepositVerificationAttemptsExceeded,
|
||||
// PaymentMethodMicrodepositVerificationDescriptorCodeMismatch,
|
||||
// PaymentMethodMicrodepositVerificationTimeout,
|
||||
// PaymentMethodProviderDecline,
|
||||
// PaymentMethodProviderTimeout,
|
||||
// PaymentMethodUnactivated,
|
||||
// PaymentMethodUnexpectedState,
|
||||
// PaymentMethodUnsupportedType,
|
||||
// PayoutsNotAllowed,
|
||||
// PlatformAccountRequired,
|
||||
// PlatformApiKeyExpired,
|
||||
// PostalCodeInvalid,
|
||||
// ProcessingError,
|
||||
// ProductInactive,
|
||||
// RateLimit,
|
||||
// ReferToCustomer,
|
||||
// RefundDisputedPayment,
|
||||
// ResourceAlreadyExists,
|
||||
// ResourceMissing,
|
||||
// ReturnIntentAlreadyProcessed,
|
||||
// RoutingNumberInvalid,
|
||||
// SecretKeyRequired,
|
||||
// SepaUnsupportedAccount,
|
||||
// SetupAttemptFailed,
|
||||
// SetupIntentAuthenticationFailure,
|
||||
// SetupIntentInvalidParameter,
|
||||
// SetupIntentSetupAttemptExpired,
|
||||
// SetupIntentUnexpectedState,
|
||||
// ShippingCalculationFailed,
|
||||
// SkuInactive,
|
||||
// StateUnsupported,
|
||||
// StatusTransitionInvalid,
|
||||
// TaxIdInvalid,
|
||||
// TaxesCalculationFailed,
|
||||
// TerminalLocationCountryUnsupported,
|
||||
// TestmodeChargesOnly,
|
||||
// TlsVersionUnsupported,
|
||||
// TokenInUse,
|
||||
// TransferSourceBalanceParametersMismatch,
|
||||
// TransfersNotAllowed,
|
||||
// [#216]: https://github.com/juspay/orca/issues/216
|
||||
// Implement the remaining stripe error codes
|
||||
|
||||
/*
|
||||
AccountCountryInvalidAddress,
|
||||
AccountErrorCountryChangeRequiresAdditionalSteps,
|
||||
AccountInformationMismatch,
|
||||
AccountInvalid,
|
||||
AccountNumberInvalid,
|
||||
AcssDebitSessionIncomplete,
|
||||
AlipayUpgradeRequired,
|
||||
AmountTooLarge,
|
||||
AmountTooSmall,
|
||||
ApiKeyExpired,
|
||||
AuthenticationRequired,
|
||||
BalanceInsufficient,
|
||||
BankAccountBadRoutingNumbers,
|
||||
BankAccountDeclined,
|
||||
BankAccountExists,
|
||||
BankAccountUnusable,
|
||||
BankAccountUnverified,
|
||||
BankAccountVerificationFailed,
|
||||
BillingInvalidMandate,
|
||||
BitcoinUpgradeRequired,
|
||||
CardDeclineRateLimitExceeded,
|
||||
CardDeclined,
|
||||
CardholderPhoneNumberRequired,
|
||||
ChargeAlreadyCaptured,
|
||||
ChargeAlreadyRefunded,
|
||||
ChargeDisputed,
|
||||
ChargeExceedsSourceLimit,
|
||||
ChargeExpiredForCapture,
|
||||
ChargeInvalidParameter,
|
||||
ClearingCodeUnsupported,
|
||||
CountryCodeInvalid,
|
||||
CountryUnsupported,
|
||||
CouponExpired,
|
||||
CustomerMaxPaymentMethods,
|
||||
CustomerMaxSubscriptions,
|
||||
DebitNotAuthorized,
|
||||
EmailInvalid,
|
||||
ExpiredCard,
|
||||
IdempotencyKeyInUse,
|
||||
IncorrectAddress,
|
||||
IncorrectCvc,
|
||||
IncorrectNumber,
|
||||
IncorrectZip,
|
||||
InstantPayoutsConfigDisabled,
|
||||
InstantPayoutsCurrencyDisabled,
|
||||
InstantPayoutsLimitExceeded,
|
||||
InstantPayoutsUnsupported,
|
||||
InsufficientFunds,
|
||||
IntentInvalidState,
|
||||
IntentVerificationMethodMissing,
|
||||
InvalidCardType,
|
||||
InvalidCharacters,
|
||||
InvalidChargeAmount,
|
||||
InvalidCvc,
|
||||
InvalidExpiryMonth,
|
||||
InvalidExpiryYear,
|
||||
InvalidNumber,
|
||||
InvalidSourceUsage,
|
||||
InvoiceNoCustomerLineItems,
|
||||
InvoiceNoPaymentMethodTypes,
|
||||
InvoiceNoSubscriptionLineItems,
|
||||
InvoiceNotEditable,
|
||||
InvoiceOnBehalfOfNotEditable,
|
||||
InvoicePaymentIntentRequiresAction,
|
||||
InvoiceUpcomingNone,
|
||||
LivemodeMismatch,
|
||||
LockTimeout,
|
||||
Missing,
|
||||
NoAccount,
|
||||
NotAllowedOnStandardAccount,
|
||||
OutOfInventory,
|
||||
ParameterInvalidEmpty,
|
||||
ParameterInvalidInteger,
|
||||
ParameterInvalidStringBlank,
|
||||
ParameterInvalidStringEmpty,
|
||||
ParametersExclusive,
|
||||
PaymentIntentActionRequired,
|
||||
PaymentIntentIncompatiblePaymentMethod,
|
||||
PaymentIntentInvalidParameter,
|
||||
PaymentIntentKonbiniRejectedConfirmationNumber,
|
||||
PaymentIntentPaymentAttemptExpired,
|
||||
PaymentIntentUnexpectedState,
|
||||
PaymentMethodBankAccountAlreadyVerified,
|
||||
PaymentMethodBankAccountBlocked,
|
||||
PaymentMethodBillingDetailsAddressMissing,
|
||||
PaymentMethodCurrencyMismatch,
|
||||
PaymentMethodInvalidParameter,
|
||||
PaymentMethodInvalidParameterTestmode,
|
||||
PaymentMethodMicrodepositFailed,
|
||||
PaymentMethodMicrodepositVerificationAmountsInvalid,
|
||||
PaymentMethodMicrodepositVerificationAmountsMismatch,
|
||||
PaymentMethodMicrodepositVerificationAttemptsExceeded,
|
||||
PaymentMethodMicrodepositVerificationDescriptorCodeMismatch,
|
||||
PaymentMethodMicrodepositVerificationTimeout,
|
||||
PaymentMethodProviderDecline,
|
||||
PaymentMethodProviderTimeout,
|
||||
PaymentMethodUnactivated,
|
||||
PaymentMethodUnexpectedState,
|
||||
PaymentMethodUnsupportedType,
|
||||
PayoutsNotAllowed,
|
||||
PlatformAccountRequired,
|
||||
PlatformApiKeyExpired,
|
||||
PostalCodeInvalid,
|
||||
ProcessingError,
|
||||
ProductInactive,
|
||||
RateLimit,
|
||||
ReferToCustomer,
|
||||
RefundDisputedPayment,
|
||||
ResourceAlreadyExists,
|
||||
ResourceMissing,
|
||||
ReturnIntentAlreadyProcessed,
|
||||
RoutingNumberInvalid,
|
||||
SecretKeyRequired,
|
||||
SepaUnsupportedAccount,
|
||||
SetupAttemptFailed,
|
||||
SetupIntentAuthenticationFailure,
|
||||
SetupIntentInvalidParameter,
|
||||
SetupIntentSetupAttemptExpired,
|
||||
SetupIntentUnexpectedState,
|
||||
ShippingCalculationFailed,
|
||||
SkuInactive,
|
||||
StateUnsupported,
|
||||
StatusTransitionInvalid,
|
||||
TaxIdInvalid,
|
||||
TaxesCalculationFailed,
|
||||
TerminalLocationCountryUnsupported,
|
||||
TestmodeChargesOnly,
|
||||
TlsVersionUnsupported,
|
||||
TokenInUse,
|
||||
TransferSourceBalanceParametersMismatch,
|
||||
TransfersNotAllowed,
|
||||
*/
|
||||
}
|
||||
|
||||
impl ::core::fmt::Display for StripeErrorCode {
|
||||
|
||||
@ -188,12 +188,11 @@ pub enum StripePaymentStatus {
|
||||
RequiresCapture,
|
||||
}
|
||||
|
||||
// TODO: Verigy if the status are correct
|
||||
impl From<api_enums::IntentStatus> for StripePaymentStatus {
|
||||
fn from(item: api_enums::IntentStatus) -> Self {
|
||||
match item {
|
||||
api_enums::IntentStatus::Succeeded => Self::Succeeded,
|
||||
api_enums::IntentStatus::Failed => Self::Canceled, // TODO: should we show canceled or processing
|
||||
api_enums::IntentStatus::Failed => Self::Canceled,
|
||||
api_enums::IntentStatus::Processing => Self::Processing,
|
||||
api_enums::IntentStatus::RequiresCustomerAction => Self::RequiresAction,
|
||||
api_enums::IntentStatus::RequiresPaymentMethod => Self::RequiresPaymentMethod,
|
||||
|
||||
@ -181,12 +181,11 @@ pub enum StripeSetupStatus {
|
||||
RequiresConfirmation,
|
||||
}
|
||||
|
||||
// TODO: Verify if the status are correct
|
||||
impl From<api_enums::IntentStatus> for StripeSetupStatus {
|
||||
fn from(item: api_enums::IntentStatus) -> Self {
|
||||
match item {
|
||||
api_enums::IntentStatus::Succeeded => Self::Succeeded,
|
||||
api_enums::IntentStatus::Failed => Self::Canceled, // TODO: should we show canceled or processing
|
||||
api_enums::IntentStatus::Failed => Self::Canceled,
|
||||
api_enums::IntentStatus::Processing => Self::Processing,
|
||||
api_enums::IntentStatus::RequiresCustomerAction => Self::RequiresAction,
|
||||
api_enums::IntentStatus::RequiresPaymentMethod => Self::RequiresPaymentMethod,
|
||||
|
||||
Reference in New Issue
Block a user