Ejemplo n.º 1
0
        private string Param(FomoPaySignatureParam fomo)
        {
            SortedDictionary <string, string> param = new SortedDictionary <string, string>();

            param.Add("merchant", fomo.merchant);
            param.Add("price", fomo.amount);
            param.Add("description", fomo.description);
            param.Add("transaction", fomo.transaction);
            param.Add("return_url", fomo.returnUrl);
            param.Add("callback_url", fomo.callbackUrl);
            param.Add("currency_code", fomo.currencyCode);
            param.Add("type", fomo.type);
            param.Add("timeout", fomo.timeout);
            param.Add("nonce", fomo.nonce);

            StringBuilder strArray = new StringBuilder();

            foreach (KeyValuePair <string, string> temp in param)
            {
                strArray.Append(temp.Key + "=" + temp.Value + "&");
            }

            int nLen = strArray.Length;

            strArray.Remove(nLen - 1, 1);

            return(strArray.ToString());
        }
Ejemplo n.º 2
0
        public IActionResult GenerateSignature([FromBody] FomoPaySignatureParam fomoPayParam)
        {
            _logger.LogInformation("GenerateSignature Request:" + JsonConvert.SerializeObject(fomoPayParam));
            string queryString = Param(fomoPayParam) + "&shared_key=" + _configuration["FomoPayment:apiKey"];

            return(Ok(new { signature = ComputeSha256Hash(queryString) }));
        }