sadadPayVerifyOtp static method

Future<bool?> sadadPayVerifyOtp({
  1. required String token,
  2. required String otp,
  3. required String userId,
})

Implementation

static Future<bool?> sadadPayVerifyOtp({required String token, required String otp, required String userId}) async {
  final url = Uri.parse(
    ApiEndPoint.sadadPayVerifyOTP,
  );
  Map<String, String> header = {'Content-Type': 'application/json', "Authorization": token};
  Map<String, dynamic> body = {"otp": int.parse(otp), "userId": int.parse(userId)};

  var result = await http.post(
    url,
    headers: header,
    body: json.encode(body),
  );

  if (result.statusCode == 200) {
    return true;
    var response = jsonDecode(result.body);
  }
  var response = jsonDecode(result.body);
  return false;
}