/// <summary> /// Validates the provided document via the e-contract service, asynchronously. /// </summary> /// <see cref="Verify"/> public async Task <SecurityInfo> VerifyAsync(Document document) { if (document == null) { throw new ArgumentNullException("document"); } var client = CreateDSSPClient(); var request = CreateVerifyRequest(document); verifyResponse responseWrapper = await client.verifyAsync(request); return(ProcessVerifyResponse(responseWrapper.VerifyResponse1)); }
public verifyResponse VerifyRequest(verifyRequest request) { try { string url = "https://gateway.zibal.ir/v1/verify"; // url var httpResponse = HttpRequestToZibal(url, JsonConvert.SerializeObject(request)); // get Response using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) // make stream reader { var responseText = streamReader.ReadToEnd(); // read Response verifyResponse response = JsonConvert.DeserializeObject <verifyResponse>(responseText); // Deserilize as response class object // you can access paidAt time with item.paidAt , result with item.result , message with item.message , status with item.status and amount with item.amount return(response); } } catch { return(null); } }
internal Transaction GhavaminCallBackPayRequest(Guid Id, string resultCode, string SayanRef, string paymentID) { var transaction = PaymentComponenets.Instance.TransactionFacade.Get(Id); if (transaction == null) { return(null); } string value = transaction.AdditionalData; string deValue = StringUtils.Decrypt(value); var data = deValue.Split('#'); string PaymentTicket = data[2]; //if (!String.IsNullOrEmpty(SayanRef)) // SayanRef = "0"; //if (!String.IsNullOrEmpty(paymentID)) // paymentID = "0"; if (Int32.Parse(resultCode) == 00) { BypassCertificateError(); GhavaminGeteway.merchant client = new merchantClient(); GhavaminGeteway.verifyRequest vrRequest = new GhavaminGeteway.verifyRequest(); GhavaminGeteway.verifyRequest1 vrRequest1 = new verifyRequest1(); vrRequest.merchantId = data[0]; vrRequest.wsp1 = data[4]; vrRequest.wsp2 = data[5]; vrRequest.paymentTicket = PaymentTicket; vrRequest1.verifyRequest = vrRequest; GhavaminGeteway.verifyResponse status = new verifyResponse(); GhavaminGeteway.verifyResponse1 status1 = new GhavaminGeteway.verifyResponse1(); status1.verifyResponse = status; status1 = client.verify(vrRequest1); if (Int32.Parse(status1.verifyResponse.resultCode) < 0) { transaction.Status = Int32.Parse(status1.verifyResponse.resultCode); } else { transaction.Status = Int32.Parse(resultCode); transaction.Done = true; } } else { transaction.Status = Int32.Parse(resultCode); } transaction.RefId = SayanRef; if (!PaymentComponenets.Instance.TransactionFacade.Update(transaction)) { return(null); } return(transaction); }