Skip to content

Commit ed99655

Browse files
feat: PG Agnostic mandate using network_txns_id (Adyen, Authorizedotnet, Stripe) (#855)
Co-authored-by: Arun Raj M <[email protected]>
1 parent 9240e16 commit ed99655

File tree

72 files changed

+1128
-100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1128
-100
lines changed

crates/api_models/src/payments.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,20 @@ pub enum MandateTxnType {
302302
#[derive(Default, Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone)]
303303
pub struct MandateIds {
304304
pub mandate_id: String,
305-
pub connector_mandate_id: Option<String>,
305+
pub mandate_reference_id: Option<MandateReferenceId>,
306+
}
307+
308+
#[derive(Eq, PartialEq, Debug, serde::Deserialize, serde::Serialize, Clone)]
309+
pub enum MandateReferenceId {
310+
ConnectorMandateId(String), // mandate_id send by connector
311+
NetworkMandateId(String), // network_txns_id send by Issuer to connector, Used for PG agnostic mandate txns
306312
}
307313

308314
impl MandateIds {
309315
pub fn new(mandate_id: String) -> Self {
310316
Self {
311317
mandate_id,
312-
connector_mandate_id: None,
318+
mandate_reference_id: None,
313319
}
314320
}
315321
}

crates/router/src/configs/settings.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,33 @@ pub struct Settings {
6565
#[cfg(feature = "s3")]
6666
pub file_upload_config: FileUploadConfig,
6767
pub tokenization: TokenizationConfig,
68+
pub connector_customer: ConnectorCustomer,
6869
}
6970

7071
#[derive(Debug, Deserialize, Clone, Default)]
7172
#[serde(transparent)]
7273
pub struct TokenizationConfig(pub HashMap<String, PaymentMethodTokenFilter>);
7374

75+
#[derive(Debug, Deserialize, Clone, Default)]
76+
pub struct ConnectorCustomer {
77+
#[serde(deserialize_with = "connector_deser")]
78+
pub connector_list: HashSet<api_models::enums::Connector>,
79+
}
80+
81+
fn connector_deser<'a, D>(
82+
deserializer: D,
83+
) -> Result<HashSet<api_models::enums::Connector>, D::Error>
84+
where
85+
D: Deserializer<'a>,
86+
{
87+
let value = <String>::deserialize(deserializer)?;
88+
Ok(value
89+
.trim()
90+
.split(',')
91+
.flat_map(api_models::enums::Connector::from_str)
92+
.collect())
93+
}
94+
7495
#[derive(Debug, Deserialize, Clone, Default)]
7596
pub struct PaymentMethodTokenFilter {
7697
#[serde(deserialize_with = "pm_deser")]

crates/router/src/connector/aci/transformers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ impl<F, T>
337337
redirection_data,
338338
mandate_reference: None,
339339
connector_metadata: None,
340+
network_txn_id: None,
340341
}),
341342
..item.data
342343
})

0 commit comments

Comments
 (0)