refactor(mandate): allow merchant to pass the mandate details and customer acceptance separately (#1188)

This commit is contained in:
Nishant Joshi
2023-05-19 12:19:19 +05:30
committed by GitHub
parent f394c4abc0
commit 6c41cdb1c9
20 changed files with 220 additions and 47 deletions

View File

@ -300,7 +300,8 @@ impl From<PaymentsRequest> for VerifyRequest {
}
}
#[derive(Clone)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum MandateTxnType {
NewMandateTxn,
RecurringMandateTxn,
@ -333,13 +334,15 @@ impl MandateIds {
}
}
// The fields on this struct are optional, as we want to allow the merchant to provide partial
// information about creating mandates
#[derive(Default, Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct MandateData {
/// A concent from the customer to store the payment method
pub customer_acceptance: CustomerAcceptance,
pub customer_acceptance: Option<CustomerAcceptance>,
/// A way to select the type of mandate used
pub mandate_type: MandateType,
pub mandate_type: Option<MandateType>,
}
#[derive(Clone, Eq, PartialEq, Copy, Debug, Default, serde::Serialize, serde::Deserialize)]