Repository: juspay/hyperswitch
File: crates/router/src/core/subscription.rs (Rust)

Code before:
                })
                .attach_printable(
                    "subscriptions: billing address missing in confirm_subscription_request",
                )
                .ok(),
            request
                .payment_details
                .payment_method_data
                .clone()
                .and_then(|data| data.payment_method_data),
        )
        .await?;

    let subscription_create_response = billing_handler
        .create_subscription_on_connector(
            &state,
            subs_handler.subscription.clone(),
            request.item_price_id.clone(),
            request
                .get_billing_address()
                .change_context(errors::ApiErrorResponse::MissingRequiredField {
                    field_name: "billing",
                })
                .attach_printable(
                    "subscriptions: billing address missing in confirm_subscription_request",
                )?,
        )
        .await?;

    let invoice_details = subscription_create_response.invoice_details;
    let (amount, currency) = InvoiceHandler::get_amount_and_currency(
        (request.amount, request.currency),
        invoice_details.clone(),
    );

    let payment_response = invoice_handler
        .create_and_confirm_payment(&state, &request, amount, currency)
        .await?;

    let invoice_entry = invoice_handler
        .create_invoice_entry(
            &state,
            profile.get_billing_processor_id()?,
            Some(payment_response.payment_id.clone()),
            amount,
            currency,
            invoice_details
                .clone()
                .and_then(|invoice| invoice.status)
                .unwrap_or(connector_enums::InvoiceStatus::InvoiceCreated),
            billing_handler.connector_data.connector_name,

Review comment (suggestion):
```suggestion
```
not needed create_subscription_on_connector will handle this error

Code after:
        )
        .await?;
    let _customer_updated_response = SubscriptionHandler::update_connector_customer_id_in_customer(
        &state,
        &merchant_context,
        &billing_handler.merchant_connector_id,
        &customer,
        customer_create_response,
    )
    .await
    .attach_printable("Failed to update customer with connector customer ID")?;

    let subscription_create_response = billing_handler
        .create_subscription_on_connector(
            &state,
            subs_handler.subscription.clone(),
            request.item_price_id.clone(),
            request.get_billing_address(),
        )
        .await?;

    let invoice_details = subscription_create_response.invoice_details;
    let (amount, currency) = InvoiceHandler::get_amount_and_currency(
        (request.amount, request.currency),
        invoice_details.clone(),
    );

    let payment_response = invoice_handler
        .create_and_confirm_payment(&state, &request, amount, currency)
        .await?;

    let invoice_entry = invoice_handler
        .create_invoice_entry(
            &state,
            profile.get_billing_processor_id()?,
            Some(payment_response.payment_id.clone()),
            amount,
            currency,
            invoice_details
                .clone()
                .and_then(|invoice| invoice.status)
                .unwrap_or(connector_enums::InvoiceStatus::InvoiceCreated),
            billing_handler.connector_data.connector_name,
            None,
            invoice_details.clone().map(|invoice| invoice.id),
        )
        .await?;

    invoice_handler
        .create_invoice_sync_job(
            &state,