Exemplo n.º 1
0
        public GSTNResult <OTPResponseModel> RequestOTP()
        {
            OTPRequestModel model = new OTPRequestModel {
                action   = "OTPREQUEST",
                username = userid,
                app_key  = EncryptionUtils.RsaEncrypt(GSTNConstants.GetAppKeyBytes())
            };
            var output = this.Post <OTPRequestModel, OTPResponseModel>(model);

            return(output);
        }
Exemplo n.º 2
0
 public MainPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     _apiServices            = new RestApi();
     _baseUrl                = Settings.Url + Domain.LoginApiConstant;
     _objOTPResponseModel    = new OTPResponseModel();
     _objOTPRequestModel     = new OTPRequestModel();
     entryPhoneNo.Completed += (sender, e) =>
     {
         btnphoneNoSubmit_Clicked(sender, e);
     };
 }
Exemplo n.º 3
0
        public GSTNResult <OTPResponseModel> RequestOTP()
        {
            dicParams.Clear();
            OTPRequestModel model = new OTPRequestModel {
                action   = "OTPREQUEST",
                username = this.username,
                app_key  = EncryptionUtils.RsaEncrypt(this.GetAppKeyBytes(), credential.cert_file_rsa)
            };
            string finalJson = this.Serialize(model);

            this.LogMessage(finalJson);
            dicParams.Add("RequestPayload", finalJson);
            var output = this.Post <OTPRequestModel, OTPResponseModel>(model);

            return(output);
        }
Exemplo n.º 4
0
        //POST APIS..........................
        public async Task <OTPResponseModel> LoginAsync(string uri, Boolean IsHeaderRequired, HeaderModel objHeaderModel, OTPRequestModel _objOTPRequestModel)
        {
            client.MaxResponseContentBufferSize = 256000;
            OTPResponseModel _objOTPResponseModel = new OTPResponseModel();

            var keyValues = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("PhoneNo", _objOTPRequestModel.PhoneNo),
                new KeyValuePair <string, string>("DeviceId", _objOTPRequestModel.DeviceId),
                new KeyValuePair <string, string>("DeviceType", _objOTPRequestModel.DeviceType)
            };

            if (IsHeaderRequired)
            {
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
                client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Length", "69");
                client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Fiddler");
                client.DefaultRequestHeaders.TryAddWithoutValidation("Host", "localhost:49165");
            }
            var request = new HttpRequestMessage(HttpMethod.Post, uri);

            request.Content = new FormUrlEncodedContent(keyValues);

            HttpResponseMessage response = await client.SendAsync(request);

            var statuscode = Convert.ToInt64(response.StatusCode);

            if (response.IsSuccessStatusCode)
            {
                var SucessResponse = await response.Content.ReadAsStringAsync();

                _objOTPResponseModel = JsonConvert.DeserializeObject <OTPResponseModel>(SucessResponse);
                return(_objOTPResponseModel);
            }
            else
            {
                var ErrorResponse = await response.Content.ReadAsStringAsync();

                _objOTPResponseModel = JsonConvert.DeserializeObject <OTPResponseModel>(ErrorResponse);
                return(_objOTPResponseModel);
            }
        }