getSecureFieldsSetting static method

Future<SecureFieldsSettingDataResponse> getSecureFieldsSetting(
  1. PayEngineConfig config
)

Retrieves the secure fields setting data response.

This method takes a PayEngineConfig object as a parameter and returns a Future that resolves to a SecureFieldsSettingDataResponse. The PayEngineConfig object contains the necessary configuration for retrieving the secure fields setting. The returned SecureFieldsSettingDataResponse contains the secure fields setting data.

Implementation

static Future<SecureFieldsSettingDataResponse> getSecureFieldsSetting(
    PayEngineConfig config) async {
  final headers = getHttpHeaders(config);
  final baseUrl = getBaseURL(config);
  var url = Uri.parse("$baseUrl/api/setting/secure-fields");
  var response = await http.get(url, headers: headers);

  if (response.statusCode == 200) {
    final result =
        SecureFieldsSettingResponse.fromJson(jsonDecode(response.body));
    return result.data;
  } else {
    throw Exception('Could not load secure field setting ${response.body}');
  }
}