/// <summary> /// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler" /> interface. /// </summary> /// <param name="context">An <see cref="T:System.Web.HttpContext" /> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param> public override void ProcessRequest(HttpContext context) { string transactionRequest = null; try { string jsonParameter = GetJsonParameter(context.Request); ITradingOrder requestObject = (ITradingOrder)JsonConvert.DeserializeObject(jsonParameter, typeof(ITradingOrder)); PaymentClient client = new PaymentClient(this.TransactionInfo); var service = new PaymentService(); if (requestObject != null) { transactionRequest = client.CreateTransactionRequest(requestObject); } } catch (Exception ex) { transactionRequest = ex.Message.ToString(); } context.Response.ContentType = "text/plain"; context.Response.Write(transactionRequest); }
/// <summary> /// Determines whether [is sign correct] [the specified dictionary]. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <returns><c>true</c> if [is sign correct] [the specified dictionary]; otherwise, <c>false</c>.</returns> private bool IsSignCorrect(Dictionary<string, string> dictionary) { if (dictionary != null) { var client = new PaymentClient(this.TransactionInfo); string signed = client.GetSignedString(dictionary); return dictionary["sign"] == signed; } return false; }