getPaywallConfig method

Future<PaywallConfig> getPaywallConfig()

Implementation

Future<PaywallConfig> getPaywallConfig() async {
  PaywallConfig paywallConfig = PaywallConfig();

  var uri = Uri.parse(
      '${APIMode.BASE_URL}api/v1/paywall/paywall-config/${ConscentInitializer.mClientId}');
  var response = await http.get(uri);

  if (response.statusCode == 200) {
    paywallConfig = PaywallConfig.fromJson(jsonDecode(response.body));
    return paywallConfig;
  } else {
    onPluginError(response.body);
  }

  return paywallConfig;
}