Example #1
0
        //public static int DecryptResponse(string trandata)
        //{
        //    iPayPipe pipe = new iPayPipe();

        //    pipe.setAlias(_alias);
        //    pipe.setResourcePath(_resourcePath);
        //    pipe.setKeystorePath(_keystorePath);
        //    int result = pipe.parseEncryptedRequest(trandata);
        //    return result;
        //}

        public static KnetResponse KnetResponseData(string trandata, string paymentid, string trackid,
                                                    string udf1,
                                                    string udf2,
                                                    string udf3,
                                                    string udf4,
                                                    string udf5
                                                    )
        {
            KnetResponse obj = new KnetResponse();

            obj.status = false;
            iPayPipe pipe = new iPayPipe();

            string resourcePath = _resourcePath;
            string keystorePath = _keystorePath;
            string aliasName    = _alias;

            pipe.setAlias(aliasName);
            pipe.setResourcePath(resourcePath);
            pipe.setKeystorePath(resourcePath);

            int knetResult = pipe.parseEncryptedRequest(trandata);


            if (knetResult != 0)
            {
                pipe.getError();
                obj.error = pipe.getError();
            }
            else
            {
                obj.paymentId = paymentid;
                obj.trackId   = trackid;
                obj.udf1      = udf1;
                obj.udf2      = udf2;
                obj.udf3      = udf3;
                obj.udf4      = udf4;
                obj.udf5      = udf5;
                obj.status    = true;
            }
            return(obj);
        }
Example #2
0
        public KnetResponse Decrypt([FromBody] KnetResponseDecryptModel Obj
                                    )
        {
            KnetResponse obj = new KnetResponse();

            obj.status = false;
            iPayPipe pipe = new iPayPipe();

            string resourcePath = _resourcePath;
            string keystorePath = _keystorePath;
            string aliasName    = _alias;

            pipe.setAlias(aliasName);
            pipe.setResourcePath(resourcePath);
            pipe.setKeystorePath(resourcePath);

            int knetResult = pipe.parseEncryptedRequest(Obj.trandata);


            if (knetResult != 0)
            {
                pipe.getError();
                obj.error = pipe.getError();
            }
            else
            {
                obj.paymentId = Obj.paymentid;
                obj.trackId   = Obj.trackid;
                obj.udf1      = Obj.udf1;
                obj.udf2      = Obj.udf2;
                obj.udf3      = Obj.udf3;
                obj.udf4      = Obj.udf4;
                obj.udf5      = Obj.udf5;
                obj.result    = pipe.getResult();
                obj.status    = obj.result == "CAPTURED" ? true :false;
            }
            return(obj);
        }
Example #3
0
        public KnetModel Get([FromBody] KnetModel Obj)
        {
            Obj = MappingFromRequest(Obj);

            try
            {
                new ExceptionLog().BeginKnetRequest(JsonConvert.SerializeObject(Obj));

                iPayPipe MyObj = new iPayPipe();

                MyObj.setKeystorePath(_keystorePath);
                MyObj.setResourcePath(_resourcePath);
                if (string.IsNullOrEmpty(Obj.ResponseURL))
                {
                    MyObj.setResponseURL(_responseUrl + Obj.OrderId);
                }
                else
                {
                    MyObj.setResponseURL(Obj.ResponseURL + Obj.OrderId);
                }

                if (string.IsNullOrEmpty(Obj.ErrorUrl))
                {
                    MyObj.setErrorURL(_errorUrl);
                }
                else
                {
                    MyObj.setErrorURL(Obj.ErrorUrl + Obj.OrderId);
                }

                MyObj.setErrorURL(_errorUrl);
                MyObj.setAlias(_alias);
                MyObj.setAction("1");
                MyObj.setAmt(Obj.Amt);
                MyObj.setCurrency(Obj.Currency);
                MyObj.setLanguage(Obj.Language);
                MyObj.setTrackId(Obj.TrackId);
                MyObj.setPaymentId(Obj.PaymentId);
                //MyObj.setTransId("117601");
                MyObj.setUdf1(Obj.Udf1);
                MyObj.setUdf2(Obj.Udf2);
                MyObj.setUdf3(Obj.Udf3);
                MyObj.setUdf4(Obj.Udf4);
                MyObj.setUdf5(Obj.Udf5);
                //

                //MyObj.setTrackId("1176");
                //MyObj.setTranportalId("117601");
                //MyObj.setTransId("117601");
                //MyObj.setPaymentId(Obj.TrackId);

                // For Hosted Payment Integration, the method to be called
                int val = MyObj.performPaymentInitializationHTTP();

                Obj.transVal = short.Parse(MyObj.performPaymentInitializationHTTP().ToString());

                if (val == 0)
                {
                    //Response.sendRedirect(pipe.getWebAddress()); //To redirect the web address.
                }
                else
                {
                    Obj.ErrorMsg = MyObj.getError();
                }
                /** End of Request Processing**/

                Obj.PaymentId   = MyObj.getPaymentId();
                Obj.PaymentPage = MyObj.getPaymentPage();
                //MyObj.getWebAddress
                Obj.ErrorMsg    = MyObj.getError();
                Obj.RawResponse = MyObj.getRawResponse();
                Obj.Result      = MyObj.getResult();
                //Obj.ErrorUrl = "koki";

                Obj.PaymentPage = MyObj.getWebAddress();

                // errorurl
            }
            catch (Exception e)
            {
                new ExceptionLog().ErrorLogging(e, ErrorLogType.KnetPaymentError);
            }
            return(Obj);
        }