mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 21:37:41 +08:00
feat(core): update card_details for an existing mandate (#3452)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -9,6 +9,13 @@ use error_stack::{IntoReport, ResultExt};
|
||||
use masking::{PeekInterface, Secret};
|
||||
use time::PrimitiveDateTime;
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct MandateDetails {
|
||||
pub update_mandate_id: Option<String>,
|
||||
pub mandate_type: Option<MandateDataType>,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum MandateDataType {
|
||||
@ -16,6 +23,13 @@ pub enum MandateDataType {
|
||||
MultiUse(Option<MandateAmountData>),
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[serde(untagged)]
|
||||
pub enum MandateTypeDetails {
|
||||
MandateType(MandateDataType),
|
||||
MandateDetails(MandateDetails),
|
||||
}
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
|
||||
pub struct MandateAmountData {
|
||||
pub amount: i64,
|
||||
@ -29,6 +43,8 @@ pub struct MandateAmountData {
|
||||
// information about creating mandates
|
||||
#[derive(Default, Eq, PartialEq, Debug, Clone)]
|
||||
pub struct MandateData {
|
||||
/// A way to update the mandate's payment method details
|
||||
pub update_mandate_id: Option<String>,
|
||||
/// A concent from the customer to store the payment method
|
||||
pub customer_acceptance: Option<CustomerAcceptance>,
|
||||
/// A way to select the type of mandate used
|
||||
@ -90,6 +106,7 @@ impl From<ApiMandateData> for MandateData {
|
||||
Self {
|
||||
customer_acceptance: value.customer_acceptance.map(|d| d.into()),
|
||||
mandate_type: value.mandate_type.map(|d| d.into()),
|
||||
update_mandate_id: value.update_mandate_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user