feat(router): make core changes in payments flow to support incremental authorization (#3009)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Sai Harsha Vardhan
2023-11-30 16:56:34 +05:30
committed by GitHub
parent 1e60c71098
commit 1ca2ba4594
88 changed files with 363 additions and 11 deletions

View File

@ -50,4 +50,6 @@ pub struct PaymentIntent {
pub updated_by: String,
pub surcharge_applicable: Option<bool>,
pub request_incremental_authorization: storage_enums::RequestIncrementalAuthorization,
pub incremental_authorization_allowed: Option<bool>,
}

View File

@ -107,6 +107,8 @@ pub struct PaymentIntentNew {
pub updated_by: String,
pub surcharge_applicable: Option<bool>,
pub request_incremental_authorization: storage_enums::RequestIncrementalAuthorization,
pub incremental_authorization_allowed: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -116,6 +118,7 @@ pub enum PaymentIntentUpdate {
amount_captured: Option<i64>,
return_url: Option<String>,
updated_by: String,
incremental_authorization_allowed: Option<bool>,
},
MetadataUpdate {
metadata: pii::SecretSerdeValue,
@ -137,6 +140,7 @@ pub enum PaymentIntentUpdate {
},
PGStatusUpdate {
status: storage_enums::IntentStatus,
incremental_authorization_allowed: Option<bool>,
updated_by: String,
},
Update {
@ -213,6 +217,7 @@ pub struct PaymentIntentUpdateInternal {
pub updated_by: String,
pub surcharge_applicable: Option<bool>,
pub incremental_authorization_allowed: Option<bool>,
}
impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
@ -283,10 +288,15 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
updated_by,
..Default::default()
},
PaymentIntentUpdate::PGStatusUpdate { status, updated_by } => Self {
PaymentIntentUpdate::PGStatusUpdate {
status,
updated_by,
incremental_authorization_allowed,
} => Self {
status: Some(status),
modified_at: Some(common_utils::date_time::now()),
updated_by,
incremental_authorization_allowed,
..Default::default()
},
PaymentIntentUpdate::MerchantStatusUpdate {
@ -310,6 +320,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
// customer_id,
return_url,
updated_by,
incremental_authorization_allowed,
} => Self {
// amount,
// currency: Some(currency),
@ -319,6 +330,7 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
return_url,
modified_at: Some(common_utils::date_time::now()),
updated_by,
incremental_authorization_allowed,
..Default::default()
},
PaymentIntentUpdate::PaymentAttemptAndAttemptCountUpdate {