Skip to content

Commit f9a4713

Browse files
ShankarSinghCGnanasundari24pixincreate
authored
refactor(router): store network_transaction_id for off_session payments irrespective of the is_connector_agnostic_mit_enabled config (#7083)
Co-authored-by: Gnanasundari24 <[email protected]> Co-authored-by: Pa1NarK <[email protected]>
1 parent c044fff commit f9a4713

File tree

3 files changed

+385
-25
lines changed

3 files changed

+385
-25
lines changed

crates/router/src/core/payments/operations/payment_response.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for
576576
merchant_account: &domain::MerchantAccount,
577577
key_store: &domain::MerchantKeyStore,
578578
payment_data: &mut PaymentData<F>,
579-
business_profile: &domain::Profile,
579+
_business_profile: &domain::Profile,
580580
) -> CustomResult<(), errors::ApiErrorResponse>
581581
where
582582
F: 'b + Clone + Send + Sync,
@@ -617,7 +617,6 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::PaymentsSyncData> for
617617
resp.status,
618618
resp.response.clone(),
619619
merchant_account.storage_scheme,
620-
business_profile.is_connector_agnostic_mit_enabled,
621620
)
622621
.await?;
623622
Ok(())
@@ -1201,7 +1200,7 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeData
12011200
merchant_account: &domain::MerchantAccount,
12021201
key_store: &domain::MerchantKeyStore,
12031202
payment_data: &mut PaymentData<F>,
1204-
business_profile: &domain::Profile,
1203+
_business_profile: &domain::Profile,
12051204
) -> CustomResult<(), errors::ApiErrorResponse>
12061205
where
12071206
F: 'b + Clone + Send + Sync,
@@ -1241,7 +1240,6 @@ impl<F: Clone> PostUpdateTracker<F, PaymentData<F>, types::CompleteAuthorizeData
12411240
resp.status,
12421241
resp.response.clone(),
12431242
merchant_account.storage_scheme,
1244-
business_profile.is_connector_agnostic_mit_enabled,
12451243
)
12461244
.await?;
12471245
Ok(())
@@ -2068,7 +2066,6 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
20682066
attempt_status: common_enums::AttemptStatus,
20692067
payment_response: Result<types::PaymentsResponseData, ErrorResponse>,
20702068
storage_scheme: enums::MerchantStorageScheme,
2071-
is_connector_agnostic_mit_enabled: Option<bool>,
20722069
) -> RouterResult<()> {
20732070
todo!()
20742071
}
@@ -2084,7 +2081,6 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
20842081
attempt_status: common_enums::AttemptStatus,
20852082
payment_response: Result<types::PaymentsResponseData, ErrorResponse>,
20862083
storage_scheme: enums::MerchantStorageScheme,
2087-
is_connector_agnostic_mit_enabled: Option<bool>,
20882084
) -> RouterResult<()> {
20892085
// If the payment_method is deleted then ignore the error related to retrieving payment method
20902086
// This should be handled when the payment method is soft deleted
@@ -2119,20 +2115,18 @@ async fn update_payment_method_status_and_ntid<F: Clone>(
21192115
})
21202116
.ok()
21212117
.flatten();
2122-
let network_transaction_id =
2123-
if let Some(network_transaction_id) = pm_resp_network_transaction_id {
2124-
if is_connector_agnostic_mit_enabled == Some(true)
2125-
&& payment_data.payment_intent.setup_future_usage
2126-
== Some(diesel_models::enums::FutureUsage::OffSession)
2127-
{
2128-
Some(network_transaction_id)
2129-
} else {
2130-
logger::info!("Skip storing network transaction id");
2131-
None
2132-
}
2118+
let network_transaction_id = if payment_data.payment_intent.setup_future_usage
2119+
== Some(diesel_models::enums::FutureUsage::OffSession)
2120+
{
2121+
if pm_resp_network_transaction_id.is_some() {
2122+
pm_resp_network_transaction_id
21332123
} else {
2124+
logger::info!("Skip storing network transaction id");
21342125
None
2135-
};
2126+
}
2127+
} else {
2128+
None
2129+
};
21362130

21372131
let pm_update = if payment_method.status != common_enums::PaymentMethodStatus::Active
21382132
&& payment_method.status != attempt_status.into()

crates/router/src/core/payments/tokenization.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,11 @@ where
111111
};
112112

113113
let network_transaction_id =
114-
if let Some(network_transaction_id) = network_transaction_id {
115-
if business_profile.is_connector_agnostic_mit_enabled == Some(true)
116-
&& save_payment_method_data.request.get_setup_future_usage()
117-
== Some(storage_enums::FutureUsage::OffSession)
118-
{
119-
Some(network_transaction_id)
114+
if save_payment_method_data.request.get_setup_future_usage()
115+
== Some(storage_enums::FutureUsage::OffSession)
116+
{
117+
if network_transaction_id.is_some() {
118+
network_transaction_id
120119
} else {
121120
logger::info!("Skip storing network transaction id");
122121
None

0 commit comments

Comments
 (0)