juspay/hyperswitch

[ENHANCEMENT]:Add scoped error enums for disputes API

Open

#1,564 opened on Jun 28, 2023

View on GitHub
 (2 comments) (0 reactions) (1 assignee)Rust (42,690 stars) (4,676 forks)batch import
A-disputesA-errorsC-refactorE-mediumgood first issuehelp wanted

Description

We have a set of API endpoints related to handling disputes from the merchant Currently the API's used with this return RouterResponse or ApiErrorResponse

We wanna deprecate ApiErrorResponse and instead use scoped API errors for each API...

Currently this are the errors faced by dispute API...

StorageErrors (we return InternalApiError here)
PaymentNotFound
DisputeStatusValidationFailed
ExternalConnectorError
UpdateFailure (same as storage error or internalservererror)
DisputeFileNotFound
DisputeFileNotAvailable
MissingDisputeId
MissingFilePurpose
MissingFileContentType

These errors returned here should have their own enum via error stack to give better context in terms of scoped errors...

Then these errors could be again. mapped to an appropriate Api Error via the ErrorSwitch trait we already use

Contributor guide