mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
fix(mandates): give higher precedence to connector mandate id over network txn id in mandates (#4073)
Co-authored-by: Samraat Bansal <samraat.bansal@juspay.in>
This commit is contained in:
@ -508,8 +508,15 @@ impl
|
||||
.map_or(false, |future_usage| {
|
||||
matches!(future_usage, FutureUsage::OffSession)
|
||||
})
|
||||
&& item.router_data.request.customer_acceptance.is_some()
|
||||
{
|
||||
&& (item.router_data.request.customer_acceptance.is_some()
|
||||
|| item
|
||||
.router_data
|
||||
.request
|
||||
.setup_mandate_details
|
||||
.clone()
|
||||
.map_or(false, |mandate_details| {
|
||||
mandate_details.customer_acceptance.is_some()
|
||||
})) {
|
||||
(
|
||||
Some(vec![CybersourceActionsList::TokenCreate]),
|
||||
Some(vec![CybersourceActionsTokenType::PaymentInstrument]),
|
||||
|
||||
@ -301,14 +301,6 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
|
||||
mandate_obj.network_transaction_id,
|
||||
mandate_obj.connector_mandate_ids,
|
||||
) {
|
||||
(Some(network_tx_id), _) => Ok(api_models::payments::MandateIds {
|
||||
mandate_id: Some(mandate_obj.mandate_id),
|
||||
mandate_reference_id: Some(
|
||||
api_models::payments::MandateReferenceId::NetworkMandateId(
|
||||
network_tx_id,
|
||||
),
|
||||
),
|
||||
}),
|
||||
(_, Some(connector_mandate_id)) => connector_mandate_id
|
||||
.parse_value("ConnectorMandateId")
|
||||
.change_context(errors::ApiErrorResponse::MandateNotFound)
|
||||
@ -324,6 +316,14 @@ impl<F: Send + Clone, Ctx: PaymentMethodRetrieve>
|
||||
))
|
||||
}
|
||||
}),
|
||||
(Some(network_tx_id), _) => Ok(api_models::payments::MandateIds {
|
||||
mandate_id: Some(mandate_obj.mandate_id),
|
||||
mandate_reference_id: Some(
|
||||
api_models::payments::MandateReferenceId::NetworkMandateId(
|
||||
network_tx_id,
|
||||
),
|
||||
),
|
||||
}),
|
||||
(_, _) => Ok(api_models::payments::MandateIds {
|
||||
mandate_id: Some(mandate_obj.mandate_id),
|
||||
mandate_reference_id: None,
|
||||
|
||||
Reference in New Issue
Block a user