mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
refactor: attempt and intent status (#210)
This commit is contained in:
committed by
GitHub
parent
c9276a30d7
commit
279961e169
@ -15,9 +15,9 @@
|
||||
pub enum AttemptStatus {
|
||||
Started,
|
||||
AuthenticationFailed,
|
||||
JuspayDeclined,
|
||||
PendingVbv,
|
||||
VbvSuccessful,
|
||||
RouterDeclined,
|
||||
AuthenticationPending,
|
||||
AuthenticationSuccessful,
|
||||
Authorized,
|
||||
AuthorizationFailed,
|
||||
Charged,
|
||||
@ -506,11 +506,11 @@ impl From<AttemptStatus> for IntentStatus {
|
||||
AttemptStatus::PaymentMethodAwaited => IntentStatus::RequiresPaymentMethod,
|
||||
|
||||
AttemptStatus::Authorized => IntentStatus::RequiresCapture,
|
||||
AttemptStatus::PendingVbv => IntentStatus::RequiresCustomerAction,
|
||||
AttemptStatus::AuthenticationPending => IntentStatus::RequiresCustomerAction,
|
||||
|
||||
AttemptStatus::PartialCharged
|
||||
| AttemptStatus::Started
|
||||
| AttemptStatus::VbvSuccessful
|
||||
| AttemptStatus::AuthenticationSuccessful
|
||||
| AttemptStatus::Authorizing
|
||||
| AttemptStatus::CodInitiated
|
||||
| AttemptStatus::VoidInitiated
|
||||
@ -520,7 +520,7 @@ impl From<AttemptStatus> for IntentStatus {
|
||||
AttemptStatus::AuthenticationFailed
|
||||
| AttemptStatus::AuthorizationFailed
|
||||
| AttemptStatus::VoidFailed
|
||||
| AttemptStatus::JuspayDeclined
|
||||
| AttemptStatus::RouterDeclined
|
||||
| AttemptStatus::CaptureFailed
|
||||
| AttemptStatus::Failure => IntentStatus::Failed,
|
||||
AttemptStatus::Voided => IntentStatus::Cancelled,
|
||||
|
||||
@ -471,7 +471,7 @@ pub fn get_redirection_response(
|
||||
"Authorised" => storage_enums::AttemptStatus::Charged,
|
||||
"Refused" => storage_enums::AttemptStatus::Failure,
|
||||
"Cancelled" => storage_enums::AttemptStatus::Failure,
|
||||
"RedirectShopper" => storage_enums::AttemptStatus::PendingVbv,
|
||||
"RedirectShopper" => storage_enums::AttemptStatus::AuthenticationPending,
|
||||
_ => storage_enums::AttemptStatus::Pending,
|
||||
};
|
||||
|
||||
|
||||
@ -486,7 +486,7 @@ impl TryFrom<types::RefundsResponseRouterData<api::RSync, &ActionResponse>>
|
||||
impl From<CheckoutRedirectResponseStatus> for enums::AttemptStatus {
|
||||
fn from(item: CheckoutRedirectResponseStatus) -> Self {
|
||||
match item {
|
||||
CheckoutRedirectResponseStatus::Success => Self::VbvSuccessful,
|
||||
CheckoutRedirectResponseStatus::Success => Self::AuthenticationSuccessful,
|
||||
|
||||
CheckoutRedirectResponseStatus::Failure => Self::Failure,
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ impl From<StripePaymentStatus> for enums::AttemptStatus {
|
||||
StripePaymentStatus::Succeeded => Self::Charged,
|
||||
StripePaymentStatus::Failed => Self::Failure,
|
||||
StripePaymentStatus::Processing => Self::Authorizing,
|
||||
StripePaymentStatus::RequiresCustomerAction => Self::PendingVbv,
|
||||
StripePaymentStatus::RequiresCustomerAction => Self::AuthenticationPending,
|
||||
StripePaymentStatus::RequiresPaymentMethod => Self::PaymentMethodAwaited,
|
||||
StripePaymentStatus::RequiresConfirmation => Self::ConfirmationAwaited,
|
||||
StripePaymentStatus::Canceled => Self::Voided,
|
||||
|
||||
@ -273,7 +273,7 @@ impl<F: Clone> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for Paymen
|
||||
),
|
||||
_ => (
|
||||
enums::IntentStatus::RequiresCustomerAction,
|
||||
enums::AttemptStatus::PendingVbv,
|
||||
enums::AttemptStatus::AuthenticationPending,
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ impl ProcessTrackerWorkflow for PaymentsSyncWorkflow {
|
||||
.await?;
|
||||
|
||||
let terminal_status = vec![
|
||||
enums::AttemptStatus::JuspayDeclined,
|
||||
enums::AttemptStatus::RouterDeclined,
|
||||
enums::AttemptStatus::Charged,
|
||||
enums::AttemptStatus::AutoRefunded,
|
||||
enums::AttemptStatus::Voided,
|
||||
|
||||
@ -187,13 +187,13 @@ impl From<F<storage_enums::AttemptStatus>> for F<storage_enums::IntentStatus> {
|
||||
storage_enums::AttemptStatus::Authorized => {
|
||||
storage_enums::IntentStatus::RequiresCapture
|
||||
}
|
||||
storage_enums::AttemptStatus::PendingVbv => {
|
||||
storage_enums::AttemptStatus::AuthenticationPending => {
|
||||
storage_enums::IntentStatus::RequiresCustomerAction
|
||||
}
|
||||
|
||||
storage_enums::AttemptStatus::PartialCharged
|
||||
| storage_enums::AttemptStatus::Started
|
||||
| storage_enums::AttemptStatus::VbvSuccessful
|
||||
| storage_enums::AttemptStatus::AuthenticationSuccessful
|
||||
| storage_enums::AttemptStatus::Authorizing
|
||||
| storage_enums::AttemptStatus::CodInitiated
|
||||
| storage_enums::AttemptStatus::VoidInitiated
|
||||
@ -203,7 +203,7 @@ impl From<F<storage_enums::AttemptStatus>> for F<storage_enums::IntentStatus> {
|
||||
storage_enums::AttemptStatus::AuthenticationFailed
|
||||
| storage_enums::AttemptStatus::AuthorizationFailed
|
||||
| storage_enums::AttemptStatus::VoidFailed
|
||||
| storage_enums::AttemptStatus::JuspayDeclined
|
||||
| storage_enums::AttemptStatus::RouterDeclined
|
||||
| storage_enums::AttemptStatus::CaptureFailed
|
||||
| storage_enums::AttemptStatus::Failure => storage_enums::IntentStatus::Failed,
|
||||
storage_enums::AttemptStatus::Voided => storage_enums::IntentStatus::Cancelled,
|
||||
|
||||
@ -33,9 +33,9 @@ pub mod diesel_exports {
|
||||
pub enum AttemptStatus {
|
||||
Started,
|
||||
AuthenticationFailed,
|
||||
JuspayDeclined,
|
||||
PendingVbv,
|
||||
VbvSuccessful,
|
||||
RouterDeclined,
|
||||
AuthenticationPending,
|
||||
AuthenticationSuccessful,
|
||||
Authorized,
|
||||
AuthorizationFailed,
|
||||
Charged,
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
ALTER TYPE "AttemptStatus" RENAME VALUE 'router_declined' TO 'juspay_declined';
|
||||
ALTER TYPE "AttemptStatus" RENAME VALUE 'authentication_successful' TO 'pending_vbv';
|
||||
ALTER TYPE "AttemptStatus" RENAME VALUE 'authentication_pending' TO 'vbv_successful';
|
||||
@ -0,0 +1,3 @@
|
||||
ALTER TYPE "AttemptStatus" RENAME VALUE 'juspay_declined' TO 'router_declined';
|
||||
ALTER TYPE "AttemptStatus" RENAME VALUE 'pending_vbv' TO 'authentication_successful';
|
||||
ALTER TYPE "AttemptStatus" RENAME VALUE 'vbv_successful' TO 'authentication_pending';
|
||||
Reference in New Issue
Block a user