Bug: [FEAT] create Redis API for unlocking token in revenue recovery




diff --git a/crates/api_models/src/revenue_recovery_data_backfill.rs b/crates/api_models/src/revenue_recovery_data_backfill.rs
index d73ae8a33c3..34c64b75547 100644
--- a/crates/api_models/src/revenue_recovery_data_backfill.rs
+++ b/crates/api_models/src/revenue_recovery_data_backfill.rs
@@ -23,6 +23,11 @@ pub struct RevenueRecoveryBackfillRequest {
     pub daily_retry_history: Option<String>,
 }
 
+#[derive(Debug, Serialize)]
+pub struct UnlockStatusResponse {
+    pub unlocked: bool,
+}
+
 #[derive(Debug, Serialize)]
 pub struct RevenueRecoveryDataBackfillResponse {
     pub processed_records: usize,
@@ -59,6 +64,12 @@ impl ApiEventMetric for RevenueRecoveryDataBackfillResponse {
     }
 }
 
+impl ApiEventMetric for UnlockStatusResponse {
+    fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
+        Some(common_utils::events::ApiEventsType::Miscellaneous)
+    }
+}
+
 impl ApiEventMetric for CsvParsingResult {
     fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
         Some(common_utils::events::ApiEventsType::Miscellaneous)
diff --git a/crates/router/src/core/revenue_recovery_data_backfill.rs b/crates/router/src/core/revenue_recovery_data_backfill.rs
index 4f32a914849..629b9e6a586 100644
--- a/crates/router/src/core/revenue_recovery_data_backfill.rs
+++ b/crates/router/src/core/revenue_recovery_data_backfill.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
 
 use api_models::revenue_recovery_data_backfill::{
     BackfillError, ComprehensiveCardData, RevenueRecoveryBackfillRequest,
-    RevenueRecoveryDataBackfillResponse,
+    RevenueRecoveryDataBackfillResponse, UnlockStatusResponse,
 };
 use common_enums::{CardNetwork, PaymentMethodType};
 use hyperswitch_domain_models::api::ApplicationResponse;
@@ -60,6 +60,33 @@ pub async fn revenue_recovery_data_backfill(
     Ok(ApplicationResponse::Json(response))
 }
 
+pub async fn unlock_connector_customer_status(
+    state: SessionState,
+    connector_customer_id: String,
+) -> RouterResult<ApplicationResponse<UnlockStatusResponse>> {
+    let unlocked = storage::revenue_recovery_redis_operation::
+        RedisTokenManager::unlock_connector_customer_status(&state, &connector_customer_id)
+        .await
+        .map_err(|e| {
+            logger::error!(
+                "Failed to unlock connector customer status for {}: {}",
+                connector_customer_id,
+                e
+            );
+            errors::ApiErrorResponse::InternalServerError
+        })?;
+
+    let response = UnlockStatusResponse { unlocked };
+
+    logger::info!(
+        "Unlock operation completed for connector customer {}: {}",
+        connector_customer_id,
+        unlocked
+    );
+
+    Ok(ApplicationResponse::Json(response))
+}
+
 async fn process_payment_method_record(
     state: &SessionState,
     record: &RevenueRecoveryBackfillRequest,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index 9f27455c75c..395306c63c1 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -2984,5 +2984,10 @@ impl RecoveryDataBackfill {
                         .to(super::revenue_recovery_data_backfill::revenue_recovery_data_backfill),
                 ),
             )
+            .service(web::resource("/status/{token_id}").route(
+                web::post().to(
+                    super::revenue_recovery_data_backfill::revenue_recovery_data_backfill_status,
+                ),
+            ))
     }
 }
diff --git a/crates/router/src/routes/revenue_recovery_data_backfill.rs b/crates/router/src/routes/revenue_recovery_data_backfill.rs
index 340d9a084bf..4203f52dfff 100644
--- a/crates/router/src/routes/revenue_recovery_data_backfill.rs
+++ b/crates/router/src/routes/revenue_recovery_data_backfill.rs
@@ -7,7 +7,7 @@ use crate::{
     core::{api_locking, revenue_recovery_data_backfill},
     routes::AppState,
     services::{api, authentication as auth},
-    types::domain,
+    types::{domain, storage},
 };
 
 #[instrument(skip_all, fields(flow = ?Flow::RecoveryDataBackfill))]
@@ -65,3 +65,26 @@ pub async fn revenue_recovery_data_backfill(
     ))
     .await
 }
+
+#[instrument(skip_all, fields(flow = ?Flow::RecoveryDataBackfill))]
+pub async fn revenue_recovery_data_backfill_status(
+    state: web::Data<AppState>,
+    req: HttpRequest,
+    path: web::Path<String>,
+) -> HttpResponse {
+    let flow = Flow::RecoveryDataBackfill;
+    let connector_customer_id = path.into_inner();
+
+    Box::pin(api::server_wrap(
+        flow,
+        state,
+        &req,
+        connector_customer_id,
+        |state, _: (), id, _| {
+            revenue_recovery_data_backfill::unlock_connector_customer_status(state, id)
+        },
+        &auth::V2AdminApiAuth,
+        api_locking::LockAction::NotApplicable,
+    ))
+    .await
+}

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

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

## Description
<!-- Describe your changes in detail -->
This API updates the lock status of customer token to unlock in revenue recovery. 

### 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).
-->


## 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)?
-->
cURL:-
```
curl --location --request POST 'http://localhost:8080/v2/recovery/data-backfill/status/fake_token_number' \
--header 'Authorization: admin-api-key=' \
```

Response:-
```
{
    "unlocked": true
}
```

Router logs:-

<img width="1058" height="759" alt="Screenshot 2025-09-16 at 18 30 15" src="https://github.com/user-attachments/assets/0a9de535-3b7f-4638-a941-bce5cfb5f4ad" />

Redis-cli logs:-

<img width="391" height="65" alt="Screenshot 2025-09-16 at 18 29 46" src="https://github.com/user-attachments/assets/d5f40b53-b4c0-46e1-9168-4420b43f2908" />



## 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`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible
