public async Task <Response> MobileCheckIn(string organisationId, MobileUpdateCountRequest payload) { var walletRequest = new CreateWalletRequest { MobileNumber = payload.MobileNumber }; var wallet = await _walletService.CreateWallet(walletRequest, true); var session = await _sessionService.CreateSession(payload.MobileNumber, wallet); var organisation = await _organisationRepository.GetAsync(Guid.Parse(organisationId)); if (organisation == default) { throw new NotFoundException(Messages.Org_NotExists); } await _smsService.SendWelcomeSms(payload.MobileNumber, organisation.Name, session.ExpireAt.Value, session.Id); var updateCounterRequest = new UpdateCountRequest { Latitude = payload.Latitude, Longitude = payload.Longitude, WalletId = wallet.Id.ToString() }; var counterResponse = await UpdateCountAsync(organisationId, updateCounterRequest, ScanType.CheckIn, true); return(counterResponse); }
public async Task <Response> MobileCheckOut(string organisationId, MobileUpdateCountRequest payload) { _cryptoService.EncryptAsServer(payload, true); var updateCounterRequest = new UpdateCountRequest { Latitude = payload.Latitude, Longitude = payload.Longitude, WalletId = await GetCheckoutWalletId(payload.MobileNumber) }; var counterResponse = await UpdateCountAsync(organisationId, updateCounterRequest, ScanType.CheckOut, true); return(counterResponse); }
public async Task <IActionResult> MobileCheckOut(string organisationId, [FromBody] MobileUpdateCountRequest payload) { var response = await _organisationService.MobileCheckOut(organisationId, payload); return(StatusCode(StatusCodes.Status200OK, response)); }