Repository: juspay/hyperswitch
File: crates/router/src/core/payments/operations/payment_confirm_intent.rs (Rust)

Code before:
                let payment_method = payment_data
                    .payment_attempt
                    .get_payment_method()
                    .ok_or_else(|| errors::ApiErrorResponse::InternalServerError)
                    .attach_printable("Payment method not found")?;
                let payment_method_type = payment_data.payment_attempt.get_payment_method_type();

                let mandate_flow_enabled = payment_data.payment_intent.setup_future_usage;

                let is_connector_tokenization_enabled =
                    payments::is_payment_method_tokenization_enabled_for_connector(
                        state,
                        &connector,
                        payment_method,
                        payment_method_type,
                        mandate_flow_enabled,
                    )?;

                payments::decide_payment_method_tokenize_action(
                    state,
                    payment_data.payment_intent.clone(),
                    is_connector_tokenization_enabled,
                )
                .await?
            }
            _ => payments::TokenizationAction::SkipConnectorTokenization,
        };

        Ok(tokenization_action)
    }
}

#[async_trait]
impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmIntentRequest>
    for PaymentIntentConfirm
{
    #[instrument(skip_all)]
    async fn update_trackers<'b>(
        &'b self,
        state: &'b SessionState,
        req_state: ReqState,
        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,
    ) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>
    where
        F: 'b + Send,

Review comment (suggestion):
```suggestion
            None => payments::TokenizationAction::SkipConnectorTokenization,
```

Code after:
            }
            Some(connector) => {
                let payment_method = payment_data
                    .payment_attempt
                    .get_payment_method()
                    .ok_or_else(|| errors::ApiErrorResponse::InternalServerError)
                    .attach_printable("Payment method not found")?;
                let payment_method_type: Option<common_enums::PaymentMethodType> =
                    payment_data.payment_attempt.get_payment_method_type();

                let mandate_flow_enabled = payment_data.payment_intent.setup_future_usage;

                let is_connector_tokenization_enabled =
                    payments::is_payment_method_tokenization_enabled_for_connector(
                        state,
                        &connector,
                        payment_method,
                        payment_method_type,
                        mandate_flow_enabled,
                    )?;

                if is_connector_tokenization_enabled {
                    payments::TokenizationAction::TokenizeInConnector
                } else {
                    payments::TokenizationAction::SkipConnectorTokenization
                }
            }
            None => payments::TokenizationAction::SkipConnectorTokenization,
        };

        Ok(tokenization_action)
    }
}

#[async_trait]
impl<F: Clone + Sync> UpdateTracker<F, PaymentConfirmData<F>, PaymentsConfirmIntentRequest>
    for PaymentIntentConfirm
{
    #[instrument(skip_all)]
    async fn update_trackers<'b>(
        &'b self,
        state: &'b SessionState,
        req_state: ReqState,
        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,
    ) -> RouterResult<(BoxedConfirmOperation<'b, F>, PaymentConfirmData<F>)>