Issue:
Bug: refactor(dynamic_routing): add col payment_method_type in dynamic_routing_stats





Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
This change will add `payment_method_type` in dynamic_routing_stats.

### Additional Changes

- [ ] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->

Testing can be done in following way:
1. Enable Success based routing for a profile with feature as metrics.
2. Make a payment.
3. Search the `dynamic_routing_stats` table for the new col. `payment_method_type` for that payment.

<img width="441" alt="Screenshot 2024-12-16 at 5 38 33 PM" src="https://github.com/user-attachments/assets/24e47a6c-e06b-43a4-b3d4-dea5bab432ba" />


## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible


Testing:


Testing can be done in following way:
1. Enable Success based routing for a profile with feature as metrics.
2. Make a payment.
3. Search the `dynamic_routing_stats` table for the new col. `payment_method_type` for that payment.

<img width="441" alt="Screenshot 2024-12-16 at 5 38 33 PM" src="https://github.com/user-attachments/assets/24e47a6c-e06b-43a4-b3d4-dea5bab432ba" />

Patch:
diff --git a/crates/diesel_models/src/dynamic_routing_stats.rs b/crates/diesel_models/src/dynamic_routing_stats.rs
index 168699d7f56..c055359d8b0 100644
--- a/crates/diesel_models/src/dynamic_routing_stats.rs
+++ b/crates/diesel_models/src/dynamic_routing_stats.rs
@@ -19,6 +19,7 @@ pub struct DynamicRoutingStatsNew {
     pub payment_status: common_enums::AttemptStatus,
     pub conclusive_classification: common_enums::SuccessBasedRoutingConclusiveState,
     pub created_at: time::PrimitiveDateTime,
+    pub payment_method_type: Option<common_enums::PaymentMethodType>,
 }
 
 #[derive(Clone, Debug, Eq, PartialEq, Queryable, Selectable, Insertable)]
@@ -38,4 +39,5 @@ pub struct DynamicRoutingStats {
     pub payment_status: common_enums::AttemptStatus,
     pub conclusive_classification: common_enums::SuccessBasedRoutingConclusiveState,
     pub created_at: time::PrimitiveDateTime,
+    pub payment_method_type: Option<common_enums::PaymentMethodType>,
 }
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 178f5600542..61a8a7e19b9 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -417,6 +417,8 @@ diesel::table! {
         payment_status -> AttemptStatus,
         conclusive_classification -> SuccessBasedRoutingConclusiveState,
         created_at -> Timestamp,
+        #[max_length = 64]
+        payment_method_type -> Nullable<Varchar>,
     }
 }
 
diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs
index da2298d934b..6569c035365 100644
--- a/crates/diesel_models/src/schema_v2.rs
+++ b/crates/diesel_models/src/schema_v2.rs
@@ -429,6 +429,8 @@ diesel::table! {
         payment_status -> AttemptStatus,
         conclusive_classification -> SuccessBasedRoutingConclusiveState,
         created_at -> Timestamp,
+        #[max_length = 64]
+        payment_method_type -> Nullable<Varchar>,
     }
 }
 
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index b3c951f0964..2abb5e64cd4 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -761,6 +761,7 @@ pub async fn push_metrics_with_update_window_for_success_based_routing(
             amount: payment_attempt.get_total_amount(),
             success_based_routing_connector: first_success_based_connector.to_string(),
             payment_connector: payment_connector.to_string(),
+            payment_method_type: payment_attempt.payment_method_type,
             currency: payment_attempt.currency,
             payment_method: payment_attempt.payment_method,
             capture_method: payment_attempt.capture_method,
diff --git a/migrations/2024-12-16-111228_add_new_col_payment_method_type_in_dynamic_routing_stats/down.sql b/migrations/2024-12-16-111228_add_new_col_payment_method_type_in_dynamic_routing_stats/down.sql
new file mode 100644
index 00000000000..bc2f40c91d2
--- /dev/null
+++ b/migrations/2024-12-16-111228_add_new_col_payment_method_type_in_dynamic_routing_stats/down.sql
@@ -0,0 +1,3 @@
+-- This file should undo anything in `up.sql`
+ALTER TABLE dynamic_routing_stats
+DROP COLUMN IF EXISTS payment_method_type;
diff --git a/migrations/2024-12-16-111228_add_new_col_payment_method_type_in_dynamic_routing_stats/up.sql b/migrations/2024-12-16-111228_add_new_col_payment_method_type_in_dynamic_routing_stats/up.sql
new file mode 100644
index 00000000000..2b5af8090f0
--- /dev/null
+++ b/migrations/2024-12-16-111228_add_new_col_payment_method_type_in_dynamic_routing_stats/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TABLE dynamic_routing_stats
+ADD COLUMN IF NOT EXISTS payment_method_type VARCHAR(64);