feat(connector): [DEUTSCHEBANK] Implement SEPA recurring payments (#5925)

This commit is contained in:
DEEPANSHU BANSAL
2024-09-20 16:46:57 +05:30
committed by GitHub
parent dccb8d4e62
commit 00e913c75c
34 changed files with 300 additions and 68 deletions

View File

@ -148,18 +148,21 @@ where
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Unable to serialize customer acceptance to value")?;
let connector_mandate_id = match responses {
let (connector_mandate_id, mandate_metadata) = match responses {
types::PaymentsResponseData::TransactionResponse {
ref mandate_reference,
..
} => {
if let Some(mandate_ref) = mandate_reference {
mandate_ref.connector_mandate_id.clone()
(
mandate_ref.connector_mandate_id.clone(),
mandate_ref.mandate_metadata.clone(),
)
} else {
None
(None, None)
}
}
_ => None,
_ => (None, None),
};
let check_for_mit_mandates = save_payment_method_data
.request
@ -178,6 +181,7 @@ where
currency,
merchant_connector_id.clone(),
connector_mandate_id.clone(),
mandate_metadata.clone(),
)
} else {
None
@ -373,6 +377,7 @@ where
currency,
merchant_connector_id.clone(),
connector_mandate_id.clone(),
mandate_metadata.clone(),
)?;
payment_methods::cards::update_payment_method_connector_mandate_details(state,
@ -479,6 +484,7 @@ where
currency,
merchant_connector_id.clone(),
connector_mandate_id.clone(),
mandate_metadata.clone(),
)?;
payment_methods::cards::update_payment_method_connector_mandate_details( state,
@ -1160,6 +1166,7 @@ pub fn add_connector_mandate_details_in_payment_method(
authorized_currency: Option<storage_enums::Currency>,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
connector_mandate_id: Option<String>,
mandate_metadata: Option<serde_json::Value>,
) -> Option<storage::PaymentsMandateReference> {
let mut mandate_details = HashMap::new();
@ -1173,6 +1180,7 @@ pub fn add_connector_mandate_details_in_payment_method(
payment_method_type,
original_payment_authorized_amount: authorized_amount,
original_payment_authorized_currency: authorized_currency,
mandate_metadata,
},
);
Some(storage::PaymentsMandateReference(mandate_details))
@ -1188,6 +1196,7 @@ pub fn update_connector_mandate_details_in_payment_method(
authorized_currency: Option<storage_enums::Currency>,
merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,
connector_mandate_id: Option<String>,
mandate_metadata: Option<serde_json::Value>,
) -> RouterResult<Option<serde_json::Value>> {
let mandate_reference = match payment_method.connector_mandate_details {
Some(_) => {
@ -1208,6 +1217,7 @@ pub fn update_connector_mandate_details_in_payment_method(
payment_method_type,
original_payment_authorized_amount: authorized_amount,
original_payment_authorized_currency: authorized_currency,
mandate_metadata: mandate_metadata.clone(),
};
mandate_details.map(|mut payment_mandate_reference| {
payment_mandate_reference
@ -1218,6 +1228,7 @@ pub fn update_connector_mandate_details_in_payment_method(
payment_method_type,
original_payment_authorized_amount: authorized_amount,
original_payment_authorized_currency: authorized_currency,
mandate_metadata: mandate_metadata.clone(),
});
payment_mandate_reference
})
@ -1231,6 +1242,7 @@ pub fn update_connector_mandate_details_in_payment_method(
authorized_currency,
merchant_connector_id,
connector_mandate_id,
mandate_metadata,
),
};
let connector_mandate_details = mandate_reference