feat(connector): Mandates for alternate payment methods via Stripe (#1041)

Co-authored-by: Manoj Ghorela <manoj.ghorela@juspay.in>
Co-authored-by: Arjun Karthik <m.arjunkarthik@gmail.com>
This commit is contained in:
Jagan
2023-05-08 19:08:15 +05:30
committed by GitHub
parent fa8683a54b
commit 64721b80ae
32 changed files with 1068 additions and 601 deletions

View File

@ -210,8 +210,8 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
.as_ref()
.and_then(|mandate_ids| match &mandate_ids.mandate_reference_id {
Some(api_models::payments::MandateReferenceId::ConnectorMandateId(
connector_mandate_id,
)) => Some(connector_mandate_id.to_string()),
connector_mandate_ids,
)) => connector_mandate_ids.connector_mandate_id.clone(),
_ => None,
})
}
@ -562,6 +562,18 @@ impl MandateData for payments::MandateAmountData {
}
}
pub trait MandateReferenceData {
fn get_connector_mandate_id(&self) -> Result<String, Error>;
}
impl MandateReferenceData for api_models::payments::ConnectorMandateReferenceId {
fn get_connector_mandate_id(&self) -> Result<String, Error> {
self.connector_mandate_id
.clone()
.ok_or_else(missing_field_err("mandate_id"))
}
}
pub fn get_header_key_value<'a>(
key: &str,
headers: &'a actix_web::http::header::HeaderMap,