feat(connector): [TRUSTPAY] Added Integrity Checks for PSync & RSync flows & Added New Variants in AttemptStatus & IntentStatus (#8096)

Co-authored-by: Sayak Bhattacharya <sayak.b@Sayak-Bhattacharya-G092THXJ34.local>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Sahkal Poddar <sahkalplanet@gmail.com>
This commit is contained in:
Sayak Bhattacharya
2025-06-10 22:00:18 +05:30
committed by GitHub
parent c3a7f5c43d
commit a76a9c1514
31 changed files with 148 additions and 64 deletions

View File

@ -155,6 +155,7 @@ pub enum AttemptStatus {
PaymentMethodAwaited,
ConfirmationAwaited,
DeviceDataCollectionPending,
IntegrityFailure,
}
impl AttemptStatus {
@ -183,7 +184,8 @@ impl AttemptStatus {
| Self::Pending
| Self::PaymentMethodAwaited
| Self::ConfirmationAwaited
| Self::DeviceDataCollectionPending => false,
| Self::DeviceDataCollectionPending
| Self::IntegrityFailure => false,
}
}
}
@ -1599,6 +1601,8 @@ pub enum IntentStatus {
PartiallyCaptured,
/// The payment has been captured partially and the remaining amount is capturable
PartiallyCapturedAndCapturable,
/// There has been a discrepancy between the amount/currency sent in the request and the amount/currency received by the processor
Conflicted,
}
impl IntentStatus {
@ -1612,7 +1616,8 @@ impl IntentStatus {
| Self::RequiresPaymentMethod
| Self::RequiresConfirmation
| Self::RequiresCapture
| Self::PartiallyCapturedAndCapturable => false,
| Self::PartiallyCapturedAndCapturable
| Self::Conflicted => false,
}
}
@ -1627,7 +1632,7 @@ impl IntentStatus {
| Self::Failed
| Self::Cancelled
| Self::PartiallyCaptured
| Self::RequiresCapture => false,
| Self::RequiresCapture | Self::Conflicted => false,
Self::Processing
| Self::RequiresCustomerAction
| Self::RequiresMerchantAction
@ -1747,7 +1752,8 @@ impl From<AttemptStatus> for PaymentMethodStatus {
| AttemptStatus::PartialCharged
| AttemptStatus::PartialChargedAndChargeable
| AttemptStatus::ConfirmationAwaited
| AttemptStatus::DeviceDataCollectionPending => Self::Inactive,
| AttemptStatus::DeviceDataCollectionPending
| AttemptStatus::IntegrityFailure => Self::Inactive,
AttemptStatus::Charged | AttemptStatus::Authorized => Self::Active,
}
}

View File

@ -2095,7 +2095,7 @@ impl From<AttemptStatus> for IntentStatus {
Self::RequiresCustomerAction
}
AttemptStatus::Unresolved => Self::RequiresMerchantAction,
AttemptStatus::IntegrityFailure => Self::Conflicted,
AttemptStatus::PartialCharged => Self::PartiallyCaptured,
AttemptStatus::PartialChargedAndChargeable => Self::PartiallyCapturedAndCapturable,
AttemptStatus::Started