Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use serde_repr for serializing enums as u8 #110

Closed
kos-for-juspay opened this issue Dec 11, 2022 · 0 comments · Fixed by #130
Closed

Use serde_repr for serializing enums as u8 #110

kos-for-juspay opened this issue Dec 11, 2022 · 0 comments · Fixed by #130
Labels
C-refactor Category: Refactor E-easy Effort: Should be easy to implement and would make a good first PR P-low Priority: Low

Comments

@kos-for-juspay
Copy link
Contributor

https://github.com/juspay/orca/blob/56d153d8f7c2c75391799cf14280c448df97842f/crates/router/src/connector/authorizedotnet/transformers.rs#L219-L227

Instead of such renaming, it would be more properly to use #[repr(u8)] here:

#[derive(Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum AuthorizedotnetPaymentStatus {
   Approved = 1,
   Declined = 2,
   Error = 3,
   #[default]
   HeldForReview = 4,
}

https://serde.rs/enum-number.html

@kos-for-juspay kos-for-juspay added E-easy Effort: Should be easy to implement and would make a good first PR P-low Priority: Low C-refactor Category: Refactor labels Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-refactor Category: Refactor E-easy Effort: Should be easy to implement and would make a good first PR P-low Priority: Low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant