feat(payments): add support for connector testing (Adyen) #7874
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This PR adds support for connector testing data in payment requests, specifically for Adyen connector. It allows merchants to send testing values via
connector_metadata
to simulate different scenarios in the sandbox environment.The implementation includes:
AdyenConnectorMetadata
andAdyenTestingData
in the API modelsThe holder_name in testing data will override card_holder_name in the connector's payment request, allowing merchants to test specific scenarios without affecting their production implementation.
Additional Changes
Motivation and Context
Connectors like Adyen provide special values for certain fields that can be used to simulate different error scenarios in their sandbox environments. These special values help merchants test error handling without requiring them to modify their actual implementation.
For example, sending a specific holder name value like "CARD_EXPIRED" can simulate a card expiration error from Adyen.
This feature enables merchants to test various error scenarios in a systematic way through HyperSwitch API without changing their integration code.
How did you test it?
1. Simulate Adyen's CARD_EXPIRED error through testing data in connector_metadata for CIT
cURL
Expectations
Response
2. Simulate Adyen's CARD_EXPIRED error through testing data in connector_metadata for MIT
- Payment succeeds
- payment_method_id is retrieved
- MIT payment fails with the specified error in testing data's holder name field
cURL (for creating mandates)
Expectations
Response
cURL (Simulating error in MIT)
Expectations
Response
Automated cypress tests for Adyen (Ideal bank redirection fails as expected)
Checklist
cargo +nightly fmt --all
cargo clippy