Exemple #1
0
        private static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Program Starting\n");

                ServiceCollection serviceCollection = new ServiceCollection();
                ConfigureServices(serviceCollection);

                IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();

                var rRRRequest = new RRRRequest
                {
                    Amount        = "20000",
                    Description   = "Payment Donation for Ophanage",
                    OrderId       = "221028",
                    PayerEmail    = "*****@*****.**",
                    PayerName     = "Alokan John Ayodeji",
                    PayerPhone    = "08030480172",
                    ServiceTypeId = ""
                };

                var getRemitaCalls = serviceProvider.GetService <HttpService>().CheckStatusByRRR("34543").Result;
                var remitaCalls    = serviceProvider.GetService <HttpService>().GenerateRRR(rRRRequest).Result;

                if (remitaCalls != null)
                {
                    Console.WriteLine($"Response: {JsonConvert.SerializeObject(remitaCalls)}");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
        public async Task <RRRResponse> GenerateRRR(RRRRequest rRRRequest)
        {
            rRRRequest.ServiceTypeId = _serviceTypeId;
            var token = $"remitaConsumer={_merchantId},remitaConsumerToken={Security.Hash512(_merchantId + _serviceTypeId + rRRRequest.OrderId + rRRRequest.Amount + _apiKey)}";

            Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

            var content = new StringContent(JObject.FromObject(rRRRequest).ToString(), Encoding.UTF8, "application/json");

            content.Headers.ContentType.CharSet = "";

            var request = await Client
                          .PostAsync("/remita/exapp/api/v1/send/api/echannelsvc/merchant/api/paymentinit", content)
                          .ConfigureAwait(false);

            var response = await request.Content.ReadAsStringAsync().ConfigureAwait(true);

            return(JsonConvert.DeserializeObject <RRRResponse>(response));
        }