Пример #1
0
        public string Param(PaymentAttributes fomo, bool withSignature)
        {
            SortedDictionary <string, string> param = new SortedDictionary <string, string>();

            param.Add("merchant", fomo.Merchant);
            param.Add("price", fomo.Price);
            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);

            if (withSignature)
            {
                param.Add("signature", fomo.Signature);
            }

            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());
        }
Пример #2
0
        private void FomoPaymentProcess(PaymentAttributes fomo)
        {
            // To be modified for actual payment gateway
            fomo.Url      = "https://gateway.fomopay.com/sandbox/pgw/v1";
            fomo.Merchant = "test";
            string apiKey = "00000000";

            string param       = this.Param(fomo, false);
            string queryString = param + "&shared_key=" + apiKey;

            Console.WriteLine(queryString);
            fomo.Signature = ComputeSha256Hash(queryString);
        }
Пример #3
0
        public string fomoSignatureTest()
        {
            PaymentAttributes fomo = new PaymentAttributes()
            {
                Price       = "1",
                Description = "a"
            };
            string host = "https://localhost:8100/menu/e-wallet/topup";

            // set predefine values
            fomo.ReturnUrl    = host + "/payment/return";
            fomo.CallbackUrl  = host + "/payment/callback";
            fomo.Transaction  = "aaaa";
            fomo.Nonce        = "bbbb";
            fomo.Type         = "sale";
            fomo.Timeout      = "1800";
            fomo.CurrencyCode = "sgd";
            FomoPaymentProcess(fomo);
            return(fomo.Signature);
        }