Skip to content

Commit

Permalink
fix: paymentUrls is null (#1786)
Browse files Browse the repository at this point in the history
* fix: paymentUrls is null

* feat: potential secure storage error
  • Loading branch information
rafael-xmr authored Nov 9, 2024
1 parent 389c334 commit 8e12fb1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/cake_pay/cake_pay_order.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class CakePayOrder {
final String orderId;
final List<OrderCard> cards;
Expand Down
6 changes: 4 additions & 2 deletions lib/cake_pay/cake_pay_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down

0 comments on commit 8e12fb1

Please sign in to comment.