Issue:
fix(connector): [adyen] handle Webhook reference and object

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [X] Bugfix
- [ ] New feature
- [ ] Enhancement
- [X] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
- Update Psync response handler to consume the incoming webhook response
- Handle Webhook Status Mapping

### 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).
-->
#3977 

## 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)?
-->
For Adyen all the subsequent payments are confirmed via Webhooks, So test Capture, Cancel, Refunds and Wallets payments.
Payment Methods Need to be tested

- Klarna (Manual Capture)
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ooWwJsn2dIWX2JrPdAbV6SYbxVBF5W0LY2ZvWHV2U3F5UXRQdHDAm9zt5q7Hk0HL' \
--data-raw '{
    "amount": 6540,
    "currency": "EUR",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "profile_id": "pro_doSItPZQZBbfoS0iEf81",
    "business_country": "US",
    "payment_method": "pay_later",
    "payment_method_type": "klarna",
    "payment_experience": "redirect_to_url",
    "connector": [
        "adyen"
    ],
    "payment_method_data": {
        "pay_later": {
            "klarna_redirect": {
                "billing_email": "hyperswitch_sdk_demo_id@gmail.com",
                "billing_country": "DE"
            }
        }
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
- Paypal (Manual Capture)
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ooWwJsn2dIWX2JrPdAbV6SYbxVBF5W0LY2ZvWHV2U3F5UXRQdHDAm9zt5q7Hk0HL' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "profile_id": "pro_doSItPZQZBbfoS0iEf81",
    "business_country": "US",
    "payment_method": "wallet",
    "payment_method_type": "paypal",
    "payment_method_data": {
        "wallet": {
            "paypal_redirect": {}
        }
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
- Cards (Automatic and Manual)
```
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_ooWwJsn2dIWX2JrPdAbV6SYbxVBF5W0LY2ZvWHV2U3F5UXRQdHDAm9zt5q7Hk0HL' \
--data-raw '{
    "amount": 6540,
    "currency": "USD",
    "confirm": true,
    "capture_method": "manual",
    "capture_on": "2022-09-10T10:11:12Z",
    "amount_to_capture": 6540,
    "customer_id": "StripeCustomer",
    "email": "guest@example.com",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://duck.com",
    "profile_id": "pro_doSItPZQZBbfoS0iEf81",
    "business_country": "US",
    "payment_method": "card",
    "payment_method_type": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "371449635398431",
            "card_exp_month": "03",
            "card_exp_year": "2030",
            "card_holder_name": "joseph Doe",
            "card_cvc": "7373"
        }
    },
    "routing": {
        "type": "single",
        "data": "adyen"
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "DE",
            "first_name": "PiX"
        }
    },
    "shipping": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "California",
            "zip": "94122",
            "country": "US",
            "first_name": "PiX"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "metadata": {
        "udf1": "value1",
        "new_customer": "true",
        "login_date": "2019-09-10T10:11:12Z"
    }
}'
```
- ideal (Automatic Capture)
```
**Confirm Call:**
{
    "client_secret": "{{client_secret}}",
    "payment_method": "bank_redirect",
    "payment_method_type": "ideal",
    "payment_method_data": {
        "bank_redirect": {
            "ideal": {
                "billing_details": {
                    "billing_name": "John Doe"
                },
                "bank_name": "n26",
                "preferred_language": "en",
                "country": "NL"
            }
        }
    },
    "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"
    }
}
```
- Do any of the operation `REFUND, CANCEL, CAPTURE`
- Wait for Configured webhooks
- Do a sync for Success Scenario


**Outgoing Webhooks Example**

- Charged
<details><summary> Cards </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/47c3d2c1-3e13-4490-b54a-220ce4fe3873">
</details> 

<details><summary> Paypal </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/e4b32b2e-152a-4f75-8559-8e26994528d6">
</details> 

<details><summary> Klarna </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/62851be5-2b37-4d18-933c-cec2f956a6d8">
</details> 

<details><summary> Ideal </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/dec43f75-4859-43fe-a296-3a76362ec144">
</details> 


- Authorized
<details><summary> Cards </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/6163f6fc-59ad-45da-86ee-9f847b5db5de">
</details> 

<details><summary> Paypal </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/94a1b125-06c1-4f47-9feb-37c551581bcf">
</details> 

<details><summary> Klarna </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/1875945d-e76c-43b8-9597-8dd9b89f7e76">
</details> 
<details><summary> Cancelled </summary>
<img src = "https://github.com/juspay/hyperswitch/assets/55536657/1f24c3de-5e1a-4f13-aa72-4ac2f74b2a86">
</details> 
<details><summary> Captured </summary>
<img src = "(https://github.com/juspay/hyperswitch/assets/55536657/e5d83e48-b70e-46f3-a815-6278878831a7">
</details> 
<details><summary> Refunded </summary>
<img src = "(https://github.com/juspay/hyperswitch/assets/55536657/fef683dd-b4e2-498a-bc9a-6ef32206ef6c">
</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
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable

Resolution:
<think>
PR Context:
- Title: fix(connector): [adyen] handle Webhook reference and object
- Merged: 2024-03-13T09:34:31Z
- Files changed: 4 files
- Commits: 3 commits

Implementation approach:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [X] Bugfix
- [ ] New feature
- [ ] Enhancement
- [X] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
- Update Psync response handler to consume the incoming webhook response
- Handle Webhook Status Mapping

### Additional Changes

- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [x] This PR modifies 
</think>

To implement this, you'll need to modify:


**Detailed Implementation:**


**Commit 1:** fix(connector): [adyen] handle Webhook reference and object (#4062)
Files to modify:


**crates/router/src/connector/adyen.rs**
  Add:
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response
    - function: private::get_5xx_error_response

**crates/router/src/connector/adyen/transformers.rs**
  Remove:
    - impl: impl TryFrom<(&api::PayLaterData, Option<api_enums::CountryAlpha2>)> for value
  Add:
    - function: private::foreign_try_from
    - function: private::build_shopper_reference
    - function: pub::check_required_field
    - impl: impl ForeignTryFrom<(bool, AdyenWebhookStatus)> for storage_enums::AttemptStatus
    - impl: impl TryFrom<(
        &api::PayLaterData,
        &Option<api_enums::CountryAlpha2>,
        &Option<Email>,
        &Option<String>,
        &Option<ShopperName>,
        &Option<Secret<String>>,
        &Option<Address>,
        &Option<Address>,
    )> for (
            pay_later_data,
            country_code,
            shopper_email,
            shopper_reference,
            shopper_name,
            telephone_number,
            billing_address,
            delivery_address,
        )