juspay/hyperswitch

[FEATURE] Use the newtype pattern for ZIP/PIN codes

Open

#1,492 opened on Jun 21, 2023

View on GitHub
 (5 comments) (0 reactions) (1 assignee)Rust (42,690 stars) (4,676 forks)batch import
A-frameworkC-featuregood first issuehelp wanted

Description

Feature Description

This issue covers one of the problems mentioned in #119, about using the newtype pattern for zip/pin codes. We want to make sure that the we have valid zip/pin codes by assigning them to a new type...

This newtype should be validated as part of construction & deserialization, can refer to #851 as an example

Please also include unit tests in your PR.

For external contributors, clarify any questions you may have, and let us know that you're interested in picking this up. We'll assign this issue to you to reduce duplication of effort on the same task.

Possible Implementation

You could use a newtype for ZipCode. Also, implement Serialize and Deserialize on these two types.

You can ask about any external libraries that you think should ease this out in the comments

Have you spent some time to check if this feature request has been raised before?

  • I checked and didn't find similar issue

Have you read the Contributing Guidelines?

Are you willing to submit a PR?

None

Contributor guide