Repository: juspay/hyperswitch
File: crates/diesel_models/src/invoice.rs (Rust)

Code before:
}

#[derive(Clone, Debug, Eq, PartialEq, AsChangeset, Deserialize)]
#[diesel(table_name = invoices)]
pub struct InvoiceUpdate {
    pub status: Option<String>,
    pub payment_method_id: Option<String>,
    pub modified_at: time::PrimitiveDateTime,
}

impl InvoiceNew {
    #[allow(clippy::too_many_arguments)]
    pub fn new(
        invoice_id: String,
        subscription_id: Option<String>,
        connector_subscription_id: Option<String>,
        merchant_id: common_utils::id_type::MerchantId,
        profile_id: common_utils::id_type::ProfileId,
        merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
        payment_intent_id: String,
        payment_method_id: Option<String>,
        customer_id: common_utils::id_type::CustomerId,
        amount: i32,
        currency: String,
        status: String,
        provider_name: String,
        metadata: Option<SecretSerdeValue>,
    ) -> Self {
        let now = common_utils::date_time::now();
        Self {
            invoice_id,
            subscription_id,
            connector_subscription_id,
            merchant_id,
            profile_id,
            merchant_connector_id,
            payment_intent_id,
            payment_method_id,
            customer_id,
            amount,
            currency,
            status,
            provider_name,
            metadata,
            created_at: now,
            modified_at: now,
        }
    }
}

impl InvoiceUpdate {

Review comment (suggestion):
```suggestion
        provider_name: Connector,
```
can we use connectorenum here

Code after:

#[derive(Clone, Debug, Eq, PartialEq, AsChangeset, Deserialize)]
#[diesel(table_name = invoice)]
pub struct InvoiceUpdate {
    pub status: Option<String>,
    pub payment_method_id: Option<String>,
    pub modified_at: time::PrimitiveDateTime,
}

impl InvoiceNew {
    #[allow(clippy::too_many_arguments)]
    pub fn new(
        id: String,
        subscription_id: String,
        merchant_id: common_utils::id_type::MerchantId,
        profile_id: common_utils::id_type::ProfileId,
        merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,
        payment_intent_id: Option<common_utils::id_type::PaymentId>,
        payment_method_id: Option<String>,
        customer_id: common_utils::id_type::CustomerId,
        amount: MinorUnit,
        currency: String,
        status: InvoiceStatus,
        provider_name: Connector,
        metadata: Option<SecretSerdeValue>,
    ) -> Self {
        let now = common_utils::date_time::now();
        Self {
            id,
            subscription_id,
            merchant_id,
            profile_id,
            merchant_connector_id,
            payment_intent_id,
            payment_method_id,
            customer_id,
            amount,
            currency,
            status: status.to_string(),
            provider_name,
            metadata,
            created_at: now,
            modified_at: now,
        }
    }
}

impl InvoiceUpdate {
    pub fn new(payment_method_id: Option<String>, status: Option<InvoiceStatus>) -> Self {
        Self {
            payment_method_id,