Bug: [BUG] Worldpay redirection flow stuck in endless DDC submission loop



### Bug Description

Worldpay's redirection flow (3DS cards) is stuck in an endless loop of submit DDC form.

This is happening for special cases where payment IDs contain non alphanumeric characters. For example - 100000091279-518099-3202453221111

#### Why does this happen?
After DDC, the data needs to be submitted to WP which returns a collectionReference, which is passed on to the next step of HS - CompleteAuthorize. At this step, there is a regex which handles updating the redirectUrl from `/payments/redirect/PAYMENT_ID/MID/PAYMENT_ATTEMPT_ID` to `/payments/PAYMENT_ID/MID/redirect/complete/worldpay`.

This regex considers only alphanumeric values for payment ID and merchant ID, leading to forming the same URL again, and submitting the same URL, and eventually getting stuck in a loop.

### Expected Behavior

After DDC submission, the redirection should happen to /redirect/complete for invoking the CompleteAuthorize flow

### Actual Behavior

After DDC submission, this step is stuck in an endless loop.

### Steps To Reproduce

1. Create a payment with non alphanumeric characters in the payment ID (auth_type: 3DS)
2. Open the redirection URL


### 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/router/src/services/api.rs b/crates/router/src/services/api.rs
index 3fef01a8c21..4bc57cfdaa8 100644
--- a/crates/router/src/services/api.rs
+++ b/crates/router/src/services/api.rs
@@ -1733,7 +1733,7 @@ pub fn build_redirection_form(
                         (PreEscaped(format!(
                             r#"
                                 function submitCollectionReference(collectionReference) {{
-                                    var redirectPathname = window.location.pathname.replace(/payments\/redirect\/(\w+)\/(\w+)\/\w+/, "payments/$1/$2/redirect/complete/worldpay");
+                                    var redirectPathname = window.location.pathname.replace(/payments\/redirect\/([^\/]+)\/([^\/]+)\/[^\/]+/, "payments/$1/$2/redirect/complete/worldpay");
                                     var redirectUrl = window.location.origin + redirectPathname;
                                     try {{
                                         if (typeof collectionReference === "string" && collectionReference.length > 0) {{
@@ -1746,7 +1746,7 @@ pub fn build_redirection_form(
                                             input.value = collectionReference;
                                             form.appendChild(input);
                                             document.body.appendChild(form);
-                                            form.submit();;
+                                            form.submit();
                                         }} else {{
                                             window.location.replace(redirectUrl);
                                         }}

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

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

## Description
This PR updates the regex used for forming the CompleteAuthorize URL for Worldpay post DDC submission.
Change made - the regex is updated to match any character except `/` for matching the query parameters. Earlier `/w` was being used which matched only the alphanumeric characters and underscore.

Defined in https://github.com/juspay/hyperswitch/issues/8025

### 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
Fixes the 3DS flows for Worldpay connector where consumers send the payment IDs (which may include non alphanumeric characters)

## How did you test it?
Steps for testing -

<details>
    <summary>1. Create a payment with non alphanumeric characters in payment ID</summary>

cURL

    curl --location --request POST 'http://localhost:8080/payments' \
        --header 'Content-Type: application/json' \
        --header 'Accept: application/json' \
        --header 'api-key: dev_TnDKeLU9mvDKwpEbzt1wd69xKW9drPRLLSjrsd9lnrF9WlaYI9Fxb38mBT9lGgF1' \
        --data-raw '{"amount":10000,"payment_id":"pay-93bd1c5d-daad-4b28-9968-a3312fe6a83d","currency":"EUR","confirm":true,"profile_id":"pro_4VVXVGE88DgoRaP6ynQI","capture_method":"automatic","capture_on":"2022-09-10T10:11:12Z","authentication_type":"three_ds","customer_id":"cus_Wz8ND2QMGUTQCZBgO4Jx","email":"abc@example.com","return_url":"https://google.com","payment_method":"card","payment_method_type":"debit","payment_method_data":{"card":{"card_number":"4000000000002503","card_exp_month":"12","card_exp_year":"2028","card_holder_name":"John Doe","card_cvc":"829"}},"metadata":{"Force-PSP":"Adyen","udf1":"value1","new_customer":"true","login_date":"2019-09-10T10:11:12Z"},"browser_info":{"user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","language":"en-US","color_depth":32,"screen_height":1117,"screen_width":1728,"time_zone":-330,"java_enabled":true,"java_script_enabled":true,"ip_address":"127.0.0.1"},"customer_acceptance":{"acceptance_type":"online","accepted_at":"1963-05-03T04:07:52.723Z","online":{"ip_address":"127.0.0.1","user_agent":"amet irure esse"}},"connector_metadata":{"adyen":{"testing":{}}},"session_expiry":60}'

Response

    {"payment_id":"pay-70b37ad5-dff2-447f-aa35-3638ee8f49a2","merchant_id":"merchant_1747207118","status":"requires_customer_action","amount":10000,"net_amount":10000,"shipping_cost":null,"amount_capturable":10000,"amount_received":null,"connector":"worldpay","client_secret":"pay-70b37ad5-dff2-447f-aa35-3638ee8f49a2_secret_yHFganGnHhl61BLGOu7t","created":"2025-05-14T10:46:44.551Z","currency":"EUR","customer_id":"cus_Wz8ND2QMGUTQCZBgO4Jx","customer":{"id":"cus_Wz8ND2QMGUTQCZBgO4Jx","name":null,"email":"abc@example.com","phone":null,"phone_country_code":null},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":null,"off_session":null,"capture_on":null,"capture_method":"automatic","payment_method":"card","payment_method_data":{"card":{"last4":"2503","card_type":"CREDIT","card_network":"Visa","card_issuer":"INTL HDQTRS-CENTER OWNED","card_issuing_country":"UNITEDSTATES","card_isin":"400000","card_extended_bin":null,"card_exp_month":"12","card_exp_year":"2028","card_holder_name":"John Doe","payment_checks":null,"authentication_data":null},"billing":null},"payment_token":null,"shipping":null,"billing":null,"order_details":null,"email":"abc@example.com","name":null,"phone":null,"return_url":"https://google.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":{"type":"redirect_to_url","redirect_to_url":"http://localhost:8080/payments/redirect/pay-70b37ad5-dff2-447f-aa35-3638ee8f49a2/merchant_1747207118/pay-70b37ad5-dff2-447f-aa35-3638ee8f49a2_1"},"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":"cus_Wz8ND2QMGUTQCZBgO4Jx","created_at":1747219604,"expires":1747223204,"secret":"epk_87fd2e1ca6d4420cb2d9b1be49aac61c"},"manual_retry_allowed":null,"connector_transaction_id":"eyJrIjoxLCJkIjoidjh4TDNMbk9jNGJyeVhHeVJlRVN6TXV6VDl2SlBrRzBSSE9VZ09JVWxjNFB4MFNVUVlGVEpHS1ZPTGZnaXZnK0M2QUZSRzROQnJmZU12dXl6T3ZqOWc9PSJ9_1","frm_message":null,"metadata":{"udf1":"value1","Force-PSP":"Adyen","login_date":"2019-09-10T10:11:12Z","new_customer":"true"},"connector_metadata":{"apple_pay":null,"airwallex":null,"noon":null,"braintree":null,"adyen":{"testing":{"holder_name":null}}},"feature_metadata":null,"reference_id":"47d77e52-3bf1-457d-b32f-2b64671269b3","payment_link":null,"profile_id":"pro_4VVXVGE88DgoRaP6ynQI","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_R9QZT88xlIImFvkbzRjS","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-05-14T10:47:44.551Z","fingerprint":null,"browser_info":{"language":"en-US","time_zone":-330,"ip_address":"127.0.0.1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","color_depth":32,"java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"java_script_enabled":true},"payment_method_id":null,"payment_method_status":null,"updated":"2025-05-14T10:46:45.055Z","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}

</details>

2. Proceed with the payment

<details>
    <summary>3. Retrieve the payment</summary>

cURL

    curl --location --request GET 'http://localhost:8080/payments/pay-70b37ad5-dff2-447f-aa35-3638ee8f49a2?force_sync=true' \
        --header 'Accept: application/json' \
        --header 'api-key: snd_TyCUg91YvGEf7k0FZjoyx3rIiH8RuP3H051L38LFsaBOyFC2DzoV112sVcLcOIju'

Response

    {"payment_id":"pay_rXpDVF7rBTlK81BLCk78","merchant_id":"merchant_1681193734270","status":"succeeded","amount":1000,"net_amount":1000,"shipping_cost":null,"amount_capturable":0,"amount_received":1000,"connector":"novalnet","client_secret":"pay_rXpDVF7rBTlK81BLCk78_secret_jYyGNnraiAbHZflZ1cUe","created":"2025-05-14T08:30:16.439Z","currency":"EUR","customer_id":"cus_zBM97pQlSjmFTtTZlXnn","customer":{"id":"cus_zBM97pQlSjmFTtTZlXnn","name":"John Nether","email":"abc@example.com","phone":"6168205362","phone_country_code":"+1"},"description":null,"refunds":null,"disputes":null,"mandate_id":null,"mandate_data":null,"setup_future_usage":"off_session","off_session":null,"capture_on":null,"capture_method":null,"payment_method":"wallet","payment_method_data":{"wallet":{},"billing":null},"payment_token":null,"shipping":null,"billing":{"address":null,"phone":null,"email":"random@juspay.in"},"order_details":null,"email":"abc@example.com","name":"John Nether","phone":"6168205362","return_url":"https://www.example.com/","authentication_type":"three_ds","statement_descriptor_name":null,"statement_descriptor_suffix":null,"next_action":null,"cancellation_reason":null,"error_code":null,"error_message":null,"unified_code":null,"unified_message":null,"payment_experience":"redirect_to_url","payment_method_type":"paypal","connector_label":null,"business_country":null,"business_label":null,"business_sub_label":null,"allowed_payment_method_types":null,"ephemeral_key":null,"manual_retry_allowed":false,"connector_transaction_id":"15185400044502956","frm_message":null,"metadata":null,"connector_metadata":null,"feature_metadata":null,"reference_id":"15185400044502956","payment_link":{"link":"https://gdpp-dev.zurich.com/payment_link/merchant_1681193734270/pay_rXpDVF7rBTlK81BLCk78?locale=en","secure_link":"https://gdpp-dev.zurich.com/payment_link/s/merchant_1681193734270/pay_rXpDVF7rBTlK81BLCk78?locale=en","payment_link_id":"plink_Rth6buCuxL0WM34L3ZgE"},"profile_id":"pro_E7pM8kGERopEKEhqwfWQ","surcharge_details":null,"attempt_count":1,"merchant_decision":null,"merchant_connector_id":"mca_76uMkQC2ErtAXZ3zTMXT","incremental_authorization_allowed":null,"authorization_count":null,"incremental_authorizations":null,"external_authentication_details":null,"external_3ds_authentication_attempted":false,"expires_on":"2025-05-14T08:45:16.436Z","fingerprint":null,"browser_info":{"os_type":"macOS","language":"en-US","time_zone":-330,"ip_address":"122.172.83.222","os_version":"10.15.7","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Safari/605.1.15","color_depth":24,"device_model":"Macintosh","java_enabled":true,"screen_width":1728,"accept_header":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8","screen_height":1117,"accept_language":"en","java_script_enabled":true},"payment_method_id":"pm_EHYfLI1wWenwsVsIC5P3","payment_method_status":"active","updated":"2025-05-14T08:30:45.990Z","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":null,"force_3ds_challenge":false,"force_3ds_challenge_trigger":false,"issuer_error_code":null,"issuer_error_message":null}

</details>

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