pageTrace method

Future<Response> pageTrace({
  1. String? url,
  2. String? pageType,
  3. String? applicationId,
  4. String? userId,
  5. List<StatItem>? items,
  6. String? ver,
})

Implementation

Future<http.Response> pageTrace({
  String? url,
  String? pageType,
  String? applicationId,
  String? userId,
  List<StatItem>? items,
  String? ver,
}) async {

  var list = items?.map((e) => e.toJson()).toList();

  var payload = {
    "ver": ver ?? '',
    "application_id": applicationId ?? '',
    "referer": '',
    "sk": await UserInfo.getBootpaySK(),
    "user_id": userId ?? '',
    "url": url ?? '',
    "page_type": pageType ?? 'ios',
    "items": list
  };

  var aes256 = BootpaySimpleAES256();
  var data = {
    "data": aes256.strEncode(json.encode(payload)),
    "session_key": aes256.getSessionKey()
  };

  var uri = Uri.parse('$defaultUrl/call');
  return await http.post(
      uri,
      body: data
  );
}