Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(platform): support update tracker for platform in payments (#10691)

Apoorv Dixit0ae859227e0a
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 3184e6229a..b1a8a21e99 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -1160,11 +1160,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
customer.clone(),
- validate_result.storage_scheme,
- None,
- platform.get_processor().get_key_store(),
#[cfg(feature = "frm")]
frm_info.and_then(|info| info.suggested_action),
#[cfg(not(feature = "frm"))]
@@ -1196,11 +1194,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
customer.clone(),
- validate_result.storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None,
header_payload.clone(),
)
@@ -1745,11 +1741,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data,
customer.clone(),
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None,
header_payload,
)
@@ -1823,11 +1817,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data,
customer.clone(),
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None,
header_payload,
)
@@ -2533,11 +2525,9 @@ pub async fn record_attempt_core(
.update_trackers(
&state,
req_state,
+ platform.get_processor(),
record_payment_data,
None,
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None,
header_payload.clone(),
)
@@ -4277,23 +4267,27 @@ where
.ok();
}
- // Update the payment trackers just before calling the connector
+ // Update customer information at provider level and payment trackers in parallel
// Since the request is already built in the previous step,
// there should be no error in request construction from hyperswitch end
- (_, *payment_data) = operation
- .to_update_tracker()?
- .update_trackers(
+ let ((), (_, new_payment_data)) = tokio::try_join!(
+ operation.to_domain()?.update_customer(
+ state,
+ platform.get_provider(),
+ customer.clone(),
+ updated_customer.clone(),
+ ),
+ operation.to_update_tracker()?.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
customer.clone(),
- platform.get_processor().get_account().storage_scheme,
- updated_customer,
- platform.get_processor().get_key_store(),
frm_suggestion,
header_payload.clone(),
)
- .await?;
+ )?;
+ *payment_data = new_payment_data;
let router_data = if should_continue_further {
// The status of payment_attempt and intent will be updated in the previous step
@@ -4686,23 +4680,27 @@ where
None => (None, false),
};
- // Update the payment trackers just before calling the connector
+ // Update customer information at provider level and payment trackers in parallel
// Since the request is already built in the previous step,
// there should be no error in request construction from hyperswitch end
- (_, *payment_data) = operation
- .to_update_tracker()?
- .update_trackers(
+ let ((), (_, new_payment_data)) = tokio::try_join!(
+ operation.to_domain()?.update_customer(
+ state,
+ platform.get_provider(),
+ customer.clone(),
+ updated_customer.clone(),
+ ),
+ operation.to_update_tracker()?.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
customer.clone(),
- platform.get_processor().get_account().storage_scheme,
- updated_customer,
- platform.get_processor().get_key_store(),
frm_suggestion,
header_payload.clone(),
)
- .await?;
+ )?;
+ *payment_data = new_payment_data;
let router_data = if should_continue_further {
// The status of payment_attempt and intent will be updated in the previous step
@@ -5082,11 +5080,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
None, // customer is not used in internal flows
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None, // frm_suggestion is not used in internal flows
header_payload.clone(),
)
@@ -5272,11 +5268,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
customer.clone(),
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
frm_suggestion,
header_payload.clone(),
)
@@ -5452,7 +5446,6 @@ where
.ok();
}
- let updated_customer = None;
let frm_suggestion = None;
(_, *payment_data) = operation
@@ -5460,11 +5453,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
customer.clone(),
- platform.get_processor().get_account().storage_scheme,
- updated_customer,
- platform.get_processor().get_key_store(),
frm_suggestion,
header_payload.clone(),
)
@@ -5595,11 +5586,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
None,
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None,
header_payload.clone(),
)
@@ -5715,11 +5704,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
None,
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None,
header_payload.clone(),
)
diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rs
index cc28682e6f..984e2ff914 100644
--- a/crates/router/src/core/payments/operations.rs
+++ b/crates/router/src/core/payments/operations.rs
@@ -279,6 +279,18 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {
storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<(BoxedOperation<'a, F, R, D>, Option<domain::Customer>), errors::StorageError>;
+ /// Update customer information at provider level
+ /// This handles connector_customer_id updates in the Customer table
+ async fn update_customer<'a>(
+ &'a self,
+ _db: &'a SessionState,
+ _provider: &domain::Provider,
+ _customer: Option<domain::Customer>,
+ _updated_customer: Option<storage::CustomerUpdate>,
+ ) -> RouterResult<()> {
+ Ok(())
+ }
+
#[cfg(feature = "v2")]
/// This will run the decision manager for the payment
async fn run_decision_manager<'a>(
@@ -490,11 +502,9 @@ pub trait UpdateTracker<F, D, Req>: Send {
&'b self,
db: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
payment_data: D,
customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- updated_customer: Option<storage::CustomerUpdate>,
- merchant_key_store: &domain::MerchantKeyStore,
frm_suggestion: Option<FrmSuggestion>,
header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(BoxedOperation<'b, F, Req, D>, D)>
diff --git a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
index 52d46577d1..a4a595f7aa 100644
--- a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
+++ b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs
@@ -479,11 +479,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ExternalVaultProxy
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentConfirmData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<api_models::enums::FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
@@ -491,6 +489,8 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ExternalVaultProxy
F: 'b + Send,
{
let db = &*state.store;
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let intent_status = common_enums::IntentStatus::Processing;
let attempt_status = common_enums::AttemptStatus::Pending;
diff --git a/crates/router/src/core/payments/operations/payment_approve.rs b/crates/router/src/core/payments/operations/payment_approve.rs
index 9970a12325..cc9f9036b2 100644
--- a/crates/router/src/core/payments/operations/payment_approve.rs
+++ b/crates/router/src/core/payments/operations/payment_approve.rs
@@ -17,9 +17,7 @@ use crate::{
services,
types::{
api::{self, PaymentIdTypeExt},
- domain,
- storage::{self, enums as storage_enums},
- PaymentAddress,
+ domain, storage, PaymentAddress,
},
utils::OptionExt,
};
@@ -227,17 +225,18 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCaptureReque
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentApproveOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
+
if matches!(frm_suggestion, Some(FrmSuggestion::FrmAuthorizeTransaction)) {
payment_data.payment_intent.status = IntentStatus::RequiresCapture; // In Approve flow, payment which has payment_capture_method "manual" and attempt status as "Unresolved",
payment_data.payment_attempt.status = AttemptStatus::Authorized; // We shouldn't call the connector instead we need to update the payment attempt and payment intent.
diff --git a/crates/router/src/core/payments/operations/payment_attempt_list.rs b/crates/router/src/core/payments/operations/payment_attempt_list.rs
index 4d5ff73ecb..262ad86303 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_list.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_list.rs
@@ -123,11 +123,9 @@ impl<F: Clone + Sync>
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: payments::PaymentAttemptListData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
diff --git a/crates/router/src/core/payments/operations/payment_attempt_record.rs b/crates/router/src/core/payments/operations/payment_attempt_record.rs
index 51565c62ff..902f91468b 100644
--- a/crates/router/src/core/payments/operations/payment_attempt_record.rs
+++ b/crates/router/src/core/payments/operations/payment_attempt_record.rs
@@ -244,11 +244,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentAttemptRecordData<F>, PaymentsAtte
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentAttemptRecordData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -258,6 +256,8 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentAttemptRecordData<F>, PaymentsAtte
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let feature_metadata = payment_data.get_updated_feature_metadata()?;
let active_attempt_id = match payment_data.revenue_recovery_data.triggered_by {
common_enums::TriggeredBy::Internal => Some(payment_data.payment_attempt.id.clone()),
diff --git a/crates/router/src/core/payments/operations/payment_cancel.rs b/crates/router/src/core/payments/operations/payment_cancel.rs
index aba829f58a..3bbced935c 100644
--- a/crates/router/src/core/payments/operations/payment_cancel.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel.rs
@@ -237,17 +237,18 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelReques
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentCancelOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
+
let cancellation_reason = payment_data.payment_attempt.cancellation_reason.clone();
let (intent_status_update, attempt_status_update) =
if payment_data.payment_intent.status != enums::IntentStatus::RequiresCapture {
diff --git a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
index fd428c9046..40f6a0f0cb 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs
@@ -281,11 +281,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsCancelPostCa
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentCancelPostCaptureOperation<'b, F>, PaymentData<F>)>
diff --git a/crates/router/src/core/payments/operations/payment_cancel_v2.rs b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
index b95de2c0ee..a619c3bfa7 100644
--- a/crates/router/src/core/payments/operations/payment_cancel_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_cancel_v2.rs
@@ -200,11 +200,9 @@ impl<F: Clone + Send + Sync>
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: hyperswitch_domain_models::payments::PaymentCancelData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- merchant_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -215,6 +213,8 @@ impl<F: Clone + Send + Sync>
F: 'b + Send,
{
let db = &*state.store;
+ let storage_scheme = processor.get_account().storage_scheme;
+ let merchant_key_store = processor.get_key_store();
let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::VoidUpdate {
status: enums::AttemptStatus::VoidInitiated,
diff --git a/crates/router/src/core/payments/operations/payment_capture.rs b/crates/router/src/core/payments/operations/payment_capture.rs
index 8ea5a30567..ec1df9ee70 100644
--- a/crates/router/src/core/payments/operations/payment_capture.rs
+++ b/crates/router/src/core/payments/operations/payment_capture.rs
@@ -293,17 +293,18 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentData<F>, api::PaymentsCa
&'b self,
db: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: payments::PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- merchant_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentCaptureOperation<'b, F>, payments::PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let merchant_key_store = processor.get_key_store();
+
payment_data.payment_attempt = if payment_data.multiple_capture_data.is_some()
|| payment_data.payment_attempt.amount_to_capture.is_some()
{
diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rs
index 276dabd2a7..f80359421a 100644
--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs
+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs
@@ -295,17 +295,17 @@ impl<F: Clone> UpdateTracker<F, PaymentCaptureData<F>, PaymentsCaptureRequest> f
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentCaptureData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentCaptureData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let payment_attempt_update = hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptUpdate::PreCaptureUpdate { amount_to_capture: payment_data.payment_attempt.amount_details.get_amount_to_capture(), updated_by: storage_scheme.to_string() };
let payment_attempt = state
diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
index b0f9a73814..9edb216dda 100644
--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs
+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs
@@ -482,17 +482,18 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(CompleteAuthorizeOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
+
let payment_intent_update = hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdate::CompleteAuthorizeUpdate {
shipping_address_id: payment_data.payment_intent.shipping_address_id.clone()
};
diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs
index 2608e53dde..cd2204fe20 100644
--- a/crates/router/src/core/payments/operations/payment_confirm.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm.rs
@@ -904,6 +904,33 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for
.await
}
+ #[cfg(feature = "v1")]
+ #[instrument(skip_all)]
+ async fn update_customer<'a>(
+ &'a self,
+ state: &'a SessionState,
+ provider: &domain::Provider,
+ customer: Option<domain::Customer>,
+ updated_customer: Option<storage::CustomerUpdate>,
+ ) -> RouterResult<()> {
+ if let Some((updated_customer, customer)) = updated_customer.zip(customer) {
+ state
+ .store
+ .update_customer_by_customer_id_merchant_id(
+ customer.customer_id.to_owned(),
+ customer.merchant_id.to_owned(),
+ customer,
+ updated_customer,
+ provider.get_key_store(),
+ provider.get_account().storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to update CustomerConnector in customer")?;
+ }
+ Ok(())
+ }
+
#[instrument(skip_all)]
async fn make_pm_data<'a>(
&'a self,
@@ -1775,11 +1802,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
mut _payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -1801,11 +1826,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
frm_suggestion: Option<FrmSuggestion>,
header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -1815,6 +1838,8 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let payment_method = payment_data.payment_attempt.payment_method;
let browser_info = payment_data.payment_attempt.browser_info.clone();
let frm_message = payment_data.frm_message.clone();
@@ -2199,43 +2224,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
.in_current_span(),
);
- let customer_fut =
- if let Some((updated_customer, customer)) = updated_customer.zip(customer) {
- let m_customer_merchant_id = customer.merchant_id.to_owned();
- let m_key_store = key_store.clone();
- let m_updated_customer = updated_customer.clone();
- let session_state = state.clone();
- let m_db = session_state.store.clone();
- tokio::spawn(
- async move {
- let m_customer_customer_id = customer.customer_id.to_owned();
- m_db.update_customer_by_customer_id_merchant_id(
- m_customer_customer_id,
- m_customer_merchant_id,
- customer,
- m_updated_customer,
- &m_key_store,
- storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to update CustomerConnector in customer")?;
-
- Ok::<_, error_stack::Report<errors::ApiErrorResponse>>(())
- }
- .in_current_span(),
- )
- } else {
- tokio::spawn(
- async move { Ok::<_, error_stack::Report<errors::ApiErrorResponse>>(()) }
- .in_current_span(),
- )
- };
-
- let (payment_intent, payment_attempt, _) = tokio::try_join!(
+ let (payment_intent, payment_attempt) = tokio::try_join!(
utils::flatten_join_error(payment_intent_fut),
utils::flatten_join_error(payment_attempt_fut),
- utils::flatten_join_error(customer_fut)
)?;
payment_data.payment_intent = payment_intent;
diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
index f2393a7bb4..1add78c000 100644
--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs
@@ -441,6 +441,33 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsConfirmIntentRequest, PaymentConf
}
}
+ #[instrument(skip_all)]
+ async fn update_customer<'a>(
+ &'a self,
+ state: &'a SessionState,
+ provider: &domain::Provider,
+ customer: Option<domain::Customer>,
+ updated_customer: Option<storage::CustomerUpdate>,
+ ) -> RouterResult<()> {
+ if let Some((customer, updated_customer)) = customer.zip(updated_customer) {
+ let customer_id = customer.get_id().clone();
+
+ let _updated_customer = state
+ .store
+ .update_customer_by_global_id(
+ &customer_id,
+ customer,
+ updated_customer,
+ provider.get_key_store(),
+ provider.get_account().storage_scheme,
+ )
+ .await
+ .change_context(errors::ApiErrorResponse::InternalServerError)
+ .attach_printable("Failed to update customer during `update_customer`")?;
+ }
+ Ok(())
+ }
+
async fn run_decision_manager<'a>(
&'a self,
state: &SessionState,
@@ -723,19 +750,19 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
async fn update_trackers<'b>(
&'b self,
state: &'b SessionState,
- req_state: ReqState,
+ _req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentConfirmData<F>,
- customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
- frm_suggestion: Option<FrmSuggestion>,
- header_payload: hyperswitch_domain_models::payments::HeaderPayload,
+ _customer: Option<domain::Customer>,
+ _frm_suggestion: Option<FrmSuggestion>,
+ _header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
where
F: 'b + Send,
{
let db = &*state.store;
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let intent_status = common_enums::IntentStatus::Processing;
let attempt_status = common_enums::AttemptStatus::Pending;
@@ -837,23 +864,6 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmInt
payment_data.payment_attempt = updated_payment_attempt;
- if let Some((customer, updated_customer)) = customer.zip(updated_customer) {
- let customer_id = customer.get_id().clone();
- let customer_merchant_id = customer.merchant_id.clone();
-
- let _updated_customer = db
- .update_customer_by_global_id(
- &customer_id,
- customer,
- updated_customer,
- key_store,
- storage_scheme,
- )
- .await
- .change_context(errors::ApiErrorResponse::InternalServerError)
- .attach_printable("Failed to update customer during `update_trackers`")?;
- }
-
Ok((Box::new(self), payment_data))
}
}
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 8c31e19811..9d2795ddc3 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -814,17 +814,17 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentCreateOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let status = match payment_data.payment_intent.status {
IntentStatus::RequiresPaymentMethod => match payment_data.payment_method_data {
Some(_) => Some(IntentStatus::RequiresConfirmation),
diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rs
index 182a4819a4..ea00cf3c2d 100644
--- a/crates/router/src/core/payments/operations/payment_create_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs
@@ -197,11 +197,9 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsC
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: payments::PaymentIntentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rs
index f57c8d8e94..fd996a24d4 100644
--- a/crates/router/src/core/payments/operations/payment_get.rs
+++ b/crates/router/src/core/payments/operations/payment_get.rs
@@ -369,11 +369,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentStatusData<F>, PaymentsRetrieveReq
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentStatusData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentStatusData<F>)>
diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rs
index fba938a58f..ba0c75b47b 100644
--- a/crates/router/src/core/payments/operations/payment_get_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs
@@ -125,11 +125,9 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsG
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: payments::PaymentIntentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
index 703181b0a9..fc03d34b70 100644
--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs
@@ -258,11 +258,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsPostSessionT
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentPostSessionTokensOperation<'b, F>, PaymentData<F>)>
diff --git a/crates/router/src/core/payments/operations/payment_reject.rs b/crates/router/src/core/payments/operations/payment_reject.rs
index 7c69a1efb8..60b0984a40 100644
--- a/crates/router/src/core/payments/operations/payment_reject.rs
+++ b/crates/router/src/core/payments/operations/payment_reject.rs
@@ -222,17 +222,18 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, PaymentsCancelRequest> fo
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_should_decline_transaction: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentRejectOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
+
let intent_status_update = storage::PaymentIntentUpdate::RejectUpdate {
status: enums::IntentStatus::Failed,
merchant_decision: Some(enums::MerchantDecision::Rejected.to_string()),
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 9baa93bf04..25ea316e21 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -248,17 +248,18 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsSessionReque
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentSessionOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
+
let metadata = payment_data.payment_intent.metadata.clone();
payment_data.payment_intent = match metadata {
Some(metadata) => state
diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rs
index a4d0bbc29c..c83ca71f74 100644
--- a/crates/router/src/core/payments/operations/payment_session_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs
@@ -166,11 +166,9 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsS
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: payments::PaymentIntentData<F>,
customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- updated_customer: Option<customer::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<common_enums::FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -180,6 +178,8 @@ impl<F: Clone + Sync> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsS
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let prerouting_algorithm = payment_data.payment_intent.prerouting_algorithm.clone();
payment_data.payment_intent = match prerouting_algorithm {
Some(prerouting_algorithm) => state
diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rs
index 9420969214..4029c5edce 100644
--- a/crates/router/src/core/payments/operations/payment_start.rs
+++ b/crates/router/src/core/payments/operations/payment_start.rs
@@ -233,11 +233,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsStartRequest
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _merchant_key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentSessionOperation<'b, F>, PaymentData<F>)>
diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs
index fd462b6e24..bdffb110fc 100644
--- a/crates/router/src/core/payments/operations/payment_status.rs
+++ b/crates/router/src/core/payments/operations/payment_status.rs
@@ -142,11 +142,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
&'b self,
_state: &'b SessionState,
req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -174,11 +172,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRetrieveRequ
&'b self,
_state: &'b SessionState,
req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs
index 1ec208eeaa..fca94cf250 100644
--- a/crates/router/src/core/payments/operations/payment_update.rs
+++ b/crates/router/src/core/payments/operations/payment_update.rs
@@ -722,12 +722,10 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
async fn update_trackers<'b>(
&'b self,
_state: &'b SessionState,
- req_state: ReqState,
+ _req_state: ReqState,
+ _processor: &domain::Processor,
mut _payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentUpdateOperation<'b, F>, PaymentData<F>)>
@@ -743,17 +741,17 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsRequest> for
&'b self,
state: &'b SessionState,
req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentUpdateOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let is_payment_method_unavailable =
payment_data.payment_attempt.payment_method_id.is_none()
&& payment_data.payment_intent.status
diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rs
index deb69033af..949b981991 100644
--- a/crates/router/src/core/payments/operations/payment_update_intent.rs
+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs
@@ -329,11 +329,9 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsUpdateIn
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: payments::PaymentIntentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -344,6 +342,8 @@ impl<F: Clone> UpdateTracker<F, payments::PaymentIntentData<F>, PaymentsUpdateIn
F: 'b + Send,
{
let db = &*state.store;
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let intent = payment_data.payment_intent.clone();
diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rs
index c3ffdc6a30..2d0ff1d727 100644
--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs
+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs
@@ -244,11 +244,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsUpdateMetada
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentUpdateMetadataOperation<'b, F>, PaymentData<F>)>
diff --git a/crates/router/src/core/payments/operations/payments_extend_authorization.rs b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
index ec00b79464..4815c09630 100644
--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs
@@ -286,11 +286,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsExtendAuthor
&'b self,
_state: &'b SessionState,
_req_state: ReqState,
+ _processor: &domain::Processor,
payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- _storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- _key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentExtendAuthorizationOperation<'b, F>, PaymentData<F>)>
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index adeac1e4a1..3f69907dfa 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -205,11 +205,9 @@ impl<F: Clone + Sync>
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: payments::PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(
@@ -219,6 +217,8 @@ impl<F: Clone + Sync>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let new_authorization_count = payment_data
.payment_intent
.authorization_count
diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
index 7566a038b4..2097ed128d 100644
--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs
+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs
@@ -364,11 +364,9 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ProxyPaymentsReque
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentConfirmData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<api_models::enums::FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
@@ -376,6 +374,8 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, ProxyPaymentsReque
F: 'b + Send,
{
let db = &*state.store;
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
let intent_status = common_enums::IntentStatus::Processing;
let attempt_status = common_enums::AttemptStatus::Pending;
diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rs
index e879e1838b..c774e68d77 100644
--- a/crates/router/src/core/payments/operations/tax_calculation.rs
+++ b/crates/router/src/core/payments/operations/tax_calculation.rs
@@ -377,17 +377,17 @@ impl<F: Clone + Sync> UpdateTracker<F, PaymentData<F>, api::PaymentsDynamicTaxCa
&'b self,
state: &'b SessionState,
_req_state: ReqState,
+ processor: &domain::Processor,
mut payment_data: PaymentData<F>,
_customer: Option<domain::Customer>,
- storage_scheme: storage_enums::MerchantStorageScheme,
- _updated_customer: Option<storage::CustomerUpdate>,
- key_store: &domain::MerchantKeyStore,
_frm_suggestion: Option<FrmSuggestion>,
_header_payload: hyperswitch_domain_models::payments::HeaderPayload,
) -> RouterResult<(PaymentSessionUpdateOperation<'b, F>, PaymentData<F>)>
where
F: 'b + Send,
{
+ let storage_scheme = processor.get_account().storage_scheme;
+ let key_store = processor.get_key_store();
// For Google Pay and Apple Pay, we don’t need to call the connector again; we can directly confirm the payment after tax_calculation. So, we update the required fields in the database during the update_tracker call.
if payment_data.should_update_in_update_tracker() {
let shipping_address = payment_data
diff --git a/crates/router/src/core/payments/session_operation.rs b/crates/router/src/core/payments/session_operation.rs
index 6ec01cb4bc..864029bc1b 100644
--- a/crates/router/src/core/payments/session_operation.rs
+++ b/crates/router/src/core/payments/session_operation.rs
@@ -187,11 +187,9 @@ where
.update_trackers(
state,
req_state,
+ platform.get_processor(),
payment_data.clone(),
customer.clone(),
- platform.get_processor().get_account().storage_scheme,
- None,
- platform.get_processor().get_key_store(),
None,
header_payload.clone(),
)