Exemple #1
0
        public static string PostBoroPowerJson(string refNum, string Borovalue)
        {
            try
            {
                DataAccess.DataReaders _dr = new DataAccess.DataReaders();

                var    CustomerInfo = _dr.GetTransactionLog(refNum);
                string AgentID      = ConfigurationManager.AppSettings["agentID"];
                string AgentKey     = ConfigurationManager.AppSettings["agentKey"];

                dynamic obj = new JObject();

                obj.customerId   = CustomerInfo.CustomerID;
                obj.accountType  = CustomerInfo.TransactionType;
                obj.customerName = CustomerInfo.CustomerName;
                obj.phonenumber  = CustomerInfo.CustomerPhone;
                obj.emailaddress = CustomerInfo.CustomerEmail;
                obj.amount       = CustomerInfo.Amount;
                //obj.amount = Borovalue;
                obj.refNumber  = CustomerInfo.ReferenceNumber;
                obj.MerchantFK = CustomerInfo.Merchant_FK;

                var email = ConfigurationManager.AppSettings["agentEmail"];

                var builder = new StringBuilder();
                builder.Append(AgentID).Append(AgentKey).Append(obj.customerId).Append(obj.amount);

                var hash = new CryptographyManager().ComputeHash(builder.ToString(), HashName.SHA512);


                var signaturetext = new StringBuilder();
                signaturetext.Append(AgentID).Append(AgentKey).Append(email);

                var signature = new CryptographyManager().ComputeHash(signaturetext.ToString(), HashName.SHA512);
                //var signaturetext = new StringBuilder();
                //signaturetext.Append(agentid).Append(agentkey).Append(EmailAddress);

                //var signature = new CryptographyManager().ComputeHash(signaturetext.ToString(), HashName.SHA256);
                obj.hashValue = hash;
                var    json      = obj.ToString();
                string sessionID = GetSessionID();
                var    PostUrl   = ConfigurationManager.AppSettings["BorrowPower"];
                var    data      = Utility.DoPosts1(json, $"{PostUrl}", AgentID, AgentKey, signature, sessionID);
                return(data);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }
Exemple #2
0
        public static string PostBuyPowerJson(string refNum, int Merc_fk)
        {
            try
            {
                DataAccess.DataReaders _dr = new DataAccess.DataReaders();
                // CustomerObj cusObj;
                var    CustomerInfo = _dr.GetTransactionLog(refNum);
                string agentID      = ConfigurationManager.AppSettings["agentID"];
                string agentKey     = ConfigurationManager.AppSettings["agentKey"];

                dynamic  obj       = new JObject();
                string   valueTime = DateTime.Now.ToString("Hmmss");
                DateTime valTime   = DateTime.Now;
                obj.agentkey     = agentKey;
                obj.customerId   = CustomerInfo.CustomerID;
                obj.accountType  = CustomerInfo.TransactionType;
                obj.customerName = CustomerInfo.CustomerName.Trim();
                obj.transDate    = CustomerInfo.TrnDate;
                obj.amount       = CustomerInfo.Amount;
                obj.refNumber    = CustomerInfo.ReferenceNumber;
                obj.MerchantFK   = Merc_fk;
                //   obj.Phone = CustomerInfo.CustomerPhone;
                obj.phoneNumber = CustomerInfo.CustomerPhone;
                // obj.Email = CustomerInfo.CustomerEmail;
                obj.emailAddress = CustomerInfo.CustomerEmail;

                var email = ConfigurationManager.AppSettings["agentEmail"];

                var builder = new StringBuilder();
                builder.Append(obj.customerId).Append(obj.amount).Append(agentID).Append(agentKey);
                var hash = new CryptographyManager().ComputeHash(builder.ToString(), HashName.SHA512);


                var signaturetext = new StringBuilder();
                signaturetext.Append(agentID).Append(agentKey).Append(email);

                var signature = new CryptographyManager().ComputeHash(signaturetext.ToString(), HashName.SHA512);
                obj.hashValue = hash;
                var    json      = obj.ToString();
                string sessionID = GetSessionID();
                var    PostUrl   = ConfigurationManager.AppSettings["Buypower"];
                var    data      = Utility.DoPosts1(json, $"{PostUrl}", agentID, agentKey, signature, sessionID);
                return(data);
            }
            catch (Exception ex)
            {
                WebLog.Log(ex.Message.ToString());
                return(null);
            }
        }