2013-07-23 4 views
0

서명을 요청하기 위해 자체 논리를 사용하고 싶었지만 서명이 완료된 후 서명 된 이미지 (png)를 DocuSign 봉투로 보내려고합니다. "Accountless Signer 서명 이미지 설정"흐름을 살펴 보았지만 정상적으로 작동하는 것으로 보였지만 서명 이미지는 봉투에 삽입되어 있지 않습니다. Accountless Signer에 대한 서명 이미지 설정 DocuSign

내가 계정 정보를 얻기

  1. 뭘 오전입니다
  2. 하는 Signature 탭 추가받는 사람
  3. 추가 "를 작성 (초안)"상태
  4. 같은 템플릿에서 봉투 만들기
  5. 봉투 상태를 "생성 됨"에서 "보낸"으로 업데이트하십시오.
  6. 수신인의 서명 이미지를 설정하십시오.

모든 오류없이 정상적으로 작동하는 것으로 보입니다. 그러나 나는 이미지를 보지 않는다. 제가 잘못했거나 봉투에 서명 이미지를 보내는 사례가 있다면 알려주십시오.

+0

질문 - 당신이하려는 것은 무엇입니까? 직접 서명을 한 다음 완성 된 봉투를 DocuSign에 업로드 하시겠습니까? 아니면 선택한 전자 서명으로 시스템의 이미지를 DocuSign에 공급 하시겠습니까? – mikebz

+0

iPad에서 직접 서명하는 앱을 제작하려고합니다. 개인 서명을위한 UI를 기본적으로 작성한 다음 서명 이미지를 Docusign에 보내 봉투에 첨부했습니다. – user2608913

+0

본인에게 이메일을 보내주십시오. 이 일을하는 것이 간단한 답이고 스택 오버 플로우가 뒤쪽과 네 번째와 발견에 도움이되는지 나는 모른다. – mikebz

답변

0

독창적 인 솔루션을 얻으려면 언제든지 문의하십시오.하지만 iPad에서 서명을 얻는 가장 쉬운 방법은 서명 이미지 컬렉션을 DocuSign에 위임하는 것입니다. 여기 템플릿 (당신은 또한 문서 바이트 스트림으로 할 수있는)에 서명을 얻는 방법입니다. 이것은 GitHub 요지에서 가져온 것입니다 : https://gist.github.com/Ergin008/5645812.

iOS 앱의 웹보기에 서명보기를 표시 할 수 있습니다.

// 
// API Walkthrough 8 - Launch the signing (recipient) view of an envelope in an embedded session 
// 
// To run this sample: 
//  1. Copy the below code into your iOS project 
//  2. Enter your email, password, integrator key, name, templateId, and roleName and save 
//  3. Run the code 
// 

- (void)embeddedSigning 
{ 
    // Enter your info: 
    NSString *email = @"<#email#>"; 
    NSString *password = @"<#password#>"; 
    NSString *integratorKey = @"<#integratorKey#>"; 
    NSString *name = @"<#name#>"; 

    // use same name as template role you saved through the Console UI 
    NSString *roleName = @"<#roleName#>"; 

    // need to login to the console and copy a valid templateId into this string 
    NSString *templateId = @"<#templateId#>"; 

    /////////////////////////////////////////////////////////////////////////////////////// 
    // STEP 1 - Login (retrieves accountId and baseUrl) 
    /////////////////////////////////////////////////////////////////////////////////////// 

    NSString *loginURL = @"https://demo.docusign.net/restapi/v2/login_information"; 

    NSMutableURLRequest *loginRequest = [[NSMutableURLRequest alloc] init]; 
    [loginRequest setHTTPMethod:@"GET"]; 
    [loginRequest setURL:[NSURL URLWithString:loginURL]]; 

    // set JSON formatted X-DocuSign-Authentication header (XML format also accepted) 
    NSDictionary *authenticationHeader = @{ @"Username": email, @"Password" : password, @"IntegratorKey" : integratorKey }; 

    // jsonStringFromObject() function defined below... 
    [loginRequest setValue:[self jsonStringFromObject:authenticationHeader] forHTTPHeaderField:@"X-DocuSign-Authentication"]; 

    // also set the Content-Type header (other accepted type is application/xml) 
    [loginRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; 

    //*** make an asynchronous web request 
    [NSURLConnection sendAsynchronousRequest:loginRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *loginResponse, NSData *loginData, NSError *loginError) { 

     if (loginError) { // succesful GET returns status 200 
      NSLog(@"Error sending request %@. Got Response %@ Error is: %@", loginRequest, loginResponse, loginError); 
      return; 
     } 

     // we use NSJSONSerialization to parse the JSON formatted response 
     NSError *jsonError = nil; 
     NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:loginData options:kNilOptions error:&jsonError]; 
     NSArray *loginArray = responseDictionary[@"loginAccounts"]; 

     // parse the accountId and baseUrl from the response and use in the next request 
     NSString *accountId = loginArray[0][@"accountId"]; 
     NSString *baseUrl = loginArray[0][@"baseUrl"]; 

     //--- display results 
     NSLog(@"\naccountId = %@\nbaseUrl = %@\n", accountId, baseUrl); 

     /////////////////////////////////////////////////////////////////////////////////////// 
     // STEP 2 - Create Envelope via Template and send the envelope 
     /////////////////////////////////////////////////////////////////////////////////////// 

     // append "/envelopes" URI to your baseUrl and use as endpoint for signature request call 
     NSString *envelopesURL = [NSString stringWithFormat:@"%@/envelopes",baseUrl]; 

     NSMutableURLRequest *signatureRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:envelopesURL]]; 

     [signatureRequest setHTTPMethod:@"POST"]; 
     [signatureRequest setURL:[NSURL URLWithString:envelopesURL]]; 

     // construct a JSON formatted signature request body (multi-line for readability) 
     NSDictionary *signatureRequestData = @{@"accountId": accountId, 
               @"emailSubject" : @"Embedded Sending API call", 
               @"emailBlurb" : @"email body goes here", 
               @"templateId" : templateId, 
               @"templateRoles" : [NSArray arrayWithObjects: @{@"email":email, @"name": name, @"roleName": roleName, @"clientUserId": @"1001" }, nil ], 
               @"status" : @"sent" 
               }; 

     // convert request body into an NSData object 
     NSData* data = [[self jsonStringFromObject:signatureRequestData] dataUsingEncoding:NSUTF8StringEncoding]; 

     // attach body to the request 
     [signatureRequest setHTTPBody:data]; 

     // authentication and content-type headers 
     [signatureRequest setValue:[self jsonStringFromObject:authenticationHeader] forHTTPHeaderField:@"X-DocuSign-Authentication"]; 
     [signatureRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; 

     // Send the signature request... 
     [NSURLConnection sendAsynchronousRequest:signatureRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *envelopeResponse, NSData *envelopeData, NSError *envelopeError) { 

      NSError *jsonError = nil; 
      NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:envelopeData options:kNilOptions error:&jsonError]; 
      NSLog(@"Signature request sent, envelope info is: \n%@\n", responseDictionary); 

      // parse envelopeId from resposne as it will be used in next request 
      NSString *envelopeId = responseDictionary[@"envelopeId"]; 

      /////////////////////////////////////////////////////////////////////////////////////// 
      // STEP 3 - Get the Embedded Signing View (aka recipient view) of the envelope 
      /////////////////////////////////////////////////////////////////////////////////////// 

      // append /envelopes/{envelopeId}/views/recipient to baseUrl and use in request 
      NSString *embeddedURL = [NSString stringWithFormat:@"%@/envelopes/%@/views/recipient", baseUrl, envelopeId]; 

      NSMutableURLRequest *embeddedRequest = [[NSMutableURLRequest alloc] init]; 
      [embeddedRequest setHTTPMethod:@"POST"]; 
      [embeddedRequest setURL:[NSURL URLWithString:embeddedURL]]; 

      // simply set the returnUrl in the request body (user is directed here after signing) 
      NSDictionary *embeddedRequestData = @{@"returnUrl": @"http://www.docusign.com/devcenter", 
                @"authenticationMethod" : @"none", 
                @"email" : email, 
                @"userName" : name, 
                @"clientUserId" : @"1001" // must match clientUserId set is step 2 
                }; 

      // convert request body into an NSData object 
      NSData* data = [[self jsonStringFromObject:embeddedRequestData] dataUsingEncoding:NSUTF8StringEncoding]; 

      // attach body to the request 
      [embeddedRequest setHTTPBody:data]; 

      // set JSON formatted X-DocuSign-Authentication header (XML format also accepted) 
      NSDictionary *authenticationHeader = @{ @"Username": email, @"Password" : password, @"IntegratorKey" : integratorKey }; 

      // jsonStringFromObject() function defined below... 
      [embeddedRequest setValue:[self jsonStringFromObject:authenticationHeader] forHTTPHeaderField:@"X-DocuSign-Authentication"]; 

      // also set the Content-Type header (other accepted type is application/xml) 
      [embeddedRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; 

      //*** make an asynchronous web request 
      [NSURLConnection sendAsynchronousRequest:embeddedRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *embeddedResponse, NSData *embeddedData, NSError *embeddedError) { 

       if (embeddedError) { // succesful POST returns status 201 
        NSLog(@"Error sending request %@. Got Response %@ Error is: %@", embeddedRequest, embeddedResponse, embeddedError); 
        return; 
       } 

       // we use NSJSONSerialization to parse the JSON formatted response 
       NSError *jsonError = nil; 
       NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:embeddedData options:kNilOptions error:&jsonError]; 
       NSString *embeddedURLToken = responseDictionary[@"url"]; 

       //--- display results 
       NSLog(@"URL token created - please navigate to the following URL to start the embedded signing workflow:\n\n%@\n\n", embeddedURLToken); 
      }]; 
     }]; 
    }]; 
} 

- (NSString *)jsonStringFromObject:(id)object { 
    NSString *string = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:object options:0 error:nil] encoding:NSUTF8StringEncoding]; 
    return string; 
} 
관련 문제