generateChecksum static method

Future<String?> generateChecksum({
  1. required String token,
  2. required String mobile,
  3. required double amount,
  4. required List product_detail,
})

Implementation

static Future<String?> generateChecksum(
    {required String token, required String mobile, required double amount, required List product_detail}) async {
  final url = Uri.parse(
    ApiEndPoint.transectionURL,
  );
  Map<String, String> header = {'Content-Type': 'application/json', "Authorization": token};
  Map<String, dynamic> body = {"MOBILE_NO": mobile, "TXN_AMOUNT": amount, "PRODUCT_DETAILS": product_detail};
  String? hashKey;
  var result = await http.post(
    url,
    headers: header,
    body: json.encode(body),
  );

  if (result.statusCode == 200) {
    var response = jsonDecode(result.body);
    hashKey = response['hash'];
    return hashKey;
  }
  return hashKey;
}