fix: paymentUrls is null (#1786)
Some checks are pending
Cache Dependencies / test (push) Waiting to run

* fix: paymentUrls is null

* feat: potential secure storage error
This commit is contained in:
Rafael 2024-11-09 02:20:06 -03:00 committed by GitHub
parent 389c334f10
commit 8e12fb1ad9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View file

@ -1,4 +1,3 @@
class CakePayOrder {
final String orderId;
final List<OrderCard> cards;

View file

@ -82,10 +82,12 @@ class CakePayService {
}
/// Logout
Future<void> logout(String email) async {
Future<void> logout([String? email]) async {
await secureStorage.delete(key: cakePayUsernameStorageKey);
await secureStorage.delete(key: cakePayUserTokenKey);
await cakePayApi.logoutUser(email: email, apiKey: cakePayApiKey);
if (email != null) {
await cakePayApi.logoutUser(email: email, apiKey: cakePayApiKey);
}
}
/// Purchase Gift Card

View file

@ -258,7 +258,11 @@ class CakePayBuyCardDetailPage extends BasePage {
if (!isLogged) {
Navigator.of(context).pushNamed(Routes.cakePayWelcomePage);
} else {
await cakePayPurchaseViewModel.createOrder();
try {
await cakePayPurchaseViewModel.createOrder();
} catch (_) {
await cakePayPurchaseViewModel.cakePayService.logout();
}
}
}