コード例 #1
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);
        }