コード例 #1
0
 public static void InsertTrans(string vpc_MerchTxnRef, string vpc_Merchant, string vpc_OrderInfo, decimal Total, string vpc_TicketNo, string vpc_BankType)
 {
     if (!TransManager.Insert(vpc_MerchTxnRef, vpc_Merchant, vpc_OrderInfo, Total, vpc_TicketNo, vpc_BankType))
     {
         throw new ApplicationException("Lỗi cập nhật Data!!!");
     }
 }
コード例 #2
0
        public static void SaveTransNL(string OrderID, string tran_info, decimal Total)
        {
            string TicketNo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();

            //if (!TransManager.Insert(tran_info, NL.merchant_site_code, OrderID, CaculatorTransCost(Total, BankDeclare.Nganluong), TicketNo, BankDeclare.Nganluong))
            //    throw new ApplicationException("Lỗi cập nhật Data!!!");
            if (!TransManager.Insert(tran_info, NL.merchant_site_code, OrderID, Total, TicketNo, BankDeclare.Nganluong))
            {
                throw new ApplicationException("Lỗi cập nhật Data!!!");
            }
        }
コード例 #3
0
        private static string AGAIN_URL  = Config.WebsiteAppPath + "/PayO.aspx";  //Config.WebsiteAppPath + "AccOnePayO.aspx";



        public static string Trans2OnePay(string OrderID, decimal Total, string vpc_BankType, string vpc_MerchTxnRef, int vpc_Bank)
        {
            // Thao tác sau khi bấm thanh toán
            // InitValues
            int vpc_order_id = nClientID;
            //string vpc_MerchTxnRef = getMerchantTntRef(OrderID, vpc_BankType);
            string  vpc_Merchant  = MERCHANT_ID;
            string  vpc_OrderInfo = OrderID;
            decimal vpc_Amount    = Total * 100;
            string  vpc_TicketNo  = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();

            // Update Database
            if (!TransManager.Insert(vpc_MerchTxnRef, vpc_Merchant, vpc_OrderInfo, Total, vpc_TicketNo, vpc_BankType))
            {
                throw new ApplicationException("Lỗi cập nhật Data!!!");
            }

            // Onepay nội địa

            // Khoi tao lop thu vien va gan gia tri cac tham so gui sang cong thanh toan
            VPCRequest conn = new VPCRequest(ONEPAY_URL);

            conn.SetSecureSecret(SECURE_SECRET);
            // Add the Digital Order Fields for the functionality you wish to use
            // Core Transaction Fields
            conn.AddDigitalOrderField("Title", "onepay paygate");
            conn.AddDigitalOrderField("vpc_Locale", "vn");//Chon ngon ngu hien thi tren cong thanh toan (vn/en)
            conn.AddDigitalOrderField("vpc_Version", "2");
            conn.AddDigitalOrderField("vpc_Command", "pay");
            conn.AddDigitalOrderField("vpc_Merchant", MERCHANT_ID);
            conn.AddDigitalOrderField("vpc_AccessCode", ACCESS_CODE);
            conn.AddDigitalOrderField("vpc_MerchTxnRef", vpc_MerchTxnRef);
            conn.AddDigitalOrderField("vpc_OrderInfo", vpc_OrderInfo);
            conn.AddDigitalOrderField("vpc_Amount", vpc_Amount.ToString());
            conn.AddDigitalOrderField("vpc_Currency", "VND");
            conn.AddDigitalOrderField("vpc_ReturnURL", RETURN_URL);
            // Thong tin them ve khach hang. De trong neu khong co thong tin
            conn.AddDigitalOrderField("vpc_SHIP_Street01", "194 Tran Quang Khai");
            conn.AddDigitalOrderField("vpc_SHIP_Provice", "Hanoi");
            conn.AddDigitalOrderField("vpc_SHIP_City", "Hanoi");
            conn.AddDigitalOrderField("vpc_SHIP_Country", "Vietnam");
            conn.AddDigitalOrderField("vpc_Customer_Phone", "043966668");
            conn.AddDigitalOrderField("vpc_Customer_Email", "*****@*****.**");
            conn.AddDigitalOrderField("vpc_Customer_Id", "onepay_paygate");
            // Dia chi IP cua khach hang
            conn.AddDigitalOrderField("vpc_TicketNo", vpc_TicketNo);
            conn.AddDigitalOrderField("vpc_Bank", vpc_Bank.ToString());
            // Chuyen huong trinh duyet sang cong thanh toan
            String url = conn.Create3PartyQueryString();

            return(url);
        }
コード例 #4
0
        public static void SaveTransBK(string OrderID, string tran_info, decimal Total, string redUrl)
        {
            TransInfo infTrans = new TransInfo();

            infTrans.Vpc_OrderInfo   = OrderID;
            infTrans.Vpc_MerchTxnRef = tran_info;
            infTrans.Vpc_Merchant    = BK.merchant_id;
            infTrans.Vpc_Amount      = CaculatorTransCost(Total, BankDeclare.Baokim);
            infTrans.Vpc_TicketNo    = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
            infTrans.Vpc_ReturnUrl   = redUrl;
            infTrans.Vpc_BankType    = BankDeclare.Baokim;

            if (!TransManager.Insert(infTrans))
            {
                throw new ApplicationException("Lỗi cập nhật Data!!!");
            }
        }