Adyen / adyen-flutter

MIT License
23 stars 4 forks source link

resultCode from PaymentSessionFinished should be an enum #154

Closed Cteq3132 closed 3 months ago

Cteq3132 commented 4 months ago

The resultCode field of the class PaymentSessionFinished is currently a String. Given that the native object it comes from are enums (e.g. SessionPaymentResultCode in Swift), why not keep it as an enum on the Flutter side?

This can lead to critical bugs in the event of a change in the native implementations... In my opinion, the Flutter wrapper MUST carry the logic of transforming the native enum to an exposed Flutter enum, this is a must have to avoid critical bugs in the future.

Robert-SD commented 4 months ago

Hi @Cteq3132, thank you for suggesting the improvement of replacing the result code String with an enum. The decision for using a String was made to be more flexible, but we agree that the SDK should expose an enum and carry the logic of mapping the result code accordingly. As you outlined, it will be indeed less error prone in case the native implementation changes.

We put the adjustment on our agenda and our plan is to introduce an enum with the first beta release. We would like to keep this thread open for further discussions and we will keep you updated. Thanks again for the idea!