Issue:
[FEATURE] scheme error code and messages in /payments API response

### Feature Description

If the payment is declined for a card transaction, the card scheme or issuer can send a raw response explaining why. These are the raw acquirer responses which helps in understanding why a card transaction was declined.

Some connectors like Adyen supports this - [reference](https://docs.adyen.com/development-resources/raw-acquirer-responses/#search-modal).

HyperSwitch today sends back `error_code` and `error_message` in the payments API response which are connector's error code and messages. Payments API response has to be extended to send back issuer specific error codes and messages.

### Possible Implementation

Issuer's error code and messages are received in payments API response or through webhooks. Considering this, below steps are to be followed

1. Ensure issuer's error code and messages are sent back from connector integration to core layer in `ErrorResponse`
2. Ensure this is handled in `IncomingWebhook` flows
3. Ensure this is stored in `payment_attempt` table
4. Ensure this is sent back in payments response

##### Changes required

1. Add below fields in `payment_attempt` table
- `issuer_error_code`
- `issuer_error_message`

2. Add below fields to payments API response
- `issuer_error_code`
- `issuer_error_message`

This maintains the existing naming convention. Today, HyperSwitch has -
- `error_code` and `unified_code`
- `error_message` and `unified_message`

### Have you spent some time checking if this feature request 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!

Resolution:
<think>
PR Context:
- Title: feat: scheme error code and messages in payments api response
- Merged: 2025-03-17T15:03:23Z
- Files changed: 30 files
- Commits: 13 commits

Implementation approach:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
This PR introduces -
- Core functionality to read and store raw acquirer responses for `payment` and `refund` operations.
    - Read raw acquirer response from connector integration
    - Store in `PaymentAttempt` and `Refund` tables
- Updates Adyen connector integration to read r
</think>

To implement this, you'll need to modify:


**Detailed Implementation:**


**Commit 1:** feat: scheme error code and messages in payments api response (#7528)
Co-authored-by: hyperswitch-bo
Files to modify:


**crates/api_models/src/payments.rs**
  Modify existing code

**crates/api_models/src/refunds.rs**
  Modify existing code

**crates/diesel_models/src/payment_attempt.rs**
  Modify existing code

**crates/diesel_models/src/refund.rs**
  Modify existing code

**crates/diesel_models/src/schema.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/aci.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/adyen.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/adyen/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/airwallex.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/amazonpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/authorizedotnet/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/bambora.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/bamboraapac.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/bamboraapac/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/bankofamerica.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/bankofamerica/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/billwerk.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/billwerk/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/bitpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/bluesnap.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/boku.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/braintree.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/braintree/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/cashtocode.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/cashtocode/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/chargebee.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/checkout.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/checkout/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/coinbase.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/coingate.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/cryptopay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/cryptopay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/cybersource.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/cybersource/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/datatrans.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/datatrans/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/deutschebank.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/deutschebank/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/dlocal.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/elavon/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/fiserv.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/fiservemea.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/fiuu.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/forte.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/getnet.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/globalpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/globalpay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/globepay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/globepay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/gocardless.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/helcim.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/hipay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/hipay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/iatapay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/iatapay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/inespay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/inespay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/itaubank.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/jpmorgan.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/klarna.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/mifinity.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/mollie.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/moneris.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/multisafepay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/nexinets.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/nexixpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/nomupay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/noon.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/noon/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/novalnet.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/novalnet/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/nuvei/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/opayo.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/opennode.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/paybox.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/paybox/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/payeezy.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/payme.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/payme/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/paypal.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/paystack.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/paystack/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/payu.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/placetopay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/powertranz.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/powertranz/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/prophetpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/prophetpay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/rapyd.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/razorpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/razorpay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/recurly.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/redsys.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/shift4.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/square.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/stax.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/stripebilling.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/taxjar.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/thunes.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/trustpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/trustpay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/tsys/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/volt.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/volt/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/wellsfargo.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/wellsfargo/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/worldpay.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/xendit.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/xendit/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/zen.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/zen/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/zsl.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/connectors/zsl/transformers.rs**
  Modify existing code

**crates/hyperswitch_connectors/src/utils.rs**
  Modify existing code

**crates/hyperswitch_domain_models/src/errors/api_error_response.rs**
  Modify existing code

**crates/hyperswitch_domain_models/src/payments/payment_attempt.rs**
  Modify existing code

**crates/hyperswitch_domain_models/src/router_data.rs**
  Modify existing code

**crates/hyperswitch_interfaces/src/api.rs**
  Modify existing code

**crates/hyperswitch_interfaces/src/connector_integration_v2.rs**
  Modify existing code

**crates/router/src/connector/adyenplatform.rs**
  Modify existing code

**crates/router/src/connector/dummyconnector.rs**
  Modify existing code

**crates/router/src/connector/ebanx.rs**
  Modify existing code

**crates/router/src/connector/gpayments.rs**
  Modify existing code

**crates/router/src/connector/netcetera.rs**
  Modify existing code

**crates/router/src/connector/netcetera/transformers.rs**
  Modify existing code

**crates/router/src/connector/nmi.rs**
  Modify existing code

**crates/router/src/connector/nmi/transformers.rs**
  Modify existing code

**crates/router/src/connector/payone.rs**
  Modify existing code

**crates/router/src/connector/plaid.rs**
  Modify existing code

**crates/router/src/connector/plaid/transformers.rs**
  Modify existing code

**crates/router/src/connector/riskified.rs**
  Modify existing code

**crates/router/src/connector/signifyd.rs**
  Modify existing code

**crates/router/src/connector/stripe.rs**
  Modify existing code

**crates/router/src/connector/stripe/transformers.rs**
  Modify existing code

**crates/router/src/connector/threedsecureio.rs**
  Modify existing code

**crates/router/src/connector/threedsecureio/transformers.rs**
  Modify existing code

**crates/router/src/connector/utils.rs**
  Modify existing code

**crates/router/src/connector/wellsfargopayout.rs**
  Modify existing code

**crates/router/src/connector/wise.rs**
  Modify existing code

**crates/router/src/core/payments/access_token.rs**
  Modify existing code

**crates/router/src/core/payments/operations/payment_response.rs**
  Modify existing code

**crates/router/src/core/payments/retry.rs**
  Modify existing code

**crates/router/src/core/payments/transformers.rs**
  Modify existing code

**crates/router/src/core/payouts/access_token.rs**
  Modify existing code

**crates/router/src/core/refunds.rs**
  Modify existing code

**crates/router/src/db/refund.rs**
  Modify existing code

**crates/router/src/services/api.rs**
  Modify existing code

**crates/router/src/utils.rs**
  Modify existing code

**crates/router/src/workflows/payment_sync.rs**
  Modify existing code

**crates/router/tests/payments.rs**
  Modify existing code

**crates/router/tests/payments2.rs**
  Modify existing code

**crates/storage_impl/src/mock_db/payment_attempt.rs**
  Modify existing code

**crates/storage_impl/src/payments/payment_attempt.rs**
  Modify existing code