testPostRequest method

Future<ApiResponse> testPostRequest({
  1. Map<String, dynamic>? additionalData,
})

Test POST request

Implementation

Future<ApiResponse> testPostRequest({
  Map<String, dynamic>? additionalData,
}) async {
  try {
    FinanceSdkLogger.info('🧪 Starting POST Request Test');

    const apiKey = 'TEST_POST_REQUEST';
    final requestBody = additionalData ?? {
      'userId': '12345',
      'name': 'Finance SDK Test User',
      'email': 'test@financesdk.com',
      'timestamp': DateTime.now().millisecondsSinceEpoch.toString(),
    };

    FinanceSdkLogger.info('Test Data: $requestBody');

    final response = await _httpService.sendRequest(
      apiKey: apiKey,
      requestBody: requestBody,
    );

    if (response.success) {
      FinanceSdkLogger.info('✅ POST Test Passed');
      FinanceSdkLogger.verbose('Response: ${response.data}');
    } else {
      FinanceSdkLogger.error('❌ POST Test Failed: ${response.error}');
    }

    return response;
  } catch (e, stackTrace) {
    FinanceSdkLogger.error('❌ POST Test Exception', e, stackTrace);
    return ApiResponse.error('Test failed: ${e.toString()}');
  }
}