예제 #1
0
        public async Task GenerateMobileOTPAsync(string mobileNumber, CancellationToken cancellationToken)
        {
            var generateMobileOTPRequest = new GenerateMobileOTPRequest();

            generateMobileOTPRequest.mobile = mobileNumber;
            generateMobileOTPRequest.secret = coWinUtilities.Secret;
            coWinUtilities.MobileNumber     = mobileNumber;

            var generateMobileOTPResponse = await coWINApiClient.GenerateMobileOTPAsync(generateMobileOTPRequest, cancellationToken);

            transactionId = generateMobileOTPResponse.txnId;
        }
예제 #2
0
        public async Task <GenerateMobileOTPResponse> GenerateMobileOTPAsync(GenerateMobileOTPRequest generateMobileOTPRequest, CancellationToken cancellationToken)
        {
            var request = new HttpRequestMessage(HttpMethod.Post, "api/v2/auth/generateMobileOTP");

            request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            request.Content = new ByteArrayContent(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(generateMobileOTPRequest)));

            using (var response = await this.client.SendAsync(request, cancellationToken))
            {
                response.EnsureSuccessStatusCode();
                var responseString = await response.Content.ReadAsStringAsync();

                return(JsonConvert.DeserializeObject <GenerateMobileOTPResponse>(responseString));
            }
        }