Bug: [BUG] Incremental authorization proceeds even when requested amount equals original



### Bug Description

Incremental authorization proceeds even when requested amount equals original

### Expected Behavior

Incremental authorization should not proceed when requested amount equals original

### Actual Behavior

Incremental authorization proceeds even when requested amount equals original

### Steps To Reproduce

Provide an unambiguous set of steps to reproduce this bug. Include code or configuration to reproduce, if relevant.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'


### Context For The Bug

_No response_

### Environment

Are you using hyperswitch hosted version? Yes/No
If yes, please provide the value of the `x-request-id` response header to help us debug your issue.

If not (or if building/running locally), please provide the following details:
1. Operating System or Linux distribution:
2. Rust version (output of `rustc --version`): ``
3. App version (output of `cargo r --features vergen -- --version`): ``


### Have you spent some time checking if this bug has been raised before?

- [x] I checked and didn't find a similar issue

### Have you read the Contributing Guidelines?

- [x] I have read the [Contributing Guidelines](https://github.com/juspay/hyperswitch/blob/main/docs/CONTRIBUTING.md)

### Are you willing to submit a PR?

Yes, I am willing to submit a PR!
diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs
index fc27effefca..b7810310369 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs
@@ -1086,7 +1086,7 @@ impl
             MinorUnit::new(req.request.total_amount),
             req.request.currency,
         )?;
-        let connector_req = stripe::StripeIncrementalAuthRequest { amount };
+        let connector_req = stripe::StripeIncrementalAuthRequest { amount }; // Incremental authorization can be done a maximum of 10 times in Stripe
 
         Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
     }
@@ -1162,7 +1162,8 @@ impl
                 .unwrap_or_else(|| NO_ERROR_CODE.to_string()),
             message: response
                 .error
-                .code
+                .message
+                .clone()
                 .unwrap_or_else(|| NO_ERROR_MESSAGE.to_string()),
             reason: response.error.message.map(|message| {
                 response
diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
index a32f89ef4d3..862fcd8ff18 100644
--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs
@@ -101,7 +101,7 @@ impl<F: Send + Clone + Sync>
 
         // Incremental authorization should be performed on an amount greater than the original authorized amount (in this case, greater than the net_amount which is sent for authorization)
         // request.amount is the total amount that should be authorized in incremental authorization which should be greater than the original authorized amount
-        if payment_attempt.get_total_amount() > request.amount {
+        if payment_attempt.get_total_amount() >= request.amount {
             Err(errors::ApiErrorResponse::PreconditionFailed {
                 message: "Amount should be greater than original authorized amount".to_owned(),
             })?

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

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

Closes these issues - 
[Issue 1](https://github.com/juspay/hyperswitch/issues/9003)
[Issue 2](https://github.com/juspay/hyperswitch/issues/9004)

## Description
<!-- Describe your changes in detail -->

Populated Error Message in Incremental Authorization Flow. Added check for same amount in incremental authorization requests.

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

Postman Test

1. Payments - Create

Request:

```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data-raw '{
    "amount": 6500,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6500,
    "customer_id": "StripeCustomer",
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+65",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "billing": {
        "address": {
            "first_name": "John",
            "last_name": "Doe",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US"
        }
    },
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "4242424242424242",  
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "737"
        }
    },
    "browser_info": {
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "language": "nl-NL",
        "color_depth": 24,
        "screen_height": 723,
        "screen_width": 1536,
        "time_zone": 0,
        "java_enabled": true,
        "java_script_enabled": true,
        "ip_address": "127.0.0.1"
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "John",
            "last_name": "Doe"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2025-07-25T11:46:12Z"
    },
    "request_incremental_authorization": true
}'
```

Response:

```
{
    "payment_id": "pay_fXzLwsUeDagw7Cdyp8Sh",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6500,
    "net_amount": 6500,
    "shipping_cost": null,
    "amount_capturable": 6500,
    "amount_received": 0,
    "connector": "stripe",
    "client_secret": "pay_fXzLwsUeDagw7Cdyp8Sh_secret_Uoa82RaRfj6xcV3MnUtO",
    "created": "2025-08-20T12:16:31.560Z",
    "currency": "USD",
    "customer_id": "StripeCustomer",
    "customer": {
        "id": "StripeCustomer",
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "US",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "California",
            "first_name": "John",
            "last_name": "Doe"
        },
        "phone": null,
        "email": null
    },
    "order_details": null,
    "email": "abcdef123@gmail.com",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "StripeCustomer",
        "created_at": 1755692191,
        "expires": 1755695791,
        "secret": "epk_c558a24e699a4b9db808d953a8df38f5"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pi_3RyAwOE9cSvqiivY17rwXSCJ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T12:31:31.560Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T12:16:32.579Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null
}
```

2. Payments - Incremental Authorization (with same amount)

Request:

```
curl --location 'http://localhost:8080/payments/pay_fXzLwsUeDagw7Cdyp8Sh/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6500
}'
```

Response:

```
{
    "error": {
        "type": "invalid_request",
        "message": "Amount should be greater than original authorized amount",
        "code": "IR_16"
    }
}
```

3. Payments - Incremental Authorization (exceeding the maximum amount of time the flow can be called in Stripe)

Request:

```
curl --location 'http://localhost:8080/payments/pay_gIQKmooikg2npSvaM9xZ/incremental_authorization' \
--header 'Content-Type: application/json' \
--header 'api-key: dev_jVOnDLj6Q2nOHSSL8NIMQUws6P8WIRE9QNZ6toLt4gB7DqXuObIkVwPiXLJsY16n' \
--data '{
  "amount": 6511
}'
```

Response:

```
{
    "payment_id": "pay_gIQKmooikg2npSvaM9xZ",
    "merchant_id": "merchant_1755689870",
    "status": "requires_capture",
    "amount": 6510,
    "net_amount": 6510,
    "shipping_cost": null,
    "amount_capturable": 6510,
    "amount_received": null,
    "connector": "stripe",
    "client_secret": "pay_gIQKmooikg2npSvaM9xZ_secret_cmcrBTpMQL6Prbvudezo",
    "created": "2025-08-20T13:28:31.692Z",
    "currency": "USD",
    "customer_id": null,
    "customer": {
        "id": null,
        "name": "John Doe",
        "email": "abcdef123@gmail.com",
        "phone": "999999999",
        "phone_country_code": "+65"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": null,
    "mandate_data": null,
    "setup_future_usage": null,
    "off_session": null,
    "capture_on": null,
    "capture_method": "manual",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "4242",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "424242",
            "card_extended_bin": null,
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "payment_checks": {
                "cvc_check": "pass",
                "address_line1_check": "pass",
                "address_postal_code_check": "pass"
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": "https://duck.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "credit",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "frm_message": null,
    "metadata": {
        "udf1": "value1",
        "login_date": "2025-07-25T11:46:12Z",
        "new_customer": "true"
    },
    "connector_metadata": null,
    "feature_metadata": {
        "redirect_response": null,
        "search_tags": null,
        "apple_pay_recurring_details": null,
        "gateway_system": "direct"
    },
    "reference_id": "pi_3RyC44E9cSvqiivY14N3VxbQ",
    "payment_link": null,
    "profile_id": "pro_PMx2Y9TaHmSY8wUiC8kP",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_7VMxMHsmscuHwnVdYZPE",
    "incremental_authorization_allowed": true,
    "authorization_count": 11,
    "incremental_authorizations": [
        {
            "authorization_id": "auth_RI9tMBRwaju7LpkDhNrT_1",
            "amount": 6501,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6500
        },
        {
            "authorization_id": "auth_BoyLq9eHomflrMn5f2kD_2",
            "amount": 6502,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6501
        },
        {
            "authorization_id": "auth_LZZQWDEHw57lbLcqqKv2_3",
            "amount": 6503,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6502
        },
        {
            "authorization_id": "auth_RQeNDy0sdQnaLEW7f4Rm_4",
            "amount": 6504,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6503
        },
        {
            "authorization_id": "auth_2MRj0ANmGIW6BvFARHAe_5",
            "amount": 6505,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6504
        },
        {
            "authorization_id": "auth_egVuyLWfl6jGIZKdgLrt_6",
            "amount": 6506,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6505
        },
        {
            "authorization_id": "auth_M33NayFU2GQicIGYMMkU_7",
            "amount": 6507,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6506
        },
        {
            "authorization_id": "auth_UHtSahoOk1wVd8yacnJx_8",
            "amount": 6508,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6507
        },
        {
            "authorization_id": "auth_IejW3q4wdP5LcRouVvGs_9",
            "amount": 6509,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6508
        },
        {
            "authorization_id": "auth_sZNDStbUEPdqMMEZMlOV_10",
            "amount": 6510,
            "status": "success",
            "error_code": null,
            "error_message": null,
            "previously_authorized_amount": 6509
        },
        {
            "authorization_id": "auth_33dxNtWv6DiOdu3kGC4l_11",
            "amount": 6511,
            "status": "failure",
            "error_code": "No error code",
            "error_message": "The PaymentIntent has reached the maximum number of 10 allowed increments and cannot be incremented further.",
            "previously_authorized_amount": 6510
        }
    ],
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2025-08-20T13:43:31.691Z",
    "fingerprint": null,
    "browser_info": {
        "language": "nl-NL",
        "time_zone": 0,
        "ip_address": "127.0.0.1",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
        "color_depth": 24,
        "java_enabled": true,
        "screen_width": 1536,
        "accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "screen_height": 723,
        "java_script_enabled": true
    },
    "payment_channel": null,
    "payment_method_id": null,
    "network_transaction_id": null,
    "payment_method_status": null,
    "updated": "2025-08-20T13:29:27.355Z",
    "split_payments": null,
    "frm_metadata": null,
    "extended_authorization_applied": null,
    "capture_before": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null,
    "card_discovery": "manual",
    "force_3ds_challenge": false,
    "force_3ds_challenge_trigger": false,
    "issuer_error_code": null,
    "issuer_error_message": null,
    "is_iframe_redirection_enabled": null,
    "whole_connector_response": null,
    "enable_partial_authorization": null
}
```

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