mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 13:30:39 +08:00
feat(mandates): recurring payment support for bank redirect and bank debit payment method for stripe (#1119)
Co-authored-by: pixincreate@work <69745008+pixincreate@users.noreply.github.com>
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
use api_models::payments;
|
||||
use common_utils::{ext_traits::Encode, pii};
|
||||
use diesel_models::enums as storage_enums;
|
||||
use error_stack::{report, ResultExt};
|
||||
@ -123,6 +124,18 @@ pub async fn get_customer_mandates(
|
||||
}
|
||||
}
|
||||
|
||||
fn get_insensitive_payment_method_data_if_exists<F, FData>(
|
||||
router_data: &types::RouterData<F, FData, types::PaymentsResponseData>,
|
||||
) -> Option<payments::PaymentMethodData>
|
||||
where
|
||||
FData: MandateBehaviour,
|
||||
{
|
||||
match &router_data.request.get_payment_method_data() {
|
||||
api_models::payments::PaymentMethodData::Card(_) => None,
|
||||
_ => Some(router_data.request.get_payment_method_data()),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn mandate_procedure<F, FData>(
|
||||
state: &AppState,
|
||||
mut resp: types::RouterData<F, FData, types::PaymentsResponseData>,
|
||||
@ -209,6 +222,7 @@ where
|
||||
pm_id.get_required_value("payment_method_id")?,
|
||||
mandate_ids,
|
||||
network_txn_id,
|
||||
get_insensitive_payment_method_data_if_exists(&resp),
|
||||
)? {
|
||||
let connector = new_mandate_data.connector.clone();
|
||||
logger::debug!("{:?}", new_mandate_data);
|
||||
|
||||
Reference in New Issue
Block a user