ezet / stripe-sdk

A simple and flexible Stripe library for Flutter with complete support for SCA and PSD2.
https://pub.dev/packages/stripe_sdk
Other
137 stars 137 forks source link

Ui flow #81

Closed eyoeldefare closed 3 years ago

eyoeldefare commented 3 years ago

This is a sample UI Flow I decided to create that could also potentially benefit others that want to implement it in their app. The majority of the codes I have added are under the folder ui-flow inside the src folder to keep this simple and prevent possible conflicts with your example flutter project.

I have also changed a few minor syntaxes related codes and error handling methods in the stripe.dart file. I realize that there is another pull request to this that would update most of the syntax related warnings so I didn't really change those warnings.

Lastly, I have provided a sample example app named example_uiflow alongside the default example flutter app showing how the flow works and implemented. This example could be with any kind of backend implementation - this particular example uses a sample expressjs server implementation to prove the point.

ezet commented 3 years ago

Thank you for this, I will have to review and test this myself. I am also a bit hesitant to merge it into the core library, as I had intentions of extractng the ui/flutter parts of the library to a separate library, in order to keep the low-level stripe api client as a native dart library. Thoughts ?

eyoeldefare commented 3 years ago

Hi, yeah I think striping out the Flutter UI from the core API integration sounds good to me. It could make it flexible and cleaner to manage and work with.

ezet commented 3 years ago

@eyoeldefare I've been reviewing and testing this PR thoroughly. While I really appreciate your contribution, and I think the example_uiflow serves as a great example, I do not wish to include the ui-flow in the library at this stage. It is too far outside the scope of what I intended this library to be, and would require too much effort and maintenance in the future. If you could re-factor this PR, and move most/all of the logic from ui-flow into the example-uiflow itself, I'd be happy to accept it. You mention that a few classes would need to be changed to work with your ui example, maybe we can look into making those changes instead of creating copies of classes present in the library? If so, please let me know what changes would be required so we can find a fitting solution.

Alternatively I can push this so a separate branch, but I don't think that'll be nearly as useful.

eyoeldefare commented 3 years ago

Hey, I agree with you. My PR was too big and might be outside of this library overall. Don't worry about it. I was going to create this for myself anyways so it wasn't a problem. Keep up the good work. Eyoel