Open erayerdin opened 2 years ago
sounds good, instead of one to one translation of java client, that would be better, i think for doing that with derive_builder crate would be easier
didn't know that this existed.
if you are ok with it, i can start with implementation.
i'm asking this because it is a breaking change to your api, methods (with their names) will change.
i'm ok with it, we can bump the version when merging to master.
Rationale
This library is currently using setters to construct various types such as
Options
,CreatePaymentRequest
,PaymentCard
,Buyer
etc. This has some drawbacks:Instead of setter methods, factory pattern would be a better approach to handle:
This pattern is utilized in various libraries such as request construction in reqwest or server construction in rocket and actix.
Examples
Taking the example in README file, it would look like this with factory pattern:
The below is a much more declarative example:
If you'd like, I can work on this and provide it as a PR.