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

Refactor all public structs (e.g. Payment) to interfaces with constructors #20

Open
alangalvino opened this issue Nov 24, 2021 · 0 comments

Comments

@alangalvino
Copy link
Contributor

alangalvino commented Nov 24, 2021

Description

It's impossible as of now to have any validation while constructing the public structs (e.g. Payment, Login, etc). For instance, if I wish to have a bool attribute that have the default value true I can't do it. That's because we are using the built-in new function to initialize some public structs.

We should create custom "constructors", e.g., NewPayment(...) as a way to have a better code encapsulation and maintainability. Here are a good reference of how to do it.

⚠️ This is a breaking change on the library.

Evidence

This PR has an example of the mentioned problem around bool default value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant