private async void SendOtp_Tapped(object sender, EventArgs e) { await SendOtp.ScaleTo(.95); Loading.IsVisible = true; await SendOtp.ScaleTo(1); Navigation.PushAsync(new VerifyOtpPage()); Loading.IsVisible = false; }
/// <summary> /// Sets the send otp member by providing locker station id, phone number, lsp id, booking id. /// </summary> /// <returns> /// Gets the success bool flag and ref code. /// </returns> public SendOtpDto SendOtp(SendOtp model) { var request = SerializerHelper <SendOtp> .SerializeObject(model); Log.Information("[Send Otp][Req]" + "[" + request + "]"); var response = HttpHandler.PostRequestResolver(request, HttpMethod.Post, MemberInfo.Version, MemberInfo.ClientId, MemberInfo.ClientSecret, UriAbsolutePath.SendOtp, TokenResponse.AccessToken, TokenResponse.DateTime); Log.Information("[Send Otp][Res]" + "[" + response + "]"); var result = JsonConvert.DeserializeObject <SendOtpResponse>(response); return(SendOtpMapper.ToObject(result)); }
public async Task <IActionResult> ResetOTP(SendOtp sendOtp) { var response = await _userService.ResetOTP(sendOtp, Context); return(ServiceResponse(response)); //switch (response.Status) //{ // case BusinessStatus.NotFound: // return Ok(response); // case BusinessStatus.Ok: // return Ok(response); // default: // return Forbid(); //} //return Ok(OtpData); }
public async Task <SendOtpResponse> ResetOTP(SendOtp sendOtp, ApiContext apiContext) { _context = (MICAUMContext)DbManager.GetContext(apiContext.ProductType, apiContext.ServerType); var user = _context.AspNetUsers.SingleOrDefault(x => x.Email == sendOtp.Email); try { if (user != null) { EmailTest emailTest = new EmailTest(); Random random = new Random(); int otp = random.Next(1001, 9999); var chkotp = _context.TblSendOtp.Where(a => a.Email == sendOtp.Email); if (chkotp != null) { foreach (var item in chkotp) { _context.TblSendOtp.Remove(item); } } sendOtp.UserId = user.Id; sendOtp.UserName = user.UserName; sendOtp.Otp = otp.ToString(); TblSendOtp _otp = _mapper.Map <TblSendOtp>(sendOtp); _context.TblSendOtp.Add(_otp); _context.SaveChanges(); emailTest.To = sendOtp.Email; emailTest.Subject = "Password reset for MICA"; emailTest.Message = "Dear User,\n" + " " + "\n" + " OTP for re-setting your MICA password is: " + otp + " " + "\n" + "\nThanks & Regards:\n" + " " + "MICA Team"; await SendEmailAsync(emailTest); } else { return(new SendOtpResponse { Status = BusinessStatus.NotFound, sendOtp = sendOtp, ResponseMessage = $"Please enter registered Email-ID" }); } } catch (Exception ex) { throw; } return(new SendOtpResponse { Status = BusinessStatus.Ok, sendOtp = sendOtp, ResponseMessage = $"OTP Sent Successfully!" }); }
/// <summary> /// Sets the send otp member by providing locker station id, phone number, lsp id, booking id. /// </summary> /// <returns> /// Gets the success bool flag and ref code. /// </returns> public JObject SendOtp(SendOtp model) { JObject result; if (TokenResponse.StatusCode == 200) { var request = SerializerHelper <SendOtp> .SerializeObject(model); Log.Information("[Send Otp][Req]" + "[" + request + "]"); var response = HttpHandler.PostRequestResolver(request, HttpMethod.Post, MemberInfo.Version, MemberInfo.ClientId, MemberInfo.ClientSecret, UriAbsolutePath.SendOtp, TokenResponse.AccessToken, TokenResponse.DateTime); Log.Information("[Send Otp][Res]" + "[" + response + "]"); result = JObject.Parse(response); return(result); } return(JObject.Parse(SerializerHelper <AuthenticationError> .SerializeObject(new AuthenticationError(false, "401", "Unauthenticated")))); }
public async Task <SendOtpResponse> ResetOTP(SendOtp sendOtp, ApiContext apiContext) { return(await _userproductService(apiContext.ProductType).ResetOTP(sendOtp, apiContext)); }
public Task <SendOtpResponse> SendOTP(SendOtp sendOtp, ApiContext apiContext) { throw new NotImplementedException(); }
public Task HandleAsync(SendOtp request, CancellationToken cancellationToken) { Thread.Sleep(4000); Debug.WriteLine(nameof(SendOtp)); return(Task.CompletedTask); }
public static void ConsumerReturn(string lockerStationId, GatewayService gatewayService) { #region Health Check var healthCheckResult = gatewayService.HealthCheck(); Console.WriteLine("[Health Check][Res]"); Console.WriteLine(JsonConvert.SerializeObject(healthCheckResult, Formatting.Indented)); #endregion #region PIN Verification Console.Write("-----------------------------------------------------------------------------\n"); Console.Write("[Consumer Return PIN Verification][Req]\n"); Console.Write("Pin: "); string consumerCollectPin = Console.ReadLine(); Console.Write("Action: "); string action = Console.ReadLine(); var consumerPin = new ConsumerPin { LockerStationId = lockerStationId, Pin = consumerCollectPin, Action = action }; var consumerPinResult = gatewayService.GetBookingByConsumerPin(consumerPin); Console.WriteLine("[Consumer Return PIN Verification][Res]"); Console.WriteLine(JsonConvert.SerializeObject(consumerPinResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Find Booking By Tracking Number Console.WriteLine("[Find Booking By Tracking Number][Req]"); Console.Write("Tracking Number: "); string trackingNumber = Console.ReadLine(); Console.Write("Booking Id: "); string bookingId = Console.ReadLine(); Console.Write("Action: "); string bookingAction = Console.ReadLine(); var findBookingResult = gatewayService.FindBooking(trackingNumber, lockerStationId, bookingId, bookingAction); Console.WriteLine("[Find Booking By Tracking Number][Res]"); Console.WriteLine(JsonConvert.SerializeObject(findBookingResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Send OTP Console.WriteLine("[Send Otp][Req]\n"); Console.Write("MobileNumber: "); string consumerCollectMobileNumber = Console.ReadLine(); Console.Write("BookingId: "); string consumerBookingId = Console.ReadLine(); var sendOtp = new SendOtp() { LockerStationId = lockerStationId, PhoneNumber = consumerCollectMobileNumber, BookingId = consumerBookingId }; var sendOtpResult = gatewayService.SendOtp(sendOtp); Console.WriteLine("[Send Otp][Res]"); Console.WriteLine(JsonConvert.SerializeObject(sendOtpResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); var sendOtpResponse = JsonConvert.DeserializeObject <SendOtpResponse>(sendOtpResult.ToString()); #endregion #region Verify Otp Console.WriteLine("[Verify Otp][Req]"); Console.Write("Code: "); string code = Console.ReadLine(); Console.Write("Booking Id: "); string consumerReturnBookingId = Console.ReadLine(); var verifyOtpModel = new VerifyOtp { LockerStationId = lockerStationId, Code = code, RefCode = sendOtpResponse.RefCode, BookingId = consumerReturnBookingId }; var verifyOtpResult = gatewayService.VerifyOtp(verifyOtpModel); Console.WriteLine("[Verify Otp][Res]"); Console.WriteLine(JsonConvert.SerializeObject(verifyOtpResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Open Compartment Console.WriteLine("[Open Compartment][Req]"); string transactionId = Guid.NewGuid().ToString(); Console.Write("Locker Id: "); string lockerId = Console.ReadLine(); Console.Write("Compartment Id: "); string compartmentIds = Console.ReadLine(); string[] compartmentId = compartmentIds.Split(','); var openCompartment = new HCM.Core.DataObjects.Models.Compartment(transactionId, lockerId, compartmentId, false, string.Empty, string.Empty); var openCompartmentResult = gatewayService.OpenCompartment(openCompartment); Console.WriteLine("[Open Compartment][Res]"); Console.WriteLine(JsonConvert.SerializeObject(openCompartmentResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Compartment Status Console.WriteLine("[Compartment Status][Req]"); Console.Write("Locker Id: "); lockerId = Console.ReadLine(); Console.Write("Compartment Id: "); compartmentIds = Console.ReadLine(); compartmentId = compartmentIds.Split(','); var compartmentStatus = new HCM.Core.DataObjects.Models.Compartment(transactionId, lockerId, compartmentId, false, string.Empty, string.Empty); var compartmentStatusResult = gatewayService.CompartmentStatus(compartmentStatus); Console.WriteLine("[Compartment Status][Res]"); Console.WriteLine(JsonConvert.SerializeObject(compartmentStatusResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Capture Image Console.WriteLine("[Capture Image][Req]"); Console.Write("Locker Id: "); lockerId = Console.ReadLine(); var captureImage = new Capture(transactionId, lockerId, false, string.Empty, string.Empty); var captureImageResult = gatewayService.CaptureImage(captureImage); Console.WriteLine("[Capture Image][Res]"); Console.WriteLine(JsonConvert.SerializeObject(captureImageResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Update Booking Status Console.WriteLine("[Update Booking Status][Req]"); Console.Write("Booking Id: "); string UpdateBookingStatusBookingId = Console.ReadLine(); Console.Write("Status: "); string status = Console.ReadLine(); Console.Write("MobileNumber: "); string mobileNumber = Console.ReadLine(); Console.Write("Reason: "); string updateBookingReason = Console.ReadLine(); var bookingStatusUpdate = new BookingStatus() { LockerStationId = lockerStationId, BookingId = Convert.ToInt32(UpdateBookingStatusBookingId), LspId = string.Empty, LspUserId = string.Empty, MobileNumber = mobileNumber, Status = status, Reason = updateBookingReason }; var bookingStatusUpdateResult = gatewayService.UpdateBookingStatus(bookingStatusUpdate); Console.WriteLine("[Update Booking Status][Res]"); Console.WriteLine(JsonConvert.SerializeObject(bookingStatusUpdateResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion }
public static void ConsumerCollect(string lockerStationId, GatewayService gatewayService) { #region Health Check var healthCheckResult = gatewayService.HealthCheck(); Console.WriteLine("[Health Check][Res]"); Console.WriteLine(JsonConvert.SerializeObject(healthCheckResult, Formatting.Indented)); #endregion #region PIN Verification Console.Write("-----------------------------------------------------------------------------\n"); Console.Write("[Consumer Collect PIN Verification][Req]\n"); Console.Write("Pin: "); string consumerCollectPin = Console.ReadLine(); Console.Write("Action: "); string action = Console.ReadLine(); var consumerPin = new ConsumerPin { LockerStationId = lockerStationId, Pin = consumerCollectPin, Action = action }; var consumerPinResult = gatewayService.GetBookingByConsumerPin(consumerPin); Console.WriteLine("[Consumer Collect PIN Verification][Res]"); Console.WriteLine(JsonConvert.SerializeObject(consumerPinResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Send OTP Console.WriteLine("[Send Otp][Req]\n"); Console.Write("MobileNumber: "); string consumerCollectMobileNumber = Console.ReadLine(); Console.Write("BookingId: "); string consumerBookingId = Console.ReadLine(); Console.Write("LspId: "); string consumerLspId = Console.ReadLine(); var sendOtp = new SendOtp() { LockerStationId = lockerStationId, LspId = consumerLspId, PhoneNumber = consumerCollectMobileNumber, BookingId = consumerBookingId }; var sendOtpResult = gatewayService.SendOtp(sendOtp); Console.WriteLine("[Send Otp][Res]"); Console.WriteLine(JsonConvert.SerializeObject(sendOtpResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Verify Consumer Otp Console.WriteLine("[Consumer Verify Otp][Req]"); Console.Write("Code: "); string consumerCode = Console.ReadLine(); Console.Write("Phone Number: "); string ConsumerPhoneNumber = Console.ReadLine(); Console.Write("LspId: "); string consumerVerifyPinLspId = Console.ReadLine(); Console.Write("Ref Code: "); string consumerRefCode = Console.ReadLine(); var consumerVerifyOtpModel = new VerifyOtp { LockerStationId = lockerStationId, LspId = consumerVerifyPinLspId, Code = consumerCode, PhoneNumber = ConsumerPhoneNumber, RefCode = consumerRefCode }; var consumerVerifyOtpResult = gatewayService.VerifyOtp(consumerVerifyOtpModel); Console.WriteLine("[Consumer Verify Otp][Res]"); Console.WriteLine(JsonConvert.SerializeObject(consumerVerifyOtpResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Open Compartment Console.WriteLine("[Open Compartment][Req]"); string ConsumerTransactionId = Guid.NewGuid().ToString(); Console.Write("Locker Id: "); string ConsumerLockerId = Console.ReadLine(); Console.Write("Compartment Id: "); string consumerCompartmentIds = Console.ReadLine(); string[] consumerCompartmentId = consumerCompartmentIds.Split(','); var consumerOpenCompartment = new HCM.Core.DataObjects.Models.Compartment(ConsumerTransactionId, ConsumerLockerId, consumerCompartmentId, false, string.Empty, string.Empty); var consumerOpenCompartmentResult = gatewayService.OpenCompartment(consumerOpenCompartment); Console.WriteLine("[Open Compartment][Res]"); Console.WriteLine(JsonConvert.SerializeObject(consumerOpenCompartmentResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion #region Update Booking Status Console.WriteLine("[Update Booking Status][Req]"); Console.Write("Booking Id: "); string consumerUpdateBookingStatusBookingId = Console.ReadLine(); Console.Write("Status: "); string consumerStatus = Console.ReadLine(); Console.Write("MobileNumber: "); string consumerMobileNumber = Console.ReadLine(); Console.Write("Reason: "); string consumerUpdateBookingReason = Console.ReadLine(); var consumerBookingStatusUpdate = new BookingStatus() { LockerStationId = lockerStationId, BookingId = Convert.ToInt32(consumerUpdateBookingStatusBookingId), LspId = consumerLspId, MobileNumber = consumerMobileNumber, Status = consumerStatus, Reason = consumerUpdateBookingReason }; var consumerBookingStatusUpdateResult = gatewayService.UpdateBookingStatus(consumerBookingStatusUpdate); Console.WriteLine("[Update Booking Status][Res]"); Console.WriteLine(JsonConvert.SerializeObject(consumerBookingStatusUpdateResult, Formatting.Indented)); Console.WriteLine("-----------------------------------------------------------------------------"); #endregion }
public async Task <IActionResult> SendOTP(SendOtp sendOtp) { var OtpData = await _userService.SendOTP(sendOtp, Context); return(Ok(OtpData)); }