fix(core): Update pm_status accordingly for the respective attempt status (#5557)

Co-authored-by: Shankar Singh C <shankar.singh@juspay.in>
Co-authored-by: Shankar Singh C <83439957+ShankarSinghC@users.noreply.github.com>
This commit is contained in:
Amisha Prabhat
2024-08-07 21:05:41 +05:30
committed by GitHub
parent 8881e9774e
commit 9d44eaeb92
3 changed files with 40 additions and 23 deletions

View File

@ -1413,8 +1413,8 @@ pub enum PaymentMethodStatus {
impl From<AttemptStatus> for PaymentMethodStatus {
fn from(attempt_status: AttemptStatus) -> Self {
match attempt_status {
AttemptStatus::Failure => Self::Inactive,
AttemptStatus::Voided
AttemptStatus::Failure
| AttemptStatus::Voided
| AttemptStatus::Started
| AttemptStatus::Pending
| AttemptStatus::Unresolved
@ -1434,9 +1434,8 @@ impl From<AttemptStatus> for PaymentMethodStatus {
| AttemptStatus::PartialCharged
| AttemptStatus::PartialChargedAndChargeable
| AttemptStatus::ConfirmationAwaited
| AttemptStatus::DeviceDataCollectionPending
| AttemptStatus::Charged
| AttemptStatus::Authorized => Self::Active,
| AttemptStatus::DeviceDataCollectionPending => Self::Inactive,
AttemptStatus::Charged | AttemptStatus::Authorized => Self::Active,
}
}
}