/// <summary> /// Gets the capture image parameters with Json web token credentials. /// Json web token credentials contains enable or disable, if enable then need to provide jwt secret and token. /// </summary> /// <returns> /// Byte array of image with transaction Id and image extension. /// </returns> public CaptureDto CaptureImage(Capture model) { var captureDto = new CaptureDto(); Log.Information("[HCM][Capture Image][Req]" + "[" + JsonSerializer.Serialize(model) + "]"); try { var(statusCode, errorResult) = LockerManagementValidator.PayloadValidator(LockerConfiguration, model.JwtCredentials.IsEnabled, model.JwtCredentials.Secret, model.JwtCredentials.Token, PayloadTypes.CaptureImage, model.LockerId, model.TransactionId, null, CaptureType.Photo); if (statusCode != StatusCode.Status200OK) { return(CaptureMapper.ToError(new CaptureDto { StatusCode = statusCode, Error = errorResult })); } var result = LockerHelper.CapturePhoto(model, LockerConfiguration); captureDto = CaptureMapper.ToObject(result); Log.Information("[HCM][Capture Image][Res]" + "[Success]"); } catch (Exception ex) { Log.Error("[HCM][Capture Image]" + "[" + ex + "]"); return(CaptureMapper.ToError(new CaptureDto { StatusCode = StatusCode.Status500InternalServerError, Error = new Common.Exceptions.ApplicationException(ApplicationErrorCodes.InternalServerError, ex.Message) })); } return(captureDto); }
private async Task _insertAsync(Capture capture) { await this._captureRepositoryWriterAsync.InsertAsync(CaptureMapper.Map(capture)).ConfigureAwait(false); await this._unitOfWork.SaveChangesAsync().ConfigureAwait(false); }