diff --git a/example/lib/model/cart_model.dart b/example/lib/model/cart_model.dart index 6f44731..4ef9bc4 100644 --- a/example/lib/model/cart_model.dart +++ b/example/lib/model/cart_model.dart @@ -32,7 +32,6 @@ class Cart { Map toMap() { return { - 'productId': productId, 'productName': productName, 'initialPrice': initialPrice, diff --git a/lib/chapawebview.dart b/lib/chapawebview.dart index 23185bf..309a692 100644 --- a/lib/chapawebview.dart +++ b/lib/chapawebview.dart @@ -68,7 +68,7 @@ class _ChapaWebViewState extends State { } void handleConnectivityChange(List result) { - if (result == ConnectivityResult.none) { + if (result.contains(ConnectivityResult.none)) { setState(() { isOffline = true; }); diff --git a/lib/data/model/response/api_response.dart b/lib/data/model/response/api_response.dart index 363f6ea..4dbe1f8 100644 --- a/lib/data/model/response/api_response.dart +++ b/lib/data/model/response/api_response.dart @@ -55,7 +55,8 @@ class ApiResponse { break; case 401: try { - message = body is Map ? body['message'] ?? "Unauthorized" : "Unauthorized"; + message = + body is Map ? body['message'] ?? "Unauthorized" : "Unauthorized"; errors.add(message); } catch (error) { errors.add("Unauthorized"); @@ -67,14 +68,18 @@ class ApiResponse { break; case 429: try { - message = body is Map ? body['message'] ?? "Too many requests" : "Too many requests"; + message = body is Map + ? body['message'] ?? "Too many requests" + : "Too many requests"; errors.add(message); } catch (error) { errors.add("Too many requests"); } break; default: - message = body is Map ? body["message"] ?? "Something went wrong." : "Something went wrong."; + message = body is Map + ? body["message"] ?? "Something went wrong." + : "Something went wrong."; break; } diff --git a/lib/domain/constants/extentions.dart b/lib/domain/constants/extentions.dart index 5c0efe4..7a66133 100644 --- a/lib/domain/constants/extentions.dart +++ b/lib/domain/constants/extentions.dart @@ -35,7 +35,8 @@ extension PaymentTypeExtension on LocalPaymentMethods { /// Returns the `VerificationType` associated with the payment method. VerificationType verificationType() { - return VerificationType.ussd; // All methods default to USSD in this implementation. + return VerificationType + .ussd; // All methods default to USSD in this implementation. } /// Returns the icon path for the payment method. @@ -91,7 +92,8 @@ extension StringExtension on String { case "pending": return PaymentStatus.pending; default: - return PaymentStatus.pending; // Defaults to pending in this implementation. + return PaymentStatus + .pending; // Defaults to pending in this implementation. } } } diff --git a/lib/features/native-checkout/bloc/chapa_native_checkout_event.dart b/lib/features/native-checkout/bloc/chapa_native_checkout_event.dart index c0f8da0..9125b32 100644 --- a/lib/features/native-checkout/bloc/chapa_native_checkout_event.dart +++ b/lib/features/native-checkout/bloc/chapa_native_checkout_event.dart @@ -6,13 +6,12 @@ sealed class ChapaNativeCheckoutEvent {} // ignore: must_be_immutable /// Event triggered to initiate the payment process. -/// +/// /// Contains the payment request data and the public key required for the payment. class InitiatePayment extends ChapaNativeCheckoutEvent { - /// The request data needed to initialize a direct charge payment. final DirectChargeRequest directChargeRequest; - + /// The public key used to authenticate the payment request with the Chapa API. final String publicKey; @@ -28,19 +27,18 @@ class InitiatePayment extends ChapaNativeCheckoutEvent { // ignore: must_be_immutable /// Event triggered to validate a payment after initiation. -/// +/// /// Contains the request data to verify the payment status and the public key. class ValidatePayment extends ChapaNativeCheckoutEvent { - /// The request data needed to validate the direct charge payment. final ValidateDirectChargeRequest validateDirectChargeRequest; - + /// The public key used to authenticate the payment validation with the Chapa API. final String publicKey; /// Constructor for the [ValidatePayment] event. /// - /// [validateDirectChargeRequest]: The request object containing reference and + /// [validateDirectChargeRequest]: The request object containing reference and /// other details to validate the payment. /// [publicKey]: The public key used for authentication with the Chapa API. ValidatePayment({