Skip to content

Commit 65fa564

Browse files
committed
moved viewrequest creation to the seperate method
1 parent 807bb71 commit 65fa564

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

launcher-csharp/eSignature/Examples/EmbeddedSending.cs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,25 @@ public static string SendEnvelopeUsingEmbeddedSending(string signerEmail, string
4545
// Step 3. create the sender view
4646
// Call the CreateSenderView API
4747
// Exceptions will be caught by the calling function
48+
EnvelopeViewRequest viewRequest = PrepareViewRequest(startingView, returnUrl);
49+
50+
ViewUrl result1 = envelopesApi.CreateSenderView(accountId, envelopeId, viewRequest);
51+
52+
// Switch to Recipient and Documents view if requested by the user
53+
string redirectUrl = result1.Url;
54+
Console.WriteLine("startingView: " + startingView);
55+
if ("recipient".Equals(startingView))
56+
{
57+
redirectUrl = redirectUrl.Replace("send=1", "send=0");
58+
}
59+
60+
//ds-snippet-end:eSign11Step3
61+
62+
return redirectUrl;
63+
}
64+
65+
private static EnvelopeViewRequest PrepareViewRequest(string startingView, string returnUrl)
66+
{
4867
EnvelopeViewSettings viewSettings = new EnvelopeViewSettings
4968
{
5069
StartingScreen = startingView,
@@ -82,20 +101,7 @@ public static string SendEnvelopeUsingEmbeddedSending(string signerEmail, string
82101
ViewAccess = "envelope",
83102
Settings = viewSettings,
84103
};
85-
86-
ViewUrl result1 = envelopesApi.CreateSenderView(accountId, envelopeId, viewRequest);
87-
88-
// Switch to Recipient and Documents view if requested by the user
89-
string redirectUrl = result1.Url;
90-
Console.WriteLine("startingView: " + startingView);
91-
if ("recipient".Equals(startingView))
92-
{
93-
redirectUrl = redirectUrl.Replace("send=1", "send=0");
94-
}
95-
96-
//ds-snippet-end:eSign11Step3
97-
98-
return redirectUrl;
104+
return viewRequest;
99105
}
100106

101107
//ds-snippet-start:eSign11Step2

0 commit comments

Comments
 (0)