public void AddAuthMethod(SigningInfo signingInfo, createrequestrequest request) { if (signingInfo.authMetod == (int)AuthMethod.BankId) { for (int i = 0; i < request.request[0].task.Length; i++) { request.request[0].task[i].authentication = new authentication { method = new string[] { "nbid", "nbid-mobil" } }; } } if (signingInfo.authMetod == (int)AuthMethod.Tupas) { for (int i = 0; i < request.request[0].task.Length; i++) { request.request[0].task[i].authentication = new authentication { method = new string[] { "tupas", "tupas-mobil" } }; } } if (signingInfo.authMetod == (int)AuthMethod.NemId) { for (int i = 0; i < request.request[0].task.Length; i++) { request.request[0].task[i].authentication = new authentication { method = new string[] { "nemid" } }; } } if (signingInfo.authMetod == (int)AuthMethod.Otp) { for (int i = 0; i < request.request[0].task.Length; i++) { request.request[0].task[i].authentication = new authentication { method = new string[] { "scid-otp" } }; } } if (signingInfo.authMetod == (int)AuthMethod.Social) { for (int i = 0; i < request.request[0].task.Length; i++) { request.request[0].task[i].authentication = new authentication { method = new string[] { "social" } }; } } }
internal createrequestrequest GetCreateRequest(sdsdocument[] documentInSds, List <ContactInfo> recipients, SigningInfo signingInfo) { try { request[] req = new[] { CreateRequest(documentInSds, recipients, signingInfo) }; var request = new createrequestrequest { password = "******", service = "prosesspilotene", request = req }; return(request); } catch (Exception ex) { throw new Exception(ex.Message); } }
internal void AddSmsNotification(createrequestresponse response, createrequestrequest request, SigningInfo signingInfo, int i, string url, string phonenr) { using (var client = new DocumentEndPointClient()) { var smsnotify = new notification { notificationid = "send_sms_" + i, type = notificationtype.SMS, recipient = phonenr, message = signingInfo.SMSText + " " + url }; var notifySmsReq = new addnotificationrequest { service = "prosesspilotene", notification = smsnotify, password = "******", requestid = response.requestid[0], taskid = request.request[0].task[i].id }; client.addNotification(notifySmsReq); } }
public string CreateSignRequest(sdsdocument uploadedDocument, string customerorg, string language, int method) { var lang = "en"; if (language == "1044") { lang = "nb"; } var signmethodText = new SignatureHandler().GetMethod(method); var signInfo = new SigningInfo(); signInfo.signingMetodText = signmethodText; signInfo.isInk = true; var authMethod = new SignatureHandler().GetAuthSignatures(signInfo); var signatures = new SignatureHandler().GetSignatures(signInfo); bool bundle = signInfo.signingMetodText == "nbid"; var request = new createrequestrequest { password = "******", service = "prosesspilotene", request = new request[] { new request { clientreference = "cliref1", language = lang, profile = "default", document = new document[] { new sdsdocument { id = uploadedDocument.id, refsdsid = uploadedDocument.refsdsid, description = uploadedDocument.description } }, subject = new subject[] { new subject { id = "subj_1", mobile = "99999999" //nationalid = "1909740939" } }, task = new task[] { new task { id = "task_1", subjectref = "subj_1", bundle = true, bundleSpecified = bundle, documentaction = new documentaction[] { new documentaction { type = documentactiontype.sign, documentref = uploadedDocument.id } }, authenticationbasedsignature = authMethod, signature = signatures } } } } }; for (int i = 0; i < request.request[0].task.Length; i++) { var callbackOnTaskCompleteUrl = "https://prosesspilotenesignicatwebapi-preprod.azurewebsites.net:443/api/Callback/Landingpage?lcid=" + Convert.ToString(language); var callbackNotificationUrl = "https://prosesspilotenesignicatwebapi-preprod.azurewebsites.net:443/api/Callback/GetSigning?orgname=" + customerorg; request.request[0].task[i].ontaskcomplete = callbackOnTaskCompleteUrl; request.request[0].task[i].notification = new[] { new notification { notificationid = "req_callback_" + i, type = notificationtype.URL, recipient = callbackNotificationUrl, message = "callbackurl", schedule = new [] { new schedule { stateis = taskstatus.completed } } } }; } createrequestresponse response; using (var client = new DocumentEndPointClient()) { response = client.createRequest(request); } return (String.Format("https://preprod.signicat.com/std/docaction/prosesspilotene?request_id={0}&task_id={1}", response.requestid[0], request.request[0].task[0].id)); }
public async Task <List <string> > Post() { var signHereUrlList = new List <string>(); if (HttpContext.Current.Request.Files.AllKeys.Any()) { var postedFiles = new List <HttpPostedFile>(); // Get the uploaded image from the Files collection for (int i = 0; i < HttpContext.Current.Request.Files.Count; i++) { postedFiles.Add(HttpContext.Current.Request.Files["file" + i]); } // Get the uploaded recipients var recipients = new List <ContactInfo>(); var postedRecipientEmails = HttpContext.Current.Request.Params["RecipientEmails"]; var postedRecipientMobiles = HttpContext.Current.Request.Params["RecipientMobiles"]; //var postedRecipientSSN = HttpContext.Current.Request.Params["RecipientSSN"]; if (postedRecipientEmails != null) { var recipientEmailList = postedRecipientEmails.Split(','); var recipientMobileList = postedRecipientMobiles.Split(','); //var recipientSSNList = postedRecipientSSN.Split(','); for (int i = 0; i < recipientEmailList.Length; i++) { if (recipientEmailList[i] == "null") { continue; } var contactInfo = new ContactInfo(); contactInfo.email = recipientEmailList[i]; contactInfo.mobile = recipientMobileList[i]; //contactInfo.ssn = recipientSSNList[i]; recipients.Add(contactInfo); } } var signingInfo = Helpers.GetSignInfo(HttpContext.Current.Request); if (postedFiles.Count > 0) { var signHandler = new SignRequestHandler(); sdsdocument[] uploadedDocuments = await signHandler.UploadDocument(postedFiles); if (uploadedDocuments == null) { return(null); } signingInfo.signingMetodText = new SignatureHandler().GetMethod(signingInfo.signMethod); //signingInfo.isInk = new SignatureHandler().CheckIfInk(signingInfo.signMethod); createrequestrequest request = signHandler.GetCreateRequest(uploadedDocuments, recipients, signingInfo); new SignatureHandler().AddAuthMethod(signingInfo, request); try { createrequestresponse response; using (var client = new DocumentEndPointClient()) { response = client.createRequest(request); } for (int i = 0; i < request.request[0].task.Length; i++) { var url = String.Format( "https://preprod.signicat.com/std/docaction/prosesspilotene?request_id={0}&task_id={1}", response.requestid[0], request.request[0].task[i].id); signHereUrlList.Add(url); var phonenr = request.request[0].task[i].subject.mobile; if (signingInfo.SendSMS && !string.IsNullOrWhiteSpace(phonenr)) { new NotificationHandler().AddSmsNotification(response, request, signingInfo, i, url, phonenr); } } } catch (Exception ex) { throw new Exception(ex.Message); } } } return(signHereUrlList); }
// Creates a "document order" request, i.e. a mapping to the object model provided // by the DocumentService, a Signicat web service for administering signature processes. private createrequestrequest GetRequest(provideddocument document, string method, string spListId, string spSource, string spListUrlDir) { string queryString = "?rid=${requestId}&" + string.Format("SPListId={0}&documentName={1}&SPSource={2}&SPListURLDir={3}", Url.Encode(spListId), Url.Encode(document.description), Url.Encode(spSource), Url.Encode(spListUrlDir)); var request = new createrequestrequest { password = PASSWORD, service = SERVICE, request = new request[] { new request { profile = "slim", language = "en", document = new document[] { document }, task = new task[] { new task { bundle = false, bundleSpecified = true, id = "task_1", ontaskcomplete = Url.Action("Return", "Home", null, Request.Url.Scheme) + queryString, ontaskcancel = Url.Action("Return", "Home", null, Request.Url.Scheme) + queryString, ontaskpostpone = Url.Action("Return", "Home", null, Request.Url.Scheme) + queryString, documentaction = new documentaction[] { new documentaction { type = documentactiontype.sign, documentref = document.id, sendresulttoarchive = true, sendresulttoarchiveSpecified = true } }, signature = new signature[] { new signature { method = new string[] { method } } }, authentication = new authentication { artifact = true, artifactSpecified = true } } } } } }; return request; }
// Creates a "document order" request, i.e. a mapping to the object model provided // by the DocumentService, a Signicat web service for administering signature processes. private createrequestrequest GetRequest(provideddocument document, string method, string spListId, string spSource, string spListUrlDir) { string queryString = "?rid=${requestId}&" + string.Format("SPListId={0}&documentName={1}&SPSource={2}&SPListURLDir={3}", Url.Encode(spListId), Url.Encode(document.description), Url.Encode(spSource), Url.Encode(spListUrlDir)); var request = new createrequestrequest { password = PASSWORD, service = SERVICE, request = new request[] { new request { profile = "slim", language = "en", document = new document[] { document }, task = new task[] { new task { bundle = false, bundleSpecified = true, id = "task_1", ontaskcomplete = Url.Action("Return", "Home", null, Request.Url.Scheme) + queryString, ontaskcancel = Url.Action("Return", "Home", null, Request.Url.Scheme) + queryString, ontaskpostpone = Url.Action("Return", "Home", null, Request.Url.Scheme) + queryString, documentaction = new documentaction[] { new documentaction { type = documentactiontype.sign, documentref = document.id, sendresulttoarchive = true, sendresulttoarchiveSpecified = true } }, signature = new signature[] { new signature { method = new string[] { method } } }, authentication = new authentication { artifact = true, artifactSpecified = true } } } } } }; return(request); }