public override async Task <EmptyResponse> UploadKycFile(KycFileRequest request, ServerCallContext context) { var result = new EmptyResponse(); var token = context.GetBearerToken(); if (request.File.IsEmpty) { return(result); } var maxSize = _config.MaxReceiveMessageSizeInMb * 1024 * 1024; if (request.File.Length > maxSize) { result.Error = new ErrorResponseBody { Code = ErrorCode.InvalidField, Message = ErrorMessages.TooBig(nameof(request.File), request.File.Length.ToString(), maxSize.ToString()), }; result.Error.Fields.Add(nameof(request.File), result.Error.Message); return(result); } var provider = new FileExtensionContentTypeProvider(); if (!provider.TryGetContentType(request.Filename, out var contentType)) { contentType = "image/jpeg"; } using (var ms = new MemoryStream(request.File.ToByteArray())) { await _walletApiV1Client.KycFilesUploadFileAsync(request.DocumentType, string.Empty, new FileParameter(ms, request.Filename, contentType), token); return(result); } }
public override Task <EmptyResponse> UploadKycFile(KycFileRequest request, ServerCallContext context) { return(Task.FromResult(new EmptyResponse())); }