PurpleSoftSrl / sumup_flutter_plugin

A Flutter wrapper to use the SumUp SDK. With this plugin, your app can easily connect to a SumUp terminal, login and accept card payments on Android and iOS.
https://www.purplesoft.io
MIT License
17 stars 17 forks source link

Avoiding app crash when closing bottom page during checkout #14

Closed jacopofranza closed 3 years ago

jacopofranza commented 3 years ago

A "Unexpectedly found nil while unwrapping an Optional value" occur on ex line 79 ("let cardType = resultCard!["type"]") when closing the bottom page during the selection between terminal and link. The updated code just check for a nil on resultCard before try to unwrap it. fix #13

sstasi95 commented 3 years ago

Hi @jacopofranza, thanks for finding the issue and opening this PR.

I noticed that when the payment bottomsheet is dismissed transactionCode is nil, so we can simply check if it's nil and return immediately. In this way we can avoid all the checks that you added on the dart side and keep the code cleaner.

So I'm closing this PR and fixing the issue with another commit.

Simone

itsAyyazdev commented 2 years ago

Still unresolved. Any updates?

sumup/SwiftSumupPlugin.swift:87: Fatal error: Unexpectedly found nil while unwrapping an Optional value