static void testMomo()
        {
            // test card payment
            RequestPayloadPayMomoGH request = new RequestPayloadPayMomoGH
            {
                PBFPubKey          = raveOptions.PublicKey,
                is_mobile_money_gh = 1,
                network            = "MTN",
                currency           = "GHS",
                country            = "GH",
                amount             = 10,
                email       = "*****@*****.**",
                phonenumber = "0xxxxxxxxx",
                firstname   = "Testeer",
                lastname    = "Joe",
                IP          = "127.0.0.1",
                txRef       = "MC-" + DateTime.Now.ToString(), // your unique merchant reference
                // meta = [{ metaname: "flightID", metavalue: "123949494DC"}],
                device_fingerprint = "69e6b7f0b72037aa8428b70fbe03986c"
            };

            var task = Rave.PayViaMomoGH(request);

            task.Wait();

            //Console.WriteLine("yes");
            //var task2 = Rave.ValidatePay(task.Result.data, "3310");
            //task2.Wait();
        }
Esempio n. 2
0
        public async Task <ResponsePayload <RequestPayloadPayMomoGH> > PayViaMomoGH(RequestPayloadPayMomoGH request)
        {
            Console.WriteLine("PayViaMomoGH => called");
            string requestContent = JsonConvert.SerializeObject(request);

            EncryptionService.RavePaymentDataEncryption en = new EncryptionService.RavePaymentDataEncryption();
            string encKey      = en.GetEncryptionKey(SECRET_KEY);
            string cipher      = en.EncryptData(encKey, requestContent);
            string requestBody = JsonConvert.SerializeObject(new RequestPayload
            {
                PBFPubKey = PUBLIC_KEY,
                client    = cipher
            });

            var response = await client.PostAsync(getUrl("flwv3-pug/getpaidx/api/charge"), new StringContent(requestBody, Encoding.UTF8, "application/json"));

            var responseString = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <ResponsePayload <RequestPayloadPayMomoGH> >(responseString));
        }