Bug: fix(revenue_recovery) : Skip record-back for failed invoices on auto-voiding billing connectors



## Description
<!-- Describe your changes in detail -->
This PR addresses two issues :

#### Unnecessary record-back for certain billing processors
 billing processors (like Stripebilling, Recurly) automatically void invoices after 30 days and cancel the associated subscription. Because of this, we don't need to call a record-back flow for failed invoices on our end. 

#### PSync flow fetching incorrect transaction
In the billing connector PSync flow, we were fetching invoice and transaction details using the invoice ID. However, the logic always selected the last transaction from the list, regardless of its status or relevance. This caused the retry count to not be updated correctly. 
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
index a15ce5f1561..9d731621b77 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
@@ -597,7 +597,7 @@ impl
         connectors: &Connectors,
     ) -> CustomResult<String, errors::ConnectorError> {
         Ok(format!(
-            "{}v1/payment_intents/{}?expand[0]=latest_charge",
+            "{}v1/charges/{}",
             self.base_url(connectors),
             req.request.billing_connector_psync_id
         ))
@@ -630,10 +630,10 @@ impl
         recovery_router_data_types::BillingConnectorPaymentsSyncRouterData,
         errors::ConnectorError,
     > {
-        let response: stripebilling::StripebillingBillingConnectorPaymentSyncResponseData = res
+        let response: stripebilling::StripebillingRecoveryDetailsData = res
             .response
-            .parse_struct::<stripebilling::StripebillingBillingConnectorPaymentSyncResponseData>(
-                "StripebillingBillingConnectorPaymentSyncResponseData",
+            .parse_struct::<stripebilling::StripebillingRecoveryDetailsData>(
+                "StripebillingRecoveryDetailsData",
             )
             .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
 
@@ -805,9 +805,7 @@ impl webhooks::IncomingWebhook for Stripebilling {
             stripebilling::StripebillingWebhookBody::get_webhook_object_from_body(request.body)
                 .change_context(errors::ConnectorError::WebhookReferenceIdNotFound)?;
         Ok(api_models::webhooks::ObjectReferenceId::PaymentId(
-            api_models::payments::PaymentIdType::ConnectorTransactionId(
-                webhook.data.object.payment_intent,
-            ),
+            api_models::payments::PaymentIdType::ConnectorTransactionId(webhook.data.object.charge),
         ))
     }
 
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
index ae80cb48ea1..4cf4d2b542f 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling/transformers.rs
@@ -426,12 +426,7 @@ impl TryFrom<StripebillingInvoiceBody> for revenue_recovery::RevenueRecoveryInvo
 }
 
 #[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct StripebillingBillingConnectorPaymentSyncResponseData {
-    pub latest_charge: StripebillingLatestChargeData,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub struct StripebillingLatestChargeData {
+pub struct StripebillingRecoveryDetailsData {
     #[serde(rename = "id")]
     pub charge_id: String,
     pub status: StripebillingChargeStatus,
@@ -517,7 +512,7 @@ impl
     TryFrom<
         ResponseRouterData<
             recovery_router_flows::BillingConnectorPaymentsSync,
-            StripebillingBillingConnectorPaymentSyncResponseData,
+            StripebillingRecoveryDetailsData,
             recovery_request_types::BillingConnectorPaymentsSyncRequest,
             recovery_response_types::BillingConnectorPaymentsSyncResponse,
         >,
@@ -527,12 +522,12 @@ impl
     fn try_from(
         item: ResponseRouterData<
             recovery_router_flows::BillingConnectorPaymentsSync,
-            StripebillingBillingConnectorPaymentSyncResponseData,
+            StripebillingRecoveryDetailsData,
             recovery_request_types::BillingConnectorPaymentsSyncRequest,
             recovery_response_types::BillingConnectorPaymentsSyncResponse,
         >,
     ) -> Result<Self, Self::Error> {
-        let charge_details = item.response.latest_charge;
+        let charge_details = item.response;
         let merchant_reference_id =
             id_type::PaymentReferenceId::from_str(charge_details.invoice_id.as_str())
                 .change_context(errors::ConnectorError::MissingRequiredField {
diff --git a/crates/router/src/core/revenue_recovery/types.rs b/crates/router/src/core/revenue_recovery/types.rs
index c043641dabd..1e533751f0e 100644
--- a/crates/router/src/core/revenue_recovery/types.rs
+++ b/crates/router/src/core/revenue_recovery/types.rs
@@ -192,18 +192,6 @@ impl RevenueRecoveryPaymentsAttemptStatus {
                     db.as_scheduler()
                         .retry_process(process_tracker.clone(), schedule_time)
                         .await?;
-                } else {
-                    // Record a failure transaction back to Billing Connector
-                    // TODO: Add support for retrying failed outgoing recordback webhooks
-                    record_back_to_billing_connector(
-                        state,
-                        &payment_attempt,
-                        payment_intent,
-                        &revenue_recovery_payment_data.billing_mca,
-                    )
-                    .await
-                    .change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
-                    .attach_printable("Failed to record back the billing connector")?;
                 }
             }
             Self::Processing => {
@@ -504,17 +492,8 @@ impl Action {
                     .await
                     .change_context(errors::RecoveryError::ProcessTrackerFailure)
                     .attach_printable("Failed to update the process tracker")?;
-                // Record back to billing connector for terminal status
                 // TODO: Add support for retrying failed outgoing recordback webhooks
-                record_back_to_billing_connector(
-                    state,
-                    payment_attempt,
-                    payment_intent,
-                    &revenue_recovery_payment_data.billing_mca,
-                )
-                .await
-                .change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
-                .attach_printable("Failed to record back the billing connector")?;
+
                 Ok(())
             }
             Self::SuccessfulPayment(payment_attempt) => {
@@ -702,18 +681,7 @@ impl Action {
             }
 
             Self::TerminalFailure(payment_attempt) => {
-                // Record a failure transaction back to Billing Connector
                 // TODO: Add support for retrying failed outgoing recordback webhooks
-                record_back_to_billing_connector(
-                    state,
-                    payment_attempt,
-                    payment_intent,
-                    &revenue_recovery_payment_data.billing_mca,
-                )
-                .await
-                .change_context(errors::RecoveryError::RecordBackToBillingConnectorFailed)
-                .attach_printable("Failed to record back the billing connector")?;
-
                 // finish the current psync task
                 db.as_scheduler()
                     .finish_process_with_business_status(

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

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

## Description
<!-- Describe your changes in detail -->
This PR addresses two issues :

#### Unnecessary record-back for certain billing processors
 billing processors (like Stripebilling, Recurly) automatically void invoices after 30 days and cancel the associated subscription. Because of this, we don't need to call a record-back flow for failed invoices on our end. 

#### PSync flow fetching incorrect transaction
In the billing connector PSync flow, we were fetching invoice and transaction details using the invoice ID. However, the logic always selected the last transaction from the list, regardless of its status or relevance. This caused the retry count to not be updated correctly. 

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [x] 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)?
-->
#### Create a mca
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_UtjuUuRAKVfLLLoRfZgg' \
--header 'x-profile-id: pro_oCx1cn5sCSpSnwZaw63U' \
--header 'Authorization: admin-api-key=test_admin' \
--data '{
    "connector_type": "payment_processor",
    "connector_name": "stripe",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": ""
    },
    "payment_methods_enabled": [
        {
            "payment_method_type": "card",
            "payment_method_subtypes": [
                {
                    "payment_method_subtype": "credit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                },
                {
                    "payment_method_subtype": "debit",
                    "payment_experience": null,
                    "card_networks": [
                        "Visa",
                        "Mastercard"
                    ],
                    "accepted_currencies": null,
                    "accepted_countries": null,
                    "minimum_amount": -1,
                    "maximum_amount": 68607706,
                    "recurring_enabled": true,
                    "installment_payment_enabled": true
                }
            ]
        }
    ],
    "metadata": {
        "status_url": "https://2753-2401-4900-1cb8-2ff9-24dd-1ccf-ed12-b464.in.ngrok.io/webhooks/merchant_1678699058/globalpay",
        "account_name": "transaction_processing",
        "pricing_type": "fixed_price",
        "acquirer_bin": "438309",
        "acquirer_merchant_id": "00002000000"
    },
    "frm_configs": null,
    "connector_webhook_details": {
        "merchant_secret": ""
    },
    "profile_id": ""
}'
```
#### Create billing processor
```
curl --location 'http://localhost:8080/v2/connector-accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-merchant-id: cloth_seller_UtjuUuRAKVfLLLoRfZgg' \
--header 'x-profile-id: pro_oCx1cn5sCSpSnwZaw63U' \
--header 'Authorization: admin-api-key=test_admin' \
--data '{
    "connector_type": "billing_processor",
    "connector_name": "stripebilling",
    "connector_account_details": {
        "auth_type": "HeaderKey",
        "api_key": ""
    },
    "connector_webhook_details": {
        "merchant_secret": "secret_needed",
        "additional_secret": "password"
    },
    "feature_metadata": {
        "revenue_recovery": {
            "max_retry_count": 7,
            "billing_connector_retry_threshold": 2,
            "billing_account_reference": {
                "mca_id": "stripebilling"
            }
        }
    },
    "profile_id": ""
}'
```
### Webhook
```
curl --location 'http://localhost:8080/v2/webhooks/cloth_seller_UtjuUuRAKVfLLLoRfZgg/pro_oCx1cn5sCSpSnwZaw63U/mca_BRNBJA0Q8sBoqhgNrqKc' \
--header 'stripe-signature: t=1751527430,v1=d0436759f119bd0d4c32d9601b0fb7a1b0c614a41fa8774189d82f143ceb0d54,v0=d718933a2ded633f9dae5b23d642d9c819cc618dca8b055b61810e25e961b1dc' \
--header 'accept: */*; q=0.5, application/json' \
--header 'user-agent: Stripe/1.0 (+https://stripe.com/docs/webhooks)' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json; charset=utf-8' \
--data '{
  "id": "evt_1RghUoCZJlEh6syL2Rj25wzT",
  "object": "event",
  "api_version": "2025-02-24.acacia",
  "created": 1751527427,
  "data": {
    "object": {
      "id": "in_1RghUdCZJlEh6syL1Mn3uN6W",
      "object": "invoice",
      "account_country": "US",
      "account_name": "nishanth2",
      "account_tax_ids": null,
      "amount_due": 10000,
      "amount_overpaid": 0,
      "amount_paid": 0,
      "amount_remaining": 10000,
      "amount_shipping": 0,
      "application": null,
      "application_fee_amount": null,
      "attempt_count": 1,
      "attempted": true,
      "auto_advance": true,
      "automatic_tax": {
        "disabled_reason": null,
        "enabled": false,
        "liability": null,
        "provider": null,
        "status": null
      },
      "automatically_finalizes_at": null,
      "billing_reason": "subscription_cycle",
      "charge": "ch_3RghUiCZJlEh6syL1A8rC285",
      "collection_method": "charge_automatically",
      "created": 1751567400,
      "currency": "usd",
      "custom_fields": null,
      "customer": "cus_SbvK4XDxQhrfp2",
      "customer_address": null,
      "customer_email": null,
      "customer_name": "Anikwet",
      "customer_phone": null,
      "customer_shipping": null,
      "customer_tax_exempt": "none",
      "customer_tax_ids": [],
      "default_payment_method": null,
      "default_source": null,
      "default_tax_rates": [],
      "description": null,
      "discount": null,
      "discounts": [],
      "due_date": null,
      "effective_at": 1751571000,
      "ending_balance": 0,
      "footer": null,
      "from_invoice": null,
      "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1R156rCZJlEh6syL/test_YWNjdF8xUjE1NnJDWkpsRWg2c3lMLF9TYnZMZkJVZWxLc21ka3NnanVpcFRBaUZpdnlvdE8wLDE0MjA2ODIzMA0200ziIDipdc?s=ap",
      "invoice_pdf": "https://pay.stripe.com/invoice/acct_1R156rCZJlEh6syL/test_YWNjdF8xUjE1NnJDWkpsRWg2c3lMLF9TYnZMZkJVZWxLc21ka3NnanVpcFRBaUZpdnlvdE8wLDE0MjA2ODIzMA0200ziIDipdc/pdf?s=ap",
      "issuer": {
        "type": "self"
      },
      "last_finalization_error": null,
      "latest_revision": null,
      "lines": {
        "object": "list",
        "data": [
          {
            "id": "il_1RgrtUCZJlEh6syLIS3D3MBo",
            "object": "line_item",
            "amount": 10000,
            "amount_excluding_tax": 10000,
            "currency": "usd",
            "description": "1 × bhfhbwfh (at $100.00 / month)",
            "discount_amounts": [],
            "discountable": true,
            "discounts": [],
            "invoice": "in_1RghUdCZJlEh6syL1Mn3uN6W",
            "livemode": false,
            "metadata": {},
            "parent": {
              "invoice_item_details": null,
              "subscription_item_details": {
                "invoice_item": null,
                "proration": false,
                "proration_details": {
                  "credited_items": null
                },
                "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
                "subscription_item": "si_SbvKW8KTf722nZ"
              },
              "type": "subscription_item_details"
            },
            "period": {
              "end": 1754245800,
              "start": 1751567400
            },
            "plan": {
              "id": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
              "object": "plan",
              "active": true,
              "aggregate_usage": null,
              "amount": 10000,
              "amount_decimal": "10000",
              "billing_scheme": "per_unit",
              "created": 1747054403,
              "currency": "usd",
              "interval": "month",
              "interval_count": 1,
              "livemode": false,
              "metadata": {},
              "meter": null,
              "nickname": null,
              "product": "prod_SIWvOH70HUE0k4",
              "tiers_mode": null,
              "transform_usage": null,
              "trial_period_days": null,
              "usage_type": "licensed"
            },
            "pretax_credit_amounts": [],
            "price": {
              "id": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
              "object": "price",
              "active": true,
              "billing_scheme": "per_unit",
              "created": 1747054403,
              "currency": "usd",
              "custom_unit_amount": null,
              "livemode": false,
              "lookup_key": null,
              "metadata": {},
              "nickname": null,
              "product": "prod_SIWvOH70HUE0k4",
              "recurring": {
                "aggregate_usage": null,
                "interval": "month",
                "interval_count": 1,
                "meter": null,
                "trial_period_days": null,
                "usage_type": "licensed"
              },
              "tax_behavior": "unspecified",
              "tiers_mode": null,
              "transform_quantity": null,
              "type": "recurring",
              "unit_amount": 10000,
              "unit_amount_decimal": "10000"
            },
            "pricing": {
              "price_details": {
                "price": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
                "product": "prod_SIWvOH70HUE0k4"
              },
              "type": "price_details",
              "unit_amount_decimal": "10000"
            },
            "proration": false,
            "proration_details": {
              "credited_items": null
            },
            "quantity": 1,
            "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
            "subscription_item": "si_SbvKW8KTf722nZ",
            "tax_amounts": [],
            "tax_rates": [],
            "taxes": [],
            "type": "subscription",
            "unit_amount_excluding_tax": "10000"
          }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "/v1/invoices/in_1RghUdCZJlEh6syL1Mn3uN6W/lines"
      },
      "livemode": false,
      "metadata": {},
      "next_payment_attempt": 1751728637,
      "number": "5AY2AUB1-0001",
      "on_behalf_of": null,
      "paid": false,
      "paid_out_of_band": false,
      "parent": {
        "quote_details": null,
        "subscription_details": {
          "metadata": {},
          "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF"
        },
        "type": "subscription_details"
      },
      "payment_intent": "pi_3RghUiCZJlEh6syL1nf1DJjU",
      "payment_settings": {
        "default_mandate": null,
        "payment_method_options": null,
        "payment_method_types": null
      },
      "period_end": 1751567400,
      "period_start": 1751527399,
      "post_payment_credit_notes_amount": 0,
      "pre_payment_credit_notes_amount": 0,
      "quote": null,
      "receipt_number": null,
      "rendering": null,
      "shipping_cost": null,
      "shipping_details": null,
      "starting_balance": 0,
      "statement_descriptor": null,
      "status": "open",
      "status_transitions": {
        "finalized_at": 1751571000,
        "marked_uncollectible_at": null,
        "paid_at": null,
        "voided_at": null
      },
      "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
      "subscription_details": {
        "metadata": {}
      },
      "subtotal": 10000,
      "subtotal_excluding_tax": 10000,
      "tax": null,
      "test_clock": "clock_1RghUYCZJlEh6syL7rjupJQi",
      "total": 10000,
      "total_discount_amounts": [],
      "total_excluding_tax": 10000,
      "total_pretax_credit_amounts": [],
      "total_tax_amounts": [],
      "total_taxes": [],
      "transfer_data": null,
      "webhooks_delivered_at": 1751567400
    }
  },
  "livemode": false,
  "pending_webhooks": 1,
  "request": {
    "id": null,
    "idempotency_key": null
  },
  "type": "invoice.payment_failed"
}'
```
#### Webhook 2 
```
curl --location 'http://localhost:8080/v2/webhooks/cloth_seller_UtjuUuRAKVfLLLoRfZgg/pro_oCx1cn5sCSpSnwZaw63U/mca_BRNBJA0Q8sBoqhgNrqKc' \
--header 'stripe-signature: t=1751528782,v1=3949ccd6d2cf800faabbae0d9444831d1b00b75c098e0b4a5c5be2fcfcc99c68,v0=97e97facf998e448ee86130da153924e8905ac8fc94b5fb4bd48e6382b26caac' \
--header 'accept: */*; q=0.5, application/json' \
--header 'user-agent: Stripe/1.0 (+https://stripe.com/docs/webhooks)' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json; charset=utf-8' \
--header 'api-key;' \
--data '{
  "id": "evt_1RghqcCZJlEh6syLWc3NGaNJ",
  "object": "event",
  "api_version": "2025-02-24.acacia",
  "created": 1751528781,
  "data": {
    "object": {
      "id": "in_1RghUdCZJlEh6syL1Mn3uN6W",
      "object": "invoice",
      "account_country": "US",
      "account_name": "nishanth2",
      "account_tax_ids": null,
      "amount_due": 10000,
      "amount_overpaid": 0,
      "amount_paid": 0,
      "amount_remaining": 10000,
      "amount_shipping": 0,
      "application": null,
      "application_fee_amount": null,
      "attempt_count": 1,
      "attempted": true,
      "auto_advance": true,
      "automatic_tax": {
        "disabled_reason": null,
        "enabled": false,
        "liability": null,
        "provider": null,
        "status": null
      },
      "automatically_finalizes_at": null,
      "billing_reason": "subscription_cycle",
      "charge": "ch_3RghUiCZJlEh6syL17CszxuH",
      "collection_method": "charge_automatically",
      "created": 1751567400,
      "currency": "usd",
      "custom_fields": null,
      "customer": "cus_SbvK4XDxQhrfp2",
      "customer_address": null,
      "customer_email": null,
      "customer_name": "Anikwet",
      "customer_phone": null,
      "customer_shipping": null,
      "customer_tax_exempt": "none",
      "customer_tax_ids": [],
      "default_payment_method": null,
      "default_source": null,
      "default_tax_rates": [],
      "description": null,
      "discount": null,
      "discounts": [],
      "due_date": null,
      "effective_at": 1751571000,
      "ending_balance": 0,
      "footer": null,
      "from_invoice": null,
      "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1R156rCZJlEh6syL/test_YWNjdF8xUjE1NnJDWkpsRWg2c3lMLF9TYnZMZkJVZWxLc21ka3NnanVpcFRBaUZpdnlvdE8wLDE0MjA2OTU4Mg0200bHHKOjrD?s=ap",
      "invoice_pdf": "https://pay.stripe.com/invoice/acct_1R156rCZJlEh6syL/test_YWNjdF8xUjE1NnJDWkpsRWg2c3lMLF9TYnZMZkJVZWxLc21ka3NnanVpcFRBaUZpdnlvdE8wLDE0MjA2OTU4Mg0200bHHKOjrD/pdf?s=ap",
      "issuer": {
        "type": "self"
      },
      "last_finalization_error": null,
      "latest_revision": null,
      "lines": {
        "object": "list",
        "data": [
          {
            "id": "il_1RgrtUCZJlEh6syLIS3D3MBo",
            "object": "line_item",
            "amount": 10000,
            "amount_excluding_tax": 10000,
            "currency": "usd",
            "description": "1 × bhfhbwfh (at $100.00 / month)",
            "discount_amounts": [],
            "discountable": true,
            "discounts": [],
            "invoice": "in_1RghUdCZJlEh6syL1Mn3uN6W",
            "livemode": false,
            "metadata": {},
            "parent": {
              "invoice_item_details": null,
              "subscription_item_details": {
                "invoice_item": null,
                "proration": false,
                "proration_details": {
                  "credited_items": null
                },
                "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
                "subscription_item": "si_SbvKW8KTf722nZ"
              },
              "type": "subscription_item_details"
            },
            "period": {
              "end": 1754245800,
              "start": 1751567400
            },
            "plan": {
              "id": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
              "object": "plan",
              "active": true,
              "aggregate_usage": null,
              "amount": 10000,
              "amount_decimal": "10000",
              "billing_scheme": "per_unit",
              "created": 1747054403,
              "currency": "usd",
              "interval": "month",
              "interval_count": 1,
              "livemode": false,
              "metadata": {},
              "meter": null,
              "nickname": null,
              "product": "prod_SIWvOH70HUE0k4",
              "tiers_mode": null,
              "transform_usage": null,
              "trial_period_days": null,
              "usage_type": "licensed"
            },
            "pretax_credit_amounts": [],
            "price": {
              "id": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
              "object": "price",
              "active": true,
              "billing_scheme": "per_unit",
              "created": 1747054403,
              "currency": "usd",
              "custom_unit_amount": null,
              "livemode": false,
              "lookup_key": null,
              "metadata": {},
              "nickname": null,
              "product": "prod_SIWvOH70HUE0k4",
              "recurring": {
                "aggregate_usage": null,
                "interval": "month",
                "interval_count": 1,
                "meter": null,
                "trial_period_days": null,
                "usage_type": "licensed"
              },
              "tax_behavior": "unspecified",
              "tiers_mode": null,
              "transform_quantity": null,
              "type": "recurring",
              "unit_amount": 10000,
              "unit_amount_decimal": "10000"
            },
            "pricing": {
              "price_details": {
                "price": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
                "product": "prod_SIWvOH70HUE0k4"
              },
              "type": "price_details",
              "unit_amount_decimal": "10000"
            },
            "proration": false,
            "proration_details": {
              "credited_items": null
            },
            "quantity": 1,
            "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
            "subscription_item": "si_SbvKW8KTf722nZ",
            "tax_amounts": [],
            "tax_rates": [],
            "taxes": [],
            "type": "subscription",
            "unit_amount_excluding_tax": "10000"
          }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "/v1/invoices/in_1RghUdCZJlEh6syL1Mn3uN6W/lines"
      },
      "livemode": false,
      "metadata": {},
      "next_payment_attempt": 1751728637,
      "number": "5AY2AUB1-0001",
      "on_behalf_of": null,
      "paid": false,
      "paid_out_of_band": false,
      "parent": {
        "quote_details": null,
        "subscription_details": {
          "metadata": {},
          "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF"
        },
        "type": "subscription_details"
      },
      "payment_intent": "pi_3RghUiCZJlEh6syL1nf1DJjU",
      "payment_settings": {
        "default_mandate": null,
        "payment_method_options": null,
        "payment_method_types": null
      },
      "period_end": 1751567400,
      "period_start": 1751527399,
      "post_payment_credit_notes_amount": 0,
      "pre_payment_credit_notes_amount": 0,
      "quote": null,
      "receipt_number": null,
      "rendering": null,
      "shipping_cost": null,
      "shipping_details": null,
      "starting_balance": 0,
      "statement_descriptor": null,
      "status": "open",
      "status_transitions": {
        "finalized_at": 1751571000,
        "marked_uncollectible_at": null,
        "paid_at": null,
        "voided_at": null
      },
      "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
      "subscription_details": {
        "metadata": {}
      },
      "subtotal": 10000,
      "subtotal_excluding_tax": 10000,
      "tax": null,
      "test_clock": "clock_1RghUYCZJlEh6syL7rjupJQi",
      "total": 10000,
      "total_discount_amounts": [],
      "total_excluding_tax": 10000,
      "total_pretax_credit_amounts": [],
      "total_tax_amounts": [],
      "total_taxes": [],
      "transfer_data": null,
      "webhooks_delivered_at": 1751567400
    }
  },
  "livemode": false,
  "pending_webhooks": 1,
  "request": {
    "id": "req_3YsUGkNRBqgJ2c",
    "idempotency_key": "072f9dde-db1d-45bd-9a64-483cc341b70a"
  },
  "type": "invoice.payment_failed"
}'
```
#### Webhook 3
```
curl --location 'http://localhost:8080/v2/webhooks/cloth_seller_UtjuUuRAKVfLLLoRfZgg/pro_oCx1cn5sCSpSnwZaw63U/mca_BRNBJA0Q8sBoqhgNrqKc' \
--header 'stripe-signature: t=1751528824,v1=4fd343c36f9b1c61a77b2f430b525ce3b435e4cbf6e58a8946752418aedf10d3,v0=b122d260854d5ad2b8f86f3bc78e09e8a19f1914e5bdf399e6a52a4da2c7190a' \
--header 'accept: */*; q=0.5, application/json' \
--header 'user-agent: Stripe/1.0 (+https://stripe.com/docs/webhooks)' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json; charset=utf-8' \
--header 'api-key;' \
--data '{
  "id": "evt_1RghrICZJlEh6syL9K2XJoSP",
  "object": "event",
  "api_version": "2025-02-24.acacia",
  "created": 1751528823,
  "data": {
    "object": {
      "id": "in_1RghUdCZJlEh6syL1Mn3uN6W",
      "object": "invoice",
      "account_country": "US",
      "account_name": "nishanth2",
      "account_tax_ids": null,
      "amount_due": 10000,
      "amount_overpaid": 0,
      "amount_paid": 0,
      "amount_remaining": 10000,
      "amount_shipping": 0,
      "application": null,
      "application_fee_amount": null,
      "attempt_count": 1,
      "attempted": true,
      "auto_advance": true,
      "automatic_tax": {
        "disabled_reason": null,
        "enabled": false,
        "liability": null,
        "provider": null,
        "status": null
      },
      "automatically_finalizes_at": null,
      "billing_reason": "subscription_cycle",
      "charge": "ch_3RghUiCZJlEh6syL1aUfCKJ9",
      "collection_method": "charge_automatically",
      "created": 1751567400,
      "currency": "usd",
      "custom_fields": null,
      "customer": "cus_SbvK4XDxQhrfp2",
      "customer_address": null,
      "customer_email": null,
      "customer_name": "Anikwet",
      "customer_phone": null,
      "customer_shipping": null,
      "customer_tax_exempt": "none",
      "customer_tax_ids": [],
      "default_payment_method": null,
      "default_source": null,
      "default_tax_rates": [],
      "description": null,
      "discount": null,
      "discounts": [],
      "due_date": null,
      "effective_at": 1751571000,
      "ending_balance": 0,
      "footer": null,
      "from_invoice": null,
      "hosted_invoice_url": "https://invoice.stripe.com/i/acct_1R156rCZJlEh6syL/test_YWNjdF8xUjE1NnJDWkpsRWg2c3lMLF9TYnZMZkJVZWxLc21ka3NnanVpcFRBaUZpdnlvdE8wLDE0MjA2OTYyNA0200i196xMb2?s=ap",
      "invoice_pdf": "https://pay.stripe.com/invoice/acct_1R156rCZJlEh6syL/test_YWNjdF8xUjE1NnJDWkpsRWg2c3lMLF9TYnZMZkJVZWxLc21ka3NnanVpcFRBaUZpdnlvdE8wLDE0MjA2OTYyNA0200i196xMb2/pdf?s=ap",
      "issuer": {
        "type": "self"
      },
      "last_finalization_error": null,
      "latest_revision": null,
      "lines": {
        "object": "list",
        "data": [
          {
            "id": "il_1RgrtUCZJlEh6syLIS3D3MBo",
            "object": "line_item",
            "amount": 10000,
            "amount_excluding_tax": 10000,
            "currency": "usd",
            "description": "1 × bhfhbwfh (at $100.00 / month)",
            "discount_amounts": [],
            "discountable": true,
            "discounts": [],
            "invoice": "in_1RghUdCZJlEh6syL1Mn3uN6W",
            "livemode": false,
            "metadata": {},
            "parent": {
              "invoice_item_details": null,
              "subscription_item_details": {
                "invoice_item": null,
                "proration": false,
                "proration_details": {
                  "credited_items": null
                },
                "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
                "subscription_item": "si_SbvKW8KTf722nZ"
              },
              "type": "subscription_item_details"
            },
            "period": {
              "end": 1754245800,
              "start": 1751567400
            },
            "plan": {
              "id": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
              "object": "plan",
              "active": true,
              "aggregate_usage": null,
              "amount": 10000,
              "amount_decimal": "10000",
              "billing_scheme": "per_unit",
              "created": 1747054403,
              "currency": "usd",
              "interval": "month",
              "interval_count": 1,
              "livemode": false,
              "metadata": {},
              "meter": null,
              "nickname": null,
              "product": "prod_SIWvOH70HUE0k4",
              "tiers_mode": null,
              "transform_usage": null,
              "trial_period_days": null,
              "usage_type": "licensed"
            },
            "pretax_credit_amounts": [],
            "price": {
              "id": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
              "object": "price",
              "active": true,
              "billing_scheme": "per_unit",
              "created": 1747054403,
              "currency": "usd",
              "custom_unit_amount": null,
              "livemode": false,
              "lookup_key": null,
              "metadata": {},
              "nickname": null,
              "product": "prod_SIWvOH70HUE0k4",
              "recurring": {
                "aggregate_usage": null,
                "interval": "month",
                "interval_count": 1,
                "meter": null,
                "trial_period_days": null,
                "usage_type": "licensed"
              },
              "tax_behavior": "unspecified",
              "tiers_mode": null,
              "transform_quantity": null,
              "type": "recurring",
              "unit_amount": 10000,
              "unit_amount_decimal": "10000"
            },
            "pricing": {
              "price_details": {
                "price": "price_1RNvrDCZJlEh6syLxM0yTOmJ",
                "product": "prod_SIWvOH70HUE0k4"
              },
              "type": "price_details",
              "unit_amount_decimal": "10000"
            },
            "proration": false,
            "proration_details": {
              "credited_items": null
            },
            "quantity": 1,
            "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
            "subscription_item": "si_SbvKW8KTf722nZ",
            "tax_amounts": [],
            "tax_rates": [],
            "taxes": [],
            "type": "subscription",
            "unit_amount_excluding_tax": "10000"
          }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "/v1/invoices/in_1RghUdCZJlEh6syL1Mn3uN6W/lines"
      },
      "livemode": false,
      "metadata": {},
      "next_payment_attempt": 1751728637,
      "number": "5AY2AUB1-0001",
      "on_behalf_of": null,
      "paid": false,
      "paid_out_of_band": false,
      "parent": {
        "quote_details": null,
        "subscription_details": {
          "metadata": {},
          "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF"
        },
        "type": "subscription_details"
      },
      "payment_intent": "pi_3RghUiCZJlEh6syL1nf1DJjU",
      "payment_settings": {
        "default_mandate": null,
        "payment_method_options": null,
        "payment_method_types": null
      },
      "period_end": 1751567400,
      "period_start": 1751527399,
      "post_payment_credit_notes_amount": 0,
      "pre_payment_credit_notes_amount": 0,
      "quote": null,
      "receipt_number": null,
      "rendering": null,
      "shipping_cost": null,
      "shipping_details": null,
      "starting_balance": 0,
      "statement_descriptor": null,
      "status": "open",
      "status_transitions": {
        "finalized_at": 1751571000,
        "marked_uncollectible_at": null,
        "paid_at": null,
        "voided_at": null
      },
      "subscription": "sub_1RghUJCZJlEh6syLYSoCZ5DF",
      "subscription_details": {
        "metadata": {}
      },
      "subtotal": 10000,
      "subtotal_excluding_tax": 10000,
      "tax": null,
      "test_clock": "clock_1RghUYCZJlEh6syL7rjupJQi",
      "total": 10000,
      "total_discount_amounts": [],
      "total_excluding_tax": 10000,
      "total_pretax_credit_amounts": [],
      "total_tax_amounts": [],
      "total_taxes": [],
      "transfer_data": null,
      "webhooks_delivered_at": 1751567400
    }
  },
  "livemode": false,
  "pending_webhooks": 1,
  "request": {
    "id": "req_mRsFYF3quUnlh5",
    "idempotency_key": "53d702db-6ee1-4964-a2bc-a6e34fe4f834"
  },
  "type": "invoice.payment_failed"
}'
```
PASSIVE_RECOVERY_WORKFLOW_EXECUTE_WORKFLOW was executed and on failure the invoice was not voided.

<img width="1140" alt="Screenshot 2025-07-04 at 4 47 45 PM" src="https://github.com/user-attachments/assets/62d5a3bd-da78-46a3-bd65-e1560357e7ad" />


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