refactor(core): update trackers for preprocessing steps (#1481)

This commit is contained in:
Narayan Bhat
2023-06-20 11:45:48 +05:30
committed by GitHub
parent 3e64321bfd
commit 8fffc161ea

View File

@ -551,26 +551,34 @@ where
payment_data.sessions_token.push(session_token);
};
let router_data_res = if should_continue_further {
let connector_request = if should_continue_further {
// Check if the actual flow specific request can be built with available data
let request = router_data
router_data
.build_flow_specific_connector_request(state, &connector, call_connector_action.clone())
.await?;
.await?
} else {
None
};
// Update the payment trackers just before calling the connector
// Since the request is already built in the previous step,
// there should be no error in request construction from hyperswitch end
operation
.to_update_tracker()?
.update_trackers(
&*state.store,
payment_data.clone(),
customer.clone(),
merchant_account.storage_scheme,
updated_customer,
)
.await?;
// Update the payment trackers just before calling the connector
// 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(
&*state.store,
payment_data.clone(),
customer.clone(),
merchant_account.storage_scheme,
updated_customer,
)
.await?;
// The status of payment_attempt and intent will be updated in the previous step
// This field will be used by the connector
router_data.status = payment_data.payment_attempt.status;
let router_data_res = if should_continue_further {
router_data
.decide_flows(
state,
@ -578,7 +586,7 @@ where
customer,
call_connector_action,
merchant_account,
request,
connector_request,
)
.await
} else {