openCardsManager method

  1. @override
Future<bool> openCardsManager({
  1. required FawryLaunchModel launchModel,
  2. required String baseURL,
  3. required String lang,
})
override

Opens the card manager for Fawry payments.

Implementation

@override
Future<bool> openCardsManager({
  required FawryLaunchModel launchModel,
  required String baseURL,
  required String lang,
}) async {
  try {
    // Encode launchModel to JSON and invoke native method
    return await _channel.invokeMethod(_METHOD_CARDS, <String, String>{
      'launchModelJson': json.encode(launchModel),
      'baseURL': baseURL,
      'lang': lang
    });
  } on PlatformException catch (e) {
    // Handle specific platform exceptions
    if (e.code == _ERROR_INIT) {
      throw "Error Occurred: Code: $_ERROR_INIT. Message: ${e.message}. Details: SDK Init Error";
    }
    throw "Error Occurred: Code: ${e.code}. Message: ${e.message}. Details: ${e.details}";
  } catch (e) {
    // Catch any other exceptions
    throw "Error Occurred: Message: $e";
  }
}