feat(router): add payments incremental authorization api (#3038)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sai Harsha Vardhan
2023-12-04 18:34:51 +05:30
committed by GitHub
parent 9274cefbdd
commit a0cfdd3fb1
60 changed files with 1792 additions and 22 deletions

View File

@ -52,4 +52,5 @@ pub struct PaymentIntent {
pub surcharge_applicable: Option<bool>,
pub request_incremental_authorization: storage_enums::RequestIncrementalAuthorization,
pub incremental_authorization_allowed: Option<bool>,
pub authorization_count: Option<i32>,
}

View File

@ -359,6 +359,10 @@ pub enum PaymentAttemptUpdate {
connector: Option<String>,
updated_by: String,
},
IncrementalAuthorizationAmountUpdate {
amount: i64,
amount_capturable: i64,
},
}
impl ForeignIDRef for PaymentAttempt {

View File

@ -109,6 +109,7 @@ pub struct PaymentIntentNew {
pub surcharge_applicable: Option<bool>,
pub request_incremental_authorization: storage_enums::RequestIncrementalAuthorization,
pub incremental_authorization_allowed: Option<bool>,
pub authorization_count: Option<i32>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -186,6 +187,12 @@ pub enum PaymentIntentUpdate {
surcharge_applicable: bool,
updated_by: String,
},
IncrementalAuthorizationAmountUpdate {
amount: i64,
},
AuthorizationCountUpdate {
authorization_count: i32,
},
}
#[derive(Clone, Debug, Default)]
@ -218,6 +225,7 @@ pub struct PaymentIntentUpdateInternal {
pub updated_by: String,
pub surcharge_applicable: Option<bool>,
pub incremental_authorization_allowed: Option<bool>,
pub authorization_count: Option<i32>,
}
impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
@ -381,6 +389,16 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
updated_by,
..Default::default()
},
PaymentIntentUpdate::IncrementalAuthorizationAmountUpdate { amount } => Self {
amount: Some(amount),
..Default::default()
},
PaymentIntentUpdate::AuthorizationCountUpdate {
authorization_count,
} => Self {
authorization_count: Some(authorization_count),
..Default::default()
},
}
}
}