getMe method

  1. @override
Future<Merchant> getMe()
override

Info about the current Merchant.

Throw UnauthorizedException when the secret key is invalid, otherwise it throws exception TelePayException with any other error.

Implementation

@override
Future<Merchant> getMe() async {
  try {
    final response = await _dio.get<Map<String, dynamic>>(
      'getMe',
      options: Options(headers: _headers),
    );
    if (response.statusCode == 200 && response.data != null) {
      final merchantJson =
          response.data!['merchant']! as Map<String, dynamic>;
      return Merchant.fromJson(merchantJson);
    }
  } on DioError catch (e) {
    _handlerError(e, 'get Me');
  }
  throw const TelePayException('Failed to get merchant info');
}