Esempio n. 1
0
        public string AtpRequest(AtpRequest payload)
        {
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Bearer {accessToken().Trim()}" }
            };
            string          url     = "https://api.telkom.co.ke/tkash/airtimerequest/v3/atpAsync";
            ITelekomService service = new TelekomService <AtpRequest>(url, RestSharp.Method.POST, payload, headers);
            var             item    = service.ServiceRequest();

            return(item.Item1);
        }
Esempio n. 2
0
        public string Transaction(TransactionRequest payload)
        {
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Bearer {accessToken().Trim()}" }
            };
            string          url     = $@"https://api.telkom.co.ke/tkash/transactionstatus/v3/getstatus?referenceCode={payload.referenceCode}&transactionType={payload.transactionType}";
            ITelekomService service = new TelekomService <object>(url, RestSharp.Method.GET, null, headers);
            var             item    = service.ServiceRequest();

            return(item.Item1);
        }
Esempio n. 3
0
        public string RegistrationRequest(RegistrationRequest payload)
        {
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Bearer {accessToken().Trim()}" }
            };
            string          url     = BASE_URL + "serviceRegistration/v3/register";
            ITelekomService service = new TelekomService <RegistrationRequest>(url, RestSharp.Method.POST, payload, headers);
            var             item    = service.ServiceRequest();

            return(item.Item1);
        }
Esempio n. 4
0
        public string UpdateUrl(UpdateUrlRequest payload)
        {
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Bearer {accessToken().Trim()}" }
            };
            string          url     = BASE_URL + "update-consumer/v3/updateUrl";
            ITelekomService service = new TelekomService <UpdateUrlRequest>(url, RestSharp.Method.PUT, payload, headers);
            var             item    = service.ServiceRequest();

            return(item.Item1);
        }
Esempio n. 5
0
        public string C2B(C2BSimulate payload)
        {
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Bearer {accessToken().Trim()}" }
            };
            string          url     = $@"https://api.telkom.co.ke/simulate/v3/c2b/{payload.BillerId}";
            ITelekomService service = new TelekomService <object>(url, RestSharp.Method.GET, null, headers);
            var             item    = service.ServiceRequest();

            return(item.Item1);
        }
Esempio n. 6
0
        public string ReplyNotification(ReplayNotification payload)
        {
            string url = $@"https://api.telkom.co.ke/notificationReplay/v3/replayNotification?notificationType={payload.notificationType}&id={payload.consumerID}&limit={payload.notificationCount}";
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Bearer {accessToken().Trim()}" }
            };
            ITelekomService service = new TelekomService <object>(url, RestSharp.Method.GET, null, headers);
            var             item    = service.ServiceRequest();

            return(item.Item1);
        }
Esempio n. 7
0
        public string accessToken()
        {
            string url  = BASE_URL + "token?grant_type=client_credentials";
            string test = $"{consumerKey}:{consumerSecret}";

            test = test.ToBase64();
            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Authorization", $"Basic {test}" }
            };

            ITelekomService service = new TelekomService <object>(url, RestSharp.Method.POST, null, headers);
            var             item    = service.ServiceRequestSpecial();
            TokenAcces      post    = JsonConvert.DeserializeObject <TokenAcces>(item.Item1);
            string          token   = post.access_token;

            post.access_token = token.Replace("'", " ");
            post.access_token = post.access_token.Trim();
            return(post.access_token);
        }