Issue:
Bug: refactor(adyen): Use enums instead of strings for statuses



As of now, we use string literals for matching on status codes returned by Adyen. They need to be replaced by enums instead.

3 instances I could find are:

https://github.com/juspay/orca/blob/7348d76cad8f52548f84c6a606fb177e7ca3620e/crates/router/src/connector/adyen/transformers.rs#L431-L435

https://github.com/juspay/orca/blob/7348d76cad8f52548f84c6a606fb177e7ca3620e/crates/router/src/connector/adyen/transformers.rs#L470-L476

https://github.com/juspay/orca/blob/7348d76cad8f52548f84c6a606fb177e7ca3620e/crates/router/src/connector/adyen/transformers.rs#L684-L701

Maybe even this:

https://github.com/juspay/orca/blob/7348d76cad8f52548f84c6a606fb177e7ca3620e/crates/router/src/connector/adyen.rs#L601-L604

Any other similar usages of strings for status codes must be addressed.

If you're interested in picking it up, assign this issue to yourself, or if you don't have access, let me know and I'll assign it to you.

Pull request description:
Fixes #262

## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates

## Description
Used enums instead of strings for statuses for Adyen.





## 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 its an obvious bug or documentation fix
that will have little conversation).
-->


## 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)?
-->


## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed submitted code
- [ ] I added unit tests for my changes where possible
- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable


Testing:

Patch:
diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs
index cd0bf7ffd52..b0d3e5acd34 100644
--- a/crates/router/src/connector/adyen/transformers.rs
+++ b/crates/router/src/connector/adyen/transformers.rs
@@ -73,6 +73,25 @@ struct AdyenBrowserInfo {
     java_enabled: bool,
 }
 
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub enum AdyenStatus {
+    Authorised,
+    Refused,
+    Cancelled,
+    RedirectShopper,
+}
+
+impl From<AdyenStatus> for storage_enums::AttemptStatus {
+    fn from(item: AdyenStatus) -> Self {
+        match item {
+            AdyenStatus::Authorised => Self::Charged,
+            AdyenStatus::Refused => Self::Failure,
+            AdyenStatus::Cancelled => Self::Voided,
+            AdyenStatus::RedirectShopper => Self::AuthenticationPending,
+        }
+    }
+}
+
 #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
 pub struct AdyenRedirectRequest {
     pub details: AdyenRedirectRequestTypes,
@@ -105,7 +124,7 @@ pub struct AdyenThreeDS {
     pub result_code: Option<String>,
 }
 
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Deserialize)]
 #[serde(untagged)]
 pub enum AdyenPaymentResponse {
     AdyenResponse(AdyenResponse),
@@ -116,17 +135,17 @@ pub enum AdyenPaymentResponse {
 #[serde(rename_all = "camelCase")]
 pub struct AdyenResponse {
     psp_reference: String,
-    result_code: String,
+    result_code: AdyenStatus,
     amount: Option<Amount>,
     merchant_reference: String,
     refusal_reason: Option<String>,
     refusal_reason_code: Option<String>,
 }
 
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Deserialize)]
 #[serde(rename_all = "camelCase")]
 pub struct AdyenRedirectionResponse {
-    result_code: String,
+    result_code: AdyenStatus,
     action: AdyenRedirectionAction,
     refusal_reason: Option<String>,
     refusal_reason_code: Option<String>,
@@ -455,16 +474,15 @@ pub fn get_adyen_response(
     ),
     errors::ParsingError,
 > {
-    let result = response.result_code;
-    let status = match result.as_str() {
-        "Authorised" => {
+    let status = match response.result_code {
+        AdyenStatus::Authorised => {
             if is_capture_manual {
                 storage_enums::AttemptStatus::Authorized
             } else {
                 storage_enums::AttemptStatus::Charged
             }
         }
-        "Refused" => storage_enums::AttemptStatus::Failure,
+        AdyenStatus::Refused => storage_enums::AttemptStatus::Failure,
         _ => storage_enums::AttemptStatus::Pending,
     };
     let error = if response.refusal_reason.is_some() || response.refusal_reason_code.is_some() {
@@ -501,14 +519,7 @@ pub fn get_redirection_response(
     ),
     errors::ParsingError,
 > {
-    let result = response.result_code;
-    let status = match result.as_str() {
-        "Authorised" => storage_enums::AttemptStatus::Charged,
-        "Refused" => storage_enums::AttemptStatus::Failure,
-        "Cancelled" => storage_enums::AttemptStatus::Failure,
-        "RedirectShopper" => storage_enums::AttemptStatus::AuthenticationPending,
-        _ => storage_enums::AttemptStatus::Pending,
-    };
+    let status = response.result_code.into();
 
     let error = if response.refusal_reason.is_some() || response.refusal_reason_code.is_some() {
         Some(types::ErrorResponse {
@@ -795,10 +806,10 @@ impl From<AdyenNotificationRequestItemWH> for AdyenResponse {
         Self {
             psp_reference: notif.psp_reference,
             merchant_reference: notif.merchant_reference,
-            result_code: String::from(match notif.success.as_str() {
-                "true" => "Authorised",
-                _ => "Refused",
-            }),
+            result_code: match notif.success.as_str() {
+                "true" => AdyenStatus::Authorised,
+                _ => AdyenStatus::Refused,
+            },
             amount: Some(Amount {
                 value: notif.amount.value,
                 currency: notif.amount.currency,