예제 #1
0
        public ActionResult Capture(Guid orderId)
        {
            var order = OrderService.GetQuery().FirstOrDefault(c => c.Id == orderId);

            if (order != null)
            {
                var trans = order.Transactions.FirstOrDefault();

                if (trans != null && PaymentType.CCard == trans.PaymentType)
                {
                    var transaction = new CCTransaction
                    {
                        GuWID         = trans.GatewayReferenceNumber,
                        Amount        = (double)trans.Amount,
                        TransactionId = trans.OrderNumber,
                        Mode          = TransactionMode.Live
                    };

                    var capture = new WireCardNet.Processing.Functions.FncCCCapture
                    {
                        FunctionId = "FN_Capture1"
                    };
                    capture.AddTransaction(transaction);

                    var job = new WireCardNet.Processing.Job();
                    job.AddFunction(capture);


                    job.JobId = "JOB_Capture1";
                    job.BusinessCaseSignature = trans.GatewayContractNumber;                     // WireCardNet.WireCard.WireCardUsername;

                    var processing = new WireCardNet.Processing.ProcessingRequest();
                    processing.AddJob(job);

                    //processing.Send();
                    var response = processing.GetResponse();

                    var status = response.FindStatus(job.JobId, capture.FunctionId, transaction.TransactionId);

                    Debug.WriteLine("#################################");
                    Debug.WriteLine("Capture result: " + status.Result);
                    if (status.Error != null)
                    {
                        Debug.WriteLine("Advice: " + status.Error.Advice);
                        Debug.WriteLine("Message: " + status.Error.Message);
                    }
                    else
                    {
                        trans.ResponseGuWID = status.GuWID;
                        order.State         = OrderState.Captured;
                    }
                    Debug.WriteLine("#################################");
                }
            }
            return(this.RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Refund(Guid orderId, Guid orderLineId)
        {
            var order = OrderService.GetQuery().FirstOrDefault(c => c.Id == orderId);

            if (order != null)
            {
                var trans = order.Transactions.FirstOrDefault();

                if (trans != null && PaymentType.PayPal != trans.PaymentType)
                {
                    var transaction = new CCTransaction
                    {
                        GuWID         = trans.GatewayReferenceNumber,
                        Amount        = (double)trans.Amount,
                        TransactionId = trans.OrderNumber,
                        Mode          = TransactionMode.Live
                    };

                    var refund = new WireCardNet.Processing.Functions.FncCCRefund()
                    {
                        FunctionId = "Func1"
                    };
                    refund.AddTransaction(transaction);

                    var job = new WireCardNet.Processing.Job();
                    job.AddFunction(refund);
                    job.JobId = "Job1";
                    job.BusinessCaseSignature = trans.GatewayContractNumber;                     // WireCardNet.WireCard.WireCardUsername;

                    var processing = new WireCardNet.Processing.ProcessingRequest();
                    processing.AddJob(job);

                    //processing.Send();
                    var response = processing.GetResponse();

                    var status = response.FindStatus("Capture1", "Func1", trans.OrderNumber);

                    if (status.Error == null)
                    {
                    }
                }
            }

            return(this.RedirectToAction("Index"));
        }
예제 #3
0
        public ActionResult Query(Guid orderId)
        {
            var order = OrderService.GetQuery().FirstOrDefault(c => c.Id == orderId);

            if (order != null)
            {
                var trans = order.Transactions.FirstOrDefault();

                if (trans != null && PaymentType.CCard == trans.PaymentType)
                {
                    var transaction = new CCTransaction
                    {
                        GuWID         = trans.ResponseGuWID,
                        Amount        = (double)(trans.Amount),
                        TransactionId = trans.OrderNumber,
                        Mode          = TransactionMode.Live
                    };

                    var query = new WireCardNet.Processing.Functions.FncCcQuery()
                    {
                        FunctionId = "FN_Query1"
                    };
                    query.AddTransaction(transaction);

                    var job = new WireCardNet.Processing.Job();
                    job.AddFunction(query);


                    job.JobId = "JOB_Query1";
                    job.BusinessCaseSignature = trans.GatewayContractNumber;                     // WireCardNet.WireCard.WireCardUsername;

                    var processing = new WireCardNet.Processing.ProcessingRequest();
                    processing.AddJob(job);

                    var response = processing.GetResponse();

                    var status = response.FindStatus(job.JobId, query.FunctionId, transaction.TransactionId);
                }
            }

            return(this.RedirectToAction("Index"));
        }