public static string CreateHashString(IRNRequest request, string secretKey) { var hashString = "MERCHANT=" + request.MERCHANT; hashString += "&ORDER_REF=" + request.ORDER_REF; hashString += "&ORDER_AMOUNT=" + request.ORDER_AMOUNT; hashString += "&ORDER_CURRENCY=" + request.ORDER_CURRENCY; hashString += "&IRN_DATE=" + request.IRN_DATE; hashString += "&AMOUNT=" + request.AMOUNT; hashString += "&ORDER_HASH=" + CreateMD5Hash(secretKey, request); return(hashString); }
protected static string CreateMD5Hash(string secretKey, IRNRequest request) { string HASHED_CONTENT = string.Empty; var hashString = Helper.GetLengthAsByte(request.MERCHANT) + request.MERCHANT; hashString += Helper.GetLengthAsByte(request.ORDER_REF) + request.ORDER_REF; hashString += Helper.GetLengthAsByte(request.ORDER_AMOUNT) + request.ORDER_AMOUNT; hashString += Helper.GetLengthAsByte(request.ORDER_CURRENCY) + request.ORDER_CURRENCY; hashString += Helper.GetLengthAsByte(request.IRN_DATE) + request.IRN_DATE; hashString += Helper.GetLengthAsByte(request.AMOUNT) + request.AMOUNT; HASHED_CONTENT = Helper.CreateHash(hashString, secretKey); return(HASHED_CONTENT); }
public static string Execute(IRNRequest request, Options options) { var hashString = CreateHashString(request, options.SecretKey); return(HttpCaller.PostDataReturnString(options.Url, hashString)); }