/// <summary> /// /// </summary> /// <param name="docToSignPathFileName"></param> /// <param name="user"></param> /// <param name="idDictao"></param> /// <param name="businessId"></param> /// <param name="backUrl"></param> /// <returns>IHM url</returns> private static string SignBySecondUser(Upsilab.Data.Model.User user, bool isCustomer, string idDictao, string backUrl) { if (string.IsNullOrEmpty(idDictao)) { //throw new Exception(SignatureExceptionCode.TransactionIdMissing.ToString()); throw new Exception("La transaction de cette signature est expirée."); } DTPClient dtpClient = new DTPClient(idDictao); //User1 : create access user for second user (Adviser ?) //string termAndConditionsFileName = "termsAndConditions_fr.pdf"; string termAndConditionsFileName = "convention_preuve.pdf"; string termAndConditionsUrl = string.Format("{0}/Client/Documents/{1}", Upsilab.Business.Utility.UrlHelper.GetHost(), termAndConditionsFileName); string accessId = dtpClient.CreateUserAccess(string.Empty, user.UserName, user.UserFirstName, user.UserMobilePhone, backUrl, true, termAndConditionsUrl, isCustomer); //Send OTP by sms to user dtpClient.SendOtp(accessId); string IHM_url = dtpClient.BuildUserInterfaceUrl(accessId); return IHM_url; }
/// <summary> /// Sign by the first user /// </summary> /// <param name="docsToSignPathFileName"></param> /// <param name="user"></param> /// <param name="idDictao"></param> /// <param name="businessId"></param> /// <param name="backUrl"></param> /// <param name="IHM_Url"></param> /// <returns></returns> private static string SignByFirstUser(List<DocumentToSign> documentsToSign, Upsilab.Data.Model.User user, bool isCustomer, string idDictao, string businessId, string backUrl, out string IHM_Url) { DTPClient dtpClient = new DTPClient(); //If idDictao has value, cancel this transaction and create a new one if (!string.IsNullOrEmpty(idDictao)) { dtpClient.TransactionId = idDictao; try { dtpClient.CancelTransaction(); } catch { } } //#1 : Init transaction dtpClient.InitTransaction(businessId); //#2 : Provide document dtpClient.ProvideDocuments(documentsToSign); //#3 : create access user //string termAndConditionsFileName = "termsAndConditions_fr.pdf"; string termAndConditionsFileName = "convention_preuve.pdf"; string termAndConditionsUrl = string.Format("{0}/Client/Documents/{1}", Upsilab.Business.Utility.UrlHelper.GetHost(), termAndConditionsFileName); string accessId = dtpClient.CreateUserAccess(string.Empty, user.UserName, user.UserFirstName, user.UserMobilePhone, backUrl, true, termAndConditionsUrl, isCustomer); //#4 : send OTP by sms to user dtpClient.SendOtp(accessId); //#5 : build urlIhm IHM_Url = dtpClient.BuildUserInterfaceUrl(accessId); idDictao = dtpClient.TransactionId; return dtpClient.TransactionId; }