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); 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 // 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()) .build_flow_specific_connector_request(state, &connector, call_connector_action.clone())
.await?; .await?
} else {
None
};
// Update the payment trackers just before calling the connector // Update the payment trackers just before calling the connector
// Since the request is already built in the previous step, // Since the request is already built in the previous step,
// there should be no error in request construction from hyperswitch end // there should be no error in request construction from hyperswitch end
operation (_, *payment_data) = operation
.to_update_tracker()? .to_update_tracker()?
.update_trackers( .update_trackers(
&*state.store, &*state.store,
payment_data.clone(), payment_data.clone(),
customer.clone(), customer.clone(),
merchant_account.storage_scheme, merchant_account.storage_scheme,
updated_customer, updated_customer,
) )
.await?; .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 router_data
.decide_flows( .decide_flows(
state, state,
@ -578,7 +586,7 @@ where
customer, customer,
call_connector_action, call_connector_action,
merchant_account, merchant_account,
request, connector_request,
) )
.await .await
} else { } else {