feat(payment_request): add field amount to OrderDetails and make order_details a Vec in payments_create request (#964)

This commit is contained in:
rishavkar
2023-05-15 14:45:32 +05:30
committed by GitHub
parent d7cfb4a179
commit 60e8c7317a
15 changed files with 111 additions and 56 deletions

View File

@ -36,6 +36,7 @@ pub struct PaymentIntent {
pub active_attempt_id: String,
pub business_country: storage_enums::CountryAlpha2,
pub business_label: String,
pub meta_data: Option<pii::SecretSerdeValue>,
}
#[derive(
@ -78,6 +79,7 @@ pub struct PaymentIntentNew {
pub active_attempt_id: String,
pub business_country: storage_enums::CountryAlpha2,
pub business_label: String,
pub meta_data: Option<pii::SecretSerdeValue>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -89,6 +91,7 @@ pub enum PaymentIntentUpdate {
},
MetadataUpdate {
metadata: pii::SecretSerdeValue,
meta_data: pii::SecretSerdeValue,
},
ReturnUrlUpdate {
return_url: Option<String>,
@ -142,6 +145,7 @@ pub struct PaymentIntentUpdateInternal {
pub active_attempt_id: Option<String>,
pub business_country: Option<storage_enums::CountryAlpha2>,
pub business_label: Option<String>,
pub meta_data: Option<pii::SecretSerdeValue>,
}
impl PaymentIntentUpdate {
@ -169,6 +173,7 @@ impl PaymentIntentUpdate {
.shipping_address_id
.or(source.shipping_address_id),
modified_at: common_utils::date_time::now(),
meta_data: internal_update.meta_data.or(source.meta_data),
..source
}
}
@ -203,8 +208,12 @@ impl From<PaymentIntentUpdate> for PaymentIntentUpdateInternal {
business_label,
..Default::default()
},
PaymentIntentUpdate::MetadataUpdate { metadata } => Self {
PaymentIntentUpdate::MetadataUpdate {
metadata,
meta_data,
} => Self {
metadata: Some(metadata),
meta_data: Some(meta_data),
modified_at: Some(common_utils::date_time::now()),
..Default::default()
},

View File

@ -353,6 +353,7 @@ diesel::table! {
active_attempt_id -> Varchar,
business_country -> CountryAlpha2,
business_label -> Varchar,
meta_data -> Nullable<Jsonb>,
}
}