mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
feat(frm): Add support to accept and decline payment when manually reviewed by merchant for risky transaction (#2071)
This commit is contained in:
@ -101,6 +101,9 @@ pub struct PaymentIntent {
|
||||
pub feature_metadata: Option<serde_json::Value>,
|
||||
pub attempt_count: i16,
|
||||
pub profile_id: Option<String>,
|
||||
// Denotes the action(approve or reject) taken by merchant in case of manual review.
|
||||
// Manual review can occur when the transaction is marked as risky by the frm_processor, payment processor or when there is underpayment/over payment incase of crypto payment
|
||||
pub merchant_decision: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize)]
|
||||
@ -138,6 +141,7 @@ pub struct PaymentIntentNew {
|
||||
pub feature_metadata: Option<serde_json::Value>,
|
||||
pub attempt_count: i16,
|
||||
pub profile_id: Option<String>,
|
||||
pub merchant_decision: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@ -191,6 +195,13 @@ pub enum PaymentIntentUpdate {
|
||||
active_attempt_id: String,
|
||||
attempt_count: i16,
|
||||
},
|
||||
ApproveUpdate {
|
||||
merchant_decision: Option<String>,
|
||||
},
|
||||
RejectUpdate {
|
||||
status: storage_enums::IntentStatus,
|
||||
merchant_decision: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
@ -215,6 +226,9 @@ pub struct PaymentIntentUpdateInternal {
|
||||
pub statement_descriptor_suffix: Option<String>,
|
||||
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
|
||||
pub attempt_count: Option<i16>,
|
||||
// Denotes the action(approve or reject) taken by merchant in case of manual review.
|
||||
// Manual review can occur when the transaction is marked as risky by the frm_processor, payment processor or when there is underpayment/over payment incase of crypto payment
|
||||
pub merchant_decision: Option<String>,
|
||||
}
|
||||
|
||||
impl PaymentIntentUpdate {
|
||||
@ -354,6 +368,18 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
|
||||
attempt_count: Some(attempt_count),
|
||||
..Default::default()
|
||||
},
|
||||
PaymentIntentUpdate::ApproveUpdate { merchant_decision } => Self {
|
||||
merchant_decision,
|
||||
..Default::default()
|
||||
},
|
||||
PaymentIntentUpdate::RejectUpdate {
|
||||
status,
|
||||
merchant_decision,
|
||||
} => Self {
|
||||
status: Some(status),
|
||||
merchant_decision,
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user