verifyOtp method

Step 4: Verify OTP (for e-wallet and flash payments) POST /payments/verify-otp

Implementation

Future<LokotroOtpVerifyResponse> verifyOtp(LokotroOtpVerifyRequest request) async {
  try {
    if (kDebugMode) {
      debugPrint('[Lokotro Payment] Verifying OTP: ${request.toString()}');
    }

    final response = await _httpClient.post<Map<String, dynamic>>(
      '/payments/verify-otp',
      data: request.toJson(),
      parser: (data) => data as Map<String, dynamic>,
    );

    if (response.isSuccess && response.data != null) {
      final verifyResponse = LokotroOtpVerifyResponse.fromJson(response.data!);

      if (kDebugMode) {
        debugPrint('[Lokotro Payment] OTP verified: ${verifyResponse.toString()}');
      }

      return verifyResponse;
    } else {
      throw LokotroPaymentException(
        message: response.message,
        code: 'OTP_VERIFICATION_FAILED',
      );
    }
  } catch (e) {
    if (kDebugMode) {
      debugPrint('[Lokotro Payment] Verify OTP error: $e');
    }
    rethrow;
  }
}