public ActionResult CheckStatus()
        {
            var checkTransactionRequest = new CheckTransactionRequest((string)Session["tid"], _configuration);
            CheckTransactionResponse response = _cieloService.CheckTransaction(checkTransactionRequest);
            ViewBag.Status = response.Status.ToString();

            return View();
        }
Exemple #2
0
        public void ToXml_GivenACheckTransactionRequest_ShouldGenerateAXmlAsExpected()
        {
            var checkTransactionRequest = new CheckTransactionRequest("10069930690864271001", new FakeConfiguration())
            {
                UniqueKey = Guid.Parse("4c38f150-b67d-4059-88d1-b53b13e54a8e")
            };

            checkTransactionRequest
            .ToXml(false)
            .RemoveNewLinesAndSpaces()
            .Should()
            .Be(ExpectedXml.RemoveNewLinesAndSpaces());
        }
Exemple #3
0
        public CheckTransactionResponse CheckTransaction(CheckTransactionRequest request)
        {
            var responseContent = string.Empty;

            try {
                responseContent = Execute(request);
                CreateExceptionIfError(responseContent);
                return(new CheckTransactionResponse(responseContent));
            }
            catch (Exception ex) {
                throw new ResponseException(responseContent, ex);
            }
        }
        static void Main(string[] args)
        {
            var validateTransactionsClient = new Voxel.Transactions.Constraints.ValidateTransactionConstraintsClient(
                // IMPORTANT Only set the uri for local tests. Comment the line if other enviroment
                new Uri("http://proddmz-bavel-typhoon-typh-transactionsconstraints.lbservice")
                );

            var filename = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "UT.xml");

            var utContent = System.IO.File.ReadAllBytes(filename);

            var checkTransactionRequest = new CheckTransactionRequest()
            {
                XmlBytes     = utContent,
                AllowArchive = false,
                UiCulture    = ""
            };
            var transactionResponse = validateTransactionsClient.CheckTransaction(checkTransactionRequest);
            var transactionsFailed  = transactionResponse.ConstraintsPassed.Where(x => x.Passed != true).ToList();
            var transactionsSuccess = transactionResponse.ConstraintsPassed.Where(x => x.Passed == true).ToList();
        }
Exemple #5
0
        public static CommonResponse InvokeCheckTransactionStatus(string MerchantId, string MerchantName, string MerchantTxnId, string ApiUsername, string ApiPassword, string ApiSecretKey)
        {
            ApiLogBusiness          _apiLog = new ApiLogBusiness();
            CheckTransactionRequest checkTran;

            using (WebClient client = new WebClient())
            {
                client.Credentials = new NetworkCredential(ApiUsername, ApiPassword);
                var postValues = new NameValueCollection();
                postValues["MerchantId"]    = MerchantId;
                postValues["MerchantName"]  = MerchantName;
                postValues["MerchantTxnId"] = MerchantTxnId;
                postValues["Signature"]     = HMACSignatureGenerator.SHA512_ComputeHash(CommonFunctions.SingnatureGenerator <CheckTransactionRequest>(checkTran = new CheckTransactionRequest {
                    MerchantId = MerchantId, MerchantName = MerchantName, MerchantTxnId = MerchantTxnId
                }), ApiSecretKey);
                var response       = client.UploadValues(GetApiUrl() + "/CheckTransactionStatus", "Post", postValues);
                var responseString = Encoding.Default.GetString(response);
                var responseModel  = responseString.SerializeJSON <CommonResponse>();

                //maintain log
                var transactionModel = ApplicationUtilities.MapObject <CheckTransactionResponse>(responseModel.data);

                _apiLog.InsertApiLog(new ApiLogCommon()
                {
                    transacionId    = transactionModel.MerchantTxnId,
                    partner_tran_id = transactionModel.GatewayReferenceNo,
                    apiRequest      = JsonConvert.SerializeObject(checkTran),
                    apiResponse     = responseModel.data.SerializeObjectToJSON(),
                    userId          = HttpContext.Current != null && HttpContext.Current.Session != null && HttpContext.Current.Session["UserName"] != null ? HttpContext.Current.Session["UserName"].ToString() : "system",
                    IpAddress       = ApplicationUtilities.GetIP(),
                    functionName    = "CheckTransactionStatus"
                });

                //end

                //CheckTransactionResponse
                //var s = responseModel.data.ToString();
                ////var s1 = s.Split(new char [] { ':'});
                //var getProcessId = responseModel.data.ToString().SerializeJSON<ProcessIdResponse>();
                //if (getProcessId != null)
                //{
                //    return getProcessId.ProcessId;
                //}
                return(responseModel);
            }
        }