/// <summary> /// Отправить запрос на генерацию сертификата пользователя. /// </summary> /// <param name="requestData">Данные пользователя.</param> /// <returns>Ответ 1С.</returns> public C1Rescponse GenerateCertificate(GenerateCertificateRequest requestData) { var parameters = new { MSISDN = requestData.Msisdn, exclusiveAccess = ServiceCertificateHasExclusiveAccess, authorityGuid = ServiceAuthority, templateGuid = ServiceCertificateTemplate, subject = new Dictionary <string, string> { ["2.5.4.3"] = requestData.FullName, ["2.5.4.4"] = requestData.Surname, ["2.5.4.42"] = requestData.Name, ["2.5.4.6"] = requestData.Country, ["2.5.4.8"] = requestData.Region, ["2.5.4.7"] = requestData.City, ["1.2.643.100.3"] = requestData.Inn, ["1.2.643.3.131.1.1"] = requestData.Snils, ["1.2.840.113549.1.9.1"] = requestData.Email, } }; C1Rescponse <Guid> response = this.Request <Guid>("/Certificates/Generate", parameters); return(response); }
public C1Rescponse GenerateCertificate([FromBody] GenerateCertificateRequest model) { Argument.Require(model != null, "Параметры не заданы."); var response = c1Service.GenerateCertificate(model); return(response); }
public C1Rescponse <Guid> GenerateCertificate([FromBody] GenerateCertificateRequest model) { Argument.Require(model != null, "Параметры не заданы."); var response = c1Service.GenerateCertificate(model); if (response.StatusCode >= STATUS_BAD_MIN) { return(new C1Rescponse <Guid>(response)); } return(WaitTillResponse <Guid>(response.TransactionGuid)); }
public C1Rescponse GenerateCertificate(GenerateCertificateRequest requestData) { Argument.Require(requestData != null, "Данные для генерации сертификата пустые."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Msisdn), "Номер телефона не задан."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.FullName), "ФИО не задано."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.City), "Город не задан."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Country), "Страна не задана."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Email), "Email не задан."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Inn), "ИНН не задан."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Name), "ИО не заданы."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Region), "Регион не задан."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Snils), "СНИЛС не задан."); Argument.Require(!string.IsNullOrWhiteSpace(requestData.Surname), "Фамилия не задана."); var response = c1Repository.GenerateCertificate(requestData); return(response); }
public Task <ApiResponse <CertificateAndPrivateKey> > GenerateCertificateAsync(GenerateCertificateRequest generateCertificateRequest = null) { var localPath = "/test-tools/v1/generate-certificate"; throw new NotImplementedException(); // var request = new RestRequest(localPath, Method.POST) // .AddHeader("Accept", "application/json") // .AddHeader("X-Kontur-Apikey", Configuration.ApiKey); // // if (generateCertificateRequest != null) // { // request.AddJsonBody(generateCertificateRequest); // } // // var response = await restClient.ExecuteTaskAsync(request).ConfigureAwait(false); // // var localVarStatusCode = (int) response.StatusCode; // // if (ExceptionFactory != null) // { // var exception = ExceptionFactory("GenerateCertificate", response); // if (exception != null) throw exception; // } // // return new ApiResponse<CertificateAndPrivateKey>( // localVarStatusCode, // response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), // (CertificateAndPrivateKey) HttpHelper.Deserialize(response, typeof (CertificateAndPrivateKey))); }