feat(router): modify attempt_id generation logic to accommodate payment_id as prefix (#1596)

This commit is contained in:
Sai Harsha Vardhan
2023-07-04 19:12:52 +05:30
committed by GitHub
parent 6447b04574
commit 82e1bf0d16
9 changed files with 38 additions and 6 deletions

View File

@ -39,6 +39,7 @@ pub struct PaymentIntent {
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub udf: Option<pii::SecretSerdeValue>,
pub attempt_count: i16,
}
#[derive(
@ -84,6 +85,7 @@ pub struct PaymentIntentNew {
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub udf: Option<pii::SecretSerdeValue>,
pub attempt_count: i16,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -135,6 +137,7 @@ pub enum PaymentIntentUpdate {
StatusAndAttemptUpdate {
status: storage_enums::IntentStatus,
active_attempt_id: String,
attempt_count: i16,
},
}
@ -164,6 +167,7 @@ pub struct PaymentIntentUpdateInternal {
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
pub order_details: Option<Vec<pii::SecretSerdeValue>>,
pub udf: Option<pii::SecretSerdeValue>,
pub attempt_count: Option<i16>,
}
impl PaymentIntentUpdate {
@ -302,9 +306,11 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
PaymentIntentUpdate::StatusAndAttemptUpdate {
status,
active_attempt_id,
attempt_count,
} => Self {
status: Some(status),
active_attempt_id: Some(active_attempt_id),
attempt_count: Some(attempt_count),
..Default::default()
},
}

View File

@ -478,6 +478,7 @@ diesel::table! {
business_label -> Varchar,
order_details -> Nullable<Array<Nullable<Jsonb>>>,
udf -> Nullable<Jsonb>,
attempt_count -> Int2,
}
}