Bug: feat(analytics): add `smart_retries` only metrics



## Proposed changes

There should be fields in PaymentDistribution, for the case where we only want to extract metric for Subsequent smart retried attempts.

For example, we have `success_rate` and `success_rate_without_retries`

Now missing field is `success_rate_with_only_smart_retries`.

This change should be extended to all fields
diff --git a/crates/analytics/src/payments/accumulator.rs b/crates/analytics/src/payments/accumulator.rs
index 651eeb0bcfe..c4e48300d07 100644
--- a/crates/analytics/src/payments/accumulator.rs
+++ b/crates/analytics/src/payments/accumulator.rs
@@ -76,8 +76,11 @@ pub struct PaymentsDistributionAccumulator {
     pub failed: u32,
     pub total: u32,
     pub success_without_retries: u32,
+    pub success_with_only_retries: u32,
     pub failed_without_retries: u32,
+    pub failed_with_only_retries: u32,
     pub total_without_retries: u32,
+    pub total_with_only_retries: u32,
 }
 
 pub trait PaymentMetricAccumulator {
@@ -181,7 +184,14 @@ impl PaymentMetricAccumulator for SuccessRateAccumulator {
 }
 
 impl PaymentMetricAccumulator for PaymentsDistributionAccumulator {
-    type MetricOutput = (Option<f64>, Option<f64>, Option<f64>, Option<f64>);
+    type MetricOutput = (
+        Option<f64>,
+        Option<f64>,
+        Option<f64>,
+        Option<f64>,
+        Option<f64>,
+        Option<f64>,
+    );
 
     fn add_metrics_bucket(&mut self, metrics: &PaymentMetricRow) {
         if let Some(ref status) = metrics.status {
@@ -193,6 +203,8 @@ impl PaymentMetricAccumulator for PaymentsDistributionAccumulator {
                     self.success += success;
                     if metrics.first_attempt.unwrap_or(false) {
                         self.success_without_retries += success;
+                    } else {
+                        self.success_with_only_retries += success;
                     }
                 }
             }
@@ -201,6 +213,8 @@ impl PaymentMetricAccumulator for PaymentsDistributionAccumulator {
                     self.failed += failed;
                     if metrics.first_attempt.unwrap_or(false) {
                         self.failed_without_retries += failed;
+                    } else {
+                        self.failed_with_only_retries += failed;
                     }
                 }
             }
@@ -208,6 +222,8 @@ impl PaymentMetricAccumulator for PaymentsDistributionAccumulator {
                 self.total += total;
                 if metrics.first_attempt.unwrap_or(false) {
                     self.total_without_retries += total;
+                } else {
+                    self.total_with_only_retries += total;
                 }
             }
         }
@@ -215,14 +231,17 @@ impl PaymentMetricAccumulator for PaymentsDistributionAccumulator {
 
     fn collect(self) -> Self::MetricOutput {
         if self.total == 0 {
-            (None, None, None, None)
+            (None, None, None, None, None, None)
         } else {
             let success = Some(self.success);
             let success_without_retries = Some(self.success_without_retries);
+            let success_with_only_retries = Some(self.success_with_only_retries);
             let failed = Some(self.failed);
+            let failed_with_only_retries = Some(self.failed_with_only_retries);
             let failed_without_retries = Some(self.failed_without_retries);
             let total = Some(self.total);
             let total_without_retries = Some(self.total_without_retries);
+            let total_with_only_retries = Some(self.total_with_only_retries);
 
             let success_rate = match (success, total) {
                 (Some(s), Some(t)) if t > 0 => Some(f64::from(s) * 100.0 / f64::from(t)),
@@ -235,6 +254,12 @@ impl PaymentMetricAccumulator for PaymentsDistributionAccumulator {
                     _ => None,
                 };
 
+            let success_rate_with_only_retries =
+                match (success_with_only_retries, total_with_only_retries) {
+                    (Some(s), Some(t)) if t > 0 => Some(f64::from(s) * 100.0 / f64::from(t)),
+                    _ => None,
+                };
+
             let failed_rate = match (failed, total) {
                 (Some(s), Some(t)) if t > 0 => Some(f64::from(s) * 100.0 / f64::from(t)),
                 _ => None,
@@ -245,11 +270,19 @@ impl PaymentMetricAccumulator for PaymentsDistributionAccumulator {
                 (Some(s), Some(t)) if t > 0 => Some(f64::from(s) * 100.0 / f64::from(t)),
                 _ => None,
             };
+
+            let failed_rate_with_only_retries =
+                match (failed_with_only_retries, total_with_only_retries) {
+                    (Some(s), Some(t)) if t > 0 => Some(f64::from(s) * 100.0 / f64::from(t)),
+                    _ => None,
+                };
             (
                 success_rate,
                 success_rate_without_retries,
+                success_rate_with_only_retries,
                 failed_rate,
                 failed_rate_without_retries,
+                failed_rate_with_only_retries,
             )
         }
     }
@@ -393,8 +426,10 @@ impl PaymentMetricsAccumulator {
         let (
             payments_success_rate_distribution,
             payments_success_rate_distribution_without_smart_retries,
+            payments_success_rate_distribution_with_only_retries,
             payments_failure_rate_distribution,
             payments_failure_rate_distribution_without_smart_retries,
+            payments_failure_rate_distribution_with_only_retries,
         ) = self.payments_distribution.collect();
         let (failure_reason_count, failure_reason_count_without_smart_retries) =
             self.failure_reasons_distribution.collect();
@@ -413,8 +448,10 @@ impl PaymentMetricsAccumulator {
             connector_success_rate: self.connector_success_rate.collect(),
             payments_success_rate_distribution,
             payments_success_rate_distribution_without_smart_retries,
+            payments_success_rate_distribution_with_only_retries,
             payments_failure_rate_distribution,
             payments_failure_rate_distribution_without_smart_retries,
+            payments_failure_rate_distribution_with_only_retries,
             failure_reason_count,
             failure_reason_count_without_smart_retries,
             payment_processed_amount_usd,
diff --git a/crates/api_models/src/analytics/payments.rs b/crates/api_models/src/analytics/payments.rs
index 1faba79eb37..70b1da62bea 100644
--- a/crates/api_models/src/analytics/payments.rs
+++ b/crates/api_models/src/analytics/payments.rs
@@ -283,8 +283,10 @@ pub struct PaymentMetricsBucketValue {
     pub connector_success_rate: Option<f64>,
     pub payments_success_rate_distribution: Option<f64>,
     pub payments_success_rate_distribution_without_smart_retries: Option<f64>,
+    pub payments_success_rate_distribution_with_only_retries: Option<f64>,
     pub payments_failure_rate_distribution: Option<f64>,
     pub payments_failure_rate_distribution_without_smart_retries: Option<f64>,
+    pub payments_failure_rate_distribution_with_only_retries: Option<f64>,
     pub failure_reason_count: Option<u64>,
     pub failure_reason_count_without_smart_retries: Option<u64>,
 }

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [x]  New feature
- [x] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
Added support for calculating new metrics based on smart retries for Analytics v2 dashboard.
The 2 metrics are:
- Payment Processed Amount and Count for smart retries
- Payments Success Rate and Failure Rate distribution for Smart Retries

`Payment Processed Amount and Count for Smart Retries` can be calculated with the existing metrics, with just a subtraction of `payment_processed_amount_without_smart_retries` from `payment_processed_amount`, hence doesn't require a separate metric.



In the `PaymentDistributionAccumulator`, I added another field variant with the signature 
`<field_name>_with_only_smart_retries`.
Where `field_name` can be anything from `success_rate`, `failure_rate`.
### Additional Changes

- [ ] This PR modifies the API contract
- [ ] 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).
-->
Fixes #6574 

## 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)?
-->
### Request
- Hit the curl:
```bash
curl --location 'http://localhost:8080/analytics/v1/org/metrics/payments' \
--header 'Accept: */*' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Origin: http://localhost:9000' \
--header 'QueryType: SingleStat' \
--header 'Referer: http://localhost:9000/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-site' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36' \
--header 'api-key: dev_r3kVZ4URj3fMiHhJJuhHOVqteaXwKyEMGCaFo6PiCS6S9vZsb0ErV4kCVqogM60H' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDZlOGRmZWYtMzI0Zi00Yjc0LTg2MTItYzdkZjNhOGZmZTcyIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI3NDM0NTkzIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTczMTY1MTcyMCwib3JnX2lkIjoib3JnXzl3Y0kxQ2hTOGVEdnRRQmRXak9IIiwicHJvZmlsZV9pZCI6InByb19FNW5lek43YjZUbVB1WlUzbEU1VSJ9.gtctUL339INfdj6CVmZLW2NDMNcseMTCPX0uxSsOD1c' \
--header 'sec-ch-ua: "Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--data '[
    {
        "timeRange": {
            "startTime": "2024-11-07T01:30:00Z",
            "endTime": "2024-11-09T23:30:00Z"
        },
        "mode": "ORDER",
        "source": "BATCH",
        "metrics": [
            "payments_distribution"
        ],
        "delta": true
    }
]'
```
### Response

```json
{
    "queryData": [
        {
            "payment_success_rate": null,
            "payment_count": null,
            "payment_success_count": null,
            "payment_processed_amount": 0,
            "payment_processed_amount_usd": null,
            "payment_processed_count": null,
            "payment_processed_amount_without_smart_retries": 0,
            "payment_processed_amount_without_smart_retries_usd": null,
            "payment_processed_count_without_smart_retries": null,
            "avg_ticket_size": null,
            "payment_error_message": null,
            "retries_count": null,
            "retries_amount_processed": 0,
            "connector_success_rate": null,
            "payments_success_rate_distribution": 66.66666666666667,
            "payments_success_rate_distribution_without_smart_retries": 57.142857142857146,
            "payments_success_rate_distribution_with_only_retries": 100.0,
            "payments_failure_rate_distribution": 33.333333333333336,
            "payments_failure_rate_distribution_without_smart_retries": 42.857142857142854,
            "payments_failure_rate_distribution_with_only_retries": 0.0,
            "failure_reason_count": 0,
            "failure_reason_count_without_smart_retries": 0,
            "currency": null,
            "status": null,
            "connector": null,
            "authentication_type": null,
            "payment_method": null,
            "payment_method_type": null,
            "client_source": null,
            "client_version": null,
            "profile_id": null,
            "card_network": null,
            "merchant_id": null,
            "card_last_4": null,
            "card_issuer": null,
            "error_reason": null,
            "time_range": {
                "start_time": "2024-11-07T01:30:00.000Z",
                "end_time": "2024-11-09T23:30:00.000Z"
            },
            "time_bucket": "2024-11-07 01:30:00"
        }
    ],
    "metaData": [
        {
            "total_payment_processed_amount": 0,
            "total_payment_processed_amount_usd": 0,
            "total_payment_processed_amount_without_smart_retries": 0,
            "total_payment_processed_amount_without_smart_retries_usd": 0,
            "total_payment_processed_count": 0,
            "total_payment_processed_count_without_smart_retries": 0,
            "total_failure_reasons_count": 0,
            "total_failure_reasons_count_without_smart_retries": 0
        }
    ]
}
```
Fields that are required to be checked:
`queryData`:
```json
"payments_success_rate_distribution_with_only_retries": 100.0,
"payments_failure_rate_distribution_with_only_retries": 0.0,
```
## 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
