示例#1
0
        public void ConvertNullSDKToAPI()
        {
            sdkSigner1 = null;
            converter  = new SignerConverter(sdkSigner1);

            Assert.IsNull(converter.ToAPISigner());
        }
示例#2
0
        public void ConvertNullAPIToAPI()
        {
            apiRole   = null;
            converter = new SignerConverter(apiRole);

            Assert.IsNull(converter.ToAPISigner());
        }
示例#3
0
        public void UpdateSigner(PackageId packageId, Signer signer)
        {
            Role apiPayload = new SignerConverter(signer).ToAPIRole(System.Guid.NewGuid().ToString());

            string path = template.UrlFor(UrlTemplate.UPDATE_SIGNER_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Replace("{roleId}", signer.Id)
                          .Build();

            try {
                string json = JsonConvert.SerializeObject(apiPayload, settings);
                restClient.Put(path, json);
            }
            catch (EslServerException e) {
                throw new EslServerException("Could not update signer." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) {
                throw new EslException("Could not update signer." + " Exception: " + e.Message, e);
            }
        }
示例#4
0
        public string AddSigner(PackageId packageId, Signer signer)
        {
            Role apiPayload = new SignerConverter(signer).ToAPIRole(System.Guid.NewGuid().ToString());

            string path = template.UrlFor(UrlTemplate.ADD_SIGNER_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Build();

            try {
                string json     = JsonConvert.SerializeObject(apiPayload, settings);
                string response = restClient.Post(path, json);
                Role   apiRole  = JsonConvert.DeserializeObject <Role> (response);

                return(apiRole.Id);
            }
            catch (EslServerException e) {
                throw new EslServerException("Could not add signer." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) {
                throw new EslException("Could not add signer." + " Exception: " + e.Message, e);
            }
        }
示例#5
0
		public void UpdateSigner( PackageId packageId, Signer signer )
		{
			Role apiPayload = new SignerConverter( signer ).ToAPIRole( System.Guid.NewGuid().ToString());

			string path = template.UrlFor (UrlTemplate.UPDATE_SIGNER_PATH)
				.Replace( "{packageId}", packageId.Id )
				.Replace( "{roleId}", signer.Id )
				.Build ();
			try {
				string json = JsonConvert.SerializeObject (apiPayload, settings);
				restClient.Put(path, json);              
			}
            catch (EslServerException e) {
                throw new EslServerException ("Could not update signer." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) {
				throw new EslException ("Could not update signer." + " Exception: " + e.Message, e);
			}
		}
示例#6
0
		public string AddSigner( PackageId packageId, Signer signer )
		{
			Role apiPayload = new SignerConverter( signer ).ToAPIRole( System.Guid.NewGuid().ToString());

			string path = template.UrlFor (UrlTemplate.ADD_SIGNER_PATH)
				.Replace( "{packageId}", packageId.Id )
				.Build ();
			try {
				string json = JsonConvert.SerializeObject (apiPayload, settings);
				string response = restClient.Post(path, json);              
				Role apiRole = JsonConvert.DeserializeObject<Role> (response);

				return apiRole.Id;
			} 
            catch (EslServerException e) {
                throw new EslServerException ("Could not add signer." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) {
				throw new EslException ("Could not add signer." + " Exception: " + e.Message, e);
			}
		}