From 26b8f4833354b25b7f8e5948773ddd43460dfe81 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Tue, 7 Jul 2020 14:38:12 -0700 Subject: [PATCH 001/699] UX changes requested by Sai (#1) * sigma's changes * ux changes except buttons * update the buttons * turn must_authenticate into a non-jumbotron element * ux modifications * account for margins in examples * change config filename and update link to remove 'eg' --- README.md | 2 +- code-examples-java.iml | 7 +- .../java/com/JsonPropertySourceLoader.java | 10 +++ .../controller/GlobalControllerAdvice.java | 17 +++-- .../java/com/docusign/model/DoneExample.java | 42 +++++++++++ src/main/resources/META-INF/spring.factories | 2 + src/main/resources/application.example.json | 39 ++++++++++ src/main/resources/application.properties | 51 ------------- .../resources/public/assets/banner-code.png | Bin 0 -> 53558 bytes src/main/resources/public/assets/css.css | 71 +++++++++++------- .../webapp/WEB-INF/templates/views/error.jsp | 15 ++-- .../views/pages/ds_must_authenticate.jsp | 7 +- .../templates/views/pages/examples/eg001.jsp | 2 +- .../templates/views/pages/examples/eg002.jsp | 2 +- .../templates/views/pages/examples/eg003.jsp | 2 +- .../templates/views/pages/examples/eg004.jsp | 4 +- .../templates/views/pages/examples/eg005.jsp | 4 +- .../templates/views/pages/examples/eg006.jsp | 4 +- .../templates/views/pages/examples/eg007.jsp | 6 +- .../templates/views/pages/examples/eg008.jsp | 2 +- .../templates/views/pages/examples/eg009.jsp | 4 +- .../templates/views/pages/examples/eg010.jsp | 2 +- .../templates/views/pages/examples/eg011.jsp | 2 +- .../templates/views/pages/examples/eg012.jsp | 2 +- .../templates/views/pages/examples/eg013.jsp | 4 +- .../templates/views/pages/examples/eg014.jsp | 2 +- .../templates/views/pages/examples/eg015.jsp | 4 +- .../templates/views/pages/examples/eg016.jsp | 2 +- .../templates/views/pages/examples/eg017.jsp | 4 +- .../templates/views/pages/examples/eg018.jsp | 4 +- .../templates/views/pages/examples/eg019.jsp | 2 +- .../templates/views/pages/examples/eg020.jsp | 2 +- .../templates/views/pages/examples/eg021.jsp | 2 +- .../templates/views/pages/examples/eg022.jsp | 2 +- .../templates/views/pages/examples/eg023.jsp | 2 +- .../templates/views/pages/examples/eg024.jsp | 2 +- .../templates/views/pages/examples/eg025.jsp | 2 +- .../templates/views/pages/examples/eg026.jsp | 2 +- .../templates/views/pages/examples/eg027.jsp | 2 +- .../templates/views/pages/examples/eg028.jsp | 2 +- .../templates/views/pages/examples/eg029.jsp | 4 +- .../templates/views/pages/examples/eg030.jsp | 6 +- .../templates/views/pages/examples/eg031.jsp | 2 +- .../WEB-INF/templates/views/pages/index.jsp | 22 ++++-- .../WEB-INF/templates/views/partials/head.jsp | 20 +++-- 45 files changed, 236 insertions(+), 157 deletions(-) create mode 100644 src/main/java/com/JsonPropertySourceLoader.java create mode 100644 src/main/resources/META-INF/spring.factories create mode 100644 src/main/resources/application.example.json delete mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/public/assets/banner-code.png diff --git a/README.md b/README.md index f054c89d..6fd64d00 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ When the token expires, it updates automatically. ### Short installation instructions * Download or clone this repository. * The project includes a Maven pom file. -* Create a file `code-examples-java/src/main/resources/application-dev.properties` and configure the project by overriding necessary properties from the `application.properties` file. **Don't add this file into the Git index.** +* Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.**. * Add VM argument `-Dspring.profiles.active=dev` to your IDE * Note that IntelliJ Community Edition does not directly support Spring Boot applications. diff --git a/code-examples-java.iml b/code-examples-java.iml index 6d509eea..4d8b5e52 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -2,7 +2,12 @@ - + + + file://$MODULE_DIR$/src/main/java/com/docusign/App.java + file://$MODULE_DIR$/src/main/java/com/docusign/WebSecurityConfig.java + + diff --git a/src/main/java/com/JsonPropertySourceLoader.java b/src/main/java/com/JsonPropertySourceLoader.java new file mode 100644 index 00000000..1f1471e9 --- /dev/null +++ b/src/main/java/com/JsonPropertySourceLoader.java @@ -0,0 +1,10 @@ +package com.docusign; + +import org.springframework.boot.env.YamlPropertySourceLoader; + +public class JsonPropertySourceLoader extends YamlPropertySourceLoader { + @Override + public String[] getFileExtensions () { + return new String[]{"json"}; + } +} \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/controller/GlobalControllerAdvice.java index 3bb8a174..446c1120 100644 --- a/src/main/java/com/docusign/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/controller/GlobalControllerAdvice.java @@ -102,7 +102,7 @@ public Locals populateLocals() { user.setAccessToken(details.getTokenValue()); if (account.isEmpty()) { - account = Optional.of(getDefaultAccountInfo(getOAuthAccounts(oauth))); + account = Optional.ofNullable(getDefaultAccountInfo(getOAuthAccounts(oauth))); } OAuth.Account oauthAccount = account.orElseThrow(() -> new NoSuchElementException(ERROR_ACCOUNT_NOT_FOUND)); @@ -124,11 +124,14 @@ private static List getOAuthAccounts(OAuth2Authentication oauth) } private OAuth.Account getDefaultAccountInfo(List accounts) { - if (StringUtils.isBlank(config.getTargetAccountId())) { - return getDefaultAccount(accounts); + String targetAccountId = config.getTargetAccountId(); + if (StringUtils.isNotBlank(targetAccountId)) { + OAuth.Account account = getAccountById(accounts, targetAccountId); + if(account != null) { + return account; + } } - - return getAccountById(accounts); + return getDefaultAccount(accounts); } private static OAuth.Account getDefaultAccount(List accounts) { @@ -140,9 +143,9 @@ private static OAuth.Account getDefaultAccount(List accounts) { return null; } - private OAuth.Account getAccountById(List accounts) { + private static OAuth.Account getAccountById(List accounts, String accountId) { for (OAuth.Account oauthAccount : accounts) { - if (StringUtils.equals(oauthAccount.getAccountId(), config.getTargetAccountId())) { + if (StringUtils.equals(oauthAccount.getAccountId(), accountId)) { return oauthAccount; } } diff --git a/src/main/java/com/docusign/model/DoneExample.java b/src/main/java/com/docusign/model/DoneExample.java index a6d41836..af3a5114 100644 --- a/src/main/java/com/docusign/model/DoneExample.java +++ b/src/main/java/com/docusign/model/DoneExample.java @@ -30,6 +30,28 @@ public class DoneExample { private Iterable diff; + + /** + * Creates DoneExample object with title. This method initializes title. + * @param String title + * @return created instance of this class + */ + public DoneExample withTitle(String title) { + this.title = title; + return this; + } + + /** + * Creates DoneExample object with name. This method initializes name. + * @param String name + * @return created instance of this class + */ + public DoneExample withName(String name) { + this.name = name; + return this; + } + + /** * Creates default DoneExample object. This method initializes title and * name members by the same value. @@ -42,6 +64,26 @@ public static DoneExample createDefault(String title) { .withName(title); } + /** + * Creates DoneExample object with message. This method initializes message. + * @param String message + * @return created instance of this class + */ + public DoneExample withMessage(String message) { + this.message = message; + return this; + } + + /** + * Creates DoneExample object with stackTrace. This method initializes error stack trace. + * @param StackTraceElement[] stackTrace + * @return created instance of this class + */ + public DoneExample withStackTrace(StackTraceElement[] stackTrace) { + this.stackTrace = stackTrace; + return this; + } + /** * Creates a JSON text from the object and applies it to member * @param object the object to convert to JSON string diff --git a/src/main/resources/META-INF/spring.factories b/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000..6886d440 --- /dev/null +++ b/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.env.PropertySourceLoader=\ +com.docusign.JsonPropertySourceLoader \ No newline at end of file diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json new file mode 100644 index 00000000..f4866735 --- /dev/null +++ b/src/main/resources/application.example.json @@ -0,0 +1,39 @@ +{ + "DS_SIGNER_NAME": "{SIGNER_NAME}", + "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", + "DS_APP_URL": "http://localhost:8080", + "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_GUID}", + + "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", + "Gateway_Account_Id": "{DS_PAYMENT_GATEWAY_ID}", + "Gateway_Display_Name": "{DS_PAYMENT_GATEWAY_DISPLAY_NAME}", + + "authorization.code.grant.client.scope": "signature", + "authorization.code.grant.sso.redirect-url": "&type=acg", + "authorization.code.grant.client.client-id": "{INTEGRATION_ID}", + "authorization.code.grant.client.client-secret": "{INTEGRATION_SECRET}", + "authorization.code.grant.client.access-token-uri": "https://account-d.docusign.com/oauth/token", + "authorization.code.grant.client.user-authorization-uri": "https://account-d.docusign.com/oauth/auth?prompt=login", + + "jwt.grant.sso.redirect-url": "&type=jwt", + "jwt.grant.client.scope": "signature impersonation", + "jwt.grant.client.base-url": "account-d.docusign.com", + "jwt.grant.client.client-id": "{JWT_API_ACCOUNT_ID}", + "jwt.grant.client.private-key-path": "src/main/resources/private.key", + "jwt.grant.client.impersonated-user-guid": "{JWT_USER_IMPERSONATED_GUID}", + + "common.client.resource.user-info-uri": "https://account-d.docusign.com/oauth/userinfo", + "com.docusign.github.example-uri": "https://github.com/docusign/code-examples-java/blob/master/src/main/java/", + "com.docusign.documentation-path": "", + + "server.tomcat.additional-tld-skip-patterns": "*jaxb*.jar", + "server.servlet.session.tracking-modes": "cookie", + "server.servlet.session.persistent": false, + "server.error.include-stacktrace": "always", + "server.error.whitelabel.enabled": false, + + "spring.session.store-type": "none", + "spring.mvc.view.prefix": "/WEB-INF/templates/views/", + "spring.mvc.view.suffix": ".jsp", + "spring.jmx.enabled": false +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index e8834828..00000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,51 +0,0 @@ -DS_SIGNER_EMAIL={SIGNER_EMAIL} -DS_SIGNER_NAME={SIGNER_NAME} -# Set if you want a specific DocuSign AccountId, If null, the user's default account will be used. -DS_TARGET_ACCOUNT_ID={IMPERSONATED_USER_GUID} -# The client id (Integrator Key) must include a Redirect URI of /login appended -# to the DS_APP_URL. Eg http://localhost:8080/login -DS_APP_URL=http://localhost:8080 - -# Optional settings for a payment gateway -Gateway_Account_Id={DS_PAYMENT_GATEWAY_ID} -Gateway_Name={DS_PAYMENT_GATEWAY_NAME} -Gateway_Display_Name={DS_PAYMENT_GATEWAY_DISPLAY_NAME} - -spring.jmx.enabled=false -# this option is needed for preventing annoying warning related to missing JAXB -# dependecies which had been excluded from the Java 11 -server.tomcat.additional-tld-skip-patterns=*jaxb*.jar - -server.servlet.session.tracking-modes=cookie -server.servlet.session.persistent=false -spring.session.store-type=none -server.error.whitelabel.enabled=false -server.error.include-stacktrace=always - -spring.mvc.view.prefix=/WEB-INF/templates/views/ -spring.mvc.view.suffix=.jsp - -# location of the source code of examples -com.docusign.github.example-uri=https://github.com/docusign/eg-03-java-auth-code-grant/blob/master/src/main/java/ -com.docusign.documentation-path= - -#JWT Grant client: -jwt.grant.client.client-id={JWT_API_ACCOUNT_ID} -jwt.grant.client.impersonated-user-guid={JWT_USER_IMPERSONATED_GUID} -jwt.grant.client.base-url=account-d.docusign.com -jwt.grant.client.scope=signature impersonation -jwt.grant.client.private-key-path=src/main/resources/private.key -#To distinguish authentication. Add to redirect urls -jwt.grant.sso.redirect-url=&type=jwt - -#Authorization Code Grant (acg) client: -authorization.code.grant.client.client-id={INTEGRATION_ID} -authorization.code.grant.client.client-secret={INTEGRATION_SECRET} -authorization.code.grant.client.user-authorization-uri=https://account-d.docusign.com/oauth/auth?prompt=login -authorization.code.grant.client.access-token-uri=https://account-d.docusign.com/oauth/token -authorization.code.grant.client.scope=signature -#To distinguish authentication. Add to redirect urls -authorization.code.grant.sso.redirect-url=&type=acg - -#User info -common.client.resource.user-info-uri=https://account-d.docusign.com/oauth/userinfo diff --git a/src/main/resources/public/assets/banner-code.png b/src/main/resources/public/assets/banner-code.png new file mode 100644 index 0000000000000000000000000000000000000000..292d14e9eb8e14c7fdb570f769ae5d95af3829b3 GIT binary patch literal 53558 zcmdqI^-~;A)bNXj#odBK0tpb@T|ywiWnl^K5}aUx#U;TB8eD=cy12XBk`P=LC)h3$ zSe%#d^Srn2e{g@eQ!_QyT|GU0dU|G#e9kv54P`>S=XhvnXoT-o-s+&CVO*i1p{oI& zJ=Jt2jW9f&&^>jO70{}u==YxrSa$O2@@Qz#1pGS-?58rWn~I?)8XDQ>{|@vuTP9yL zwCVBpZ{_uTO^!pDm0MqS){3k_Uhd^DQI`uY!y!%|WaUNW zsJm+2SXyzFdS=U`I$=K_!GAkQWF#iig64nrSaQE#|69u!>(0vi{QuVTYiuk1-`0FX z-#YC7w=vC-SQ7RB(+ds9S>gZfgl6llsnGv)%|~FB{r~UI2N!F5zs!v4XQ^{6y9(z7 zoZoytJ8bUWYr~J}cCH`%TsNfYbzcAi3(qG^#yoUfo@@pN-Y9e*#o(5f)WzUJ;wmYrLcJI^McqwxSxJ#S$ENXu(86x@Ou+_Z}wB-ItG;j^H0<%N# z+>H9(oId`&QG{M*D#?1Uxky}ZM-1KvJpS0XHWHn8Zr%TUR>X90qj)-|7<2oKN!Dy4 z407kO3E-czz!7cIyEYbCZlQ@PWt7gjJE$6THuDTTZC3v{#pY}nv^scyw&G#PPYsa} z=PS7ew|{kqov*v{9lFat3;b8Kzm51rC9Am3aGyUYDUgPLw#j#wK$pENVR3b*Tauj4 zl&$e_cKZ1&2(EvQ&!M)ug;mK$oUI{Z-2E7GrzrZ%scqx4$J*%3C|!aEhgm1&mNIl2 zbxA%mT5Lx}M}E8Bg=29#z*ds1?D9in&EHYt8a97Jn|9rgqqL|xm7(FiY>|N-JozGK zDoj*^gGsF5(9GMCCMNU(WMzsV?8dVzOUU&oCm4&NuY2naN(S6KVug9Q&YWLaF3_<{WdM^ z(5M zLhq4+;kBH(ZS~XP7c74t2QJPR6ibqM&E`$7X#KUa>XWK_fR!fiWhds=%d3UV9UhV6$*Zka5C$MYd5BI8csq|~yF08y zD7#vBss4QIYVKCErlZ@ci^|`mQ-z3DYQNKU|!HZgUkC! z@_bAr-$p_3a*OHkb`D$cF?EmXqpw$Y$uw-ax~yi_gvi*}v0&AiD>l^vJ@9BwA*=$i zh}D3wPk3nV4=ij{!1tdv^~3+Oar;S~dX5>`#kJr&4=vg0xqUbq?8BIwMSY7I=oi)G z2)a>$*W=m~lD?agE+?7z13v5aq(7)wpEK)`3jIV?qc0`tX?ibDJH+G|Bgd6Cb*XJNUX={(vu4){g^jmTT zx(lGg2S2P%CnDevJ6toP@0BwXiDkV!W0u6~T+H`%y<$@%I~Jt5kA@kRj&W*wgd$!y zl&58X@kdDI+##e_0}VPJKNql=;x65(i)3psy7y&#Au>5_)+|k)NpNU(?{fyA@-oaH zVZ3-K?v;k=pDeX$t*4v&+pDD|$+Cf<6reNnk)=E2ci%={9M?xs9@4J=;&YBje&aCk z|I@=px6?Aqe()KNZ_DIad(FP*w-iOOUeb`rtqYsBcctfI*B zGe+(|fOYVL_s!|maRjC6g++02R)$X6#wBEoj*HX}YII@~&<9Qw@A5G@nb#~y#=QIu zF5kR~xyj3re!S}dFaz&FJj^RwB?W;&^UN9Dx7JXximsn>T!W!gn*~dOcTEbPVuyrE zR+TEk(Z*P#n4~k^W*O&Yzy%9hW!~n!cbqGqgX8KTGZa`ZcLD7Upr3MoSA&RG(>cG+ z(?aql*!J4uvJR9f?da#b1^UCXSWg+f?g}gNs}6bpp!z-X54bsK><*e`{ggkx?nfnz zFOYm@nj+0k3P4$XjFz%USolI=7;0`O zF7<220t3Lvn%-hPB8(q9d7ky{4~n1%dkOK~#4jZsbiBWuf!c`D8-G0ZelFOrds@j1 z+(XCkaai5H;2@#>d7M`sMaJ(%n($*jThgPf8_9Z7xkT{#vnmG`-9O$&`)$EY9l!JI z-2dui^k-766-758zq$wAK-*;T?)+-RjAVypdOJ7oo-4@Q50L2?yeE-?wZT#*v3jRp z>FRYKgeI0&X1sd2&`=>Uj=jbb8gR9YKG^}mbXq7kK&>|VA%nRHdru&m>I?IY#R$d3 zpoy2U@c0YkS=C>c&5sAitQ(;RGaiwZo}5~@o~U>&zH*774{uG6o=ps4rA3DEJ&W1I zfl=+chgW;eUo*1ndsnL2w#INgZ!uXNHhYz7tqzvLjLb zy!GDNQu3h3R$;p%R4X=8>3)r5#ZV>c8((L)k?|NT`A@l1hbg$_1RrLCH8PjDRb3x% zl%e25j0kZH`U*?(SRq&l;K^{OVdQSJ?7X^EhNC z64pL)FL-UHR*RKp`GwPv>_}=@hVzJ~pO1V*EbH)?cT|AP`QhJxmvQ={oK{9_--(Ec zsO|U!ooNp~@4NfaUSLzT=;goK+-B_G`}=Z#cvSh|Y@!}!_iQ_TSUQ?`cks-$`)Gny z|64dl>sD?TspQX_CS#U0EouBv7oeY2F)Ob(rUSPpm85rJ%TR4uah-FmTfuAQ;S1;V zz2bf=fkhwD)m)ss+w9TsCPaJJ3E1e9`f3`E`txoav*TR`;v&Fb?E5SO)PZId|0Z#Kh^b{A_q zFl-{3P(Z`Rk@&$Dj$!{P&*EdqI(#Qw@2*AM<0V!%omV3Dau|D)V~FyM58Nway=bWn zLzfjj0UG>{xTHU0G5URjV^I(L&X0Dy^kjB; z{7B|NZ!>Q!wk`)*@92_t3J6dviH42x)1v5&JNzH6sgcNcl8j+WIZ&;&t4+KHH{aOl z*uo8+=kDQ%6yhK}s+~?BlOjWjb3ITPG&U6OT93HJV=-w=3d5_$-sJ}7UN<`Gj-z5MiyV0TDI(}A^^3Wm zzQuIo_fF5uw~DNB!yh=YW1+vFW(wLyZYf5?K_6_>71&53u$1ZlgOA?<;-A7&Cq;jk z0dyDF+8H-?b6gS1!Vl%Oy@E^v$QLuHwHr=>^7`ADNK01RLfu|-8<6pzz77V{Mze0}bfvSE z3lGKStsM91dEWq;s_dyUAC=ndI;N+V6}kgb6?4)^Mje|~{ZeB2^)_R>*~Fu5EoH-{ zbp;#1O|gM|R_S!$X9L2Z5>3%6Q^;k9zc(YUtmH5;u*i*i_&gU${C@1{=fQDddDXu|YaoHe9Iiz%&=RX5u*7 z|EBDNk+hJLX@A^oi2p$yqsR~SDj>hFEYR-rA6&~z<^fJZ5&e+ry(7ODP1=%sKZ|V^ z0}NU=`+)#k(S`mZ_c-Sn>wg}c*Y&_04o+b86d?wWiaRQhC9=oz}(v#Yt7|U;kQW#fqZ`{bO!Y)=iKMEdg zXfY!(qDmx(k-k*sHs>5`kV#A0Kx9FPWdWD>BG0{)tY5)&0HlqdWHYt#Wz)5>#>xGe zOFvxW#<&YvE5+kcey(%X1l5VUSnA7YzpMP$Za@X)1R?vpTcVa;6?SUA_M}k+7k?T^ zFk78DkG*BQm*`&UdHKO`1*d z!* zj2rd3J+$@7cPC5SV~0GHO`SAeNu{#9$$-qf%yLR3%CspR-}W`xCZU!aVYP~J?B=2p z%EX;ydOfe#nY}(D(;Hr)Hg&Z&Ox4~N`i`7x&7m(en2TyLUF4%Hv?(t_Z1^HreNhIn zc&n5s!Y5y}h=sAbUyoq%l{31YU?74w% za9smo3R8g%nUea4AE7oKh}}Y->|KU&jbYTN!#rf|*x*1yQNGP=wuYW$bM}^Pb12Yksq@_^Vu!nfhzd!qHv{_0{FV+gsbG4a` zFMXq%JTN{aKoK`2^!%sOr?PcWy(~ z^_>`oEh_?VLD&H)Dx5^0Hhijs>tDx~jKo~@*2pxC@VVzonB#GHw~LxRN8Mh)mzfv&LvC}Tivrh%eqB*eoIXZYsZxt7=1x_5zb>DM>fJCs(GCqJx! z5LM$!%P5W{5kYR^SV4`K23|LzYSIv1`x#G-t#|yTLsP)L{WDNaUmaudDH4BoQSZyg zV$k!7-~^qwRnS+qdVc+{5~&Zv^aa`Fm{al{v@UK!iQiwm#7_2Pa6V^rk?&U~b!PA) zwf!bo=9x(^v(U0t_K+`3RKw;9tri&9!dM^s;jBYk4@)#c zLVn(fj6YA12V&esGNp*F$RG)`{ce1}ezQJe<>0NnlWljb|)|%=t_7 zRSTmIw(k*T5|P@>ymK5c*Mm@|q}SC47lR))%)f!J_%rf7!af^N!UA* zm4gllI5qu{w$W~DYT!jsBxhPlO#aDf;{~KE{<0oF!y0I&vre5|fzCSY>WC@dCJxj* z4Hqk?;2TX^%{NYqqlme#l$(ipSFlp5cQmMlK5la&t`ElD2<8UD`)$z)`7peaTL^~8 z^ckqSAg4@@X_kQ(QvQ|icItWxvp&Fnke!H68qV(1<;ERoQlA)EMR^sZ>U*_eguG6B zTKUrhWT=9hFeTO5(}B=?+y|oW3kt!!EPAgS{6D>v9CydDlNs$Vdk-x9h^fZg!1nlC z#uwNriAK9k<6hF-5)i2m_yP+MA@hhtEjrGw?{ZloC7liY>z_%(Y!*)EX%!WA__ zl|vr#PjY9v3Ii;tFl3l?I0=g}P&l*t0H)bb34cYTuwL!BP?7BF(PhL%jXC{}^dmp9 zT9i}pzzPVh7QZyRmyT+$;So^XFfDpOj8dMkq!Cf%EiPb4CSU|kc+6tkH(M?li%dc^ z47dSTF8l^41U^=J#;1>|!H*}Cs)r|ZL`$maW*Xeq;kcHbS}SgeDV)Uio#Q*>6MfI$ zQN5X^R>8e$VJh!Y?;2mYQi4*Zp$0I%-&&hA4;6-M-Ut zvoRHA#E|I-#MxEvafS49@F-8Rz3|c62~jr#t@X=mKs545JR^)!4qzT6CyPC0+ay23 z^mhoY_|GiCZmVB^tkA|PG7a>QK0te5H1-p-_dbn4h96+^_VhUZBcBCtYnTZH)`JYTJ<(|?vspPWW zDpZw1=y|R<^WKuPo1s=M-h4(GPOprq~!{H2=UZ=z-Qv(ualVO~oyw!gTw9&_G z=bo`35xFiS;2Iwl8}A%W0j7lt;XACKZM~Y#ESa(|gSkK%i!^1I3ZNdKqp&%~3(0s$ z=~w62Ck>+DReFvW6~k}wYK9g@_xuD-d_|l^OK)~x{fn333sIbtQh~)OI}3gnC<=S@ zQ#cHFw^N$r#MOhmopW!4Pc&8Jcu0j4mJ+PlL;@_;1Q4h(M9*VO`4joEMhRua(p-@MnSE9fjT|A`u00Um0FI_4}cpzmaYrte2x|I==^3P*9X%kB)i3WX8DOnLVl*X<*Ne=DLQLuCn_`&39BG|q;=ILcd(qiQx@P2*- z-hcLbynsU_K}&Yeyo#rF?Edn^$JZ@^U_2`AcR_hFdop4D2l&|QJ4K^!u~62h=T2zI z4WgKmk)J=r6rsCPfCQqodd_E+0nGirDD7gbh2UB^V3X214pdQRSI;z^k{Px^LT@=I&i{#_dyIU9Nu zgb7fnrT`suQz0aX(dNcPgOMJ;1=%rT2Vkhk2I!}A5Lu4MZE#J!|MZ!pV{HCpSpPUh z-rVkPGxzfV`hKidtUHnWrq8*H=aar5GPaeZE8tnDQLyvazA)j|X3@eQE?M*OtJ z-Ezp2GZ+XZWI^}bu1;|Ny^Cus4sx4?FVqsIlG7I}j2-_~5w-1?X!%#x8igV&*`2iE z#*l$ih5UpN?iv6&UU*&Nobr2FqAvw=IdWfyx~dpXU3cmE?dH($%o%>msK{t6BW_xh za!J~1u8`Y@0R%J2&0Hh8F8GLiBv` zVGPQ-{pZ~HSG_}BnmPv$pBq~ugG_q_`d^Pg#pna!`$=Kn+jbMdTjzi*ogMP25}i~# z@&%#dQxH}Fmf}k(==-ra%B`N>+ODYUogQ?Z*t0jqn{hN*1xmE4{!T@CS-T#4K&TRg z&|{nYYsG;VE`QJ(wob29`dkT zdvOu;1LVn0#dU9!dapB^txfPSEBnKfMb)BNrbJT36j}udW7-IjW-5=<3grrIlfC-m z^RF{ogM`ot5&9M!aC-j?oynJq>?GuO!!WwM#bpr<7Wk$M?Y`23j??o@TQ$NaT$+lk zk)-4PYO~JfYq~w>%1-Dz?d#MppoPDfwDEu7d+52%vJPUxyMg;6e!yyd=iXJ;U1B0w zJGAVeJdpg;?_I35rvU{;J2@$SP12#AJIEFod&f$77`Bj_s5|IT-)LEVW#VX&<|NUQ!;bFZ##fKAr{flz?WGN;actCdO8{l5W=O?UtvtL)k&xSfJEjvME0$>EK{UOxM6Qh0s(SKt^N# z?Ugmj17E&g$+j#9*b%};+dYmtOal7*0u1)v9F^TlH?e24k))I?HNyV7_($$bCh2D1^S2MKz$wqDEFV3! zw?+%G<+py8dkF&`@V#eA2|uKLUU$`>G_!Hf1OGBtCg}?}jrTwA%Pu=;vS9Fm|5?JG zH?3`8gr`U}W)L2jCJC}x)=rfY`CEs%kH}2!4srs*^-=%0U%h_Y3C*wk6uZbm&O$Se z?FVJ>_Y78fTd^&^)q;=-RJ+MGeLhoy7WzlOq5+kwzN#UwpfGM+GrIf z71={yiPtGHYI(eIiD1z1Qpc_A`8KqJn}?#cHMAt>v*w(i6fw=5Wq&ugS@{DaL4(I936wu7Zlj)zBQ;CBMH_ z@t)Zkl(4xtr5(G47}u^oj6j0=FKFnm5M2^=BBUoD^vMWbeY_YJ^zP zxNi@7*P<00+XN>t!rZF0amFk5nUicB*3bGBs?u(E#S1K+uof? z+P+)2J8Av1MzPaj`lM8Nq(EcARSnzj^YE9dt#vHhUahCO$|GV$LWl_#^*1E}X0Hus zdo*)nRh=UO=1AtE{*QOwBx=k#PWb-!)~T{YwU zMMQv6DU*^>h|-|tEf>ZKuX~|bWD@nVqRYSRWX@4Z&3B<~T{bOW5~V{UbQ_H#8$zH7 zn7US+CnVD@N%#ztZDbib%$4K;X?SH90hhn8G|RTcx4vuH^jeSyv$wkN31aMNXo$hY zlStm!a;JrydWVtEjr9>BuQ!Yiu6yQf4kz)Py;}30;&B*v6o8B!kq{pe&+CowdB`Mt z%zlmmHI&?oiW-Zy!T#r@dMlrAOOzwd6{E)z4aS<$ky;qY+!(+QxIOx4mNCSDmFLo! zgulUfsEjrDDdJhm>AYT;G&|q}5FxI)RxrL7y2G1xIosd-c8G4s(?pesZdG+Ewp8!( zWZ5lDulij;@>pB+_agPp7|^>yftDi6-Xf<}b)v0@6U-IYnv9C8V;H<*D}E?kqC09Y zsraqEIt8+= z>G8w&jF=asE5lUfG)~|P+EKdDNVkuToO$?2!2GzLG37~B(scwT3u-~T8ThQ3cCJm+ zbmUfJbcsS&?oD#0IYK8WwrdPNYGV}(CLninYC#qvkDb#B?noYt1X2n(3CC<5ZFKSKTN>tk zE@cv&A?Z-|=P0GEz*))u@c8$pvp_d?C5`9rb7842Y-#NU$me%v&Eo`8>}7Qyrn&k< z;|IrO`_H68MK0%EWG29}0IhQ7;|2L}>r_Jx&xBA^DaD&^w{u^EEV>jui(CF$p1MdW z-x(BgHAwX?9Zi3i8EDYELNne8yBVg@y=eR3E3cok;+`-Y3`Y##KRzB48QbC#)p(q9 zhuN^9g6sU)(|%&4OFfx{kR@6MOW`sG(LJoKF2mrj7J14<+<}tp%h=bG%!{S`EPEp)*p4_8Ln)V5*6K;~@XYb~N&!YO1<7 z^Ck;Uzxvd%2pbMKvSf6$O}$)_6a-Q=kb8#|{1`1b?jJple8_3mygIPi*QUFf07CKC z)|lNm8?D)O^_pVXP2cb-c-Z$OH^k>z7pOw3X}i@$e5^I(pWe6Q=f+L|9<|on+6`d2 z^)HHq)kc;mQKf9kLv6%{Mk{k!4pJms(J+gq2w1vnIjc=)^_}6fL+gfNF1YXa?LTy$ zOtTjF)EDX9lnlnre_9_RyOUeucDR{nz-+vin1RtuGRt}1_!iN@<$SBACeyxB{yqgJ z1}F#o`+$p$2hG-OYLW?neU+7W73Rk$U~0)$D?jh2g>GP?4av&swVvLr(%&bdA~2lu z&cceLVt2qN|8?Ob*n#;}wyW1U01|+x=(*?eD*I@(FilGFmw43?Pv*8|QO}0N5$}GW zDo!u_;K9bt9S_d+sNry*j=$_$RbRPbSw7~2K4%qLnPYzLA$pb;Frx-@C5zTPDFGw+=#hB36=uxO52-E$#D9cQ;NXD z#}o$HwQ&h~i$)*#dn4jIK`W=M9vF$oYpGVPL#pZAcs^WVclt+ZL_)a7z{T zEm!K;Aa5T2t=qnTv|7H$hi)9xOMK;!8I`rXD+del@A%w}P-ciBMJTpNZXo8~;*UzQ zjxdM@hoN5QmbPgcjdTsrQiI;5FehVXo}@Fn(G3dTO1_99e1(IVgx6fIPc2UxgQm~! zkyvs2D*h{dHR@sJ9?$O_O`pOBcpGIT8A+0xf%IN#0$M=^TBW{yB_i{hQw07;k!})~071+u-H2u2*uFm;)hw;wkUtEV6cMGu_07oXN z1!{^eA(z(fpcv)rV_m9}9ex>dFILTy;(Lbc+iY1QFq8H{WV&ZuWX79w!e6Q60x=ZJk|m>sIICJt$OkpaA^T zKLdHWYSL^lXfpq|iI(FDvJF)O9W+~A=oD#Pamf6nTk!W~{Vn z35`4!KtOc5ya@xhe|G-clCjHCu9cmS^RIk>Ozxn;2ANFtBcby22~S$$^+-%TdY;6@ zRtxQbTv7ZwpDH;6YB&LO0Sm+RI*M{3z=nBZHV2pQ{biYDgVl4*e`BwFNZz+TZv6Zx z1#rE~HGKB&l)(ZFxSboaONIBJa~LTvRNE2zXoia0LCa71c&9Z(3xG`0STBe>(O-wv z4&S@u=-!{3dpSrZ)P`s~H%t3l5SVZ1c7wM9gH@&XQ(E_lJiT-48c~ zq-KY--1=5Y2)v`o0I>hvB}=ayZ5mU-$fzs);nW-WDZYp|ApuV^#}GrqbP#1 zVglRtMg^Chii+>04th5KXx_%3En1Zp!;*C4fQu3*M1NXjk29X8SU9E|cJ|qw`2LDX z)b^iebsRp7-baUQq+6WY@FUEh^Nx8Vcz( zmzm(V2;v!u>F<$S^O#W(`*Pj8zpcrn&hdC}D{B3G3~b_ z_h$E=fFThh3WW&AcGbUo&t!SKzNx~pHM#<;{*If;nk>N{15ECoJp|6YoEa78(BLp~ zl~I!&2EZ;25S>x5)0lLxYYJJfzPlzP4UWAWshkxruTvt+tp^wrb?(pwsvKrD~Bo?Q@VX_`sIi&G z&CIB?3;)9*$K;wc{2>`2W%vR^NiXEfD%BVO!#*93vjChL8gWkqurK`PQp{ z`_}hf7t&e5X%~?((fq|v)HPKKj>{{dor7HUo)_Q(^1{H=$Syl_P<~#gzro)4Uhx-In*XGx9H79rl z_V`efOY{|eu`>zI!bJ5@gDzNbuxtb7Qsw3;K|>niZ8Q}Ksf-b|ij^QT%%vOc^a|VM!Fk3s8d@LxwMBZ%P zL<_JEIp*0gWX`ad)VWvbJs%kELJ~@^_nmBba!F2M2blY!OL?~0r-a2fMMKG5vA;?5X?9bc($iV0TbqOmvAgWox zzhuVrtp?=9&pwGE#K4?UV^W^;V-1@$UQcEOX4SZ$&!K##qV5|2{@jn@`5CvwPP9j< zSyM{&`*U;@Hu;&|aKb8$Qds$#dfvKa-7f5N9z}qvK^|Pnw)pkHSnYcQu#S07&l@WM zOX-B9rUu7hRncujw&7%4jH{{9jg%WHvzYE|$fW4&(Cq#%;L!XbDI+`6UD1FGh)WIc z)ezvIdPZ}Ik;;13G_T`UZ=-*R(g6!}RUFZA(#-guN8A<`Mf>)8$dV-GQ7iDF8ud6}PQ z&yLGlWCp_LW4Q@5-3sSZE8{FQ3mF1*2h8#o1%cik*z^7Rx8i?{LN0rb7tf5!I@)KF zu;zBDqTb5~ACP3uk=$I5;$LSfSP~vwDL<})XIy3ZbFvwwGzIPk1gr+GmT*I@_qFdo zR@1knGg80Ow~P*(6s@MVI@7F6@08BT_W!-<^Y%-(t7(lW!Xd^<^J!?ZX8yh#YhgBD z8&xj2uvlDQ;fIB)w;aradUxVavn1jC%KW^^@5`lR(5s{}FC?N#56S`~YSBCH#}+5X zz z&scw}A8D0+5~>uOk|`d8=K#>nRA6@#X@(#YrGi`=6F6ZU9A$||hA2~mSic4vPWBMH ziTfu!C-Ft1%${GN(yDbtMvb4#m_l?8`TmI*wu9t#V6F)2trnOIDt!O8V~NXN%|4u|5gJ0r!*e!v z&Zu|9;K^mRzYfMrFIici$8qJ>F^)V=6+e?R@lmP8Vxum9pygulgGy(_|1sz8{~5j; zGN{<7jg2q+a0VntUs7J-)1w1W1JN6~(_CeCMVJYRV=d&t2UCusxo`=Vy8U{-gI)y{ zIlWZa3o8orfSl(%oQ!wMwD5+4rAu@1O>?2yXMF4VuV%xaBNltunU-?7iLL5AhHE@B>PsUjAtBvn_ zm19Nj10QM9P|PXkjDADTSkFWlK_-8s$M~9N1EQ9HbpTK#%dz>^2LkHOMhl?0>sUap zJJ5J!kC)QnmG0aFC(W`iLB5j~>SW!qJxpaVX3&x9l#2g^XWbwF)}iwAlOvbpZR&4* zwiT->pjTF(0;)Nj=@rHwqGj&t`f=}llK>{B$*%TNpL?fQ3s+@r?|jU4G;v9;Jd!uH zXPq%Hh(7|ocoWWsyDtMwywhrHQ)e2WAk#0AJclf{5!j7)%S$~&IOzo`B?(BUETZ#k z7+uCrY6W2yok)p=-)}vSkG@Y#LbiIfGm!@Vp-2Rw(%6R~(XX}o)%^>ss$V%}xfZUB zJ$p9;HzlG}zjMl}=C**d0~cT6)_$&lZ?iClU6BI2akKqLO3Bx-yhL_=V5k zqE7>xXfw2ytUiQbu!OGoKHTu_oQnfgyRuVXfVvQ1o;B4tK~=nPG!Kd#O~w}ga_I&^k%Y!gM~YFTtIfSqH@gthJ>J%_ZyK8LZXE| z?biQ*|Gc;pb+1|T3}7c6BXcVn^A&py z9Ro(HV+5{PmF zb2u2dU~X*n-Gc6Kb5t}a&6|{sPhi@gc76-6=zo5_`vYIhELhiP99F=k^@?Po5<%F) zJs`4gkGu-B!^S8)FyP7VfCLJjYlEm_lpX888ojmOI3f!Ow>oFA+IzBDJYviJC~~C& z`$s;8DZCbrf_;y2HNCqVMmul1dDD~qzE<$O8L~`ux39Yg=VNabt;64MuCTF%rhO8fdr_WVU%Oyb;jgZX{3GxSGs3o=`s65|iPed_F9_C%pohQKoz{$n>qaFUJn=*9x5pAdYh=-hlwRER(T&-`;S0 zoMDDob--8p1AwHpw+?t+a)XbnPODhx{u~XbZ@n)6VRxgJ`GTMgYlFEMWX@Lgd!!%^ zxD$mz7_d-kOtJvX5;d)B;C2xOy#V_89?e+wG-rpe4F|rCebMlpU z=`T=zA#umo9ET{r1ZJrUIQm4Gq;tig7j7CVWt{08`_mao>DT5Eq~X1c)k{`hkuc1> zKf#z-j|Fx8B-1oA@%4%M^1vX>(CMZXy=K)R#+pWDl>t_$$?HBwgWy$fZgz|yX6ox1 z(HOwB8dW&~fdMXI9`4n3IEIWq`6i#9p`6OmIG7vDv;F{+uiA}YCn$@8sd>42Gydd$bX@_|DLc_6zOodl*W=Zi$cq=vdnI17%j0` zKpu3n>u}52g9fyKLmbr+PM-C@a#iE=pUZ|gaGtA}C9Xz5f8K=VUvAXjxSqcoJ7%@P zJq+Vu{pjdwN<5wb?19^3Rw-GZLxfIS@FQ)cTS5r;$C4yyzE-LLUz6>jSGppVRs{EO zQyf3xa-DQQ6Q2vZe{@%qpTnsn?T*1(A=}Q1CePsbdaB(G135fNV3G9I!AvFj-4MK(gkLEMdVZMl5-pF`6(ED3Fpeo)w&@`D)!N z6u1-2&8O&q4DkmRPaffk2;28Ec6zm7)>HldO>{T8^{M8jPtOenl;seVQCO#`r6=Q=fWSveu}ez)7YGavC;>J|g1G18OS zCnAmgiEXW{L(~>T+w8Cqv2r7OO|)nClYR33fcNo+L=1Ds5Ei!xeQ?>Y>BQN;r^_(} z%3XQc6E|aFtIo_I-hk!vu_3wv?0`y%Cwh;*tp+ikvHs8NV)?&xS`br1QBXX6VJQ3y zXOS9HBIk!ENH_-3rr^t=JA#j*wqfil&n=;zN24+ezdCzs%Dzjj@h(yiM|_Tb5f|HIo`MYYkr54bqNDYQY0 z7Y*)iEzqI`f)sZs?iSpN)8ZN^6pDNC;10!If>YexPQKs&+@9OB)?Ce+jO^K&E${O_ zdmIkg_jdW=u9Krff#5Vvr`{Jw4x!*Hv%LxF#kw}r{`a`RK z{P%u#^ziuB){^s7XS=7h+)u#+iUii{*(7=o%yGuu1{iV|8bXCQ}jJz?npMY}Rg= zf+gW=fVC<(TVhYIgGuYt3Q15zcPk>ZKx!mopQ%7!=^z)ReIfVh%;n3L!8O*dbPovI z%;ei;Pai4b9{&S5bAkfni-~Dvub42>Uuo(^qdkJXFI{aAz_M`mVRd4K*|gO$+T)SC zQ8NmATr+2`uu?Y1Vu~){mN42@2OmY^*k^US688d4iwumZl@UlC?HR0Dagq1&s&=2I zPrr|5t*GW?RHh@sTTHqY9|z@GfrpvQ??0wZS|H{8`?Pgq({CTYiJlJ;#>Q{hIxIU| z_@=LBRvqJIh{v1{Z7cGIjfDXZC;?A(LMD~^9{e{GM87QyKHGF5s8G1K-b!i(jgyXr zf;2H?*rHiQJE6~c;1JZ|8=rok9Hm{=a#fYmK6|HF~x*=tXsBF zB54-n=x?1qoF>23dtVT2_j0*@D*b1<(jk{9Q3*5vG?E%hV8xO20yCls=4or&;~IL% zK$O-Z(HEW#(H4%)blqw?ddR63vPF>WzY*KXdK@lbLeB!aKSY;X0fKM0YrQqyn`L_A zFO?0bAGx#56$76|RcLURXk>{h3`^qr#|&ugfcQ(Qb9;#}bjTznkx}R4!Aazg!iwP? zLQ41X4gd4ff+|BHL&~r);Cl)qrOn|1#)x*B3pv?h=*x- z$SDTCL9qB=M;H_k&H6)HICJQq);>IHU9hDuQU|wEI}oA-eI}bSE@TpoIfb zSq5tV5w>fuB3_5qFPuD;I?LRG>X3b?_7vUzMGD%4-Y`Q_?^-nIzi+AcBnt$7iRUmbpY(R-i8ZGNIJ2 zX&G???tDmwOR7ySROdWd>JOy~%P7C&r_mlEGRV}@|GsCs>o$&vpCoa*rcws{K1PL{ zLuea|+ee8ZvS{Ze?a0-F`wch9Utsga&DD0A2+s0s4*y`2Bh58b^1?)CE~Ey*O)ed9 zOg|x^)V|7@f$w0UG?6XsJ6@n=p6Gi{>JryJcPCgStsMhJkFwsAX~!8GhSMg4`^4xG zJ)gkw_ID89LC*gOK9t4kh#qvWI2n1hc#EZ6!=c4MM=Rks)D+?Uj+rV{9>Mg5T8zjq zf{+7(WyJOieV}ktG6b8cAW8#N<8#JwlHD%5&xr$Sc6&vwb6kf}{-+vkZcKGta{e1CTD~trrP^L0* zz3&hH{q|8VETiK>`qvzOJp8D_Wj^^WPH&n9b%Ul!MSFwg`?3Wt)8bO-QSK3U5L`dn%m;Lpe8 zI^RbQXe?tKEAB+40m)!Kqbhj^IE?>Xg?jnv5>V19?oSPVDf9UD9FMxIZ{5XW!HH1X zSw(FD)>jMc0GbzfI)&pULG0-Fce-xK@X0HZJzpQM)skZ!p}hf_CFjrCSVjLg(Lo$m?UT;HZ1md84N0unpc^@j{MX= zo2jd+=dBug-GP&?@6<8qobqhg=4=#&-3x>9hG-xDHOmP;ZUt;0r=J>O+VHkq_7|0t zoG3bizQF+@f2tXZYiiNhUsX84;sMS*c)x3?mc5!+`RuDd`sBx))}I_VACuCA05gtG zJ@eYEE{gUGq@tl2^wq7Vk(%zA!2)Lu-$OBTL@U1N?^>xyebjBTM8~GXC%=5!l48YA z)UdF^I>1S{85(oL<&rNkb|G+Oa)51nj-&US{C@C;dAMpfR;TsryviB#(Bn8R`Y#t{ zsoOyhPln)&xC-!!{Hk!RA#zMN8O}&uFel_Qj`V{>KlvutfKD$?#JLI|gs~-3abD`b z-Fbb(Q?g!FlmrYvdmo<00sMriwO_)(_7xuKJR;@XtWSqC$ zT*qyVTH()~N}LPbdLd}PqMW1O2NHTGcEMK(@6^t{`}haFzL?@O4rM^ z9(%d34_*B($oTE)aW+*BQv@B@Z%#H?kvzgG&zkMV9h5N3TW^E8v(3SCp4Y_Ws__*O zCyBO_x)uBEgec+?UbcB=UdG`kJ}nW%?5@kG4#YUqUf;S@QQ5z?da?Yf~?cXKZb2M1U5>-&VP zhNRlj(%bDdzzV05Z4K z;(;{C5a2v%`zN+i;M^Bv$G+lx|qwuXrp zc+<-2Xb> zh)Eb0g~Qt}#Fs@myGe~@Q=<+5ohK4Zwgk~s(Sv1tVU3{mxZHc7dcWiwbR_tz|Y@KRvapym^62;E6r(WN68 z@(B6Px4G6v60bVnUp{Q7Dd{CQ2R^mm>ghVmycMwI=cE@!h`&~O`L*cIO+D8pgWK&^ z2m;SRASy6pFI<96C1KPZwPQMCC>Hv2d5n=-1m*jFA~&w6V+mZ`4#|n z%~ju`j>-WCs)VruCoeBjwiUrOPg_0T}P631(D7 z`IlW5F~}*7jEM(+%4U5?Rz=9AF3g>OIA;&0`~RHKOb6cw&wsyAsh}>4QbdgyDi(MM zR33P<`wtd_2eC<3>l*AVM!ntdlEWRgh@-I3u5z~dfei3e#i!A<_rP;SB41}rUq!eu zFx%a+C^-0T#3*J+&}A;lcwcf)HT*OPtyOj?XH=-ynmzvcH*>N;Ivj}6jfm$Jh)~r$ z4F$Bw5mDPUvv{(G%6LRPfF}Qsu60_$V3?scZ!(VXH8;r@k&!zT&uoGmc0T(3HiR|g zb-+ENOdMwC;jwK=tulfqHj?Kh4KW^;sIMG(2k;*r#7xFZzAq<$7YsLq5sS5ZHMM(_ z1*NYYhy-T``~UPiwl&1iXT##!(SI`&L8$QOuT~QdY6jCBI;RYz zI>`P!p2L8tLK<7Deov}Sf@_@BZ@!{(s31`Hh-S|yZtUB@!i*;3-psGHcnC(fN7KEY zky!L{v3tewwCa|)XSJUe;b!=&$A6+WsFw_9;;6?-pFM z`$MzZ{l`Vo2cdrC%{?B$3LT{-Yk}%n$Z?;L%{5@)zpL)D(WLoZ+KI+WM8ERhKWSyn zW+}p>{Q3U6R8p(pS9$RA9@;c}f1Q(c060*hT|4=Nd@{ily_a>;a+#Pk`h^d<(Ey5p zZ(TulV;=_Y6A!w``lKiL&KjQ?m-NOuVo6N3Zmul(l32OASsNdbR6gv4j~UhQr)ZFF zKGEe50Xi}Tk-nc0Z9};n^{=&Z6_5G(Nn`T*?<5hZqpzON$CkmjX(h;1!Lvl`wg>D{ z1~-J#j7l-@H}jwZ+?v zb`D>VxDiFcr}McP+@N^x^lzz%7$?)yNo6+f4-ZUyVfJIe6k&bsyMWIi8TGI+aR~AZK@DuP~w0| zf(YlD;#2*J6k6fO@E7|gY+ANAK>1ZR4$Ei1)OB)Qedeh!Uqubz{T_^dvZ(idFgRrC zy-L(ym=w-%?We0mz7~ktR;RW-NKi%Ga?ce>1zT%7BJdVt(qwgORsK+XeKPDi0FWnv z5lm>-EJhviB=%fISNQ_kwdA=VRFzVaDT7)+-3c^H)L{oDlE$Cr$U4XBO)WeY!}!tP z(T=fRi47)1pqQr|Lzo5sF^x&is=iK5(sgi%=qpS3|4nnc0qGcY%yd-GdMtXDP<4Vl z_fh<7CmSY-i?@oYs1JW``5vAqBDmzmZ2*x!XgT>l75Ag6#8kbd7q~QHm zGcUfbHx1O!YIFQCv^ojxpUmoT=X4)5+w#^$SppPkZU26hv3dr*uxyp*=Y^ZOK(h%J(My@z5bD<`gN!Oj!jP9^*ksz$OMA?kesYkS{|5%j6{{->1h?y{gojuj-adI+d&1kdrMSmS*hDBN(v*s9) z!ETQJOuL(&`p+7)5GHwHB2;!ZEf&vrA3h%^_$>?Whr+0vgca(SNI*IM{%jX;$HK%F zk8$@DoYosm2c7$+^^6PmY*NrM#A?YA+&X5|R=mW1vD`K_NY;``>xYKTa~F&vgBbm4~pQ7W{R2%~t)_rYZBUQsZ6wY4u-*!7+oeFc3qSk~DsbSIFI00>R(&8McS}W6g8@AK%w~7P+J%WXD_$nDLl|21?LQWLE;b$j(3MI!YfeiE zahJK@`0CVPX1p>}yEg(4^tzRMIocrtmULgUCE@K$7}QSv=@lco-kl=B4g$~Uay%X) z&b-UX{&e)>VMgo8A#c3e7YmioqUqutHV_r_$1{S-8zp{5CznNw^geyb!8G)D+T*>y=vQg1aFUn02*$eOtgzE*$07VF;SH0d z#g=sb<#%7N*XqJfVkT!lbUUkd|NA_LS~zGu0|(pQ1aai8M8KJx37OhWC2CZjQQJ)U z+LrV}&lk@%!~50n&*)uGVMRc4gj;GcxIR&^J>3> z*Z-`TiZsn(;hMBbNO?(|Y+1sYI1B|1)!}}*Sj>Y?Plr=&13LZ*for{(_eQ&Eo2z~< z|7m+I;Y7zmjeo9a=OZ8wKCj|`-E%u2x}}}(Fg>$in3`mDVri$~0QD-Qt6#KHCNj^5 zoqX{Ld8?{Mggtdce1B+_t_2MXpje#;CHQN#@s^#;7V5BCqDASe;D`_Gh2(!ip1Rbrhl-5;zc&n2x#_TUH3RrxoB?}!K+>0Z)GKB*vsvZAY`NtFt_4%8+_{rBj1AD$Wq*$ zS@z|P-1~x#m-}pQm zghilX{yokZt5S~J))L{J z=u~YvNMC7}c!aVhXcR>53})(0t@M8}$bo3S`ZoL$uvzUx@%}z60m>!@_i`4eeNw#n z>nAx#B_BxFMe<@P_FDvd7Wz<8E9Fm*H^i{>o!qi?~I`*xDv<%s!) zf~#p$JCj%KPP}lCnu@Vae^fkin#}6Vx6q;MC^HF*Z zBFHLr9_AbE$P9`fH%hL-8|adWL6tVM_A|>MH8oP`j{FmTE<6+=X)!`CyrxS27ZVWH z_`yWq9`mzGLhfbR5_YyKj8h*o{9;+yBI0yO-kr-Py^P^?+#=&Xh($J3Eh z*LpMlN!uskF8GAcoH*_)X;Vz5+$!g?#kHsBr_0vXv5MXu^%?e%E==U2xKb3`fw-mD z?yfoL&JHDS&9=L;d=r-*i@7y0j`&xBIyy7qq8MHLUmSP1XB^1*UW&VS{)$!H`@UD` z-=;_%6{)ZRJoKQRikEr}BaG}W!i}1Sc4K|Vzw*JK3C2Qz@yPW)-88fq>r^WLWGFO# ziFYau2Wgm4fSM0cG_LlTig_kR=E!a>=J9Hc!ACU0q3_<g15W;d*m7uO+BdASQVbD*~(+G+xm#I@HtYd}Cz99{qh%zr4uKyi~t> zqRR~3{(_yhk=|3Qd{76tyIr@sGZ1~$>6TBGff-Bj#TVRwHD{PWrL)XQ*@62*BYt*U z93({oJswKguV1J8{vr~Ji(gVP@wU;a01ePb^d-0g#A^MaBF4>gEnELrH&?)T^pNt)aj|V`Q~6H47DSxw*Fl=cc0bw7*7Z z0HaDN1}ZXX`jxISux9A)fi?*yU&S`?8|xHgu1i2vd+||QCNW-(*j1aW8QC*#njy5^ zbgsqI<*2aE?{XJ=u2Ntz(tD?0ayF<2BsE0oGe~yk+2d~Nd|%~38&e3fx9iz&-shV0 zV*qlYfp<8-R>GZfpvNOXNoI?(z7EjnY5Ic60YzG{Y%b;PpO2UXF2`N?dI3f`UZvBz zxbPS&-oDsorc--LbK!Hm{wAh9?hRVPdfRA%3$ln=L{9yxzo~O8z}4Za zI3u^r+-`r>-yE+-7&PJ`&R0BzBr`^Mim9RRzcD% z61%A#o!RnlPoCHI8fWW;g=h__A7XGfLGG3qG9E_6oJTdC(SA_tp9Cdjp<#WW>gA>W zuu=!#`H(Py{-W?1*yr$9v+cKSro3@*Ahm)DBTIk|r0*uIvWRRoSPijB*mKYczx^IU zs=#O@EA~y29x$ohfbwUCXGtxX;j1_X=eTcb&vd^)(`wHj`1#DnzJ3tM&=g>tr7bHc zanJ+Ms5VJ#@`Or?S$v1CIwK+%m=MLGt|fFxeJMWQ}0 zT;vt_wPmB-{M=#7qfET1Km%-=Eby&o`a?2Q7u8$5CQS^ zHBSohq{tF;%K)PStI9ChRtWcyKJFGD6QDg4X%_B><@#w~OlVi`j712iQ{M-}1V@=W zebrf1Ca4@}1n_pVNJ&1a+2NXqFAqG;&QlIEhI~lY!MpO5GVWiIug7bosYX8S+^o~> zYv>l+uFt}TQ3yQ3AY?hTS{qgP2NPDD`yzd&Y8c^Tj!FsQYEK--{@{=D%^1S0*W&aK zgbywU+h;uHwY0W*h-9W)Mzb2yOj`BeaQFGG(sS8hI-0{d1P*FhMbWcWCW3N1Q0ik) zOZb>X7(VdTWiS2SF|dhwCoWK{FiRCEos<1+reciB8|f~FegH}q}?r)2Rx zAks#2p25w##twTYFlp}=qajH9N=B$fcE$={{eL1vXLmJ<783f*4|P5!x~fK&_k;p# zjg7x0kUo;A+hC?QfLl6TFTJ}zhl=mb;=``o=UCA^cBqe!!tkCmMFN7}zuERp?VRCq zae=D7~zJ`wg@J{QspODmLdg~f{0F>my^*`YKTXCm<<%6AS_QDlM^>6D9JhVQC z*I1jIWr&>9^+ReF#JIiG=c)FXD-Nb?YNeelISsB~}cf$_x@Z=;okH3z>e9af&LZ1}s&}HVCayLcR4} zbrdzzc^c7gPZ;adV{D{8bA?f`5T9O<)doVs+YCKxnt&$-{p`0^{9(E*Dh?N?j!p6V5mW>p0mOah>%}{;IK# zFtaN|@dvF2-pM52z|&2cZzu^m|3F$wI02uk9m&&pr$rHQyRKKwDlrIIkq#@kT|MiS zF2TUt$|33>^QSKAg(Xu=4TgmeKZ0+{QBdwu+KiR$v>e8BB~xiF&eq3ss;E0GO)I6O z%@GWTj@$57&a>CHO=nDnxNA5c-q=7pdq{9+upRNE?xpkAT|; zynj2Gw`P*mgC#PS6mQtpO?aQn=VLDLUG;s3XkNQa9)paRXWXMrUAx1%9*-L7`vh>f zk*TS5wrgeuV{UZFw@J~)O8yKmZ`7x;dduL}6nblCr@cvY{JD%ta3D|0B!eOR7wPlK zf(~wxLn?G7E%)WCQpdRNX$FEbic~)eTPy!QNN$nrc&*!B{BCwbvM z=`h7)Q^^^U?0r3|*0?75C-ltqWjtVt(@gm8Me4;$_uw_ql}sjA%YBE!yP6D9y#s&d zVZL!=S*vA!;4wG-Y+)(}QT!aA%X)QVpwvN)Mtm9}-}HMeC5b4;3`OEghKT=x!S|sw zqKCIVyT4rpzOB=~)Rolg>o{4(Pzt3DQSvz=5X0{h$rcd^M1wxY>RX2!LPC%m^z$b#~a>b*?PNX zgw~p6##aEyTQ_W(T7ZAH^`ME+?be6H2$gVhS7mKCn{ANgEuL0ktml;Ohf^NH?$QFO zzZj+yck{bg4?RsFQbZK)*2cObY80s<5ZX3@hbe`eGf5wspQIg`x4{PghL!FIASa6sYqHgR!g~v8C7w;EL zUkA75?O&pwi5AOBn^mnAU&|<;nRCtcgNUbu^{O_D=n)zmoW9=f3$UeNDqBn3g3}ubkX@NqmhuP8DW_IU)}h6L`HDm{2)3#Kx_0wP87=gGLxza zd<&8>xsz;#i%Iz@+3+Om&35fo=pCHrXfEo!e(TPzVBcYtnpB2JAvPtObz;9jhESS= zlMQD!R|o*JaZOswP7@mvUTITZiB4pdDIb{Pxr+v~ia;V+j;};ZX?wxa!QWq-FJo<5 zjQ2<$%#P?sqYq8#^zi}O)U?cj*=gRW?BfZT)2HfYO;N8J!APVu-}-BOY054hxXAi> zHj<>x4pkG))Z^LJRLgie!;QHCA=vB${-WyMryBiTH_}6O{zXe!;fpHogz!Eh%$Z8z zUoW}}TZUFbG=ML#PfKJn9rp>rtA8UsdrZ7PrFEmrZ2LJ7t0E{n=uHJmw4~Rc#e$I= zLf;dvg5jPowg|hp>phf?!u8yzKj+OwbbvsXPtHC5Ed_@RV6RNr{ImKt4P#YiAUqDy z;8#!8u2(O)Wy7SxBhgFE(qjf=j9Py#MRzs_fqK_<1I4~rl}jO)-XrS(x?;Pch);#f z`3t|B*A!1KyANVT5;ISL`r=eAY5MLXJC2#;l~f{*Du;C zeMeuo_MR$Im+Aotew9WzmH~XAI3G(W(%uX%xkoOWF}Zugv{tLB{loIE?kS-fjCK}h7TQ6S0o%TPcpQ- zQ&~Rb_P34tkNh<>8&TCNg~FBWlpm<|(xmMH{d8-!ue7979#`kTKUj=k`d=PS-Umjj z9{TQ+-;-0Y<-SG+bXhxh*BG@gI(&W`64*{yS@o&-bGR_q2<=;XergG?{E8`l9ShT< zZj_?XoVUU)XojtvIVl95=!@4t^Bi^*F)Y&4*uIGNL)8&WxD}v zbE6r)CO&ix$3rh~G)E=57SU-q@~Hff(QC=Y8Y2$WKoPaS%~IF7ve~E96uH)pNnC5| z2|v^hEKvMK$A9)pnD?<4DuXL+y&6gg0x@)&coA<`as$Z#3eV!z<=qiBSExsZSlud? zG#j`aq2E8B<}C&0mJ=LMw%*)iKJeHlQ3WYX`k>`Tp%UdC7SLpjcOrdstvJ0QyRHQFMiT}55- zZ0a3wkLX6rAD9Y5O^h}hE+*stDMFe-BP0M!Yjt%|MIMO)lstu&p6+)}tTA@}Ge?h{ zqHJx<_aJ(1&sV@puCEjWeSufV#K&cb;KQ#cavT78aqCWx_~lXb*x6Y?begK}zX{V4 zA8X#OY5@kFQq6W5Lqeu@o}k?wIt(;%v|m+k3CL75+bU?*LoIQ=_RRMivl}HJ*{X{+X&qyDCE;-Viy_B2Hy#C)Jgg5UZ%so8W6P z=Q44W*NcjXY*7@UbZ4g-7D>k>b1?GYp&2s*B%n|8&9GkmAzBrn6AD@vFMv}y; zC|7y`qxd7fV5ykDkG~0>7K(bdrbWkvs!hPSQ;yqv$&*N_&)cS3o%@As?jVDcP8LryKjCitCJ6{^})<&>(b;U9heS6=Nk6F`C$50YpS-@@XT+H|i5qCtQO~7#%!AjapEx*+u4^4!(Qsdy=vG z&E$=BhPDI-Mb$Jdci`~H-*+4E_%e}dkt-vxPykrQ-a}q|-#3JE_aXKbfz{(2qI!a9Bho>lNS7%T|FPfESn_3tTotE4DqnuKV`b5cG4<5;;mhE z{%Q0_nH>}GCekQ?-&%H=4_X!+)4ieJf$C!a1)=xH;aHiUJIxwPhpQd>?#m|l!R$|Wl%!G@HK>L2w)5D65D`ODmKs@J)vSQHcN*S$z)B0=(&Z_YQ^?3D6E$itVYOPkoPbqM+O~IR zfKc@@QiY;H;~Q?lwZHkt>v^2A=y?IEQitjh24ebb8x^!|&BS>bi$I+EQ)`sdC5;Ro`ckegi zUuH_1<07)R(ThOkdYEXviSeIK)RAfPRH-%ck+gaEO84J-5h}sGYy6(=Ln$GTrf0yM zskn)&ew627Rvqkyh(Zc;m}4xo(DK5kXA6RW%3Ta;Y~$^YOh?uEmGbpgzN@%c(mCzMk^pST@F~Z!=WZ? zf(GOG&8@*~x>PmC=@J0Hbf1YLhxmgCV?K2ngZiGP_-#^Rd&Z$s$y;Ar(pt*>j)yxw`b``ebSy-ac%iZM&ydr%nRJKzz8!;l zlHlWNNSUbm5Dkb1@-7vRsQpTHOIWp-G39^Z7~L2&S~UON zA)y$vzc*f!_B*9XWr0@mU$eV^bjWET;yIx3ny?T6Sd_L*wM;f1o-(JZ@0t?v6Kr^h zk5BM>QpAfecmdsXN16gtX&zwu7yz8}TUMkS?vUgGLX5wEVAl3y3%TY4I#YEOZZyh9 zKlZ?&xHKNWK-Z5HFa82F)($0TzPZr;W&tp~50|*3OzjD)lbv4P3$2g4n3!O`mdo!v zCmqm~8gOz8<5{N_D|j>?2AO+&wRxAuue7)?da`fKI*Gqy*A;}s0rIfJ<*Fvq9BrZP zo<%G}Sq#D|8?ui-Nez6|>BA~ZE}^&2p%sS>pY}OczarU zj~(iZKxJFsm6WYe%~JkdrKvTVSCul{danoD%u?oAJAum+zSt#@w1fnKx8tdUh4)gA z!#apPm6(hg!+yMsDGt5q3M#{Il;6t8o^LAgFwGS{f9k?a9>HjLA{Lx;8F{iGq{(RJ z9-%L|cz@BeS5-?lSD6rK$;fwQ_*zLKX;-}c0L}aO>gb@iT|;^aJ5(we-`&o*Tq7D2 z1stbUkIlGDX&a3)S{xwQgriS}!lFU0@4nA+(=>_Y^q=c2Hq~Xg`C;+VTM*rqE~8l! z0>-`X^^FiY2;Xfh!Z9+K;Y1(%Ie3dQOK6<<^En44wm{e43KP@x&RGCQ$I8_lQ-H3Z zwVYRuWq79=($2W~y8U53$ez}Grs=fK2X5!B%yGl3-E=6u7g8^KWs6vXdL?)Vm)J7S zrhsjHBUvM3TSiH$LaqTvCzNaHIz8S4ST$UE-hYru(sMS+?Nn5JesxSPfNo&Lm4*&z zzwL-|Xxg;Dskar9Y`=>{205~(DCKEel!Sl*F6pTHZRX`}QgnzE#puTxzpJOrxoAF*+oh6+ctm~~t5U%> zJkm+l!3_+<`8Kuw!0;e@2eUV+>0faei&@jz;a#rP6zw4@78#CA>k8NKd{|sgFo+=T zIcS{T?(q6Rp+auv4sYg)Pw>Vh5p!=Bs2bD-geo=0l67+nAj4%{zB8TtlkYRRh!lKJ za*h`zSd+Egr?lNAI2Ji(Mb!@3=5jV69cWER6yd@ITA;icj?i&OM;N(<+$K~d7?!2t zgw2Hseg`9x)~SHjHHB{L6}|6+fhdV)L#e(og!7@sub(Yp>9oPm^WW&r1YrUaTFN4%HUQ*!)QhlYS2<@jxI#oWT#N1%43Zha*Z`Jo56V6 z26Z(xaUQ}u*HBA^e@bX?j^`HbV_oybpU)?Ba}8NAJ3XqsdvB?JV>7IRFyK&&ZSL%+ zxQai$7wC+d=ogeks7aqf!ZDRa7i_6)8l`IUTka;i%;CGiL#8s4+$}F{og6>leI`uS zd`oHm{XO&O5MyGwl(%RXBI$x+prPBs{Jmw!=5|wYH+i1FXuGK3%on`@<1hj2^$15k zLBxU{IUqtoBdr3CGTTp#Ro{E*>{648Hpie@mf7{#okEXC%wNJOcQYMy%(H0IL_P7O zb-PJvg`7_e?mb;i%9qSh8@!h*bt={DwgC@G>+f$LD%kXe7q~b*d&fy>%~E{=WGA#b zFlTLfCI~k}^?&WulR^}44E4;}4@B!3C@jzCYZ==gG+|ZoM1lSr!ksn;Z2k4hhLk`? zsYhtqZ>R_7TE10u7OW#KA%F9!9c%U%I_|yBuy%)SjLPAP8 z#&DR@>;?8%WLER`E;k?GONpcM+D(?fKKJ!N#@dN=_#6CDX86she6)+6<8j{zPryl< z;H$DBnvN=N_3el7lNir1V5BD!GvRoRN!<0^z=VocgaBq?l?i9NCn9}BhBgHI|vcrfFgh<%eq zUop-}$)i|!A?F1JadbOoG{08*xu5nAM^FlH8L@>^awbz==t;uOq}K48;1t;7D#_|o zjo=;7=^C}zsT(e-da?q|31*v6oBSH-ci#HY&4v5FtuM0G znl#+xzpW2}0O9?=`$?J3fBtVLV*loQL%#nz7}pH(-TuFW!%bp{|G#vQy$c=dSd?#!*Hb2k@)=5p2{thrwD`wx5G+bTs+nUzM_Dlq5AyZpT^ zYN#qxJEXJ`qrp%ho3eH6P=$HPxNUFi6!kx(^bV#9gTmV$p7@3KzU`Seymb>5)^}E! za7Z_57tbzxaW#NB62`@g)(JhYy!63aH7*Y-p^$*s_KO&S%yrAHj<%@$Qa`BwncT!! zyWf7_tS#KAeNTOE?kN*z%WnVqv~$Dr@@A|sk(gj^JHqr}v?!5&MO5gysu!_DikFRu z@I%ku7U0HHz_R37jb`9&RgtgZvEJQfSnt#0C9gx%mKAOcYb-faEt&}MBa5Nz`WQvRS7 z&eMvpcd-hX+fF~G#4L1+`As5JqJDEEC+9|;%fJx4OJ2_wf;nj_lKfKMK7QYUM8NH9`u-B~FdAaV!KknzK< zTf{sv0OTW})Lf{f`;mcrh2A&V_)R$uxxWBIlg#U5PIy~GU3R6>LBN@m@q5(ASmN>S z2f?7&p|&|-d-3r9!`fR$MfJUL`@{f4gGfn((v8wx1`+~8BP}T1AYG11D%~LsBHcA~ zN=pq4Lpw+dGxT%({?_`h|C{IC^AZ+|IdjfFXYX_G>%KmnGukwIIiFfxsSaAIs=sdj zO%#ns6feW33jy3<<9^u1_@EaHs^^W@p?OguyiP{$YiX5dQ$@yb;_S7~8D{W&_T7DN6$CWwFE6!M1 zmK7*3*ub7Pm#?{4_I2GldOj)^?Wsk92&4)^v^wpI|8+{LnY}TD|KMpiTvgaeCXH-u z5;2{OJdI03&&oIveU5h&O4IsfZVEUnWt_~7cs#!owOIBCp2Yp9r3?ZdT9?3;p`o$3 zrpxVksvU0L0}9%9kJ^hwX;6coyc{auuWC8JeusTepxVRY{Z{^g=3LsO`yJuo9D%FC ztF&dnz-;Lmx~%iE`l;mIT6)hu$oX+*XDtnBSmIvjITNvtlT`?!q3%j+E?n9<(tDBB z=TT^q74GNE5m$uq`w2m0I;-lFl^79ucYj@jQbAbMI*ehjt(*QPjCiiUWDh;}h(+PB zbHhBtaoEt;=4z8;g|mf&&zVHLsW1J^+5ZViFNPT)PbsRwst_s*mNg*kk}7mB zMfzfNuytHMFV~_YgN&U+57*?dTCis&!*N$yv)h6(KT{r9_Y#A|%qsLltg90gyh|Dd zuV)AgF=+N~j-+h|?~c8pPM72Uclp5z(RU)y-OC(}pGGFBAyf|EN1BiyqAzQzxG|*U z2r~s!@I-QRa#vu%@_vMGE`NA5BqRoD`C6Gle%36U_z`RY*o-h@aieEInOgV8oavtR z3zK{c0Ki_$FI+nHarop`pA`*IvhN-9(^aTO8d`gB4g?g;&Cvq3%L1)u8&$mw@x@Ws zqZ1}3&>htegpf`_a5H$^o5pr^kVOHwyW6|`o`PWRq$vJ0Q0YOPV~#Kx`gK!1Db3HF zm9_!)gypz!O&H}Bt)M0_*pJSW!n^oRGDE zUr7sb5QJBDpjU8NAc*YmrzrEew?wd|L)jYr1oe-WVg)GHzL1li^^@-H2-%BrE%T&g zMJ4(iIU2&wRDtkN)k;=-#+}uvGc85;%z85`mei80aiT>({UE$0L!6f1Tq4w4J`}$e zxZ$48R>q?%3#`pG!`w}Ff5{Q!qvR;xdp&KoV(J6w-y#dFb61KJ_g3Dd)WCdG#SSih z(FH&byu7yq#G3*&Sejjb>svjtWNtsn>iM1+>vhoN_4E05l?|Ob;vc@)l=avT0)se& z{b)DNu zDJXh80px*C9kJAE*GQK8DEp<_CMa^>JpCXZ_cx`C{~3rH`WuCjs1gg}PjbM3S5+Oj z5mbm^vrzqP754D`@2Pty-j+77rh+A*-nNH%-qD($5qV1|NASs!L?kG+u^h`Nk~VT@ zHefw_!>1UPnlF$uO150Mj0+MEY?WHZsxXVI9`qY$s!*4ZMMlE2d`~g^{cW2ahQ@Gi z6|Bk$r5{Ut5l`}X1E|ZSAv%Fz;2F6J=xuFP&;pQ{N8+6f*X@$N;dN$!5;Lvs`P+&m zQIg(We83OcWLC^2PEHKF(xy!;0a()>Dd?uYotn}!l{Lb>y5hEVJ8Bl$ct8YHuTS90iN$_Ct(JnEYE zVE%#iWtF&f%&EAGG{bibCY|V%(}Rl45^~jruA_S8(pUQdLkkgZ#efUI1dk!riX?A; z^RNA!I<>3~PG!XtdjIth=>dIG;HLPJi$ze{KZ0>tz5>V&z%g`Wow#GXG~vX?ru7IM}Wmq{WHzEOY4N z1PK|hFeSdy>+kl2oNv7q?@heGTV~gZvhyU20?@y~Vcyv&3eCG=m!x|*Mt;MOUsXXv zeU_7>M{Bz4kiSiv3E;-cp7Lm}=vdwm^pogOoJ`|Ldx$)N^{XE7QMXcRC{}~!@be(? z9>`m#=ThaJE4;Mqx9Xv8vM}J9AAhG_Bl$E z&_C1fp@NysyhjeP(2+^Pz0I8~&aV^`q)KXsXrNg0dD7n6_P3Gu^6otfRRvqp&PrBarZ+drKRnW%1Ev`VX!`==$?Fob zRhU9eJbW#*QE*FJi=q%cY6qhijj~{x^q{h(xs|6OE@JB^f|a#dUC=3*21#Fd_wg%+mgKyr=#f~=%Mo{y0+eukNDlm!!Pmbq567+SVGzqsZY^PHry^N-_6m0d+J847efrL|1H z`lA+P0mQX#8_hjgQZbpHmAwp*&~mHM^IrDA1izR6OJTaz<<2i(7F@vno9}Ac;DDZT ztm=Tc(pZWBMgPHSR^_!55GLHuWnLc}q-|?!tAjqr#PDT3thkjITI;!g+ZbiJJfE6k z7gm~h$H10~C*VZj=ZlFyFJl`d1)&MOL%JtYt~RupT^95?iSfe4JJ(%hu#IniDM-U2 z_(i>QmZ^960R(2}FDJHPvWL`K%WM4^O#;|sPP$2ESiL4WW;pDRLK&%;N#Mx$4e>u+ z&-(zKxcDzfM!;>{z*!t$Nutck8!W%o!XMw4y7Tm(oh54K6E)j;t{vL-S)Dc_%g4>Y zge2Cda#c=!&*m1N&0|L!jl2&n2p=;|>c3Y!;{>??lv{$1|Et z0?43>x%hg`4k+Jyv6qpqliY?!imR7l0DwWA@S`1G=)sip0k=+&pBOU!?yq^2P9HWG z>hQG3vnm9I&JO-FUF+ZxFaIpnu-YHId_>W{P~vt7dqC+)$&QKX*2Re%ou_2?)Z$aK z!E}?VF`31_4$d3G>XXC9&cfi{p3iF&&zCR)JAoJv3LfPmqSXO!)s|@FD9a^YiKQ4- zBN9muA*69u5^h6U2ZdPn#wElw@X%nMrRyt%{E4jpM*fROUCy>oNk@awvhdB8jLz9} zu2DatJ&Ls-BMcg^e(??vWST*kC0PY3XPz{_DfXBWBcB8|g~rDgyk8e61BhADF9hDA~`gaQ|L8X1a54}tufn%0+5%(LdV%sGct3xsF#y7B`N&jI`Qnm{LlZE?s?UzWfj$N^C1(L&%vu`rGB z1O`44%V0Kldnf6Iz_Ce6W4s-uJ9D-&x9iPc!pSjoGQZ4TuCDlJuu{4-JG&;au>)dZ zp=w!y=co?Z>n4Y`oWUqDTED z&m_3)I5XqZEN{N=xy~!0cqC(=Ut)rfS9P2rM%IcGp<6+RX?8|Nm zk|;n6cA~ejS1vCf$Of5o$X$C{bvaGY%w<`umRBatUrIKyYA!o})Ks%jegd|(T1=SX z@WvJ^X|=GZt{#B%DnF|;+*<9)w`eD>|16b>O|I1J^nT$!uf@J7cy&uZw;4l`@F2xT z#88<4J74NRu@EPw1tjavZ3oXT%u(Qt)Rm zrafNz7ds8)`owrhss;FXw_J%A#-SAFA{`aA5*Dpqy@P454#?Qbl7h<;)330?q^V7* zHr9vOoZ6p0&Q4;ZVIO=D#-boKM#=2jrJRaf3CwbHB)U1$?4Ec^h!Ke*I}Nf(_q2AS z%SCAr-52E*$E}w2M{|UCK+-9+hKgiu{`PTr(J#f~MSfc$@51~4eNQld%-f42@*jx< zHN-%CZWXS1=?wIn*7RdlsdEANLJe^5cgNA$0F%GpXfE+ z96$`M+Yeqp@I33?w|hn_YP1}53cPhyw^lv6uRZqL=_gOG>sSN+dew$R8aS)Q|KWCV zgg0-!XbqdrVXsk)2TY7a1;_|b%*&`>+k%!y6;~NgoRw%}v%my>UTlZo{Vi#I&1C%` z@FSj6f2{}>fb$Z_h1sf@8e=(EqO`#eoFRw^gS0%8$ZKAtahSHqgXc8HIf=X*Y}$7r z2C?6P6z755301AYdW?vIx%SKMr_E}@fDtg<{+n({@!E2Q9goVGsiJ-!=Pbvl~t|aC*czcO^{IE5oNC(JKsOziaDuhqz$~S)9Fcae`56?BPFj z{b8Q3s5%KO+~Ev8(hm7kjQ^f(CC50y5Ju&yP;x{3mQy)1!!0=g#^p2CDxa)^m6!mg zO2ljaCW&8MBS%%U2t7AmUT+)hskTR;>pfg-gu_oD#e1wDIQRu5#t1_N}k}zA8Opl z;ZN*AsE&5Rf%}!R5=giQ!o)Ga$^9-!6)}^YuA++*oc3~+-*XAH*2Nkw@ki<4n~sn165)IV4pCcSBovI-RKI>_nz01J zrFC&cx@eI(@MB22+kG&Fsd^)Z8%I;MxAhy^QwPhi?S|^z?Kabci{)P<|9roiN+0@*%=1qWAl!t9sIbwUUP+3wSXEVAZ98}kF@8f0ggfg=K_FMphl`BZ1DxE5#E@Ch~mBM{ih0{>Z2WldHaq|%6eieH>&=a>`jM0jn( zU*6fr8bD#A*{~Dg!~<2V8i_oL8aGDTmgIG$$ z*{$4ai-yNaTryrhzTP?s+F0pCb(^`XKkSmTnYQn4mD&iTJPO+#ds_pfz)ucr%Wfx6 z768&k<`mAE|0Wcg`n;XJc=Cf5AIUm_MBA5%(8I?UtN%=pG`Z!o35ppK4OU7Tg=Q{p zo*%a!+auY`ZH-EVs-(5ixNga?vHiR8ZJw06rCvH9mSTO;ebQL#4c^Nu`3Cl|!WVA* z5r<8OR0)(EgRV4T*}=(sU!e^9oxBs27d5fmusMi3j=9Hdn7b0Q!W(a<$xU@_LT{Uy zLC*FQOEV5~Zi03-|d_eh|X->uvYuy-D1Ck`o{MM%Xq zJiQ@hZhLY&?zt{?b}?|FrLx}&y|Qsv`O+^D7vJ$NQS%ilD@iQg!esFOTQ)4j=*7L} z?em+&8sHqNg2@pepPxnG`iOhtgcAj3aS5MoyL=S%V8A|uPuwHMC!P@E@J~ZV_NM;& zjT`wLkXQtT;-2&C&L;mrk`*oSMy&06Hd1jz)tS-R)r`>siytIo6YZfC6e)zrMXUEh zXu|P)UWRaWoh{P%x8Ir;WtmH38K!jvU5zxYGfbLMaBH#RTYMg+_(Yi--xq?8WF;J- z3lYTgZ(X#GUC5n8b$4V7*QI9Pw*1dx+I^*GhrOqtXq3iz#57pH&Uiccp5jVoB+f{@ ze$K%3kMd9pSK&K5rvg zg8qA_WtTEHeTdf$#M}`%LT^_tI$}nDSeQRiSGc`()oybY<%IWMlmsf|s4UQx{##oE z-33lrFPx((-Gk?%W;`4#iwYm|FLhS#jXhP8cK5MdObq6eU`=tSf?h`S{=z zk$dQ~9-XKEy1!qqEmo#jahsTX|3DQvpl1B&zHFl7PoYR#(6fWV=FP5d&UI2QHy)^Re{8-DrnVuhs|>s6fV%NwT2X|ef8=YWO0gAT_ps^KJ(!GSm;EX`xtsDnh^ zdkLKo<0ILutP0eAYeX>1fOS&TPhk=Or`#mHwO97*6O!0+UH;HZ{*1T^{BTt$({ebi z!RlAu;%ct|7h`$HsO)Ib}T<~R- z`hjHFSHufez5|wKmSc;T=MF5Mfq&)rkC4rs$JXZJ_{wjLH+DX4jj4Cv_A_XV27qM` z__#BChEJ$w#(F6$bRj2{}fvnMb*H8BW|;ENu2sq!5lUar`ZVnMexRkPkHShOWoMIsICtt989xUB&SZfUXL?hPO z3cPWU>#^qe!>y6-ul;5T4Yq=}L-#)4V?K5^$S6`l^UjK7mK0!ezo* zbD^=&3CYO3K&74=tZHFo9ph?=K(laRt+iFz@8x&RUtw~>Mch`akGk9AFXS7_Z24aY zt)jQm126{q#(B9}7Sj!RLruSf{@MuVmbC&k^Zf+c<(iDlhc>s>%wq=t8SLGy{k1oH zHb@pU|KWBS%vgp6Gw$ZZyF2wz@KhY?p?%_{?d&Am+!MJq>eftIMcMM;^gh2ArnUHS zkCWtNQtF=jp|IaqM5K6UbTA~$V1nhnUgsTK`o*#e#b&Ywc81nj0EMlt0gvD9>H&xf zBvQX$7Qimc#Mms(rr1w*bR2lneuXbXLbl!ZqqYa>QjB`A(w(+t`jUqj%eS_w)38#S zXIyTLMO)FSg;~%T!WFZ@J2Uqt@=PH4fQGKiN&(nmYW)XLE>S$m_orZWYwBh(otwaR z#CE~qL8y1DtqHqdauI9sHmpuwFAIFdq-~hoJAVRAYstcTSaduv`0CKmTe+3s8ssuk3mdqwHAGS zqO&>TsHkg&un(e4aj1NA8{}s5!eM5SuKgS+2>$7)cQFSqaD|$z4E7>C!)s&D6CUVx z;F6!-Y}spaIX(>6@m%njdDjo3XlH7L3lpq*Ckq}TW!m;o=f600TfS~8u6!dY;q!G~ z0jL0O;NnH3;Eh|quptIhq0J2$hqL#5!bU+o{7Po!;}mdGeVI_j=b>5y+J`c$ckAIDxh*9|Oa%EU{QUS6F@f%IE(wH}vn!{52X&46aS`e(l=YAlfZz|8+ z(D_3Gn}GQ3r_&+&oh%rv^%c5Xa2r4T`0gH|G+LO;qdL!7k+gUBpQ?jGayUGnvpJ!w zSuHowbn03!zCTMX^i#$iIhf|<2?k^M_OTpepGtKBDi<0f;H0j9laJY5Y^RdbJE{ar z>hCB1Fq^ZA==C)8R;GZv)is};{I*3ib%i{wR}rVajs0-YGgF-S)K!3{g%Oz}3R&_C zX24F%-vfs;-XhAi^yorjY9{wXSxrG!kP@=y74G?a^+)Bh!s6Ctw{M+!wNl8~A9o)cxcJic-RbNwzG;ndvJ-4-8WwJc!S z1G)fHs#AllfB21rhyd7d#eW6rf4nfpV{|AP^O;{$%9C*4fQPO6!CfItdeZ2S2k*91)mx?Q7%yNX4y&|e7+>_i zQ99EIyO4E?z)M~;6UTC{zewAvaVQ;o0^T$d*6-kSbI|f57Z}sk z++OB;x7SoZY88WMmHPNc1BgsZ;`kB@jL@2irso+i=d`VpQ8BN?Nt?_1w{3v;Iv0S} zv?Jj1vr36)QlEap&uF_}Dih|?X4m* zcvrEOJuodXjpjPw9z!|YSwCnJO;Xx;nuR5(V3ir#@T}jhp3NupK114UvmI_k!_&Ea z;@~dnU2Z&^{S_|nfFLDCTpGeT78^;o(GBxb-&tCRO?0`xAjlwRl6^sfyG#mqwyh+M3+e-s|4xY*fwQVc2tntXJRgfE;zJ+O%l%S`IJe=+CS?2hsh$ zMXP%A!UGw7royx?JKK4Txz~b<=_-GWW*!m&6U12p?N!*PyEGM4+n>$QHtbs@*bBAl zt*G(Bhgs{F{y&2yh(!iTMOxMBOS{INkF$DYh;A9xOEBKuAKXxOWiWbq+@b0G*aHTo zJ`INaqE+1G!b-16J#BN7dcRv7EN;nMKaLEldAZ3bI?$y0ZoK@Zs3wx0@@b9ndgKJ- zLJYF;csb{Cc;GCVpd^v0NgNrx%G!vNi^*aI8mwMCeQB`F8o*!r&;(vA>j7z!BNIoE^mcDe9T;;!SHL`%9JUB+8?2r#gh^d~^);S)QOn>Ci?F z8fjfq{D|84i>S`#toFNy6%$qXNn8>idm6O6U5FfuQgj_~NWIawgz5B5%=n^C*g)u- z^j=-c#wq;H5*4(wkfc8*))6+;ty`yzwu27 z=)NgGZwp7LhVu6aZj|wMh0s?j%(m>G^w|DbI>Z%!g_^ZDi$`UV!(^2ACi1l)_R4+T zL_IRwW4M4Lc!mZPR4K?fbiNoZ9algkt_pfGt!)-M8x(V4riXM|{!u$z94Wm(q6g3o@x4h7VT!>aQ7@LDLbE6vKqFxo!O{ZY8W+ zEIpxJ>b#sP9G3wcRb!}*$^Anzi)@6oi(!^*Glk?tKN5=?jx zoP(*}ijHJTQ>QAO5H0D&^A3l6rG=4dHB>OMHczL9YT4Rhn`^ciR7&RX5 zkt^=mBNYAP4lTR+oa-(CINYB~ibTN(02pbMW4w3XOW#H|IWf2LMjwcsK7)FccZ$5G z+b|lNl_9t%mRFi~*0yu|&{-!4boqP2>D3vq@OcyQ|DF*1zu|}Wy_b7hTu+%EXPX6t zZC~q|r2~+j!bMG$0w}A}Z_!xe%4evvHIPi<66sYNc4fZoR8zkqnk75(>2rB38zz5m z#~muTKQG1AsNjFL>Z5;i5`lid85WK3PbY@M`y^yXTL=X`5E=_jD(D$tb1rko*SX_j+Go^l>8Nt> zX2L*dbq25_%fI$s^{U-ZIS<^JQ}!QW z=ih$2>*cWnnHkQJ(dKfze%Z7_Tf$Uv<#k2f8b|_KAD0jWZI>L(I`al!{q*vfpPL!B za+!Kla5EL}brn>7+SsanC~xc(sL#|-&gj^R9uPU)k%D2g&;hq+MJ~&yT^7Jc!F8Of zd=@*63Zaq@ZU+zK_BVski!M~22=AF;3x&BGzSA~zaUz3|&xB(e67gkBHo|=Z z9{Kgn2I&WSbf&XDxS*0Cx2y1q`edbTW_V@(B^MX7NVZc$dQdLWuaZ<|qsu?H=!*69 z3h574V+<$OcYiweyiT?%-Ybo4AzW%NwlZgi(+5d8{(L{*_`SI|pK`v@g_xaLq`0ThszuDy-RvK(N$u6C2niYnJZ~18TSdvclVt0_a&$&SZst$v zPC5<1z!|=!IIgJ!wDlK*@;k@jsvQbJ`Y~6HDIIi10hFk_KbM~-%YX^=<~nn^TERoZ z>XAO$xXh_})$8O6ohn~9&&9gFB0J-A`0AH}wB*yu zj467qLayHD&^W~AYH>+elrKBrQXT)+qPzKxy6iL$WxdG{7(lK5bHXNBQF#o>N3H1_ zmTHIPh4dg-2q(cd4$8)V+ZexvVDhT<&o1I(wuL2-I8dFXGx* z_tr_&W1AChy3p+_FVW&2GT^=v8?XeMQzy)I#zZ)hf4`M>{C!pRI7t*rItBQyPJrvf zabk_mv+BuxU>NPTzWWvGg3_)Cuu+W&`oq@R4vk{+C5@DYbn#K-9FrgRW`xPaPAAFv z{t!HbF%kG?NHCk5G-(8%{qm~)t-c>Dqx_T4<#cfi|KaAIA#v_DTYalKbDxiypNXfY zn_xT~j(|tX#G>wwp}$X<2iOE1f+jR$0_qPmyR=c1-y#QIHz26Hf|}g2&4v+NG}}Mm zS46qvEDHSAMfywt=SvB&bHX8=cV0~yHFRKmMEh&-Y`Ku8@eSAeX&WomYJG34{Y8OP zO|B5ir3QJ-d2Ek>;#m>t#7f=Y*A8BjFUwDI0HCM-PY}^KGfiIcfr-QZr$=<Hj{d*?7AINa-; z5U`u;B$x#o-1T%ocfyht&+HzBJ~5I@wLdtR*cuUzkq6e5xXxS4@q2{dw1ZE5DDQv9 zHwG+_ZLMm?#wyCc^f;!#Mp83cfLb`%-`3m2W%$ zK~Hkgw#P-2EPX%$#0|sC&M(7#y;h%ZXDVn+a(A7j1uF#g7%khi9c*(B2+7|egL1qx zPZoT;i$k5n>e4d7l@m;8CuNM*Wn&e0Ra;(j7i!)EU!vj2xcWTXD^k#vZlL`i{8lXg z7>%^0#J!sUE-FuR||9OQaCn>{lEWy)j}18&qu=UJ4K<+V)Af$JuN zf$i6m&`h%%*VTZz5Xz)shrD_(5hIETU*a;9p}CfVIwArKk=B^ixnrAkyrwW_1iM@d zQLtq5J1l$8fEUR$?OYxl^{3NDuFEFenI1};)7qSCtMYzlxW^oH;nyhfbEG<)h)|=Y4cd0O<<TDViMvo2r0QOVC|5u=7^sf19c_c(*gCTLw!Gt` z4IB~?f;xv>D$B|}?EE2hj1PiQ2DaQ7%x!BQL_G?N?d=k+C9k1pFEws}K${}*@Wp)o z1Ua|gdYufu3}ei{E##PS(Nc`N_?FduvMb<^?c+p8(F!pIf?47z(b-+`a& zdmQX3^XLKqCLtzdX0M6W=+uz}|>7zNrJUSx9=*>^J+*^P&u?)aa+l+2Q4vQVDX8o+bqT z{ncD7ML-ib35q-4`zq$;Zx-Q3&67&5#P$AuCOC#i(=^Nc!B#VwD!xgQ>i!wXz~RhmpZa}Jv4o4v!X>L z{s9zZNT}Cm-*@@ei~PV5C6{F7!k#Oa{zIPu;3R2gpzEEBwavZEObm0m_;Xp)Bo)ma2^{s|Y>Tbp$g>1~wer|4 zkc(+{TYs0T`NN4a zrg-x|SblFTd2aopbKMEO%vWFiLz3-vHkDf+_M8&JRsPrOqcU1_M1V6N3U$RpY^!?$!cq6N<=!CqugQ|Gv3mD*Z2HvqQiV5v#lbb(s?cZ?EXMupCWYMiEsEjcc zDbHIDNI)MhFwFHc%B1c^tIT^+0kJfKQKVX!cG_txPV4V!6OyNeW+ehf=I&>&(72cW z1`#BRHsKds*DEo!{AuOwz$6|A)Mw44bvf6%TDrdIna?@*hEIg3E|a{R)P#o}0R8j6 zOClPh1<0~mvpgxXy#_p3)Qs)ijqEiUL;{aT5aL57ipvwb(JLV&V7lD^B}PgE0?G*V z6#6vqbjjL~m~8dcmTWVfcL(;CKig(S??+kilOS1^Z&)yqt#erWoHvn1_veU)=POic znN^N!8!^qI#4)vRVnkP_VOlZYVYl7dq)g7Az^5?m7)>a9~RuI?!>Js1% z)s?^NdS6#PQrc<*z4%n8+JlJUvz_Puj49GwC*v(c_zgxTFpb3pYl4A zXFNQ4UC~Np#;Jc0P#*|tirPXi3LLm<>ij9PKetEOVt4I-ZvH?9^T^CtYN1u#W_{V* z7VSI4p0EU`xWBTq{*h1hPZLM;mz^9B2XRVneW~tgy&_FJkwPYMnyjD1w!eoce-4W< z?Q!*tMo7G!7gz$Kl-3!W4b50#K`-TeyLr{#&_R9>yPa{2er=TyF0mBR^QO+)z5L|H z)MsIqJurfaX&JRNw!xh?eDQ4H;CpKSpqvQEsgqm7Ag7B9{ywMchd*4GtWU7?>bxjbWJ2VL^wD9ujMUa$YIC)SzS8N8vzDvfvoMt(?%ZG4dwHXp0Y4nJX;%j z@Zhh2#GG?N4IBUH!;3!WR@uP6W?jTo2~RkZwN8GGMhBO-vVm%O=V{Gi^w-#Gu&j*9 z8Du=Xq28?^Huf!_-sc(DK5!Rn`i~T$WJ{(^MGJ$nX?bkh4`Y)QcZ~vU2=gEiqJvlAKDV2=BOQ2jK&vQ5 zZB2U|3asm70Lc-UG4>*N12xr0&?%Vaci3s*$gx%?bNUzpj;RTKoNV!6--|cTsZ>Sz zSxe~wd79VCa*MQE6fWK_E?%re^`w)dZr8+~^F)_%arp+*Ivt2>*XViH)F^Po>`>I>^|rKNF2F?6XGDnZ8wPCpq+d4zO4;lZC%s zZwj6%YGrx3{`6x%Pozqan*`w=BDhF!Vx7iQ&hOxL)5nj}LGI5U3e&v~GO~cW-rK=T zU>b6@JVNX!ay)v5#IL<$Mkqv2y#9O@;TflNaceiE#60j0KwN;3W1(i&X8ZCHb~^8D zDNZ#M$b6f2Aimu2!`Le%yst~jOf$KQ+iFhbxByjX>B1guknP7g5u3UjJb9NyOl^OU zkkwG1p!40OGW6!wpPDvwbuE*!Q1~D4$h2y1tf-5MfKO>CYugz>ET|wu+A%K zpso*U}Gz}$k$seq@XV!wy;B7aR&97@ZN5XbZ$Ca4TVPh(n>aT>+)b30rC~A zfCZl26!~7hl1jCXH$`dB2{V~2z~SIXWF^Tclf=~+?$=;-w(&}S<$oYmCWc=5{!tAH zB->Vuurd~j`a~W${cq#EIiY4z*KR73TuK6av0dLHk5`RLkm}vH&!JFn#W}WkeCK=`25PzdqS75Qf|aa8kbYixcr8-e(kieq98&Y*6lbwBC9(C5KHc{o1~HZo|? zj_$*h1c2xX=YB|xBtZJ^KD$m*&khxX4A$A(Qoi4U6=guQohbWL#Uyg2mD{JYaJkM0 zXpShR6Uv`69JCnBA6JLH@}_;9P09Ci%z`DuNNB11s_Z1uFpKe6W!1lpy_aYrQq3%x z5SG!e{@G`7t^e8x@uE;bwVOK?P*$;ul@mrO4S3Pr-)H;zX19fK+~LpFrmZOe8PkYD z;_s)`V7|~E%y_3cdQcOLS&4Lc!QcHFt$$o_6Mu6~=ae!Z$8B&Ku4%z<)rU|pNBKO9 zNq!KmqU08wD0we@v==dW^~zll=prQr$Q~Z-+%a4gp#n_p0L?udWe8JVE-FuO=>?P5 zJ*p$Z*X$gz;t$`Fk(P1 z`MZje!m*ygK2yN6{7*anzX&CJ#|aJD>f=S4qWLD~Zm_SfM(vI%5#9kD&`F>bt~(xF z;?TR8kUWYe6;Z4SMF4SP-l2!&hRM}r8>xTeY7Xm&u@$H-@LE!&w~N!RY)L@-XvRmh*Hj@!)CanjR%$G?iLrCZBWHNisKQA?5E&%Pb|ixPyZ;g29-YapZEm&_47j-eS4OfUcIzo8vkSLd=hG z#qOtc(L5~GDP_{_A=H~MI61uqpQa0f0FV=&iyoW!Tww6hx$y~FE6^csrG-Ae`Dn^@LT7Z zXwVvwW@D{%#*`;R8lAA26aP!~4nH z*c9YBl>qVa&^?u6#yQ%0A%`#ea>=7Pq00-{&+K&HN~y$JQ#b#0ldgQ4{G3weQF7GD z$w$_!&?D2QSZmb+kWP||tA0x6%{|9;qiTJB}*$#K8kaT^C8o~ccE?{)o&!C z(PrU~6|R4-TJa&*ae;t5C28^z3}Cf^CD50aPZwCxh5%(&c_7ZUw?PRh#9L-7d6 zJ~+#2`9zh~+nOWhxSdMAQ{0M^|6&vjECqo+8d_*={n2pX>P{Aa z8U}Ri8zs>0^%m02h+==aP|0>^T^w*{i&r!VwCt50WH!Oneb~xvw|Q%fH&_YvmIIv? zsOg`z;(OjS{n!gWx=Q-Nx$R&Vd?zbr{-DIu)l23O(c7zZ8EUzzU(JgXKz9`VA%3qsu!=BKrPNwkki`3* z4Jzp+jrLZY;!zc^_I6&@ngb{@tsg`K2jfq6x=+7xvKjQod24e!q~6oh>^k<5@1jdIQT3i-H@at^_p%GzDmmz|s z`k@XPo5fodY(DiD8bj(wn;cyVi;ZTfA$6Z_c3Xbi9!7GKkeZBq?XDxjb^13TKN1q= zvh>vtDwaP7jv`J*AF=G&hpn+!{aoL~88j~KndkvK4LsMq^Q0nJb$`&*svzrWXvJeQ zQ*cYx<@ar&vJ}_{Jh#bo?QT_9=zZV!z{)O-x`k^|^e(E4u&C$vAPOiV$It_mmjtJl zjhgTXsiZSb_^Xk4Di)^(Md22n(cX^qGKB1=y800DGB&4GjwYo0ogM`|*C)ELRpRIm zM4Ux*lY5*qc+*=;T@@=feV#J7B5uufvzI?A`OfMzpsq0kdK=X?gw<*c)ko2Sqlxt9LTeq4}V6fZN+sky^O!-;| zK)P6cZW6`%{eaX-5mKC{2OluT3n-W)A1z++Uv9>WIQ)=Up1ih%H|EbXiZ`+9m^&<) zd?~M^{XpQuwl|dxCB2~=paaywiK4DJ ziNiThY6UmL-)2VS&B}%KtJ%G-k6 z;f|7}Ver665p?`#lolP)r~&K)Hy{E$eF{F{&=I70yshN9w_@jqF#1Zd4Kcp_lmLWc z7ZQRV4(O8NWLDpB(C5UQ>yK-KySZ6g&j+6#y~y_OPHS8LQ*?$gV0LHdtd<=Kmri#K zm10lP9Q)k?c#s5X_(G&5UaoMv42mH*&qzar5*`|H-XIhbF5f`vc%=dCzsG+IbzkxfZ^^?1Zj$8ZSYRA^a< zFF&^(nWs4mgA7p5!}hOX0%<_94KP2cw07YQ9gQSb^iBBx9FqsgE1?eB%r8crftErLLu?rHf?Z(4rAOyVwR-q9?2c>A_TZ#g~yCDv5D&DpJ- zpCiWL1X=AJfSxbE%Sl%elJ0Q(qKiImKizDO&~aze72$5?Yh>E_-$WTO^dND%G(Z@! zo@?U!)e4)9PlZ<|5*ko?ZsQ{7;IU8`x#g*(W0Oy^Ov>hn-($azIG}m-*a(ze<}+G7 zwQhzr7blv1HzP3QOeSM2+0EloszXoqf7(0OXsFjcjx#9}275EgWiY96+-DHRgpArk zF1ciAFyqp0=Qd0erDojIL6_}l$YoMtGlWvjpg8U(BBPMWAVa8z$Y{cx|LL5!`^8!7 zoOkD0&+BJB>-Sshd7ibt-{+s*iNb@eOY_o%kG(Ie(WYbE}-^2i$S0q2xRV<5~qyik0*d3s#XD zWGA!>>fiBr9wC~DE6grmG)apDkN5austQWY!`~4tPWlI69TFz(V-*jKWBD#1F=CE- zBoyp7iOdlsw~T3nn7Ct1OPjX+*>m*6WxmRW*^u_th+h}GJpW$i*bt=xjsd3-OY~z# z1xxj$Dep{WM~=DWiOutBu-CV)tVKD)aGU4Tv9E*G)p~KKGjR0=8bYh>`4&B63xg1H zn`|lH!)rntbCRETKH=??WBJalWEsmDn0LE+5zF^9R0-6i!|)S=Nq$XhISaFH`j>nI zET&c_nkcg7!^j@p(wXqEEgN1Ff39o0IR0j8z|Y zU_R*vh2`-zw@rDE>rJZxG1gf2pA?4^iKaK3kTS$9A5fjmueNCM)WU3m-?9W9cT+*% zRrh)d?ZWZZ)WcsnX}~pMbF)q`s##yae+@D}pL@Q?t<92>A*0>0{p*wabgKrQmoZ#Wt3s_sPR zj%O~RF`-QlNhBNf#YqlbaR4N$;jZ_kXORxV>*`+e24EInMg z>D?jUqO7GKp|)$-SgJn(-6qhhfOfYA!~T-iO3goMvZt{`>u=D>FmP#$55rP3j4Uc* zULt)@{s^bU7izvsWsWkT4L<<^e9nsm6Q0j3Z`SH=P{|xe1H;ICD4h|+w~N$9i}pVaP@rlGVc9)il`k|iQSw0R90`bn#0M^okTcJgG0u@? z;+g5SU;K0i3Jv+HYUYiH(e~ehlA(7v_m7{JFAoB8A4) zq2ZU42Vy?R&1jk0_=zHN2rvju@3a4+FS!GG3wY-^Or34VYTPbumV)dItkaT)73XSSA@m^Q#en|)a?uM=8WVM{U@jD3 zzy#q%o@6_1p?zGJf}isqQq=rryK)RYr2Sh0y2k5WLXK`*n1KS#NE3~>iPkpH5dbQL z88}pH$+KIn@hyknC?|tJL~Irm*2D+7u|!Oz1*?^>zLch2txEvBjhf^Wt%{YZ@P9Zo z3s!84b&!PDR=qb)fm_;k+8;^`TlswZEN8(1J4O~A*Pn~PZhS`fGIdGj9Z{U$mpghb*MU55&ve*y}eSi)ZTSwEax4DKN9c#l|6aPIp!Ak-s#$0)lVD;^w4;ALJatCS<2sl2dam$-Rkl{F!tyg6yNB>`hy=QZ9-$ zFX55ms0xrGvrtNX1?1IWK-|mS7h@uVy#!hLYGN}Ox4Gpsb0<#2&2VWyVTtYWA+u_0?OUqKi@P3rFBsA z(ew91qs~Pv#)7b(eh#}0g9oGSZ_9`^R^?X}@s~@fLYW6oONvNJ>@UUT(H3*3Z2=$0 zptbAS7xl5Ew+&tVZ}xy2S=Z=i{^Zq|v~uwRbcfLaGIYKreQ@gR(Hv{}#vhpVa(bnE4hBpQ-WXhAa4)6fj(l LdK`IxC8YiX2lGP* literal 0 HcmV?d00001 diff --git a/src/main/resources/public/assets/css.css b/src/main/resources/public/assets/css.css index 40080201..1aedd5d9 100644 --- a/src/main/resources/public/assets/css.css +++ b/src/main/resources/public/assets/css.css @@ -8,31 +8,49 @@ body { } #index-page h4::before { z-index: -100; - display: block; - content: " "; - margin-top: -4rem; - height: 4rem; - visibility: hidden; + display: block; + content: " "; + margin-top: -4rem; + height: 4rem; + visibility: hidden; pointer-events: none; } .jumbotron { - background: #888888; - padding: 3em; + + background: #000 !important; + padding-top: 0 !important; + padding-bottom: 0 !important; + padding-left: 30px !important; + padding-right: 30px !important; + margin: 0 !important; color: white; - margin: 1em auto 1.5em; } +} .jumbotron p { margin-top: 1em; font-size: 1.45em; } +.btn-docu { + + background-color: #00BAA1; + color:#FFF; + border-color: #121517; +} + +.btn-docu:hover, .btn-docu:focus, .btn-docu:active, .btn-docu.active, .open .dropdown-toggle.btn-docu { + background-color: #02d6ba; + color:#FFF; + border-color: #050607; +} + hr.styled { overflow: visible; /* For IE */ padding: 0; border: none; - border-top: medium double #333; - color: #333; + border-top: medium double 0; + color: #000; text-align: center; } hr.styled:after { @@ -45,7 +63,6 @@ hr.styled:after { background: white; } - .feedback, .hidden {display: none;} span.feedback {margin-left:2em;} @@ -56,27 +73,18 @@ pre.json-display { background-color: ghostwhite; border: 1px solid silver; padding: 10px 20px; - } +} .json-key { color: brown; - } +} .json-value { color: navy; - } +} .json-string { color: olive; - } - -table, th, td { - background-color: #f4f4fb; - padding-left: 7px; - padding-right: 7px; - caption-side: top; } -th { - border-bottom: 1px solid black; -} + /* From http://tobiasahlin.com/spinkit/ */ @@ -125,10 +133,15 @@ th { @keyframes sk-stretchdelay { 0%, 40%, 100% { - transform: scaleY(0.4); - -webkit-transform: scaleY(0.4); + transform: scaleY(0.4); + -webkit-transform: scaleY(0.4); } 20% { - transform: scaleY(1.0); - -webkit-transform: scaleY(1.0); - } + transform: scaleY(1.0); + -webkit-transform: scaleY(1.0); + } } + +.your-class div{ +float:left; +margin-left: 10px; +} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/error.jsp b/src/main/webapp/WEB-INF/templates/views/error.jsp index 49417655..cac83ae5 100644 --- a/src/main/webapp/WEB-INF/templates/views/error.jsp +++ b/src/main/webapp/WEB-INF/templates/views/error.jsp @@ -1,15 +1,12 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

${done.title}. ${done.name}

-

The example "${done.name}" is failed. Error information:

-

Message:
${done.message}

-

Stack trace:

-
    - -
  • ${item.className}.${item.methodName}(${item.fileName}:${item.lineNumber})
  • -
    -
+

Example page failure.

+ +

Error information: ${error}

+ +

Something wrong with your account credentials.

+

Continue

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp index aa857c4b..5b20cfe0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp @@ -1,6 +1,6 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -
+

Please Authenticate with DocuSign

Please choose your authentication type

@@ -9,9 +9,10 @@ -

- +

+

+

You need to authenticate with DocuSign to continue your request.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg001.jsp index 1a689fbe..afdc1e40 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg001.jsp @@ -34,7 +34,7 @@ value="${locals.dsConfig.signerName}" required>
- + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg002.jsp index 6958c6f3..89a09d5c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg002.jsp @@ -47,7 +47,7 @@ required>
- + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg003.jsp index e8dfd42d..9ceb15bd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg003.jsp @@ -19,7 +19,7 @@
- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg004.jsp index 051abe61..48807fbb 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg004.jsp @@ -31,7 +31,7 @@
- +
@@ -39,7 +39,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg005.jsp index f0cff895..07852cba 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg005.jsp @@ -23,7 +23,7 @@
- +
@@ -31,7 +31,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg006.jsp index a0341084..c2bf9a21 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg006.jsp @@ -27,7 +27,7 @@
- +
@@ -35,7 +35,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg007.jsp index 89eed27e..84bec4ab 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg007.jsp @@ -34,7 +34,7 @@ Thank you.

- +
@@ -43,7 +43,7 @@ Thank you.

- +
@@ -63,7 +63,7 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg008.jsp index fd249303..141e82ca 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg008.jsp @@ -28,7 +28,7 @@
- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg009.jsp index 227dfc8b..b633f5ec 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg009.jsp @@ -63,7 +63,7 @@ required> - + @@ -71,7 +71,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg010.jsp index 008fd01c..4ef4f034 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg010.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg010.jsp @@ -47,7 +47,7 @@ required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg011.jsp index c67e4034..16dc342e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg011.jsp @@ -60,7 +60,7 @@ required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg012.jsp index 97134c97..cc3c8905 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg012.jsp @@ -41,7 +41,7 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg013.jsp index 3739cb36..b8c1895f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg013.jsp @@ -99,7 +99,7 @@ - + @@ -107,7 +107,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg014.jsp index 37e49588..76a72de2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg014.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg014.jsp @@ -53,7 +53,7 @@ required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg015.jsp index 7f451ab3..68f8c4dd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg015.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg015.jsp @@ -35,7 +35,7 @@
- +
@@ -43,7 +43,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg016.jsp index aaa47d98..92aa04af 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg016.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg016.jsp @@ -49,7 +49,7 @@ required > - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg017.jsp index 50aeba3f..0f6c87c1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg017.jsp @@ -47,7 +47,7 @@ - + @@ -56,7 +56,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg018.jsp index 0a90c072..771f4029 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg018.jsp @@ -35,7 +35,7 @@

- +
@@ -43,7 +43,7 @@ Thank you.

- +
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg019.jsp index e0955e80..43a6dc6d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg019.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg019.jsp @@ -45,7 +45,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg020.jsp index c0daa432..cc6e7f12 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg020.jsp @@ -30,7 +30,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg021.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg021.jsp index 85007e4d..b6d7ecb5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg021.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg021.jsp @@ -30,7 +30,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg022.jsp index 667e08c9..1534fb11 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg022.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg022.jsp @@ -30,7 +30,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg023.jsp index cc628383..694cf6c9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg023.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg023.jsp @@ -39,7 +39,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg024.jsp index dbd066d9..64827712 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg024.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg024.jsp @@ -28,7 +28,7 @@ create a permission profile with the eSignature REST API. - + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg025.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg025.jsp index 1383dad5..6c332a87 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg025.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg025.jsp @@ -42,7 +42,7 @@ - + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg026.jsp index e71c0566..a7dcc652 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg026.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/examples/eg026.jsp @@ -50,7 +50,7 @@ with the eSignature REST API. <%-- --%> <%-- --%> - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg027.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp similarity index 93% rename from src/main/webapp/WEB-INF/templates/views/pages/examples/eg027.jsp rename to src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp index ba61f457..f8283fde 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg027.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp @@ -1,5 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - +

27. ${title}.

@@ -36,4 +36,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg028.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp similarity index 95% rename from src/main/webapp/WEB-INF/templates/views/pages/examples/eg028.jsp rename to src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp index 966e4cf1..14378cdd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg028.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp @@ -1,5 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - +

28. Creating a brand.

@@ -47,4 +47,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp similarity index 97% rename from src/main/webapp/WEB-INF/templates/views/pages/examples/eg029.jsp rename to src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index aa50e631..f535023b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -1,5 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> - +

29. Applying a brand to an envelope

@@ -71,4 +71,4 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp similarity index 97% rename from src/main/webapp/WEB-INF/templates/views/pages/examples/eg030.jsp rename to src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp index 786a4d9f..4d712e17 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg030.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp @@ -1,5 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> - +

30. Applying a brand to a template

This code example demonstrates how to apply a brand to an template.

@@ -99,4 +99,4 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp similarity index 97% rename from src/main/webapp/WEB-INF/templates/views/pages/examples/eg031.jsp rename to src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index 427b9740..bd329dab 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -1,5 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - +

31. ${title}.

@@ -84,4 +84,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp similarity index 99% rename from src/main/webapp/WEB-INF/templates/views/pages/index.jsp rename to src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index ca661132..a68bf1e9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -1,5 +1,5 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - + @@ -300,4 +300,4 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp new file mode 100644 index 00000000..74864924 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp @@ -0,0 +1,22 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

1. Creating a room.

+ +

This example demonstrates creating a DocuSign room.

+ +

API methods used: + Roles::GetRoles and + Rooms::CreateRoom. +

+ +
+
+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp new file mode 100644 index 00000000..46a6ab6f --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp @@ -0,0 +1,43 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

2. Creating a room with a template.

+ +

This example demonstrates creating a DocuSign Room using a predefined template. + If you've created a template + for your organization in either Rooms for Mortgage or Rooms for Real Estate, + you can create rooms based on this template using the Rooms API. +

+ +

API method used: + RoomTemplates::GetRoomTemplates, + Roles::GetRoles and + Rooms::CreateRoom. +

+ + + +

Cannot find any templates. Please first create a template. +

+
+ +
+
+ + +
+
+ + +
+ + +
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp new file mode 100644 index 00000000..67d9a110 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp @@ -0,0 +1,37 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

3. Exporting data from a room.

+ +

This example demonstrates how to export rooms data from a DocuSign Room. +

+ +

API method used: + Rooms::GetRooms and + Rooms::GetRoomFieldSet. +

+ + + +

Cannot find any rooms. Please first create a room using + example 1 or + example 2. +

+
+ +
+
+ + +
+ + +
+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp new file mode 100644 index 00000000..60e3aba0 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp @@ -0,0 +1,57 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

4. Adding forms to a room.

+ +

This example demonstrates how to attach forms to a room using the Rooms API. +

+ +

API method used: + Rooms::GetRooms, + FormLibraries::GetFormLibraryForms and + Rooms::AddFormToRoom. +

+ + +
+ + +
+ + +
+
+ +

Problem: please first create a room using example 1

+
+
+ + +
+ + + + + + +

Problem: this room have already all the form

+
+
+
+
+
+ + +
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp new file mode 100644 index 00000000..023655e0 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp @@ -0,0 +1,32 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

5. Get Rooms with filters.

+ +

This example demonstrates how to return rooms filtered by your parameters using the + Rooms API. + This specific code example filters for all rooms that have had their field data, updated within + the date range, as shown on the Details tab in the UI. +

+ +

API method used: + Rooms::GetRooms. +

+ +
+ +
+ + +
+
+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp new file mode 100644 index 00000000..dcf3323b --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp @@ -0,0 +1,64 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

6. Creating an external form fill session.

+ +

The DocuSign Rooms API offers developers the option to have users fill out forms without + logging in to the Rooms UI through the use of an external form fill session. + This example demonstrates how to create an external form fill session using the + Rooms API: + the result of this code example is the URL for the form fill session, which you can embed in + your integration or send to the user. +

+ +

API method used: + Rooms::GetRooms, + FormLibraries::GetFormLibraries and + ExternalFormFillSessions::CreateExternalFormFillSession, +

+ + +
+ + +
+ + +
+
+ +

Problem: please first create a room using example 1

+
+
+ + + + +
+ + +
+
+ +

Problem: selected rooms does not have any documents. Please first add form to a room using example 4

+

Thank you

+
+
+
+
+ + + + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp new file mode 100644 index 00000000..c3254f32 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp @@ -0,0 +1,98 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + +
+
+ + + + + + +
+

Java Launcher

+

Welcome to the DocuSign Java examples using multiple OAuth flows (JWT and Authorization Code Grant).

+
+ +
+
+ + +
+

Welcome

+

This launcher both demonstrates use of common OAuth2 grant flows and multiple usage examples from the DocuSign Rooms REST API.

+ +

Documentation on using OAuth Authorization Code Grant from a Java application.

+
+ +

Rooms Examples

+ +

1. Creating a room with data

+

This example demonstrates creating a DocuSign room. +

+

API methods used: + Roles::GetRoles and + Rooms::CreateRoom. +

+ +

2. Creating a room with a template

+

This example demonstrates creating a DocuSign Room using a predefined template. + If you've created a template + for your organization in either Rooms for Mortgage or Rooms for Real Estate, + you can create rooms based on this template using the Rooms API. +

+

API method used: + RoomTemplates::GetRoomTemplates, + Roles::GetRoles and + Rooms::CreateRoom. +

+ +

3. Exporting data from a room

+

This example demonstrates how to export rooms data from aDocuSign Room. +

+

API method used: + Rooms::GetRooms and + Rooms::GetRoomFieldSet. +

+ +

4. Adding forms to a room

+

This example demonstrates how to attach forms to a room using the Rooms API. +

+

API method used: + Rooms::GetRooms, + FormLibraries::GetFormLibraryForms and + Rooms::AddFormToRoom. +

+ +

5. Get Rooms with filters

+

This example demonstrates how to return rooms filtered by your parameters using the + Rooms API. + This specific code example filters for all rooms that have had their field data, updated within + the last 10 days, as shown on the Details tab in the UI. +

+

API method used: + Rooms::GetRooms. +

+ +

6. Creating an external form fill session

+

The DocuSign Rooms API offers developers the option to have users fill out forms without + logging in to the Rooms UI through the use of an external form fill session. + This example demonstrates how to create an external form fill session using the + Rooms API: + the result of this code example is the URL for the form fill session, which you can embed in + your integration or send to the user. +

+

API method used: + Rooms::GetRooms, + FormLibraries::GetFormLibraries and + ExternalFormFillSessions::CreateExternalFormFillSession, +

+
+ + + + + + From 366f6cf29dd57f1cd76a3bb777f22ea2bed899dd Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Wed, 4 Nov 2020 21:10:18 -0800 Subject: [PATCH 057/699] update comment steps typo --- .../rooms/examples/R002ControllerCreateRoomWithTemplate.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 27b3d806..62fb83ff 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -60,10 +60,10 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Construct the request body for your room + // Step 4: Construct the request body for your room RoomForCreate roomForCreate = this.createRoom(adminRole.getRoleId(), args.getRoomName(), args.getRoomTemplateId()); - // Step 4: Call the v2 Rooms API + // Step 5: Call the v2 Rooms API Room createdRoom = roomsApi.createRoom(this.session.getAccountId(), roomForCreate); From ff96e5f675cfcfc54f636e8eb1b598fefc8078e3 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 5 Nov 2020 13:45:24 -0800 Subject: [PATCH 058/699] Rename application.json to application.example.json --- src/main/resources/{application.json => application.example.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/{application.json => application.example.json} (100%) diff --git a/src/main/resources/application.json b/src/main/resources/application.example.json similarity index 100% rename from src/main/resources/application.json rename to src/main/resources/application.example.json From 34735bd7dbc7c5cc114c860a1fa3fc98f3219fec Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 5 Nov 2020 13:46:03 -0800 Subject: [PATCH 059/699] Rename application.json to application.example.json --- src/main/resources/{application.json => application.example.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/{application.json => application.example.json} (100%) diff --git a/src/main/resources/application.json b/src/main/resources/application.example.json similarity index 100% rename from src/main/resources/application.json rename to src/main/resources/application.example.json From 17dde41ac3e3a8dbeee11679a69cd1734b797898 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Thu, 5 Nov 2020 20:26:39 -0800 Subject: [PATCH 060/699] fixes compile problems and clean up old code --- .../EG001ControllerEmbeddedSigning.java | 3 +- .../examples/AbstractRoomsController.java | 40 +++- .../core/controller/IndexController.java | 1 + .../examples/AbstractRoomsController.java | 175 ------------------ 4 files changed, 40 insertions(+), 179 deletions(-) delete mode 100644 src/main/java/com/docusign/rooms/controller/examples/AbstractRoomsController.java diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 19f324e5..26bc8ad5 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -1,7 +1,8 @@ package com.docusign; -import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.AbstractEsignatureController; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index 041f718c..a1f375f5 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -1,17 +1,19 @@ package com.docusign.controller.rooms.examples; import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; import com.docusign.core.controller.AbstractController; import com.docusign.rooms.api.*; import com.docusign.rooms.client.ApiClient; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.client.auth.OAuth; import com.docusign.rooms.model.*; +import lombok.SneakyThrows; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; -import java.util.ArrayList; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** @@ -121,7 +123,7 @@ protected static RoleSummary getAdminRole(String basePath, String userAccessToke RoleSummaryList roleSummaryList = createRolesApiClient(basePath, userAccessToken).getRoles(accountId); return roleSummaryList.getRoles() .stream() - .filter(role-> role.isIsDefaultForAdmin()) + .filter(RoleSummary::isIsDefaultForAdmin) .findFirst() .get(); } @@ -138,4 +140,36 @@ protected static List getFormSummaryList(String basePath, String us } return forms; } + + protected List getDocumentsByRoomsId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { + RoomsApi roomsApiClient = createRoomsApiClient(basePath, accessToken); + + return roomsApiClient.getDocuments(accountId, roomId.getRoomId()).getDocuments(); + } + + protected RoomSummaryList getRoomSummaryList(String basePath, String accessToken, String accountId) throws ApiException { + RoomsApi roomsApi = createRoomsApiClient(basePath, accessToken); + + return roomsApi.getRooms(accountId); + } + + protected List getRoomSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { + RoomSummaryList summaryList = getRoomSummaryList(basePath, accessToken, accountId); + return summaryList.getRooms().stream() + .filter(var -> var.getRoomId().equals(roomId.getRoomId())) + .collect(Collectors.toList()); + } + + protected List getAvailableFormSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { + List formsByRoomsId = getDocumentsByRoomsId(basePath, accessToken, accountId, roomId); + List formSummaries = getFormSummaryList(basePath, accessToken, accountId); + + List formListByRoomId = formsByRoomsId.stream() + .map(var -> var.getName().replaceAll("\\.pdf", "")) + .collect(Collectors.toList()); + + return formSummaries.stream() + .filter(form -> !formListByRoomId.contains(form.getName())) + .collect(Collectors.toList()); + } } diff --git a/src/main/java/com/docusign/core/controller/IndexController.java b/src/main/java/com/docusign/core/controller/IndexController.java index aa2992e4..a1fef547 100644 --- a/src/main/java/com/docusign/core/controller/IndexController.java +++ b/src/main/java/com/docusign/core/controller/IndexController.java @@ -1,5 +1,6 @@ package com.docusign.core.controller; +import com.docusign.DSConfiguration; import com.docusign.core.model.AuthType; import com.docusign.core.model.Session; import com.docusign.core.security.OAuthProperties; diff --git a/src/main/java/com/docusign/rooms/controller/examples/AbstractRoomsController.java b/src/main/java/com/docusign/rooms/controller/examples/AbstractRoomsController.java deleted file mode 100644 index 9cd8fca4..00000000 --- a/src/main/java/com/docusign/rooms/controller/examples/AbstractRoomsController.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.docusign.rooms.controller.examples; - -import com.docusign.DSConfiguration; -import com.docusign.common.WorkArguments; -import com.docusign.core.controller.AbstractController; -import com.docusign.rooms.api.*; -import com.docusign.rooms.client.ApiClient; -import com.docusign.rooms.client.ApiException; -import com.docusign.rooms.client.auth.OAuth; -import com.docusign.rooms.model.*; -import lombok.SneakyThrows; -import org.springframework.http.HttpHeaders; -import org.springframework.stereotype.Controller; - -import java.util.*; -import java.util.stream.Collectors; - - -/** - * Abstract base class for all Rooms controllers. - */ -@Controller -public abstract class AbstractRoomsController extends AbstractController { - - private static final String EXAMPLE_PAGES_PATH = "pages/rooms/examples/"; - - public AbstractRoomsController(DSConfiguration config, String exampleName, String title) { - super(config, exampleName, title); - } - - protected String getExamplePagesPath() { - return AbstractRoomsController.EXAMPLE_PAGES_PATH; - } - - /** - * Creates new instance of the Rooms API client. - * @param basePath URL to eSignature REST API - * @param userAccessToken user's access token - * @return an instance of the {@link ApiClient} - */ - protected static ApiClient createApiClient(String basePath, String userAccessToken) { - ApiClient apiClient = new ApiClient(basePath); - apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken); - // it is a workaround to NPE, see DSPW-61 - // apiClient.addAuthorization("docusignAccessCode", null); - apiClient.addAuthorization("docusignAccessCode", new OAuth()); - return apiClient; - } - - /** - * Creates a new instance of the RoomsApi. This method - * creates an instance of the ApiClient class silently. - * @param basePath URL to Rooms REST API - * @param userAccessToken user's access token - * @return an instance of the {@link RoomsApi} - */ - protected static RoomsApi createRoomsApiClient(String basePath, String userAccessToken) { - ApiClient apiClient = createApiClient(basePath, userAccessToken); - return new RoomsApi(apiClient); - } - - /** - * Creates a new instance of the rooms RolesApi. This method - * creates an instance of the ApiClient class silently. - * @param basePath URL to Rooms REST API - * @param userAccessToken user's access token - * @return an instance of the {@link RolesApi} - */ - protected static RolesApi createRolesApiClient(String basePath, String userAccessToken) { - ApiClient apiClient = createApiClient(basePath, userAccessToken); - return new RolesApi(apiClient); - } - - /** - * Creates a new instance of the rooms OfficesApi. This method - * creates an instance of the ApiClient class silently. - * @param basePath URL to Rooms REST API - * @param userAccessToken user's access token - * @return an instance of the {@link OfficesApi} - */ - protected static OfficesApi createOfficeApiClient(String basePath, String userAccessToken) { - ApiClient apiClient = createApiClient(basePath, userAccessToken); - return new OfficesApi(apiClient); - } - - /** - * Creates a new instance of the rooms ExternalFormFillSessionsApi. This method - * creates an instance of the ApiClient class silently. - * @param basePath URL to Rooms REST API - * @param userAccessToken user's access token - * @return an instance of the {@link ExternalFormFillSessionsApi} - */ - protected static ExternalFormFillSessionsApi createExternalFormFillSessionsApiClient(String basePath, String userAccessToken) { - ApiClient apiClient = createApiClient(basePath, userAccessToken); - return new ExternalFormFillSessionsApi(apiClient); - } - - /** - * Creates a new instance of the rooms RoomTemplatesApi. This method - * creates an instance of the ApiClient class silently. - * @param basePath URL to Rooms REST API - * @param userAccessToken user's access token - * @return an instance of the {@link RoomTemplatesApi} - */ - protected static RoomTemplatesApi createRoomTemplatesApiClient(String basePath, String userAccessToken) { - ApiClient apiClient = createApiClient(basePath, userAccessToken); - return new RoomTemplatesApi(apiClient); - } - - /** - * Creates a new instance of the FormLibrariesApi. This method - * creates an instance of the ApiClient class silently. - * @param basePath URL to Rooms REST API - * @param userAccessToken user's access token - * @return an instance of the {@link RoomsApi} - */ - protected static FormLibrariesApi createFormLibrariesApi(String basePath, String userAccessToken) { - ApiClient apiClient = createApiClient(basePath, userAccessToken); - return new FormLibrariesApi(apiClient); - } - - protected static RoleSummary getAdminRole(String basePath, String userAccessToken, String accountId) throws ApiException { - RoleSummaryList roleSummaryList = createRolesApiClient(basePath, userAccessToken).getRoles(accountId); - return roleSummaryList.getRoles() - .stream() - .filter(RoleSummary::isIsDefaultForAdmin) - .findFirst() - .get(); - } - - protected static List getFormSummaryList(String basePath, String userAccessToken, String accountId) throws ApiException { - FormLibrariesApi formLibrariesApi = createFormLibrariesApi(basePath, userAccessToken); - FormLibrarySummaryList formLibrarySummaryList = formLibrariesApi.getFormLibraries(accountId); - - List forms = new ArrayList<>(); - - for (FormLibrarySummary formLibrarySummary : formLibrarySummaryList.getFormsLibrarySummaries()) { - FormSummaryList formSummaryList = formLibrariesApi.getFormLibraryForms(accountId, formLibrarySummary.getFormsLibraryId()); - forms.addAll(formSummaryList.getForms()); - } - return forms; - } - - protected List getDocumentsByRoomsId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { - RoomsApi roomsApiClient = createRoomsApiClient(basePath, accessToken); - - return roomsApiClient.getDocuments(accountId, roomId.getRoomId()).getDocuments(); - } - - protected RoomSummaryList getRoomSummaryList(String basePath, String accessToken, String accountId) throws ApiException { - RoomsApi roomsApi = createRoomsApiClient(basePath, accessToken); - - return roomsApi.getRooms(accountId); - } - - protected List getRoomSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { - RoomSummaryList summaryList = getRoomSummaryList(basePath, accessToken, accountId); - return summaryList.getRooms().stream() - .filter(var -> var.getRoomId().equals(roomId.getRoomId())) - .collect(Collectors.toList()); - } - - protected List getAvailableFormSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { - List formsByRoomsId = getDocumentsByRoomsId(basePath, accessToken, accountId, roomId); - List formSummaries = getFormSummaryList(basePath, accessToken, accountId); - - List formListByRoomId = formsByRoomsId.stream() - .map(var -> var.getName().replaceAll("\\.pdf", "")) - .collect(Collectors.toList()); - - return formSummaries.stream() - .filter(form -> !formListByRoomId.contains(form.getName())) - .collect(Collectors.toList()); - } -} From 8582dbfd46218100753ba60f867be21fd5d356d5 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Thu, 5 Nov 2020 20:31:12 -0800 Subject: [PATCH 061/699] update readme --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7be27bbb..28709ebf 100644 --- a/README.md +++ b/README.md @@ -113,22 +113,22 @@ This repo is a Java Spring Boot application that demonstrates: 1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001CreateRoomWithData.js) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001CreateRoomWithData.java) This example creates a new room in your DocuSign Rooms account to be used for a transaction. 1. **Create a room from a template.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002CreateRoomFromTemplate.js) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002CreateRoomFromTemplate.java) This example creates a new room using a template. 1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ExportDataFromRoom.js) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ExportDataFromRoom.java) This example exports all the avialalble data from a specific room in your DocuSign Rooms account. 1. **Add forms to a room.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004AddingFormToRoom.js) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004AddingFormToRoom.java) This example adds a standard real estate related form to a specific room in your DocuSign Rooms account. 1. **How to search for rooms with filters.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005GetRoomsWithFilters.js) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005GetRoomsWithFilters.java) This example searches for rooms in your DocuSign Rooms account using a specific filter. 1. **Create an external form fillable session.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006CreateExternalFormFillSession.js) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006CreateExternalFormFillSession.java) This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. @@ -262,7 +262,7 @@ browser to http://localhost:8080 * For the Root directory, Browse for and select this same repo `code-examples-java`. * Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. * Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration with the following: - * Name the configuration `code-examples-java`. + * Name the configuration `code-examples-java` (If You have downloaded the launcher via Quickstart, skip this step). * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. * Put in the following value for the Goals field: `spring-boot::run`. * Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. From 288248df4b41b1e3a9b4479bce4e87582d3d2085 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Thu, 5 Nov 2020 20:37:56 -0800 Subject: [PATCH 062/699] renames in file links --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 28709ebf..d15b07b1 100644 --- a/README.md +++ b/README.md @@ -113,22 +113,22 @@ This repo is a Java Spring Boot application that demonstrates: 1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001CreateRoomWithData.java) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) This example creates a new room in your DocuSign Rooms account to be used for a transaction. 1. **Create a room from a template.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002CreateRoomFromTemplate.java) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) This example creates a new room using a template. 1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ExportDataFromRoom.java) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportDataFromRoom.java) This example exports all the avialalble data from a specific room in your DocuSign Rooms account. 1. **Add forms to a room.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004AddingFormToRoom.java) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) This example adds a standard real estate related form to a specific room in your DocuSign Rooms account. 1. **How to search for rooms with filters.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005GetRoomsWithFilters.java) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) This example searches for rooms in your DocuSign Rooms account using a specific filter. 1. **Create an external form fillable session.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006CreateExternalFormFillSession.java) + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. From 3cf812b88600e8cccccaf8c6984a68647f35cf6a Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 9 Nov 2020 19:29:10 -0800 Subject: [PATCH 063/699] Update R004ControllerAddingFormsToRoom.java --- .../rooms/examples/R004ControllerAddingFormsToRoom.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 1ee40324..a539f5e7 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -58,13 +58,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - // Step 2: Construct your API headers + // Step 2. Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Construct the request body for adding a form + // Step 3. Construct the request body for adding a form FormForAdd formForAdd = new FormForAdd().formId(args.getFormId()); - // Step 3: Call the v2 Rooms API + // Step 4. Call the v2 Rooms API RoomDocument roomDocument = roomsApi.addFormToRoom(this.session.getAccountId(), args.getRoomId(), formForAdd); DoneExample.createDefault(this.title) From 7f6cd66ce9b276f4362062f77f847b993fe74a4d Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 9 Nov 2020 21:38:33 -0800 Subject: [PATCH 064/699] Update R004ControllerAddingFormsToRoom.java --- .../rooms/examples/R004ControllerAddingFormsToRoom.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index a539f5e7..32dd30fe 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -45,8 +45,9 @@ public R004ControllerAddingFormsToRoom(DSConfiguration config, Session session, protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); + // Step 3. Obtain the desired form ID + RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); @@ -60,11 +61,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { // Step 2. Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - - // Step 3. Construct the request body for adding a form - FormForAdd formForAdd = new FormForAdd().formId(args.getFormId()); - + // Step 4. Call the v2 Rooms API + FormForAdd formForAdd = new FormForAdd().formId(args.getFormId()); RoomDocument roomDocument = roomsApi.addFormToRoom(this.session.getAccountId(), args.getRoomId(), formForAdd); DoneExample.createDefault(this.title) From d0a1c3e67cdf7977279b0f99b300b23b680ebb28 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Tue, 10 Nov 2020 00:40:51 -0800 Subject: [PATCH 065/699] Update R005ControllerGetRoomsWithFilters.java --- .../rooms/examples/R005ControllerGetRoomsWithFilters.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index 2bd1a6b1..7a5b57fd 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -51,7 +51,6 @@ public R005ControllerGetRoomsWithFilters(DSConfiguration config, Session session protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - // Step 3. Set your filtering parameters LocalDateTime current = LocalDateTime.now().plusDays(FROM_DATE_FORWARD_DAYS); LocalDateTime past = LocalDateTime.now().minusDays(FROM_DATE_OFFSET_DAYS); @@ -66,11 +65,12 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + // Step 3. Prepare your request parameters RoomsApi.GetRoomsOptions options = roomsApi.new GetRoomsOptions(); options.setFieldDataChangedStartDate(args.getStartDate()); options.setFieldDataChangedEndDate(args.getEndDate()); - // Step 3: Call the v2 Rooms API + // Step 4. Call the v2 Rooms API RoomSummaryList rooms = roomsApi.getRooms(this.session.getAccountId(), options); DoneExample.createDefault(this.title) From d4d11f2ef8650e5feffe22b82f0c7cc25c42b760 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Tue, 10 Nov 2020 00:55:15 -0800 Subject: [PATCH 066/699] Update R006ControllerCreatExternalFormFillSession.java --- .../examples/R006ControllerCreatExternalFormFillSession.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreatExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreatExternalFormFillSession.java index a4b043eb..93105534 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreatExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreatExternalFormFillSession.java @@ -60,7 +60,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - // Step 2: Construct your API headers + // Step 2. Construct your API headers ExternalFormFillSessionsApi externalFormFillSessionsApi = createExternalFormFillSessionsApiClient( this.session.getBasePath(), this.user.getAccessToken() ); @@ -70,7 +70,7 @@ protected Object doWork(WorkArguments args, ModelMap model, .formId(args.getFormId().toString()) .roomId(args.getRoomId()); - // Step 4: Call the v2 Rooms API + // Step 4. Call the v2 Rooms API ExternalFormFillSession externalFormFillSession = externalFormFillSessionsApi.createExternalFormFillSession( this.session.getAccountId(), externalFormFillSessionForCreate ); From 465de49331d8d140499d27091496041262eb9454 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Wed, 11 Nov 2020 21:56:05 -0800 Subject: [PATCH 067/699] Split room scopes (#9) * set rooms scope conditionally based on api name * Resolved PR comments --- README.md | 3 ++- src/main/java/com/docusign/App.java | 10 ++++++++- .../java/com/docusign/DSConfiguration.java | 15 ++++++------- .../java/com/docusign/WebSecurityConfig.java | 21 ++++++++++++++++++- .../controller/GlobalControllerAdvice.java | 4 ++-- .../java/com/docusign/core/model/Session.java | 1 + src/main/resources/application.example.json | 9 ++++---- 7 files changed, 45 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d15b07b1..00c2b040 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Java Launcher Code Examples -This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. To use the Rooms API code example, modify the **exampleAPI** settings at the end of the appsettings.json file from eSignature to rooms. +This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. To use the Rooms API code examples, change the **DS_API_NAME** value to `ROOMS` in the application.json config file. **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). @@ -265,6 +265,7 @@ browser to http://localhost:8080 * Name the configuration `code-examples-java` (If You have downloaded the launcher via Quickstart, skip this step). * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. * Put in the following value for the Goals field: `spring-boot::run`. + * Click the JRE tab and add in the paste in the following VM argument: `-Dfork=false` (This will allow Eclipse to gracefully terminate the Tomcat Webserver when also terminating the output console in Eclipse). * Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. * Click apply to save. Finally, click `Run` to run it! * Open a browser to http://localhost:8080 diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index e93a1420..f9ec5082 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -1,5 +1,7 @@ package com.docusign; +import java.io.IOException; + import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; @@ -8,7 +10,13 @@ @SpringBootApplication(exclude={JmxAutoConfiguration.class}) public class App { - public static void main(String[] args) { + public static void main(String[] args) throws IOException { SpringApplication.run(App.class, args); + openHomePage(); + } + + private static void openHomePage() throws IOException { + Runtime rt = Runtime.getRuntime(); + rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); } } diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index 736c1e92..d7bf3a70 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -24,8 +24,11 @@ public class DSConfiguration { @Value("${DS_API_NAME}") private String apiName; - @Value("${DS_API_BASE_URL}") - private String apiBaseUrl; + @Value("${DS_BASE_PATH}") + private String basePath; + + @Value("${DS_ROOMS_BASE_PATH}") + private String roomsBasePath; @Value("${DS_SIGNER_EMAIL:{USER_EMAIL}}") private String signerEmail; @@ -54,11 +57,5 @@ public String getDsReturnUrl() { public String getDsPingUrl() { return appUrl + "/"; } - public String getApiName(){ - if(apiName.contains("{")){ - apiName = "ESIGNATURE"; - apiBaseUrl = "https://demo.docusign.net"; - } - return apiName; - } + } diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index ac0f23da..542faa83 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -1,5 +1,4 @@ package com.docusign; - import com.docusign.core.security.OAuthProperties; import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; @@ -35,7 +34,13 @@ @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + public String roomScopes[] = new String[] {"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}; + @Autowired + private DSConfiguration dsConfiguration; + + + @Autowired private OAuth2ClientContext oAuth2ClientContext; @Bean @@ -53,6 +58,7 @@ public OAuthProperties jwtGrantSso() { @Bean @ConfigurationProperties("authorization.code.grant.client") public AuthorizationCodeResourceDetails authCodeGrantClient() { + return new AuthorizationCodeResourceDetails(); } @@ -79,6 +85,13 @@ public FilterRegistrationBean oAuth2ClientFilterRegis private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { OAuth2SsoProperties authCodeGrantSso = authCodeGrantSso(); AuthorizationCodeResourceDetails authCodeGrantClient = authCodeGrantClient(); + + + if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { + authCodeGrantClient.setScope(Arrays.asList(roomScopes)); + } + + ResourceServerProperties userInfoResource = userInfoResource(); OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(authCodeGrantSso.getLoginPath()); @@ -93,6 +106,12 @@ private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { private OAuth2ClientAuthenticationProcessingFilter jwtGrantFilter() { OAuth2SsoProperties authCodeGrantSso = jwtGrantSso(); JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = jwtCodeGrantClient(); + + if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { + jwtCodeGrantClient.setScope(Arrays.asList(roomScopes)); + + } + OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(authCodeGrantSso.getLoginPath()); OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index f5d3adae..93d89342 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -112,8 +112,8 @@ public Locals populateLocals() { OAuth.Account oauthAccount = account.orElseThrow(() -> new NoSuchElementException(ERROR_ACCOUNT_NOT_FOUND)); session.setAccountId(oauthAccount.getAccountId()); session.setAccountName(oauthAccount.getAccountName()); - - String baseUrl = !config.getApiBaseUrl().isEmpty() ? config.getApiBaseUrl() : oauthAccount.getBaseUri(); + //TODO set this more efficiently with more APIs as they're added in + String baseUrl = config.getApiName().equalsIgnoreCase("rooms") ? config.getRoomsBasePath() : oauthAccount.getBaseUri(); session.setBasePath(baseUrl + BASE_URI_SUFFIX); } diff --git a/src/main/java/com/docusign/core/model/Session.java b/src/main/java/com/docusign/core/model/Session.java index 2e4160dd..7b54e6dc 100644 --- a/src/main/java/com/docusign/core/model/Session.java +++ b/src/main/java/com/docusign/core/model/Session.java @@ -21,6 +21,7 @@ public class Session implements Serializable { private String accountId; private String accountName; private String basePath; + private String roomsBasePath; private String envelopeId; private String templateName; private List envelopeDocuments; diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index d2d2f313..4249c543 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -3,10 +3,11 @@ "DS_SIGNER_NAME": "{SIGNER_NAME}", "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", - "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_GUID}", + "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", "DS_API_NAME": "{API_NAME:(ESIGNATURE|ROOMS)}", - "DS_API_BASE_URL": "{API_BASE_URL:(https://demo.docusign.net|https://demo.rooms.docusign.com)}", - + "DS_API_BASE_PATH": "https://demo.docusign.net", + "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", + "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", "Gateway_Display_Name": "{DS_PAYMENT_GATEWAY_DISPLAY_NAME}", @@ -21,7 +22,7 @@ "jwt.grant.sso.redirect-url": "&type=jwt", "jwt.grant.client.scope": "signature impersonation", "jwt.grant.client.base-url": "account-d.docusign.com", - "jwt.grant.client.client-id": "{JWT_API_ACCOUNT_ID}", + "jwt.grant.client.client-id": "{INTEGRATION_KEY_JWT}", "jwt.grant.client.private-key-path": "src/main/resources/private.key", "jwt.grant.client.impersonated-user-guid": "{IMPERSONATED_USER_ID}", From 40f7520c67d2e4d390a8d7c3d79ece4d30d76e7e Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Thu, 12 Nov 2020 03:39:53 -0800 Subject: [PATCH 068/699] var name typo --- src/main/resources/application.example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index 4249c543..c7400f73 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -5,7 +5,7 @@ "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", "DS_API_NAME": "{API_NAME:(ESIGNATURE|ROOMS)}", - "DS_API_BASE_PATH": "https://demo.docusign.net", + "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", From 3e6a4eb3b9ef498b9fdeaab328dad8a9396e9232 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Thu, 12 Nov 2020 03:46:48 -0800 Subject: [PATCH 069/699] setting -Dfork=false did not kill process as expected --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 00c2b040..dd52d467 100644 --- a/README.md +++ b/README.md @@ -265,7 +265,6 @@ browser to http://localhost:8080 * Name the configuration `code-examples-java` (If You have downloaded the launcher via Quickstart, skip this step). * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. * Put in the following value for the Goals field: `spring-boot::run`. - * Click the JRE tab and add in the paste in the following VM argument: `-Dfork=false` (This will allow Eclipse to gracefully terminate the Tomcat Webserver when also terminating the output console in Eclipse). * Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. * Click apply to save. Finally, click `Run` to run it! * Open a browser to http://localhost:8080 From 19b57228b8affd7e7622a7d73f8590ec7ba8f103 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 16 Nov 2020 11:04:12 -0800 Subject: [PATCH 070/699] Update application.example.json --- src/main/resources/application.example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index c7400f73..0ec81dee 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -4,7 +4,7 @@ "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", - "DS_API_NAME": "{API_NAME:(ESIGNATURE|ROOMS)}", + "DS_API_NAME": "ESIGNATURE", "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", From cebf69cb176a0e011163304fbe63a7effb48b346 Mon Sep 17 00:00:00 2001 From: Yaryna Kimak <64064514+yarynakimak@users.noreply.github.com> Date: Thu, 19 Nov 2020 04:57:45 +0200 Subject: [PATCH 071/699] Added ARR examples (#10) Co-authored-by: Kharko, Yaryna --- .../com/docusign/common/WorkArguments.java | 4 + ...EG032ControllerPauseSignatureWorkflow.java | 121 ++++++++++ ...033ControllerUnpauseSignatureWorkflow.java | 71 ++++++ ...034ControllerUseConditionalRecipients.java | 217 ++++++++++++++++++ .../eSignature/examples/EnvelopeHelpers.java | 3 + src/main/resources/Welcome.txt | 11 + src/main/resources/Welcome1.txt | 3 + .../views/pages/esignature/examples/eg032.jsp | 58 +++++ .../views/pages/esignature/examples/eg033.jsp | 32 +++ .../views/pages/esignature/examples/eg034.jsp | 68 ++++++ .../views/pages/esignature/index.jsp | 41 ++++ 11 files changed, 629 insertions(+) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java create mode 100644 src/main/resources/Welcome.txt create mode 100644 src/main/resources/Welcome1.txt create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index d2928583..faf44e5d 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -28,6 +28,10 @@ public class WorkArguments { private String dsReturnUrl; private String dsPingUrl; private String signerClientId; + private String signerCheckedEmail; + private String signerCheckedName; + private String signerNotCheckedEmail; + private String signerNotCheckedName; private String docSelect; private String accessCode; private String brandName; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java new file mode 100644 index 00000000..4d95c37e --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -0,0 +1,121 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +/** + * This topic demonstrates how to create an envelope where the workflow + * is paused before the envelope is sent to a second recipient. + */ +@Controller +@RequestMapping("/eg032") +public class EG032ControllerPauseSignatureWorkflow extends AbstractEsignatureController { + + private static final String DOCUMENT_FILE_NAME = "Welcome.txt"; + private static final String DOCUMENT_ID = "1"; + private static final String DOCUMENT_NAME = "Welcome"; + + private final Session session; + private final User user; + + + @Autowired + public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session session, User user) { + super(config, "eg032", "Pause a signature workflow."); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + + // Step 1: Construct your API headers + EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 2: Construct your envelope JSON body + EnvelopeDefinition envelope = createEnvelope(args); + + // Step 3: Call the eSignature REST API + EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); + + this.session.setEnvelopeId(results.getEnvelopeId()); + DoneExample.createDefault(this.title) + .withJsonObject(results) + .withMessage( + "The envelope where the workflow is paused before the envelope is sent to a second recipient " + + "has been created and sent!
Envelope ID " + + this.session.getEnvelopeId() + ".") + .addToModel(model); + + return DONE_EXAMPLE_PAGE; + } + + private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); + workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); + workflowStep.setItemId("2"); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); + + SignHere signHere1 = new SignHere(); + signHere1.setName("SignHereTabs"); + signHere1.setXPosition("200"); + signHere1.setYPosition("200"); + signHere1.setTabLabel("Sign Here"); + signHere1.setPageNumber("1"); + signHere1.setDocumentId(document.getDocumentId()); + + Signer signer1 = new Signer(); + signer1.setName(args.getSignerName()); + signer1.setEmail(args.getSignerEmail()); + signer1.setRoutingOrder("1"); + signer1.setRecipientId("1"); + signer1.setTabs(EnvelopeHelpers.createSignerTabs(signHere1)); + + SignHere signHere2 = new SignHere(); + signHere2.setName("SignHereTabs"); + signHere2.setXPosition("300"); + signHere2.setYPosition("200"); + signHere2.setTabLabel("Sign Here"); + signHere2.setPageNumber("1"); + signHere2.setDocumentId(document.getDocumentId()); + + Signer signer2 = new Signer(); + signer2.setName(args.getSignerName2()); + signer2.setEmail(args.getSignerEmail2()); + signer2.setRoutingOrder("2"); + signer2.setRecipientId("2"); + signer2.setTabs(EnvelopeHelpers.createSignerTabs(signHere2)); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer1, signer2)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("EnvelopeWorkflowTest"); + envelope.setDocuments(Collections.singletonList(document)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + envelope.setWorkflow(workflow); + + return envelope; + } +} \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java new file mode 100644 index 00000000..a4cd0b3d --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -0,0 +1,71 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Envelope; +import com.docusign.esign.model.EnvelopeUpdateSummary; +import com.docusign.esign.model.Workflow; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; + + +/** + * This topic demonstrates how to resume an envelope workflow that has been paused. + */ +@Controller +@RequestMapping("/eg033") +public class EG033ControllerUnpauseSignatureWorkflow extends AbstractEsignatureController { + + private final Session session; + private final User user; + + + @Autowired + public EG033ControllerUnpauseSignatureWorkflow(DSConfiguration config, Session session, User user) { + super(config, "eg033", "Unpause a signature workflow"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { + + // Step 1: Construct your API headers + EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + + // Step 2: Construct your envelope JSON body + Workflow workflow = new Workflow(); + workflow.setWorkflowStatus(EnvelopeHelpers.WORKFLOW_STATUS_IN_PROGRESS); + + Envelope envelope = new Envelope(); + envelope.setWorkflow(workflow); + + EnvelopesApi.UpdateOptions updateOptions = envelopesApi. new UpdateOptions(); + updateOptions.setResendEnvelope("true"); + + // Step 3: Call the eSignature REST API + EnvelopeUpdateSummary results = envelopesApi.update( + this.session.getAccountId(), + this.session.getEnvelopeId(), + envelope, + updateOptions + ); + + DoneExample.createDefault(this.title) + .withJsonObject(results) + .withMessage("A paused envelope was resumed.") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java new file mode 100644 index 00000000..dc1664d2 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -0,0 +1,217 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * This topic demonstrates how to create an envelope where the workflow + * is paused before the envelope is sent to a second recipient. + */ +@Controller +@RequestMapping("/eg034") +public class EG034ControllerUseConditionalRecipients extends AbstractEsignatureController { + + private static final String DOCUMENT_FILE_NAME = "Welcome1.txt"; + private static final String DOCUMENT_ID = "1"; + private static final String DOCUMENT_NAME = "Welcome"; + + private final Session session; + private final User user; + + + @Autowired + public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session session, User user) { + super(config, "eg034", "Use conditional recipients."); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + + // Step 1: Construct your API headers + EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 2: Construct your envelope JSON body + EnvelopeDefinition envelope = createEnvelope(args); + + // Step 3: Call the eSignature REST API + EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); + + this.session.setEnvelopeId(results.getEnvelopeId()); + DoneExample.createDefault(this.title) + .withJsonObject(results) + .withMessage( + "An envelope where the workflow is routed to different recipients based on the value of a transaction " + + "has been created and sent!
Envelope ID " + + this.session.getEnvelopeId() + ".") + .addToModel(model); + + return DONE_EXAMPLE_PAGE; + } + + private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); + workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); + workflowStep.setItemId("2"); + workflowStep.setStatus("pending"); + workflowStep.setRecipientRouting(createRecipientRouting(args)); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList( + createApprovalSigner(document.getDocumentId()), + createPurchaserSigner(args, document.getDocumentId()) + )); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("ApproveIfChecked"); + envelope.setDocuments(Collections.singletonList(document)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + envelope.setWorkflow(workflow); + + return envelope; + } + + private static Signer createPurchaserSigner(WorkArguments args, String documentId) { + SignHere signHere = new SignHere(); + signHere.setName("SignHereTabs"); + signHere.setXPosition("200"); + signHere.setYPosition("200"); + signHere.setTabLabel("PurchaserSignature"); + signHere.setPageNumber("1"); + signHere.setDocumentId(documentId); + + Checkbox checkbox = new Checkbox(); + checkbox.setName("ClickToApprove"); + checkbox.setSelected("false"); + checkbox.setXPosition("50"); + checkbox.setYPosition("50"); + checkbox.setTabLabel("ApproveWhenChecked"); + checkbox.setPageNumber("1"); + checkbox.setDocumentId(documentId); + + Tabs tabs = EnvelopeHelpers.createSignerTabs(signHere); + tabs.setCheckboxTabs(Collections.singletonList(checkbox)); + + Signer signer = new Signer(); + signer.setName(args.getSignerName()); + signer.setEmail(args.getSignerEmail()); + signer.setRoutingOrder("1"); + signer.setRecipientId("1"); + signer.setRoleName("Purchaser"); + signer.setTabs(tabs); + + return signer; + } + + private static Signer createApprovalSigner(String documentId) { + SignHere signHere = new SignHere(); + signHere.setName("SignHere"); + signHere.setRecipientId("2"); + signHere.setXPosition("200"); + signHere.setYPosition("300"); + signHere.setTabLabel("ApproverSignature"); + signHere.setPageNumber("1"); + signHere.setDocumentId(documentId); + + Signer signer = new Signer(); + signer.setName("Approver"); + signer.setEmail("placeholder@example.com"); + signer.setRoutingOrder("2"); + signer.setRecipientId("2"); + signer.setRoleName("Approver"); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + return signer; + } + + private static List createConditionalRecipientRuleConditions() { + + ConditionalRecipientRuleFilter filter1 = new ConditionalRecipientRuleFilter(); + filter1.setRecipientId("1"); + filter1.setScope("tabs"); + filter1.setTabId("ApprovalTab"); + filter1.setOperator("equals"); + filter1.setValue("false"); + filter1.setTabLabel("ApproveWhenChecked"); + + ConditionalRecipientRuleFilter filter2 = new ConditionalRecipientRuleFilter(); + filter2.setRecipientId("1"); + filter2.setScope("tabs"); + filter2.setTabId("ApprovalTab"); + filter2.setOperator("equals"); + filter2.setValue("true"); + filter2.setTabLabel("ApproveWhenChecked"); + + ConditionalRecipientRuleCondition condition1 = new ConditionalRecipientRuleCondition(); + condition1.setRecipientLabel("signer2a"); + condition1.setOrder("1"); + condition1.setFilters(Collections.singletonList(filter1)); + + ConditionalRecipientRuleCondition condition2 = new ConditionalRecipientRuleCondition(); + condition2.setRecipientLabel("signer2b"); + condition2.setOrder("2"); + condition2.setFilters(Collections.singletonList(filter2)); + return Arrays.asList(condition1, condition2); + } + + private static RecipientGroup createRecipientGroup(WorkArguments args) { + RecipientOption recipientOption1 = new RecipientOption(); + recipientOption1.setRecipientLabel("signer2a"); + recipientOption1.setName(args.getSignerNotCheckedName()); + recipientOption1.setRoleName("Signer when not checked"); + recipientOption1.setEmail(args.getSignerNotCheckedEmail()); + + RecipientOption recipientOption2 = new RecipientOption(); + recipientOption2.setRecipientLabel("signer2b"); + recipientOption2.setName(args.getSignerCheckedName()); + recipientOption2.setRoleName("Signer when checked"); + recipientOption2.setEmail(args.getSignerCheckedEmail()); + + RecipientGroup recipientGroup = new RecipientGroup(); + recipientGroup.setGroupName("Approver"); + recipientGroup.setGroupMessage("Members of this group approve a workflow"); + recipientGroup.setRecipients(Arrays.asList(recipientOption1, recipientOption2)); + return recipientGroup; + } + + private static ConditionalRecipientRule createConditionalRecipientRule(WorkArguments args) { + ConditionalRecipientRule conditionalRecipientRule = new ConditionalRecipientRule(); + conditionalRecipientRule.setRecipientId("2"); + conditionalRecipientRule.setOrder("0"); + conditionalRecipientRule.setRecipientGroup(createRecipientGroup(args)); + conditionalRecipientRule.setConditions(createConditionalRecipientRuleConditions()); + return conditionalRecipientRule; + } + + private static RecipientRouting createRecipientRouting(WorkArguments args) { + RecipientRules recipientRules = new RecipientRules(); + recipientRules.setConditionalRecipients(Collections.singletonList(createConditionalRecipientRule(args))); + + RecipientRouting recipientRouting = new RecipientRouting(); + recipientRouting.setRules(recipientRules); + return recipientRouting; + } +} \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java index acace7e7..1e25c3f8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java @@ -36,6 +36,9 @@ public final class EnvelopeHelpers { public static final String DELIVERY_METHOD_EMAIL = "Email"; public static final String SIGNER_ROLE_NAME = "signer"; public static final String CC_ROLE_NAME = "cc"; + public static final String WORKFLOW_STEP_ACTION_PAUSE = "pause_before"; + public static final String WORKFLOW_TRIGGER_ROUTING_ORDER = "routing_order"; + public static final String WORKFLOW_STATUS_IN_PROGRESS = "in_progress"; private EnvelopeHelpers() {} diff --git a/src/main/resources/Welcome.txt b/src/main/resources/Welcome.txt new file mode 100644 index 00000000..797f3bda --- /dev/null +++ b/src/main/resources/Welcome.txt @@ -0,0 +1,11 @@ + + + + + Welcome to the DocuSign Recruiting Event + + + Please Sign in! + + + \ No newline at end of file diff --git a/src/main/resources/Welcome1.txt b/src/main/resources/Welcome1.txt new file mode 100644 index 00000000..642eb799 --- /dev/null +++ b/src/main/resources/Welcome1.txt @@ -0,0 +1,3 @@ +Thanks for reviewing this! + +We'll move forward as soon as we hear back. \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp new file mode 100644 index 00000000..ce7c089a --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp @@ -0,0 +1,58 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

32. ${title}.

+ +

+ This topic demonstrates how to create an envelope where the workflow is paused before the + envelope is sent to a second recipient. For information on resuming a workflow see + + How to unpause a signature workflow + . The envelope includes a txt document. +

+ + +

Documentation about this example.

+
+ +

API methods used: + Envelopes::create. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ + +
+
+ + + We'll never share your email with anyone else. +
+
+ + +
+ +
+ + + We'll never share your email with anyone else. +
+
+ + +
+ + + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp new file mode 100644 index 00000000..c8f26460 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp @@ -0,0 +1,32 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

33. ${title}.

+ +

+ This topic demonstrates how to resume an envelope workflow that has been paused. + For information on creating an envelope with a paused workflow, see + + How to pause a signature workflow + . The envelope includes a txt document. +

+ + +

Documentation about this example.

+
+ +

API methods used: + Envelopes::update. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp new file mode 100644 index 00000000..4b2b8dae --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp @@ -0,0 +1,68 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

34. ${title}.

+ +

+ This topic demonstrates how to create an envelope where the workflow is routed to + different recipients based on the value of a transaction. The envelope includes a txt document. +

+ + +

Documentation about this example.

+
+ +

API methods used: + Envelopes::create. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ + +
+
+ + + We'll never share your email with anyone else. +
+
+ + +
+ +
+ + + We'll never share your email with anyone else. +
+
+ + +
+ +
+ + + We'll never share your email with anyone else. +
+
+ + +
+ + + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index a68bf1e9..e954f45c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -294,6 +294,47 @@ EnvelopeRecipients::create.

+

Advanced recipient routing

+ +

32. Pause a signature workflow

+ +

+ This topic demonstrates how to create an envelope where the workflow is paused before the + envelope is sent to a second recipient. For information on resuming a workflow see + + How to unpause a signature workflow + . +

+

+ API methods used: + Envelopes::create. +

+ +

33. Unpause a signature workflow

+ +

+ This topic demonstrates how to resume an envelope workflow that has been paused. + For information on creating an envelope with a paused workflow, see + + How to pause a signature workflow + . +

+

+ API methods used: + Envelopes::update. +

+ +

34. Use conditional recipients

+ +

+ This topic demonstrates how to create an envelope where the workflow is routed to + different recipients based on the value of a transaction. +

+

+ API methods used: + Envelopes::create. +

+
From 3bf85c6a260ab6ab895039ecf5e5cc9951506492 Mon Sep 17 00:00:00 2001 From: "Kharko, Yaryna" Date: Thu, 19 Nov 2020 12:05:19 +0200 Subject: [PATCH 072/699] Install sdk, update launcher --- pom.xml | 7 +++ .../java/com/docusign/DSConfiguration.java | 3 + .../java/com/docusign/common/ApiIndex.java | 3 +- .../examples/AbstractClickController.java | 55 +++++++++++++++++++ .../controller/GlobalControllerAdvice.java | 12 +++- src/main/resources/application.example.json | 5 +- .../templates/views/pages/click/index.jsp | 45 +++++++++++++++ 7 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/docusign/controller/click/examples/AbstractClickController.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp diff --git a/pom.xml b/pom.xml index f2270fad..f3081506 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ 2.6 3.8.0 1.0.0 + 1.0.0-alpha @@ -91,6 +92,12 @@ docusign-rooms-java ${rooms.version} + + + com.docusign + docusign-click-java + ${click.version} + diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index d7bf3a70..0579cadf 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -30,6 +30,9 @@ public class DSConfiguration { @Value("${DS_ROOMS_BASE_PATH}") private String roomsBasePath; + @Value("${DS_CLICK_BASE_PATH}") + private String clickBasePath; + @Value("${DS_SIGNER_EMAIL:{USER_EMAIL}}") private String signerEmail; diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index 1b27d1eb..90840edf 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -2,7 +2,8 @@ public enum ApiIndex { ESIGNATURE("/pages/esignature/index"), - ROOMS("/pages/rooms/index"); + ROOMS("/pages/rooms/index"), + CLICK("/pages/click/index"); private final String indexPath; diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java new file mode 100644 index 00000000..b8bd0d87 --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -0,0 +1,55 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiClient; +import com.docusign.click.client.auth.OAuth; +import com.docusign.core.controller.AbstractController; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Controller; + + +/** + * Abstract base class for all Click controllers. + */ +@Controller +public abstract class AbstractClickController extends AbstractController { + + private static final String EXAMPLE_PAGES_PATH = "pages/click/examples/"; + + public AbstractClickController(DSConfiguration config, String exampleName, String title) { + super(config, exampleName, title); + } + + protected String getExamplePagesPath() { + return AbstractClickController.EXAMPLE_PAGES_PATH; + } + + /** + * Creates new instance of the Click API client. + * @param basePath URL to eSignature REST API + * @param userAccessToken user's access token + * @return an instance of the {@link ApiClient} + */ + protected static ApiClient createApiClient(String basePath, String userAccessToken) { + ApiClient apiClient = new ApiClient(basePath); + apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken); + // it is a workaround to NPE, see DSPW-61 + // apiClient.addAuthorization("docusignAccessCode", null); + apiClient.addAuthorization("docusignAccessCode", new OAuth()); + return apiClient; + } + + /** + * Creates a new instance of the RoomsApi. This method + * creates an instance of the ApiClient class silently. + * @param basePath URL to Rooms REST API + * @param userAccessToken user's access token + * @return an instance of the {@link AccountsApi} + */ + protected static AccountsApi createAccountsApiClient(String basePath, String userAccessToken) { + ApiClient apiClient = createApiClient(basePath, userAccessToken); + return new AccountsApi(apiClient); + } +} + diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 93d89342..ab49b01f 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -113,13 +113,23 @@ public Locals populateLocals() { session.setAccountId(oauthAccount.getAccountId()); session.setAccountName(oauthAccount.getAccountName()); //TODO set this more efficiently with more APIs as they're added in - String baseUrl = config.getApiName().equalsIgnoreCase("rooms") ? config.getRoomsBasePath() : oauthAccount.getBaseUri(); + String baseUrl = this.getBaseUrl(apiIndex, oauthAccount); session.setBasePath(baseUrl + BASE_URI_SUFFIX); } return new Locals(config, session, user, ""); } + private String getBaseUrl(ApiIndex apiIndex, OAuth.Account oauthAccount) { + if (apiIndex.equals(ApiIndex.ROOMS)) { + return this.config.getRoomsBasePath(); + } else if (apiIndex.equals(ApiIndex.CLICK)) { + return this.config.getClickBasePath(); + } else { + return oauthAccount.getBaseUri(); + } + } + @SuppressWarnings("unchecked") private static List getOAuthAccounts(OAuth2Authentication oauth) { Map userAuthenticationDetails = (Map) oauth.getUserAuthentication().getDetails(); diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index c7400f73..cc9c09f5 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -4,10 +4,11 @@ "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", - "DS_API_NAME": "{API_NAME:(ESIGNATURE|ROOMS)}", + "DS_API_NAME": "{API_NAME:(ESIGNATURE|ROOMS|CLICK)}", "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", - + "DS_CLICK_BASE_PATH": "https://demo.rooms.docusign.com", + "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", "Gateway_Display_Name": "{DS_PAYMENT_GATEWAY_DISPLAY_NAME}", diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp new file mode 100644 index 00000000..4599adea --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -0,0 +1,45 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + +
+
+ + + + + + +
+

Java Launcher

+

Welcome to the DocuSign Java examples using multiple OAuth flows (JWT and Authorization Code Grant).

+
+ +
+
+ + +
+

Welcome

+

This launcher both demonstrates use of common OAuth2 grant flows and multiple usage examples from the DocuSign Rooms REST API.

+ +

Documentation on using OAuth Authorization Code Grant from a Java application.

+
+ +

Click Examples

+ +

1. Create a clickwrap

+

This example demonstrates creating a DocuSign room. +

+

API methods used: + Roles::GetRoles and + Rooms::CreateRoom. +

+
+ + + + + + From 0b0d5c716673be2322d76f00a4beec48611ae56d Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 16 Nov 2020 11:04:12 -0800 Subject: [PATCH 073/699] Update application.example.json --- src/main/resources/application.example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index c7400f73..0ec81dee 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -4,7 +4,7 @@ "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", - "DS_API_NAME": "{API_NAME:(ESIGNATURE|ROOMS)}", + "DS_API_NAME": "ESIGNATURE", "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", From 1d34a890ca2c341bf2f2d0f6e1192f49789a474c Mon Sep 17 00:00:00 2001 From: karissarjacobsen <73908223+karissarjacobsen@users.noreply.github.com> Date: Mon, 23 Nov 2020 11:50:30 -0800 Subject: [PATCH 074/699] remove 'ceremony' from all references to embedded signing (#13) --- README.md | 6 +++--- .../EG001ControllerEmbeddedSigning.java | 18 +++++++++--------- .../EG011ControllerEmbeddedSending.java | 2 +- .../EG013ControllerAddDocToTemplate.java | 10 +++++----- .../examples/EG016ControllerSetTabValues.java | 6 +++--- .../EG017ControllerSetTemplateTabValues.java | 6 +++--- .../views/pages/esignature/examples/eg011.jsp | 2 +- .../views/pages/esignature/examples/eg013.jsp | 4 ++-- .../templates/views/pages/esignature/index.jsp | 10 +++++----- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index dd52d467..95cb8387 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This GitHub repo includes code example for both the DocuSign eSignature REST API ## Introduction This repo is a Java Spring Boot application that demonstrates: -1. **Embedded Signing.** +1. **Use embedded signing.** [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. @@ -34,11 +34,11 @@ This repo is a Java Spring Boot application that demonstrates: 1. **Send an envelope and upload its documents with multipart binary transfer.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) Binary transfer is 33% more efficient than using Base64 encoding. -1. **Embedded sending.** +1. **Use embedded sending.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) 1. **Embedded DocuSign web tool (NDSE).** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) -1. **Embedded Signing from a template with an added document.** +1. **Use embedded signing from a template with an added document.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) This example sends an envelope based on a template. In addition to the template's document(s), the example adds an diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 26bc8ad5..6132daaa 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -29,10 +29,10 @@ /** - * Embedded Signing Ceremony.
- * This example sends an envelope, and then uses an embedded signing ceremony + * Use embedded signing.
+ * This example sends an envelope, and then uses embedded signing * for the first signer. Embedded signing provides a smoother user experience - * for the signer: the DocuSign signing ceremony is initiated from your site. + * for the signer: the DocuSign signing is initiated from your site. */ @Controller @RequestMapping("/eg001") @@ -50,7 +50,7 @@ public class EG001ControllerEmbeddedSigning extends AbstractEsignatureController @Autowired public EG001ControllerEmbeddedSigning(DSConfiguration config, Session session, User user) { - super(config, "eg001", "Embedded Signing Ceremony"); + super(config, "eg001", "Use embedded signing"); this.session = session; this.user = user; } @@ -73,11 +73,11 @@ protected Object doWork(WorkArguments args, ModelMap model, String envelopeId = envelopeSummary.getEnvelopeId(); session.setEnvelopeId(envelopeId); - // Step 3. create the recipient view, the Signing Ceremony + // Step 3. create the recipient view, the embedded signing RecipientViewRequest viewRequest = makeRecipientViewRequest(signerEmail, signerName); ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); - // Step 4. Redirect the user to the Signing Ceremony + // Step 4. Redirect the user to the embedded signing // Don't use an iFrame! // State can be stored/recovered using the framework's session or a // query parameter on the returnUrl (see the makeRecipientViewRequest method) @@ -90,7 +90,7 @@ private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String // should typically be a callback route somewhere in your app. // The query parameter is included as an example of how // to save/recover state information during the redirect to - // the DocuSign signing ceremony. It's usually better to use + // the DocuSign signing. It's usually better to use // the session mechanism of your web framework. Query parameters // can be changed/spoofed very easily. viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); @@ -107,9 +107,9 @@ private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String viewRequest.setClientUserId(SIGNER_CLIENT_ID); // DocuSign recommends that you redirect to DocuSign for the - // Signing Ceremony. There are multiple ways to save state. + // embedded signing. There are multiple ways to save state. // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign Signing Ceremony web page + // parameter. It causes the DocuSign signing web page // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address viewRequest.setPingFrequency("600"); // seconds diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index 5fc3fb4c..40d494b4 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -23,7 +23,7 @@ /** - * Embedded Sending
+ * Use embedded sending
* An envelope will be created in draft mode. A browser will then be redirected * to the DocuSign web tool where the envelope can be (optionally) updated and * then sent. The envelope includes a pdf, Word, and HTML document. diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index ec9fab0d..d6335c91 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -34,7 +34,7 @@ /** - * Embedded Signing Ceremony from a template with an added document.
+ * Use embedded signing from a template with an added document.
* This example sends an envelope based on a template. In addition to the * template's document(s), the example adds an additional document to the * envelope by using the Composite Templates. @@ -56,7 +56,7 @@ public class EG013ControllerAddDocToTemplate extends AbstractEsignatureControlle @Autowired public EG013ControllerAddDocToTemplate(DSConfiguration config, Session session, User user) { - super(config, "eg013", "Embedded Signing Ceremony from template and extra doc"); + super(config, "eg013", "Use embedded signing from template and extra doc"); this.session = session; this.user = user; } @@ -86,7 +86,7 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2. call Envelopes::create API method EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - // Step 3. create the recipient view, the Signing Ceremony + // Step 3. create the recipient view, the embedded signing RecipientViewRequest viewRequest = makeRecipientViewRequest(args); ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); return new RedirectView(viewUrl.getUrl()); @@ -108,9 +108,9 @@ private static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) viewRequest.setClientUserId(args.getSignerClientId()); // DocuSign recommends that you redirect to DocuSign for the - // Signing Ceremony. There are multiple ways to save state. + // embedded signing. There are multiple ways to save state. // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign Signing Ceremony web page + // parameter. It causes the DocuSign signing web page // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address viewRequest.setPingFrequency("600"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java index a7e0d88d..59f4d74f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java @@ -77,7 +77,7 @@ private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String // should typically be a callback route somewhere in your app. // The query parameter is included as an example of how // to save/recover state information during the redirect to - // the DocuSign signing ceremony. It's usually better to use + // the DocuSign signing. It's usually better to use // the session mechanism of your web framework. Query parameters // can be changed/spoofed very easily. viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); @@ -94,9 +94,9 @@ private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String viewRequest.setClientUserId(SIGNER_CLIENT_ID); // DocuSign recommends that you redirect to DocuSign for the - // Signing Ceremony. There are multiple ways to save state. + // Embedded signing . There are multiple ways to save state. // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign Signing Ceremony web page + // parameter. It causes the DocuSign signing web page // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address viewRequest.setPingFrequency("600"); // seconds diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index e199956e..76561549 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -89,7 +89,7 @@ private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String // should typically be a callback route somewhere in your app. // The query parameter is included as an example of how // to save/recover state information during the redirect to - // the DocuSign signing ceremony. It's usually better to use + // the DocuSign signing. It's usually better to use // the session mechanism of your web framework. Query parameters // can be changed/spoofed very easily. viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); @@ -106,9 +106,9 @@ private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String viewRequest.setClientUserId(SIGNER_CLIENT_ID); // DocuSign recommends that you redirect to DocuSign for the - // Signing Ceremony. There are multiple ways to save state. + // embedded signing. There are multiple ways to save state. // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign Signing Ceremony web page + // parameter. It causes the DocuSign signing web page // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address viewRequest.setPingFrequency("600"); // seconds diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 0acd2850..55fbcd91 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

11. Embedded Sending

+

11. Use embedded sending

An envelope will be created in draft mode. Your browser will then be redirected to the DocuSign web tool where the envelope can be (optionally) updated and then sent.

The envelope includes a pdf, Word, and HTML document. Anchor text diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index eb52ee0c..a9e9d4d2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

13. Embedded Signing Ceremony from a template with an added document

+

13. Use embedded signing from a template with an added document

This example sends an envelope based on a template.

In addition to the template's document(s), the example adds an @@ -15,7 +15,7 @@

This example then enables you to sign the envelope using embedded signing.

Embedded signing provides a smoother user experience for a signer who is already logged into your web application since the DocuSign - signing ceremony is initiated from your website.

+ signing is initiated from your website.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index e954f45c..df2df2be 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -45,9 +45,9 @@

Basic Examples

-

1. Embedded Signing Ceremony

-

This example sends an envelope, and then uses an embedded signing ceremony for the first signer. - With embedded signing, the DocuSign signing ceremony is initiated from your website. +

1. Use embedded signing

+

This example sends an envelope, and then uses embedded signing for the first signer. + With embedded signing, the DocuSign signing is initiated from your website.

API methods used: Envelopes::create and @@ -125,7 +125,7 @@ Envelopes::create.

-

11. Embedded sending

+

11. Use embedded sending

An envelope will be created in draft mode. The DocuSign web tool (NDSE) will then be shown, enabling further updates to the envelope before it is sent. @@ -140,7 +140,7 @@ EnvelopeViews::createConsole.

-

13. Embedded Signing Ceremony from a template with an added document

+

13. Use embedded signing from a template with an added document

This example sends an envelope based on a template.

In addition to the template's document(s), the example adds an additional document to the envelope by using the From 220e8198cb3f3de8fe3fe76f98574082b822a17b Mon Sep 17 00:00:00 2001 From: Yaryna Kimak <64064514+yarynakimak@users.noreply.github.com> Date: Wed, 25 Nov 2020 23:23:29 +0200 Subject: [PATCH 075/699] ARR example updates (#12) * Update readme file with new ARR examples * Add exception handler for 34th example Co-authored-by: Kharko, Yaryna --- README.md | 12 +++++++ ...034ControllerUseConditionalRecipients.java | 31 +++++++++++++------ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 95cb8387..bb125c43 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,18 @@ This repo is a Java Spring Boot application that demonstrates: [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. +1. **Сreating an envelope where the workflow is paused** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) + This topic demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + +1. **Resuming an envelope workflow that has been paused** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) + This topic demonstrates how to resume an envelope workflow that has been paused. + +1. **Use conditional recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) + This topic demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + ## Rooms API **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index dc1664d2..1cf664b0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -30,6 +30,7 @@ public class EG034ControllerUseConditionalRecipients extends AbstractEsignatureC private static final String DOCUMENT_FILE_NAME = "Welcome1.txt"; private static final String DOCUMENT_ID = "1"; private static final String DOCUMENT_NAME = "Welcome"; + private static final String NOT_ALLOWED_ERROR_MESSAGE = "Update to the workflow with recipient routing is not allowed"; private final Session session; private final User user; @@ -52,16 +53,26 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopeDefinition envelope = createEnvelope(args); // Step 3: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); - - this.session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(this.title) - .withJsonObject(results) - .withMessage( - "An envelope where the workflow is routed to different recipients based on the value of a transaction " + - "has been created and sent!
Envelope ID " - + this.session.getEnvelopeId() + ".") - .addToModel(model); + try { + EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); + this.session.setEnvelopeId(results.getEnvelopeId()); + DoneExample.createDefault(this.title) + .withJsonObject(results) + .withMessage( + "An envelope where the workflow is routed to different recipients based on the value of a transaction " + + "has been created and sent!
Envelope ID " + + this.session.getEnvelopeId() + ".") + .addToModel(model); + } catch (ApiException apiException) { + if (!apiException.getMessage().contains(NOT_ALLOWED_ERROR_MESSAGE)) { + throw apiException; + } + DoneExample.createDefault(this.title) + .withMessage(NOT_ALLOWED_ERROR_MESSAGE + " for your account!
" + + "Please contact with our support team " + + "to resolve this issue.") + .addToModel(model); + } return DONE_EXAMPLE_PAGE; } From 99c7d054e65292abc80d29cecb537bf572cf6276 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 30 Nov 2020 11:46:26 -0800 Subject: [PATCH 076/699] Update README.md Advanced recipient routing links in readme --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 95cb8387..5fb3d282 100644 --- a/README.md +++ b/README.md @@ -103,10 +103,19 @@ This repo is a Java Spring Boot application that demonstrates: [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. You must have at least one created template and brand. - 1. **Bulk sending envelopes to multiple recipients** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. +1. **Pausing a signature workflow Source.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. +1. **Unpausing a signature workflow** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) + This code example demonstrates how to resume an envelope workflow that has been paused +1. **Using conditional recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) + This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction. + ## Rooms API **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). From d2835a7c1c992a61a30637efef17cd5a697ea8cf Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Tue, 1 Dec 2020 12:34:21 -0800 Subject: [PATCH 077/699] match dc step numbers --- .../examples/EG032ControllerPauseSignatureWorkflow.java | 6 +++--- .../EG033ControllerUnpauseSignatureWorkflow.java | 6 +++--- .../EG034ControllerUseConditionalRecipients.java | 9 ++++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index 4d95c37e..cad63057 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -44,13 +44,13 @@ public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session ses @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - // Step 1: Construct your API headers + // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); - // Step 2: Construct your envelope JSON body + // Step 3: Construct your envelope JSON body EnvelopeDefinition envelope = createEnvelope(args); - // Step 3: Call the eSignature REST API + // Step 4: Call the eSignature REST API EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); this.session.setEnvelopeId(results.getEnvelopeId()); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index a4cd0b3d..b3b9cfd4 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -40,10 +40,10 @@ public EG033ControllerUnpauseSignatureWorkflow(DSConfiguration config, Session s // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { - // Step 1: Construct your API headers + // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 2: Construct your envelope JSON body + // Step 3: Construct your envelope JSON body Workflow workflow = new Workflow(); workflow.setWorkflowStatus(EnvelopeHelpers.WORKFLOW_STATUS_IN_PROGRESS); @@ -53,7 +53,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi.UpdateOptions updateOptions = envelopesApi. new UpdateOptions(); updateOptions.setResendEnvelope("true"); - // Step 3: Call the eSignature REST API + // Step 4: Call the eSignature REST API EnvelopeUpdateSummary results = envelopesApi.update( this.session.getAccountId(), this.session.getEnvelopeId(), diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index 1cf664b0..d26dc19e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -44,15 +44,16 @@ public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session s } @Override + // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - // Step 1: Construct your API headers + // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); - // Step 2: Construct your envelope JSON body + // Step 3: Construct your envelope JSON body EnvelopeDefinition envelope = createEnvelope(args); - // Step 3: Call the eSignature REST API + // Step 4: Call the eSignature REST API try { EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); this.session.setEnvelopeId(results.getEnvelopeId()); @@ -225,4 +226,6 @@ private static RecipientRouting createRecipientRouting(WorkArguments args) { recipientRouting.setRules(recipientRules); return recipientRouting; } + + // ***DS.snippet.0.end } \ No newline at end of file From 359c09ba1a2d120096b3478e0b588c77c471f816 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Wed, 2 Dec 2020 14:48:00 -0800 Subject: [PATCH 078/699] adds readme changes in --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 65cfc87e..ef053fa8 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,7 @@ When the token expires, it updates automatically. A sample Redirect URI: http://myserver.it.mycompany.com/login 1. [JDK 11](https://jdk.java.net/14/) or later +1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE 1. [Maven](https://maven.apache.org/download.cgi) 1. A name and email for a signer, and a name and email for a cc recipient. The signer and the cc email cannot be the same. @@ -200,6 +201,7 @@ When the token expires, it updates automatically. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** * Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** * Add VM argument `-Dspring.profiles.active=dev` to your IDE +* If using VS Code or Intellij, search for and install the Lombok Annotations Plugin. If using Eclipse, install the lombok.jar file `java -jar lombok.jar` in the terminal. * Note that IntelliJ IDEA Community Edition does not directly support Spring Boot applications. From e6ed88d0e4fdad341d151b0dd9ca2c831a180d44 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Wed, 2 Dec 2020 15:30:10 -0800 Subject: [PATCH 079/699] move mention of lombok around slightly --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ef053fa8..debc27d4 100644 --- a/README.md +++ b/README.md @@ -188,11 +188,10 @@ When the token expires, it updates automatically. A sample Redirect URI: http://myserver.it.mycompany.com/login 1. [JDK 11](https://jdk.java.net/14/) or later -1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE 1. [Maven](https://maven.apache.org/download.cgi) 1. A name and email for a signer, and a name and email for a cc recipient. The signer and the cc email cannot be the same. - +1. (Optional) [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE ### Short installation instructions * Download or clone this repository. @@ -201,10 +200,9 @@ When the token expires, it updates automatically. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** * Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** * Add VM argument `-Dspring.profiles.active=dev` to your IDE -* If using VS Code or Intellij, search for and install the Lombok Annotations Plugin. If using Eclipse, install the lombok.jar file `java -jar lombok.jar` in the terminal. * Note that IntelliJ IDEA Community Edition does not directly support Spring Boot applications. - +* If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. ### Build and run Launchers are built as a dedicated application with embedded TomCat server. Build: ``` bash From 7314a3003da4d411da609325b425feaf307a11a1 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Wed, 2 Dec 2020 18:11:31 -0800 Subject: [PATCH 080/699] consistency in verbiage --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index debc27d4..a644b3b2 100644 --- a/README.md +++ b/README.md @@ -119,15 +119,15 @@ This repo is a Java Spring Boot application that demonstrates: 1. **Сreating an envelope where the workflow is paused** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) - This topic demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. 1. **Resuming an envelope workflow that has been paused** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) - This topic demonstrates how to resume an envelope workflow that has been paused. + This code example demonstrates how to resume an envelope workflow that has been paused. 1. **Use conditional recipients** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) - This topic demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. ## Rooms API **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). @@ -135,22 +135,22 @@ This repo is a Java Spring Boot application that demonstrates: 1. **Create room with Data.** [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) - This example creates a new room in your DocuSign Rooms account to be used for a transaction. + This code example creates a new room in your DocuSign Rooms account to be used for a transaction. 1. **Create a room from a template.** [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) - This example creates a new room using a template. + This code example creates a new room using a template. 1. **Create room with Data.** [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportDataFromRoom.java) - This example exports all the avialalble data from a specific room in your DocuSign Rooms account. + This code example exports all the avialalble data from a specific room in your DocuSign Rooms account. 1. **Add forms to a room.** [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) - This example adds a standard real estate related form to a specific room in your DocuSign Rooms account. + This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account. 1. **How to search for rooms with filters.** [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) - This example searches for rooms in your DocuSign Rooms account using a specific filter. + This code example searches for rooms in your DocuSign Rooms account using a specific filter. 1. **Create an external form fillable session.** [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) - This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. + This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. From f914a19025095fc138558488c1a76d7ce0e63fe3 Mon Sep 17 00:00:00 2001 From: karissarjacobsen <73908223+karissarjacobsen@users.noreply.github.com> Date: Tue, 8 Dec 2020 15:10:23 -0800 Subject: [PATCH 081/699] update README to include scope info and update JWT Scopes (#15) --- README.md | 9 +++++++++ .../jwt/JWTAuthorizationCodeResourceDetails.java | 2 +- .../core/security/jwt/JWTOAuth2RestTemplate.java | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 65cfc87e..29918933 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ This GitHub repo includes code example for both the DocuSign eSignature REST API ## Introduction This repo is a Java Spring Boot application that demonstrates: +## eSignature API + +For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth) + 1. **Use embedded signing.** [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) This example sends an envelope, and then uses embedded signing for the first signer. @@ -130,6 +134,9 @@ This repo is a Java Spring Boot application that demonstrates: This topic demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. ## Rooms API + +For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/) + **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). @@ -164,6 +171,8 @@ The **refresh token** is not used in this example. * Authentication with DocuSign via the [JSON Web Token (JWT) Grant](https://developers.docusign.com/platform/auth/jwt/). When the token expires, it updates automatically. + **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. + ## Installation diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 4149cf41..bc5e83db 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -46,7 +46,7 @@ public ApiClient getApiClient() { public List getScopeByApiName(){ //Only signature scope is needed for eSIgnature api. Impersonation scope is implied. - return dsConfiguration.getApiName().equalsIgnoreCase(ApiIndex.ROOMS.toString()) ? + return dsConfiguration.getApiName().equalsIgnoreCase("rooms") ? getScope() : Arrays.asList(OAuth.Scope_SIGNATURE); } diff --git a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java index f4eb0994..ad6640c6 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java @@ -81,12 +81,13 @@ private OAuth2AccessToken accessToken() throws LauncherException { // Special handling for consent_required String message = e.getMessage(); String consent_url = ""; + String consent_scopes = String.join(" ", scopes) + " impersonation"; if (message != null && message.contains("consent_required")) { consent_url = String.format("https://%s/oauth/auth?prompt=login&response_type=code&scope=%s" + "&client_id=%s" + "&redirect_uri=%s", resource.getBaseUrl(), - "signature%20impersonation", + consent_scopes, resource.getClientId(), "http://localhost:8080/login%26type%3Djwt"); System.err.println("\nC O N S E N T R E Q U I R E D" + From 22b7064eb6b716ac6136da7802547117ce5f6de1 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Tue, 8 Dec 2020 17:06:57 -0800 Subject: [PATCH 082/699] updated to match reference guidelines --- README.md | 84 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index a644b3b2..35e5e2c2 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,25 @@ # Java Launcher Code Examples -This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. To use the Rooms API code examples, change the **DS_API_NAME** value to `ROOMS` in the application.json config file. +Github repo: https://github.com/docusign/code-examples-java + +This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. + +To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the vlue to `ROOMS`. **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). ## Introduction -This repo is a Java Spring Boot application that demonstrates: +This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the +[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. + +The [Spring Boot security Oauth2 boot autoconfigure package](https://github.com/spring-projects/spring-security-oauth2-boot/blob/master/spring-security-oauth2-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateCustomizer.java) is used for authentication. + +The OAuth library is used in the file [WebSecurityConfig.java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/WebSecurityConfig.java). + +## eSignature API + +For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). + 1. **Use embedded signing.** [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) @@ -116,7 +130,6 @@ This repo is a Java Spring Boot application that demonstrates: [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction. - 1. **Сreating an envelope where the workflow is paused** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. @@ -130,7 +143,10 @@ This repo is a Java Spring Boot application that demonstrates: This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. ## Rooms API -**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). + +For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). + +**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. 1. **Create room with Data.** @@ -153,18 +169,6 @@ This repo is a Java Spring Boot application that demonstrates: This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. - - -## Included OAuth grant types: - -* Authentication with Docusign via [Authorization Code Grant flow](https://developers.docusign.com/platform/auth/authcode) . -When the token expires, the user is asked to re-authenticate. -The **refresh token** is not used in this example. - -* Authentication with DocuSign via the [JSON Web Token (JWT) Grant](https://developers.docusign.com/platform/auth/jwt/). -When the token expires, it updates automatically. - - ## Installation ### Prerequisites @@ -187,22 +191,45 @@ When the token expires, it updates automatically. use the appropriate DNS name and port instead of `localhost:8080`. A sample Redirect URI: http://myserver.it.mycompany.com/login -1. [JDK 11](https://jdk.java.net/14/) or later +1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later 1. [Maven](https://maven.apache.org/download.cgi) 1. A name and email for a signer, and a name and email for a cc recipient. The signer and the cc email cannot be the same. 1. (Optional) [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE -### Short installation instructions -* Download or clone this repository. -* The project includes a Maven pom file. +#### Authorization Code Grant specifics: + You will need the integration key and its secret. The integration key must include a redirect URI of + + {app_url}/login&type=acg + + where {app_url} is the URL you have associated with the folder where the source files are located. + + For example, if you have created a web server that enables the URL + + http://localhost:8080/ + + to execute files on the /public folder of this example, then you must add a redirect URI to your integration key with the value + + http://localhost:8080/login&type=acg + +#### JWT (JSON Web Token) specifics: + You will need the integration key, an RSA private key, and the user ID (GUID) of the impersonated user. + + The private part of the RSA key pair must be copied over and stored in a private.key file located in `src\main\resources\private.key`. + + **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. + + +### Installation steps +1. Download or clone this repository. +1. The project includes a Maven pom file. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** -* Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** -* Add VM argument `-Dspring.profiles.active=dev` to your IDE -* Note that IntelliJ IDEA Community Edition does not directly support +1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** +1. Add VM argument `-Dspring.profiles.active=dev` to your IDE +1. Note that IntelliJ IDEA Community Edition does not directly support Spring Boot applications. -* If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. +1. If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. ### Build and run Launchers are built as a dedicated application with embedded TomCat server. Build: ``` bash @@ -292,14 +319,9 @@ browser to http://localhost:8080 ### Payments code example -To use the payments example, create a -test payments gateway for your developer account. - -See the -[PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) -file for instructions. +To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. -Then add the payment gateway account id to the **application.properties** file. +Then add the payment gateway account id to the **application.json** file. ## License and additional information From 7f91a04f363015468988a0edf2d37f5b3b8768be Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Wed, 9 Dec 2020 09:53:03 -0800 Subject: [PATCH 083/699] emphasize lombok is optional --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 35e5e2c2..a2f551e5 100644 --- a/README.md +++ b/README.md @@ -195,26 +195,23 @@ For more information about the scopes used for obtaining authorization to use th 1. [Maven](https://maven.apache.org/download.cgi) 1. A name and email for a signer, and a name and email for a cc recipient. The signer and the cc email cannot be the same. -1. (Optional) [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE +### Nice to have +1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE #### Authorization Code Grant specifics: You will need the integration key and its secret. The integration key must include a redirect URI of {app_url}/login&type=acg - where {app_url} is the URL you have associated with the folder where the source files are located. - For example, if you have created a web server that enables the URL http://localhost:8080/ to execute files on the /public folder of this example, then you must add a redirect URI to your integration key with the value - http://localhost:8080/login&type=acg #### JWT (JSON Web Token) specifics: You will need the integration key, an RSA private key, and the user ID (GUID) of the impersonated user. - The private part of the RSA key pair must be copied over and stored in a private.key file located in `src\main\resources\private.key`. **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. @@ -229,7 +226,7 @@ For more information about the scopes used for obtaining authorization to use th 1. Add VM argument `-Dspring.profiles.active=dev` to your IDE 1. Note that IntelliJ IDEA Community Edition does not directly support Spring Boot applications. -1. If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. +1. [Optional] If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. ### Build and run Launchers are built as a dedicated application with embedded TomCat server. Build: ``` bash From 24045fa51504d7a809ef70126410422112d66000 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Wed, 9 Dec 2020 21:38:01 -0800 Subject: [PATCH 084/699] changes configuration to java app based on springboot github feedback --- README.md | 665 +++++++++++++++++++++++++++--------------------------- 1 file changed, 334 insertions(+), 331 deletions(-) diff --git a/README.md b/README.md index a2f551e5..8a568b07 100644 --- a/README.md +++ b/README.md @@ -1,331 +1,334 @@ -# Java Launcher Code Examples - -Github repo: https://github.com/docusign/code-examples-java - -This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. - -To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the vlue to `ROOMS`. - -**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). - -## Introduction -This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the -[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. - -The [Spring Boot security Oauth2 boot autoconfigure package](https://github.com/spring-projects/spring-security-oauth2-boot/blob/master/spring-security-oauth2-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateCustomizer.java) is used for authentication. - -The OAuth library is used in the file [WebSecurityConfig.java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/WebSecurityConfig.java). - -## eSignature API - -For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). - - -1. **Use embedded signing.** - [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) - This example sends an envelope, and then uses embedded signing for the first signer. - With embedded signing, DocuSign signing is initiated from your website. -1. **Send an envelope with a remote (email) signer and cc recipient.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) - The envelope includes a pdf, Word, and HTML document. - Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. -1. **List envelopes in the user's account.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java) -1. **Get an envelope's basic information.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java) - The example lists the basic information about an envelope, including its overall status. -1. **List an envelope's recipients and their current status.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) -1. **List an envelope's documents.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) -1. **Download an envelope's documents.** The example can download individual - documents, the documents concatenated together, or a zip file of the documents. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) -1. **Programmatically create a template.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) -1. **Send an envelope using a template.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) -1. **Send an envelope and upload its documents with multipart binary transfer.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) - Binary transfer is 33% more efficient than using Base64 encoding. -1. **Use embedded sending.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) -1. **Embedded DocuSign web tool (NDSE).** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) -1. **Use embedded signing from a template with an added document.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) - This example sends an envelope based on a template. - In addition to the template's document(s), the example adds an - additional document to the envelope by using the - [Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates) - feature. -1. **Payments example: an order form, with online payment by credit card.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java) -1. **Get the envelope tab data.** - Retrieve the tab (field) values for all of the envelope's recipients. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java) -1. **Set envelope tab values.** - The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs - are set to be read-only, others can be updated by the recipient. The example also stores - metadata with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java) -1. **Set template tab values.** - The example creates an envelope using a template and sets the initial values for its tabs (fields). - The example also stores metadata with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java) -1. **Get the envelope custom field data (metadata).** - The example retrieves the custom metadata (custom data fields) stored with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java) -1. **Requiring an Access Code for a Recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java) - This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. -1. **Requiring SMS authentication for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java) - This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. -1. **Requiring Phone authentication for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java) - This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. -1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java) - This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication. -1. **Requiring ID Verification (IDV) for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java) - This example sends and envelope that requires the recipient to upload a government issued id. -1. **Creating a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java) - This code example demonstrates how to create a user group's permission profile using the [Create Profile](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/create) method. -1. **Setting a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java) - This code example demonstrates how to set a user group's permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method. - You must have already created permissions profile and group of users. -1. **Updating individual permission settings** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java) - This code example demonstrates how to update individual settings for a specific permission profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method. - You must have already created permissions profile and group of users. -1. **Deleting a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java) - This code example demonstrates how to an account's permission profile using the [Delete AccountPermissionProfiles](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/delete) method. -1. **Creating a brand** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java) - This example creates brand profile for an account using the [Create Brand](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountBrands/create) method. -1. **Applying a brand to an envelope** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java) - This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. - First, creates the envelope and then applies brand to it. - Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. -1. **Applying a brand to a template** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) - This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. - You must have at least one created template and brand. -1. **Bulk sending envelopes to multiple recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) - This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. -1. **Pausing a signature workflow Source.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. -1. **Unpausing a signature workflow** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) - This code example demonstrates how to resume an envelope workflow that has been paused -1. **Using conditional recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) - This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction. - -1. **Сreating an envelope where the workflow is paused** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. - -1. **Resuming an envelope workflow that has been paused** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) - This code example demonstrates how to resume an envelope workflow that has been paused. - -1. **Use conditional recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. - -## Rooms API - -For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). - -**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. - - -1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) - This code example creates a new room in your DocuSign Rooms account to be used for a transaction. -1. **Create a room from a template.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) - This code example creates a new room using a template. -1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportDataFromRoom.java) - This code example exports all the avialalble data from a specific room in your DocuSign Rooms account. -1. **Add forms to a room.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) - This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account. -1. **How to search for rooms with filters.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) - This code example searches for rooms in your DocuSign Rooms account using a specific filter. -1. **Create an external form fillable session.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) - This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. - - -## Installation - -### Prerequisites -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 1 and 2 below as they're automatically performed for you.** - -1. A DocuSign developer account (email and password) on [demo.docusign.net](https://demo.docusign.net). - Create a [free account](https://go.docusign.com/sandbox/productshot/?elqCampaignId=16533). -1. A DocuSign Integration Key (a client ID) that is configured to use the - OAuth Authorization Code flow. - You will need the **Integration Key** itself, and its **secret**. To - use JSON Web token, you will need the **Integration Key** itself, the - **RSA Secret Key** and an API user ID for the user you are impersonating. - - If you use this launcher on your own workstation, - the Integration key must include following **Redirect URI**s: - * http://localhost:8080/login&type=acg - * http://localhost:8080/login&type=jwt - - If you will not be running the launcher on your own workstation, - use the appropriate DNS name and port instead of `localhost:8080`. - A sample Redirect URI: http://myserver.it.mycompany.com/login - -1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later -1. [Maven](https://maven.apache.org/download.cgi) -1. A name and email for a signer, and a name and email for a cc recipient. - The signer and the cc email cannot be the same. -### Nice to have -1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE - -#### Authorization Code Grant specifics: - You will need the integration key and its secret. The integration key must include a redirect URI of - - {app_url}/login&type=acg - where {app_url} is the URL you have associated with the folder where the source files are located. - For example, if you have created a web server that enables the URL - - http://localhost:8080/ - - to execute files on the /public folder of this example, then you must add a redirect URI to your integration key with the value - http://localhost:8080/login&type=acg - -#### JWT (JSON Web Token) specifics: - You will need the integration key, an RSA private key, and the user ID (GUID) of the impersonated user. - The private part of the RSA key pair must be copied over and stored in a private.key file located in `src\main\resources\private.key`. - - **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. - - -### Installation steps -1. Download or clone this repository. -1. The project includes a Maven pom file. - -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** -1. Add VM argument `-Dspring.profiles.active=dev` to your IDE -1. Note that IntelliJ IDEA Community Edition does not directly support - Spring Boot applications. -1. [Optional] If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. -### Build and run -Launchers are built as a dedicated application with embedded TomCat server. Build: -``` bash -$ cd code-examples-java -$ mvn package -``` -Run: -``` bash -$ cd target -$ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war -``` - - -## IntelliJ Ultimate instructions - -The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) -can be used with the launcher. The IntelliJ Ultimate edition is -required due to its support for Spring Boot and JSP view pages. - -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** - -**Step 1.** Download or clone the -[code-examples-java](https://github.com/docusign/code-examples-java) - repository - -**Step 2.** Start IntelliJ Ultimate and choose the **Open or Import** option. - -![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) - -**Step 3.** Use the popup file chooser to select -**code-examples-java** or your unzipped Quickstart directory. - -**Step 4.** The **Import Project** wizard will open. It's a -series of screens. On the first screen, select -**Import project from external model** and **Maven**. - -![IntelliJ Import Maven project](./docs/install_fig_2.png) - -**Step 5.** Click **Finish** and the project will -be displayed in the IDE. - -### Configuring IntelliJ's *Run/Debug Configuration* -IntelliJ uses **Run/Debug Configuration** to manage -settings for running the launcher. - -Set up a Run/Debug Configuration for the launcher: - -Step 1. Use the menu command **Run > Edit configurations...** -to open the configuration manager. - -Step 2. Click the **+** (plus) sign to add a new configuration. -The configuration type is **Spring Boot**. You may need to -open the additional templates section of the template chooser. - -Step 3. Update the form with the **Name** of the -configuration to `code-examples-java` and the **Main class** for the configuration, -`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. - -Under **Spring Boot** select the `Enable debug output` checkbox. - -![Configure a Run configuration](./docs/install_fig_7.png) - -### Running or debugging the launcher - -Use a **Run** menu option to run or debug the launcher. - -After the application finishes building, open your -browser to http://localhost:8080 - - - -## Eclipse instructions - -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the first step as it was automatically performed for you.** - -* Download or clone this repository. -* Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. -* For the Root directory, Browse for and select this same repo `code-examples-java`. -* Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. -* Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration with the following: - * Name the configuration `code-examples-java` (If You have downloaded the launcher via Quickstart, skip this step). - * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. - * Put in the following value for the Goals field: `spring-boot::run`. -* Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. -* Click apply to save. Finally, click `Run` to run it! -* Open a browser to http://localhost:8080 - - -### Payments code example -To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. - -Then add the payment gateway account id to the **application.json** file. - - -## License and additional information - -### License -This repository uses the MIT License. See the LICENSE file for more information. - -### Pull Requests -Pull requests are welcomed. Pull requests will only be considered if their content -uses the MIT License. +# Java Launcher Code Examples + +Github repo: https://github.com/docusign/code-examples-java + +This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. + +To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the vlue to `ROOMS`. + +**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). + +## Introduction +This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the +[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. + +The [Spring Boot security Oauth2 boot autoconfigure package](https://github.com/spring-projects/spring-security-oauth2-boot/blob/master/spring-security-oauth2-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateCustomizer.java) is used for authentication. + +The OAuth library is used in the file [WebSecurityConfig.java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/WebSecurityConfig.java). + +## eSignature API + +For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). + + +1. **Use embedded signing.** + [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) + This example sends an envelope, and then uses embedded signing for the first signer. + With embedded signing, DocuSign signing is initiated from your website. +1. **Send an envelope with a remote (email) signer and cc recipient.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) + The envelope includes a pdf, Word, and HTML document. + Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. +1. **List envelopes in the user's account.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java) +1. **Get an envelope's basic information.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java) + The example lists the basic information about an envelope, including its overall status. +1. **List an envelope's recipients and their current status.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) +1. **List an envelope's documents.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) +1. **Download an envelope's documents.** The example can download individual + documents, the documents concatenated together, or a zip file of the documents. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) +1. **Programmatically create a template.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) +1. **Send an envelope using a template.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) +1. **Send an envelope and upload its documents with multipart binary transfer.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) + Binary transfer is 33% more efficient than using Base64 encoding. +1. **Use embedded sending.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) +1. **Embedded DocuSign web tool (NDSE).** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) +1. **Use embedded signing from a template with an added document.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) + This example sends an envelope based on a template. + In addition to the template's document(s), the example adds an + additional document to the envelope by using the + [Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates) + feature. +1. **Payments example: an order form, with online payment by credit card.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java) +1. **Get the envelope tab data.** + Retrieve the tab (field) values for all of the envelope's recipients. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java) +1. **Set envelope tab values.** + The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs + are set to be read-only, others can be updated by the recipient. The example also stores + metadata with the envelope. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java) +1. **Set template tab values.** + The example creates an envelope using a template and sets the initial values for its tabs (fields). + The example also stores metadata with the envelope. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java) +1. **Get the envelope custom field data (metadata).** + The example retrieves the custom metadata (custom data fields) stored with the envelope. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java) +1. **Requiring an Access Code for a Recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java) + This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. +1. **Requiring SMS authentication for a recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java) + This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. +1. **Requiring Phone authentication for a recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java) + This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. +1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java) + This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication. +1. **Requiring ID Verification (IDV) for a recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java) + This example sends and envelope that requires the recipient to upload a government issued id. +1. **Creating a permission profile** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java) + This code example demonstrates how to create a user group's permission profile using the [Create Profile](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/create) method. +1. **Setting a permission profile** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java) + This code example demonstrates how to set a user group's permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method. + You must have already created permissions profile and group of users. +1. **Updating individual permission settings** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java) + This code example demonstrates how to update individual settings for a specific permission profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method. + You must have already created permissions profile and group of users. +1. **Deleting a permission profile** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java) + This code example demonstrates how to an account's permission profile using the [Delete AccountPermissionProfiles](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/delete) method. +1. **Creating a brand** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java) + This example creates brand profile for an account using the [Create Brand](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountBrands/create) method. +1. **Applying a brand to an envelope** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java) + This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. + First, creates the envelope and then applies brand to it. + Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. +1. **Applying a brand to a template** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) + This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. + You must have at least one created template and brand. +1. **Bulk sending envelopes to multiple recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) + This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. +1. **Pausing a signature workflow Source.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. +1. **Unpausing a signature workflow** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) + This code example demonstrates how to resume an envelope workflow that has been paused +1. **Using conditional recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) + This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction. + +1. **Сreating an envelope where the workflow is paused** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + +1. **Resuming an envelope workflow that has been paused** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) + This code example demonstrates how to resume an envelope workflow that has been paused. + +1. **Use conditional recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + +## Rooms API + +For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). + +**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. + + +1. **Create room with Data.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) + This code example creates a new room in your DocuSign Rooms account to be used for a transaction. +1. **Create a room from a template.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) + This code example creates a new room using a template. +1. **Create room with Data.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportDataFromRoom.java) + This code example exports all the avialalble data from a specific room in your DocuSign Rooms account. +1. **Add forms to a room.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) + This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account. +1. **How to search for rooms with filters.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) + This code example searches for rooms in your DocuSign Rooms account using a specific filter. +1. **Create an external form fillable session.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) + This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. + + +## Installation + +### Prerequisites +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 1 and 2 below as they're automatically performed for you.** + +1. A DocuSign developer account (email and password) on [demo.docusign.net](https://demo.docusign.net). + Create a [free account](https://go.docusign.com/sandbox/productshot/?elqCampaignId=16533). +1. A DocuSign Integration Key (a client ID) that is configured to use the + OAuth Authorization Code flow. + You will need the **Integration Key** itself, and its **secret**. To + use JSON Web token, you will need the **Integration Key** itself, the + **RSA Secret Key** and an API user ID for the user you are impersonating. + + If you use this launcher on your own workstation, + the Integration key must include following **Redirect URI**s: + * http://localhost:8080/login&type=acg + * http://localhost:8080/login&type=jwt + + If you will not be running the launcher on your own workstation, + use the appropriate DNS name and port instead of `localhost:8080`. + A sample Redirect URI: http://myserver.it.mycompany.com/login + +1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later +1. [Maven](https://maven.apache.org/download.cgi) +1. A name and email for a signer, and a name and email for a cc recipient. + The signer and the cc email cannot be the same. +### Nice to have +1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE + +#### Authorization Code Grant specifics: + You will need the integration key and its secret. The integration key must include a redirect URI of + + {app_url}/login&type=acg + where {app_url} is the URL you have associated with the folder where the source files are located. + For example, if you have created a web server that enables the URL + + http://localhost:8080/ + + to execute files on the /public folder of this example, then you must add a redirect URI to your integration key with the value + http://localhost:8080/login&type=acg + +#### JWT (JSON Web Token) specifics: + You will need the integration key, an RSA private key, and the user ID (GUID) of the impersonated user. + The private part of the RSA key pair must be copied over and stored in a private.key file located in `src\main\resources\private.key`. + + **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. + + +### Installation steps +1. Download or clone this repository. +1. The project includes a Maven pom file. + +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** +1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** +1. Add VM argument `-Dspring.profiles.active=dev` to your IDE +1. Note that IntelliJ IDEA Community Edition does not directly support + Spring Boot applications. +1. [Optional] If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. +### Build and run +Launchers are built as a dedicated application with embedded TomCat server. Build: +``` bash +$ cd code-examples-java +$ mvn package +``` +Run: +``` bash +$ cd target +$ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war +``` + + +## IntelliJ Ultimate instructions + +The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) +can be used with the launcher. The IntelliJ Ultimate edition is +required due to its support for Spring Boot and JSP view pages. + +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** + +**Step 1.** Download or clone the +[code-examples-java](https://github.com/docusign/code-examples-java) + repository + +**Step 2.** Start IntelliJ Ultimate and choose the **Open or Import** option. + +![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) + +**Step 3.** Use the popup file chooser to select +**code-examples-java** or your unzipped Quickstart directory. + +**Step 4.** The **Import Project** wizard will open. It's a +series of screens. On the first screen, select +**Import project from external model** and **Maven**. + +![IntelliJ Import Maven project](./docs/install_fig_2.png) + +**Step 5.** Click **Finish** and the project will +be displayed in the IDE. + +### Configuring IntelliJ's *Run/Debug Configuration* +IntelliJ uses **Run/Debug Configuration** to manage +settings for running the launcher. + +Set up a Run/Debug Configuration for the launcher: + +Step 1. Use the menu command **Run > Edit configurations...** +to open the configuration manager. + +Step 2. Click the **+** (plus) sign to add a new configuration. +The configuration type is **Spring Boot**. You may need to +open the additional templates section of the template chooser. + +Step 3. Update the form with the **Name** of the +configuration to `code-examples-java` and the **Main class** for the configuration, +`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. + +Under **Spring Boot** select the `Enable debug output` checkbox. + +![Configure a Run configuration](./docs/install_fig_7.png) + +### Running or debugging the launcher + +Use a **Run** menu option to run or debug the launcher. + +After the application finishes building, open your +browser to http://localhost:8080 + + + +## Eclipse instructions + +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the first step as it was automatically performed for you.** + +* Download or clone this repository. +* Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. +* For the Root directory, Browse for and select this same repo `code-examples-java`. +* Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. +* Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration to clean and compile with the following: + * Name the configuration `build` (If You have downloaded the launcher via Quickstart, skip this step). + * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. + * Put in the following values into the Goals field: `clean package`. +* Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. +* Click apply to save. +* Finally, create another configuration by again using `Run->Run Configurations`, choosing Java Application Configuration with the following: + * Name the configuration `run` (If You have downloaded the launcher via Quickstart, skip this step). + * Put in the following value for project: `code-examples-java`. + * Put in the following value into the Main class: `com.docusign.App`. +* Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080 + +### Payments code example +To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. + +Then add the payment gateway account id to the **application.json** file. + + +## License and additional information + +### License +This repository uses the MIT License. See the LICENSE file for more information. + +### Pull Requests +Pull requests are welcomed. Pull requests will only be considered if their content +uses the MIT License. From d458806a99fb13acc9907fc6921c41a1aee33bd4 Mon Sep 17 00:00:00 2001 From: "Kharko, Yaryna" Date: Thu, 10 Dec 2020 12:37:36 +0200 Subject: [PATCH 085/699] Added Click code examples --- README.md | 25 ++++- .../java/com/docusign/WebSecurityConfig.java | 39 ++++--- .../java/com/docusign/common/ApiIndex.java | 14 ++- .../com/docusign/common/WorkArguments.java | 2 +- .../examples/AbstractClickController.java | 27 +++++ .../C001ControllerCreateClickwrap.java | 84 +++++++++++++++ .../C002ControllerActivateClickwrap.java | 70 +++++++++++++ .../examples/C003ControllerTestClickwrap.java | 61 +++++++++++ .../C004ControllerEmbedClickwrap.java | 56 ++++++++++ ...05ControllerCreateNewVersionClickwrap.java | 99 ++++++++++++++++++ .../C006ControllerGetListClickwraps.java | 54 ++++++++++ .../C007ControllerGetClickwrapResponses.java | 55 ++++++++++ .../click/examples/ClickwrapHelper.java | 46 ++++++++ .../controller/GlobalControllerAdvice.java | 5 +- .../java/com/docusign/core/model/Session.java | 9 +- .../JWTAuthorizationCodeResourceDetails.java | 6 +- .../com/docusign/core/utils/FileUtils.java | 19 ++++ src/main/resources/TermsOfService.pdf | Bin 0 -> 27701 bytes src/main/resources/application.example.json | 2 +- .../views/pages/click/examples/c001.jsp | 26 +++++ .../views/pages/click/examples/c002.jsp | 32 ++++++ .../views/pages/click/examples/c003.jsp | 29 +++++ .../views/pages/click/examples/c004.jsp | 50 +++++++++ .../views/pages/click/examples/c005.jsp | 32 ++++++ .../views/pages/click/examples/c006.jsp | 23 ++++ .../views/pages/click/examples/c007.jsp | 23 ++++ .../templates/views/pages/click/index.jsp | 61 ++++++++++- 27 files changed, 915 insertions(+), 34 deletions(-) create mode 100644 src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java create mode 100644 src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java create mode 100644 src/main/java/com/docusign/core/utils/FileUtils.java create mode 100644 src/main/resources/TermsOfService.pdf create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp diff --git a/README.md b/README.md index dd52d467..2a858b55 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,30 @@ This repo is a Java Spring Boot application that demonstrates: This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. - +## Click API +**Note:** to use the Click API you must also be ready authenticate with one of the workflows (https://developers.docusign.com/docs/click-api/click101/auth). + +1. **Create Clickwraps.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java) + This example shows how to create a clickwrap. +1. **Activate Clickwrap.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) + This example shows how to activate a new clickwrap that you have already created.. +1. **Test Clickwrap.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java) + This example shows how to test a newly create clickwrap. +1. **Clickwrap Embeding.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java) + This example shows how to embed a clickwrap into a page. +1. **Clickwrap Versioning.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java) + This example shows how to create a new clickwrap version. +1. **Get a list of Clickwraps.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java) + This example shows how to get a list of clickwraps. +1. **Get Clickwrap Responses.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java) + This example shows how to get clickwrap responses. ## Included OAuth grant types: diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 542faa83..3f0f8c6e 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -26,16 +26,17 @@ import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter; import org.springframework.web.filter.CompositeFilter; +import javax.servlet.Filter; import java.util.Arrays; import java.util.List; -import javax.servlet.Filter; @EnableOAuth2Client @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public String roomScopes[] = new String[] {"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}; - + public String clickScopes[] = new String[] {"signature", "click.manage", "click.send"}; + @Autowired private DSConfiguration dsConfiguration; @@ -82,16 +83,26 @@ public FilterRegistrationBean oAuth2ClientFilterRegis return registration; } + private List getScopes() { + List scopes = null; + if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { + scopes = Arrays.asList(this.roomScopes); + } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("click")) { + scopes = Arrays.asList(this.clickScopes); + } + + return scopes; + } + private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { OAuth2SsoProperties authCodeGrantSso = authCodeGrantSso(); AuthorizationCodeResourceDetails authCodeGrantClient = authCodeGrantClient(); - - if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { - authCodeGrantClient.setScope(Arrays.asList(roomScopes)); - } - - + List scopes = this.getScopes(); + if (scopes != null) { + authCodeGrantClient.setScope(scopes); + } + ResourceServerProperties userInfoResource = userInfoResource(); OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(authCodeGrantSso.getLoginPath()); @@ -106,12 +117,12 @@ private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { private OAuth2ClientAuthenticationProcessingFilter jwtGrantFilter() { OAuth2SsoProperties authCodeGrantSso = jwtGrantSso(); JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = jwtCodeGrantClient(); - - if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { - jwtCodeGrantClient.setScope(Arrays.asList(roomScopes)); - - } - + + List scopes = this.getScopes(); + if (scopes != null) { + jwtCodeGrantClient.setScope(scopes); + } + OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(authCodeGrantSso.getLoginPath()); OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index 90840edf..3d4c110d 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -1,14 +1,20 @@ package com.docusign.common; public enum ApiIndex { - ESIGNATURE("/pages/esignature/index"), - ROOMS("/pages/rooms/index"), - CLICK("/pages/click/index"); + ESIGNATURE("/pages/esignature/index", "/restapi"), + ROOMS("/pages/rooms/index", "/restapi"), + CLICK("/pages/click/index", "/clickapi"); private final String indexPath; + private final String baseUrlSuffix; - ApiIndex(final String indexPath) { + ApiIndex(final String indexPath, final String baseUrlSuffix) { this.indexPath = indexPath; + this.baseUrlSuffix = baseUrlSuffix; + } + + public String getBaseUrlSuffix() { + return baseUrlSuffix; } @Override diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index d2928583..a7c17859 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -5,7 +5,6 @@ import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; -import java.time.LocalDate; import java.util.UUID; @@ -19,6 +18,7 @@ public class WorkArguments { private String signerName; private String ccEmail; private String ccName; + private String clickwrapName; private String signerEmail2; private String signerName2; private String ccEmail2; diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index b8bd0d87..fcc7048c 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -3,8 +3,11 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiClient; +import com.docusign.click.client.ApiException; import com.docusign.click.client.auth.OAuth; +import com.docusign.click.model.ClickwrapResponse; import com.docusign.core.controller.AbstractController; +import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; @@ -51,5 +54,29 @@ protected static AccountsApi createAccountsApiClient(String basePath, String use ApiClient apiClient = createApiClient(basePath, userAccessToken); return new AccountsApi(apiClient); } + + /** + * Determine if clickwrap is exists and is active. + * @param basePath URL to Rooms REST API + * @param userAccessToken user's access token + * @param accountId user's account id + * @param clickwrapId clickwrap's id + * @return an boolean value + */ + protected boolean isClickwrapExistsAndActive(String basePath, String userAccessToken, + String accountId, String clickwrapId) throws ApiException { + boolean isClickwrapOk = false; + + if (StringUtils.isNotBlank(clickwrapId)) { + + AccountsApi accountsApi = this.createAccountsApiClient(basePath, userAccessToken); + ClickwrapResponse clickwrapResponse = accountsApi.getClickwrap(accountId, clickwrapId); + + isClickwrapOk = clickwrapResponse.getClickwrapId().equals(clickwrapId) && + clickwrapResponse.getStatus().equals(ClickwrapHelper.STATUS_ACTIVE); + } + + return isClickwrapOk; + } } diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java new file mode 100644 index 00000000..3ff34e4e --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -0,0 +1,84 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapSummaryResponse; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Create a clickwrap. + */ +@Controller +@RequestMapping("/c001") +public class C001ControllerCreateClickwrap extends AbstractClickController { + + private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; + private static final Integer DOCUMENT_ORDER = 0; + private static final String DOCUMENT_NAME = "Terms of Service"; + + private final Session session; + private final User user; + + + @Autowired + public C001ControllerCreateClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c001", "Create a clickwrap"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws IOException, ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(args.getClickwrapName()); + + // Step 4: Call the v1 Click API + ClickwrapSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); + + this.session.setClickwrapId(createdClickwrap.getClickwrapId()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + DoneExample.createDefault(this.title) + .withJsonObject(createdClickwrap) + .withMessage("The clickwrap has been created!
Clickwrap ID " + createdClickwrap.getClickwrapId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + private ClickwrapRequest createClickwrapRequest(String clickwrapName) throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true). + documentDisplay("document"); + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName(clickwrapName) + .requireReacceptance(true) + .displaySettings(displaySettings); + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java new file mode 100644 index 00000000..16fca94e --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -0,0 +1,70 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.*; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Activate a clickwrap. + */ +@Controller +@RequestMapping("/c002") +public class C002ControllerActivateClickwrap extends AbstractClickController { + + private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + + private final Session session; + private final User user; + + + @Autowired + public C002ControllerActivateClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c002", "Activate a clickwrap"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + model.addAttribute(MODEL_CLICKWRAP_OK, StringUtils.isNotBlank(this.session.getClickwrapId())); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE); + + // Step 4: Call the v1 Click API + ClickwrapSummaryResponse updatedClickwrap = accountsApi.updateClickwrapVersion( + this.session.getAccountId(), + this.session.getClickwrapId(), + this.session.getClickwrapVersionNumber(), + clickwrapRequest); + + DoneExample.createDefault(this.title) + .withJsonObject(updatedClickwrap) + .withMessage("The clickwrap has been activated!
Clickwrap ID " + updatedClickwrap.getClickwrapId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java new file mode 100644 index 00000000..12c50384 --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java @@ -0,0 +1,61 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; + +/** + * Embed a clickwrap. + */ +@Controller +@RequestMapping("/c003") +public class C003ControllerTestClickwrap extends AbstractClickController { + + private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + private static final String MODEL_TEST_CLICKWRAP_URL = "testClickwrapUrl"; + + private final Session session; + private final User user; + + + @Autowired + public C003ControllerTestClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c003", "Embed a clickwrap"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + + boolean isClickwrapOk = this.isClickwrapExistsAndActive( + this.session.getBasePath(), + this.user.getAccessToken(), + this.session.getAccountId(), + this.session.getClickwrapId()); + + model.addAttribute(MODEL_CLICKWRAP_OK, isClickwrapOk); + model.addAttribute(MODEL_TEST_CLICKWRAP_URL, this.getTestClickWrapUrl()); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) { + return DONE_EXAMPLE_PAGE; + } + + private String getTestClickWrapUrl() { + return "https://developers.docusign.com/click-api/test-clickwrap/?" + + "a=" + this.session.getAccountId() + "&cw=" + this.session.getClickwrapId() + "&eh=demo"; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java new file mode 100644 index 00000000..c99ce87f --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java @@ -0,0 +1,56 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; + +/** + * Embed a clickwrap. + */ +@Controller +@RequestMapping("/c004") +public class C004ControllerEmbedClickwrap extends AbstractClickController { + + private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + private static final String MODEL_CLICKWRAP_ID = "clickwrapId"; + + private final Session session; + private final User user; + + + @Autowired + public C004ControllerEmbedClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c004", "Embed a clickwrap"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + + boolean isClickwrapOk = this.isClickwrapExistsAndActive( + this.session.getBasePath(), + this.user.getAccessToken(), + this.session.getAccountId(), + this.session.getClickwrapId()); + + model.addAttribute(MODEL_CLICKWRAP_OK, isClickwrapOk); + model.addAttribute(MODEL_CLICKWRAP_ID, this.session.getClickwrapId()); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) { + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java new file mode 100644 index 00000000..c6741f8d --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java @@ -0,0 +1,99 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapSummaryResponse; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Create a clickwrap. + */ +@Controller +@RequestMapping("/c005") +public class C005ControllerCreateNewVersionClickwrap extends AbstractClickController { + + private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + + private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; + private static final Integer DOCUMENT_ORDER = 0; + private static final String DOCUMENT_NAME = "Terms of Service"; + + private final Session session; + private final User user; + + + @Autowired + public C005ControllerCreateNewVersionClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c005", "Create a new clickwrap version"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + model.addAttribute(MODEL_CLICKWRAP_OK, StringUtils.isNotBlank(this.session.getClickwrapId())); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws IOException, ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(); + + // Step 4: Call the v1 Click API + ClickwrapSummaryResponse createdClickwrap = accountsApi.createClickwrapVersion( + this.session.getAccountId(), + this.session.getClickwrapId(), + clickwrapRequest); + + this.session.setClickwrapId(createdClickwrap.getClickwrapId()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + DoneExample.createDefault(this.title) + .withJsonObject(createdClickwrap) + .withMessage("The new clickwrap version has been created!
" + + "Clickwrap ID " + createdClickwrap.getClickwrapId() + + ".
Version number " + createdClickwrap.getVersionNumber()) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + private ClickwrapRequest createClickwrapRequest() throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service v2") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true) + .documentDisplay("document"); + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName("Terms of Service") + .requireReacceptance(true) + .status(ClickwrapHelper.STATUS_ACTIVE) + .displaySettings(displaySettings); + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java new file mode 100644 index 00000000..a83d8ecb --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java @@ -0,0 +1,54 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.*; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Get a list of clickwraps. + */ +@Controller +@RequestMapping("/c006") +public class C006ControllerGetListClickwraps extends AbstractClickController { + + private final Session session; + private final User user; + + + @Autowired + public C006ControllerGetListClickwraps(DSConfiguration config, Session session, User user) { + super(config, "c006", "Get a list of clickwraps"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Call the v1 Click API + ClickwrapsResponse clickwrapsResponse = accountsApi.getClickwraps(this.session.getAccountId()); + + DoneExample.createDefault(this.title) + .withJsonObject(clickwrapsResponse) + .withMessage("Clickwraps have been returned!") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java new file mode 100644 index 00000000..40a9d54e --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java @@ -0,0 +1,55 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapAgreementsResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Get clickwrap responses. + */ +@Controller +@RequestMapping("/c007") +public class C007ControllerGetClickwrapResponses extends AbstractClickController { + + private final Session session; + private final User user; + + + @Autowired + public C007ControllerGetClickwrapResponses(DSConfiguration config, Session session, User user) { + super(config, "c007", "Get clickwrap responses"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Call the v1 Click API + ClickwrapAgreementsResponse clickwrapAgreementsResponse = accountsApi.getClickwrapAgreements( + this.session.getAccountId(), this.session.getClickwrapId()); + + DoneExample.createDefault(this.title) + .withJsonObject(clickwrapAgreementsResponse) + .withMessage("Clickwrap responses have been returned!") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java b/src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java new file mode 100644 index 00000000..7ae854cc --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java @@ -0,0 +1,46 @@ +package com.docusign.controller.click.examples; + +import com.docusign.click.model.Document; +import com.docusign.core.utils.FileUtils; +import org.apache.commons.io.FilenameUtils; + +import java.io.IOException; +import java.util.Base64; + +public class ClickwrapHelper { + + public static final String STATUS_ACTIVE = "active"; + + /** + * Loads document from a file and creates a document object that represents + * loaded document. + * @param fileName name of the file to load document; the extension of the + * loading file determines an extension of the created document + * @param docName the name of the document; it may be differ from the file + * @param order order of the created document + * @return the {@link Document} object + * @throws IOException if document cannot be loaded due to some reason + */ + public static Document createDocumentFromFile(String fileName, String docName, Integer order) throws IOException { + byte[] buffer = FileUtils.readFile(fileName); + String extension = FilenameUtils.getExtension(fileName); + return createDocument(buffer, docName, extension, order); + } + + /** + * Creates a document object from the raw data. + * @param data the raw data + * @param documentName the name of the document; it may be differ from the file + * @param fileExtension the extension of the creating file + * @param order order of the created document + * @return the {@link Document} object + */ + static Document createDocument(byte[] data, String documentName, String fileExtension, Integer order) { + Document document = new Document(); + document.setDocumentBase64(Base64.getEncoder().encodeToString(data)); + document.setDocumentName(documentName); + document.setFileExtension(fileExtension); + document.setOrder(order); + return document; + } +} diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index ab49b01f..785d763e 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -49,7 +49,6 @@ @Scope(WebApplicationContext.SCOPE_SESSION) public class GlobalControllerAdvice { - private static final String BASE_URI_SUFFIX = "/restapi"; private static final String ERROR_ACCOUNT_NOT_FOUND = "Could not find account information for the user"; private final DSConfiguration config; @@ -113,8 +112,8 @@ public Locals populateLocals() { session.setAccountId(oauthAccount.getAccountId()); session.setAccountName(oauthAccount.getAccountName()); //TODO set this more efficiently with more APIs as they're added in - String baseUrl = this.getBaseUrl(apiIndex, oauthAccount); - session.setBasePath(baseUrl + BASE_URI_SUFFIX); + String basePath = this.getBaseUrl(apiIndex, oauthAccount) + apiIndex.getBaseUrlSuffix(); + session.setBasePath(basePath); } return new Locals(config, session, user, ""); diff --git a/src/main/java/com/docusign/core/model/Session.java b/src/main/java/com/docusign/core/model/Session.java index 7b54e6dc..28256ec3 100644 --- a/src/main/java/com/docusign/core/model/Session.java +++ b/src/main/java/com/docusign/core/model/Session.java @@ -1,15 +1,14 @@ package com.docusign.core.model; import lombok.Data; - -import java.io.Serializable; -import java.util.List; - import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.ScopedProxyMode; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; +import java.io.Serializable; +import java.util.List; + @Component @Scope(value = WebApplicationContext.SCOPE_SESSION, @@ -30,5 +29,7 @@ public class Session implements Serializable { private String apiIndexPath; private AuthType authTypeSelected = AuthType.AGC; private boolean refreshToken = false; + private String clickwrapId; + private String clickwrapVersionNumber; } diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 4149cf41..3923d693 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -46,8 +46,8 @@ public ApiClient getApiClient() { public List getScopeByApiName(){ //Only signature scope is needed for eSIgnature api. Impersonation scope is implied. - return dsConfiguration.getApiName().equalsIgnoreCase(ApiIndex.ROOMS.toString()) ? - getScope() : - Arrays.asList(OAuth.Scope_SIGNATURE); + return dsConfiguration.getApiName().equalsIgnoreCase(ApiIndex.ESIGNATURE.toString()) ? + Arrays.asList(OAuth.Scope_SIGNATURE) : + getScope(); } } diff --git a/src/main/java/com/docusign/core/utils/FileUtils.java b/src/main/java/com/docusign/core/utils/FileUtils.java new file mode 100644 index 00000000..66dcb5cc --- /dev/null +++ b/src/main/java/com/docusign/core/utils/FileUtils.java @@ -0,0 +1,19 @@ +package com.docusign.core.utils; + +import org.springframework.core.io.ClassPathResource; +import org.springframework.util.StreamUtils; + +import java.io.IOException; + +public class FileUtils { + /** + * Loads a file content and copy it into a byte array. + * @param path the absolute path within the class path + * @return the new byte array that has been loaded from the file + * @throws IOException in case of I/O errors + */ + public static byte[] readFile(String path) throws IOException { + ClassPathResource resource = new ClassPathResource(path); + return StreamUtils.copyToByteArray(resource.getInputStream()); + } +} diff --git a/src/main/resources/TermsOfService.pdf b/src/main/resources/TermsOfService.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cbecb52e2085523b8e7463b9eb2acc6b4c81b2c5 GIT binary patch literal 27701 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 literal 0 HcmV?d00001 diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index cc9c09f5..86ed4204 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -7,7 +7,7 @@ "DS_API_NAME": "{API_NAME:(ESIGNATURE|ROOMS|CLICK)}", "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", - "DS_CLICK_BASE_PATH": "https://demo.rooms.docusign.com", + "DS_CLICK_BASE_PATH": "https://demo.docusign.net", "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp new file mode 100644 index 00000000..b93eea7c --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -0,0 +1,26 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

1. Creating a clickwrap.

+ +

This topic describes how to use DocuSign Click + to create a clickwrap that you can embed in your website or app.
+ To learn how to generate a clickwrap automatically by using the UI, see the Click User Guide. +

+

API methods used: + ClickWraps:createClickwrap. +

+

+ View source file ${sourceFile} on GitHub. +

+ +
+
+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp new file mode 100644 index 00000000..a2a8e1b2 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -0,0 +1,32 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

2. Activating a clickwrap.

+ +

This topic describes how to use DocuSign Click + to activate a new clickwrap that you have already created. + By default, new clickwraps are inactive. You must activate your clickwrap before you can use it. +

+

API methods used: + ClickWraps:updateClickwrapVersion. +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

The clickwrap you created via example 1 will be activated.

+
+ + +
+
+ +

Cannot find any clickwrap. Please first create a clickwrap using + example 1. +

+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp new file mode 100644 index 00000000..b85e0d8a --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -0,0 +1,29 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

3. Test a clickwrap.

+ +

Before you embed a clickwrap in your website or app, you should preview it to make sure + it appears and behaves the way you want. However, the web page in which you test your + clickwrap cannot be a local file that you open in a browser. The page must be hosted + on a web server. The DocuSign Clickwrap Tester takes care of this for you, making it easy + to preview the behavior and appearance of your clickwrap. +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

The clickwrap you created via example 1 will be tested.

+ Test clickwrap +
+ +

Cannot find any active clickwrap. Please first create a clickwrap using + example 1 and activate it using + example 2. +

+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp new file mode 100644 index 00000000..974d9385 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -0,0 +1,50 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

4. Embeding a clickwrap.

+ +

This topic describes how to use DocuSign Click + to embed an existing clickwrap in your website. It walks you through the process of + creating the JavaScript code you use to embed the clickwrap. + + You perform this step after you follow the steps in + How to create a clickwrap and + How to activate a clickwrap. + To learn how to automatically generate a clickwrap and its embed code by using the UI, + see the Click User Guide. +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

The clickwrap you created via example 1 will be embeded.

+
+
+ +
+ +

Cannot find any active clickwrap. Please first create a clickwrap using + example 1 and activate it using + example 2. +

+
+
+ + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp new file mode 100644 index 00000000..9cdbe7a0 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -0,0 +1,32 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

5. Creating a new clickwrap version.

+ +

This topic demonstrates how to use the Click API to create a new version of a clickwrap. + You can specify whether you require users who have previously accepted the clickwrap + to accept the new version when they return to your website. +

+

API methods used: + ClickWraps:updateClickwrapVersion +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

For the clickwrap you created via example 1 new version will be created.

+
+ + +
+
+ +

Cannot find any clickwrap. Please first create a clickwrap using + example 1. +

+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp new file mode 100644 index 00000000..c70e95b1 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp @@ -0,0 +1,23 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

6. Get a list of clickwraps.

+ +

This topic demonstrates how to use the Click API to get a list of clickwraps + associated with a specific DocuSign user. +

+

API methods used: + ClickWraps:getClickwraps +

+

+ View source file ${sourceFile} on GitHub. +

+ + +
+ + +
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp new file mode 100644 index 00000000..6fae7696 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp @@ -0,0 +1,23 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

7. Get clickwrap responses.

+ +

This topic demonstrates how to use the Click API to get user responses to + your clickwrap agreements. +

+

API methods used: + ClickWraps:getClickwrapAgreements +

+

+ View source file ${sourceFile} on GitHub. +

+ + +
+ + +
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index 4599adea..0ac01bb6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -30,11 +30,66 @@

Click Examples

1. Create a clickwrap

-

This example demonstrates creating a DocuSign room. +

This topic describes how to use DocuSign Click + to create a clickwrap that you can embed in your website or app.
+ To learn how to generate a clickwrap automatically by using the UI, see the Click User Guide.

API methods used: - Roles::GetRoles and - Rooms::CreateRoom. + ClickWraps:createClickwrap. +

+ +

2. Activate a clickwrap

+

This topic describes how to use DocuSign Click + to activate a new clickwrap that you have already created. + By default, new clickwraps are inactive. You must activate your clickwrap before you can use it. +

+

API methods used: + ClickWraps:updateClickwrapVersion +

+ +

3. Test a clickwrap

+

Before you embed a clickwrap in your website or app, you should preview it to make sure + it appears and behaves the way you want. However, the web page in which you test your + clickwrap cannot be a local file that you open in a browser. The page must be hosted + on a web server. The DocuSign Clickwrap Tester takes care of this for you, making it easy + to preview the behavior and appearance of your clickwrap. +

+ +

4. Embed a clickwrap

+

This topic describes how to use DocuSign Click + to embed an existing clickwrap in your website. It walks you through the process of + creating the JavaScript code you use to embed the clickwrap. + + You perform this step after you follow the steps in + How to create a clickwrap and + How to activate a clickwrap. + To learn how to automatically generate a clickwrap and its embed code by using the UI, + see the Click User Guide. +

+ +

5. How to create a new clickwrap version

+

This topic demonstrates how to use the Click API to create a new version of a clickwrap. + You can specify whether you require users who have previously accepted the clickwrap + to accept the new version when they return to your website. +

+

API methods used: + ClickWraps:updateClickwrapVersion +

+ +

6. Get a list of clickwraps

+

This topic demonstrates how to use the Click API to get a list of clickwraps + associated with a specific DocuSign user. +

+

API methods used: + ClickWraps:getClickwraps +

+ +

7. Get clickwrap responses

+

This topic demonstrates how to use the Click API to get user responses to + your clickwrap agreements. +

+

API methods used: + ClickWraps:getClickwrapAgreements

From 33c9a06fe9d45c66de0dfcc42441ae8b63a8e622 Mon Sep 17 00:00:00 2001 From: "Kharko, Yaryna" Date: Thu, 10 Dec 2020 13:02:58 +0200 Subject: [PATCH 086/699] Code tune --- README.md | 3 ++- .../jwt/JWTAuthorizationCodeResourceDetails.java | 11 +++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bf5291c0..19da03f8 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,8 @@ For more information about the scopes used for obtaining authorization to use th ## Click API -**Note:** to use the Click API you must also be ready authenticate with one of the workflows (https://developers.docusign.com/docs/click-api/click101/auth). + +For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) 1. **Create Clickwraps.** [Source.](./src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java) diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 3923d693..ede56388 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -1,13 +1,8 @@ package com.docusign.core.security.jwt; import com.docusign.DSConfiguration; -import com.docusign.common.ApiIndex; import com.docusign.core.exception.LauncherException; import com.docusign.esign.client.ApiClient; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - import com.docusign.esign.client.auth.OAuth; import lombok.Getter; import lombok.Setter; @@ -16,6 +11,10 @@ import org.springframework.security.oauth2.client.token.grant.redirect.AbstractRedirectResourceDetails; import org.springframework.util.FileCopyUtils; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + @Getter @Setter public class JWTAuthorizationCodeResourceDetails extends AbstractRedirectResourceDetails { @@ -46,7 +45,7 @@ public ApiClient getApiClient() { public List getScopeByApiName(){ //Only signature scope is needed for eSIgnature api. Impersonation scope is implied. - return dsConfiguration.getApiName().equalsIgnoreCase(ApiIndex.ESIGNATURE.toString()) ? + return dsConfiguration.getApiName().equalsIgnoreCase("esignature") ? Arrays.asList(OAuth.Scope_SIGNATURE) : getScope(); } From 4caf451f960c871456cd615cbe9f15d4bc2b5aa2 Mon Sep 17 00:00:00 2001 From: "Kharko, Yaryna" Date: Thu, 10 Dec 2020 13:18:42 +0200 Subject: [PATCH 087/699] Code tune --- .../controller/click/examples/AbstractClickController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index fcc7048c..bdf6d61f 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -44,9 +44,9 @@ protected static ApiClient createApiClient(String basePath, String userAccessTok } /** - * Creates a new instance of the RoomsApi. This method + * Creates a new instance of the ClickApi. This method * creates an instance of the ApiClient class silently. - * @param basePath URL to Rooms REST API + * @param basePath URL to Click REST API * @param userAccessToken user's access token * @return an instance of the {@link AccountsApi} */ @@ -57,7 +57,7 @@ protected static AccountsApi createAccountsApiClient(String basePath, String use /** * Determine if clickwrap is exists and is active. - * @param basePath URL to Rooms REST API + * @param basePath URL to Click API * @param userAccessToken user's access token * @param accountId user's account id * @param clickwrapId clickwrap's id From 681d61b8e5f77c252627475b2f6ebed425659123 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Thu, 10 Dec 2020 11:36:23 -0800 Subject: [PATCH 088/699] Add more details for Lombok directions w/ Eclipse and Intellij --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8a568b07..42a5c1a7 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,7 @@ For more information about the scopes used for obtaining authorization to use th 1. [Maven](https://maven.apache.org/download.cgi) 1. A name and email for a signer, and a name and email for a cc recipient. The signer and the cc email cannot be the same. + ### Nice to have 1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE @@ -226,7 +227,8 @@ For more information about the scopes used for obtaining authorization to use th 1. Add VM argument `-Dspring.profiles.active=dev` to your IDE 1. Note that IntelliJ IDEA Community Edition does not directly support Spring Boot applications. -1. [Optional] If you wish to add Lombok, search for and install the Lombok Annotations Plugin. If using Eclipse, download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. +1. [Optional] Install Lombok for your IDE (See below for details). + ### Build and run Launchers are built as a dedicated application with embedded TomCat server. Build: ``` bash @@ -241,10 +243,7 @@ $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ## IntelliJ Ultimate instructions - -The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) -can be used with the launcher. The IntelliJ Ultimate edition is -required due to its support for Spring Boot and JSP view pages. +The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** @@ -293,13 +292,15 @@ Under **Spring Boot** select the `Enable debug output` checkbox. Use a **Run** menu option to run or debug the launcher. -After the application finishes building, open your -browser to http://localhost:8080 +After the application finishes building, open your browser to http://localhost:8080 +### [Optional] Installing Lombok -## Eclipse instructions +Click File, then Settings. From there select `Plugins`. Open the Marketplace tab and type **Lombok**. It should have an author named Michail Plushnikov. Click install then restart IntelliJ. + +## Eclipse instructions **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the first step as it was automatically performed for you.** * Download or clone this repository. @@ -317,6 +318,7 @@ browser to http://localhost:8080 * Put in the following value for project: `code-examples-java`. * Put in the following value into the Main class: `com.docusign.App`. * Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080 +* [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter** ### Payments code example To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. From a1986c22b16ac5afa9768a8b13ed3b422f5cf9c4 Mon Sep 17 00:00:00 2001 From: Aaron Wilde Date: Thu, 10 Dec 2020 13:13:00 -0800 Subject: [PATCH 089/699] pr feedback comments --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42a5c1a7..ce0bb04c 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ For more information about the scopes used for obtaining authorization to use th 1. Add VM argument `-Dspring.profiles.active=dev` to your IDE 1. Note that IntelliJ IDEA Community Edition does not directly support Spring Boot applications. -1. [Optional] Install Lombok for your IDE (See below for details). +1. [Optional] Install Lombok for your IDE (See the IntelliJ or Eclipse instructions below for specific details). ### Build and run Launchers are built as a dedicated application with embedded TomCat server. Build: From 5574dbf29afabf6ce8ba4d3339c85e6f5003aec8 Mon Sep 17 00:00:00 2001 From: "Kharko, Yaryna" Date: Fri, 11 Dec 2020 13:07:38 +0200 Subject: [PATCH 090/699] Code tune --- .../controller/click/examples/AbstractClickController.java | 1 - .../click/examples/C001ControllerCreateClickwrap.java | 1 - .../click/examples/C002ControllerActivateClickwrap.java | 1 - .../controller/click/examples/C003ControllerTestClickwrap.java | 1 - .../controller/click/examples/C004ControllerEmbedClickwrap.java | 1 - .../click/examples/C005ControllerCreateNewVersionClickwrap.java | 2 -- .../click/examples/C006ControllerGetListClickwraps.java | 1 - .../click/examples/C007ControllerGetClickwrapResponses.java | 1 - .../WEB-INF/templates/views/pages/click/examples/c004.jsp | 2 +- 9 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index bdf6d61f..3d3537ad 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -11,7 +11,6 @@ import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; - /** * Abstract base class for all Click controllers. */ diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 3ff34e4e..3bfa8c0e 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -33,7 +33,6 @@ public class C001ControllerCreateClickwrap extends AbstractClickController { private final Session session; private final User user; - @Autowired public C001ControllerCreateClickwrap(DSConfiguration config, Session session, User user) { super(config, "c001", "Create a clickwrap"); diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index 16fca94e..e5221455 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -29,7 +29,6 @@ public class C002ControllerActivateClickwrap extends AbstractClickController { private final Session session; private final User user; - @Autowired public C002ControllerActivateClickwrap(DSConfiguration config, Session session, User user) { super(config, "c002", "Activate a clickwrap"); diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java index 12c50384..a69f57ab 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java @@ -24,7 +24,6 @@ public class C003ControllerTestClickwrap extends AbstractClickController { private final Session session; private final User user; - @Autowired public C003ControllerTestClickwrap(DSConfiguration config, Session session, User user) { super(config, "c003", "Embed a clickwrap"); diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java index c99ce87f..8bffbc39 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java @@ -24,7 +24,6 @@ public class C004ControllerEmbedClickwrap extends AbstractClickController { private final Session session; private final User user; - @Autowired public C004ControllerEmbedClickwrap(DSConfiguration config, Session session, User user) { super(config, "c004", "Embed a clickwrap"); diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java index c6741f8d..88dafc95 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java @@ -28,7 +28,6 @@ public class C005ControllerCreateNewVersionClickwrap extends AbstractClickController { private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; - private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; private static final Integer DOCUMENT_ORDER = 0; private static final String DOCUMENT_NAME = "Terms of Service"; @@ -36,7 +35,6 @@ public class C005ControllerCreateNewVersionClickwrap extends AbstractClickContro private final Session session; private final User user; - @Autowired public C005ControllerCreateNewVersionClickwrap(DSConfiguration config, Session session, User user) { super(config, "c005", "Create a new clickwrap version"); diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java index a83d8ecb..e55939e5 100644 --- a/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java @@ -26,7 +26,6 @@ public class C006ControllerGetListClickwraps extends AbstractClickController { private final Session session; private final User user; - @Autowired public C006ControllerGetListClickwraps(DSConfiguration config, Session session, User user) { super(config, "c006", "Get a list of clickwraps"); diff --git a/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java index 40a9d54e..355ca7ec 100644 --- a/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java @@ -26,7 +26,6 @@ public class C007ControllerGetClickwrapResponses extends AbstractClickController private final Session session; private final User user; - @Autowired public C007ControllerGetClickwrapResponses(DSConfiguration config, Session session, User user) { super(config, "c007", "Get clickwrap responses"); diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index 974d9385..ce7b5b80 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -19,7 +19,7 @@ -

The clickwrap you created via example 1 will be embeded.

+

The clickwrap you created via example 1 will be embedded.

Date: Mon, 14 Dec 2020 17:56:40 +0200 Subject: [PATCH 091/699] Code tune --- .../click/examples/C001ControllerCreateClickwrap.java | 1 + .../examples/C005ControllerCreateNewVersionClickwrap.java | 1 + .../WEB-INF/templates/views/pages/click/examples/c001.jsp | 4 ++-- .../WEB-INF/templates/views/pages/click/examples/c002.jsp | 4 ++-- .../WEB-INF/templates/views/pages/click/examples/c004.jsp | 8 ++++---- .../WEB-INF/templates/views/pages/click/examples/c005.jsp | 2 +- .../WEB-INF/templates/views/pages/click/examples/c006.jsp | 2 +- .../WEB-INF/templates/views/pages/click/examples/c007.jsp | 2 +- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 3bfa8c0e..86fea425 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -73,6 +73,7 @@ private ClickwrapRequest createClickwrapRequest(String clickwrapName) throws IOE .mustView(true) .requireAccept(true). documentDisplay("document"); + return new ClickwrapRequest() .addDocumentsItem(document) .clickwrapName(clickwrapName) diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java index 88dafc95..477eac3e 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java @@ -86,6 +86,7 @@ private ClickwrapRequest createClickwrapRequest() throws IOException { .mustView(true) .requireAccept(true) .documentDisplay("document"); + return new ClickwrapRequest() .addDocumentsItem(document) .clickwrapName("Terms of Service") diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index b93eea7c..7701e3b1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -3,12 +3,12 @@

1. Creating a clickwrap.

-

This topic describes how to use DocuSign Click +

This topic describes how to use DocuSign Click to create a clickwrap that you can embed in your website or app.
To learn how to generate a clickwrap automatically by using the UI, see the Click User Guide.

API methods used: - ClickWraps:createClickwrap. + ClickWraps:createClickwrap.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index a2a8e1b2..dfe292ee 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -3,12 +3,12 @@

2. Activating a clickwrap.

-

This topic describes how to use DocuSign Click +

This topic describes how to use DocuSign Click to activate a new clickwrap that you have already created. By default, new clickwraps are inactive. You must activate your clickwrap before you can use it.

API methods used: - ClickWraps:updateClickwrapVersion. + ClickWraps:updateClickwrapVersion.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index ce7b5b80..3cebf104 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -3,15 +3,15 @@

4. Embeding a clickwrap.

-

This topic describes how to use DocuSign Click +

This topic describes how to use DocuSign Click to embed an existing clickwrap in your website. It walks you through the process of creating the JavaScript code you use to embed the clickwrap. You perform this step after you follow the steps in - How to create a clickwrap and - How to activate a clickwrap. + How to create a clickwrap and + How to activate a clickwrap. To learn how to automatically generate a clickwrap and its embed code by using the UI, - see the Click User Guide. + see the Click User Guide.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index 9cdbe7a0..a88dbc63 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -8,7 +8,7 @@ to accept the new version when they return to your website.

API methods used: - ClickWraps:updateClickwrapVersion + ClickWraps:updateClickwrapVersion

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp index c70e95b1..2455609e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp @@ -7,7 +7,7 @@ associated with a specific DocuSign user.

API methods used: - ClickWraps:getClickwraps + ClickWraps:getClickwraps

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp index 6fae7696..0590a391 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp @@ -7,7 +7,7 @@ your clickwrap agreements.

API methods used: - ClickWraps:getClickwrapAgreements + ClickWraps:getClickwrapAgreements

View source file ${sourceFile} on GitHub. From 4f0a98dd9a933a49bd81017292af73192d5fe7fc Mon Sep 17 00:00:00 2001 From: "Kharko, Yaryna" Date: Mon, 14 Dec 2020 17:59:06 +0200 Subject: [PATCH 092/699] Code tune --- .../WEB-INF/templates/views/pages/click/examples/c002.jsp | 4 ++-- .../WEB-INF/templates/views/pages/click/examples/c003.jsp | 4 ++-- .../WEB-INF/templates/views/pages/click/examples/c004.jsp | 4 ++-- .../WEB-INF/templates/views/pages/click/examples/c005.jsp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index dfe292ee..24e34455 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -8,7 +8,7 @@ By default, new clickwraps are inactive. You must activate your clickwrap before you can use it.

API methods used: - ClickWraps:updateClickwrapVersion. + ClickWraps:updateClickwrapVersion.

View source file ${sourceFile} on GitHub. @@ -24,7 +24,7 @@

Cannot find any clickwrap. Please first create a clickwrap using - example 1. + example 1.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index b85e0d8a..87aac222 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -20,8 +20,8 @@

Cannot find any active clickwrap. Please first create a clickwrap using - example 1 and activate it using - example 2. + example 1 and activate it using + example 2.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index 3cebf104..6ea9b034 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -29,8 +29,8 @@

Cannot find any active clickwrap. Please first create a clickwrap using - example 1 and activate it using - example 2. + example 1 and activate it using + example 2.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index a88dbc63..3ee5f8c2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -24,7 +24,7 @@

Cannot find any clickwrap. Please first create a clickwrap using - example 1. + example 1.

From fd9063678d98daef3d6126fca727fee2b8e8b6d4 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Fri, 18 Dec 2020 11:58:06 -0800 Subject: [PATCH 093/699] Removing dll that only functions on Windows --- src/main/java/com/docusign/App.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index f9ec5082..a0959d07 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -12,11 +12,5 @@ public class App { public static void main(String[] args) throws IOException { SpringApplication.run(App.class, args); - openHomePage(); - } - - private static void openHomePage() throws IOException { - Runtime rt = Runtime.getRuntime(); - rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); } } From 41bb6282c69952ecdfe3bbc273b7a27d7a486257 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Fri, 18 Dec 2020 12:39:25 -0800 Subject: [PATCH 094/699] detecting the user's os and acting accordingly --- src/main/java/com/docusign/App.java | 17 ++++++++++++++++- src/main/java/com/docusign/OSDetector.java | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/docusign/OSDetector.java diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index a0959d07..1106cdac 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -12,5 +12,20 @@ public class App { public static void main(String[] args) throws IOException { SpringApplication.run(App.class, args); + openHomePage(); } -} + + private static void openHomePage() throws IOException { + if (OSDetector.isMac()){ + Runtime rt = Runtime.getRuntime(); + String[] arguments = { "osascript", "-e", "open location \"" + "http://localhost:5000" + "\"" }; + rt.exec(arguments); + } + else { + Runtime rt = Runtime.getRuntime(); + rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); + } + + } + +} \ No newline at end of file diff --git a/src/main/java/com/docusign/OSDetector.java b/src/main/java/com/docusign/OSDetector.java new file mode 100644 index 00000000..b590b2a5 --- /dev/null +++ b/src/main/java/com/docusign/OSDetector.java @@ -0,0 +1,21 @@ +package com.docusign; + +public class OSDetector +{ + private static boolean isWindows; + private static boolean isLinux; + private static boolean isMac; + + static + { + String os = System.getProperty("os.name").toLowerCase(); + isWindows = os.contains("win"); + isLinux = os.contains("nux") || os.contains("nix"); + isMac = os.contains("mac"); + } + + public static boolean isWindows() { return isWindows; } + public static boolean isLinux() { return isLinux; } + public static boolean isMac() { return isMac; }; + +} \ No newline at end of file From fcf8c8d1e3cd65e84dd2508489789aa1bb66980e Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Fri, 18 Dec 2020 14:26:27 -0800 Subject: [PATCH 095/699] fixing error with port --- src/main/java/com/docusign/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index 1106cdac..9ab0468c 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -18,7 +18,7 @@ public static void main(String[] args) throws IOException { private static void openHomePage() throws IOException { if (OSDetector.isMac()){ Runtime rt = Runtime.getRuntime(); - String[] arguments = { "osascript", "-e", "open location \"" + "http://localhost:5000" + "\"" }; + String[] arguments = { "osascript", "-e", "open location \"" + "http://localhost:8080" + "\"" }; rt.exec(arguments); } else { From 3ed7637a3362ef854e2ea01302647b3184fe56c7 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Fri, 18 Dec 2020 14:50:43 -0800 Subject: [PATCH 096/699] adding comments and Linux handling --- src/main/java/com/docusign/App.java | 18 ++++++++++++------ src/main/java/com/docusign/OSDetector.java | 4 ++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index 9ab0468c..dcbf8424 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -6,7 +6,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; - @SpringBootApplication(exclude={JmxAutoConfiguration.class}) public class App { @@ -16,16 +15,23 @@ public static void main(String[] args) throws IOException { } private static void openHomePage() throws IOException { + // Each operating system opens web browsers differently so we need to determine the user's + // OS and open a browser to the example homepage accordingly. + Runtime rt = Runtime.getRuntime(); if (OSDetector.isMac()){ - Runtime rt = Runtime.getRuntime(); String[] arguments = { "osascript", "-e", "open location \"" + "http://localhost:8080" + "\"" }; rt.exec(arguments); } - else { - Runtime rt = Runtime.getRuntime(); + else if (OSDetector.isWindows()){ rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); } + else if (OSDetector.isLinux()){ + String [] browsers = {"firefox", "safari", "chrome", "mozilla"}; + StringBuffer cmd = new StringBuffer(); + for (int i=0; i Date: Tue, 5 Jan 2021 08:42:18 -0800 Subject: [PATCH 097/699] remove explicit declaration to version (#19) --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index f2270fad..ded11ee4 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,6 @@ com.fasterxml.jackson.datatype jackson-datatype-joda - 2.8.7 From ea763b548728b4934ba78d240d53041aab8da14a Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Tue, 5 Jan 2021 18:59:21 -0800 Subject: [PATCH 098/699] fix conversion mismatch compilation errors --- code-examples-java.iml | 119 ------------------ pom.xml | 2 +- .../examples/AbstractClickController.java | 4 +- .../C001ControllerCreateClickwrap.java | 4 +- .../C002ControllerActivateClickwrap.java | 2 +- ...05ControllerCreateNewVersionClickwrap.java | 4 +- .../C006ControllerGetListClickwraps.java | 2 +- 7 files changed, 9 insertions(+), 128 deletions(-) delete mode 100644 code-examples-java.iml diff --git a/code-examples-java.iml b/code-examples-java.iml deleted file mode 100644 index a02202cc..00000000 --- a/code-examples-java.iml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index f3081506..66f10bb2 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 2.6 3.8.0 1.0.0 - 1.0.0-alpha + 1.0.0-BETA diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index 3d3537ad..6bf53c8b 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -5,7 +5,7 @@ import com.docusign.click.client.ApiClient; import com.docusign.click.client.ApiException; import com.docusign.click.client.auth.OAuth; -import com.docusign.click.model.ClickwrapResponse; +import com.docusign.click.model.ClickwrapVersionResponse; import com.docusign.core.controller.AbstractController; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpHeaders; @@ -69,7 +69,7 @@ protected boolean isClickwrapExistsAndActive(String basePath, String userAccessT if (StringUtils.isNotBlank(clickwrapId)) { AccountsApi accountsApi = this.createAccountsApiClient(basePath, userAccessToken); - ClickwrapResponse clickwrapResponse = accountsApi.getClickwrap(accountId, clickwrapId); + ClickwrapVersionResponse clickwrapResponse = accountsApi.getClickwrap(accountId, clickwrapId); isClickwrapOk = clickwrapResponse.getClickwrapId().equals(clickwrapId) && clickwrapResponse.getStatus().equals(ClickwrapHelper.STATUS_ACTIVE); diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 86fea425..db3ecdc4 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -4,7 +4,7 @@ import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; import com.docusign.click.model.ClickwrapRequest; -import com.docusign.click.model.ClickwrapSummaryResponse; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; import com.docusign.click.model.DisplaySettings; import com.docusign.click.model.Document; import com.docusign.common.WorkArguments; @@ -51,7 +51,7 @@ protected Object doWork(WorkArguments args, ModelMap model, ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(args.getClickwrapName()); // Step 4: Call the v1 Click API - ClickwrapSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); + ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index e5221455..bf74b88f 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -53,7 +53,7 @@ protected Object doWork(WorkArguments args, ModelMap model, ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE); // Step 4: Call the v1 Click API - ClickwrapSummaryResponse updatedClickwrap = accountsApi.updateClickwrapVersion( + ClickwrapVersionSummaryResponse updatedClickwrap = accountsApi.updateClickwrapVersion( this.session.getAccountId(), this.session.getClickwrapId(), this.session.getClickwrapVersionNumber(), diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java index 477eac3e..2b94f66d 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java @@ -4,7 +4,7 @@ import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; import com.docusign.click.model.ClickwrapRequest; -import com.docusign.click.model.ClickwrapSummaryResponse; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; import com.docusign.click.model.DisplaySettings; import com.docusign.click.model.Document; import com.docusign.common.WorkArguments; @@ -59,7 +59,7 @@ protected Object doWork(WorkArguments args, ModelMap model, ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(); // Step 4: Call the v1 Click API - ClickwrapSummaryResponse createdClickwrap = accountsApi.createClickwrapVersion( + ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrapVersion( this.session.getAccountId(), this.session.getClickwrapId(), clickwrapRequest); diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java index e55939e5..13e2cc46 100644 --- a/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java @@ -41,7 +41,7 @@ protected Object doWork(WorkArguments args, ModelMap model, AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Call the v1 Click API - ClickwrapsResponse clickwrapsResponse = accountsApi.getClickwraps(this.session.getAccountId()); + ClickwrapVersionsResponse clickwrapsResponse = accountsApi.getClickwraps(this.session.getAccountId()); DoneExample.createDefault(this.title) .withJsonObject(clickwrapsResponse) From 7fa230a3ec5d9530c8d3cdd1ed347fe9a769d810 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Tue, 5 Jan 2021 19:46:18 -0800 Subject: [PATCH 099/699] delete ex 3,4 and updated README and click index --- ...3ControllerCreateNewVersionClickwrap.java} | 0 .../examples/C003ControllerTestClickwrap.java | 60 ------------------- .../C004ControllerEmbedClickwrap.java | 55 ----------------- ...a => C004ControllerGetListClickwraps.java} | 0 ... C005ControllerGetClickwrapResponses.java} | 0 .../views/pages/click/examples/c003.jsp | 25 ++++---- .../views/pages/click/examples/c004.jsp | 49 ++++----------- .../views/pages/click/examples/c005.jsp | 29 ++++----- .../views/pages/click/examples/c006.jsp | 23 ------- .../views/pages/click/examples/c007.jsp | 23 ------- 10 files changed, 35 insertions(+), 229 deletions(-) rename src/main/java/com/docusign/controller/click/examples/{C005ControllerCreateNewVersionClickwrap.java => C003ControllerCreateNewVersionClickwrap.java} (100%) delete mode 100644 src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java delete mode 100644 src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java rename src/main/java/com/docusign/controller/click/examples/{C006ControllerGetListClickwraps.java => C004ControllerGetListClickwraps.java} (100%) rename src/main/java/com/docusign/controller/click/examples/{C007ControllerGetClickwrapResponses.java => C005ControllerGetClickwrapResponses.java} (100%) delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java similarity index 100% rename from src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java rename to src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java deleted file mode 100644 index a69f57ab..00000000 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.docusign.controller.click.examples; - -import com.docusign.DSConfiguration; -import com.docusign.common.WorkArguments; -import com.docusign.core.model.Session; -import com.docusign.core.model.User; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; - -import javax.servlet.http.HttpServletResponse; - -/** - * Embed a clickwrap. - */ -@Controller -@RequestMapping("/c003") -public class C003ControllerTestClickwrap extends AbstractClickController { - - private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; - private static final String MODEL_TEST_CLICKWRAP_URL = "testClickwrapUrl"; - - private final Session session; - private final User user; - - @Autowired - public C003ControllerTestClickwrap(DSConfiguration config, Session session, User user) { - super(config, "c003", "Embed a clickwrap"); - this.session = session; - this.user = user; - } - - @Override - protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { - super.onInitModel(args, model); - - boolean isClickwrapOk = this.isClickwrapExistsAndActive( - this.session.getBasePath(), - this.user.getAccessToken(), - this.session.getAccountId(), - this.session.getClickwrapId()); - - model.addAttribute(MODEL_CLICKWRAP_OK, isClickwrapOk); - model.addAttribute(MODEL_TEST_CLICKWRAP_URL, this.getTestClickWrapUrl()); - } - - @Override - // ***DS.snippet.0.start - protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) { - return DONE_EXAMPLE_PAGE; - } - - private String getTestClickWrapUrl() { - return "https://developers.docusign.com/click-api/test-clickwrap/?" + - "a=" + this.session.getAccountId() + "&cw=" + this.session.getClickwrapId() + "&eh=demo"; - } - // ***DS.snippet.0.end -} diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java deleted file mode 100644 index 8bffbc39..00000000 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.docusign.controller.click.examples; - -import com.docusign.DSConfiguration; -import com.docusign.common.WorkArguments; -import com.docusign.core.model.Session; -import com.docusign.core.model.User; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; - -import javax.servlet.http.HttpServletResponse; - -/** - * Embed a clickwrap. - */ -@Controller -@RequestMapping("/c004") -public class C004ControllerEmbedClickwrap extends AbstractClickController { - - private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; - private static final String MODEL_CLICKWRAP_ID = "clickwrapId"; - - private final Session session; - private final User user; - - @Autowired - public C004ControllerEmbedClickwrap(DSConfiguration config, Session session, User user) { - super(config, "c004", "Embed a clickwrap"); - this.session = session; - this.user = user; - } - - @Override - protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { - super.onInitModel(args, model); - - boolean isClickwrapOk = this.isClickwrapExistsAndActive( - this.session.getBasePath(), - this.user.getAccessToken(), - this.session.getAccountId(), - this.session.getClickwrapId()); - - model.addAttribute(MODEL_CLICKWRAP_OK, isClickwrapOk); - model.addAttribute(MODEL_CLICKWRAP_ID, this.session.getClickwrapId()); - } - - @Override - // ***DS.snippet.0.start - protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) { - return DONE_EXAMPLE_PAGE; - } - // ***DS.snippet.0.end -} diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java similarity index 100% rename from src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java rename to src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java diff --git a/src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java similarity index 100% rename from src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java rename to src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 87aac222..3ee5f8c2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -1,13 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

3. Test a clickwrap.

+

5. Creating a new clickwrap version.

-

Before you embed a clickwrap in your website or app, you should preview it to make sure - it appears and behaves the way you want. However, the web page in which you test your - clickwrap cannot be a local file that you open in a browser. The page must be hosted - on a web server. The DocuSign Clickwrap Tester takes care of this for you, making it easy - to preview the behavior and appearance of your clickwrap. +

This topic demonstrates how to use the Click API to create a new version of a clickwrap. + You can specify whether you require users who have previously accepted the clickwrap + to accept the new version when they return to your website. +

+

API methods used: + ClickWraps:updateClickwrapVersion

View source file ${sourceFile} on GitHub. @@ -15,13 +16,15 @@ -

The clickwrap you created via example 1 will be tested.

- Test clickwrap +

For the clickwrap you created via example 1 new version will be created.

+
+ + +
-

Cannot find any active clickwrap. Please first create a clickwrap using - example 1 and activate it using - example 2. +

Cannot find any clickwrap. Please first create a clickwrap using + example 1.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index 6ea9b034..2455609e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -1,50 +1,23 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

4. Embeding a clickwrap.

+

6. Get a list of clickwraps.

-

This topic describes how to use DocuSign Click - to embed an existing clickwrap in your website. It walks you through the process of - creating the JavaScript code you use to embed the clickwrap. - - You perform this step after you follow the steps in - How to create a clickwrap and - How to activate a clickwrap. - To learn how to automatically generate a clickwrap and its embed code by using the UI, - see the Click User Guide. +

This topic demonstrates how to use the Click API to get a list of clickwraps + associated with a specific DocuSign user. +

+

API methods used: + ClickWraps:getClickwraps

View source file ${sourceFile} on GitHub.

- - -

The clickwrap you created via example 1 will be embedded.

-
-
- -
- -

Cannot find any active clickwrap. Please first create a clickwrap using - example 1 and activate it using - example 2. -

-
-
- - +
+ + +
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index 3ee5f8c2..0590a391 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -1,32 +1,23 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

5. Creating a new clickwrap version.

+

7. Get clickwrap responses.

-

This topic demonstrates how to use the Click API to create a new version of a clickwrap. - You can specify whether you require users who have previously accepted the clickwrap - to accept the new version when they return to your website. +

This topic demonstrates how to use the Click API to get user responses to + your clickwrap agreements.

API methods used: - ClickWraps:updateClickwrapVersion + ClickWraps:getClickwrapAgreements

View source file ${sourceFile} on GitHub.

- - -

For the clickwrap you created via example 1 new version will be created.

-
- - -
-
- -

Cannot find any clickwrap. Please first create a clickwrap using - example 1. -

-
-
+ +
+ + +
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp deleted file mode 100644 index 2455609e..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - -

6. Get a list of clickwraps.

- -

This topic demonstrates how to use the Click API to get a list of clickwraps - associated with a specific DocuSign user. -

-

API methods used: - ClickWraps:getClickwraps -

-

- View source file ${sourceFile} on GitHub. -

- - -
- - -
- - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp deleted file mode 100644 index 0590a391..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c007.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - -

7. Get clickwrap responses.

- -

This topic demonstrates how to use the Click API to get user responses to - your clickwrap agreements. -

-

API methods used: - ClickWraps:getClickwrapAgreements -

-

- View source file ${sourceFile} on GitHub. -

- - -
- - -
- - - \ No newline at end of file From 142ff448129ea5e58ca1b18476840821e0c06826 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Wed, 6 Jan 2021 13:05:04 -0800 Subject: [PATCH 100/699] PR suggestions and other fixes --- README.md | 12 +- code-examples-java.iml | 121 ++++++++++++++++++ .../C001ControllerCreateClickwrap.java | 6 +- ...03ControllerCreateNewVersionClickwrap.java | 8 +- .../C004ControllerGetListClickwraps.java | 8 +- .../C005ControllerGetClickwrapResponses.java | 8 +- .../templates/views/pages/click/index.jsp | 26 +--- 7 files changed, 142 insertions(+), 47 deletions(-) create mode 100644 code-examples-java.iml diff --git a/README.md b/README.md index 196520d4..141f57d1 100644 --- a/README.md +++ b/README.md @@ -181,20 +181,14 @@ For more information about the scopes used for obtaining authorization to use th 1. **Activate Clickwrap.** [Source.](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) This example shows how to activate a new clickwrap that you have already created.. -1. **Test Clickwrap.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C003ControllerTestClickwrap.java) - This example shows how to test a newly create clickwrap. -1. **Clickwrap Embeding.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C004ControllerEmbedClickwrap.java) - This example shows how to embed a clickwrap into a page. 1. **Clickwrap Versioning.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C005ControllerCreateNewVersionClickwrap.java) + [Source.](./src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java) This example shows how to create a new clickwrap version. 1. **Get a list of Clickwraps.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C006ControllerGetListClickwraps.java) + [Source.](./src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java) This example shows how to get a list of clickwraps. 1. **Get Clickwrap Responses.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C007ControllerGetClickwrapResponses.java) + [Source.](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) This example shows how to get clickwrap responses. ## Included OAuth grant types: diff --git a/code-examples-java.iml b/code-examples-java.iml new file mode 100644 index 00000000..b6e203ff --- /dev/null +++ b/code-examples-java.iml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index db3ecdc4..99676eea 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -44,13 +44,13 @@ public C001ControllerCreateClickwrap(DSConfiguration config, Session session, Us // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - // Step 2: Construct your API headers + // Step 2. Construct your API headers AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Construct the request body for your clickwrap + // Step 3. Construct the request body for your clickwrap ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(args.getClickwrapName()); - // Step 4: Call the v1 Click API + // Step 4. Call the v1 Click API ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index 2b94f66d..284e2802 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -24,8 +24,8 @@ * Create a clickwrap. */ @Controller -@RequestMapping("/c005") -public class C005ControllerCreateNewVersionClickwrap extends AbstractClickController { +@RequestMapping("/c003") +public class C003ControllerCreateNewVersionClickwrap extends AbstractClickController { private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; @@ -36,8 +36,8 @@ public class C005ControllerCreateNewVersionClickwrap extends AbstractClickContro private final User user; @Autowired - public C005ControllerCreateNewVersionClickwrap(DSConfiguration config, Session session, User user) { - super(config, "c005", "Create a new clickwrap version"); + public C003ControllerCreateNewVersionClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c003", "Create a new clickwrap version"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index 13e2cc46..18725d4a 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -20,15 +20,15 @@ * Get a list of clickwraps. */ @Controller -@RequestMapping("/c006") -public class C006ControllerGetListClickwraps extends AbstractClickController { +@RequestMapping("/c004") +public class C004ControllerGetListClickwraps extends AbstractClickController { private final Session session; private final User user; @Autowired - public C006ControllerGetListClickwraps(DSConfiguration config, Session session, User user) { - super(config, "c006", "Get a list of clickwraps"); + public C004ControllerGetListClickwraps(DSConfiguration config, Session session, User user) { + super(config, "c004", "Get a list of clickwraps"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index 355ca7ec..0ff8a185 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -20,15 +20,15 @@ * Get clickwrap responses. */ @Controller -@RequestMapping("/c007") -public class C007ControllerGetClickwrapResponses extends AbstractClickController { +@RequestMapping("/c005") +public class C005ControllerGetClickwrapResponses extends AbstractClickController { private final Session session; private final User user; @Autowired - public C007ControllerGetClickwrapResponses(DSConfiguration config, Session session, User user) { - super(config, "c007", "Get clickwrap responses"); + public C005ControllerGetClickwrapResponses(DSConfiguration config, Session session, User user) { + super(config, "c005", "Get clickwrap responses"); this.session = session; this.user = user; } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index 0ac01bb6..0983548a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -47,27 +47,7 @@ ClickWraps:updateClickwrapVersion

-

3. Test a clickwrap

-

Before you embed a clickwrap in your website or app, you should preview it to make sure - it appears and behaves the way you want. However, the web page in which you test your - clickwrap cannot be a local file that you open in a browser. The page must be hosted - on a web server. The DocuSign Clickwrap Tester takes care of this for you, making it easy - to preview the behavior and appearance of your clickwrap. -

- -

4. Embed a clickwrap

-

This topic describes how to use DocuSign Click - to embed an existing clickwrap in your website. It walks you through the process of - creating the JavaScript code you use to embed the clickwrap. - - You perform this step after you follow the steps in - How to create a clickwrap and - How to activate a clickwrap. - To learn how to automatically generate a clickwrap and its embed code by using the UI, - see the Click User Guide. -

- -

5. How to create a new clickwrap version

+

3. How to create a new clickwrap version

This topic demonstrates how to use the Click API to create a new version of a clickwrap. You can specify whether you require users who have previously accepted the clickwrap to accept the new version when they return to your website. @@ -76,7 +56,7 @@ ClickWraps:updateClickwrapVersion

-

6. Get a list of clickwraps

+

4. Get a list of clickwraps

This topic demonstrates how to use the Click API to get a list of clickwraps associated with a specific DocuSign user.

@@ -84,7 +64,7 @@ ClickWraps:getClickwraps

-

7. Get clickwrap responses

+

5. Get clickwrap responses

This topic demonstrates how to use the Click API to get user responses to your clickwrap agreements.

From 8c4ea27566eaf4821c55da130f36bfd32b4fdca1 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Wed, 6 Jan 2021 13:08:11 -0800 Subject: [PATCH 101/699] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 141f57d1..273825b1 100644 --- a/README.md +++ b/README.md @@ -177,19 +177,19 @@ For more information about the scopes used for obtaining authorization to use th 1. **Create Clickwraps.** [Source.](./src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java) - This example shows how to create a clickwrap. + This code example shows how to create a clickwrap. 1. **Activate Clickwrap.** [Source.](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) - This example shows how to activate a new clickwrap that you have already created.. + This code example shows how to activate a new clickwrap that you have already created.. 1. **Clickwrap Versioning.** [Source.](./src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java) - This example shows how to create a new clickwrap version. + This code example shows how to create a new clickwrap version. 1. **Get a list of Clickwraps.** [Source.](./src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java) - This example shows how to get a list of clickwraps. + This code example shows how to get a list of clickwraps. 1. **Get Clickwrap Responses.** [Source.](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) - This example shows how to get clickwrap responses. + This code example shows how to get clickwrap responses. ## Included OAuth grant types: From 48ebeef64d733bac5541b6ccf7ffa9748eccac99 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Wed, 6 Jan 2021 13:08:53 -0800 Subject: [PATCH 102/699] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 273825b1..08a2235b 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ For more information about the scopes used for obtaining authorization to use th This code example shows how to create a clickwrap. 1. **Activate Clickwrap.** [Source.](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) - This code example shows how to activate a new clickwrap that you have already created.. + This code example shows how to activate a new clickwrap that you have already created. 1. **Clickwrap Versioning.** [Source.](./src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java) This code example shows how to create a new clickwrap version. From 7a19c0698ba3a9fc24a4cea012a38c25b49861dc Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Wed, 6 Jan 2021 13:17:45 -0800 Subject: [PATCH 103/699] PR comment fixes --- src/main/java/com/docusign/WebSecurityConfig.java | 2 +- .../controller/click/examples/AbstractClickController.java | 6 ++---- .../controller/rooms/examples/AbstractRoomsController.java | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 3f0f8c6e..a8a6cbf5 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -35,7 +35,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public String roomScopes[] = new String[] {"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}; - public String clickScopes[] = new String[] {"signature", "click.manage", "click.send"}; + public String clickScopes[] = new String[] {"click.manage", "click.send"}; @Autowired private DSConfiguration dsConfiguration; diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index 6bf53c8b..accbdcdd 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -29,15 +29,13 @@ protected String getExamplePagesPath() { /** * Creates new instance of the Click API client. - * @param basePath URL to eSignature REST API + * @param basePath URL to Click REST API * @param userAccessToken user's access token * @return an instance of the {@link ApiClient} */ protected static ApiClient createApiClient(String basePath, String userAccessToken) { ApiClient apiClient = new ApiClient(basePath); apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken); - // it is a workaround to NPE, see DSPW-61 - // apiClient.addAuthorization("docusignAccessCode", null); apiClient.addAuthorization("docusignAccessCode", new OAuth()); return apiClient; } @@ -55,7 +53,7 @@ protected static AccountsApi createAccountsApiClient(String basePath, String use } /** - * Determine if clickwrap is exists and is active. + * Checks a clickwrap and return true IF clickwrap exists and is activated. * @param basePath URL to Click API * @param userAccessToken user's access token * @param accountId user's account id diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index a1f375f5..177cea75 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -41,8 +41,6 @@ protected String getExamplePagesPath() { protected static ApiClient createApiClient(String basePath, String userAccessToken) { ApiClient apiClient = new ApiClient(basePath); apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken); - // it is a workaround to NPE, see DSPW-61 - // apiClient.addAuthorization("docusignAccessCode", null); apiClient.addAuthorization("docusignAccessCode", new OAuth()); return apiClient; } From 284377792af22f1147ef3e1d5e4926dd24ff443f Mon Sep 17 00:00:00 2001 From: Yaryna Kimak <64064514+yarynakimak@users.noreply.github.com> Date: Fri, 8 Jan 2021 19:00:14 +0200 Subject: [PATCH 104/699] Click examples (#16) * Install sdk, update launcher * Added Click code examples * Code tune * Code tune * Code tune * Code tune * Code tune * fix conversion mismatch compilation errors * delete ex 3,4 and updated README and click index * PR suggestions and other fixes * Update README.md * Update README.md * PR comment fixes Co-authored-by: Kharko, Yaryna Co-authored-by: Aaron JacksonWilde Co-authored-by: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> --- README.md | 706 +++++++++--------- code-examples-java.iml | 16 +- pom.xml | 7 + .../java/com/docusign/DSConfiguration.java | 3 + .../java/com/docusign/WebSecurityConfig.java | 39 +- .../java/com/docusign/common/ApiIndex.java | 13 +- .../com/docusign/common/WorkArguments.java | 2 +- .../examples/AbstractClickController.java | 79 ++ .../C001ControllerCreateClickwrap.java | 84 +++ .../C002ControllerActivateClickwrap.java | 69 ++ ...03ControllerCreateNewVersionClickwrap.java | 98 +++ .../C004ControllerGetListClickwraps.java | 53 ++ .../C005ControllerGetClickwrapResponses.java | 54 ++ .../click/examples/ClickwrapHelper.java | 46 ++ .../examples/AbstractRoomsController.java | 2 - .../controller/GlobalControllerAdvice.java | 15 +- .../java/com/docusign/core/model/Session.java | 9 +- .../JWTAuthorizationCodeResourceDetails.java | 15 +- .../com/docusign/core/utils/FileUtils.java | 19 + src/main/resources/TermsOfService.pdf | Bin 0 -> 27701 bytes src/main/resources/application.example.json | 3 +- .../views/pages/click/examples/c001.jsp | 26 + .../views/pages/click/examples/c002.jsp | 32 + .../views/pages/click/examples/c003.jsp | 32 + .../views/pages/click/examples/c004.jsp | 23 + .../views/pages/click/examples/c005.jsp | 23 + .../templates/views/pages/click/index.jsp | 80 ++ 27 files changed, 1169 insertions(+), 379 deletions(-) create mode 100644 src/main/java/com/docusign/controller/click/examples/AbstractClickController.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java create mode 100644 src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java create mode 100644 src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java create mode 100644 src/main/java/com/docusign/core/utils/FileUtils.java create mode 100644 src/main/resources/TermsOfService.pdf create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp diff --git a/README.md b/README.md index ce0bb04c..08a2235b 100644 --- a/README.md +++ b/README.md @@ -1,336 +1,370 @@ -# Java Launcher Code Examples - -Github repo: https://github.com/docusign/code-examples-java - -This GitHub repo includes code example for both the DocuSign eSignature REST API as well as the DocuSign Rooms API. - -To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the vlue to `ROOMS`. - -**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). - -## Introduction -This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the -[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. - -The [Spring Boot security Oauth2 boot autoconfigure package](https://github.com/spring-projects/spring-security-oauth2-boot/blob/master/spring-security-oauth2-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateCustomizer.java) is used for authentication. - -The OAuth library is used in the file [WebSecurityConfig.java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/WebSecurityConfig.java). - -## eSignature API - -For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). - - -1. **Use embedded signing.** - [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) - This example sends an envelope, and then uses embedded signing for the first signer. - With embedded signing, DocuSign signing is initiated from your website. -1. **Send an envelope with a remote (email) signer and cc recipient.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) - The envelope includes a pdf, Word, and HTML document. - Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. -1. **List envelopes in the user's account.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java) -1. **Get an envelope's basic information.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java) - The example lists the basic information about an envelope, including its overall status. -1. **List an envelope's recipients and their current status.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) -1. **List an envelope's documents.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) -1. **Download an envelope's documents.** The example can download individual - documents, the documents concatenated together, or a zip file of the documents. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) -1. **Programmatically create a template.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) -1. **Send an envelope using a template.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) -1. **Send an envelope and upload its documents with multipart binary transfer.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) - Binary transfer is 33% more efficient than using Base64 encoding. -1. **Use embedded sending.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) -1. **Embedded DocuSign web tool (NDSE).** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) -1. **Use embedded signing from a template with an added document.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) - This example sends an envelope based on a template. - In addition to the template's document(s), the example adds an - additional document to the envelope by using the - [Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates) - feature. -1. **Payments example: an order form, with online payment by credit card.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java) -1. **Get the envelope tab data.** - Retrieve the tab (field) values for all of the envelope's recipients. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java) -1. **Set envelope tab values.** - The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs - are set to be read-only, others can be updated by the recipient. The example also stores - metadata with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java) -1. **Set template tab values.** - The example creates an envelope using a template and sets the initial values for its tabs (fields). - The example also stores metadata with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java) -1. **Get the envelope custom field data (metadata).** - The example retrieves the custom metadata (custom data fields) stored with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java) -1. **Requiring an Access Code for a Recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java) - This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. -1. **Requiring SMS authentication for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java) - This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. -1. **Requiring Phone authentication for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java) - This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. -1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java) - This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication. -1. **Requiring ID Verification (IDV) for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java) - This example sends and envelope that requires the recipient to upload a government issued id. -1. **Creating a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java) - This code example demonstrates how to create a user group's permission profile using the [Create Profile](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/create) method. -1. **Setting a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java) - This code example demonstrates how to set a user group's permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method. - You must have already created permissions profile and group of users. -1. **Updating individual permission settings** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java) - This code example demonstrates how to update individual settings for a specific permission profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method. - You must have already created permissions profile and group of users. -1. **Deleting a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java) - This code example demonstrates how to an account's permission profile using the [Delete AccountPermissionProfiles](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/delete) method. -1. **Creating a brand** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java) - This example creates brand profile for an account using the [Create Brand](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountBrands/create) method. -1. **Applying a brand to an envelope** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java) - This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. - First, creates the envelope and then applies brand to it. - Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. -1. **Applying a brand to a template** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) - This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. - You must have at least one created template and brand. -1. **Bulk sending envelopes to multiple recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) - This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. -1. **Pausing a signature workflow Source.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. -1. **Unpausing a signature workflow** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) - This code example demonstrates how to resume an envelope workflow that has been paused -1. **Using conditional recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) - This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction. - -1. **Сreating an envelope where the workflow is paused** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. - -1. **Resuming an envelope workflow that has been paused** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) - This code example demonstrates how to resume an envelope workflow that has been paused. - -1. **Use conditional recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. - -## Rooms API - -For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). - -**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. - - -1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) - This code example creates a new room in your DocuSign Rooms account to be used for a transaction. -1. **Create a room from a template.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) - This code example creates a new room using a template. -1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportDataFromRoom.java) - This code example exports all the avialalble data from a specific room in your DocuSign Rooms account. -1. **Add forms to a room.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) - This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account. -1. **How to search for rooms with filters.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) - This code example searches for rooms in your DocuSign Rooms account using a specific filter. -1. **Create an external form fillable session.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) - This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. - - -## Installation - -### Prerequisites -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 1 and 2 below as they're automatically performed for you.** - -1. A DocuSign developer account (email and password) on [demo.docusign.net](https://demo.docusign.net). - Create a [free account](https://go.docusign.com/sandbox/productshot/?elqCampaignId=16533). -1. A DocuSign Integration Key (a client ID) that is configured to use the - OAuth Authorization Code flow. - You will need the **Integration Key** itself, and its **secret**. To - use JSON Web token, you will need the **Integration Key** itself, the - **RSA Secret Key** and an API user ID for the user you are impersonating. - - If you use this launcher on your own workstation, - the Integration key must include following **Redirect URI**s: - * http://localhost:8080/login&type=acg - * http://localhost:8080/login&type=jwt - - If you will not be running the launcher on your own workstation, - use the appropriate DNS name and port instead of `localhost:8080`. - A sample Redirect URI: http://myserver.it.mycompany.com/login - -1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later -1. [Maven](https://maven.apache.org/download.cgi) -1. A name and email for a signer, and a name and email for a cc recipient. - The signer and the cc email cannot be the same. - -### Nice to have -1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE - -#### Authorization Code Grant specifics: - You will need the integration key and its secret. The integration key must include a redirect URI of - - {app_url}/login&type=acg - where {app_url} is the URL you have associated with the folder where the source files are located. - For example, if you have created a web server that enables the URL - - http://localhost:8080/ - - to execute files on the /public folder of this example, then you must add a redirect URI to your integration key with the value - http://localhost:8080/login&type=acg - -#### JWT (JSON Web Token) specifics: - You will need the integration key, an RSA private key, and the user ID (GUID) of the impersonated user. - The private part of the RSA key pair must be copied over and stored in a private.key file located in `src\main\resources\private.key`. - - **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. - - -### Installation steps -1. Download or clone this repository. -1. The project includes a Maven pom file. - -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** -1. Add VM argument `-Dspring.profiles.active=dev` to your IDE -1. Note that IntelliJ IDEA Community Edition does not directly support - Spring Boot applications. -1. [Optional] Install Lombok for your IDE (See the IntelliJ or Eclipse instructions below for specific details). - -### Build and run -Launchers are built as a dedicated application with embedded TomCat server. Build: -``` bash -$ cd code-examples-java -$ mvn package -``` -Run: -``` bash -$ cd target -$ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war -``` - - -## IntelliJ Ultimate instructions -The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. - -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** - -**Step 1.** Download or clone the -[code-examples-java](https://github.com/docusign/code-examples-java) - repository - -**Step 2.** Start IntelliJ Ultimate and choose the **Open or Import** option. - -![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) - -**Step 3.** Use the popup file chooser to select -**code-examples-java** or your unzipped Quickstart directory. - -**Step 4.** The **Import Project** wizard will open. It's a -series of screens. On the first screen, select -**Import project from external model** and **Maven**. - -![IntelliJ Import Maven project](./docs/install_fig_2.png) - -**Step 5.** Click **Finish** and the project will -be displayed in the IDE. - -### Configuring IntelliJ's *Run/Debug Configuration* -IntelliJ uses **Run/Debug Configuration** to manage -settings for running the launcher. - -Set up a Run/Debug Configuration for the launcher: - -Step 1. Use the menu command **Run > Edit configurations...** -to open the configuration manager. - -Step 2. Click the **+** (plus) sign to add a new configuration. -The configuration type is **Spring Boot**. You may need to -open the additional templates section of the template chooser. - -Step 3. Update the form with the **Name** of the -configuration to `code-examples-java` and the **Main class** for the configuration, -`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. - -Under **Spring Boot** select the `Enable debug output` checkbox. - -![Configure a Run configuration](./docs/install_fig_7.png) - -### Running or debugging the launcher - -Use a **Run** menu option to run or debug the launcher. - -After the application finishes building, open your browser to http://localhost:8080 - - -### [Optional] Installing Lombok - -Click File, then Settings. From there select `Plugins`. Open the Marketplace tab and type **Lombok**. It should have an author named Michail Plushnikov. Click install then restart IntelliJ. - - -## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the first step as it was automatically performed for you.** - -* Download or clone this repository. -* Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. -* For the Root directory, Browse for and select this same repo `code-examples-java`. -* Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. -* Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration to clean and compile with the following: - * Name the configuration `build` (If You have downloaded the launcher via Quickstart, skip this step). - * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. - * Put in the following values into the Goals field: `clean package`. -* Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. -* Click apply to save. -* Finally, create another configuration by again using `Run->Run Configurations`, choosing Java Application Configuration with the following: - * Name the configuration `run` (If You have downloaded the launcher via Quickstart, skip this step). - * Put in the following value for project: `code-examples-java`. - * Put in the following value into the Main class: `com.docusign.App`. -* Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080 -* [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter** - -### Payments code example -To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. - -Then add the payment gateway account id to the **application.json** file. - - -## License and additional information - -### License -This repository uses the MIT License. See the LICENSE file for more information. - -### Pull Requests -Pull requests are welcomed. Pull requests will only be considered if their content -uses the MIT License. +# Java Launcher Code Examples + +Github repo: https://github.com/docusign/code-examples-java + +This GitHub repo includes code example for the DocuSign eSignature REST API, for the DocuSign Rooms API and for the Click API. + +To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `ROOMS`. +To use the Click API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `CLICK`. + +**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). + +## Introduction +This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the +[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. + +The [Spring Boot security Oauth2 boot autoconfigure package](https://github.com/spring-projects/spring-security-oauth2-boot/blob/master/spring-security-oauth2-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateCustomizer.java) is used for authentication. + +The OAuth library is used in the file [WebSecurityConfig.java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/WebSecurityConfig.java). + +## eSignature API + +For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). + + +1. **Use embedded signing.** + [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) + This example sends an envelope, and then uses embedded signing for the first signer. + With embedded signing, DocuSign signing is initiated from your website. +1. **Send an envelope with a remote (email) signer and cc recipient.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) + The envelope includes a pdf, Word, and HTML document. + Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. +1. **List envelopes in the user's account.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java) +1. **Get an envelope's basic information.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java) + The example lists the basic information about an envelope, including its overall status. +1. **List an envelope's recipients and their current status.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) +1. **List an envelope's documents.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) +1. **Download an envelope's documents.** The example can download individual + documents, the documents concatenated together, or a zip file of the documents. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) +1. **Programmatically create a template.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) +1. **Send an envelope using a template.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) +1. **Send an envelope and upload its documents with multipart binary transfer.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) + Binary transfer is 33% more efficient than using Base64 encoding. +1. **Use embedded sending.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) +1. **Embedded DocuSign web tool (NDSE).** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) +1. **Use embedded signing from a template with an added document.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) + This example sends an envelope based on a template. + In addition to the template's document(s), the example adds an + additional document to the envelope by using the + [Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates) + feature. +1. **Payments example: an order form, with online payment by credit card.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java) +1. **Get the envelope tab data.** + Retrieve the tab (field) values for all of the envelope's recipients. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java) +1. **Set envelope tab values.** + The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs + are set to be read-only, others can be updated by the recipient. The example also stores + metadata with the envelope. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java) +1. **Set template tab values.** + The example creates an envelope using a template and sets the initial values for its tabs (fields). + The example also stores metadata with the envelope. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java) +1. **Get the envelope custom field data (metadata).** + The example retrieves the custom metadata (custom data fields) stored with the envelope. + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java) +1. **Requiring an Access Code for a Recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java) + This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. +1. **Requiring SMS authentication for a recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java) + This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. +1. **Requiring Phone authentication for a recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java) + This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. +1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java) + This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication. +1. **Requiring ID Verification (IDV) for a recipient** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java) + This example sends and envelope that requires the recipient to upload a government issued id. +1. **Creating a permission profile** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java) + This code example demonstrates how to create a user group's permission profile using the [Create Profile](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/create) method. +1. **Setting a permission profile** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java) + This code example demonstrates how to set a user group's permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method. + You must have already created permissions profile and group of users. +1. **Updating individual permission settings** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java) + This code example demonstrates how to update individual settings for a specific permission profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method. + You must have already created permissions profile and group of users. +1. **Deleting a permission profile** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java) + This code example demonstrates how to an account's permission profile using the [Delete AccountPermissionProfiles](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/delete) method. +1. **Creating a brand** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java) + This example creates brand profile for an account using the [Create Brand](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountBrands/create) method. +1. **Applying a brand to an envelope** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java) + This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. + First, creates the envelope and then applies brand to it. + Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. +1. **Applying a brand to a template** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) + This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. + You must have at least one created template and brand. +1. **Bulk sending envelopes to multiple recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) + This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. +1. **Pausing a signature workflow Source.** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. +1. **Unpausing a signature workflow** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) + This code example demonstrates how to resume an envelope workflow that has been paused +1. **Using conditional recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) + This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction. + +1. **Сreating an envelope where the workflow is paused** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + +1. **Resuming an envelope workflow that has been paused** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) + This code example demonstrates how to resume an envelope workflow that has been paused. + +1. **Use conditional recipients** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) + This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + +## Rooms API + +For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). + +**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. + + +1. **Create room with Data.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) + This code example creates a new room in your DocuSign Rooms account to be used for a transaction. +1. **Create a room from a template.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) + This code example creates a new room using a template. +1. **Create room with Data.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportDataFromRoom.java) + This code example exports all the avialalble data from a specific room in your DocuSign Rooms account. +1. **Add forms to a room.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) + This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account. +1. **How to search for rooms with filters.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) + This code example searches for rooms in your DocuSign Rooms account using a specific filter. +1. **Create an external form fillable session.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) + This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. + This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. + + +## Click API + +For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) + +1. **Create Clickwraps.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java) + This code example shows how to create a clickwrap. +1. **Activate Clickwrap.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) + This code example shows how to activate a new clickwrap that you have already created. +1. **Clickwrap Versioning.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java) + This code example shows how to create a new clickwrap version. +1. **Get a list of Clickwraps.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java) + This code example shows how to get a list of clickwraps. +1. **Get Clickwrap Responses.** + [Source.](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) + This code example shows how to get clickwrap responses. + +## Included OAuth grant types: + +* Authentication with Docusign via [Authorization Code Grant flow](https://developers.docusign.com/platform/auth/authcode) . +When the token expires, the user is asked to re-authenticate. +The **refresh token** is not used in this example. + +* Authentication with DocuSign via the [JSON Web Token (JWT) Grant](https://developers.docusign.com/platform/auth/jwt/). +When the token expires, it updates automatically. + + **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. + + +## Installation + +### Prerequisites +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 1 and 2 below as they're automatically performed for you.** + +1. A DocuSign developer account (email and password) on [demo.docusign.net](https://demo.docusign.net). + Create a [free account](https://go.docusign.com/sandbox/productshot/?elqCampaignId=16533). +1. A DocuSign Integration Key (a client ID) that is configured to use the + OAuth Authorization Code flow. + You will need the **Integration Key** itself, and its **secret**. To + use JSON Web token, you will need the **Integration Key** itself, the + **RSA Secret Key** and an API user ID for the user you are impersonating. + + If you use this launcher on your own workstation, + the Integration key must include following **Redirect URI**s: + * http://localhost:8080/login&type=acg + * http://localhost:8080/login&type=jwt + + If you will not be running the launcher on your own workstation, + use the appropriate DNS name and port instead of `localhost:8080`. + A sample Redirect URI: http://myserver.it.mycompany.com/login + +1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later +1. [Maven](https://maven.apache.org/download.cgi) +1. A name and email for a signer, and a name and email for a cc recipient. + The signer and the cc email cannot be the same. + +### Nice to have +1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE + +#### Authorization Code Grant specifics: + You will need the integration key and its secret. The integration key must include a redirect URI of + + {app_url}/login&type=acg + where {app_url} is the URL you have associated with the folder where the source files are located. + For example, if you have created a web server that enables the URL + + http://localhost:8080/ + + to execute files on the /public folder of this example, then you must add a redirect URI to your integration key with the value + http://localhost:8080/login&type=acg + +#### JWT (JSON Web Token) specifics: + You will need the integration key, an RSA private key, and the user ID (GUID) of the impersonated user. + The private part of the RSA key pair must be copied over and stored in a private.key file located in `src\main\resources\private.key`. + + **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. + + +### Installation steps +1. Download or clone this repository. +1. The project includes a Maven pom file. + +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** +1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** +1. Add VM argument `-Dspring.profiles.active=dev` to your IDE +1. Note that IntelliJ IDEA Community Edition does not directly support + Spring Boot applications. +1. [Optional] Install Lombok for your IDE (See the IntelliJ or Eclipse instructions below for specific details). + +### Build and run +Launchers are built as a dedicated application with embedded TomCat server. Build: +``` bash +$ cd code-examples-java +$ mvn package +``` +Run: +``` bash +$ cd target +$ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war +``` + + +## IntelliJ Ultimate instructions +The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. + +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** + +**Step 1.** Download or clone the +[code-examples-java](https://github.com/docusign/code-examples-java) + repository + +**Step 2.** Start IntelliJ Ultimate and choose the **Open or Import** option. + +![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) + +**Step 3.** Use the popup file chooser to select +**code-examples-java** or your unzipped Quickstart directory. + +**Step 4.** The **Import Project** wizard will open. It's a +series of screens. On the first screen, select +**Import project from external model** and **Maven**. + +![IntelliJ Import Maven project](./docs/install_fig_2.png) + +**Step 5.** Click **Finish** and the project will +be displayed in the IDE. + +### Configuring IntelliJ's *Run/Debug Configuration* +IntelliJ uses **Run/Debug Configuration** to manage +settings for running the launcher. + +Set up a Run/Debug Configuration for the launcher: + +Step 1. Use the menu command **Run > Edit configurations...** +to open the configuration manager. + +Step 2. Click the **+** (plus) sign to add a new configuration. +The configuration type is **Spring Boot**. You may need to +open the additional templates section of the template chooser. + +Step 3. Update the form with the **Name** of the +configuration to `code-examples-java` and the **Main class** for the configuration, +`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. + +Under **Spring Boot** select the `Enable debug output` checkbox. + +![Configure a Run configuration](./docs/install_fig_7.png) + +### Running or debugging the launcher + +Use a **Run** menu option to run or debug the launcher. + +After the application finishes building, open your browser to http://localhost:8080 + + +### [Optional] Installing Lombok + +Click File, then Settings. From there select `Plugins`. Open the Marketplace tab and type **Lombok**. It should have an author named Michail Plushnikov. Click install then restart IntelliJ. + + +## Eclipse instructions +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the first step as it was automatically performed for you.** + +* Download or clone this repository. +* Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. +* For the Root directory, Browse for and select this same repo `code-examples-java`. +* Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. +* Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration to clean and compile with the following: + * Name the configuration `build` (If You have downloaded the launcher via Quickstart, skip this step). + * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. + * Put in the following values into the Goals field: `clean package`. +* Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. +* Click apply to save. +* Finally, create another configuration by again using `Run->Run Configurations`, choosing Java Application Configuration with the following: + * Name the configuration `run` (If You have downloaded the launcher via Quickstart, skip this step). + * Put in the following value for project: `code-examples-java`. + * Put in the following value into the Main class: `com.docusign.App`. +* Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080 +* [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter** + +### Payments code example +To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. + +Then add the payment gateway account id to the **application.json** file. + + +## License and additional information + +### License +This repository uses the MIT License. See the LICENSE file for more information. + +### Pull Requests +Pull requests are welcomed. Pull requests will only be considered if their content +uses the MIT License. diff --git a/code-examples-java.iml b/code-examples-java.iml index a02202cc..b6e203ff 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -1,9 +1,6 @@ - - - @@ -11,6 +8,9 @@ + + + @@ -74,6 +74,9 @@ + + + @@ -81,7 +84,7 @@ - + @@ -102,7 +105,6 @@ - @@ -112,8 +114,8 @@ - - + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index ded11ee4..2b067d60 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ 2.6 3.8.0 1.0.0 + 1.0.0-BETA @@ -90,6 +91,12 @@ docusign-rooms-java ${rooms.version} + + + com.docusign + docusign-click-java + ${click.version} + diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index d7bf3a70..0579cadf 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -30,6 +30,9 @@ public class DSConfiguration { @Value("${DS_ROOMS_BASE_PATH}") private String roomsBasePath; + @Value("${DS_CLICK_BASE_PATH}") + private String clickBasePath; + @Value("${DS_SIGNER_EMAIL:{USER_EMAIL}}") private String signerEmail; diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 542faa83..a8a6cbf5 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -26,16 +26,17 @@ import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter; import org.springframework.web.filter.CompositeFilter; +import javax.servlet.Filter; import java.util.Arrays; import java.util.List; -import javax.servlet.Filter; @EnableOAuth2Client @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public String roomScopes[] = new String[] {"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}; - + public String clickScopes[] = new String[] {"click.manage", "click.send"}; + @Autowired private DSConfiguration dsConfiguration; @@ -82,16 +83,26 @@ public FilterRegistrationBean oAuth2ClientFilterRegis return registration; } + private List getScopes() { + List scopes = null; + if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { + scopes = Arrays.asList(this.roomScopes); + } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("click")) { + scopes = Arrays.asList(this.clickScopes); + } + + return scopes; + } + private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { OAuth2SsoProperties authCodeGrantSso = authCodeGrantSso(); AuthorizationCodeResourceDetails authCodeGrantClient = authCodeGrantClient(); - - if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { - authCodeGrantClient.setScope(Arrays.asList(roomScopes)); - } - - + List scopes = this.getScopes(); + if (scopes != null) { + authCodeGrantClient.setScope(scopes); + } + ResourceServerProperties userInfoResource = userInfoResource(); OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(authCodeGrantSso.getLoginPath()); @@ -106,12 +117,12 @@ private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { private OAuth2ClientAuthenticationProcessingFilter jwtGrantFilter() { OAuth2SsoProperties authCodeGrantSso = jwtGrantSso(); JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = jwtCodeGrantClient(); - - if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { - jwtCodeGrantClient.setScope(Arrays.asList(roomScopes)); - - } - + + List scopes = this.getScopes(); + if (scopes != null) { + jwtCodeGrantClient.setScope(scopes); + } + OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(authCodeGrantSso.getLoginPath()); OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index 1b27d1eb..3d4c110d 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -1,13 +1,20 @@ package com.docusign.common; public enum ApiIndex { - ESIGNATURE("/pages/esignature/index"), - ROOMS("/pages/rooms/index"); + ESIGNATURE("/pages/esignature/index", "/restapi"), + ROOMS("/pages/rooms/index", "/restapi"), + CLICK("/pages/click/index", "/clickapi"); private final String indexPath; + private final String baseUrlSuffix; - ApiIndex(final String indexPath) { + ApiIndex(final String indexPath, final String baseUrlSuffix) { this.indexPath = indexPath; + this.baseUrlSuffix = baseUrlSuffix; + } + + public String getBaseUrlSuffix() { + return baseUrlSuffix; } @Override diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index faf44e5d..222e61af 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -5,7 +5,6 @@ import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; -import java.time.LocalDate; import java.util.UUID; @@ -19,6 +18,7 @@ public class WorkArguments { private String signerName; private String ccEmail; private String ccName; + private String clickwrapName; private String signerEmail2; private String signerName2; private String ccEmail2; diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java new file mode 100644 index 00000000..accbdcdd --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -0,0 +1,79 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiClient; +import com.docusign.click.client.ApiException; +import com.docusign.click.client.auth.OAuth; +import com.docusign.click.model.ClickwrapVersionResponse; +import com.docusign.core.controller.AbstractController; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Controller; + +/** + * Abstract base class for all Click controllers. + */ +@Controller +public abstract class AbstractClickController extends AbstractController { + + private static final String EXAMPLE_PAGES_PATH = "pages/click/examples/"; + + public AbstractClickController(DSConfiguration config, String exampleName, String title) { + super(config, exampleName, title); + } + + protected String getExamplePagesPath() { + return AbstractClickController.EXAMPLE_PAGES_PATH; + } + + /** + * Creates new instance of the Click API client. + * @param basePath URL to Click REST API + * @param userAccessToken user's access token + * @return an instance of the {@link ApiClient} + */ + protected static ApiClient createApiClient(String basePath, String userAccessToken) { + ApiClient apiClient = new ApiClient(basePath); + apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken); + apiClient.addAuthorization("docusignAccessCode", new OAuth()); + return apiClient; + } + + /** + * Creates a new instance of the ClickApi. This method + * creates an instance of the ApiClient class silently. + * @param basePath URL to Click REST API + * @param userAccessToken user's access token + * @return an instance of the {@link AccountsApi} + */ + protected static AccountsApi createAccountsApiClient(String basePath, String userAccessToken) { + ApiClient apiClient = createApiClient(basePath, userAccessToken); + return new AccountsApi(apiClient); + } + + /** + * Checks a clickwrap and return true IF clickwrap exists and is activated. + * @param basePath URL to Click API + * @param userAccessToken user's access token + * @param accountId user's account id + * @param clickwrapId clickwrap's id + * @return an boolean value + */ + protected boolean isClickwrapExistsAndActive(String basePath, String userAccessToken, + String accountId, String clickwrapId) throws ApiException { + boolean isClickwrapOk = false; + + if (StringUtils.isNotBlank(clickwrapId)) { + + AccountsApi accountsApi = this.createAccountsApiClient(basePath, userAccessToken); + ClickwrapVersionResponse clickwrapResponse = accountsApi.getClickwrap(accountId, clickwrapId); + + isClickwrapOk = clickwrapResponse.getClickwrapId().equals(clickwrapId) && + clickwrapResponse.getStatus().equals(ClickwrapHelper.STATUS_ACTIVE); + } + + return isClickwrapOk; + } +} + diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java new file mode 100644 index 00000000..99676eea --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -0,0 +1,84 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Create a clickwrap. + */ +@Controller +@RequestMapping("/c001") +public class C001ControllerCreateClickwrap extends AbstractClickController { + + private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; + private static final Integer DOCUMENT_ORDER = 0; + private static final String DOCUMENT_NAME = "Terms of Service"; + + private final Session session; + private final User user; + + @Autowired + public C001ControllerCreateClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c001", "Create a clickwrap"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws IOException, ApiException { + // Step 2. Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3. Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(args.getClickwrapName()); + + // Step 4. Call the v1 Click API + ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); + + this.session.setClickwrapId(createdClickwrap.getClickwrapId()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + DoneExample.createDefault(this.title) + .withJsonObject(createdClickwrap) + .withMessage("The clickwrap has been created!
Clickwrap ID " + createdClickwrap.getClickwrapId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + private ClickwrapRequest createClickwrapRequest(String clickwrapName) throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true). + documentDisplay("document"); + + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName(clickwrapName) + .requireReacceptance(true) + .displaySettings(displaySettings); + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java new file mode 100644 index 00000000..bf74b88f --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -0,0 +1,69 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.*; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Activate a clickwrap. + */ +@Controller +@RequestMapping("/c002") +public class C002ControllerActivateClickwrap extends AbstractClickController { + + private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + + private final Session session; + private final User user; + + @Autowired + public C002ControllerActivateClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c002", "Activate a clickwrap"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + model.addAttribute(MODEL_CLICKWRAP_OK, StringUtils.isNotBlank(this.session.getClickwrapId())); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE); + + // Step 4: Call the v1 Click API + ClickwrapVersionSummaryResponse updatedClickwrap = accountsApi.updateClickwrapVersion( + this.session.getAccountId(), + this.session.getClickwrapId(), + this.session.getClickwrapVersionNumber(), + clickwrapRequest); + + DoneExample.createDefault(this.title) + .withJsonObject(updatedClickwrap) + .withMessage("The clickwrap has been activated!
Clickwrap ID " + updatedClickwrap.getClickwrapId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java new file mode 100644 index 00000000..284e2802 --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -0,0 +1,98 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Create a clickwrap. + */ +@Controller +@RequestMapping("/c003") +public class C003ControllerCreateNewVersionClickwrap extends AbstractClickController { + + private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; + private static final Integer DOCUMENT_ORDER = 0; + private static final String DOCUMENT_NAME = "Terms of Service"; + + private final Session session; + private final User user; + + @Autowired + public C003ControllerCreateNewVersionClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c003", "Create a new clickwrap version"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + model.addAttribute(MODEL_CLICKWRAP_OK, StringUtils.isNotBlank(this.session.getClickwrapId())); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws IOException, ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(); + + // Step 4: Call the v1 Click API + ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrapVersion( + this.session.getAccountId(), + this.session.getClickwrapId(), + clickwrapRequest); + + this.session.setClickwrapId(createdClickwrap.getClickwrapId()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + DoneExample.createDefault(this.title) + .withJsonObject(createdClickwrap) + .withMessage("The new clickwrap version has been created!
" + + "Clickwrap ID " + createdClickwrap.getClickwrapId() + + ".
Version number " + createdClickwrap.getVersionNumber()) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + private ClickwrapRequest createClickwrapRequest() throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service v2") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true) + .documentDisplay("document"); + + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName("Terms of Service") + .requireReacceptance(true) + .status(ClickwrapHelper.STATUS_ACTIVE) + .displaySettings(displaySettings); + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java new file mode 100644 index 00000000..18725d4a --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -0,0 +1,53 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.*; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Get a list of clickwraps. + */ +@Controller +@RequestMapping("/c004") +public class C004ControllerGetListClickwraps extends AbstractClickController { + + private final Session session; + private final User user; + + @Autowired + public C004ControllerGetListClickwraps(DSConfiguration config, Session session, User user) { + super(config, "c004", "Get a list of clickwraps"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Call the v1 Click API + ClickwrapVersionsResponse clickwrapsResponse = accountsApi.getClickwraps(this.session.getAccountId()); + + DoneExample.createDefault(this.title) + .withJsonObject(clickwrapsResponse) + .withMessage("Clickwraps have been returned!") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java new file mode 100644 index 00000000..0ff8a185 --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -0,0 +1,54 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapAgreementsResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Get clickwrap responses. + */ +@Controller +@RequestMapping("/c005") +public class C005ControllerGetClickwrapResponses extends AbstractClickController { + + private final Session session; + private final User user; + + @Autowired + public C005ControllerGetClickwrapResponses(DSConfiguration config, Session session, User user) { + super(config, "c005", "Get clickwrap responses"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + // Step 3: Call the v1 Click API + ClickwrapAgreementsResponse clickwrapAgreementsResponse = accountsApi.getClickwrapAgreements( + this.session.getAccountId(), this.session.getClickwrapId()); + + DoneExample.createDefault(this.title) + .withJsonObject(clickwrapAgreementsResponse) + .withMessage("Clickwrap responses have been returned!") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java b/src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java new file mode 100644 index 00000000..7ae854cc --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/ClickwrapHelper.java @@ -0,0 +1,46 @@ +package com.docusign.controller.click.examples; + +import com.docusign.click.model.Document; +import com.docusign.core.utils.FileUtils; +import org.apache.commons.io.FilenameUtils; + +import java.io.IOException; +import java.util.Base64; + +public class ClickwrapHelper { + + public static final String STATUS_ACTIVE = "active"; + + /** + * Loads document from a file and creates a document object that represents + * loaded document. + * @param fileName name of the file to load document; the extension of the + * loading file determines an extension of the created document + * @param docName the name of the document; it may be differ from the file + * @param order order of the created document + * @return the {@link Document} object + * @throws IOException if document cannot be loaded due to some reason + */ + public static Document createDocumentFromFile(String fileName, String docName, Integer order) throws IOException { + byte[] buffer = FileUtils.readFile(fileName); + String extension = FilenameUtils.getExtension(fileName); + return createDocument(buffer, docName, extension, order); + } + + /** + * Creates a document object from the raw data. + * @param data the raw data + * @param documentName the name of the document; it may be differ from the file + * @param fileExtension the extension of the creating file + * @param order order of the created document + * @return the {@link Document} object + */ + static Document createDocument(byte[] data, String documentName, String fileExtension, Integer order) { + Document document = new Document(); + document.setDocumentBase64(Base64.getEncoder().encodeToString(data)); + document.setDocumentName(documentName); + document.setFileExtension(fileExtension); + document.setOrder(order); + return document; + } +} diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index a1f375f5..177cea75 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -41,8 +41,6 @@ protected String getExamplePagesPath() { protected static ApiClient createApiClient(String basePath, String userAccessToken) { ApiClient apiClient = new ApiClient(basePath); apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken); - // it is a workaround to NPE, see DSPW-61 - // apiClient.addAuthorization("docusignAccessCode", null); apiClient.addAuthorization("docusignAccessCode", new OAuth()); return apiClient; } diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 93d89342..785d763e 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -49,7 +49,6 @@ @Scope(WebApplicationContext.SCOPE_SESSION) public class GlobalControllerAdvice { - private static final String BASE_URI_SUFFIX = "/restapi"; private static final String ERROR_ACCOUNT_NOT_FOUND = "Could not find account information for the user"; private final DSConfiguration config; @@ -113,13 +112,23 @@ public Locals populateLocals() { session.setAccountId(oauthAccount.getAccountId()); session.setAccountName(oauthAccount.getAccountName()); //TODO set this more efficiently with more APIs as they're added in - String baseUrl = config.getApiName().equalsIgnoreCase("rooms") ? config.getRoomsBasePath() : oauthAccount.getBaseUri(); - session.setBasePath(baseUrl + BASE_URI_SUFFIX); + String basePath = this.getBaseUrl(apiIndex, oauthAccount) + apiIndex.getBaseUrlSuffix(); + session.setBasePath(basePath); } return new Locals(config, session, user, ""); } + private String getBaseUrl(ApiIndex apiIndex, OAuth.Account oauthAccount) { + if (apiIndex.equals(ApiIndex.ROOMS)) { + return this.config.getRoomsBasePath(); + } else if (apiIndex.equals(ApiIndex.CLICK)) { + return this.config.getClickBasePath(); + } else { + return oauthAccount.getBaseUri(); + } + } + @SuppressWarnings("unchecked") private static List getOAuthAccounts(OAuth2Authentication oauth) { Map userAuthenticationDetails = (Map) oauth.getUserAuthentication().getDetails(); diff --git a/src/main/java/com/docusign/core/model/Session.java b/src/main/java/com/docusign/core/model/Session.java index 7b54e6dc..28256ec3 100644 --- a/src/main/java/com/docusign/core/model/Session.java +++ b/src/main/java/com/docusign/core/model/Session.java @@ -1,15 +1,14 @@ package com.docusign.core.model; import lombok.Data; - -import java.io.Serializable; -import java.util.List; - import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.ScopedProxyMode; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; +import java.io.Serializable; +import java.util.List; + @Component @Scope(value = WebApplicationContext.SCOPE_SESSION, @@ -30,5 +29,7 @@ public class Session implements Serializable { private String apiIndexPath; private AuthType authTypeSelected = AuthType.AGC; private boolean refreshToken = false; + private String clickwrapId; + private String clickwrapVersionNumber; } diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index bc5e83db..ede56388 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -1,13 +1,8 @@ package com.docusign.core.security.jwt; import com.docusign.DSConfiguration; -import com.docusign.common.ApiIndex; import com.docusign.core.exception.LauncherException; import com.docusign.esign.client.ApiClient; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - import com.docusign.esign.client.auth.OAuth; import lombok.Getter; import lombok.Setter; @@ -16,6 +11,10 @@ import org.springframework.security.oauth2.client.token.grant.redirect.AbstractRedirectResourceDetails; import org.springframework.util.FileCopyUtils; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + @Getter @Setter public class JWTAuthorizationCodeResourceDetails extends AbstractRedirectResourceDetails { @@ -46,8 +45,8 @@ public ApiClient getApiClient() { public List getScopeByApiName(){ //Only signature scope is needed for eSIgnature api. Impersonation scope is implied. - return dsConfiguration.getApiName().equalsIgnoreCase("rooms") ? - getScope() : - Arrays.asList(OAuth.Scope_SIGNATURE); + return dsConfiguration.getApiName().equalsIgnoreCase("esignature") ? + Arrays.asList(OAuth.Scope_SIGNATURE) : + getScope(); } } diff --git a/src/main/java/com/docusign/core/utils/FileUtils.java b/src/main/java/com/docusign/core/utils/FileUtils.java new file mode 100644 index 00000000..66dcb5cc --- /dev/null +++ b/src/main/java/com/docusign/core/utils/FileUtils.java @@ -0,0 +1,19 @@ +package com.docusign.core.utils; + +import org.springframework.core.io.ClassPathResource; +import org.springframework.util.StreamUtils; + +import java.io.IOException; + +public class FileUtils { + /** + * Loads a file content and copy it into a byte array. + * @param path the absolute path within the class path + * @return the new byte array that has been loaded from the file + * @throws IOException in case of I/O errors + */ + public static byte[] readFile(String path) throws IOException { + ClassPathResource resource = new ClassPathResource(path); + return StreamUtils.copyToByteArray(resource.getInputStream()); + } +} diff --git a/src/main/resources/TermsOfService.pdf b/src/main/resources/TermsOfService.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cbecb52e2085523b8e7463b9eb2acc6b4c81b2c5 GIT binary patch literal 27701 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 literal 0 HcmV?d00001 diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index 0ec81dee..bbc3c6e1 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -7,7 +7,8 @@ "DS_API_NAME": "ESIGNATURE", "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", - + "DS_CLICK_BASE_PATH": "https://demo.docusign.net", + "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", "Gateway_Display_Name": "{DS_PAYMENT_GATEWAY_DISPLAY_NAME}", diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp new file mode 100644 index 00000000..7701e3b1 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -0,0 +1,26 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

1. Creating a clickwrap.

+ +

This topic describes how to use DocuSign Click + to create a clickwrap that you can embed in your website or app.
+ To learn how to generate a clickwrap automatically by using the UI, see the Click User Guide. +

+

API methods used: + ClickWraps:createClickwrap. +

+

+ View source file ${sourceFile} on GitHub. +

+ +
+
+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp new file mode 100644 index 00000000..24e34455 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -0,0 +1,32 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

2. Activating a clickwrap.

+ +

This topic describes how to use DocuSign Click + to activate a new clickwrap that you have already created. + By default, new clickwraps are inactive. You must activate your clickwrap before you can use it. +

+

API methods used: + ClickWraps:updateClickwrapVersion. +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

The clickwrap you created via example 1 will be activated.

+
+ + +
+
+ +

Cannot find any clickwrap. Please first create a clickwrap using + example 1. +

+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp new file mode 100644 index 00000000..3ee5f8c2 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -0,0 +1,32 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

5. Creating a new clickwrap version.

+ +

This topic demonstrates how to use the Click API to create a new version of a clickwrap. + You can specify whether you require users who have previously accepted the clickwrap + to accept the new version when they return to your website. +

+

API methods used: + ClickWraps:updateClickwrapVersion +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

For the clickwrap you created via example 1 new version will be created.

+
+ + +
+
+ +

Cannot find any clickwrap. Please first create a clickwrap using + example 1. +

+
+
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp new file mode 100644 index 00000000..2455609e --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -0,0 +1,23 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

6. Get a list of clickwraps.

+ +

This topic demonstrates how to use the Click API to get a list of clickwraps + associated with a specific DocuSign user. +

+

API methods used: + ClickWraps:getClickwraps +

+

+ View source file ${sourceFile} on GitHub. +

+ + +
+ + +
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp new file mode 100644 index 00000000..0590a391 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -0,0 +1,23 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

7. Get clickwrap responses.

+ +

This topic demonstrates how to use the Click API to get user responses to + your clickwrap agreements. +

+

API methods used: + ClickWraps:getClickwrapAgreements +

+

+ View source file ${sourceFile} on GitHub. +

+ + +
+ + +
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp new file mode 100644 index 00000000..0983548a --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -0,0 +1,80 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + +
+
+ + + + + + +
+

Java Launcher

+

Welcome to the DocuSign Java examples using multiple OAuth flows (JWT and Authorization Code Grant).

+
+ +
+
+ + +
+

Welcome

+

This launcher both demonstrates use of common OAuth2 grant flows and multiple usage examples from the DocuSign Rooms REST API.

+ +

Documentation on using OAuth Authorization Code Grant from a Java application.

+
+ +

Click Examples

+ +

1. Create a clickwrap

+

This topic describes how to use DocuSign Click + to create a clickwrap that you can embed in your website or app.
+ To learn how to generate a clickwrap automatically by using the UI, see the Click User Guide. +

+

API methods used: + ClickWraps:createClickwrap. +

+ +

2. Activate a clickwrap

+

This topic describes how to use DocuSign Click + to activate a new clickwrap that you have already created. + By default, new clickwraps are inactive. You must activate your clickwrap before you can use it. +

+

API methods used: + ClickWraps:updateClickwrapVersion +

+ +

3. How to create a new clickwrap version

+

This topic demonstrates how to use the Click API to create a new version of a clickwrap. + You can specify whether you require users who have previously accepted the clickwrap + to accept the new version when they return to your website. +

+

API methods used: + ClickWraps:updateClickwrapVersion +

+ +

4. Get a list of clickwraps

+

This topic demonstrates how to use the Click API to get a list of clickwraps + associated with a specific DocuSign user. +

+

API methods used: + ClickWraps:getClickwraps +

+ +

5. Get clickwrap responses

+

This topic demonstrates how to use the Click API to get user responses to + your clickwrap agreements. +

+

API methods used: + ClickWraps:getClickwrapAgreements +

+
+ + + + + + From 2abbeaf1e395aa9db7b7f32cff79925ba9ae3713 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 11 Jan 2021 18:10:32 -0800 Subject: [PATCH 105/699] Update C001ControllerCreateClickwrap.java --- .../click/examples/C001ControllerCreateClickwrap.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 99676eea..48af20bf 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -71,8 +71,8 @@ private ClickwrapRequest createClickwrapRequest(String clickwrapName) throws IOE .format("modal") .mustRead(true) .mustView(true) - .requireAccept(true). - documentDisplay("document"); + .requireAccept(true) + .documentDisplay("document"); return new ClickwrapRequest() .addDocumentsItem(document) From 94431d30ffcbd021c10dd90e27c5f175c67c123d Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 12 Jan 2021 11:00:21 -0800 Subject: [PATCH 106/699] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 08a2235b..6887c20a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ For more information about the scopes used for obtaining authorization to use th [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. -1. **Send an envelope with a remote (email) signer and cc recipient.** +1. **How to request a signature by email (Remote Signing).** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) The envelope includes a pdf, Word, and HTML document. Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. From 8a9316cf45ed15263487f8fa5e4a824039d4f1fd Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 12 Jan 2021 11:16:37 -0800 Subject: [PATCH 107/699] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6887c20a..11a62cd6 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ For more information about the scopes used for obtaining authorization to use th [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. -1. **How to request a signature by email (Remote Signing).** +1. **Request a signature by email (Remote Signing).** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) The envelope includes a pdf, Word, and HTML document. Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. @@ -44,7 +44,7 @@ For more information about the scopes used for obtaining authorization to use th [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) 1. **Programmatically create a template.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) -1. **Send an envelope using a template.** +1. **Request a signature by email using a template.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) 1. **Send an envelope and upload its documents with multipart binary transfer.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) From 2d5e0efcf26fe3f4083eb14c1a9324486ef7814c Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 12 Jan 2021 11:28:18 -0800 Subject: [PATCH 108/699] updating from public --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 08a2235b..11a62cd6 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ For more information about the scopes used for obtaining authorization to use th [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. -1. **Send an envelope with a remote (email) signer and cc recipient.** +1. **Request a signature by email (Remote Signing).** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) The envelope includes a pdf, Word, and HTML document. Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. @@ -44,7 +44,7 @@ For more information about the scopes used for obtaining authorization to use th [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) 1. **Programmatically create a template.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) -1. **Send an envelope using a template.** +1. **Request a signature by email using a template.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) 1. **Send an envelope and upload its documents with multipart binary transfer.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) From d37b47628736b89a457d7058dc8a48bd59a821f9 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Fri, 15 Jan 2021 15:22:02 -0800 Subject: [PATCH 109/699] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 11a62cd6..4580bde0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ This GitHub repo includes code example for the DocuSign eSignature REST API, for To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `ROOMS`. To use the Click API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `CLICK`. -**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). +**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). + +[![IMAGE ALT TEXT](http://img.youtube.com/vi/XGpb861XQuA&t=3s/0.jpg)](http://www.youtube.com/watch?v=XGpb861XQuA&t=3s "Java Quickstart") ## Introduction This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the From cb0619a546f715737fbcd5f5f88f6f5fd056ef2b Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Fri, 15 Jan 2021 15:25:24 -0800 Subject: [PATCH 110/699] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4580bde0..5df0f6fa 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ To use the Click API code examples, modify the **DS_API_NAME** setting at the en **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). -[![IMAGE ALT TEXT](http://img.youtube.com/vi/XGpb861XQuA&t=3s/0.jpg)](http://www.youtube.com/watch?v=XGpb861XQuA&t=3s "Java Quickstart") +[![Java Quickstart video](https://img.youtube.com/vi/XGpb861XQuA/0.jpg)](http://www.youtube.com/watch?v=XGpb861XQuA&t=3s "Java Quickstart") ## Introduction This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the From 50ee14cba52e7f2b30399dbf6935e11de150527e Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Wed, 20 Jan 2021 11:42:14 -0800 Subject: [PATCH 111/699] SMS delivery changes --- code-examples-java.iml | 119 -------------- .../com/docusign/common/WorkArguments.java | 3 + .../examples/EG035ControllerSMSDelivery.java | 151 ++++++++++++++++++ .../views/pages/esignature/examples/eg035.jsp | 75 +++++++++ .../views/pages/esignature/index.jsp | 10 ++ 5 files changed, 239 insertions(+), 119 deletions(-) delete mode 100644 code-examples-java.iml create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp diff --git a/code-examples-java.iml b/code-examples-java.iml deleted file mode 100644 index a02202cc..00000000 --- a/code-examples-java.iml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index faf44e5d..0d20233b 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -49,4 +49,7 @@ public class WorkArguments { private UUID formId; private String startDate; private String endDate; + private String ccPhoneNumber; + private String countryCode; + private String ccCountryCode; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java new file mode 100644 index 00000000..2c9fe378 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java @@ -0,0 +1,151 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.common.DocumentType; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.CarbonCopy; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.Signer; +import com.docusign.esign.model.Tabs; +import com.docusign.esign.model.RecipientAdditionalNotification; +import com.docusign.esign.model.RecipientPhoneNumber; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import java.io.IOException; +import java.util.Arrays; + +import javax.servlet.http.HttpServletResponse; + + +/** + * Send an envelope with a remote (email) signer and cc recipient.
+ * The envelope includes a pdf, Word, and HTML document. Anchor text is used to + * position the signing fields in the documents. + */ +@Controller +@RequestMapping("/eg035") +public class EG035ControllerSMSDelivery extends AbstractEsignatureController { + + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + private final Session session; + private final User user; + + @Autowired + public EG035ControllerSMSDelivery(DSConfiguration config, Session session, User user) { + super(config, "eg035", "Signing request by email"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + // Set status for the makeEnvelope method + if (!EnvelopeHelpers.ENVELOPE_STATUS_CREATED.equalsIgnoreCase(args.getStatus())) { + args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } + + EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + + EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + + // process results + session.setEnvelopeId(results.getEnvelopeId()); + DoneExample.createDefault(title) + .withMessage("The envelope has been created and sent!
Envelope ID " + + results.getEnvelopeId() + ".") + .withJsonObject(results) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + // document 1 (html) has tag **signature_1** + // document 2 (docx) has tag /sn1/ + // document 3 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. After it is signed, + // a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. So the signHere2 tab will be used in + // both document 2 and 3 since they use the same anchor string for + // their "signer 1" tabs. + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + RecipientAdditionalNotification smsDelivery = new RecipientAdditionalNotification(); + smsDelivery.setSecondaryDeliveryMethod("SMS"); + + RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); + phoneNumber.setCountryCode(args.getCountryCode()); + phoneNumber.setNumber(args.getPhoneNumber()); + smsDelivery.phoneNumber(phoneNumber); + signer.setAdditionalNotifications(Arrays.asList(smsDelivery)); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy(); + cc.setEmail(args.getCcEmail()); + cc.setName(args.getCcName()); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + + RecipientAdditionalNotification ccSmsDelivery = new RecipientAdditionalNotification(); + ccSmsDelivery.setSecondaryDeliveryMethod("SMS"); + + RecipientPhoneNumber ccPhoneNumber = new RecipientPhoneNumber(); + ccPhoneNumber.setCountryCode(args.getCcCountryCode()); + ccPhoneNumber.setNumber(args.getCcPhoneNumber()); + ccSmsDelivery.phoneNumber(ccPhoneNumber); + cc.setAdditionalNotifications(Arrays.asList(ccSmsDelivery)); + + // The order in the docs array determines the order in the envelope + byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, + DocumentType.HTML.getDefaultFileExtention(), "1"), + EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(args.getStatus()); + + return envelope; + } +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp new file mode 100644 index 00000000..09532d20 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp @@ -0,0 +1,75 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

2. Send an envelope via SMS delivery

+

The envelope includes a pdf, Word, and HTML document. Anchor text + (AutoPlace) + is used to position the signing fields in the documents. +

+

This is a general example of creating and sending an envelope (a signing request) to a recipient and notifying that recipient with an SMS message..

+ +

Documentation about this example.

+
+ +

API method used: + Envelopes::create. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ +
+ +
+ + The country code for the phone number below. +
+
+ + +
+
+ + + We'll never share your email with anyone else. +
+
+ + +
+
+ + The country code for the phone number below. +
+
+ + +
+
+ + + The email and/or name for the cc recipient must be different + from the signer. + +
+
+ + +
+ + +
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index df2df2be..1bcee4cc 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -335,6 +335,16 @@ Envelopes::create.

+

35. Send with SMS Delivery

+ +

+ This topic demonstrates how to send an envelope using SMS delivery. +

+

+ API methods used: + Envelopes::create. +

+
From 3bc72977e2d2882905953195ba62b86a52afd955 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Wed, 20 Jan 2021 11:44:15 -0800 Subject: [PATCH 112/699] changes to readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index ce0bb04c..9662ca65 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,10 @@ For more information about the scopes used for obtaining authorization to use th 1. **Use conditional recipients** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. + +1. **Request a signature by SMS** + [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG035SMSDelivery.java) + This code example demonstrates how to send a signature request for a signer to read and sign via an SMS message. ## Rooms API From d8bc6ae6ad6a910c4f6f7f9b362eac6cb3efb7e7 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Thu, 21 Jan 2021 10:12:55 -0800 Subject: [PATCH 113/699] adding privacy message for phone number --- .../WEB-INF/templates/views/pages/esignature/examples/eg035.jsp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp index 09532d20..5d508629 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp @@ -31,6 +31,7 @@ + We'll never share your phone number with anyone else.
@@ -54,6 +55,7 @@ + We'll never share your phone number with anyone else.
From ebce772fce2bf38637c65f1d785f999e05f0e3e9 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 21 Jan 2021 16:46:48 -0800 Subject: [PATCH 114/699] Added "Windows" and "OK" button on Step 3 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5df0f6fa..4afaac6c 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,7 @@ $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ``` -## IntelliJ Ultimate instructions +## IntelliJ Ultimate instructions for Windows The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** @@ -322,6 +322,8 @@ configuration to `code-examples-java` and the **Main class** for the configurati Under **Spring Boot** select the `Enable debug output` checkbox. +Select the **OK** button. + ![Configure a Run configuration](./docs/install_fig_7.png) ### Running or debugging the launcher From 761770a7b630b5b2c0eb539312d0387d3bb6806f Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 21 Jan 2021 16:47:22 -0800 Subject: [PATCH 115/699] Synced with public --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 11a62cd6..4afaac6c 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ This GitHub repo includes code example for the DocuSign eSignature REST API, for To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `ROOMS`. To use the Click API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `CLICK`. -**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). +**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). + +[![Java Quickstart video](https://img.youtube.com/vi/XGpb861XQuA/0.jpg)](http://www.youtube.com/watch?v=XGpb861XQuA&t=3s "Java Quickstart") ## Introduction This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the @@ -276,7 +278,7 @@ $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ``` -## IntelliJ Ultimate instructions +## IntelliJ Ultimate instructions for Windows The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** @@ -320,6 +322,8 @@ configuration to `code-examples-java` and the **Main class** for the configurati Under **Spring Boot** select the `Enable debug output` checkbox. +Select the **OK** button. + ![Configure a Run configuration](./docs/install_fig_7.png) ### Running or debugging the launcher From dde01fe7e8325085ecc13e853697f1f5acd67e42 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 25 Jan 2021 13:38:51 -0800 Subject: [PATCH 116/699] Updating bulk send to fix issue with new SDK --- pom.xml | 2 +- .../eSignature/examples/EG031ControllerBulkSendEnvelopes.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 2b067d60..a28b8a7b 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 11 2.1.1.RELEASE 2.6 - 3.8.0 + 3.11.0-RC2 1.0.0 1.0.0-BETA diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index ad11d918..c88dab46 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -93,10 +93,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse try { TimeUnit.SECONDS.sleep(BULK_REQUEST_DELAY); // For 2000 recipients, it can take about an hour - BulkEnvelopeStatus status = bulkEnvelopesApi.get(accountId, batchId); + BulkSendBatchStatus status = bulkEnvelopesApi.getBulkSendBatchStatus(accountId, batchId); DoneExample.createDefault(title) .withJsonObject(status) - .withMessage(String.join("", "Bulk request was sent to ", status.getSent(), " user lists.")) + .withMessage(String.join("", "Bulk request queued to ", status.getQueued(), " user lists.")) .addToModel(model); } catch (InterruptedException exception) { Thread.currentThread().interrupt(); From 15e55345481809d7e3dd5110f21712f377995434 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 25 Jan 2021 18:38:40 -0800 Subject: [PATCH 117/699] Update EG031ControllerBulkSendEnvelopes.java change dependency import to match update --- .../eSignature/examples/EG031ControllerBulkSendEnvelopes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index c88dab46..f78c0d67 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -21,7 +21,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.BulkEnvelopeStatus; +import com.docusign.esign.model.BulkSendBatchStatus; import com.docusign.esign.model.BulkSendRequest; import com.docusign.esign.model.BulkSendingCopy; import com.docusign.esign.model.BulkSendingCopyRecipient; @@ -174,4 +174,4 @@ private static Signer createSignerPlaceholder(String roleName, String recipientI .recipientId(recipientId) .recipientType(EnvelopeHelpers.SIGNER_ROLE_NAME); } -} \ No newline at end of file +} From d2986e6f874aa86da224c67b3454afc42482fe71 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Tue, 26 Jan 2021 17:29:45 -0800 Subject: [PATCH 118/699] Update README.md --- README.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/README.md b/README.md index 349f8ff2..73d01484 100644 --- a/README.md +++ b/README.md @@ -129,18 +129,6 @@ For more information about the scopes used for obtaining authorization to use th 1. **Unpausing a signature workflow** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) This code example demonstrates how to resume an envelope workflow that has been paused -1. **Using conditional recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) - This code example demonstrates how to create an envelope where the workflow is routed to different recipients based on the value of a transaction. - -1. **Сreating an envelope where the workflow is paused** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. - -1. **Resuming an envelope workflow that has been paused** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) - This code example demonstrates how to resume an envelope workflow that has been paused. - 1. **Use conditional recipients** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. From e2bfbed2a49b17ce59b61b9b78186e1ab432dc1e Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Tue, 26 Jan 2021 17:31:41 -0800 Subject: [PATCH 119/699] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73d01484..5b72d522 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,10 @@ For more information about the scopes used for obtaining authorization to use th [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) 1. **List an envelope's documents.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) -1. **Download an envelope's documents.** The example can download individual - documents, the documents concatenated together, or a zip file of the documents. +1. **Download an envelope's documents.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) + This example can download individual + documents, the documents concatenated together, or a zip file of the documents. 1. **Programmatically create a template.** [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) 1. **Request a signature by email using a template.** From a8595d057cf01fadeac609ab008315f3d24ccbd5 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 1 Feb 2021 10:12:55 -0800 Subject: [PATCH 120/699] Devdocs 3887 (#23) Readme updates and controller changes --- README.md | 325 ++++++++---------- docs/lombok_errors.png | Bin 0 -> 26640 bytes .../C001ControllerCreateClickwrap.java | 4 +- ...trollerCreateExternalFormFillSession.java} | 4 +- 4 files changed, 151 insertions(+), 182 deletions(-) create mode 100644 docs/lombok_errors.png rename src/main/java/com/docusign/controller/rooms/examples/{R006ControllerCreatExternalFormFillSession.java => R006ControllerCreateExternalFormFillSession.java} (94%) diff --git a/README.md b/README.md index 5b72d522..c51dcd1a 100644 --- a/README.md +++ b/README.md @@ -24,119 +24,85 @@ The OAuth library is used in the file [WebSecurityConfig.java](https://github.co For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). -1. **Use embedded signing.** - [Source.](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) - This example sends an envelope, and then uses embedded signing for the first signer. - With embedded signing, DocuSign signing is initiated from your website. -1. **Request a signature by email (Remote Signing).** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) - The envelope includes a pdf, Word, and HTML document. +1. **Use embedded signing.** + [Source](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) + This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. +1. **Request a signature by email (Remote Signing).** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) The envelope includes a pdf, Word, and HTML document. Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. -1. **List envelopes in the user's account.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java) -1. **Get an envelope's basic information.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java) +1. **List envelopes in the user's account.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java) +1. **Get an envelope's basic information.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java) The example lists the basic information about an envelope, including its overall status. -1. **List an envelope's recipients and their current status.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) -1. **List an envelope's documents.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) -1. **Download an envelope's documents.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) - This example can download individual - documents, the documents concatenated together, or a zip file of the documents. -1. **Programmatically create a template.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) -1. **Request a signature by email using a template.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) -1. **Send an envelope and upload its documents with multipart binary transfer.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) - Binary transfer is 33% more efficient than using Base64 encoding. -1. **Use embedded sending.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) -1. **Embedded DocuSign web tool (NDSE).** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) -1. **Use embedded signing from a template with an added document.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) - This example sends an envelope based on a template. - In addition to the template's document(s), the example adds an - additional document to the envelope by using the - [Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates) - feature. -1. **Payments example: an order form, with online payment by credit card.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java) -1. **Get the envelope tab data.** - Retrieve the tab (field) values for all of the envelope's recipients. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java) -1. **Set envelope tab values.** - The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs - are set to be read-only, others can be updated by the recipient. The example also stores - metadata with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java) -1. **Set template tab values.** - The example creates an envelope using a template and sets the initial values for its tabs (fields). - The example also stores metadata with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java) -1. **Get the envelope custom field data (metadata).** - The example retrieves the custom metadata (custom data fields) stored with the envelope. - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java) -1. **Requiring an Access Code for a Recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java) - This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. -1. **Requiring SMS authentication for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java) - This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. -1. **Requiring Phone authentication for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java) - This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. -1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java) - This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication. -1. **Requiring ID Verification (IDV) for a recipient** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java) - This example sends and envelope that requires the recipient to upload a government issued id. -1. **Creating a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java) - This code example demonstrates how to create a user group's permission profile using the [Create Profile](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/create) method. -1. **Setting a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java) - This code example demonstrates how to set a user group's permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method. - You must have already created permissions profile and group of users. -1. **Updating individual permission settings** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java) - This code example demonstrates how to update individual settings for a specific permission profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method. - You must have already created permissions profile and group of users. -1. **Deleting a permission profile** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java) +1. **List an envelope's recipients and their current status.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) +1. **List an envelope's documents.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) +1. **Download an envelope's documents.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) This example can download individual documents, the documents concatenated together, or a zip file of the documents. +1. **Programmatically create a template.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) +1. **Request a signature by email using a template.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) +1. **Send an envelope and upload its documents with multipart binary transfer.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) Binary transfer is 33% more efficient than using Base64 encoding. +1. **Use embedded sending.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) +1. **Embedded DocuSign web tool (NDSE).** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) +1. **Use embedded signing from a template with an added document.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) + This example sends an envelope based on a template. In addition to the template's document(s), the example adds an additional document to the envelope by using the [Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates) feature. +1. **Payments example: an order form, with online payment by credit card.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java) +1. **Get the envelope tab data.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java) Retrieve the tab (field) values for all of the envelope's recipients. +1. **Set envelope tab values.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java) The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs are set to be read-only, others can be updated by the recipient. The example also stores metadata with the envelope. +1. **Set template tab values.** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java) The example creates an envelope using a template and sets the initial values or its tabs (fields). The example also stores metadata with the envelope. +1. **Get the envelope custom field data (metadata).** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java) The example retrieves the custom metadata (custom data fields) stored with the envelope. +1. **Requiring an Access Code for a Recipient** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java) + This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. +1. **Requiring SMS authentication for a recipient** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java) This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. +1. **Requiring Phone authentication for a recipient** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java) This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. +1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java) This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication. +1. **Requiring ID Verification (IDV) for a recipient** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java) This example sends and envelope that requires the recipient to upload a government issued id. +1. **Creating a permission profile** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java) This code example demonstrates how to create a user group's permission profile using the [Create Profile](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/create) method. +1. **Setting a permission profile** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java) This code example demonstrates how to set a user group's permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method. You must have already created permissions profile and group of users. +1. **Updating individual permission settings** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java) This code example demonstrates how to update individual settings for a specific permission profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method. You must have already created permissions profile and group of users. +1. **Deleting a permission profile** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java) This code example demonstrates how to an account's permission profile using the [Delete AccountPermissionProfiles](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/delete) method. -1. **Creating a brand** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java) +1. **Creating a brand** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java) This example creates brand profile for an account using the [Create Brand](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountBrands/create) method. -1. **Applying a brand to an envelope** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java) - This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. +1. **Applying a brand to an envelope** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java) This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. First, creates the envelope and then applies brand to it. Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. 1. **Applying a brand to a template** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) - This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. - You must have at least one created template and brand. -1. **Bulk sending envelopes to multiple recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) - This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. -1. **Pausing a signature workflow Source.** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. -1. **Unpausing a signature workflow** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) - This code example demonstrates how to resume an envelope workflow that has been paused -1. **Use conditional recipients** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) - This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. - -1. **Request a signature by SMS** - [Source.](./src/main/java/com/docusign/controller/eSignature/examples/EG035SMSDelivery.java) - This code example demonstrates how to send a signature request for a signer to read and sign via an SMS message. + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. You must have at least one created template and brand. +1. **Bulk sending envelopes to multiple recipients** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. +1. **Pausing a signature workflow Source** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. +1. **Unpausing a signature workflow** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) This code example demonstrates how to resume an envelope workflow that has been paused +1. **Use conditional recipients** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. +1. **Request a signature by SMS** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java) This code example demonstrates how to send a signature request for a signer to read and sign via an SMS message. ## Rooms API @@ -145,45 +111,43 @@ For more information about the scopes used for obtaining authorization to use th **Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. -1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) +1. **Create room with Data.** + [Source](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) This code example creates a new room in your DocuSign Rooms account to be used for a transaction. -1. **Create a room from a template.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) +1. **Create a room from a template.** + [Source](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) This code example creates a new room using a template. -1. **Create room with Data.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportDataFromRoom.java) +1. **Create room with Data.** + [Source](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java) This code example exports all the avialalble data from a specific room in your DocuSign Rooms account. -1. **Add forms to a room.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) +1. **Add forms to a room.** + [Source](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account. -1. **How to search for rooms with filters.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) +1. **How to search for rooms with filters.** + [Source](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) This code example searches for rooms in your DocuSign Rooms account using a specific filter. -1. **Create an external form fillable session.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) +1. **Create an external form fillable session.** + [Source](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. -## Click API - -For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) - -1. **Create Clickwraps.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java) - This code example shows how to create a clickwrap. -1. **Activate Clickwrap.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) +## Click API +For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) + +1. **Create Clickwraps.** + [Source](./src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java) This code example shows how to create a clickwrap. +1. **Activate Clickwrap.** + [Source](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) This code example shows how to activate a new clickwrap that you have already created. -1. **Clickwrap Versioning.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java) +1. **Clickwrap Versioning.** + [Source](./src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java) This code example shows how to create a new clickwrap version. -1. **Get a list of Clickwraps.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java) +1. **Get a list of Clickwraps.** + [Source](./src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java) This code example shows how to get a list of clickwraps. -1. **Get Clickwrap Responses.** - [Source.](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) +1. **Get Clickwrap Responses.** + [Source](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) This code example shows how to get clickwrap responses. ## Included OAuth grant types: @@ -201,7 +165,7 @@ When the token expires, it updates automatically. ## Installation ### Prerequisites -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip steps 1 and 2 below as they're automatically performed for you.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip step 2 below as it is automatically performed for you.** 1. A DocuSign developer account (email and password) on [demo.docusign.net](https://demo.docusign.net). Create a [free account](https://go.docusign.com/sandbox/productshot/?elqCampaignId=16533). @@ -224,9 +188,8 @@ When the token expires, it updates automatically. 1. [Maven](https://maven.apache.org/download.cgi) 1. A name and email for a signer, and a name and email for a cc recipient. The signer and the cc email cannot be the same. - -### Nice to have -1. [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE +1. **Optional** [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE. + #### Authorization Code Grant specifics: You will need the integration key and its secret. The integration key must include a redirect URI of @@ -251,13 +214,17 @@ When the token expires, it updates automatically. 1. Download or clone this repository. 1. The project includes a Maven pom file. -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** +1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** 1. Add VM argument `-Dspring.profiles.active=dev` to your IDE 1. Note that IntelliJ IDEA Community Edition does not directly support Spring Boot applications. -1. [Optional] Install Lombok for your IDE (See the IntelliJ or Eclipse instructions below for specific details). +1. [Optional] Install Lombok for your IDE (See the IntelliJ or Eclipse instructions below for specific details). + +**NOTE:** If Lombok Annotations Processing is not installed in your IDE, you will see several errors regarding undefined methods. These methods are generated at compile time and do not otherwise impact the functionality of the launcher. +![Lombok Errors Example](./docs/lombok_errors.png) + ### Build and run Launchers are built as a dedicated application with embedded TomCat server. Build: ``` bash @@ -274,26 +241,23 @@ $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ## IntelliJ Ultimate instructions for Windows The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Step 1 as it was automatically performed for you.** -**Step 1.** Download or clone the -[code-examples-java](https://github.com/docusign/code-examples-java) - repository -**Step 2.** Start IntelliJ Ultimate and choose the **Open or Import** option. +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next 2 steps as they were automatically performed for you.** +1. Download or clone the +[code-examples-java](https://github.com/docusign/code-examples-java) + repository +1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** +1. Start IntelliJ Ultimate and choose the **Open or Import** option. ![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) - -**Step 3.** Use the popup file chooser to select +1. Use the popup file chooser to select **code-examples-java** or your unzipped Quickstart directory. - -**Step 4.** The **Import Project** wizard will open. It's a +1. The **Import Project** wizard will open. It's a series of screens. On the first screen, select **Import project from external model** and **Maven**. - ![IntelliJ Import Maven project](./docs/install_fig_2.png) - -**Step 5.** Click **Finish** and the project will +1. Click **Finish** and the project will be displayed in the IDE. ### Configuring IntelliJ's *Run/Debug Configuration* @@ -302,16 +266,16 @@ settings for running the launcher. Set up a Run/Debug Configuration for the launcher: -Step 1. Use the menu command **Run > Edit configurations...** +1. Use the menu command **Run > Edit configurations...** to open the configuration manager. -Step 2. Click the **+** (plus) sign to add a new configuration. +1. Click the **+** (plus) sign to add a new configuration. The configuration type is **Spring Boot**. You may need to open the additional templates section of the template chooser. -Step 3. Update the form with the **Name** of the +1. Update the form with the **Name** of the configuration to `code-examples-java` and the **Main class** for the configuration, -`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. +`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. Under **Spring Boot** select the `Enable debug output` checkbox. @@ -332,34 +296,39 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the first step as it was automatically performed for you.** - -* Download or clone this repository. -* Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. -* For the Root directory, Browse for and select this same repo `code-examples-java`. -* Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. -* Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration to clean and compile with the following: - * Name the configuration `build` (If You have downloaded the launcher via Quickstart, skip this step). - * Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. - * Put in the following values into the Goals field: `clean package`. -* Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. -* Click apply to save. -* Finally, create another configuration by again using `Run->Run Configurations`, choosing Java Application Configuration with the following: - * Name the configuration `run` (If You have downloaded the launcher via Quickstart, skip this step). - * Put in the following value for project: `code-examples-java`. - * Put in the following value into the Main class: `com.docusign.App`. -* Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080 -* [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine, open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter** - -### Payments code example +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next 2 steps as they were automatically performed for you.** +1. Download or clone the +[code-examples-java](https://github.com/docusign/code-examples-java) + repository + +1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** + +1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. +1. For the Root directory, Browse for and select this same repo `code-examples-java`. +1. Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. +1. Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration to clean and compile with the following: + 1. Name the configuration `build` (If You have downloaded the launcher via Quickstart, skip this step). + 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. + 1. Put in the following values into the Goals field: `clean package`. +1. Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. +1. Click apply to save. +1.* Finally, create another configuration by again using `Run->Run Configurations`, choosing Java Application Configuration with the following: + 1. Name the configuration `run` (If You have downloaded the launcher via Quickstart, skip this step). + 1. Put in the following value for project: `code-examples-java`. + 1. Put in the following value into the Main class: `com.docusign.App`. +1. Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080. +1. [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine. Open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. + + +### Payments code example To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. Then add the payment gateway account id to the **application.json** file. -## License and additional information +## License and additional information -### License +### License This repository uses the MIT License. See the LICENSE file for more information. ### Pull Requests diff --git a/docs/lombok_errors.png b/docs/lombok_errors.png new file mode 100644 index 0000000000000000000000000000000000000000..bbe873cb549b4c97e4b8f6ba79fb48fafeb8fea3 GIT binary patch literal 26640 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 literal 0 HcmV?d00001 diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 99676eea..48af20bf 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -71,8 +71,8 @@ private ClickwrapRequest createClickwrapRequest(String clickwrapName) throws IOE .format("modal") .mustRead(true) .mustView(true) - .requireAccept(true). - documentDisplay("document"); + .requireAccept(true) + .documentDisplay("document"); return new ClickwrapRequest() .addDocumentsItem(document) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreatExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java similarity index 94% rename from src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreatExternalFormFillSession.java rename to src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index 93105534..27168d1b 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreatExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -28,7 +28,7 @@ */ @Controller @RequestMapping("/r006") -public class R006ControllerCreatExternalFormFillSession extends AbstractRoomsController { +public class R006ControllerCreateExternalFormFillSession extends AbstractRoomsController { private static final String MODEL_FORM_LIST = "formList"; private static final String MODEL_ROOM_LIST = "roomList"; @@ -37,7 +37,7 @@ public class R006ControllerCreatExternalFormFillSession extends AbstractRoomsCon private final User user; @Autowired - public R006ControllerCreatExternalFormFillSession(DSConfiguration config, Session session, User user) { + public R006ControllerCreateExternalFormFillSession(DSConfiguration config, Session session, User user) { super(config, "r006", "Creating an external form fill session"); this.session = session; this.user = user; From a25346598a6626bfcf1063086d712394a63dc53a Mon Sep 17 00:00:00 2001 From: Matthew Lusher Date: Tue, 2 Feb 2021 16:21:10 -0500 Subject: [PATCH 121/699] SMS update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c51dcd1a..eaa909d2 100644 --- a/README.md +++ b/README.md @@ -101,8 +101,8 @@ For more information about the scopes used for obtaining authorization to use th [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) This code example demonstrates how to resume an envelope workflow that has been paused 1. **Use conditional recipients** [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. -1. **Request a signature by SMS** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java) This code example demonstrates how to send a signature request for a signer to read and sign via an SMS message. +1. **Request a signature by SMS delivery** + [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java) This code example demonstrates how to send a signature request via an SMS message using the [Envelopes: create](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. ## Rooms API From 76b2caefda08ff6419b223321c83452b8ea458da Mon Sep 17 00:00:00 2001 From: Yaryna Kimak <64064514+yarynakimak@users.noreply.github.com> Date: Tue, 2 Mar 2021 22:08:06 +0200 Subject: [PATCH 122/699] Add form group examples related to the Rooms API (#24) * Add form group examples related to the Rooms API * baseline fixes for filename typo issues * gc rename DEVDOCS-3604 Co-authored-by: Kharko, Yaryna Co-authored-by: Aaron JacksonWilde --- README.md | 13 ++- pom.xml | 2 +- .../com/docusign/common/WorkArguments.java | 3 + .../examples/AbstractRoomsController.java | 18 +++- .../R007ControllerCreateFormGroup.java | 62 ++++++++++++ ...ontrollerGrantOfficeAccessToFormGroup.java | 89 +++++++++++++++++ .../R009ControllerAssignFormToFormGroup.java | 97 +++++++++++++++++++ .../views/pages/rooms/examples/r007.jsp | 21 ++++ .../views/pages/rooms/examples/r008.jsp | 51 ++++++++++ .../views/pages/rooms/examples/r009.jsp | 53 ++++++++++ .../templates/views/pages/rooms/index.jsp | 34 +++++++ 11 files changed, 438 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java create mode 100644 src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java create mode 100644 src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp diff --git a/README.md b/README.md index eaa909d2..9cc82b1f 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,18 @@ For more information about the scopes used for obtaining authorization to use th [Source](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. - +1. **Create a form group.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java) + This code example create a form group for your DocuSign Rooms for Real Estate account. +1. **Grant office access to a form group.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java) + This code example assign an office to a form group for your DocuSign Rooms for Real Estate account. + Granting office access to a form group will enable you to filter which form groups are available based on that office. +1. **Assign a form to a form group.** + [Source.](./src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java) + This example demonstrates how to assign a form to a form group for your DocuSign Rooms for Real + Estate account. As a prerequisite, ensure that you have created a form group and set the + office ID on this form group before proceeding. ## Click API For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) diff --git a/pom.xml b/pom.xml index a28b8a7b..bbd778c0 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 2.1.1.RELEASE 2.6 3.11.0-RC2 - 1.0.0 + 1.1.0-RC1 1.0.0-BETA diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index a04d58a8..aea0f629 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -46,7 +46,10 @@ public class WorkArguments { private String roomName; private Integer roomTemplateId; private Integer roomId; + private Integer officeId; private UUID formId; + private String formGroupName; + private UUID formGroupId; private String startDate; private String endDate; private String ccPhoneNumber; diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index 177cea75..c9e6515f 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -8,11 +8,11 @@ import com.docusign.rooms.client.ApiException; import com.docusign.rooms.client.auth.OAuth; import com.docusign.rooms.model.*; -import lombok.SneakyThrows; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import java.util.stream.Collectors; @@ -76,7 +76,7 @@ protected static RolesApi createRolesApiClient(String basePath, String userAcces * @param userAccessToken user's access token * @return an instance of the {@link OfficesApi} */ - protected static OfficesApi createOfficeApiClient(String basePath, String userAccessToken) { + protected static OfficesApi createOfficesApiClient(String basePath, String userAccessToken) { ApiClient apiClient = createApiClient(basePath, userAccessToken); return new OfficesApi(apiClient); } @@ -117,6 +117,18 @@ protected static FormLibrariesApi createFormLibrariesApi(String basePath, String return new FormLibrariesApi(apiClient); } + /** + * Creates a new instance of the FormGroupsApi. This method + * creates an instance of the ApiClient class silently. + * @param basePath URL to Rooms REST API + * @param userAccessToken user's access token + * @return an instance of the {@link RoomsApi} + */ + protected static FormGroupsApi createFormGroupsApi(String basePath, String userAccessToken) { + ApiClient apiClient = createApiClient(basePath, userAccessToken); + return new FormGroupsApi(apiClient); + } + protected static RoleSummary getAdminRole(String basePath, String userAccessToken, String accountId) throws ApiException { RoleSummaryList roleSummaryList = createRolesApiClient(basePath, userAccessToken).getRoles(accountId); return roleSummaryList.getRoles() diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java new file mode 100644 index 00000000..1e1856be --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -0,0 +1,62 @@ +package com.docusign.controller.rooms.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormGroup; +import com.docusign.rooms.model.FormGroupForCreate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Creating create a form group. + */ +@Controller +@RequestMapping("/r007") +public class R007ControllerCreateFormGroup extends AbstractRoomsController { + + private final Session session; + private final User user; + + @Autowired + public R007ControllerCreateFormGroup(DSConfiguration config, Session session, User user) { + super(config, "r007", "Creating create a form group"); + this.session = session; + this.user = user; + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws IOException, ApiException { + // Step 2 Start + FormGroupsApi formGroupsApi = createFormGroupsApi( + this.session.getBasePath(), this.user.getAccessToken() + ); + // Step 2 End + + // Step 3 Start + FormGroupForCreate formGroupForCreate = new FormGroupForCreate() + .name(args.getFormGroupName()); + // Step 3 End + + // Step 4 Start + FormGroup formGroup = formGroupsApi.createFormGroup(this.session.getAccountId(), formGroupForCreate); + // Step 4 End + + DoneExample.createDefault(this.title) + .withJsonObject(formGroup) + .withMessage("A form group has been created!") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } +} diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java new file mode 100644 index 00000000..355daae1 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -0,0 +1,89 @@ +package com.docusign.controller.rooms.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.api.OfficesApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Granting office access to a form group. + */ +@Controller +@RequestMapping("/r008") +public class R008ControllerGrantOfficeAccessToFormGroup extends AbstractRoomsController { + + private static final String MODEL_OFFICE_LIST = "officeList"; + private static final String MODEL_FORM_GROUP_LIST = "formGroupList"; + private static final String OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP_ERROR_MESSAGE = "OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP"; + + private final Session session; + private final User user; + + private FormGroupsApi formGroupsApi; + + @Autowired + public R008ControllerGrantOfficeAccessToFormGroup(DSConfiguration config, Session session, User user) { + super(config, "r008", "Granting office access to a form group"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + + // Step 2 Start + this.formGroupsApi = createFormGroupsApi( + this.session.getBasePath(), this.user.getAccessToken() + ); + // Step 2 End + + // Step 3 Start + OfficesApi officesApi = createOfficesApiClient(this.session.getBasePath(), this.user.getAccessToken()); + OfficeSummaryList officeSummaryList = officesApi.getOffices(this.session.getAccountId()); + // Step 3 End + + // Step 4 Start + FormGroupSummaryList formGroupSummaryList = formGroupsApi.getFormGroups(this.session.getAccountId()); + // Step 4 End + + model.addAttribute(MODEL_FORM_GROUP_LIST, formGroupSummaryList.getFormGroups()); + model.addAttribute(MODEL_OFFICE_LIST, officeSummaryList.getOfficeSummaries()); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws IOException, ApiException { + + try { + // Step 5 Start + this.formGroupsApi.grantOfficeAccessToFormGroup(this.session.getAccountId(), args.getFormGroupId(), args.getOfficeId()); + // Step 5 End + + DoneExample.createDefault(this.title) + .withMessage("Office has been granted access to a form group!") + .addToModel(model); + } catch (ApiException apiException) { + if (!apiException.getMessage().contains(OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP_ERROR_MESSAGE)) { + throw apiException; + } + DoneExample.createDefault(this.title) + .withMessage("The selected office already has access to a form group!") + .addToModel(model); + } + return DONE_EXAMPLE_PAGE; + } +} diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java new file mode 100644 index 00000000..d804cef2 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -0,0 +1,97 @@ +package com.docusign.controller.rooms.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormGroupFormToAssign; +import com.docusign.rooms.model.FormGroupSummaryList; +import com.docusign.rooms.model.FormSummary; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * Assigning a form to a form group. + */ +@Controller +@RequestMapping("/r009") +public class R009ControllerAssignFormToFormGroup extends AbstractRoomsController { + + private static final String MODEL_FORM_LIST = "formList"; + private static final String MODEL_FORM_GROUP_LIST = "formGroupList"; + private static final String FORM_ALREADY_EXISTS_ERROR_MESSAGE = "Form in the form group already exists"; + + + private final Session session; + private final User user; + private FormGroupsApi formGroupsApi; + + @Autowired + public R009ControllerAssignFormToFormGroup(DSConfiguration config, Session session, User user) { + super(config, "r009", "Assigning a form to a form group"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + + // Step 2 Start + this.formGroupsApi = createFormGroupsApi( + this.session.getBasePath(), this.user.getAccessToken() + ); + // Step 2 End + + // Step 3 Start + FormGroupSummaryList formGroupSummaryList = formGroupsApi.getFormGroups(this.session.getAccountId()); + // Step 3 End + + // Step 4 Start + List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + // Step 4 End + + model.addAttribute(MODEL_FORM_GROUP_LIST, formGroupSummaryList.getFormGroups()); + model.addAttribute(MODEL_FORM_LIST, forms); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws IOException, ApiException { + + // Step 5 Start + FormGroupFormToAssign formGroupFormToAssignRequest = new FormGroupFormToAssign() + .formId(args.getFormId()); + // Step 5 End + + try { + // Step 6 Start + FormGroupFormToAssign formGroupFormToAssign = this.formGroupsApi.assignFormGroupForm( + this.session.getAccountId(), args.getFormGroupId(), formGroupFormToAssignRequest); + // Step 6 End + + DoneExample.createDefault(this.title) + .withJsonObject(formGroupFormToAssign) + .withMessage("A form has been assigned to a form group!") + .addToModel(model); + } catch (ApiException apiException) { + if (!apiException.getMessage().contains(FORM_ALREADY_EXISTS_ERROR_MESSAGE)) { + throw apiException; + } + DoneExample.createDefault(this.title) + .withMessage(FORM_ALREADY_EXISTS_ERROR_MESSAGE) + .addToModel(model); + } + return DONE_EXAMPLE_PAGE; + } +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp new file mode 100644 index 00000000..34d3763a --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp @@ -0,0 +1,21 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

7. Creating a form group.

+ +

This example demonstrates creating a form group for your DocuSign Rooms for Real Estate account.

+ +

API methods used: + FormGroups:CreateFormGroup. +

+ +
+
+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp new file mode 100644 index 00000000..48f9b54d --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp @@ -0,0 +1,51 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

8. Granting office access to a form group.

+ +

This example demonstrates how to assign an office to + a form group + for your DocuSign Rooms for Real Estate account. Granting office access to a form group will + enable you to filter which form groups are available based on that office. +

+ +

API method used: + FormGroups:GrantOfficeAccessToFormGroup, + FormGroups:GetFormGroups and + Offices:GetOffices. +

+ + +
+ + +

Problem: please first create a form group using example 7

+
+ +

Problem: cannot find any offices

+
+ +
+ + +
+
+ + +
+ + +
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp new file mode 100644 index 00000000..de6ad104 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp @@ -0,0 +1,53 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

9. Assigning a form to a form group.

+ +

This example demonstrates how to assign a form to + a form group + for your DocuSign Rooms for Real Estate account. As a prerequisite, ensure that you have + created a form group + and set the office ID on this form group + before proceeding. +

+ +

API method used: + FormGroups:AssignFormGroupForm, + FormGroups:GetFormGroups and + FormLibraries::GetFormLibraryForms. +

+ + +
+ + +

Problem: please first create a form group using example 7

+
+ +

Problem: cannot find any forms, please first create a form

+
+ +
+ + +
+
+ + +
+ + +
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp index c3254f32..6ec29119 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp @@ -89,6 +89,40 @@ FormLibraries::GetFormLibraries and ExternalFormFillSessions::CreateExternalFormFillSession,

+ +

7. Creating a form group

+

This example demonstrates creating a form group for your DocuSign + Rooms for Real Estate account. +

+

API method used: + FormGroups:CreateFormGroup. +

+ +

8. Granting office access to a form group

+

This example demonstrates how to assign an office to + a form group + for your DocuSign Rooms for Real Estate account. Granting office access to a form group will + enable you to filter which form groups are available based on that office. +

+

API method used: + FormGroups:GrantOfficeAccessToFormGroup, + FormGroups:GetFormGroups and + Offices:GetOffices. +

+ +

9. Assigning a form to a form group

+

This example demonstrates how to assign a form to + a form group + for your DocuSign Rooms for Real Estate account. As a prerequisite, ensure that you have + created a form group + and set the office ID on this form group + before proceeding. +

+

API method used: + FormGroups:AssignFormGroupForm, + FormGroups:GetFormGroups and + FormLibraries::GetFormLibraryForms. +

From c577f926d338432897d058928dd82bf76e4ad44a Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Wed, 3 Mar 2021 09:55:24 -0800 Subject: [PATCH 123/699] add in rooms links on rooms launcher homepage --- .../templates/views/pages/rooms/index.jsp | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp index c3254f32..6ec29119 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp @@ -89,6 +89,40 @@ FormLibraries::GetFormLibraries and ExternalFormFillSessions::CreateExternalFormFillSession,

+ +

7. Creating a form group

+

This example demonstrates creating a form group for your DocuSign + Rooms for Real Estate account. +

+

API method used: + FormGroups:CreateFormGroup. +

+ +

8. Granting office access to a form group

+

This example demonstrates how to assign an office to + a form group + for your DocuSign Rooms for Real Estate account. Granting office access to a form group will + enable you to filter which form groups are available based on that office. +

+

API method used: + FormGroups:GrantOfficeAccessToFormGroup, + FormGroups:GetFormGroups and + Offices:GetOffices. +

+ +

9. Assigning a form to a form group

+

This example demonstrates how to assign a form to + a form group + for your DocuSign Rooms for Real Estate account. As a prerequisite, ensure that you have + created a form group + and set the office ID on this form group + before proceeding. +

+

API method used: + FormGroups:AssignFormGroupForm, + FormGroups:GetFormGroups and + FormLibraries::GetFormLibraryForms. +

From 9b802758e46365b4c1189052c1be23523afc0841 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Wed, 3 Mar 2021 22:00:51 -0800 Subject: [PATCH 124/699] Update R009ControllerAssignFormToFormGroup.java --- .../rooms/examples/R009ControllerAssignFormToFormGroup.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index d804cef2..82cccaeb 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -46,13 +46,10 @@ public R009ControllerAssignFormToFormGroup(DSConfiguration config, Session sessi protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - // Step 2 Start + // Step 3 Start this.formGroupsApi = createFormGroupsApi( this.session.getBasePath(), this.user.getAccessToken() ); - // Step 2 End - - // Step 3 Start FormGroupSummaryList formGroupSummaryList = formGroupsApi.getFormGroups(this.session.getAccountId()); // Step 3 End From 4630789cace38606c8b409a918b89a37a6fa9153 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 4 Mar 2021 10:04:25 -0800 Subject: [PATCH 125/699] removed Step 2 start/end since it is in abstract file --- .../rooms/examples/R007ControllerCreateFormGroup.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 1e1856be..76f4e27e 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -38,11 +38,10 @@ public R007ControllerCreateFormGroup(DSConfiguration config, Session session, Us // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - // Step 2 Start + FormGroupsApi formGroupsApi = createFormGroupsApi( this.session.getBasePath(), this.user.getAccessToken() ); - // Step 2 End // Step 3 Start FormGroupForCreate formGroupForCreate = new FormGroupForCreate() From d2455787f82a1ba58e6daceeccaab768b942a06a Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 4 Mar 2021 10:05:19 -0800 Subject: [PATCH 126/699] Removed Step 2 start/end comment since it is in abstract file --- .../rooms/examples/R007ControllerCreateFormGroup.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 1e1856be..76f4e27e 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -38,11 +38,10 @@ public R007ControllerCreateFormGroup(DSConfiguration config, Session session, Us // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - // Step 2 Start + FormGroupsApi formGroupsApi = createFormGroupsApi( this.session.getBasePath(), this.user.getAccessToken() ); - // Step 2 End // Step 3 Start FormGroupForCreate formGroupForCreate = new FormGroupForCreate() From 2ead981705cf59194f7794e3a544c6692eba2b70 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 4 Mar 2021 11:01:31 -0800 Subject: [PATCH 127/699] Removed Step 2 start/end comments --- .../examples/R008ControllerGrantOfficeAccessToFormGroup.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index 355daae1..03c82db4 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -44,11 +44,9 @@ public R008ControllerGrantOfficeAccessToFormGroup(DSConfiguration config, Sessio protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - // Step 2 Start this.formGroupsApi = createFormGroupsApi( this.session.getBasePath(), this.user.getAccessToken() ); - // Step 2 End // Step 3 Start OfficesApi officesApi = createOfficesApiClient(this.session.getBasePath(), this.user.getAccessToken()); From dcb92d5d5d18e8adac1bac42e0f2e49259d8f566 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 4 Mar 2021 11:02:21 -0800 Subject: [PATCH 128/699] Removed Step 2 start/end comments --- .../examples/R008ControllerGrantOfficeAccessToFormGroup.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index 355daae1..03c82db4 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -44,11 +44,9 @@ public R008ControllerGrantOfficeAccessToFormGroup(DSConfiguration config, Sessio protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - // Step 2 Start this.formGroupsApi = createFormGroupsApi( this.session.getBasePath(), this.user.getAccessToken() ); - // Step 2 End // Step 3 Start OfficesApi officesApi = createOfficesApiClient(this.session.getBasePath(), this.user.getAccessToken()); From 2083e1eac78a5a6d77b0b3b9eebd0b3a3df56bda Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 4 Mar 2021 13:35:38 -0800 Subject: [PATCH 129/699] fixes link and description to ex 27 (#25) --- .../templates/views/pages/esignature/examples/eg029.jsp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index f535023b..8b957f1b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -55,7 +55,7 @@ There are no brands - created in your account. Create ones at the 'Create brand' page. + created in your account. Create ones at the 'Create brand' page. @@ -64,8 +64,8 @@
-

Problem: please first create the brand(s) using example 24.
Thank you.

-
+

Problem: please first create the brand(s) using example 27.
Thank you.

+
From 3b594a3fee8e60993c4fc53c0b5c4582c8f4aa6d Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 15 Mar 2021 12:09:10 -0700 Subject: [PATCH 130/699] Added Step start/end comments; deleted other subcomments --- .../examples/EG007ControllerEnvelopeGetDoc.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index 9ac66a8f..0ede9229 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -68,17 +68,19 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception } @Override - // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + // Step 2 start EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - - // Step 1. EnvelopeDocuments::get. + // Step 2 end + + // Step 3 start + // EnvelopeDocuments::get. // Exceptions will be caught by the calling function String documentId = args.getDocSelect(); byte[] results = envelopesApi.getDocument(session.getAccountId(), session.getEnvelopeId(), documentId); - // Step 2. process results + // Process results List envelopeDocuments = session.getEnvelopeDocuments(); EnvelopeDocumentInfo docItem = find(envelopeDocuments, documentId); @@ -116,5 +118,5 @@ private static EnvelopeDocumentInfo find(List documents, S throw new ExampleException("Requested document is not found.", null); } - // ***DS.snippet.0.end + // Step 3 start end } From 9cb2572f4aa74b35268fd46ff645f598b41719b3 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 15 Mar 2021 12:43:41 -0700 Subject: [PATCH 131/699] moved Step 3 comments --- .../examples/EG007ControllerEnvelopeGetDoc.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index 0ede9229..ee20df48 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -74,11 +74,12 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2 end - // Step 3 start // EnvelopeDocuments::get. - // Exceptions will be caught by the calling function + // Exceptions will be caught by the calling function String documentId = args.getDocSelect(); + // Step 3 start byte[] results = envelopesApi.getDocument(session.getAccountId(), session.getEnvelopeId(), documentId); + // Step 3 end // Process results List envelopeDocuments = session.getEnvelopeDocuments(); @@ -117,6 +118,5 @@ private static EnvelopeDocumentInfo find(List documents, S } throw new ExampleException("Requested document is not found.", null); - } - // Step 3 start end + } } From 9ebb4452e7fb00fb9eb24425a6fa2ed6e5e053ee Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 17:47:50 -0700 Subject: [PATCH 132/699] Edited Eclipse instructions --- README.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9cc82b1f..74bcca18 100644 --- a/README.md +++ b/README.md @@ -307,27 +307,25 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next 2 steps as they were automatically performed for you.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the Steps 1 and 2 as they were automatically performed for you.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** +1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the *API Username* in the *Apps and Keys* page), authorization.code.grant.client.client-id (*Integration Key*), authorization.code.grant.client.client-secret (Select the *Actions* button to the right of your *Integration Key* > *Edit* > *Authentication* > *+ ADD SECRET KEY* > *Secret Key*), jwt.grant.client.client-id (*Integration Key*), wt.grant.client.impersonated-user-guid (*API Username*). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. -1. For the Root directory, Browse for and select this same repo `code-examples-java`. -1. Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. -1. Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration to clean and compile with the following: - 1. Name the configuration `build` (If You have downloaded the launcher via Quickstart, skip this step). +1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. +1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. +1. Next, select `Run > Run Configurations` and right-click `Maven Build` then a `New Configuration` to clean and compile with the following: + 1. Name the configuration `build`. 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. 1. Put in the following values into the Goals field: `clean package`. -1. Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. -1. Click apply to save. -1.* Finally, create another configuration by again using `Run->Run Configurations`, choosing Java Application Configuration with the following: - 1. Name the configuration `run` (If You have downloaded the launcher via Quickstart, skip this step). - 1. Put in the following value for project: `code-examples-java`. +1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. +1. Create a Java Application Configuration in the Run Configurations dialog box, right-clicking Java Application > New Configuration with the following: + 1. Name the configuration `App`. + 1. Put in the following value for Project: `code-examples-java`. 1. Put in the following value into the Main class: `com.docusign.App`. -1. Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080. + 1. Select `Run` to run the launcher. A browser window should automatically open to the consent page. 1. [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine. Open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. From 0da2a084709f518c5cddcb98cb0581218ca83f53 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 17:53:10 -0700 Subject: [PATCH 133/699] More Eclipse edits --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 74bcca18..4d66f26f 100644 --- a/README.md +++ b/README.md @@ -307,12 +307,12 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the Steps 1 and 2 as they were automatically performed for you.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 5.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the *API Username* in the *Apps and Keys* page), authorization.code.grant.client.client-id (*Integration Key*), authorization.code.grant.client.client-secret (Select the *Actions* button to the right of your *Integration Key* > *Edit* > *Authentication* > *+ ADD SECRET KEY* > *Secret Key*), jwt.grant.client.client-id (*Integration Key*), wt.grant.client.impersonated-user-guid (*API Username*). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** +1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), authorization.code.grant.client.client-id (**Integration Key**), authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), jwt.grant.client.client-id (**Integration Key**), wt.grant.client.impersonated-user-guid (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. 1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. @@ -320,11 +320,12 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab 1. Name the configuration `build`. 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. 1. Put in the following values into the Goals field: `clean package`. -1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. + 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. 1. Create a Java Application Configuration in the Run Configurations dialog box, right-clicking Java Application > New Configuration with the following: 1. Name the configuration `App`. 1. Put in the following value for Project: `code-examples-java`. 1. Put in the following value into the Main class: `com.docusign.App`. + 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. 1. Select `Run` to run the launcher. A browser window should automatically open to the consent page. 1. [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine. Open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. From d268312ad6d61e58d77831fdcee52bf10311f5fa Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 17:54:52 -0700 Subject: [PATCH 134/699] Add line breaks --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d66f26f..2c42f395 100644 --- a/README.md +++ b/README.md @@ -312,7 +312,7 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), authorization.code.grant.client.client-id (**Integration Key**), authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), jwt.grant.client.client-id (**Integration Key**), wt.grant.client.impersonated-user-guid (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** +1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), authorization.code.grant.client.client-id (**Integration Key**), authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), jwt.grant.client.client-id (**Integration Key**), wt.grant.client.impersonated-user-guid (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. 1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. From 51fa2b49de1b83ed9a03159f61c94f848fdfc750 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 17:56:03 -0700 Subject: [PATCH 135/699] adding line breaks again --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c42f395..f8c9eec4 100644 --- a/README.md +++ b/README.md @@ -312,7 +312,13 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), authorization.code.grant.client.client-id (**Integration Key**), authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), jwt.grant.client.client-id (**Integration Key**), wt.grant.client.impersonated-user-guid (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** +1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. +The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), +authorization.code.grant.client.client-id (**Integration Key**), +authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), +jwt.grant.client.client-id (**Integration Key**), +wt.grant.client.impersonated-user-guid (**API Username**). +Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. 1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. From 3e37dee04e364996566255a4a05d907690102031 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 17:58:37 -0700 Subject: [PATCH 136/699] more editing --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f8c9eec4..5b02b25c 100644 --- a/README.md +++ b/README.md @@ -312,8 +312,10 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Open the `src\main\resources\application.example.json` file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. -The DS_SIGNER_NAME, DS_SIGNER_EMAIL, DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), +1. Open the `src\main\resources\application.example.json` file. +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. +The DS_SIGNER_NAME, DS_SIGNER_EMAIL, +DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), authorization.code.grant.client.client-id (**Integration Key**), authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), jwt.grant.client.client-id (**Integration Key**), @@ -322,13 +324,13 @@ Save this file as `application.json`. **Don't add this application.json file to 1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. 1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. -1. Next, select `Run > Run Configurations` and right-click `Maven Build` then a `New Configuration` to clean and compile with the following: - 1. Name the configuration `build`. +1. Next, select `Run > Run Configurations` and right-click `Maven Build` then `New Configuration` to clean and compile with the following: + 1. Name the configuration: `build`. 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. 1. Put in the following values into the Goals field: `clean package`. 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. 1. Create a Java Application Configuration in the Run Configurations dialog box, right-clicking Java Application > New Configuration with the following: - 1. Name the configuration `App`. + 1. Name the configuration: `App`. 1. Put in the following value for Project: `code-examples-java`. 1. Put in the following value into the Main class: `com.docusign.App`. 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. From ec3f2097d59ff50da231e5a07c8feaf8bd718d3c Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 18:07:35 -0700 Subject: [PATCH 137/699] more Eclipse updates --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5b02b25c..008ebebb 100644 --- a/README.md +++ b/README.md @@ -322,17 +322,17 @@ jwt.grant.client.client-id (**Integration Key**), wt.grant.client.impersonated-user-guid (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. +1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your Quickstart folder name or code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. 1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. 1. Next, select `Run > Run Configurations` and right-click `Maven Build` then `New Configuration` to clean and compile with the following: 1. Name the configuration: `build`. 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. 1. Put in the following values into the Goals field: `clean package`. 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. -1. Create a Java Application Configuration in the Run Configurations dialog box, right-clicking Java Application > New Configuration with the following: +1. Create a Java Application Configuration in the `Run > Run Configurations` dialog box, right-clicking `Java Application > New Configuration` with the following: 1. Name the configuration: `App`. - 1. Put in the following value for Project: `code-examples-java`. - 1. Put in the following value into the Main class: `com.docusign.App`. + 1. Name the Project: `code-examples-java`. + 1. Name the Main class: `com.docusign.App`. 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. 1. Select `Run` to run the launcher. A browser window should automatically open to the consent page. 1. [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine. Open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. From 7d5f0ce9602e2d4708228309e137c1f0de2c300b Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 18:10:07 -0700 Subject: [PATCH 138/699] more Eclipse updates --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 008ebebb..b707507d 100644 --- a/README.md +++ b/README.md @@ -320,7 +320,8 @@ authorization.code.grant.client.client-id (**Integration Key**), authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), jwt.grant.client.client-id (**Integration Key**), wt.grant.client.impersonated-user-guid (**API Username**). -Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** +Save this file as `application.json`. +**Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your Quickstart folder name or code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. 1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. From 3dc15018419ebef7a24adad8b8a6f901210662fb Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 18:11:57 -0700 Subject: [PATCH 139/699] Updated IntelliJ #2 --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b707507d..ca50ed50 100644 --- a/README.md +++ b/README.md @@ -255,11 +255,20 @@ The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next 2 steps as they were automatically performed for you.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1 and 2 as they were automatically performed for you.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** +1. Open the `src\main\resources\application.example.json` file. +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. +The DS_SIGNER_NAME, DS_SIGNER_EMAIL, +DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), +authorization.code.grant.client.client-id (**Integration Key**), +authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), +jwt.grant.client.client-id (**Integration Key**), +wt.grant.client.impersonated-user-guid (**API Username**). +Save this file as `application.json`. +**Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Start IntelliJ Ultimate and choose the **Open or Import** option. ![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) 1. Use the popup file chooser to select From b9de4cdaaed15b16ad65c9eb686ea729cf628a42 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 18:13:02 -0700 Subject: [PATCH 140/699] Added line breaks around image --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ca50ed50..289eccef 100644 --- a/README.md +++ b/README.md @@ -269,8 +269,8 @@ jwt.grant.client.client-id (**Integration Key**), wt.grant.client.impersonated-user-guid (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Start IntelliJ Ultimate and choose the **Open or Import** option. -![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) +1. Start IntelliJ Ultimate and choose the **Open or Import** option. +![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) 1. Use the popup file chooser to select **code-examples-java** or your unzipped Quickstart directory. 1. The **Import Project** wizard will open. It's a From eab9a027829ab210e371652351e4a453af80f98a Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 18 Mar 2021 18:16:09 -0700 Subject: [PATCH 141/699] Syncing IntelliJ, Eclipse instructions with public README --- README.md | 60 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9cc82b1f..21434197 100644 --- a/README.md +++ b/README.md @@ -249,19 +249,27 @@ $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ``` -## IntelliJ Ultimate instructions for Windows -The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. - +## IntelliJ Ultimate instructions for Windows +The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next 2 steps as they were automatically performed for you.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1 and 2 as they were automatically performed for you.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** -1. Start IntelliJ Ultimate and choose the **Open or Import** option. -![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) +1. Open the `src\main\resources\application.example.json` file. +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. +The DS_SIGNER_NAME, DS_SIGNER_EMAIL, +DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), +authorization.code.grant.client.client-id (**Integration Key**), +authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), +jwt.grant.client.client-id (**Integration Key**), +wt.grant.client.impersonated-user-guid (**API Username**). +Save this file as `application.json`. +**Don't add this application.json file to your GitHub repo since it contains personal information.** +1. Start IntelliJ Ultimate and choose the **Open or Import** option. +![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) 1. Use the popup file chooser to select **code-examples-java** or your unzipped Quickstart directory. 1. The **Import Project** wizard will open. It's a @@ -307,27 +315,35 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next 2 steps as they were automatically performed for you.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 5.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** - -1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project` and choose `Next`. -1. For the Root directory, Browse for and select this same repo `code-examples-java`. -1. Once selected, click `Finish` at the bottom center to save the project link to your eclipse workspace. -1. Next, click the menu item `Run->Run Configurations` and choose a new Maven configuration to clean and compile with the following: - 1. Name the configuration `build` (If You have downloaded the launcher via Quickstart, skip this step). +1. Open the `src\main\resources\application.example.json` file. +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. +The DS_SIGNER_NAME, DS_SIGNER_EMAIL, +DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), +authorization.code.grant.client.client-id (**Integration Key**), +authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), +jwt.grant.client.client-id (**Integration Key**), +wt.grant.client.impersonated-user-guid (**API Username**). +Save this file as `application.json`. +**Don't add this application.json file to your GitHub repo since it contains personal information.** + +1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your Quickstart folder name or code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. +1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. +1. Next, select `Run > Run Configurations` and right-click `Maven Build` then `New Configuration` to clean and compile with the following: + 1. Name the configuration: `build`. 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. 1. Put in the following values into the Goals field: `clean package`. -1. Click the JRE tab in the Run Configurations menu and make sure your have a Runtime JRE set to jdk-11 or higher. -1. Click apply to save. -1.* Finally, create another configuration by again using `Run->Run Configurations`, choosing Java Application Configuration with the following: - 1. Name the configuration `run` (If You have downloaded the launcher via Quickstart, skip this step). - 1. Put in the following value for project: `code-examples-java`. - 1. Put in the following value into the Main class: `com.docusign.App`. -1. Run the application by using Run dropdown shortcut then choosing build then choosing run. Open your browser to http://localhost:8080. + 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. +1. Create a Java Application Configuration in the `Run > Run Configurations` dialog box, right-clicking `Java Application > New Configuration` with the following: + 1. Name the configuration: `App`. + 1. Name the Project: `code-examples-java`. + 1. Name the Main class: `com.docusign.App`. + 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. + 1. Select `Run` to run the launcher. A browser window should automatically open to the consent page. 1. [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine. Open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. From 0d23846bc1b65131dd942b4edde809ca7aae0e14 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 09:59:22 -0700 Subject: [PATCH 142/699] Updated Eclipse instructions with conventional bold and code font --- README.md | 60 ++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 289eccef..d22a3f8b 100644 --- a/README.md +++ b/README.md @@ -248,25 +248,21 @@ $ cd target $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ``` - ## IntelliJ Ultimate instructions for Windows The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. - - - **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1 and 2 as they were automatically performed for you.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Open the `src\main\resources\application.example.json` file. +1. Open the src\main\resources\application.example.json file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. -The DS_SIGNER_NAME, DS_SIGNER_EMAIL, -DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), -authorization.code.grant.client.client-id (**Integration Key**), -authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), -jwt.grant.client.client-id (**Integration Key**), -wt.grant.client.impersonated-user-guid (**API Username**). +The `DS_SIGNER_NAME`, `DS_SIGNER_EMAIL`, +`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page), +`authorization.code.grant.client.client-id` (**Integration Key**), +`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), +`jwt.grant.client.client-id` (**Integration Key**), +`wt.grant.client.impersonated-user-guid` (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Start IntelliJ Ultimate and choose the **Open or Import** option. @@ -321,31 +317,31 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab [code-examples-java](https://github.com/docusign/code-examples-java) repository -1. Open the `src\main\resources\application.example.json` file. +1. Open the src\main\resources\application.example.json file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. -The DS_SIGNER_NAME, DS_SIGNER_EMAIL, -DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), -authorization.code.grant.client.client-id (**Integration Key**), -authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), -jwt.grant.client.client-id (**Integration Key**), -wt.grant.client.impersonated-user-guid (**API Username**). +The `DS_SIGNER_NAME`, `DS_SIGNER_EMAIL`, +`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page), +`authorization.code.grant.client.client-id` (**Integration Key**), +`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), +`jwt.grant.client.client-id` (**Integration Key**), +`wt.grant.client.impersonated-user-guid` (**API Username**). Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your Quickstart folder name or code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. -1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. -1. Next, select `Run > Run Configurations` and right-click `Maven Build` then `New Configuration` to clean and compile with the following: - 1. Name the configuration: `build`. - 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. - 1. Put in the following values into the Goals field: `clean package`. - 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. -1. Create a Java Application Configuration in the `Run > Run Configurations` dialog box, right-clicking `Java Application > New Configuration` with the following: - 1. Name the configuration: `App`. - 1. Name the Project: `code-examples-java`. - 1. Name the Main class: `com.docusign.App`. - 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. - 1. Select `Run` to run the launcher. A browser window should automatically open to the consent page. -1. [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine. Open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. +1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your or code-examples-java. Under **Projects**, the **pom.xml** file should be selected. +1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. +1. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: + 1. In the **Name** field, input: `build`. + 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}`. + 1. In **Goals**, input: `clean package`. + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. +1. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: + 1. In the **Name** field, input: `App`. + 1. In the **Project** field, input: `code-examples-java`. + 1. In the **Main class** field, input: `com.docusign.App`. + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. + 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. +1. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar`. ### Payments code example From 8791e8cf96ba8514059b5540e133db6345d9d201 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:04:33 -0700 Subject: [PATCH 143/699] more Eclipse instructions updates --- README.md | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d22a3f8b..f64d9d01 100644 --- a/README.md +++ b/README.md @@ -256,13 +256,14 @@ The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used [code-examples-java](https://github.com/docusign/code-examples-java) repository 1. Open the src\main\resources\application.example.json file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. -The `DS_SIGNER_NAME`, `DS_SIGNER_EMAIL`, -`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page), -`authorization.code.grant.client.client-id` (**Integration Key**), -`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), -`jwt.grant.client.client-id` (**Integration Key**), -`wt.grant.client.impersonated-user-guid` (**API Username**). +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: +`DS_SIGNER_NAME` +`DS_SIGNER_EMAIL` +`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) +`authorization.code.grant.client.client-id` (**Integration Key**) +`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) +`jwt.grant.client.client-id` (**Integration Key**) +`wt.grant.client.impersonated-user-guid` (**API Username**) Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Start IntelliJ Ultimate and choose the **Open or Import** option. @@ -318,13 +319,15 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab repository 1. Open the src\main\resources\application.example.json file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. -The `DS_SIGNER_NAME`, `DS_SIGNER_EMAIL`, -`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page), -`authorization.code.grant.client.client-id` (**Integration Key**), -`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), -`jwt.grant.client.client-id` (**Integration Key**), -`wt.grant.client.impersonated-user-guid` (**API Username**). +1. Open the src\main\resources\application.example.json file. +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: +`DS_SIGNER_NAME` +`DS_SIGNER_EMAIL` +`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) +`authorization.code.grant.client.client-id` (**Integration Key**) +`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) +`jwt.grant.client.client-id` (**Integration Key**) +`wt.grant.client.impersonated-user-guid` (**API Username**) Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** From ad29ec6f61d8b0ce2af288117a19c9729c37ac6a Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:10:22 -0700 Subject: [PATCH 144/699] more Eclipse edits --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f64d9d01..7c394063 100644 --- a/README.md +++ b/README.md @@ -257,8 +257,8 @@ The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used repository 1. Open the src\main\resources\application.example.json file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: -`DS_SIGNER_NAME` -`DS_SIGNER_EMAIL` +`DS_SIGNER_NAME` (a string value for the Signer's name) +`DS_SIGNER_EMAIL` (a string value for the Signer's email address) `DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) `authorization.code.grant.client.client-id` (**Integration Key**) `authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) @@ -321,8 +321,8 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab 1. Open the src\main\resources\application.example.json file. 1. Open the src\main\resources\application.example.json file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: -`DS_SIGNER_NAME` -`DS_SIGNER_EMAIL` +`DS_SIGNER_NAME` (a string value for the Signer's name) +`DS_SIGNER_EMAIL` (a string value for the Signer's email address) `DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) `authorization.code.grant.client.client-id` (**Integration Key**) `authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) From 3e99ba88bf0cc714c05999dcd04877688994cd01 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:17:51 -0700 Subject: [PATCH 145/699] more Eclipse editing --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 7c394063..ebdfc332 100644 --- a/README.md +++ b/README.md @@ -317,8 +317,6 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository - -1. Open the src\main\resources\application.example.json file. 1. Open the src\main\resources\application.example.json file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: `DS_SIGNER_NAME` (a string value for the Signer's name) From 3bb6252d0aa205bf4604f22580a735fc2acaeca7 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:19:39 -0700 Subject: [PATCH 146/699] more Eclipse changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ebdfc332..de616406 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,7 @@ Configure the launcher by pasting the following data from your DocuSign develope Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your or code-examples-java. Under **Projects**, the **pom.xml** file should be selected. +1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. Under **Projects**, the **pom.xml** file should be selected. 1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. 1. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: 1. In the **Name** field, input: `build`. From 4d7037bf12cd8bbaf3d09bd02ba93b76d9546531 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:24:09 -0700 Subject: [PATCH 147/699] more Eclipse updates --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index de616406..c12f9cff 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,7 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 5.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository @@ -329,20 +329,21 @@ Configure the launcher by pasting the following data from your DocuSign develope Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. Under **Projects**, the **pom.xml** file should be selected. -1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. -1. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: +1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. + 1. Under **Projects**, the **pom.xml** file should be selected. + 1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. +3. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: 1. In the **Name** field, input: `build`. 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}`. 1. In **Goals**, input: `clean package`. 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. -1. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: +4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: 1. In the **Name** field, input: `App`. 1. In the **Project** field, input: `code-examples-java`. 1. In the **Main class** field, input: `com.docusign.App`. 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. -1. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar`. +5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar`. ### Payments code example From 546c09328ae01b481b712accb29fd897a620c8a1 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:25:50 -0700 Subject: [PATCH 148/699] Added 2 periods --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c12f9cff..7695087d 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1 and 2 as they were automatically performed for you.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) - repository + repository. 1. Open the src\main\resources\application.example.json file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: `DS_SIGNER_NAME` (a string value for the Signer's name) @@ -316,7 +316,7 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) - repository + repository. 1. Open the src\main\resources\application.example.json file. Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: `DS_SIGNER_NAME` (a string value for the Signer's name) From 21f3c6a251e58f840a73ba8c819feabdfbbfb741 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:30:08 -0700 Subject: [PATCH 149/699] synced IntelliJ, Eclipse instructions with public README --- README.md | 73 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 21434197..dd7f1635 100644 --- a/README.md +++ b/README.md @@ -251,21 +251,21 @@ $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ## IntelliJ Ultimate instructions for Windows -The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. - +The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1 and 2 as they were automatically performed for you.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) - repository -1. Open the `src\main\resources\application.example.json` file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. -The DS_SIGNER_NAME, DS_SIGNER_EMAIL, -DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), -authorization.code.grant.client.client-id (**Integration Key**), -authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), -jwt.grant.client.client-id (**Integration Key**), -wt.grant.client.impersonated-user-guid (**API Username**). + repository. +1. Open the src\main\resources\application.example.json file. +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: +`DS_SIGNER_NAME` (a string value for the Signer's name) +`DS_SIGNER_EMAIL` (a string value for the Signer's email address) +`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) +`authorization.code.grant.client.client-id` (**Integration Key**) +`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) +`jwt.grant.client.client-id` (**Integration Key**) +`wt.grant.client.impersonated-user-guid` (**API Username**) Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Start IntelliJ Ultimate and choose the **Open or Import** option. @@ -315,36 +315,37 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 5.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) - repository - -1. Open the `src\main\resources\application.example.json` file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page. -The DS_SIGNER_NAME, DS_SIGNER_EMAIL, -DS_TARGET_ACCOUNT_ID (the **API Username** in the **Apps and Keys** page), -authorization.code.grant.client.client-id (**Integration Key**), -authorization.code.grant.client.client-secret (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**), -jwt.grant.client.client-id (**Integration Key**), -wt.grant.client.impersonated-user-guid (**API Username**). + repository. +1. Open the src\main\resources\application.example.json file. +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: +`DS_SIGNER_NAME` (a string value for the Signer's name) +`DS_SIGNER_EMAIL` (a string value for the Signer's email address) +`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) +`authorization.code.grant.client.client-id` (**Integration Key**) +`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) +`jwt.grant.client.client-id` (**Integration Key**) +`wt.grant.client.impersonated-user-guid` (**API Username**) Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select import. When the window appears, click the Maven folder, then click `Existing Maven Project`, and `Browse` for your Quickstart folder name or code-examples-java repo. Under `Projects`, the `pom.xml` file should be selected. -1. Select the `Add project(s) to working set` checkbox to save the project link to your Eclipse workspace. Select `Finish`. -1. Next, select `Run > Run Configurations` and right-click `Maven Build` then `New Configuration` to clean and compile with the following: - 1. Name the configuration: `build`. - 1. Put in the following value for your workspace in the Base Directory: `${workspace_loc:/code-examples-java}`. - 1. Put in the following values into the Goals field: `clean package`. - 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. -1. Create a Java Application Configuration in the `Run > Run Configurations` dialog box, right-clicking `Java Application > New Configuration` with the following: - 1. Name the configuration: `App`. - 1. Name the Project: `code-examples-java`. - 1. Name the Main class: `com.docusign.App`. - 1. Select the JRE tab in the Run Configurations menu and make sure you have a Runtime JRE set to jdk-11 or higher. Select `Apply` to save. - 1. Select `Run` to run the launcher. A browser window should automatically open to the consent page. -1. [Optional] Install Lombok by downloading the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) itself to your local machine. Open a terminal or command prompt window and install by typing in `java -jar lombok.jar` then pressing **Enter**. +1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. + 1. Under **Projects**, the **pom.xml** file should be selected. + 1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. +3. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: + 1. In the **Name** field, input: `build`. + 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}`. + 1. In **Goals**, input: `clean package`. + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. +4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: + 1. In the **Name** field, input: `App`. + 1. In the **Project** field, input: `code-examples-java`. + 1. In the **Main class** field, input: `com.docusign.App`. + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. + 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. +5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar`. ### Payments code example From 98072657676781887a5624d07853ff8394c98353 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 12:44:02 -0700 Subject: [PATCH 150/699] update IntelliJ instructions --- README.md | 63 +++++++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index dd7f1635..6e630d23 100644 --- a/README.md +++ b/README.md @@ -258,47 +258,28 @@ The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used [code-examples-java](https://github.com/docusign/code-examples-java) repository. 1. Open the src\main\resources\application.example.json file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: +Configure the launcher by pasting the following data from your DocuSign developer account's [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: `DS_SIGNER_NAME` (a string value for the Signer's name) `DS_SIGNER_EMAIL` (a string value for the Signer's email address) `DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) `authorization.code.grant.client.client-id` (**Integration Key**) -`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) +`authorization.code.grant.client.client-secret` (To the right of your **Integration Key**, select **Actions** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) `jwt.grant.client.client-id` (**Integration Key**) `wt.grant.client.impersonated-user-guid` (**API Username**) Save this file as `application.json`. -**Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Start IntelliJ Ultimate and choose the **Open or Import** option. -![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) -1. Use the popup file chooser to select -**code-examples-java** or your unzipped Quickstart directory. -1. The **Import Project** wizard will open. It's a -series of screens. On the first screen, select -**Import project from external model** and **Maven**. -![IntelliJ Import Maven project](./docs/install_fig_2.png) -1. Click **Finish** and the project will -be displayed in the IDE. - -### Configuring IntelliJ's *Run/Debug Configuration* -IntelliJ uses **Run/Debug Configuration** to manage -settings for running the launcher. - -Set up a Run/Debug Configuration for the launcher: - -1. Use the menu command **Run > Edit configurations...** -to open the configuration manager. - -1. Click the **+** (plus) sign to add a new configuration. -The configuration type is **Spring Boot**. You may need to -open the additional templates section of the template chooser. +**Don't add this application.json file to your GitHub repo since it contains personal information.** +1. Start IntelliJ Ultimate and choose the **Open** option. + 1. In the dialog box, select your unzipped Quickstart folder or code-examples-java > **OK** + 1. In the **Open or Import Project** dialog box, select **Maven project** > **OK**. -1. Update the form with the **Name** of the -configuration to `code-examples-java` and the **Main class** for the configuration, -`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. - -Under **Spring Boot** select the `Enable debug output` checkbox. - -Select the **OK** button. +1. In the top navigation bar, select **Run** > **Edit configurations...** to create a Java application configuration. + 1. In the far left corner, select **+** > **Spring Boot** + 1. In the **Name** field, input: `App`. + 1. To the right of the **Main class** field, select **...** > **App (com.docusign) code-examples-java** > **OK**. + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. + 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. + 1. Under **Spring Boot**, select the **Enable debug output** checkbox > **OK**. + 1. Select **Run 'App'** to run the launcher. A browser window should automatically open to the consent page. ![Configure a Run configuration](./docs/install_fig_7.png) @@ -315,31 +296,31 @@ Click File, then Settings. From there select `Plugins`. Open the Marketplace tab ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository. 1. Open the src\main\resources\application.example.json file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: +Configure the launcher by pasting the following data from your DocuSign developer account's [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: `DS_SIGNER_NAME` (a string value for the Signer's name) `DS_SIGNER_EMAIL` (a string value for the Signer's email address) `DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) `authorization.code.grant.client.client-id` (**Integration Key**) -`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) +`authorization.code.grant.client.client-secret` (To the right of your **Integration Key**, select **Actions** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) `jwt.grant.client.client-id` (**Integration Key**) `wt.grant.client.impersonated-user-guid` (**API Username**) Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. - 1. Under **Projects**, the **pom.xml** file should be selected. - 1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. -3. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: +1. Open Eclipse and select **Import**. In the dialog box, select the **Maven** folder, then select **Existing Maven Project** > **Next**, then **Browse** for your unzipped Quickstart folder or code-examples-java. + 1. Under **Projects**, check to make sure the **pom.xml** file is selected. + 1. Select the **Add project(s) to working set** checkbox. Select **Finish**. +3. Next, select **Run** > **Run Configurations**, right-click **Maven Build** > **New Configuration** to clean and compile the Maven build: 1. In the **Name** field, input: `build`. 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}`. 1. In **Goals**, input: `clean package`. 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. -4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: +4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application** > **New Configuration** to create a Java application configuration: 1. In the **Name** field, input: `App`. 1. In the **Project** field, input: `code-examples-java`. 1. In the **Main class** field, input: `com.docusign.App`. From 5c5479b4fa3f2fb565389fe04e9884ebf978fabf Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 12:50:23 -0700 Subject: [PATCH 151/699] more intelliJ updates --- README.md | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6e630d23..41d33988 100644 --- a/README.md +++ b/README.md @@ -279,20 +279,8 @@ Save this file as `application.json`. 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. 1. Under **Spring Boot**, select the **Enable debug output** checkbox > **OK**. - 1. Select **Run 'App'** to run the launcher. A browser window should automatically open to the consent page. - -![Configure a Run configuration](./docs/install_fig_7.png) - -### Running or debugging the launcher - -Use a **Run** menu option to run or debug the launcher. - -After the application finishes building, open your browser to http://localhost:8080 - - -### [Optional] Installing Lombok - -Click File, then Settings. From there select `Plugins`. Open the Marketplace tab and type **Lombok**. It should have an author named Michail Plushnikov. Click install then restart IntelliJ. + 1. In the top navigation bar, select **Run 'App'** to run the launcher. A browser window should automatically open to the consent page. +1. [Optional] To install Lombok, select **File** > **Settings...** > **Plugins** > **Marketplace** tab > search for **Lombok**. It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. ## Eclipse instructions From 4ddd6141064fa48f30f42f37c441eb752db6e8bb Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 12:52:58 -0700 Subject: [PATCH 152/699] added periods --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 41d33988..e64a6fc3 100644 --- a/README.md +++ b/README.md @@ -251,7 +251,7 @@ $ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war ## IntelliJ Ultimate instructions for Windows -The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. +The [IntelliJ Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. **Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1 and 2 as they were automatically performed for you.** 1. Download or clone the @@ -268,17 +268,17 @@ Configure the launcher by pasting the following data from your DocuSign develope `wt.grant.client.impersonated-user-guid` (**API Username**) Save this file as `application.json`. **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Start IntelliJ Ultimate and choose the **Open** option. - 1. In the dialog box, select your unzipped Quickstart folder or code-examples-java > **OK** - 1. In the **Open or Import Project** dialog box, select **Maven project** > **OK**. +1. Start IntelliJ Ultimate, and select **Open**. + 1. In the dialog box, select your unzipped Quickstart folder or code-examples-java > **OK**. + 1. In the **Open or Import Project** dialog box, select **Maven project** > **OK**. 1. In the top navigation bar, select **Run** > **Edit configurations...** to create a Java application configuration. - 1. In the far left corner, select **+** > **Spring Boot** - 1. In the **Name** field, input: `App`. - 1. To the right of the **Main class** field, select **...** > **App (com.docusign) code-examples-java** > **OK**. - 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. - 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. - 1. Under **Spring Boot**, select the **Enable debug output** checkbox > **OK**. + 1. In the far left corner, select **+** > **Spring Boot**. + 1. In the **Name** field, input: `App`. + 1. To the right of the **Main class** field, select **...** > **App (com.docusign) code-examples-java** > **OK**. + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. + 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. + 1. Under **Spring Boot**, select the **Enable debug output** checkbox > **OK**. 1. In the top navigation bar, select **Run 'App'** to run the launcher. A browser window should automatically open to the consent page. 1. [Optional] To install Lombok, select **File** > **Settings...** > **Plugins** > **Marketplace** tab > search for **Lombok**. It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. From fadad13cffd155fe306e157fe32d3cc2ef8ddabf Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Mar 2021 12:58:23 -0700 Subject: [PATCH 153/699] more IntelliJ updates --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e64a6fc3..4a534312 100644 --- a/README.md +++ b/README.md @@ -276,10 +276,9 @@ Save this file as `application.json`. 1. In the far left corner, select **+** > **Spring Boot**. 1. In the **Name** field, input: `App`. 1. To the right of the **Main class** field, select **...** > **App (com.docusign) code-examples-java** > **OK**. - 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. - 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. 1. Under **Spring Boot**, select the **Enable debug output** checkbox > **OK**. - 1. In the top navigation bar, select **Run 'App'** to run the launcher. A browser window should automatically open to the consent page. + +1. In the top navigation bar, select **Run 'App'** to run the launcher. A browser window should automatically open to the consent page. 1. [Optional] To install Lombok, select **File** > **Settings...** > **Plugins** > **Marketplace** tab > search for **Lombok**. It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. @@ -303,7 +302,7 @@ Save this file as `application.json`. 1. Open Eclipse and select **Import**. In the dialog box, select the **Maven** folder, then select **Existing Maven Project** > **Next**, then **Browse** for your unzipped Quickstart folder or code-examples-java. 1. Under **Projects**, check to make sure the **pom.xml** file is selected. 1. Select the **Add project(s) to working set** checkbox. Select **Finish**. -3. Next, select **Run** > **Run Configurations**, right-click **Maven Build** > **New Configuration** to clean and compile the Maven build: +3. In the top navigation bar, select **Run** > **Run Configurations**, right-click **Maven Build** > **New Configuration** to clean and compile the Maven build: 1. In the **Name** field, input: `build`. 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}`. 1. In **Goals**, input: `clean package`. @@ -312,8 +311,9 @@ Save this file as `application.json`. 1. In the **Name** field, input: `App`. 1. In the **Project** field, input: `code-examples-java`. 1. In the **Main class** field, input: `com.docusign.App`. - 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. - 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. + +1. In the top navigation bar, select **Run** to run the launcher. A browser window should automatically open to the consent page. 5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar`. From 271f92843b59f16441a0978029a5378adcecdbf3 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Mar 2021 10:34:34 -0700 Subject: [PATCH 154/699] deleted some periods --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7695087d..6818dadd 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ Configure the launcher by pasting the following data from your DocuSign develope `authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) `jwt.grant.client.client-id` (**Integration Key**) `wt.grant.client.impersonated-user-guid` (**API Username**) -Save this file as `application.json`. +Save this file as `application.json` **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Start IntelliJ Ultimate and choose the **Open or Import** option. ![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) @@ -326,24 +326,24 @@ Configure the launcher by pasting the following data from your DocuSign develope `authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) `jwt.grant.client.client-id` (**Integration Key**) `wt.grant.client.impersonated-user-guid` (**API Username**) -Save this file as `application.json`. +Save this file as `application.json` **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. 1. Under **Projects**, the **pom.xml** file should be selected. 1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. 3. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: - 1. In the **Name** field, input: `build`. - 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}`. - 1. In **Goals**, input: `clean package`. + 1. In the **Name** field, input: `build` + 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}` + 1. In **Goals**, input: `clean package` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. 4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: - 1. In the **Name** field, input: `App`. - 1. In the **Project** field, input: `code-examples-java`. - 1. In the **Main class** field, input: `com.docusign.App`. + 1. In the **Name** field, input: `App` + 1. In the **Project** field, input: `code-examples-java` + 1. In the **Main class** field, input: `com.docusign.App` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. -5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar`. +5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar` ### Payments code example From e1909abcb6907881d97154e82f5db940f3763092 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Mar 2021 10:35:50 -0700 Subject: [PATCH 155/699] Deleted some periods --- README.md | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 4a534312..777dce1b 100644 --- a/README.md +++ b/README.md @@ -266,7 +266,7 @@ Configure the launcher by pasting the following data from your DocuSign develope `authorization.code.grant.client.client-secret` (To the right of your **Integration Key**, select **Actions** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) `jwt.grant.client.client-id` (**Integration Key**) `wt.grant.client.impersonated-user-guid` (**API Username**) -Save this file as `application.json`. +Save this file as `application.json` **Don't add this application.json file to your GitHub repo since it contains personal information.** 1. Start IntelliJ Ultimate, and select **Open**. 1. In the dialog box, select your unzipped Quickstart folder or code-examples-java > **OK**. @@ -283,38 +283,37 @@ Save this file as `application.json`. ## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** +**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** 1. Download or clone the [code-examples-java](https://github.com/docusign/code-examples-java) repository. 1. Open the src\main\resources\application.example.json file. -Configure the launcher by pasting the following data from your DocuSign developer account's [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: +Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: `DS_SIGNER_NAME` (a string value for the Signer's name) `DS_SIGNER_EMAIL` (a string value for the Signer's email address) `DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) `authorization.code.grant.client.client-id` (**Integration Key**) -`authorization.code.grant.client.client-secret` (To the right of your **Integration Key**, select **Actions** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) +`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) `jwt.grant.client.client-id` (**Integration Key**) `wt.grant.client.impersonated-user-guid` (**API Username**) -Save this file as `application.json`. +Save this file as `application.json` **Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Open Eclipse and select **Import**. In the dialog box, select the **Maven** folder, then select **Existing Maven Project** > **Next**, then **Browse** for your unzipped Quickstart folder or code-examples-java. - 1. Under **Projects**, check to make sure the **pom.xml** file is selected. - 1. Select the **Add project(s) to working set** checkbox. Select **Finish**. -3. In the top navigation bar, select **Run** > **Run Configurations**, right-click **Maven Build** > **New Configuration** to clean and compile the Maven build: - 1. In the **Name** field, input: `build`. - 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}`. - 1. In **Goals**, input: `clean package`. +1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. + 1. Under **Projects**, the **pom.xml** file should be selected. + 1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. +3. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: + 1. In the **Name** field, input: `build` + 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}` + 1. In **Goals**, input: `clean package` + 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. +4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: + 1. In the **Name** field, input: `App` + 1. In the **Project** field, input: `code-examples-java` + 1. In the **Main class** field, input: `com.docusign.App` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. -4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application** > **New Configuration** to create a Java application configuration: - 1. In the **Name** field, input: `App`. - 1. In the **Project** field, input: `code-examples-java`. - 1. In the **Main class** field, input: `com.docusign.App`. - 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. - -1. In the top navigation bar, select **Run** to run the launcher. A browser window should automatically open to the consent page. -5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar`. + 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. +5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar` ### Payments code example From 3227b1da6fe73ea3b87882d5b38b60da75856853 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 29 Mar 2021 13:25:46 -0700 Subject: [PATCH 156/699] Fix JWT compatibility with path when using raw cli to start launcher Updated readme with java execution on directory target to address jwt compatibility. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 777dce1b..f8e4cb61 100644 --- a/README.md +++ b/README.md @@ -244,8 +244,7 @@ $ mvn package ``` Run: ``` bash -$ cd target -$ java -Dspring.profiles.active=dev -jar code-examples-java-1.0-SNAPSHOT.war +$ java -Dspring.profiles.active=dev -jar target/code-examples-java-1.0-SNAPSHOT.war ``` From 66a9b9c4804c7f839f14f22f210326d7b17a1cda Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 9 Apr 2021 10:22:58 -0700 Subject: [PATCH 157/699] Update PAYMENTS_INSTALLATION.md --- PAYMENTS_INSTALLATION.md | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/PAYMENTS_INSTALLATION.md b/PAYMENTS_INSTALLATION.md index bfd85dcb..d575c2c2 100644 --- a/PAYMENTS_INSTALLATION.md +++ b/PAYMENTS_INSTALLATION.md @@ -1,24 +1,21 @@ -# Configuring a DocuSign payments gateway +# Configure a payment gateway -DocuSign offers built-in connections to multiple payment -gateways. The payments example uses a demo account via the Stripe -gateway service. +DocuSign offers built-in connections to multiple payment gateways. The payments code example uses a developer account via the Stripe gateway service. -## Creating the payments gateway account -1. Login to demo.docusign.net and go to the Admin Tool. -1. On the Integrations / Payments screen, click Stripe. -1. For development, you can skip the Stripe account application - by using the `Skip this account form` link: +## Create a Stripe payment gateway + +1. Select the Stripe button on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. + +1. For development, you can skip the Stripe account application by using the **Skip this account form** link at the top of the page.
+ + ![Skipping the Stripe account form](docs/stripe_skip_account_form_link.png) + + An enabled Stripe payment gateway is now associated with your DocuSign developer account and is shown under **Payment Gateway**. + +1. Save the **Gateway Account ID** GUID to the code example launcher configuration file. - ![Skipping the Stripe account form](docs/stripe_skip_account_form_link.png) -1. Next, the Admin Tool will show that an enabled Stripe - payment gateway account has been associated with your - DocuSign Developer account. -1. Configure the example launcher with the gateway account id shown in the Admin tool. ## Additional documentation -See the -[Managing Payment Gateways](https://support.docusign.com/en/guides/managing-payment-gateways) -documentation. - +* [Managing Payment Gateways](https://support.docusign.com/en/guides/managing-payment-gateways) +* [How to send a request for payment](https://developers.docusign.com/docs/esign-rest-api/how-to/request-a-payment) From 9c0964bac60e2496acac0025b339ee1824455d69 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 9 Apr 2021 10:23:17 -0700 Subject: [PATCH 158/699] Update PAYMENTS_INSTALLATION.md --- PAYMENTS_INSTALLATION.md | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/PAYMENTS_INSTALLATION.md b/PAYMENTS_INSTALLATION.md index bfd85dcb..d575c2c2 100644 --- a/PAYMENTS_INSTALLATION.md +++ b/PAYMENTS_INSTALLATION.md @@ -1,24 +1,21 @@ -# Configuring a DocuSign payments gateway +# Configure a payment gateway -DocuSign offers built-in connections to multiple payment -gateways. The payments example uses a demo account via the Stripe -gateway service. +DocuSign offers built-in connections to multiple payment gateways. The payments code example uses a developer account via the Stripe gateway service. -## Creating the payments gateway account -1. Login to demo.docusign.net and go to the Admin Tool. -1. On the Integrations / Payments screen, click Stripe. -1. For development, you can skip the Stripe account application - by using the `Skip this account form` link: +## Create a Stripe payment gateway + +1. Select the Stripe button on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. + +1. For development, you can skip the Stripe account application by using the **Skip this account form** link at the top of the page.
+ + ![Skipping the Stripe account form](docs/stripe_skip_account_form_link.png) + + An enabled Stripe payment gateway is now associated with your DocuSign developer account and is shown under **Payment Gateway**. + +1. Save the **Gateway Account ID** GUID to the code example launcher configuration file. - ![Skipping the Stripe account form](docs/stripe_skip_account_form_link.png) -1. Next, the Admin Tool will show that an enabled Stripe - payment gateway account has been associated with your - DocuSign Developer account. -1. Configure the example launcher with the gateway account id shown in the Admin tool. ## Additional documentation -See the -[Managing Payment Gateways](https://support.docusign.com/en/guides/managing-payment-gateways) -documentation. - +* [Managing Payment Gateways](https://support.docusign.com/en/guides/managing-payment-gateways) +* [How to send a request for payment](https://developers.docusign.com/docs/esign-rest-api/how-to/request-a-payment) From b7c6a77b8f0fe135d80c56fd92ac267f637eff9f Mon Sep 17 00:00:00 2001 From: robert-knight Date: Tue, 20 Apr 2021 15:23:55 -0700 Subject: [PATCH 159/699] Fixed sequence values for eg013. --- .factorypath | 10 ++++++---- .../examples/EG013ControllerAddDocToTemplate.java | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.factorypath b/.factorypath index b7b2e811..ff1dc2ca 100644 --- a/.factorypath +++ b/.factorypath @@ -51,6 +51,9 @@ + + + @@ -58,7 +61,7 @@ - + @@ -79,7 +82,6 @@ - @@ -89,7 +91,7 @@ - - + + diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index d6335c91..4f183aec 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -140,7 +140,7 @@ private EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { // Add the roles via an inlineTemplate InlineTemplate inlineTemplate = new InlineTemplate(); - inlineTemplate.setSequence("1"); + inlineTemplate.setSequence("2"); inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients(createSigner(args), cc1)); compTemplate1.setInlineTemplates(Arrays.asList(inlineTemplate)); @@ -156,7 +156,7 @@ private EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { CompositeTemplate compTemplate2 = new CompositeTemplate(); compTemplate2.setCompositeTemplateId("2"); InlineTemplate inlineTemplate2 = new InlineTemplate(); - inlineTemplate2.setSequence("2"); + inlineTemplate2.setSequence("1"); inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc1)); compTemplate2.setInlineTemplates(Arrays.asList(inlineTemplate2)); compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, From 0588b1ba4584809cda60b5cc4b8d74b1e719f572 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 20 Apr 2021 18:34:22 -0700 Subject: [PATCH 160/699] Update README.md --- README.md | 128 +++++++++++++++++++++++++----------------------------- 1 file changed, 58 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index aff7b423..953aaa43 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ To use the Click API code examples, modify the **DS_API_NAME** setting at the en **Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). -[![Java Quickstart video](https://img.youtube.com/vi/XGpb861XQuA/0.jpg)](http://www.youtube.com/watch?v=XGpb861XQuA&t=3s "Java Quickstart") ## Introduction This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the @@ -19,11 +18,11 @@ The [Spring Boot security Oauth2 boot autoconfigure package](https://github.com/ The OAuth library is used in the file [WebSecurityConfig.java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/WebSecurityConfig.java). + ## eSignature API For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). - 1. **Use embedded signing.** [Source](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. @@ -104,13 +103,13 @@ For more information about the scopes used for obtaining authorization to use th 1. **Request a signature by SMS delivery** [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java) This code example demonstrates how to send a signature request via an SMS message using the [Envelopes: create](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. + ## Rooms API For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). **Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. - 1. **Create room with Data.** [Source](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) This code example creates a new room in your DocuSign Rooms account to be used for a transaction. @@ -143,6 +142,7 @@ For more information about the scopes used for obtaining authorization to use th Estate account. As a prerequisite, ensure that you have created a form group and set the office ID on this form group before proceeding. + ## Click API For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) @@ -161,91 +161,79 @@ For more information about the scopes used for obtaining authorization to use th [Source](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) This code example shows how to get clickwrap responses. -## Included OAuth grant types: -* Authentication with Docusign via [Authorization Code Grant flow](https://developers.docusign.com/platform/auth/authcode) . -When the token expires, the user is asked to re-authenticate. -The **refresh token** is not used in this example. +## Installation -* Authentication with DocuSign via the [JSON Web Token (JWT) Grant](https://developers.docusign.com/platform/auth/jwt/). -When the token expires, it updates automatically. +### Prerequisites +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, item step 2 as it was automatically performed for you. - **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. +1. A free [DocuSign developer account](https://go.docusign.com/o/sandbox/); create one if you don't already have one. +1. A DocuSign app and integration key that is configured to use either [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) or [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication. + This [video](https://www.youtube.com/watch?v=eiRI4fe5HgM) demonstrates how to obtain an integration key. + + To use [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/), you will need an integration key and a secret key. See [Installation steps](#installation-steps) for details. -## Installation + To use [JWT Grant](https://developers.docusign.com/platform/auth/jwt/), you will need an integration key, an RSA key pair, and the API Username GUID of the impersonated user. See [Installation steps for JWT Grant authentication](#installation-steps-for-jwt-grant-authentication) for details. + + For both authentication flows: + + If you use this launcher on your own workstation, the integration key must include a redirect URIs of -### Prerequisites -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip step 2 below as it is automatically performed for you.** - -1. A DocuSign developer account (email and password) on [demo.docusign.net](https://demo.docusign.net). - Create a [free account](https://go.docusign.com/sandbox/productshot/?elqCampaignId=16533). -1. A DocuSign Integration Key (a client ID) that is configured to use the - OAuth Authorization Code flow. - You will need the **Integration Key** itself, and its **secret**. To - use JSON Web token, you will need the **Integration Key** itself, the - **RSA Secret Key** and an API user ID for the user you are impersonating. - - If you use this launcher on your own workstation, - the Integration key must include following **Redirect URI**s: * http://localhost:8080/login&type=acg * http://localhost:8080/login&type=jwt - If you will not be running the launcher on your own workstation, - use the appropriate DNS name and port instead of `localhost:8080`. - A sample Redirect URI: http://myserver.it.mycompany.com/login + If you host this launcher on a remote web server, set your redirect URI as + + {base_url}/login + + where {base_url} is the URL for the web app. 1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later 1. [Maven](https://maven.apache.org/download.cgi) -1. A name and email for a signer, and a name and email for a cc recipient. - The signer and the cc email cannot be the same. -1. **Optional** [Lombok Annotations Processing](https://www.baeldung.com/lombok-ide) configured for your IDE. - - -#### Authorization Code Grant specifics: - You will need the integration key and its secret. The integration key must include a redirect URI of - - {app_url}/login&type=acg - where {app_url} is the URL you have associated with the folder where the source files are located. - For example, if you have created a web server that enables the URL - - http://localhost:8080/ - - to execute files on the /public folder of this example, then you must add a redirect URI to your integration key with the value - http://localhost:8080/login&type=acg - -#### JWT (JSON Web Token) specifics: - You will need the integration key, an RSA private key, and the user ID (GUID) of the impersonated user. - The private part of the RSA key pair must be copied over and stored in a private.key file located in `src\main\resources\private.key`. - - **Note:** Before you can make any API calls using JWT Grant, you must get your user’s consent for your app to impersonate them. To do this, the `impersonation` scope is added when requesting a JSON Web Token. ### Installation steps -1. Download or clone this repository. -1. The project includes a Maven pom file. -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip the next step as it was automatically performed for you.** -1. Configure the project by overriding necessary properties from the `src\main\resources\application.example.json` and saving this file as `application.json` file. **Don't add this file into the Git index.** -1. Add VM argument `-Dspring.profiles.active=dev` to your IDE -1. Note that IntelliJ IDEA Community Edition does not directly support - Spring Boot applications. -1. [Optional] Install Lombok for your IDE (See the IntelliJ or Eclipse instructions below for specific details). +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, step 4 as it was automatically performed for you. + +1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. +1. In your command-line environment, switch to the folder: + `cd ` or `cd code-examples-java` +1. Package the code: `mvn package` +1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. + 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. + 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions** > **Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. + 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. + 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. + 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. +**Note:** Protect your personal information. Please make sure that application.json will not be stored in your source code repository. +1. Run the launcher: `java -Dspring.profiles.active=dev -jar target/code-examples-java-1.0-SNAPSHOT.war` -**NOTE:** If Lombok Annotations Processing is not installed in your IDE, you will see several errors regarding undefined methods. These methods are generated at compile time and do not otherwise impact the functionality of the launcher. - -![Lombok Errors Example](./docs/lombok_errors.png) -### Build and run -Launchers are built as a dedicated application with embedded TomCat server. Build: -``` bash -$ cd code-examples-java -$ mvn package -``` -Run: -``` bash -$ java -Dspring.profiles.active=dev -jar target/code-examples-java-1.0-SNAPSHOT.war -``` +### Installation steps for JWT Grant authentication + +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, step 4 as it was automatically performed for you. +Also, in order to select JSON Web Token authentication in the launcher, in src/main/resources/application.json, change `quickstart` to `false`. + +1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. +1. In your command-line environment, switch to the folder: + `cd ` or `cd code-examples-java` +1. Package the code: `mvn package` +1. To configure the launcher for [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. + 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID` and as your `jwt.grant.client.impersonated-user-guid`. + 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions** > **Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `jwt.grant.client.client-id`. + 1. Generate an RSA key pair, if you don’t already have one. Under **Authentication**, select **+ GENERATE RSA**. Copy the private key and save it in a new file named src/main/resources/private.key. + 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=jwt. Select **SAVE**. + 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. +**Note:** Protect your personal information. Please make sure that application.json will not be stored in your source code repository. +1. Run the launcher: `java -Dspring.profiles.active=dev -jar target/code-examples-java-1.0-SNAPSHOT.war` + The launcher automatically opens. +1. On the black navigation bar, select **Login**. +1. From the picklist, select **JSON Web Token (JWT) grant** > **Authenticate with DocuSign**. +1. When prompted, log in to your DocuSign developer account. If this is your first time using the app, select **ACCEPT** at the consent window. +3. Select your desired code example. + ## IntelliJ Ultimate instructions for Windows The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. From 69f9b8290613412a7aaefb21e1057ef4568689e3 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 20 Apr 2021 18:35:56 -0700 Subject: [PATCH 161/699] add skip --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 953aaa43..176f075d 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ For more information about the scopes used for obtaining authorization to use th ## Installation ### Prerequisites -**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, item step 2 as it was automatically performed for you. +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip item 2 as it was automatically performed for you. 1. A free [DocuSign developer account](https://go.docusign.com/o/sandbox/); create one if you don't already have one. 1. A DocuSign app and integration key that is configured to use either [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) or [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication. @@ -195,7 +195,7 @@ For more information about the scopes used for obtaining authorization to use th ### Installation steps -**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, step 4 as it was automatically performed for you. +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 4 as it was automatically performed for you. 1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. 1. In your command-line environment, switch to the folder: @@ -213,7 +213,7 @@ For more information about the scopes used for obtaining authorization to use th ### Installation steps for JWT Grant authentication -**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, step 4 as it was automatically performed for you. +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 4 as it was automatically performed for you. Also, in order to select JSON Web Token authentication in the launcher, in src/main/resources/application.json, change `quickstart` to `false`. 1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. From 3207a1b011eb2d0fca481d5265f8a6c5e2c1c902 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Wed, 21 Apr 2021 17:13:54 -0700 Subject: [PATCH 162/699] Update README.md --- README.md | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 176f075d..18ff3574 100644 --- a/README.md +++ b/README.md @@ -236,26 +236,21 @@ Also, in order to select JSON Web Token authentication in the launcher, in src/m ## IntelliJ Ultimate instructions for Windows -The [IntelliJ IDE Ultimate edition](https://www.jetbrains.com/idea/) can be used with the launcher. The IntelliJ Ultimate edition is required due to its support for Spring Boot and JSP view pages. +IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition](https://www.jetbrains.com/idea/download/#section=windows) is required due to its support for Spring Boot and JSP view pages. -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1 and 2 as they were automatically performed for you.** -1. Download or clone the -[code-examples-java](https://github.com/docusign/code-examples-java) - repository. -1. Open the src\main\resources\application.example.json file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: -`DS_SIGNER_NAME` (a string value for the Signer's name) -`DS_SIGNER_EMAIL` (a string value for the Signer's email address) -`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) -`authorization.code.grant.client.client-id` (**Integration Key**) -`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) -`jwt.grant.client.client-id` (**Integration Key**) -`wt.grant.client.impersonated-user-guid` (**API Username**) -Save this file as `application.json` -**Don't add this application.json file to your GitHub repo since it contains personal information.** -1. Start IntelliJ Ultimate and choose the **Open or Import** option. -![IntelliJ Import project](./docs/IntelliJ_import_highlight.jpg) -1. Use the popup file chooser to select +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip steps 1 and 2 as they were automatically performed for you. + +1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. +1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. + 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. + 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions** > **Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. + 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. + 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. + 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. +**Note:** Protect your personal information. Please make sure that application.json will not be stored in your source code repository. +1. Start IntelliJ IDEA Ultimate and select **Open**. + 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. +3. Use the popup file chooser to select **code-examples-java** or your unzipped Quickstart directory. 1. The **Import Project** wizard will open. It's a series of screens. On the first screen, select From bbbd941ae06fbe7c3d7bedbabea9c0c811662301 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Wed, 21 Apr 2021 17:32:23 -0700 Subject: [PATCH 163/699] Update README.md --- README.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 18ff3574..2ebda01f 100644 --- a/README.md +++ b/README.md @@ -248,16 +248,18 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. **Note:** Protect your personal information. Please make sure that application.json will not be stored in your source code repository. -1. Start IntelliJ IDEA Ultimate and select **Open**. - 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. -3. Use the popup file chooser to select -**code-examples-java** or your unzipped Quickstart directory. -1. The **Import Project** wizard will open. It's a -series of screens. On the first screen, select -**Import project from external model** and **Maven**. -![IntelliJ Import Maven project](./docs/install_fig_2.png) -1. Click **Finish** and the project will -be displayed in the IDE. +1. Start IntelliJ IDEA Ultimate. In the **Welcome to IntelliJ IDEA** dialog box, select **Open**. + 1. In the **Open File or Project** dialog box, select your Quickstart folder or code-examples-java, then select **OK**. + 1. In **Open or Import Project** dialog box, select **Maven project**, then select **OK**. +1. Create a Java application configuration: In the top navigation bar, select **Run** > **Edit configurations**. + 1. In the far left corner, select **+** > **Spring Boot**. + 1. To the right of **Main class**, select **... > App (com.docusign) code-examples-java**, then select **OK**. + 1. Under **Spring Boot**, select the **Enable debug output** checkbox, then select **OK**. +1. Run the launcher: In the top navigation bar, select **Run 'App'**. + The launcher automatically opens. +1. [Optional] To install Lombok, select **File > Settings > Plugins > Marketplace** tab. To the right of the magnifying glass icon, input: `Lombok` + It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. + ### Configuring IntelliJ's *Run/Debug Configuration* IntelliJ uses **Run/Debug Configuration** to manage From 919e9d63806edf0a8ec927f4b0b524af099374f7 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Wed, 21 Apr 2021 17:36:32 -0700 Subject: [PATCH 164/699] select Run --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ebda01f..ab967a2d 100644 --- a/README.md +++ b/README.md @@ -243,7 +243,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. - 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions** > **Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. + 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. @@ -255,7 +255,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. In the far left corner, select **+** > **Spring Boot**. 1. To the right of **Main class**, select **... > App (com.docusign) code-examples-java**, then select **OK**. 1. Under **Spring Boot**, select the **Enable debug output** checkbox, then select **OK**. -1. Run the launcher: In the top navigation bar, select **Run 'App'**. +1. Run the launcher: In the top navigation bar, select **Run > Run 'App'**. The launcher automatically opens. 1. [Optional] To install Lombok, select **File > Settings > Plugins > Marketplace** tab. To the right of the magnifying glass icon, input: `Lombok` It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. From 8a8f4323dd4ab89a934b316a0c595f8d788630d3 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Wed, 21 Apr 2021 17:56:42 -0700 Subject: [PATCH 165/699] Update README.md --- README.md | 86 ++++++++++++++++--------------------------------------- 1 file changed, 24 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index ab967a2d..85937390 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ Also, in order to select JSON Web Token authentication in the launcher, in src/m ## IntelliJ Ultimate instructions for Windows IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition](https://www.jetbrains.com/idea/download/#section=windows) is required due to its support for Spring Boot and JSP view pages. -**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip steps 1 and 2 as they were automatically performed for you. +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 2 as it was automatically performed for you. 1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. @@ -256,90 +256,52 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. To the right of **Main class**, select **... > App (com.docusign) code-examples-java**, then select **OK**. 1. Under **Spring Boot**, select the **Enable debug output** checkbox, then select **OK**. 1. Run the launcher: In the top navigation bar, select **Run > Run 'App'**. - The launcher automatically opens. + When prompted, log in to your DocuSign developer account. If this is your first time using the app, select **ACCEPT** at the consent window. 1. [Optional] To install Lombok, select **File > Settings > Plugins > Marketplace** tab. To the right of the magnifying glass icon, input: `Lombok` It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. -### Configuring IntelliJ's *Run/Debug Configuration* -IntelliJ uses **Run/Debug Configuration** to manage -settings for running the launcher. - -Set up a Run/Debug Configuration for the launcher: - -1. Use the menu command **Run > Edit configurations...** -to open the configuration manager. - -1. Click the **+** (plus) sign to add a new configuration. -The configuration type is **Spring Boot**. You may need to -open the additional templates section of the template chooser. - -1. Update the form with the **Name** of the -configuration to `code-examples-java` and the **Main class** for the configuration, -`com.docusign.App` **Tip:** use the **...** (ellipses) button next to the field to choose the Main class. - -Under **Spring Boot** select the `Enable debug output` checkbox. - -Select the **OK** button. - -![Configure a Run configuration](./docs/install_fig_7.png) - -### Running or debugging the launcher - -Use a **Run** menu option to run or debug the launcher. - -After the application finishes building, open your browser to http://localhost:8080 - - -### [Optional] Installing Lombok +## Eclipse instructions -Click File, then Settings. From there select `Plugins`. Open the Marketplace tab and type **Lombok**. It should have an author named Michail Plushnikov. Click install then restart IntelliJ. +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 2 as it was automatically performed for you. +1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. +1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. + 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. + 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. + 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. + 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. + 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. +**Note:** Protect your personal information. Please make sure that application.json will not be stored in your source code repository. -## Eclipse instructions -**Note: If you downloaded this code using Quickstart from the DocuSign Developer Center, skip Steps 1, 2, and 4.** -1. Download or clone the -[code-examples-java](https://github.com/docusign/code-examples-java) - repository. -1. Open the src\main\resources\application.example.json file. -Configure the launcher by pasting the following data from your DocuSign developer account [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page: -`DS_SIGNER_NAME` (a string value for the Signer's name) -`DS_SIGNER_EMAIL` (a string value for the Signer's email address) -`DS_TARGET_ACCOUNT_ID` (the **API Username** in the **Apps and Keys** page) -`authorization.code.grant.client.client-id` (**Integration Key**) -`authorization.code.grant.client.client-secret` (Select the **Actions** button to the right of your **Integration Key** > **Edit** > **Authentication** > **+ ADD SECRET KEY** > **Secret Key**) -`jwt.grant.client.client-id` (**Integration Key**) -`wt.grant.client.impersonated-user-guid` (**API Username**) -Save this file as `application.json` -**Don't add this application.json file to your GitHub repo since it contains personal information.** - -1. Open Eclipse and select import. When the window appears, select the Maven folder, then select **Existing Maven Project**, and **Browse** for your Quickstart folder name or code-examples-java. - 1. Under **Projects**, the **pom.xml** file should be selected. - 1. Select the **Add project(s) to working set** checkbox to save the project link to your Eclipse workspace. Select **Finish**. -3. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile: +1. Open Eclipse and select **File > Import**. In the **Import** dialog box, select **Existing Maven Project > Next > Browse**, browse for your Quickstart folder or code-examples-java, then **Select Folder**. + 1. Under **Projects**, the `pom.xml` file should be selected. + 1. To save the project link to your Eclipse workspace, select the **Add project(s) to working set** checkbox. Select **Finish**. +1. Next, select **Run**, then **Run Configurations**, and right-click **Maven Build**, then **New Configuration** to clean and compile the package. 1. In the **Name** field, input: `build` - 1. In **Base Directory**, input: `${workspace_loc:/code-examples-java}` + 1. In **Base directory**, input: `${workspace_loc:/code-examples-java}` 1. In **Goals**, input: `clean package` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. -4. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**: +1. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**. 1. In the **Name** field, input: `App` 1. In the **Project** field, input: `code-examples-java` 1. In the **Main class** field, input: `com.docusign.App` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. - 1. Select **Run** to run the launcher. A browser window should automatically open to the consent page. -5. [Optional] Download the [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine. To install Lombok, open a terminal or command line. Run `java -jar lombok.jar` + 1. Select **Run** to run the launcher. + When prompted, log in to your DocuSign developer account. If this is your first time using the app, select **ACCEPT** at the consent window. +1. [Optional] Download [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine, then run the following command to install Lombok: `java -jar lombok.jar` ### Payments code example -To use the payments example, create a test payments gateway for your developer account. See the [PAYMENTS_INSTALLATION.md](https://github.com/docusign/code-examples-java/blob/master/PAYMENTS_INSTALLATION.md) file for instructions. +To use the payments code example, create a test payment gateway on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. See [Configure a payment gateway](./PAYMENTS_INSTALLATION.md) for details. -Then add the payment gateway account id to the **application.json** file. +Once you've created a payment gateway, save the **Gateway Account ID** GUID to application.json. ## License and additional information ### License -This repository uses the MIT License. See the LICENSE file for more information. +This repository uses the MIT License. See [LICENSE](./LICENSE) for details. ### Pull Requests Pull requests are welcomed. Pull requests will only be considered if their content From 1925785ffda67d48a50917279eee3c5f362f4736 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Wed, 21 Apr 2021 18:30:55 -0700 Subject: [PATCH 166/699] Update README.md --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 85937390..3864c825 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ For more information about the scopes used for obtaining authorization to use th ## Installation ### Prerequisites -**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip item 2 as it was automatically performed for you. +**Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip items 1 and 2 as they were automatically performed for you. 1. A free [DocuSign developer account](https://go.docusign.com/o/sandbox/); create one if you don't already have one. 1. A DocuSign app and integration key that is configured to use either [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) or [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication. @@ -178,7 +178,7 @@ For more information about the scopes used for obtaining authorization to use th For both authentication flows: - If you use this launcher on your own workstation, the integration key must include a redirect URIs of + If you use this launcher on your own workstation, the integration key must include redirect URIs of * http://localhost:8080/login&type=acg * http://localhost:8080/login&type=jwt @@ -203,7 +203,7 @@ For more information about the scopes used for obtaining authorization to use th 1. Package the code: `mvn package` 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. - 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions** > **Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. + 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. @@ -214,16 +214,15 @@ For more information about the scopes used for obtaining authorization to use th ### Installation steps for JWT Grant authentication **Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 4 as it was automatically performed for you. -Also, in order to select JSON Web Token authentication in the launcher, in src/main/resources/application.json, change `quickstart` to `false`. +Also, in order to select JSON Web Token authentication in the launcher, in src/main/resources/application.json, change the `quickstart` setting to `false`. 1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. -1. In your command-line environment, switch to the folder: - `cd ` or `cd code-examples-java` +1. In your command-line environment, switch to the folder: `cd ` or `cd code-examples-java` 1. Package the code: `mvn package` 1. To configure the launcher for [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID` and as your `jwt.grant.client.impersonated-user-guid`. - 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions** > **Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `jwt.grant.client.client-id`. - 1. Generate an RSA key pair, if you don’t already have one. Under **Authentication**, select **+ GENERATE RSA**. Copy the private key and save it in a new file named src/main/resources/private.key. + 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `jwt.grant.client.client-id`. + 1. Generate an RSA key pair, if you don’t already have one. Under **Authentication**, select **+ GENERATE RSA**. Copy the private key, and save it in a new file named src/main/resources/private.key. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=jwt. Select **SAVE**. 1. Set a name and email address for the signer. In application.json, save an email address as `DS_SIGNER_EMAIL` and a name as `DS_SIGNER_NAME`. **Note:** Protect your personal information. Please make sure that application.json will not be stored in your source code repository. @@ -255,7 +254,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. In the far left corner, select **+** > **Spring Boot**. 1. To the right of **Main class**, select **... > App (com.docusign) code-examples-java**, then select **OK**. 1. Under **Spring Boot**, select the **Enable debug output** checkbox, then select **OK**. -1. Run the launcher: In the top navigation bar, select **Run > Run 'App'**. +1. Run the launcher: In the top navigation bar, select **Run > Run 'App'**. The launcher automatically opens. When prompted, log in to your DocuSign developer account. If this is your first time using the app, select **ACCEPT** at the consent window. 1. [Optional] To install Lombok, select **File > Settings > Plugins > Marketplace** tab. To the right of the magnifying glass icon, input: `Lombok` It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. @@ -287,7 +286,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. In the **Project** field, input: `code-examples-java` 1. In the **Main class** field, input: `com.docusign.App` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. - 1. Select **Run** to run the launcher. + 1. Select **Run** to run the launcher. The launcher automatically opens. When prompted, log in to your DocuSign developer account. If this is your first time using the app, select **ACCEPT** at the consent window. 1. [Optional] Download [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine, then run the following command to install Lombok: `java -jar lombok.jar` From f7d616abccb4993ca4e7db829226c57dcd8c27c5 Mon Sep 17 00:00:00 2001 From: annahileta Date: Mon, 26 Apr 2021 15:14:00 +0300 Subject: [PATCH 167/699] Get monitoring data code example --- pom.xml | 14 ++ .../java/com/docusign/WebSecurityConfig.java | 3 + .../java/com/docusign/common/ApiIndex.java | 3 +- .../examples/AbstractMonitorController.java | 23 +++ .../examples/M001GetMonitoringData.java | 139 ++++++++++++++++++ .../views/pages/monitor/examples/m001.jsp | 24 +++ .../templates/views/pages/monitor/index.jsp | 60 ++++++++ 7 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java create mode 100644 src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp diff --git a/pom.xml b/pom.xml index bbd778c0..411ddb6e 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,7 @@ org.projectlombok lombok + 1.18.20 true @@ -92,11 +93,24 @@ ${rooms.version} + + com.docusign + docusign-monitor-java + 1.0.0-ALPHA + + com.docusign docusign-click-java ${click.version} + + + org.projectlombok + lombok + RELEASE + compile + diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index a8a6cbf5..3e9d310c 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -36,6 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public String roomScopes[] = new String[] {"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}; public String clickScopes[] = new String[] {"click.manage", "click.send"}; + public String monitorScopes[] = new String[] {"signature", "impersonation"}; @Autowired private DSConfiguration dsConfiguration; @@ -89,6 +90,8 @@ private List getScopes() { scopes = Arrays.asList(this.roomScopes); } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("click")) { scopes = Arrays.asList(this.clickScopes); + } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("monitor")) { + scopes = Arrays.asList(this.monitorScopes); } return scopes; diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index 3d4c110d..7412695f 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -3,7 +3,8 @@ public enum ApiIndex { ESIGNATURE("/pages/esignature/index", "/restapi"), ROOMS("/pages/rooms/index", "/restapi"), - CLICK("/pages/click/index", "/clickapi"); + CLICK("/pages/click/index", "/clickapi"), + MONITOR("/pages/monitor/index", "/restapi"); private final String indexPath; private final String baseUrlSuffix; diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java new file mode 100644 index 00000000..da872999 --- /dev/null +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -0,0 +1,23 @@ +package com.docusign.controller.monitor.examples; + +import com.docusign.DSConfiguration; +import com.docusign.core.controller.AbstractController; +import org.springframework.stereotype.Controller; + +/** + * Abstract base class for all Click controllers. + */ +@Controller +public abstract class AbstractMonitorController extends AbstractController { + + private static final String EXAMPLE_PAGES_PATH = "pages/monitor/examples/"; + + public AbstractMonitorController(DSConfiguration config, String exampleName, String title) { + super(config, exampleName, title); + } + + protected String getExamplePagesPath() { + return AbstractMonitorController.EXAMPLE_PAGES_PATH; + } +} + diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java new file mode 100644 index 00000000..d83701a6 --- /dev/null +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -0,0 +1,139 @@ +package com.docusign.controller.monitor.examples; + +import com.docusign.DSConfiguration; +import com.docusign.WebSecurityConfig; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.AuthType; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; +import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; +import com.docusign.monitor.client.ApiException; +import org.json.JSONArray; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.oauth2.client.OAuth2ClientContext; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + + +/** + * List envelopes in the user's account.
+ * List the envelopes created in the last 30 days. This example demonstrates + * how to query DocuSign about envelopes sent by the current user. + */ +@Controller +@RequestMapping("/m001") +public class M001GetMonitoringData extends AbstractMonitorController { + + private final Session session; + private final User user; + + @Qualifier("oauth2ClientContext") + @Autowired + private OAuth2ClientContext oAuth2ClientContext; + + @Autowired + public M001GetMonitoringData(DSConfiguration config, Session session, User user) { + super(config, "m001", "Get monitoring data"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + String accessToken = this.user.getAccessToken(); + + // Check, if you are using the JWT authentication + // step 1 start + if (session.getAuthTypeSelected() != AuthType.JWT || accessToken.isEmpty()){ + WebSecurityConfig securityConfig = new WebSecurityConfig(); + JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = securityConfig.jwtCodeGrantClient(); + + OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); + accessToken = restTemplate.getAccessToken().toString(); + } + // step 1 end + + String requestPath = "https://lens-d.docusign.net/api/v2.0/datasets/monitor/"; + + JSONArray result = getMonitoringData(requestPath, accessToken); + + // Process results + DoneExample.createDefault(title) + .withMessage("Monitor data response output:") + .withJsonObject(result.toString()) + .addToModel(model); + + return DONE_EXAMPLE_PAGE; + } + + protected JSONArray getMonitoringData(String requestPath, String accessToken) throws IOException { + // Declare variables + Boolean complete = false; + String cursorValue = ""; + Integer limit = 1; // Amount of records you want to read in one request + JSONArray result = new JSONArray(); + + // Get monitoring data + do + { + String cursorValueFormatted = (cursorValue.isEmpty()) ? cursorValue : String.format("=%s", cursorValue); + + // Add cursor value and amount of records to read to the request + String requestParameters = String.format("stream?cursor%s&limit=%d", + cursorValueFormatted, limit); + + URL fullRequestPath = new URL(requestPath + requestParameters); + HttpURLConnection httpConnection = (HttpURLConnection) fullRequestPath.openConnection(); + httpConnection.setRequestMethod("GET"); + + // Construct API headers + // step 2 start + httpConnection.setRequestProperty("Content-Type", "application/json"); + httpConnection.setRequestProperty("Authorization", "Bearer " + accessToken); + // step 2 end + + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); + String temp = ""; + StringBuffer stringBuffer = new StringBuffer(); + while ((temp = bufferedReader.readLine()) != null) { + stringBuffer.append(temp); + } + bufferedReader.close(); + + httpConnection.disconnect(); + // Cleaning the data from wrong symbols + String responseData = stringBuffer.toString().replaceAll("'", ""); + + JSONObject object = new JSONObject(responseData); + String endCursor = object.getString("endCursor"); + + // If the endCursor from the response is the same as the one that you already have, + // it means that you have reached the end of the records + if (endCursor.equals(cursorValue)) + { + complete = true; + } + else + { + cursorValue = endCursor; + result.put(new JSONObject(responseData)); + } + } + while (!complete); + + return result; + } +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp new file mode 100644 index 00000000..f11efaff --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp @@ -0,0 +1,24 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

1. Get monitoring data

+

Demonstrates how to get and display all of your organization's monitoring data.

+ +

Documentation about this example.

+
+ + +

API method used: + DataSet:GetStreamForDataset. +

+

+ View source file ${sourceFile} on GitHub. +

+ +
+ + +
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp new file mode 100644 index 00000000..28fe541c --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -0,0 +1,60 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + +
+
+ + + + + + +
+

Java Launcher

+

Welcome to the DocuSign Java examples using JWT OAuth flow.

+
+ +
+
+ + + + + + + <% + + + // New location to be redirected + String site = new String("/eg001"); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + %> + + + + +
+

Java Launcher

+

Welcome to the Java code examples for DocuSign Monitor API with JWT Grant authentication

+ +

Documentation on using OAuth Authorization Code Grant from a Java application.

+
+ +

Basic Monitor API Examples

+ +

1. Get monitoring data

+

Demonstrates how to get and display all of your organization’s monitoring data.

+

API methods used: + DataSet:GetStreamForDataset +

+
+ + + + + + + From ad37674077e1c52e7ccb7a3089bc9fe54c407642 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 20:21:46 +0000 Subject: [PATCH 168/699] Bump commons-io from 2.6 to 2.7 Bumps commons-io from 2.6 to 2.7. Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bbd778c0..88a659a0 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 11 2.1.1.RELEASE - 2.6 + 2.7 3.11.0-RC2 1.1.0-RC1 1.0.0-BETA From f3719be6afe86f6155e7e8978188c26fa8831e2e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Apr 2021 20:45:05 +0000 Subject: [PATCH 169/699] Bump commons-io from 2.6 to 2.7 Bumps commons-io from 2.6 to 2.7. Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bbd778c0..88a659a0 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 11 2.1.1.RELEASE - 2.6 + 2.7 3.11.0-RC2 1.1.0-RC1 1.0.0-BETA From 1e517a8f94850c292e79543f9947468ad3c24a10 Mon Sep 17 00:00:00 2001 From: annahileta Date: Fri, 30 Apr 2021 18:00:24 +0300 Subject: [PATCH 170/699] Moved authorization check to AbstractMonitorController --- pom.xml | 6 ----- .../examples/AbstractMonitorController.java | 25 ++++++++++++++++++- .../examples/M001GetMonitoringData.java | 22 ++-------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 411ddb6e..5c6a84c7 100644 --- a/pom.xml +++ b/pom.xml @@ -93,12 +93,6 @@ ${rooms.version} - - com.docusign - docusign-monitor-java - 1.0.0-ALPHA - - com.docusign docusign-click-java diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index da872999..2897592f 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -1,17 +1,30 @@ package com.docusign.controller.monitor.examples; import com.docusign.DSConfiguration; +import com.docusign.WebSecurityConfig; import com.docusign.core.controller.AbstractController; +import com.docusign.core.model.AuthType; +import com.docusign.core.model.Session; +import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; +import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.oauth2.client.OAuth2ClientContext; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; import org.springframework.stereotype.Controller; /** - * Abstract base class for all Click controllers. + * Abstract base class for all Monitor controllers. */ @Controller public abstract class AbstractMonitorController extends AbstractController { private static final String EXAMPLE_PAGES_PATH = "pages/monitor/examples/"; + @Qualifier("oauth2ClientContext") + @Autowired + private OAuth2ClientContext oAuth2ClientContext; + public AbstractMonitorController(DSConfiguration config, String exampleName, String title) { super(config, exampleName, title); } @@ -19,5 +32,15 @@ public AbstractMonitorController(DSConfiguration config, String exampleName, Str protected String getExamplePagesPath() { return AbstractMonitorController.EXAMPLE_PAGES_PATH; } + + protected void ensureUsageOfJWTToken(String accessToken, Session session) { + if (session.getAuthTypeSelected() != AuthType.JWT || accessToken.isEmpty()){ + WebSecurityConfig securityConfig = new WebSecurityConfig(); + JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = securityConfig.jwtCodeGrantClient(); + + OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); + accessToken = restTemplate.getAccessToken().toString(); + } + } } diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index d83701a6..5802b1ca 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -1,21 +1,13 @@ package com.docusign.controller.monitor.examples; import com.docusign.DSConfiguration; -import com.docusign.WebSecurityConfig; import com.docusign.common.WorkArguments; -import com.docusign.core.model.AuthType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; -import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; -import com.docusign.monitor.client.ApiException; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.security.oauth2.client.OAuth2ClientContext; -import org.springframework.security.oauth2.client.OAuth2RestTemplate; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; @@ -40,10 +32,6 @@ public class M001GetMonitoringData extends AbstractMonitorController { private final Session session; private final User user; - @Qualifier("oauth2ClientContext") - @Autowired - private OAuth2ClientContext oAuth2ClientContext; - @Autowired public M001GetMonitoringData(DSConfiguration config, Session session, User user) { super(config, "m001", "Get monitoring data"); @@ -52,18 +40,12 @@ public M001GetMonitoringData(DSConfiguration config, Session session, User user) } @Override - protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException { String accessToken = this.user.getAccessToken(); // Check, if you are using the JWT authentication // step 1 start - if (session.getAuthTypeSelected() != AuthType.JWT || accessToken.isEmpty()){ - WebSecurityConfig securityConfig = new WebSecurityConfig(); - JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = securityConfig.jwtCodeGrantClient(); - - OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); - accessToken = restTemplate.getAccessToken().toString(); - } + ensureUsageOfJWTToken(accessToken, this.session); // step 1 end String requestPath = "https://lens-d.docusign.net/api/v2.0/datasets/monitor/"; From 76ff1fad13593c423830c3d652f3de3dcc168091 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 4 May 2021 14:25:57 -0700 Subject: [PATCH 171/699] add Select --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3864c825..98d12dbd 100644 --- a/README.md +++ b/README.md @@ -281,7 +281,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. In **Base directory**, input: `${workspace_loc:/code-examples-java}` 1. In **Goals**, input: `clean package` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. -1. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**. +1. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then select **New Configuration**. 1. In the **Name** field, input: `App` 1. In the **Project** field, input: `code-examples-java` 1. In the **Main class** field, input: `com.docusign.App` From 62d28f1e18a70bdc9aa6fb27a5e5edd223160de4 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 4 May 2021 14:37:53 -0700 Subject: [PATCH 172/699] updated DS_API_NAME section --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 98d12dbd..31fc3dcc 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,11 @@ Github repo: https://github.com/docusign/code-examples-java -This GitHub repo includes code example for the DocuSign eSignature REST API, for the DocuSign Rooms API and for the Click API. - -To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `ROOMS`. -To use the Click API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `CLICK`. - -**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). +This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, and Click API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS` or `CLICK`. ## Introduction + This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the [Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. @@ -106,10 +102,9 @@ For more information about the scopes used for obtaining authorization to use th ## Rooms API +**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). -**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. - 1. **Create room with Data.** [Source](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) This code example creates a new room in your DocuSign Rooms account to be used for a transaction. From a0dd073a44cd9920df11d43b301604384613b101 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 4 May 2021 14:40:35 -0700 Subject: [PATCH 173/699] change Payments to heading --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 31fc3dcc..38b3870a 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,8 @@ Also, in order to select JSON Web Token authentication in the launcher, in src/m 3. Select your desired code example. -## IntelliJ Ultimate instructions for Windows +## IntelliJ Ultimate instructions for Windows + IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition](https://www.jetbrains.com/idea/download/#section=windows) is required due to its support for Spring Boot and JSP view pages. **Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 2 as it was automatically performed for you. @@ -255,7 +256,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. -## Eclipse instructions +## Eclipse instructions for Windows **Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 2 as it was automatically performed for you. @@ -286,7 +287,8 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. [Optional] Download [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine, then run the following command to install Lombok: `java -jar lombok.jar` -### Payments code example +## Payments code example + To use the payments code example, create a test payment gateway on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. See [Configure a payment gateway](./PAYMENTS_INSTALLATION.md) for details. Once you've created a payment gateway, save the **Gateway Account ID** GUID to application.json. From da12581f32c3a64fee3adcf4c9c79f928c367487 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 4 May 2021 14:43:36 -0700 Subject: [PATCH 174/699] Rooms account edits --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38b3870a..eff17568 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ For more information about the scopes used for obtaining authorization to use th ## Rooms API -**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. +**Note:** To use the Rooms API you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). 1. **Create room with Data.** From b62d63b105ae31f1daf4e94bcdb9083ac61c627e Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 4 May 2021 14:44:44 -0700 Subject: [PATCH 175/699] synced with private changes --- README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3864c825..eff17568 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,11 @@ Github repo: https://github.com/docusign/code-examples-java -This GitHub repo includes code example for the DocuSign eSignature REST API, for the DocuSign Rooms API and for the Click API. - -To use the Rooms API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `ROOMS`. -To use the Click API code examples, modify the **DS_API_NAME** setting at the end of the application.json file. Set the value to `CLICK`. - -**Note:** to use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). +This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, and Click API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS` or `CLICK`. ## Introduction + This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the [Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. @@ -106,10 +102,9 @@ For more information about the scopes used for obtaining authorization to use th ## Rooms API +**Note:** To use the Rooms API you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). -**Note:** To use the Rooms API you must also [create your DocuSign Developer Account for Rooms](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. - 1. **Create room with Data.** [Source](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) This code example creates a new room in your DocuSign Rooms account to be used for a transaction. @@ -234,7 +229,8 @@ Also, in order to select JSON Web Token authentication in the launcher, in src/m 3. Select your desired code example. -## IntelliJ Ultimate instructions for Windows +## IntelliJ Ultimate instructions for Windows + IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition](https://www.jetbrains.com/idea/download/#section=windows) is required due to its support for Spring Boot and JSP view pages. **Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 2 as it was automatically performed for you. @@ -260,7 +256,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition It should have an author named Michail Plushnikov. Select **Install**, then restart IntelliJ. -## Eclipse instructions +## Eclipse instructions for Windows **Note:** If you downloaded this code using [Quickstart](https://developers.docusign.com/docs/esign-rest-api/quickstart/) from the DocuSign Developer Center, skip step 2 as it was automatically performed for you. @@ -281,7 +277,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. In **Base directory**, input: `${workspace_loc:/code-examples-java}` 1. In **Goals**, input: `clean package` 1. Select the **JRE** tab. Under **Runtime JRE**, ensure it lists jdk-11 or higher. Select **Apply** to save. -1. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then **New Configuration**. +1. In the **Run Configurations** dialog box, in the left sidebar, right-click **Java Application**, then select **New Configuration**. 1. In the **Name** field, input: `App` 1. In the **Project** field, input: `code-examples-java` 1. In the **Main class** field, input: `com.docusign.App` @@ -291,7 +287,8 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. [Optional] Download [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine, then run the following command to install Lombok: `java -jar lombok.jar` -### Payments code example +## Payments code example + To use the payments code example, create a test payment gateway on the [**Payments**](https://admindemo.docusign.com/authenticate?goTo=payments) page in your developer account. See [Configure a payment gateway](./PAYMENTS_INSTALLATION.md) for details. Once you've created a payment gateway, save the **Gateway Account ID** GUID to application.json. From 15e6f9988a393436d06143a4a3d05f4c995732b8 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 5 May 2021 13:29:02 +0300 Subject: [PATCH 176/699] Refactoring code and adding a status code check --- .../java/com/docusign/DSConfiguration.java | 3 +- .../java/com/docusign/common/ApiIndex.java | 2 +- .../examples/AbstractMonitorController.java | 18 +++---- .../examples/M001GetMonitoringData.java | 50 ++++++++++++------- .../controller/GlobalControllerAdvice.java | 2 + .../views/pages/monitor/examples/m001.jsp | 20 ++++---- .../templates/views/pages/monitor/index.jsp | 38 ++++---------- 7 files changed, 67 insertions(+), 66 deletions(-) diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index 0579cadf..f7dbcaa4 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -51,7 +51,8 @@ public class DSConfiguration { @Value("${quickstart:{quickstart}}") private String quickstart; - + @Value("${DS_MONITOR_BASE_PATH}") + private String monitorBasePath; public String getDsReturnUrl() { return appUrl + "/ds-return"; diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index 7412695f..d0659af0 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -4,7 +4,7 @@ public enum ApiIndex { ESIGNATURE("/pages/esignature/index", "/restapi"), ROOMS("/pages/rooms/index", "/restapi"), CLICK("/pages/click/index", "/clickapi"), - MONITOR("/pages/monitor/index", "/restapi"); + MONITOR("/pages/monitor/index", "/api"); private final String indexPath; private final String baseUrlSuffix; diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index 2897592f..5a0ba22a 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -1,16 +1,12 @@ package com.docusign.controller.monitor.examples; import com.docusign.DSConfiguration; -import com.docusign.WebSecurityConfig; import com.docusign.core.controller.AbstractController; import com.docusign.core.model.AuthType; import com.docusign.core.model.Session; -import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; -import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.security.oauth2.client.OAuth2ClientContext; -import org.springframework.security.oauth2.client.OAuth2RestTemplate; import org.springframework.stereotype.Controller; /** @@ -20,6 +16,10 @@ public abstract class AbstractMonitorController extends AbstractController { private static final String EXAMPLE_PAGES_PATH = "pages/monitor/examples/"; + private static final String REDIRECT_PREFIX = "redirect:"; + private static final String REDIRECT_AUTHENTICATION_PAGE = REDIRECT_PREFIX + "/ds/mustAuthenticate"; + + protected static String apiUrl = "/v2.0/datasets/monitor"; @Qualifier("oauth2ClientContext") @Autowired @@ -33,13 +33,11 @@ protected String getExamplePagesPath() { return AbstractMonitorController.EXAMPLE_PAGES_PATH; } - protected void ensureUsageOfJWTToken(String accessToken, Session session) { + protected String ensureUsageOfJWTToken(String accessToken, Session session) { if (session.getAuthTypeSelected() != AuthType.JWT || accessToken.isEmpty()){ - WebSecurityConfig securityConfig = new WebSecurityConfig(); - JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = securityConfig.jwtCodeGrantClient(); - - OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); - accessToken = restTemplate.getAccessToken().toString(); + return REDIRECT_AUTHENTICATION_PAGE; + } else { + return accessToken; } } } diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 5802b1ca..e6b4af99 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -8,11 +8,14 @@ import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.MediaType; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -21,9 +24,8 @@ /** - * List envelopes in the user's account.
- * List the envelopes created in the last 30 days. This example demonstrates - * how to query DocuSign about envelopes sent by the current user. + * Get monitoring data
+ * This example demonstrates how to get monitoring data from the Monitor API. */ @Controller @RequestMapping("/m001") @@ -31,6 +33,7 @@ public class M001GetMonitoringData extends AbstractMonitorController { private final Session session; private final User user; + private static final String PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE = "The connection string may be corrupt, please ensure that you are using a right link."; @Autowired public M001GetMonitoringData(DSConfiguration config, Session session, User user) { @@ -40,17 +43,17 @@ public M001GetMonitoringData(DSConfiguration config, Session session, User user) } @Override - protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException { + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { String accessToken = this.user.getAccessToken(); // Check, if you are using the JWT authentication // step 1 start - ensureUsageOfJWTToken(accessToken, this.session); + accessToken = ensureUsageOfJWTToken(accessToken, this.session); // step 1 end - String requestPath = "https://lens-d.docusign.net/api/v2.0/datasets/monitor/"; + String requestPath = session.getBasePath() + apiUrl; - JSONArray result = getMonitoringData(requestPath, accessToken); + JSONArray result = getMonitoringData(requestPath, accessToken, model); // Process results DoneExample.createDefault(title) @@ -61,9 +64,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - protected JSONArray getMonitoringData(String requestPath, String accessToken) throws IOException { + protected JSONArray getMonitoringData(String requestPath, String accessToken, ModelMap model) throws Exception { // Declare variables - Boolean complete = false; + boolean complete = false; String cursorValue = ""; Integer limit = 1; // Amount of records you want to read in one request JSONArray result = new JSONArray(); @@ -74,30 +77,43 @@ protected JSONArray getMonitoringData(String requestPath, String accessToken) th String cursorValueFormatted = (cursorValue.isEmpty()) ? cursorValue : String.format("=%s", cursorValue); // Add cursor value and amount of records to read to the request - String requestParameters = String.format("stream?cursor%s&limit=%d", + String requestParameters = String.format("/stream?cursor%s&limit=%d", cursorValueFormatted, limit); URL fullRequestPath = new URL(requestPath + requestParameters); HttpURLConnection httpConnection = (HttpURLConnection) fullRequestPath.openConnection(); - httpConnection.setRequestMethod("GET"); + httpConnection.setRequestMethod(HttpMethod.GET.toString()); // Construct API headers // step 2 start - httpConnection.setRequestProperty("Content-Type", "application/json"); - httpConnection.setRequestProperty("Authorization", "Bearer " + accessToken); + httpConnection.setRequestProperty(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); + httpConnection.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + accessToken); // step 2 end + int responseCode = httpConnection.getResponseCode(); + if (responseCode < HttpURLConnection.HTTP_OK || responseCode >= HttpURLConnection.HTTP_BAD_REQUEST) { + if (httpConnection.getResponseMessage() != PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE){ + throw new Exception(httpConnection.getResponseMessage()); + } + + DoneExample.createDefault(this.title) + .withMessage(PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE) + .addToModel(model); + } + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); - String temp = ""; - StringBuffer stringBuffer = new StringBuffer(); + String temp; + StringBuilder stringBuilder = new StringBuilder(); while ((temp = bufferedReader.readLine()) != null) { - stringBuffer.append(temp); + stringBuilder.append(temp); } bufferedReader.close(); + + httpConnection.disconnect(); // Cleaning the data from wrong symbols - String responseData = stringBuffer.toString().replaceAll("'", ""); + String responseData = stringBuilder.toString().replaceAll("'", ""); JSONObject object = new JSONObject(responseData); String endCursor = object.getString("endCursor"); diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 785d763e..40b49ea7 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -124,6 +124,8 @@ private String getBaseUrl(ApiIndex apiIndex, OAuth.Account oauthAccount) { return this.config.getRoomsBasePath(); } else if (apiIndex.equals(ApiIndex.CLICK)) { return this.config.getClickBasePath(); + } else if (apiIndex.equals(ApiIndex.MONITOR)) { + return this.config.getMonitorBasePath(); } else { return oauthAccount.getBaseUri(); } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp index f11efaff..92fbec36 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp @@ -1,24 +1,24 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> +

1. Get monitoring data

Demonstrates how to get and display all of your organization's monitoring data.

- +

Documentation about this example.

API method used: - DataSet:GetStreamForDataset. + DataSet:GetStreamForDataset.

- View source file ${sourceFile} on GitHub. + View source file ${sourceFile} on GitHub.

-
- - + + +
- + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 28fe541c..fceb007f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -1,18 +1,18 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> +
-
+
@@ -20,23 +20,7 @@ - - - - - <% - - - // New location to be redirected - String site = new String("/eg001"); - response.setStatus(response.SC_MOVED_TEMPORARILY); - response.setHeader("Location", site); - %> - - - - -
+

Java Launcher

Welcome to the Java code examples for DocuSign Monitor API with JWT Grant authentication

@@ -45,16 +29,16 @@

Basic Monitor API Examples

-

1. Get monitoring data

+

1. Get monitoring data

Demonstrates how to get and display all of your organization’s monitoring data.

API methods used: - DataSet:GetStreamForDataset + DataSet:GetStreamForDataset

- + - + From 97cbb3f0d9701d0db1f98e4fdc61960df855c247 Mon Sep 17 00:00:00 2001 From: annahileta Date: Thu, 6 May 2021 10:21:42 +0300 Subject: [PATCH 177/699] Added protected access modifier to REDIRECT_AUTHENTICATION_PAGE property --- .../controller/monitor/examples/AbstractMonitorController.java | 2 -- .../java/com/docusign/core/controller/AbstractController.java | 2 +- src/main/resources/application.example.json | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index 5a0ba22a..ca511c26 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -16,8 +16,6 @@ public abstract class AbstractMonitorController extends AbstractController { private static final String EXAMPLE_PAGES_PATH = "pages/monitor/examples/"; - private static final String REDIRECT_PREFIX = "redirect:"; - private static final String REDIRECT_AUTHENTICATION_PAGE = REDIRECT_PREFIX + "/ds/mustAuthenticate"; protected static String apiUrl = "/v2.0/datasets/monitor"; diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index 3af4652d..9826bce0 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -30,7 +30,7 @@ public abstract class AbstractController { private static final String REDIRECT_PREFIX = "redirect:"; - private static final String REDIRECT_AUTHENTICATION_PAGE = REDIRECT_PREFIX + "/ds/mustAuthenticate"; + protected static final String REDIRECT_AUTHENTICATION_PAGE = REDIRECT_PREFIX + "/ds/mustAuthenticate"; protected static final String BEARER_AUTHENTICATION = "Bearer "; protected static final String DONE_EXAMPLE_PAGE = "pages/example_done"; protected static final String DONE_EXAMPLE_PAGE_COMPARE = "pages/example_done_compare"; diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index bbc3c6e1..389e4782 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -8,6 +8,7 @@ "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", "DS_CLICK_BASE_PATH": "https://demo.docusign.net", + "DS_MONITOR_BASE_PATH": "https://lens-d.docusign.net", "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", From a1d0d67dae63dcf6f605b061e544d9975d8c4e45 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Fri, 7 May 2021 15:51:13 -0700 Subject: [PATCH 178/699] font changes and automatic jwt login for monitor api --- .../monitor/examples/M001GetMonitoringData.java | 2 +- .../com/docusign/core/controller/IndexController.java | 8 ++++++-- .../WEB-INF/templates/views/pages/monitor/index.jsp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index e6b4af99..626915b3 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -57,7 +57,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample.createDefault(title) - .withMessage("Monitor data response output:") + .withMessage("Results from the DataSet:GetStreamForDataset method:") .withJsonObject(result.toString()) .addToModel(model); diff --git a/src/main/java/com/docusign/core/controller/IndexController.java b/src/main/java/com/docusign/core/controller/IndexController.java index a1fef547..45557b99 100644 --- a/src/main/java/com/docusign/core/controller/IndexController.java +++ b/src/main/java/com/docusign/core/controller/IndexController.java @@ -48,8 +48,12 @@ public ModelAndView mustAuthenticateController(ModelMap model) { if (session.isRefreshToken() || config.getQuickstart().equals("true")) { return new ModelAndView(getRedirectView(session.getAuthTypeSelected())); } - - return new ModelAndView("pages/ds_must_authenticate"); + else if (config.getApiName().equals("MONITOR")) { + return new ModelAndView(getRedirectView(AuthType.JWT)); + } + else { + return new ModelAndView("pages/ds_must_authenticate"); + } } @RequestMapping(path = "/ds/authenticate", method = RequestMethod.POST) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index fceb007f..d9fef1e6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -30,7 +30,7 @@

Basic Monitor API Examples

1. Get monitoring data

-

Demonstrates how to get and display all of your organization’s monitoring data.

+

Demonstrates how to get and display all of your organization's monitoring data.

API methods used: DataSet:GetStreamForDataset

From f8a066398e67160fee711f46066fbb57f0c513da Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Mon, 10 May 2021 10:19:21 -0700 Subject: [PATCH 179/699] adding gist comments --- .../controller/monitor/examples/M001GetMonitoringData.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 626915b3..637ae40b 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -47,9 +47,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String accessToken = this.user.getAccessToken(); // Check, if you are using the JWT authentication - // step 1 start accessToken = ensureUsageOfJWTToken(accessToken, this.session); - // step 1 end String requestPath = session.getBasePath() + apiUrl; @@ -101,6 +99,7 @@ protected JSONArray getMonitoringData(String requestPath, String accessToken, Mo .addToModel(model); } + // step 3 start BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); String temp; StringBuilder stringBuilder = new StringBuilder(); @@ -131,7 +130,8 @@ protected JSONArray getMonitoringData(String requestPath, String accessToken, Mo } } while (!complete); - + //step 3 end + return result; } } From af2d7161fde7bf85611f8fb6ed6557a2eb250bf5 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Mon, 10 May 2021 11:04:47 -0700 Subject: [PATCH 180/699] responding to PR comments --- .../monitor/examples/M001GetMonitoringData.java | 8 ++++---- .../WEB-INF/templates/views/pages/monitor/index.jsp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 637ae40b..b8db4671 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -33,7 +33,7 @@ public class M001GetMonitoringData extends AbstractMonitorController { private final Session session; private final User user; - private static final String PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE = "The connection string may be corrupt, please ensure that you are using a right link."; + private static final String PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE = "The connection string may be corrupt, please ensure that you are using the right URL."; @Autowired public M001GetMonitoringData(DSConfiguration config, Session session, User user) { @@ -46,7 +46,7 @@ public M001GetMonitoringData(DSConfiguration config, Session session, User user) protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { String accessToken = this.user.getAccessToken(); - // Check, if you are using the JWT authentication + // Check if you are using the JWT authentication accessToken = ensureUsageOfJWTToken(accessToken, this.session); String requestPath = session.getBasePath() + apiUrl; @@ -111,7 +111,7 @@ protected JSONArray getMonitoringData(String requestPath, String accessToken, Mo httpConnection.disconnect(); - // Cleaning the data from wrong symbols + // Removing invalid symbols from the data String responseData = stringBuilder.toString().replaceAll("'", ""); JSONObject object = new JSONObject(responseData); @@ -131,7 +131,7 @@ protected JSONArray getMonitoringData(String requestPath, String accessToken, Mo } while (!complete); //step 3 end - + return result; } } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index d9fef1e6..4500edce 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -27,11 +27,11 @@

Documentation on using OAuth Authorization Code Grant from a Java application.

-

Basic Monitor API Examples

+

Monitor API Code Examples

1. Get monitoring data

Demonstrates how to get and display all of your organization's monitoring data.

-

API methods used: +

API method used: DataSet:GetStreamForDataset

From a9927f3256758bd6dab57518a2cf228aa9aad2f9 Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Tue, 11 May 2021 14:17:53 -0700 Subject: [PATCH 181/699] fixing banner text --- .../webapp/WEB-INF/templates/views/pages/monitor/index.jsp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 4500edce..11ac787a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -9,7 +9,7 @@
-

Java Launcher

-

Welcome to the DocuSign Java examples using JWT OAuth flow.

+

Java Launcher

+

Welcome to the DocuSign Java examples using JWT OAuth flow.

- +

Java Launcher

-

Welcome to the DocuSign Java examples using JWT OAuth flow.

+

Welcome to the Java code examples for DocuSign Monitor API with JWT Grant authentication

@@ -21,8 +21,6 @@
-

Java Launcher

-

Welcome to the Java code examples for DocuSign Monitor API with JWT Grant authentication

Documentation on using OAuth Authorization Code Grant from a Java application.

From 94ce42d87e5dd83de7fb522acfd3e4ad1ef5229d Mon Sep 17 00:00:00 2001 From: Paige Rossi Date: Tue, 11 May 2021 14:22:52 -0700 Subject: [PATCH 182/699] readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index eff17568..2087111f 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,13 @@ For more information about the scopes used for obtaining authorization to use th [Source](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) This code example shows how to get clickwrap responses. +## Monitor API + +**Note:** To use the Monitor API, you must also [enable DocuSign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/). +For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). + +1. **Get monitoring data.** [Source](./src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java) + Demonstrates how to get and display all of your organization’s monitoring data. ## Installation From 1a4c923e45269d46889eadf4ebe3df08d05f8c04 Mon Sep 17 00:00:00 2001 From: Paige Rossi <70241979+paigesrossi@users.noreply.github.com> Date: Tue, 11 May 2021 14:24:04 -0700 Subject: [PATCH 183/699] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2087111f..26ce28d1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Github repo: https://github.com/docusign/code-examples-java -This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, and Click API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS` or `CLICK`. +This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, and Click API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS`, `CLICK`, or `MONITOR`. ## Introduction From 83fd88c2f11c760f809e120c56d602d5df693b5e Mon Sep 17 00:00:00 2001 From: Paige Rossi <70241979+paigesrossi@users.noreply.github.com> Date: Tue, 11 May 2021 14:24:45 -0700 Subject: [PATCH 184/699] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2087111f..a85bad88 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Github repo: https://github.com/docusign/code-examples-java -This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, and Click API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS` or `CLICK`. +This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, Click API, and Monitor API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS`, `CLICK`, or `MONITOR`. ## Introduction From 65955fc941fde315b575a883ce0dc4fb8119feba Mon Sep 17 00:00:00 2001 From: Paige Rossi <70241979+paigesrossi@users.noreply.github.com> Date: Tue, 11 May 2021 14:25:05 -0700 Subject: [PATCH 185/699] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26ce28d1..a85bad88 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Github repo: https://github.com/docusign/code-examples-java -This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, and Click API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS`, `CLICK`, or `MONITOR`. +This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, Click API, and Monitor API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS`, `CLICK`, or `MONITOR`. ## Introduction From 7a85472fb20cb2f0577bcb8f92138d3e75a53dbf Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 27 May 2021 22:59:39 -0700 Subject: [PATCH 186/699] Devdocs 4819 (#30) * Update README.md * Update README.md * add setTabType("Checkbox") to fix and bumps sdk version to 3.13 Co-authored-by: Paige Rossi <70241979+paigesrossi@users.noreply.github.com> --- pom.xml | 2 +- .../examples/EG034ControllerUseConditionalRecipients.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ed25da30..b8f21d8c 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 11 2.1.1.RELEASE 2.7 - 3.11.0-RC2 + 3.13.0-RC1 1.1.0-RC1 1.0.0-BETA diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index d26dc19e..b6b85210 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -167,6 +167,7 @@ private static List createConditionalRecipien filter1.setTabId("ApprovalTab"); filter1.setOperator("equals"); filter1.setValue("false"); + filter1.setTabType("checkbox"); filter1.setTabLabel("ApproveWhenChecked"); ConditionalRecipientRuleFilter filter2 = new ConditionalRecipientRuleFilter(); @@ -175,6 +176,7 @@ private static List createConditionalRecipien filter2.setTabId("ApprovalTab"); filter2.setOperator("equals"); filter2.setValue("true"); + filter2.setTabType("checkbox"); filter2.setTabLabel("ApproveWhenChecked"); ConditionalRecipientRuleCondition condition1 = new ConditionalRecipientRuleCondition(); From ad0591e9e13eeadf86de20a1f7505df8d6d084dd Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Tue, 1 Jun 2021 23:33:59 -0700 Subject: [PATCH 187/699] Update EG013ControllerAddDocToTemplate.java clarify comment order --- .../examples/EG013ControllerAddDocToTemplate.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index 4f183aec..3d7a8630 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -71,25 +71,27 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception } @Override - // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { String accountId = session.getAccountId(); EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 1. Make the envelope request body + // Step 2 start args.setDsReturnUrl(config.getDsReturnUrl()); args.setDsPingUrl(config.getDsPingUrl()); args.setSignerClientId(SIGNER_CLIENT_ID); EnvelopeDefinition envelope = makeEnvelope(args); - - // Step 2. call Envelopes::create API method + // Step 2 end + + // Step 3 start EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - - // Step 3. create the recipient view, the embedded signing + // Step 3 end + + // Step 4 start RecipientViewRequest viewRequest = makeRecipientViewRequest(args); ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); return new RedirectView(viewUrl.getUrl()); + // Step 4 end } private static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) { @@ -179,5 +181,4 @@ private static Signer createSigner(WorkArguments args) { signer.setClientUserId(args.getSignerClientId()); return signer; } - // ***DS.snippet.0.end } From a432b87b2a12dc3a7e4121fefe8ea7a33f1057da Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Wed, 2 Jun 2021 15:52:21 -0700 Subject: [PATCH 188/699] Update EG029ControllerApplyBrandToEnvelope.java --- .../examples/EG029ControllerApplyBrandToEnvelope.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index 7054e570..6334a03b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -84,7 +84,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Creates an envelope. The envelope has one recipient who should sign an // attached document. Attached document is read from a local directory. - // Also the envelope contains a brand Id which is created on EG024 example. + // Also the envelope contains a brand Id which is created on EG028 example. private static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { // Reads a file from a local directory and create Document object. Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); @@ -104,7 +104,7 @@ private static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExce // Return envelope definition using created objects: the document, // the recipients and obtained brand Id. return new EnvelopeDefinition() - .emailSubject("EG025. Please complete your order") + .emailSubject("EG029. Please Sign") .documents(List.of(document)) .recipients(recipients) .brandId(args.getBrandId()) From 3dd7c82d61c537373fedbc9d8327efe3b15be3fc Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 3 Jun 2021 13:10:19 -0700 Subject: [PATCH 189/699] Readme changes to support DC links (#31) * Update EG029ControllerApplyBrandToEnvelope.java * updated readme changes --- README.md | 137 +----------------- .../EG029ControllerApplyBrandToEnvelope.java | 4 +- 2 files changed, 10 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index a85bad88..2d421ffc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Java Launcher Code Examples -Github repo: https://github.com/docusign/code-examples-java +### Github repo: [code-examples-java](./) This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, Click API, and Monitor API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS`, `CLICK`, or `MONITOR`. @@ -19,85 +19,8 @@ The OAuth library is used in the file [WebSecurityConfig.java](https://github.co For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). -1. **Use embedded signing.** - [Source](./src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java) - This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, DocuSign signing is initiated from your website. -1. **Request a signature by email (Remote Signing).** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java) The envelope includes a pdf, Word, and HTML document. - Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. -1. **List envelopes in the user's account.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java) -1. **Get an envelope's basic information.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java) - The example lists the basic information about an envelope, including its overall status. -1. **List an envelope's recipients and their current status.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java) -1. **List an envelope's documents.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java) -1. **Download an envelope's documents.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java) This example can download individual documents, the documents concatenated together, or a zip file of the documents. -1. **Programmatically create a template.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java) -1. **Request a signature by email using a template.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java) -1. **Send an envelope and upload its documents with multipart binary transfer.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java) Binary transfer is 33% more efficient than using Base64 encoding. -1. **Use embedded sending.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java) -1. **Embedded DocuSign web tool (NDSE).** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java) -1. **Use embedded signing from a template with an added document.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java) - This example sends an envelope based on a template. In addition to the template's document(s), the example adds an additional document to the envelope by using the [Composite Templates](https://developers.docusign.com/esign-rest-api/guides/features/templates#composite-templates) feature. -1. **Payments example: an order form, with online payment by credit card.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java) -1. **Get the envelope tab data.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java) Retrieve the tab (field) values for all of the envelope's recipients. -1. **Set envelope tab values.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java) The example creates an envelope and sets the initial values for its tabs (fields). Some of the tabs are set to be read-only, others can be updated by the recipient. The example also stores metadata with the envelope. -1. **Set template tab values.** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java) The example creates an envelope using a template and sets the initial values or its tabs (fields). The example also stores metadata with the envelope. -1. **Get the envelope custom field data (metadata).** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java) The example retrieves the custom metadata (custom data fields) stored with the envelope. -1. **Requiring an Access Code for a Recipient** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java) - This example sends and envelope that requires an access-code for the purpose of multi-factor authentication. -1. **Requiring SMS authentication for a recipient** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java) This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication. -1. **Requiring Phone authentication for a recipient** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java) This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication. -1. **Requiring Knowledge-Based Authentication (KBA) for a Recipient** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java) This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication. -1. **Requiring ID Verification (IDV) for a recipient** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java) This example sends and envelope that requires the recipient to upload a government issued id. -1. **Creating a permission profile** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java) This code example demonstrates how to create a user group's permission profile using the [Create Profile](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/create) method. -1. **Setting a permission profile** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java) This code example demonstrates how to set a user group's permission profile using the [Update Group](https://developers.docusign.com/esign-rest-api/reference/UserGroups/Groups/update) method. You must have already created permissions profile and group of users. -1. **Updating individual permission settings** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java) This code example demonstrates how to update individual settings for a specific permission profile using the [Update Permission Profile](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/update) method. You must have already created permissions profile and group of users. -1. **Deleting a permission profile** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java) - This code example demonstrates how to an account's permission profile using the [Delete AccountPermissionProfiles](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountPermissionProfiles/delete) method. -1. **Creating a brand** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java) - This example creates brand profile for an account using the [Create Brand](https://developers.docusign.com/esign-rest-api/reference/Accounts/AccountBrands/create) method. -1. **Applying a brand to an envelope** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java) This code example demonstrates how to apply a brand you've created to an envelope using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. - First, creates the envelope and then applies brand to it. - Anchor text ([AutoPlace](https://support.docusign.com/en/guides/AutoPlace-New-DocuSign-Experience)) is used to position the signing fields in the documents. -1. **Applying a brand to a template** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java) This code example demonstrates how to apply a brand you've created to a template using using the [Create Envelope](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. You must have at least one created template and brand. -1. **Bulk sending envelopes to multiple recipients** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java) This example creates and sends a bulk envelope by generating a bulk recipient list and initiating a bulk send. -1. **Pausing a signature workflow Source** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. -1. **Unpausing a signature workflow** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java) This code example demonstrates how to resume an envelope workflow that has been paused -1. **Use conditional recipients** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java) This code example demonstrates how to create an envelope where the workflow is paused before the envelope is sent to a second recipient. -1. **Request a signature by SMS delivery** - [Source](./src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java) This code example demonstrates how to send a signature request via an SMS message using the [Envelopes: create](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/create) method. + +For a list of code examples that use the eSignature API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/esign-rest-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Rooms API @@ -105,64 +28,20 @@ For more information about the scopes used for obtaining authorization to use th **Note:** To use the Rooms API you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). -1. **Create room with Data.** - [Source](./src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java) - This code example creates a new room in your DocuSign Rooms account to be used for a transaction. -1. **Create a room from a template.** - [Source](./src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java) - This code example creates a new room using a template. -1. **Create room with Data.** - [Source](./src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java) - This code example exports all the avialalble data from a specific room in your DocuSign Rooms account. -1. **Add forms to a room.** - [Source](./src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java) - This code example adds a standard real estate related form to a specific room in your DocuSign Rooms account. -1. **How to search for rooms with filters.** - [Source](./src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java) - This code example searches for rooms in your DocuSign Rooms account using a specific filter. -1. **Create an external form fillable session.** - [Source](./src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java) - This code example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. - This example create an external form that can be filled using DocuSign for a specific room in your DocuSign Rooms account. -1. **Create a form group.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java) - This code example create a form group for your DocuSign Rooms for Real Estate account. -1. **Grant office access to a form group.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java) - This code example assign an office to a form group for your DocuSign Rooms for Real Estate account. - Granting office access to a form group will enable you to filter which form groups are available based on that office. -1. **Assign a form to a form group.** - [Source.](./src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java) - This example demonstrates how to assign a form to a form group for your DocuSign Rooms for Real - Estate account. As a prerequisite, ensure that you have created a form group and set the - office ID on this form group before proceeding. - +For a list of code examples that use the Rooms API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/rooms-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Click API For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) - -1. **Create Clickwraps.** - [Source](./src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java) This code example shows how to create a clickwrap. -1. **Activate Clickwrap.** - [Source](./src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java) - This code example shows how to activate a new clickwrap that you have already created. -1. **Clickwrap Versioning.** - [Source](./src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java) - This code example shows how to create a new clickwrap version. -1. **Get a list of Clickwraps.** - [Source](./src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java) - This code example shows how to get a list of clickwraps. -1. **Get Clickwrap Responses.** - [Source](./src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java) - This code example shows how to get clickwrap responses. + + +For a list of code examples that use the Click API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/click-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Monitor API **Note:** To use the Monitor API, you must also [enable DocuSign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/). For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). -1. **Get monitoring data.** [Source](./src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java) - Demonstrates how to get and display all of your organization’s monitoring data. +For a list of code examples that use the Click API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/monitor-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Installation diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index 7054e570..6334a03b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -84,7 +84,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Creates an envelope. The envelope has one recipient who should sign an // attached document. Attached document is read from a local directory. - // Also the envelope contains a brand Id which is created on EG024 example. + // Also the envelope contains a brand Id which is created on EG028 example. private static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { // Reads a file from a local directory and create Document object. Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); @@ -104,7 +104,7 @@ private static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExce // Return envelope definition using created objects: the document, // the recipients and obtained brand Id. return new EnvelopeDefinition() - .emailSubject("EG025. Please complete your order") + .emailSubject("EG029. Please Sign") .documents(List.of(document)) .recipients(recipients) .brandId(args.getBrandId()) From 4634fed797b5443ddf3c729828ad665995106eae Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 8 Jun 2021 16:53:39 -0700 Subject: [PATCH 190/699] Update README.md (#32) --- README.md | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2d421ffc..c9abb6f5 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,19 @@ # Java Launcher Code Examples -### Github repo: [code-examples-java](./) +### GitHub repo: [code-examples-java](./README.md) This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, Click API, and Monitor API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS`, `CLICK`, or `MONITOR`. ## Introduction -This repo is a Java Spring Boot application that demonstrates how to authenticate with DocuSign via the -[Authorization Code Grant flow](https://developers.docusign.com/esign-rest-api/guides/authentication/oauth2-code-grant). When the token expires, the user is asked to reauthenticate. The refresh token is not used. +This repo is a Java Spring Boot application that supports the following authentication workflows: + +* Authentication with DocuSign via [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode). +When the token expires, the user is asked to re-authenticate. The refresh token is not used. + +* Authentication with DocuSign via [JSON Web Token (JWT) Grant](https://developers.docusign.com/platform/auth/jwt/). +When the token expires, it updates automatically. The [Spring Boot security Oauth2 boot autoconfigure package](https://github.com/spring-projects/spring-security-oauth2-boot/blob/master/spring-security-oauth2-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoRestTemplateCustomizer.java) is used for authentication. @@ -17,31 +22,33 @@ The OAuth library is used in the file [WebSecurityConfig.java](https://github.co ## eSignature API -For more information about the scopes used for obtaining authorization to use the eSignature API, see the [Required Scopes section](https://developers.docusign.com/docs/esign-rest-api/esign101/auth). +For more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes). -For a list of code examples that use the eSignature API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/esign-rest-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the eSignature API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/esign-rest-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Rooms API -**Note:** To use the Rooms API you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. -For more information about the scopes used for obtaining authorization to use the Rooms API, see the [Required Scopes section](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). +**Note:** To use the Rooms API, you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. +For more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). + +For a list of code examples that use the Rooms API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/rooms-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. -For a list of code examples that use the Rooms API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/rooms-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Click API -For more information about the scopes used for obtaining authorization to use the Click API, see the [Required Scopes section](https://developers.docusign.com/docs/click-api/click101/auth/) +For more information about the scopes used for obtaining authorization to use the Click API, see [Required scopes](https://developers.docusign.com/docs/click-api/click101/auth/#required-scopes) + +For a list of code examples that use the Click API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/click-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. -For a list of code examples that use the Click API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/click-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Monitor API **Note:** To use the Monitor API, you must also [enable DocuSign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/). For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). -For a list of code examples that use the Click API, select the Python tab under [Examples and languages](https://developers.docusign.com/docs/monitor-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the Click API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/monitor-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. ## Installation From 86ad4e7e42f45ed51141cd96898f753c79d12e81 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Tue, 8 Jun 2021 23:45:30 -0700 Subject: [PATCH 191/699] no need to mention api username on acg --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c9abb6f5..c13311c2 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,6 @@ For a list of code examples that use the Click API, select the Java tab under [E `cd ` or `cd code-examples-java` 1. Package the code: `mvn package` 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. - 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. From 2f744741b4df8738ebdcf1f6c648f56a9ab78d81 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Wed, 9 Jun 2021 17:42:50 -0700 Subject: [PATCH 192/699] added back target account id --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c13311c2..c9abb6f5 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ For a list of code examples that use the Click API, select the Java tab under [E `cd ` or `cd code-examples-java` 1. Package the code: `mvn package` 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. + 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. From 369ae665d3fa806edb0d7a77c4bbc605deaecfae Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Wed, 9 Jun 2021 17:44:21 -0700 Subject: [PATCH 193/699] added back target account id --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c13311c2..c9abb6f5 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ For a list of code examples that use the Click API, select the Java tab under [E `cd ` or `cd code-examples-java` 1. Package the code: `mvn package` 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. + 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. From 2fb6e61854aeaae6e76dae14d8f670668092ecf2 Mon Sep 17 00:00:00 2001 From: annahileta <80112359+annahileta@users.noreply.github.com> Date: Thu, 17 Jun 2021 01:48:22 +0300 Subject: [PATCH 194/699] Transfer monitor example to use sdk (#29) * Changed monitor example to use sdk * Removed session property from AbstractMonitorController * Removed formation of the request path and added createApiClient function to Adstract Monitor Controller * Returned request path. Added additional method for getting ApiClient * Added createDataSetApi method * Changed comments and removed content-type header * Remove extra usings * add cursor value and update text * QA fixes Co-authored-by: Karissa Jacobsen --- pom.xml | 7 ++ .../java/com/docusign/common/ApiIndex.java | 2 +- .../examples/AbstractMonitorController.java | 37 ++++++-- .../examples/M001GetMonitoringData.java | 89 ++++++------------- .../views/pages/monitor/examples/m001.jsp | 2 +- .../templates/views/pages/monitor/index.jsp | 36 ++++---- 6 files changed, 81 insertions(+), 92 deletions(-) diff --git a/pom.xml b/pom.xml index b8f21d8c..65b1f0ec 100644 --- a/pom.xml +++ b/pom.xml @@ -23,6 +23,7 @@ 3.13.0-RC1 1.1.0-RC1 1.0.0-BETA + 1.0.0-BETA @@ -99,6 +100,12 @@ ${click.version} + + com.docusign + docusign-monitor-java + ${monitor.version} + + org.projectlombok lombok diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index d0659af0..e210feea 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -4,7 +4,7 @@ public enum ApiIndex { ESIGNATURE("/pages/esignature/index", "/restapi"), ROOMS("/pages/rooms/index", "/restapi"), CLICK("/pages/click/index", "/clickapi"), - MONITOR("/pages/monitor/index", "/api"); + MONITOR("/pages/monitor/index", ""); private final String indexPath; private final String baseUrlSuffix; diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index ca511c26..b544d497 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -4,9 +4,9 @@ import com.docusign.core.controller.AbstractController; import com.docusign.core.model.AuthType; import com.docusign.core.model.Session; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.security.oauth2.client.OAuth2ClientContext; +import com.docusign.monitor.api.DataSetApi; +import com.docusign.monitor.client.ApiClient; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; /** @@ -17,12 +17,6 @@ public abstract class AbstractMonitorController extends AbstractController { private static final String EXAMPLE_PAGES_PATH = "pages/monitor/examples/"; - protected static String apiUrl = "/v2.0/datasets/monitor"; - - @Qualifier("oauth2ClientContext") - @Autowired - private OAuth2ClientContext oAuth2ClientContext; - public AbstractMonitorController(DSConfiguration config, String exampleName, String title) { super(config, exampleName, title); } @@ -38,5 +32,30 @@ protected String ensureUsageOfJWTToken(String accessToken, Session session) { return accessToken; } } + + /** + * Creates new instance of the Monitor API client. + * @param accessToken user's access token + * @param session active session + * @return an instance of the {@link com.docusign.monitor.client.ApiClient} + */ + protected static ApiClient createApiClient(String accessToken, Session session) { + ApiClient apiClient = new ApiClient(session.getBasePath()); + apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + accessToken); + + return apiClient; + } + + /** + * Creates a new instance of the DataSetApi. This method + * creates an instance of the ApiClient class silently. + * @param accessToken user's access token + * @param session active session + * @return an instance of the {@link DataSetApi} + */ + protected static DataSetApi createDataSetApi(String accessToken, Session session) { + ApiClient apiClient = createApiClient(accessToken, session); + return new DataSetApi(apiClient); + } } diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index b8db4671..12b35ab4 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -5,22 +5,17 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.monitor.api.DataSetApi; +import com.docusign.monitor.api.DataSetApi.GetStreamOptions; +import com.docusign.monitor.model.CursoredResult; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.MediaType; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; /** @@ -33,11 +28,10 @@ public class M001GetMonitoringData extends AbstractMonitorController { private final Session session; private final User user; - private static final String PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE = "The connection string may be corrupt, please ensure that you are using the right URL."; @Autowired public M001GetMonitoringData(DSConfiguration config, Session session, User user) { - super(config, "m001", "Get monitoring data"); + super(config, "m001", "Monitoring data result"); this.session = session; this.user = user; } @@ -46,76 +40,48 @@ public M001GetMonitoringData(DSConfiguration config, Session session, User user) protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { String accessToken = this.user.getAccessToken(); - // Check if you are using the JWT authentication + // Check, if you are using the JWT authentication + // step 1 start accessToken = ensureUsageOfJWTToken(accessToken, this.session); + // step 1 end - String requestPath = session.getBasePath() + apiUrl; + JSONArray result = getMonitoringData(accessToken); - JSONArray result = getMonitoringData(requestPath, accessToken, model); + // Cleaning the data from wrong symbols + String resultCleaned = result.toString().replaceAll("'", ""); // Process results DoneExample.createDefault(title) - .withMessage("Results from the DataSet:GetStreamForDataset method:") - .withJsonObject(result.toString()) + .withMessage("Results from DataSet:getStream method:") + .withJsonObject(resultCleaned) .addToModel(model); return DONE_EXAMPLE_PAGE; } - protected JSONArray getMonitoringData(String requestPath, String accessToken, ModelMap model) throws Exception { + protected JSONArray getMonitoringData(String accessToken) throws Exception { // Declare variables boolean complete = false; String cursorValue = ""; - Integer limit = 1; // Amount of records you want to read in one request +// Integer limit = 1; // Amount of records you want to read in one request JSONArray result = new JSONArray(); - // Get monitoring data + DataSetApi datasetApi = this.createDataSetApi(accessToken, this.session); + GetStreamOptions options = datasetApi.new GetStreamOptions(); +// options.setLimit(limit); + + // First call the endpoint with no cursor to get the first records. + // After each call, save the cursor and use it to make the next + // call from the point where the previous one left off when iterating through + // the monitoring records do { - String cursorValueFormatted = (cursorValue.isEmpty()) ? cursorValue : String.format("=%s", cursorValue); - - // Add cursor value and amount of records to read to the request - String requestParameters = String.format("/stream?cursor%s&limit=%d", - cursorValueFormatted, limit); - - URL fullRequestPath = new URL(requestPath + requestParameters); - HttpURLConnection httpConnection = (HttpURLConnection) fullRequestPath.openConnection(); - httpConnection.setRequestMethod(HttpMethod.GET.toString()); - - // Construct API headers - // step 2 start - httpConnection.setRequestProperty(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); - httpConnection.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + accessToken); - // step 2 end - - int responseCode = httpConnection.getResponseCode(); - if (responseCode < HttpURLConnection.HTTP_OK || responseCode >= HttpURLConnection.HTTP_BAD_REQUEST) { - if (httpConnection.getResponseMessage() != PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE){ - throw new Exception(httpConnection.getResponseMessage()); - } - - DoneExample.createDefault(this.title) - .withMessage(PROBLEMS_WITH_CONNECTION_ERROR_MESSAGE) - .addToModel(model); - } - - // step 3 start - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); - String temp; - StringBuilder stringBuilder = new StringBuilder(); - while ((temp = bufferedReader.readLine()) != null) { - stringBuilder.append(temp); - } - bufferedReader.close(); - - + if(!cursorValue.isEmpty()) + options.setCursor(cursorValue); - httpConnection.disconnect(); - // Removing invalid symbols from the data - String responseData = stringBuilder.toString().replaceAll("'", ""); + CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); - JSONObject object = new JSONObject(responseData); - String endCursor = object.getString("endCursor"); + String endCursor = cursoredResult.getEndCursor(); // If the endCursor from the response is the same as the one that you already have, // it means that you have reached the end of the records @@ -126,11 +92,10 @@ protected JSONArray getMonitoringData(String requestPath, String accessToken, Mo else { cursorValue = endCursor; - result.put(new JSONObject(responseData)); + result.put(new JSONObject(cursoredResult)); } } while (!complete); - //step 3 end return result; } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp index 92fbec36..b2c43c60 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp @@ -10,7 +10,7 @@

API method used: DataSet:GetStreamForDataset. + href='https://developers.docusign.com/docs/monitor-api/reference/monitor/dataset/getstream/'>DataSet:getStream.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 11ac787a..543688f6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -1,24 +1,22 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> - - -

-
- - - - - - -
-

Java Launcher

-

Welcome to the Java code examples for DocuSign Monitor API with JWT Grant authentication

-
- -
-
- + +
+
+ + + + + + +
+

Java Launcher

+

Welcome to the Java code examples for DocuSign Monitor API with JWT Grant authentication

+
+ +
+
@@ -30,7 +28,7 @@

1. Get monitoring data

Demonstrates how to get and display all of your organization's monitoring data.

API method used: - DataSet:GetStreamForDataset + DataSet:getStream

From 592deb87f04d13d208f6b0b559bebc688433584c Mon Sep 17 00:00:00 2001 From: Matthew Lusher Date: Mon, 12 Jul 2021 19:40:28 -0400 Subject: [PATCH 195/699] Updating links to DevCenter --- .../views/pages/esignature/examples/eg001.jsp | 4 +- .../views/pages/esignature/examples/eg002.jsp | 4 +- .../views/pages/esignature/examples/eg003.jsp | 2 +- .../views/pages/esignature/examples/eg004.jsp | 2 +- .../views/pages/esignature/examples/eg005.jsp | 2 +- .../views/pages/esignature/examples/eg006.jsp | 2 +- .../views/pages/esignature/examples/eg007.jsp | 2 +- .../views/pages/esignature/examples/eg008.jsp | 4 +- .../views/pages/esignature/examples/eg009.jsp | 2 +- .../views/pages/esignature/examples/eg010.jsp | 2 +- .../views/pages/esignature/examples/eg011.jsp | 6 +- .../views/pages/esignature/examples/eg012.jsp | 2 +- .../views/pages/esignature/examples/eg013.jsp | 6 +- .../views/pages/esignature/examples/eg014.jsp | 4 +- .../views/pages/esignature/examples/eg015.jsp | 2 +- .../views/pages/esignature/examples/eg016.jsp | 2 +- .../views/pages/esignature/examples/eg017.jsp | 2 +- .../views/pages/esignature/examples/eg018.jsp | 2 +- .../views/pages/esignature/examples/eg019.jsp | 4 +- .../views/pages/esignature/examples/eg020.jsp | 2 +- .../views/pages/esignature/examples/eg021.jsp | 2 +- .../views/pages/esignature/examples/eg022.jsp | 2 +- .../views/pages/esignature/examples/eg023.jsp | 4 +- .../views/pages/esignature/examples/eg024.jsp | 2 +- .../views/pages/esignature/examples/eg025.jsp | 2 +- .../views/pages/esignature/examples/eg026.jsp | 2 +- .../views/pages/esignature/examples/eg027.jsp | 2 +- .../views/pages/esignature/examples/eg028.jsp | 2 +- .../views/pages/esignature/examples/eg029.jsp | 4 +- .../views/pages/esignature/examples/eg030.jsp | 2 +- .../views/pages/esignature/examples/eg031.jsp | 6 +- .../views/pages/esignature/examples/eg035.jsp | 4 +- .../views/pages/esignature/index.jsp | 86 +++++++++---------- 33 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp index 69823e18..fa3f06a7 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp @@ -11,10 +11,10 @@

API methods used: - Envelopes::create + Envelopes::create and EnvelopeViews::createRecipient. + href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient/">EnvelopeViews::createRecipient.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp index 892232ce..0ae1d857 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp @@ -3,7 +3,7 @@

2. Send an envelope with a remote (email) signer and cc recipient

The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) + (AutoPlace) is used to position the signing fields in the documents.

This is a general example of creating and sending an envelope (a signing request) to multiple recipients, @@ -13,7 +13,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp index 090937d7..869b11ec 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp @@ -11,7 +11,7 @@

API method used: Envelopes::listStatusChanges. + href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/liststatuschanges/">Envelopes::listStatusChanges.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index 19936de2..1ed6abc0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -18,7 +18,7 @@

API method used: - Envelopes::get. + Envelopes::get.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index 8eb8a6c8..a2efe59b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -11,7 +11,7 @@

API method used: EnvelopeRecipients::list. + href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/enveloperecipients/list/">EnvelopeRecipients::list.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index b5964272..f9ab7f2c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -14,7 +14,7 @@

API method used: - EnvelopeDocuments::list. + EnvelopeDocuments::list.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index fbd7da2c..a266dfa9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -20,7 +20,7 @@

API method used: - EnvelopeDocuments::get. + EnvelopeDocuments::get.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp index 9de015dd..c66d459a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp @@ -18,8 +18,8 @@

API methods used: - Templates::list, - Templates::create. + Templates::list, + Templates::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index 33e8bd02..f618d788 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -17,7 +17,7 @@

API method used: - Envelopes::create. + Envelopes::create.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp index 7b01381e..8fa3f89d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp @@ -15,7 +15,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 55fbcd91..242639c1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -5,7 +5,7 @@

An envelope will be created in draft mode. Your browser will then be redirected to the DocuSign web tool where the envelope can be (optionally) updated and then sent.

The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) + (AutoPlace) is used to position the signing fields in the documents.

DocuSign recommends that you enhance your application as needed to avoid the need for the embedded sender view. @@ -20,8 +20,8 @@

API methods used: - Envelopes::create and - EnvelopeViews::createSender. + Envelopes::create and + EnvelopeViews::createSender.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index 206260ed..7a4460d9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -18,7 +18,7 @@

API method used: EnvelopeViews::createConsole. + href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createconsole/">EnvelopeViews::createConsole.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index a9e9d4d2..219a829a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -7,7 +7,7 @@

In addition to the template's document(s), the example adds an additional document to the envelope by using the Composite + href='https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/templates/composite/'>Composite Templates feature.

In this example, the additional document is an HTML document that @@ -24,10 +24,10 @@

API methods used: - Envelopes::create + Envelopes::create and EnvelopeViews::createRecipient. + href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient/">EnvelopeViews::createRecipient.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp index 00969654..2b8af6fb 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp @@ -10,7 +10,7 @@

Anchor strings - (AutoPlace) + (AutoPlace) are used to position the fields in the documents.

@@ -19,7 +19,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp index b9532ab7..49ad329b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp @@ -19,7 +19,7 @@

API method used: - EnvelopeFormData::get. + EnvelopeFormData::get.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp index 3284fab3..83ecfe0d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp @@ -17,7 +17,7 @@

API method used: - EnvelopeFormData::get. + EnvelopeFormData::get.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index b53fa537..a93dd2c5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -14,7 +14,7 @@

API method used: - Envelopes::create. + Envelopes::create.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index 7efd234d..d49f8c27 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -21,7 +21,7 @@

API method used: - EnvelopeCustomFields::list. + EnvelopeCustomFields::list.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp index ecd725fc..31f989b5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp @@ -5,7 +5,7 @@

The envelope includes a pdf document. Anchor text - (AutoPlace) + (AutoPlace) is used to position the signing fields in the documents.

@@ -17,7 +17,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp index dd2b83d0..2525bb22 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp @@ -8,7 +8,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp index 84abd0d2..1289e74a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp @@ -8,7 +8,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp index 564f3639..71f8061f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp @@ -8,7 +8,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp index 68c9c8bd..668099e5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp @@ -5,7 +5,7 @@

The envelope includes a pdf document. Anchor text - (AutoPlace) + (AutoPlace) is used to position the signing fields in the documents.

@@ -18,7 +18,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp index f83270c6..5ce6a98f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp @@ -14,7 +14,7 @@ create a permission profile with the eSignature REST API.

API method used: - AccountPermissionProfiles::create. + AccountPermissionProfiles::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp index b151e3cb..585e8d6b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp @@ -14,7 +14,7 @@

API method used: - Groups::update. + Groups::update.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp index 0ec17508..72872b9d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp @@ -13,7 +13,7 @@ with the eSignature REST API.

API method used: - AccountPermissionProfiles::update. + AccountPermissionProfiles::update.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp index f8283fde..f378d7a6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp @@ -14,7 +14,7 @@

API method used: - AccountPermissionProfiles::update. + AccountPermissionProfiles::update.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp index 14378cdd..bdf72183 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp @@ -18,7 +18,7 @@

API method used: - AccountBrands::create. + AccountBrands::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index 8b957f1b..d9882236 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -4,7 +4,7 @@

29. Applying a brand to an envelope

The envelope includes a pdf document. Anchor text (AutoPlace) + href="https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/auto-place/">AutoPlace) is used to position the signing fields in the documents.

@@ -23,7 +23,7 @@

API method used: Envelopes::create. + href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create.

View source file ${sourceFile} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp index 4d712e17..da6906a6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp @@ -23,7 +23,7 @@

API method used: Envelopes::create. + href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create.

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index bd329dab..cfb0b39d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -16,12 +16,12 @@

API methods used: - EnvelopeRecipients::create, - Envelopes::create, + EnvelopeRecipients::create, + Envelopes::create, BulkEnvelopes::get, EnvelopeCustomFields::create, BulkSend::createBulkSendList - EnvelopeRecipients::create. + EnvelopeRecipients::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp index 5d508629..3b30bb7d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp @@ -3,7 +3,7 @@

2. Send an envelope via SMS delivery

The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) + (AutoPlace) is used to position the signing fields in the documents.

This is a general example of creating and sending an envelope (a signing request) to a recipient and notifying that recipient with an SMS message..

@@ -12,7 +12,7 @@

API method used: - Envelopes::create. + Envelopes::create.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 74d2a213..6b4339ef 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -50,24 +50,24 @@ With embedded signing, the DocuSign signing is initiated from your website.

API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. + Envelopes::create and + EnvelopeViews::createRecipient.

2. Send an envelope with a remote (email) signer and cc recipient

The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) + (AutoPlace) is used to position the signing fields in the documents.

API method used: - Envelopes::create. + Envelopes::create.

3. List envelopes in the user's account

List the envelopes created in the last 30 days.

API method used: - Envelopes::listStatusChanges. + Envelopes::listStatusChanges.

4. Get an envelope's basic information and status

@@ -76,14 +76,14 @@ envelope, its documents, recipients, etc.

API method used: - Envelopes::get. + Envelopes::get.

5. List an envelope's recipients and their status

List the envelope's recipients, including their current status.

API method used: - EnvelopeRecipients::list. + EnvelopeRecipients::list.

6. List an envelope's documents

@@ -91,28 +91,28 @@ is also associated with every envelope.

API method used: - EnvelopeDocuments::list. + EnvelopeDocuments::list.

7. Download a document from an envelope

An envelope's documents can be downloaded one by one or as a complete set.

API method used: - EnvelopeDocuments::get. + EnvelopeDocuments::get.

8. Create a template

Create a template with two roles, signer and cc.

API methods used: - Templates::list, - Templates::create. + Templates::list, + Templates::create.

9. Send an envelope using a template

The envelope is defined by the template. The signer and cc recipient name and email are used to fill in the template's roles.

API method used: - Envelopes::create. + Envelopes::create.

10. Send an envelope using binary document transfer

@@ -122,7 +122,7 @@ Binary transfer is not yet supported by the SDK.

API method used: - Envelopes::create. + Envelopes::create.

11. Use embedded sending

@@ -131,98 +131,98 @@ to the envelope before it is sent.

API methods used: - Envelopes::create, - EnvelopeViews::createSender. + Envelopes::create, + EnvelopeViews::createSender.

12. Embedded DocuSign web tool

Redirect the user to the DocuSign web tool.

API method used: - EnvelopeViews::createConsole. + EnvelopeViews::createConsole.

13. Use embedded signing from a template with an added document

This example sends an envelope based on a template.

In addition to the template's document(s), the example adds an additional document to the envelope by using the - Composite Templates + Composite Templates feature.

API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. + Envelopes::create and + EnvelopeViews::createRecipient.

14. Send an envelope with an order form and payment field

Anchor text - (AutoPlace) + (AutoPlace) is used to position the fields in the documents.

API method used: - Envelopes::create. + Envelopes::create.

Tabs Examples

15. Get the tab data from an envelope

-

This example retrieves the tab (field) values from an envelope.

+

This example retrieves the tab (field) values from an envelope.

API method used: - EnvelopeFormData::get. + EnvelopeFormData::get.

16. Set tab values for an envelope

This example sets the tab (field) values for an envelope including tabs that can and cannot be changed by the signer.

API method used: - Envelopes::create and - EnvelopeViews::createRecipient. + Envelopes::create and + EnvelopeViews::createRecipient.

17. Set template tab values

This example sets the tab (field) values for a template being used by an envelope.

API method used: - Envelopes::create and - EnvelopeViews::createRecipient. + Envelopes::create and + EnvelopeViews::createRecipient.

18. List envelope custom metadata field values

This example lists the envelope's custom metadata field values.

API method used: - EnvelopeCustomFields::list. + EnvelopeCustomFields::list.

19. Send an envelope with Access Code Authentication

This example sends and envelope that requires an access-code for the purpose of multi-factor authentication.

API method used: - Envelopes::create. + Envelopes::create.

20. Send an envelope with SMS Authentication

This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication.

API method used: - Envelopes::create. + Envelopes::create.

21. Send an envelope with Phone Authentication

This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication.

API method used: - Envelopes::create. + Envelopes::create.

22. Send an envelope with Knowledge-Based Authentication

This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication.

API method used: - Envelopes::create. + Envelopes::create.

23. Send an envelope with ID Verification Authentication

Submit an envelope that requires verification of a government issued identity.

API method used: - Envelopes::create. + Envelopes::create.

Permissions

@@ -233,14 +233,14 @@

API method used: - AccountPermissionProfiles::create. + AccountPermissionProfiles::create.

25. Setting a permission profile

This example allows you to set a permission profile on an existing user group.

API method used: - Groups::update. + Groups::update.

26. Updating individual permission profile settings

@@ -250,31 +250,31 @@

API method used: - AccountPermissionProfiles::update. + AccountPermissionProfiles::update.

27. Deleting a permission profile

This example lists all available permissions profiles and allows you to delete any without associated users. Please note that you cannot remove "Everyone" nor "Administrator" permission profiles.

API method used: - AccountPermissionProfiles::create. + AccountPermissionProfiles::create.

28. Create a brand

This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

API method used: - AccountBrands::create. + AccountBrands::create.

29. Applying a brand to an envelope

This example will show you how to create an envelope using any of the created brands on your account.

API method used: - Envelopes::create. + Envelopes::create.

30. Applying a brand to a template

This example will show you how to create an envelope using a brand

API method used: - Envelopes::create. + Envelopes::create.

Bulk operations

@@ -286,12 +286,12 @@

API methods used: - EnvelopeRecipients::create, - Envelopes::create, + EnvelopeRecipients::create, + Envelopes::create, BulkEnvelopes::get, EnvelopeCustomFields::create, BulkSend::createBulkSendList - EnvelopeRecipients::create. + EnvelopeRecipients::create.

Advanced recipient routing

From a7f7a8bca0dc8381b77be9234e57bf632b82d4af Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 13 Jul 2021 17:08:44 -0700 Subject: [PATCH 196/699] delete not update --- .../templates/views/pages/esignature/examples/eg027.jsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp index f378d7a6..5b91aaf4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp @@ -14,7 +14,7 @@

API method used: - AccountPermissionProfiles::update. + AccountPermissionProfiles::delete.

@@ -36,4 +36,4 @@ - \ No newline at end of file + From 242d653951c077881f0607941811f8d617d4cc33 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 13 Jul 2021 17:15:55 -0700 Subject: [PATCH 197/699] Update eg031.jsp --- .../templates/views/pages/esignature/examples/eg031.jsp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index cfb0b39d..cee266c5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -18,9 +18,8 @@

API methods used: EnvelopeRecipients::create, Envelopes::create, - BulkEnvelopes::get, - EnvelopeCustomFields::create, - BulkSend::createBulkSendList + EnvelopeCustomFields::create, + BulkSend::createBulkSendList EnvelopeRecipients::create.

@@ -84,4 +83,4 @@ - \ No newline at end of file + From 95cc124e979f4f8141324d0b9b0c4dfa5b938610 Mon Sep 17 00:00:00 2001 From: Prafull Kotecha Date: Sun, 1 Aug 2021 11:34:14 +0000 Subject: [PATCH 198/699] Use latest versions to fix security vulnerabilities --- pom.xml | 6 +++--- src/main/java/com/docusign/core/model/DoneExample.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 65b1f0ec..6261a6f8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.2.1.RELEASE + 2.5.3 @@ -18,8 +18,8 @@ 11 - 2.1.1.RELEASE - 2.7 + 2.5.2 + 2.11.0 3.13.0-RC1 1.1.0-RC1 1.0.0-BETA diff --git a/src/main/java/com/docusign/core/model/DoneExample.java b/src/main/java/com/docusign/core/model/DoneExample.java index 17f61da6..346b614e 100644 --- a/src/main/java/com/docusign/core/model/DoneExample.java +++ b/src/main/java/com/docusign/core/model/DoneExample.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.datatype.joda.JodaModule; import com.google.gson.Gson; -import org.codehaus.jackson.map.SerializationConfig; +import com.fasterxml.jackson.databind.SerializationConfig; import org.json.JSONObject; import org.springframework.ui.ModelMap; From ed54ae086307474f5363583951a4fbd3639d9014 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 25 Aug 2021 16:41:22 +0300 Subject: [PATCH 199/699] Refactoring eSignture examples --- .../EG001ControllerEmbeddedSigning.java | 84 +++------ .../C001ControllerCreateClickwrap.java | 22 +-- .../C002ControllerActivateClickwrap.java | 14 +- ...03ControllerCreateNewVersionClickwrap.java | 33 +--- .../C004ControllerGetListClickwraps.java | 9 +- .../C005ControllerGetClickwrapResponses.java | 8 +- .../EG002ControllerSigningViaEmail.java | 66 +------ .../EG003ControllerListEnvelopes.java | 12 +- .../examples/EG004ControllerEnvelopeInfo.java | 5 +- .../EG005ControllerEnvelopeRecipients.java | 10 +- .../examples/EG006ControllerEnvelopeDocs.java | 6 +- .../EG007ControllerEnvelopeGetDoc.java | 28 ++- .../EG008ControllerCreateTemplate.java | 160 +--------------- .../examples/EG009ControllerUseTemplate.java | 24 +-- .../EG010ControllerSendBinaryDocs.java | 141 +------------- .../EG011ControllerEmbeddedSending.java | 10 +- .../EG012ControllerEmbeddedConsole.java | 20 +- .../EG013ControllerAddDocToTemplate.java | 114 +---------- .../EG014ControllerCollectPayment.java | 160 +--------------- .../examples/EG015ControllerGetTabValues.java | 8 +- .../examples/EG016ControllerSetTabValues.java | 142 +------------- .../EG017ControllerSetTemplateTabValues.java | 165 +++------------- ...18ControllerEnvelopeCustomFieldValues.java | 14 +- ...019ControllerAccessCodeAuthentication.java | 50 +---- .../EG020ControllerSmsAuthentication.java | 54 +----- .../EG021ControllerPhoneAuthentication.java | 59 +----- .../EG022ControllerKBAAuthentication.java | 50 +---- .../EG023ControllerIdvAuthentication.java | 77 ++------ .../EG024ControllerPermissionCreate.java | 17 +- ...G025ControllerPermissionSetUserGroups.java | 17 +- ...ntrollerPermissionChangeSingleSetting.java | 50 +---- .../EG027ControllerPermissionDelete.java | 3 +- .../examples/EG028ControllerCreateBrand.java | 33 ++-- .../EG029ControllerApplyBrandToEnvelope.java | 42 +---- .../EG030ControllerApplyBrandToTemplate.java | 27 +-- .../EG031ControllerBulkSendEnvelopes.java | 98 +--------- ...EG032ControllerPauseSignatureWorkflow.java | 78 ++------ ...033ControllerUnpauseSignatureWorkflow.java | 19 +- ...034ControllerUseConditionalRecipients.java | 170 +---------------- .../examples/EG035ControllerSMSDelivery.java | 81 +------- .../eSignature/examples/EnvelopeHelpers.java | 12 +- .../AccessCodeAuthenticationService.java | 61 ++++++ .../examples/AddDocToTemplateService.java | 129 +++++++++++++ .../examples/ApplyBrandToEnvelopeService.java | 55 ++++++ .../examples/ApplyBrandToTemplateService.java | 39 ++++ .../examples/BulkSendEnvelopesService.java | 117 ++++++++++++ .../examples/CollectPaymentService.java | 178 ++++++++++++++++++ .../examples/CreateBrandService.java | 25 +++ .../examples/CreateTemplateService.java | 171 +++++++++++++++++ .../examples/EmbeddedConsoleService.java | 28 +++ .../examples/EmbeddedSendingService.java | 28 +++ .../examples/EmbeddedSigningService.java | 92 +++++++++ .../EnvelopeCustomFieldValuesService.java | 14 ++ .../examples/EnvelopeDocsService.java | 17 ++ .../examples/EnvelopeGetDocService.java | 25 +++ .../examples/EnvelopeInfoService.java | 11 ++ .../examples/EnvelopeRecipientsService.java | 11 ++ .../examples/GetTabValuesService.java | 11 ++ .../examples/IdvAuthenticationService.java | 91 +++++++++ .../examples/KBAAuthenticationService.java | 61 ++++++ .../examples/ListEnvelopesServices.java | 20 ++ .../PauseSignatureWorkflowService.java | 79 ++++++++ .../PermissionChangeSingleSettingService.java | 63 +++++++ .../examples/PermissionCreateService.java | 26 +++ .../examples/PermissionDeleteService.java | 14 ++ .../PermissionSetUserGroupsService.java | 28 +++ .../examples/PhoneAuthenticationService.java | 67 +++++++ .../examples/SMSDeliveryService.java | 102 ++++++++++ .../examples/SendBinaryDocsService.java | 171 +++++++++++++++++ .../examples/SetTabValuesService.java | 149 +++++++++++++++ .../examples/SetTemplateTabValuesService.java | 170 +++++++++++++++++ .../examples/SigningViaEmailService.java | 84 +++++++++ .../examples/SmsAuthenticationService.java | 66 +++++++ .../UnpauseSignatureWorkflowService.java | 34 ++++ .../UseConditionalRecipientsService.java | 177 +++++++++++++++++ .../examples/UseTemplateService.java | 35 ++++ 76 files changed, 2761 insertions(+), 1880 deletions(-) create mode 100644 src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/CreateBrandService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EmbeddedConsoleService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/ListEnvelopesServices.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/PermissionSetUserGroupsService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/UnpauseSignatureWorkflowService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java create mode 100644 src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 6132daaa..8b448a7f 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -16,6 +16,7 @@ import com.docusign.esign.model.Signer; import com.docusign.esign.model.ViewUrl; +import com.docusign.services.eSignature.examples.EmbeddedSigningService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -63,7 +64,14 @@ protected Object doWork(WorkArguments args, ModelMap model, String accountId = session.getAccountId(); // Step 1. Create the envelope definition - EnvelopeDefinition envelope = makeEnvelope(signerEmail, signerName); + EnvelopeDefinition envelope = EmbeddedSigningService.makeEnvelope( + signerEmail, + signerName, + SIGNER_CLIENT_ID, + ANCHOR_OFFSET_Y, + ANCHOR_OFFSET_X, + DOCUMENT_FILE_NAME, + DOCUMENT_NAME); // Step 2. Call DocuSign to create the envelope ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); @@ -74,8 +82,18 @@ protected Object doWork(WorkArguments args, ModelMap model, session.setEnvelopeId(envelopeId); // Step 3. create the recipient view, the embedded signing - RecipientViewRequest viewRequest = makeRecipientViewRequest(signerEmail, signerName); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + RecipientViewRequest viewRequest = EmbeddedSigningService.makeRecipientViewRequest( + signerEmail, + signerName, + config, + SIGNER_CLIENT_ID); + + ViewUrl viewUrl = EmbeddedSigningService.embeddedSigning( + envelopesApi, + accountId, + envelopeId, + viewRequest + ); // Step 4. Redirect the user to the embedded signing // Don't use an iFrame! @@ -83,64 +101,4 @@ protected Object doWork(WorkArguments args, ModelMap model, // query parameter on the returnUrl (see the makeRecipientViewRequest method) return new RedirectView(viewUrl.getUrl()); } - - private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String signerName) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - // The query parameter is included as an example of how - // to save/recover state information during the redirect to - // the DocuSign signing. It's usually better to use - // the session mechanism of your web framework. Query parameters - // can be changed/spoofed very easily. - viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); - - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(SIGNER_CLIENT_ID); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds - viewRequest.setPingUrl(config.getDsPingUrl()); - - return viewRequest; - } - - private static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName) throws IOException { - // Create a signer recipient to sign the document, identified by name and email - // We set the clientUserId to enable embedded signing for the recipient - Signer signer = new Signer(); - signer.setEmail(signerEmail); - signer.setName(signerName); - signer.clientUserId(SIGNER_CLIENT_ID); - signer.recipientId("1"); - signer.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // Add the recipient to the envelope object - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign this document"); - envelopeDefinition.setRecipients(recipients); - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "3"); - envelopeDefinition.setDocuments(Arrays.asList(doc)); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeDefinition; - } } diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 48af20bf..f7919145 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -11,6 +11,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.click.examples.CreateClickwrapService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -48,7 +49,7 @@ protected Object doWork(WorkArguments args, ModelMap model, AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3. Construct the request body for your clickwrap - ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(args.getClickwrapName()); + ClickwrapRequest clickwrapRequest = CreateClickwrapService.createClickwrapRequest(args.getClickwrapName(), DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); // Step 4. Call the v1 Click API ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); @@ -61,24 +62,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private ClickwrapRequest createClickwrapRequest(String clickwrapName) throws IOException { - Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); - DisplaySettings displaySettings = new DisplaySettings() - .displayName("Terms of Service") - .consentButtonText("I Agree") - .downloadable(true) - .format("modal") - .mustRead(true) - .mustView(true) - .requireAccept(true) - .documentDisplay("document"); - - return new ClickwrapRequest() - .addDocumentsItem(document) - .clickwrapName(clickwrapName) - .requireReacceptance(true) - .displaySettings(displaySettings); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index bf74b88f..3e7ce8bd 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -3,11 +3,12 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; -import com.docusign.click.model.*; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.click.examples.ActivateClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; /** * Activate a clickwrap. @@ -49,15 +49,11 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Construct the request body for your clickwrap - ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE); - - // Step 4: Call the v1 Click API - ClickwrapVersionSummaryResponse updatedClickwrap = accountsApi.updateClickwrapVersion( + ClickwrapVersionSummaryResponse updatedClickwrap = ActivateClickwrapService.activateClickwrap( + accountsApi, this.session.getAccountId(), this.session.getClickwrapId(), - this.session.getClickwrapVersionNumber(), - clickwrapRequest); + this.session.getClickwrapVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(updatedClickwrap) diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index 284e2802..c5732724 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -11,6 +11,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.click.examples.CreateNewVersionClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -55,14 +56,12 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Construct the request body for your clickwrap - ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(); - - // Step 4: Call the v1 Click API - ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrapVersion( + ClickwrapVersionSummaryResponse createdClickwrap = CreateNewVersionClickwrapService.createNewVersionClickwrap( + accountsApi, + CreateNewVersionClickwrapService.createClickwrapRequest(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER), this.session.getAccountId(), - this.session.getClickwrapId(), - clickwrapRequest); + this.session.getClickwrapId() + ); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); @@ -74,25 +73,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private ClickwrapRequest createClickwrapRequest() throws IOException { - Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); - DisplaySettings displaySettings = new DisplaySettings() - .displayName("Terms of Service v2") - .consentButtonText("I Agree") - .downloadable(true) - .format("modal") - .mustRead(true) - .mustView(true) - .requireAccept(true) - .documentDisplay("document"); - - return new ClickwrapRequest() - .addDocumentsItem(document) - .clickwrapName("Terms of Service") - .requireReacceptance(true) - .status(ClickwrapHelper.STATUS_ACTIVE) - .displaySettings(displaySettings); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index 18725d4a..e55e9be1 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -3,18 +3,18 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; -import com.docusign.click.model.*; +import com.docusign.click.model.ClickwrapVersionsResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.click.examples.GetListClickwrapsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; /** * Get a list of clickwraps. @@ -40,8 +40,9 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Call the v1 Click API - ClickwrapVersionsResponse clickwrapsResponse = accountsApi.getClickwraps(this.session.getAccountId()); + ClickwrapVersionsResponse clickwrapsResponse = GetListClickwrapsService.getListClickwrap( + accountsApi, + this.session.getAccountId()); DoneExample.createDefault(this.title) .withJsonObject(clickwrapsResponse) diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index 0ff8a185..eccc85ee 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -8,13 +8,13 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.click.examples.GetClickwrapResponsesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; /** * Get clickwrap responses. @@ -41,8 +41,10 @@ protected Object doWork(WorkArguments args, ModelMap model, AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Call the v1 Click API - ClickwrapAgreementsResponse clickwrapAgreementsResponse = accountsApi.getClickwrapAgreements( - this.session.getAccountId(), this.session.getClickwrapId()); + ClickwrapAgreementsResponse clickwrapAgreementsResponse = GetClickwrapResponsesService.getClickwrapResponses( + accountsApi, + this.session.getAccountId(), + this.session.getClickwrapId()); DoneExample.createDefault(this.title) .withJsonObject(clickwrapAgreementsResponse) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index 7a91b168..f9a1bb4f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -14,6 +14,7 @@ import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; +import com.docusign.services.eSignature.examples.SigningViaEmailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -33,15 +34,6 @@ @RequestMapping("/eg002") public class EG002ControllerSigningViaEmail extends AbstractEsignatureController { - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private final Session session; private final User user; @@ -62,8 +54,8 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = makeEnvelope(args); - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeDefinition envelope = SigningViaEmailService.makeEnvelope(args); + EnvelopeSummary results = SigningViaEmailService.signingViaEmail(envelopesApi, session.getAccountId(), envelope); // process results session.setEnvelopeId(results.getEnvelopeId()); @@ -75,57 +67,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - // document 1 (html) has tag **signature_1** - // document 2 (docx) has tag /sn1/ - // document 3 (pdf) has tag /sn1/ - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. After it is signed, - // a copy is sent to the cc person. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // The DocuSign platform searches throughout your envelope's documents - // for matching anchor strings. So the signHere2 tab will be used in - // both document 2 and 3 since they use the same anchor string for - // their "signer 1" tabs. - Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // Create a signer recipient to sign the document, identified by name - // and email. We're setting the parameters via the object creation. - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signerTabs); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRecipientId("2"); - cc.setRoutingOrder("2"); - // The order in the docs array determines the order in the envelope - byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please sign this document set"); - envelope.setDocuments(Arrays.asList( - EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, - DocumentType.HTML.getDefaultFileExtention(), "1"), - EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), - EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); - envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); - - return envelope; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 1c91bfb0..1d216cfe 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -14,6 +14,8 @@ import javax.servlet.http.HttpServletResponse; +import com.docusign.esign.model.EnvelopesInformation; +import com.docusign.services.eSignature.examples.ListEnvelopesServices; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -29,13 +31,9 @@ @RequestMapping("/eg003") public class EG003ControllerListEnvelopes extends AbstractEsignatureController { - private static final int FROM_DATE_OFFSET_DAYS = 30; - private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd"); - private final Session session; private final User user; - @Autowired public EG003ControllerListEnvelopes(DSConfiguration config, Session session, User user) { super(config, "eg003", "List envelopes"); @@ -47,13 +45,11 @@ public EG003ControllerListEnvelopes(DSConfiguration config, Session session, Use // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - ListStatusChangesOptions options = envelopesApi.new ListStatusChangesOptions(); - LocalDate date = LocalDate.now().minusDays(FROM_DATE_OFFSET_DAYS); - options.setFromDate(DATE_FORMATTER.format(date)); + EnvelopesInformation envelopesInformation = ListEnvelopesServices.listEnvelopes(envelopesApi, session.getAccountId()); DoneExample.createDefault(title) .withMessage("Results from the Envelopes::listStatusChanges method:") - .withJsonObject(envelopesApi.listStatusChanges(session.getAccountId(), options)) + .withJsonObject(envelopesInformation) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index 6c707a8f..85419624 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -10,6 +10,8 @@ import javax.servlet.http.HttpServletResponse; +import com.docusign.esign.model.Envelope; +import com.docusign.services.eSignature.examples.EnvelopeInfoService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -52,8 +54,9 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope info EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + Envelope envelope = EnvelopeInfoService.envelopeInfo(envelopesApi, session.getAccountId(), session.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(envelopesApi.getEnvelope(session.getAccountId(), session.getEnvelopeId())) + .withJsonObject(envelope) .withMessage("Results from the Envelopes::get method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index b493d394..852d24ce 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -7,15 +7,16 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.esign.model.Recipients; +import com.docusign.services.eSignature.examples.EnvelopeRecipientsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; + /** * List an envelope's recipients and their status.
@@ -47,8 +48,9 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope recipients EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + Recipients recipients = EnvelopeRecipientsService.envelopeRecipients(envelopesApi, session.getAccountId(), session.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(envelopesApi.listRecipients(session.getAccountId(), session.getEnvelopeId())) + .withJsonObject(recipients) .withMessage("Results from the EnvelopeRecipients::list method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java index a4c152e8..2a61bdf7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java @@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletResponse; +import com.docusign.services.eSignature.examples.EnvelopeDocsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -56,7 +57,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. List the envelope's documents - EnvelopeDocumentsResult result = envelopesApi.listDocuments(session.getAccountId(), session.getEnvelopeId()); + EnvelopeDocumentsResult result = EnvelopeDocsService.envelopeDocs( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); // Step 2. Process results // Save the envelopeId and its list of documents in the session so diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index ee20df48..66997040 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -7,6 +7,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; +import com.docusign.services.eSignature.examples.EnvelopeGetDocService; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -73,13 +74,17 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2 start EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2 end - + // EnvelopeDocuments::get. - // Exceptions will be caught by the calling function + // Exceptions will be caught by the calling function String documentId = args.getDocSelect(); - // Step 3 start - byte[] results = envelopesApi.getDocument(session.getAccountId(), session.getEnvelopeId(), documentId); - // Step 3 end + // Step 3 start + byte[] results = EnvelopeGetDocService.envelopeGetDoc( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId(), + documentId); + // Step 3 end // Process results List envelopeDocuments = session.getEnvelopeDocuments(); @@ -89,10 +94,10 @@ protected Object doWork(WorkArguments args, ModelMap model, String docType = docItem.getType(); String pdfExtention = DocumentType.PDF.getDefaultFileExtention(); if (StringUtils.equalsAny(docType, "content", "summary", pdfExtention)) { - docName = addExtension(docName, pdfExtention); + docName = EnvelopeGetDocService.addExtension(docName, pdfExtention); } if (ZIP_EXTENSION.equals(docType)) { - docName = addExtension(docName, ZIP_EXTENSION); + docName = EnvelopeGetDocService.addExtension(docName, ZIP_EXTENSION); } response.setContentType(URLConnection.guessContentTypeFromName(docName)); @@ -103,13 +108,6 @@ protected Object doWork(WorkArguments args, ModelMap model, return null; } - private static String addExtension(String fileName, String extension) { - if (FilenameUtils.isExtension(fileName, extension)) { - return fileName; - } - return String.join(".", fileName, extension); - } - private static EnvelopeDocumentInfo find(List documents, String documentId) { for (EnvelopeDocumentInfo docInfo : documents) { if (StringUtils.equalsIgnoreCase(docInfo.getDocumentId(), documentId)) { @@ -118,5 +116,5 @@ private static EnvelopeDocumentInfo find(List documents, S } throw new ExampleException("Requested document is not found.", null); - } + } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index c438af47..c9bb8b61 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -22,6 +22,7 @@ import com.docusign.esign.model.Tabs; import com.docusign.esign.model.TemplateSummary; import com.docusign.esign.model.Text; +import com.docusign.services.eSignature.examples.CreateTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -43,16 +44,9 @@ @RequestMapping("/eg008") public class EG008ControllerCreateTemplate extends AbstractEsignatureController { - private static final String TEMPLATE_NAME = "Example Signer and CC template"; - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_fields.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCUMENT_ID = "1"; - private static final String PAGE_NUMBER = "1"; - private static final String FALSE = "false"; - private final Session session; private final User user; - + private static final String TEMPLATE_NAME = "Example Signer and CC template"; @Autowired public EG008ControllerCreateTemplate(DSConfiguration config, Session session, User user) { @@ -67,11 +61,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { // Step 1. list existing templates ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); - TemplatesApi templatesApi = new TemplatesApi(apiClient); - TemplatesApi.ListTemplatesOptions options = templatesApi.new ListTemplatesOptions(); - options.setSearchText(TEMPLATE_NAME); String accountId = session.getAccountId(); - EnvelopeTemplateResults results = templatesApi.listTemplates(accountId, options); + EnvelopeTemplateResults results = CreateTemplateService.searchTemplatesByName(apiClient, accountId, TEMPLATE_NAME); // Step 2. Process results. If template do not exist, create one if (Integer.parseInt(results.getResultSetSize()) > 0) { @@ -83,7 +74,10 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); } else { session.setTemplateName(TEMPLATE_NAME); - TemplateSummary template = templatesApi.createTemplate(accountId, makeTemplate()); + TemplateSummary template = CreateTemplateService.createTemplate( + apiClient, + accountId, + CreateTemplateService.makeTemplate(session.getTemplateName())); DoneExample.createDefault(title) .withMessage(String.format( "The template has been created!
Template name: %s, ID %s.", @@ -93,145 +87,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - - // document 1 (pdf) has tag /sn1/ - // - // The template has two recipient roles. - // recipient 1 - signer - // recipient 2 - cc - // The template will be sent first to the signer. - // After it is signed, a copy is sent to the cc person. - private EnvelopeTemplate makeTemplate() throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "1"); - - // Tabs are set per recipient / signer - Tabs signer1Tabs = new Tabs(); - signer1Tabs.setCheckboxTabs(Arrays.asList( - createCheckbox("ckAuthorization", "75", "417"), - createCheckbox("ckAuthentication", "75", "447"), - createCheckbox("ckAgreement", "75", "478"), - createCheckbox("ckAcknowledgement", "75", "508"))); - signer1Tabs.setListTabs(Arrays.asList(createList())); - signer1Tabs.setRadioGroupTabs(Arrays.asList(createRadioGroup())); - signer1Tabs.setSignHereTabs(Arrays.asList(createSignHere())); - signer1Tabs.textTabs(Arrays.asList( - createText("text", "153", "230"), - createText("numbersOnly", "153", "260"))); - - // create a signer recipient to sign the document, identified by name and email - // routingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signer1Tabs); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc1 = new CarbonCopy(); - cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); - cc1.setRoutingOrder("2"); - cc1.setRecipientId("2"); - - // Create the overall template definition. The order in the docs array - // determines the order in the envelope. - EnvelopeTemplate template = new EnvelopeTemplate(); - template.setDocuments(Arrays.asList(doc)); - template.setEmailSubject("Please sign this document"); - template.setName(session.getTemplateName()); - template.setDescription("Example template created via the API"); - template.setShared(FALSE); - template.setRecipients(EnvelopeHelpers.createRecipients(signer, cc1)); - template.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); - - return template; - } - - private static List createList() { - List list = new List(); - list.setDocumentId(DOCUMENT_ID); - list.setPageNumber(PAGE_NUMBER); - list.setXPosition("142"); - list.setYPosition("291"); - list.setFont("helvetica"); - list.setFontSize("size14"); - list.setTabLabel("list"); - list.setRequired(FALSE); - list.setListItems(Arrays.asList( - createListItem("Red"), - createListItem("Orange"), - createListItem("Yellow"), - createListItem("Green"), - createListItem("Blue"), - createListItem("Indigo"), - createListItem("Violet") - )); - return list; - } - - private static ListItem createListItem(String color) { - ListItem item = new ListItem(); - item.setText(color); - item.setValue(color.toLowerCase(Locale.ENGLISH)); - return item; - } - - private static RadioGroup createRadioGroup() { - RadioGroup radioGroup = new RadioGroup(); - radioGroup.setDocumentId(DOCUMENT_ID); - radioGroup.setGroupName("radio1"); - - radioGroup.setRadios(Arrays.asList( - createRadio("white", "142"), - createRadio("red", "74"), - createRadio("blue", "220") - )); - return radioGroup; - } - - private static Radio createRadio(String value, String xPosition) { - Radio radio = new Radio(); - radio.setPageNumber(PAGE_NUMBER); - radio.setValue(value); - radio.setXPosition(xPosition); - radio.setYPosition("384"); - radio.setRequired(FALSE); - return radio; - } - - private static Checkbox createCheckbox(String label, String xPosition, String yPosition) { - Checkbox check = new Checkbox(); - check.setDocumentId(DOCUMENT_ID); - check.setPageNumber(PAGE_NUMBER); - check.setXPosition(xPosition); - check.setYPosition(yPosition); - check.setTabLabel(label); - return check; - } - - private static Text createText(String label, String xPosition, String yPosition) { - Text text = new Text(); - text.setDocumentId(DOCUMENT_ID); - text.setPageNumber(PAGE_NUMBER); - text.setXPosition(xPosition); - text.setYPosition(yPosition); - text.setFont("helvetica"); - text.setFontSize("size14"); - text.setTabLabel(label); - text.setHeight("23"); - text.setWidth("84"); - text.setRequired(FALSE); - return text; - } - - private static SignHere createSignHere() { - SignHere signHere = new SignHere(); - signHere.setDocumentId(DOCUMENT_ID); - signHere.setPageNumber(PAGE_NUMBER); - signHere.setXPosition("191"); - signHere.setYPosition("148"); - return signHere; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index 6f040944..ef5050d2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -14,6 +14,7 @@ import com.docusign.esign.model.EnvelopeTemplateResults; import com.docusign.esign.model.TemplateRole; +import com.docusign.services.eSignature.examples.UseTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -62,8 +63,8 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = makeEnvelope(args); - EnvelopeSummary result = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeDefinition envelope = UseTemplateService.makeEnvelope(args); + EnvelopeSummary result = UseTemplateService.createEnvelopeTemplate(envelopesApi, session.getAccountId(), envelope); session.setEnvelopeId(result.getEnvelopeId()); DoneExample.createDefault(title) @@ -73,24 +74,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition makeEnvelope(WorkArguments args) { - TemplateRole signer = new TemplateRole(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - - TemplateRole cc = new TemplateRole(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setTemplateId(args.getTemplateId()); - envelope.setTemplateRoles(Arrays.asList(signer, cc)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index 4c04ed38..4f746c81 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -10,6 +10,7 @@ import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; +import com.docusign.services.eSignature.examples.SendBinaryDocsService; import lombok.Value; import org.json.JSONArray; @@ -20,6 +21,7 @@ import org.springframework.ui.ModelMap; import org.springframework.util.StreamUtils; import org.springframework.web.bind.annotation.RequestMapping; + import javax.net.ssl.HttpsURLConnection; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.HttpMethod; @@ -42,7 +44,6 @@ @RequestMapping("/eg010") public class EG010ControllerSendBinaryDocs extends AbstractEsignatureController { - private static final String HYPHENS = "--"; private static final String LINE_DELIMITER = "\r\n"; private static final String BOUNDARY_DELIMITER = "multipartboundary_multipartboundary"; @@ -52,8 +53,6 @@ public class EG010ControllerSendBinaryDocs extends AbstractEsignatureController private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; private final Session session; private final User user; @@ -69,50 +68,12 @@ public EG010ControllerSendBinaryDocs(DSConfiguration config, Session session, Us @Override // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException { - // Step 1. Gather documents and their headers - List documents = List.of( - new DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, - EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)), - new DocumentInfo(DOCX_DOCUMENT_NAME, "2", DocumentType.DOCX, - EnvelopeHelpers.readFile(DOCX_DOCUMENT_FILE_NAME)), - new DocumentInfo(PDF_DOCUMENT_NAME, "3", DocumentType.PDF, - EnvelopeHelpers.readFile(PDF_DOCUMENT_FILE_NAME)) - ); - - // Step 2. Make the envelope JSON request body - JSONObject envelopeJSON = makeEnvelopeJSON(args, documents); - - // Step 3. Create the multipart body - URL uri = new URL(String.format("%s/v2.1/accounts/%s/envelopes", session.getBasePath(), session.getAccountId())); - String contentType = String.join("",MediaType.MULTIPART_FORM_DATA, "; boundary=", BOUNDARY_DELIMITER); - HttpsURLConnection connection = (HttpsURLConnection) uri.openConnection(); - connection.setRequestMethod(HttpMethod.POST); - connection.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); - connection.setRequestProperty(HttpHeaders.CONTENT_TYPE, contentType); - connection.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); - connection.setDoOutput(true); - - // See https://developers.docusign.com/esign-rest-api/guides/requests-and-responses - DataOutputStream buffer = new DataOutputStream(connection.getOutputStream()); - writeBoundaryHeader(buffer, MediaType.APPLICATION_JSON, "form-data"); - buffer.writeBytes(envelopeJSON.toString(DoneExample.JSON_INDENT_FACTOR)); - - for (DocumentInfo docInfo : documents) { - String content = String.format("file; filename=\"%s\";documentid=%s", docInfo.getName(), docInfo.getId()); - buffer.writeBytes(LINE_DELIMITER); - writeBoundaryHeader(buffer, docInfo.getDocType().getMime(), content); - buffer.write(docInfo.getData()); - } - - writeClosingBoundary(buffer); - - int responseCode = connection.getResponseCode(); - if (responseCode < HttpURLConnection.HTTP_OK || responseCode >= HttpURLConnection.HTTP_MULT_CHOICE) { - String error = StreamUtils.copyToString(connection.getErrorStream(), StandardCharsets.UTF_8); - throw new ExampleException(error, null); - } - - String responseString = StreamUtils.copyToString(connection.getInputStream(), StandardCharsets.UTF_8); + String responseString = SendBinaryDocsService.sendBinaryDocs( + args, + session.getBasePath(), + session.getAccountId(), + user.getAccessToken() + ); JSONObject obj = new JSONObject(responseString); String envelopeId = obj.getString("envelopeId"); session.setEnvelopeId(envelopeId); @@ -122,91 +83,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static void writeBoundaryHeader(DataOutputStream buffer, - String contentType, String contentDisposition) throws IOException { - buffer.writeBytes(HYPHENS); - buffer.writeBytes(BOUNDARY_DELIMITER); - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_TYPE, contentType)); - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_DISPOSITION, contentDisposition)); - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(LINE_DELIMITER); - } - - private static void writeClosingBoundary(DataOutputStream buffer) throws IOException { - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(HYPHENS); - buffer.writeBytes(BOUNDARY_DELIMITER); - buffer.writeBytes(HYPHENS); - buffer.writeBytes(LINE_DELIMITER); - buffer.flush(); - } - - // document 1 (html) has tag **signature_1** - // document 2 (docx) has tag /sn1/ - // document 3 (pdf) has tag /sn1/ - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. - // After it is signed, a copy is sent to the cc person. - private static JSONObject makeEnvelopeJSON(WorkArguments args, List documents) { - // The DocuSign platform searches throughout your envelope's documents for - // matching anchor strings. So the signHere2 tab will be used in both document - // 2 and 3 since they use the same anchor string for their "signer 1" tabs. - Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // create a signer recipient to sign the document, identified by name and email - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signerTabs); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRecipientId("2"); - cc.setRoutingOrder("2"); - - // The order in the documents array determines the order in the envelope - JSONArray jsonDocuments = new JSONArray(); - for (DocumentInfo docInfo : documents) { - JSONObject jsonDoc = new JSONObject(); - jsonDoc.put("name", docInfo.getName()); - jsonDoc.put("fileExtension", docInfo.getDocType().getDefaultFileExtention()); - jsonDoc.put("documentId", docInfo.getId()); - jsonDocuments.put(jsonDoc); - } - - // Create the envelope definition. Request that the envelope be sent by - // setting |status| to "sent". To request that the envelope be created - // as a draft, set to "created" - JSONObject envelopeJSON = new JSONObject(); - envelopeJSON.put("emailSubject", "Please sign this document set"); - envelopeJSON.put("documents", jsonDocuments); - envelopeJSON.put("recipients", new JSONObject(EnvelopeHelpers.createRecipients(signer, cc))); - envelopeJSON.put("status", EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeJSON; - } - - @Value - private static class DocumentInfo { - private String name; - private String id; - private DocumentType docType; - private byte[] data; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index 40d494b4..536ab588 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -11,6 +11,8 @@ import com.docusign.esign.model.ReturnUrlRequest; import com.docusign.esign.model.ViewUrl; +import com.docusign.services.eSignature.examples.EmbeddedSendingService; +import com.docusign.services.eSignature.examples.SigningViaEmailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -51,17 +53,13 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. Make the envelope with "created" (draft) status - args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); - EnvelopeDefinition env = EG002ControllerSigningViaEmail.makeEnvelope(args); - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, env); + EnvelopeSummary results = EmbeddedSendingService.createEnvelopeWithDraftStatus(envelopesApi, args, accountId); String envelopeId = results.getEnvelopeId(); // Step 2. Create the sender view. // Set the url where you want the recipient to go once they are done // signing should typically be a callback route somewhere in your app. - ReturnUrlRequest viewRequest = new ReturnUrlRequest(); - viewRequest.setReturnUrl(config.getDsReturnUrl()); - ViewUrl viewUrl = envelopesApi.createSenderView(accountId, envelopeId, viewRequest); + ViewUrl viewUrl = EmbeddedSendingService.createSenderView(envelopesApi, accountId, envelopeId, config.getDsReturnUrl()); // Switch to Recipient and Documents view if requested by the user String url = viewUrl.getUrl(); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java index 2b315a62..059c28f1 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java @@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse; +import com.docusign.services.eSignature.examples.EmbeddedConsoleService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -54,19 +55,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 1. Create the Console / Web UI view. - // Set the URL where you want the recipient to go once they are finished in - // the Web UI. There are cases where a user will never click "FINISH" within - // the Web UI, you cannot assume control will be passed back to your application. - ConsoleViewRequest viewRequest = new ConsoleViewRequest(); - viewRequest.setReturnUrl(config.getDsReturnUrl()); - String envelopeId = session.getEnvelopeId(); - if ("envelope".equalsIgnoreCase(args.getStartingView()) && envelopeId != null) { - viewRequest.setEnvelopeId(envelopeId); - } - // Step 2. Call the CreateSenderView API - ViewUrl viewUrl = envelopesApi.createConsoleView(session.getAccountId(), viewRequest); + ViewUrl viewUrl = EmbeddedConsoleService.createConsoleView( + envelopesApi, + config.getDsReturnUrl(), + session.getEnvelopeId(), + args.getStartingView(), + session.getAccountId()); + return new RedirectView(viewUrl.getUrl()); } // ***DS.snippet.0.end diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index 3d7a8630..cc135c4a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -21,6 +21,7 @@ import com.docusign.esign.model.Tabs; import com.docusign.esign.model.ViewUrl; +import com.docusign.services.eSignature.examples.AddDocToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -45,10 +46,6 @@ public class EG013ControllerAddDocToTemplate extends AbstractEsignatureControlle private static final String MODEL_LIST_TEMPLATE = "listTemplates"; private static final String SIGNER_CLIENT_ID = "1000"; - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl"; - private static final String HTML_DOCUMENT_NAME = "Appendix 1--Sales order"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; private final Session session; private final User user; @@ -76,109 +73,18 @@ protected Object doWork(WorkArguments args, ModelMap model, String accountId = session.getAccountId(); EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 2 start - args.setDsReturnUrl(config.getDsReturnUrl()); - args.setDsPingUrl(config.getDsPingUrl()); - args.setSignerClientId(SIGNER_CLIENT_ID); - EnvelopeDefinition envelope = makeEnvelope(args); - // Step 2 end - - // Step 3 start - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - // Step 3 end - - // Step 4 start - RecipientViewRequest viewRequest = makeRecipientViewRequest(args); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); + ViewUrl viewUrl = AddDocToTemplateService.addDocumentToTemplate( + envelopesApi, + args, + config.getDsReturnUrl(), + config.getDsPingUrl(), + SIGNER_CLIENT_ID, + accountId + ); + return new RedirectView(viewUrl.getUrl()); // Step 4 end } - private static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - viewRequest.setReturnUrl(args.getDsReturnUrl()); - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(args.getSignerEmail()); - viewRequest.setUserName(args.getSignerName()); - viewRequest.setClientUserId(args.getSignerClientId()); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); - viewRequest.setPingUrl(args.getDsPingUrl()); - - return viewRequest; - } - // The envelope request object uses Composite Template to include in the envelope: - // 1. A template stored on the DocuSign service - // 2. An additional document which is a custom HTML source document - private EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // Create a signer and cc recipients for the signer role of the server template - CarbonCopy cc1 = new CarbonCopy(); - cc1.setEmail(args.getCcEmail()); - cc1.setName(args.getCcName()); - cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); - cc1.setRecipientId("2"); - - // create a composite template for the Server Template - CompositeTemplate compTemplate1 = new CompositeTemplate(); - compTemplate1.setCompositeTemplateId("1"); - ServerTemplate serverTemplates = new ServerTemplate(); - serverTemplates.setSequence("1"); - serverTemplates.setTemplateId(args.getTemplateId()); - compTemplate1.setServerTemplates(Arrays.asList(serverTemplates)); - - // Add the roles via an inlineTemplate - InlineTemplate inlineTemplate = new InlineTemplate(); - inlineTemplate.setSequence("2"); - inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients(createSigner(args), cc1)); - compTemplate1.setInlineTemplates(Arrays.asList(inlineTemplate)); - - // The signer recipient for the added document with a tab definition: - Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); - Signer signer1AddedDoc = createSigner(args); - signer1AddedDoc.setTabs(signer1Tabs); - - // create the HTML document - byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); - - // create a composite template for the added document and add the recipients via an inlineTemplate - CompositeTemplate compTemplate2 = new CompositeTemplate(); - compTemplate2.setCompositeTemplateId("2"); - InlineTemplate inlineTemplate2 = new InlineTemplate(); - inlineTemplate2.setSequence("1"); - inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc1)); - compTemplate2.setInlineTemplates(Arrays.asList(inlineTemplate2)); - compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, - DocumentType.HTML.getDefaultFileExtention(), "1")); - - EnvelopeDefinition env = new EnvelopeDefinition(); - env.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - env.setCompositeTemplates(Arrays.asList(compTemplate1, compTemplate2)); - - return env; - } - - // Adding clientUserId transforms the template recipient into an embedded recipient - private static Signer createSigner(WorkArguments args) { - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - signer.setRecipientId("1"); - signer.setClientUserId(args.getSignerClientId()); - return signer; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 4df3a2aa..f06237aa 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -19,6 +19,7 @@ import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; +import com.docusign.services.eSignature.examples.CollectPaymentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -49,23 +50,9 @@ public class EG014ControllerCollectPayment extends AbstractEsignatureController { private static final String MODEL_GATEWAY_OK = "gatewayOk"; - private static final String HTML_DOCUMENT_FILE_NAME = "templates/order-form.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order form"; - // Order form constants - private static final String TRUE = "true"; - private static final String FALSE = "false"; - private static final int L1_PRICE = 5; - private static final int L2_PRICE = 150; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private static final String DEFAULT_FONT = "helvetica"; - private static final String DEFAULT_FONT_SIZE = "size11"; - private static final String ANCHOR_UNITS = "pixels"; - private final Session session; private final User user; - @Autowired public EG014ControllerCollectPayment(DSConfiguration config, Session session, User user) { super(config, "eg014", "Envelope sent"); @@ -86,10 +73,10 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. Make the envelope request body - EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeDefinition envelope = CollectPaymentService.makeEnvelope(args, config.getGatewayAccountId(), config.getGatewayName(), config.getGatewayDisplayName()); // Step 2. call Envelopes::create API method - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary results = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); DoneExample.createDefault(title) .withMessage(String.join("", "The envelope has been created and sent!
Envelope ID ", @@ -97,146 +84,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - // document 1 (html) has multiple tags: - // /l1q/ and /l2q/ -- quantities: drop down - // /l1e/ and /l2e/ -- extended: payment lines - // /l3t/ -- total -- formula - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. - // After it is signed, a copy is sent to the cc person. - private EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); - - // create a signer recipient to sign the document, identified by name and email - // routingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer() - .email(args.getSignerEmail()) - .name(args.getSignerName()) - .recipientId("1") - .routingOrder("1"); - signer.setTabs(createTabs()); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy() - .email(args.getCcEmail()) - .name(args.getCcName()) - .routingOrder("2") - .recipientId("2"); - - // Create the envelope definition - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please complete your order"); - envelope.setDocuments(Arrays.asList(EnvelopeHelpers.createDocument(htmlDoc, - HTML_DOCUMENT_NAME, DocumentType.HTML.getDefaultFileExtention(), "1"))); - envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelope; - } - - // creates tabs per signer - private Tabs createTabs() { - java.util.List listItems = java.util.List.of( - new ListItem().text("none").value("0"), - new ListItem().text("1").value("1"), - new ListItem().text("2").value("2"), - new ListItem().text("3").value("3"), - new ListItem().text("4").value("4"), - new ListItem().text("5").value("5"), - new ListItem().text("6").value("6"), - new ListItem().text("7").value("7"), - new ListItem().text("8").value("8"), - new ListItem().text("9").value("9"), - new ListItem().text("10").value("10")); - List listl1q = createList("/l1q/", "l1q", listItems); - List listl2q = createList("/l2q/", "l2q", listItems); - - // Create two formula tabs for the extended price on the line items and formula for the total - FormulaTab formulal1e = createFormulaTab("/l1e/", "l1e", L1_PRICE); - FormulaTab formulal2e = createFormulaTab("/l2e/", "l2e", L2_PRICE); - FormulaTab formulal3t = new FormulaTab() - .font(DEFAULT_FONT) - .bold(TRUE) - .fontSize("size12") - .anchorString("/l3t/") - .anchorYOffset("-8") - .anchorUnits(ANCHOR_UNITS) - .anchorXOffset("50") - .tabLabel("l3t") - .formula("[l1e] + [l2e]") - .roundDecimalPlaces("0") - .required(TRUE) - .locked(TRUE) - .disableAutoSize(FALSE); - PaymentLineItem paymentLineIteml1 = new PaymentLineItem() - .name("Harmonica") - .description(String.format("${%d} each", L1_PRICE)) - .amountReference("l1e"); - PaymentLineItem paymentLineIteml2 = new PaymentLineItem() - .name("Xylophone") - .description(String.format("${%d} each", L2_PRICE)) - .amountReference("l2e"); - PaymentDetails paymentDetails = new PaymentDetails() - .gatewayAccountId(config.getGatewayAccountId()) - .currencyCode("USD") - .gatewayName(config.getGatewayName()) - .gatewayDisplayName(config.getGatewayDisplayName()) - .lineItems(Arrays.asList(paymentLineIteml1, paymentLineIteml2)); - // Hidden formula for the payment itself - FormulaTab formulaPayment = new FormulaTab() - .tabLabel("payment") - .formula("([l1e] + [l2e]) * {100}") - .roundDecimalPlaces("0") - .paymentDetails(paymentDetails) - .hidden(TRUE) - .required(TRUE) - .locked(TRUE) - .documentId("1") - .pageNumber("1") - .xPosition("0") - .yPosition("0"); - - Tabs signerTabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); - signerTabs.listTabs(Arrays.asList(listl1q, listl2q)); - signerTabs.formulaTabs(Arrays.asList(formulal1e, formulal2e, formulal3t, formulaPayment)); - return signerTabs; - } - - private static List createList(String anchor, String label, java.util.List items) { - return new List() - .font(DEFAULT_FONT) - .fontSize(DEFAULT_FONT_SIZE) - .anchorString(anchor) - .anchorYOffset("-10") - .anchorUnits(ANCHOR_UNITS) - .anchorXOffset("0") - .listItems(items) - .required(TRUE) - .tabLabel(label); - } - - private static FormulaTab createFormulaTab(String anchor, String label, int price) { - return new FormulaTab() - .font(DEFAULT_FONT) - .fontSize(DEFAULT_FONT_SIZE) - .anchorString(anchor) - .anchorYOffset("-8") - .anchorUnits(ANCHOR_UNITS) - .anchorXOffset("105") - .tabLabel(label) - .formula(String.format("[l1q] * {%d}", price)) - .roundDecimalPlaces("0") - .required(TRUE) - .locked(TRUE) - .disableAutoSize(FALSE); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java index 18001930..7b3bc22a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java @@ -7,6 +7,8 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeFormData; +import com.docusign.services.eSignature.examples.GetTabValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -46,8 +48,12 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope recipients EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + EnvelopeFormData envelopeFormData = GetTabValuesService.getTabValues( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(envelopesApi.getFormData(session.getAccountId(), session.getEnvelopeId())) + .withJsonObject(envelopeFormData) .withMessage("Results from the Envelope::GetFormData method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java index 59f4d74f..199005bb 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java @@ -9,6 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; +import com.docusign.services.eSignature.examples.SetTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -25,12 +26,6 @@ @RequestMapping("/eg016") public class EG016ControllerSetTabValues extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_salary.docx"; - private static final String DOCUMENT_NAME = "Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = 20; - private static final int ANCHOR_OFFSET_X = 10; - private static final String SIGNER_CLIENT_ID = "1000"; - private final Session session; private final User user; @@ -49,8 +44,7 @@ protected Object doWork(WorkArguments args, ModelMap model, String signerEmail = args.getSignerEmail(); String accountId = session.getAccountId(); - - EnvelopeDefinition envelope = makeEnvelope(signerEmail, signerName); + EnvelopeDefinition envelope = SetTabValuesService.makeEnvelope(signerEmail, signerName); // Step 2. Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); @@ -63,135 +57,15 @@ protected Object doWork(WorkArguments args, ModelMap model, session.setEnvelopeId(envelopeId); // Step 6. Create the view request - RecipientViewRequest viewRequest = makeRecipientViewRequest(signerEmail, signerName); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + RecipientViewRequest viewRequest = SetTabValuesService.makeRecipientViewRequest( + signerEmail, + signerName, + config.getDsReturnUrl(), + config.getDsPingUrl()); + ViewUrl viewUrl = SetTabValuesService.createRecipientView(envelopesApi, accountId, envelopeId, viewRequest); // State can be stored/recovered using the framework's session or a // query parameter on the returnUrl (see the makeRecipientViewRequest method) return new RedirectView(viewUrl.getUrl()); } - - private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String signerName) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - // The query parameter is included as an example of how - // to save/recover state information during the redirect to - // the DocuSign signing. It's usually better to use - // the session mechanism of your web framework. Query parameters - // can be changed/spoofed very easily. - viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); - - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(SIGNER_CLIENT_ID); - - // DocuSign recommends that you redirect to DocuSign for the - // Embedded signing . There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds - viewRequest.setPingUrl(config.getDsPingUrl()); - - return viewRequest; - } - - // Step 4. Construct your request body - private static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName) throws IOException { - // Create a signer recipient to sign the document, identified by name and email - // We set the clientUserId to enable embedded signing for the recipient - Signer signer = new Signer(); - signer.setEmail(signerEmail); - signer.setName(signerName); - signer.clientUserId(SIGNER_CLIENT_ID); - signer.recipientId("1"); - - // Step 3. Create tabs and CustomFields - SignHere signHere = new SignHere(); - signHere.setAnchorString("/sn1"); - signHere.setAnchorUnits("pixels"); - signHere.setAnchorYOffset("10"); - signHere.setAnchorXOffset("20"); - - Text textLegal = new Text(); - textLegal.setAnchorString("/legal/"); - textLegal.setAnchorUnits("pixels"); - textLegal.setAnchorYOffset("-9"); - textLegal.setAnchorXOffset("5"); - textLegal.setFont("helvetica"); - textLegal.setFontSize("size11"); - textLegal.setBold("true"); - textLegal.setValue(signerName); - textLegal.setLocked("false"); - textLegal.setTabId("legal_name"); - textLegal.setTabLabel("Legal Name"); - - Text textFamiliar = new Text(); - textFamiliar.setAnchorString("/familar/"); - textFamiliar.setAnchorUnits("pixels"); - textFamiliar.setAnchorYOffset("-9"); - textFamiliar.setAnchorXOffset("5"); - textFamiliar.setFont("helvetica"); - textFamiliar.setFontSize("size11"); - textFamiliar.setBold("true"); - textFamiliar.setValue(signerName); - textFamiliar.setLocked("false"); - textFamiliar.setTabId("familiar_name"); - textFamiliar.setTabLabel("Familiar Name"); - - Integer salary = 123000; - - Text textSalary = new Text(); - textSalary.setAnchorString("/salary/"); - textSalary.setAnchorUnits("pixels"); - textSalary.setAnchorYOffset("-9"); - textSalary.setAnchorXOffset("5"); - textSalary.setFont("helvetica"); - textSalary.setFontSize("size11"); - textSalary.setBold("true"); - textSalary.setValue(String.format("$ %d", salary)); - textSalary.setLocked("true"); - textSalary.setTabId("salary"); - textSalary.setTabLabel("salary"); - - TextCustomField salaryCustomField = new TextCustomField(); - salaryCustomField.setName("salary"); - salaryCustomField.setRequired("false"); - salaryCustomField.setShow("true"); // Yes, included in the CoC - salaryCustomField.setValue(String.valueOf(salary)); - - CustomFields cf = new CustomFields(); - cf.setTextCustomFields(Arrays.asList(salaryCustomField)); - - Tabs tabs = new Tabs(); - tabs.setSignHereTabs(Arrays.asList(signHere)); - tabs.setTextTabs(Arrays.asList(textLegal, textFamiliar, textSalary)); - - signer.setTabs(tabs); - - // Add the recipient to the envelope object - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); - envelopeDefinition.setRecipients(recipients); - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "3"); - envelopeDefinition.setDocuments(Arrays.asList(doc)); - envelopeDefinition.setCustomFields(cf); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeDefinition; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index 76561549..09825760 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -11,6 +11,7 @@ import com.docusign.esign.model.*; import com.docusign.esign.model.Checkbox; import com.docusign.esign.model.List; +import com.docusign.services.eSignature.examples.SetTemplateTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -67,7 +68,13 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 3. is shown in the makeEnvelope method below // Step 4. Construct your request body - EnvelopeDefinition envelope = makeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId); + EnvelopeDefinition envelope = SetTemplateTabValuesService.makeEnvelope( + signerEmail, + signerName, + ccEmail, + ccName, + templateId, + SIGNER_CLIENT_ID); // Step 5. Call the eSignature REST API EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); @@ -75,152 +82,22 @@ protected Object doWork(WorkArguments args, ModelMap model, session.setEnvelopeId(envelopeId); // Step 6. Create the view request - RecipientViewRequest viewRequest = makeRecipientViewRequest(signerEmail, signerName); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + RecipientViewRequest viewRequest = SetTemplateTabValuesService.makeRecipientViewRequest( + signerEmail, + signerName, + config.getDsReturnUrl(), + SIGNER_CLIENT_ID, + config.getDsPingUrl()); + + ViewUrl viewUrl = SetTemplateTabValuesService.setTemplateTabValues( + envelopesApi, + accountId, + envelopeId, + viewRequest + ); // State can be stored/recovered using the framework's session or a // query parameter on the returnUrl (see the makeRecipientViewRequest method) return new RedirectView(viewUrl.getUrl()); } - - private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String signerName) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - // The query parameter is included as an example of how - // to save/recover state information during the redirect to - // the DocuSign signing. It's usually better to use - // the session mechanism of your web framework. Query parameters - // can be changed/spoofed very easily. - viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); - - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(SIGNER_CLIENT_ID); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds - viewRequest.setPingUrl(config.getDsPingUrl()); - - return viewRequest; - } - - - private static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName, String ccEmail, String ccName, String templateId){ - // Create a signer recipient to sign the document, identified by name and email - // We set the clientUserId to enable embedded signing for the recipient - - // Step 3. Create tabs and CustomFields - List list1 = new List(); - list1.setValue("green"); - list1.setDocumentId("1"); - list1.setPageNumber("1"); - list1.setTabLabel("list"); - - // Checkboxes - Checkbox ck1 = new Checkbox(); - ck1.setTabLabel("ckAuthorization"); - ck1.setSelected("true"); - - Checkbox ck2 = new Checkbox(); - ck2.setTabLabel("ckAgreement"); - ck2.setSelected("true"); - - Radio radio = new Radio(); - radio.setValue("white"); - radio.setSelected("true"); - - RadioGroup rg = new RadioGroup(); - rg.setGroupName("radio1"); - rg.setRadios(Arrays.asList(radio)); - - - Text txt = new Text(); - txt.setTabLabel("text"); - txt.setValue("Jabberywocky!"); - - // We can also add a new tab (field) to the ones already in the template: - - Text txtExtra = new Text(); - txtExtra.setDocumentId("1"); - txtExtra.setPageNumber("1"); - txtExtra.setXPosition("280"); - txtExtra.setYPosition("172"); - txtExtra.setFont("helvetica"); - txtExtra.setFontSize("size14"); - txtExtra.setTabLabel("added text field"); - txtExtra.setHeight("23"); - txtExtra.setWidth("84"); - txtExtra.setRequired("false"); - txtExtra.setBold("true"); - txtExtra.setValue(signerName); - txtExtra.setLocked("false"); - txtExtra.setTabId("name"); - - - // Add the tabs model (including the SignHere tab) to the signer. - // The Tabs object wants arrays of the different field/tab types - // Tabs are set per recipient / signer - - Tabs tabs = new Tabs(); - - tabs.setTextTabs(Arrays.asList(txt, txtExtra)); - tabs.setRadioGroupTabs(Arrays.asList(rg)); - tabs.setCheckboxTabs(Arrays.asList(ck1, ck2)); - tabs.setListTabs(Arrays.asList(list1)); - - - // create a signer recipient to sign the document, identified by name and email - // We're setting the parameters via the object creation - TemplateRole signer = new TemplateRole(); - signer.setEmail(signerEmail); - signer.setName(signerName); - // Setting the client_user_id marks the signer as embedded - signer.setClientUserId(SIGNER_CLIENT_ID); - signer.setRoleName("signer"); - signer.setTabs(tabs); - - TemplateRole cc = new TemplateRole(); - cc.setEmail(ccEmail); - cc.setName(ccName); - cc.setRoleName("cc"); - - // Create an envelope custom field to save our application"s - // Data about the envelope - TextCustomField customField = new TextCustomField(); - customField.setName("app metadata item"); - customField.setValue("1234567"); - customField.setRequired("false"); - customField.show("true"); //Yes, include in the CoC - - - CustomFields cf = new CustomFields(); - cf.setTextCustomFields(Arrays.asList(customField)); - - - // Next, create the top level envelope definition and populate it. - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); - // The Recipients object wants arrays for each recipient type - envelopeDefinition.setTemplateId(templateId); - envelopeDefinition.setTemplateRoles(Arrays.asList(signer, cc)); - envelopeDefinition.setCustomFields(cf); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeDefinition; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java index ea90bbd1..a24f4209 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java @@ -7,6 +7,8 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.CustomFieldsEnvelope; +import com.docusign.services.eSignature.examples.EnvelopeCustomFieldValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -46,11 +48,15 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2. Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + // Step 3. Call the eSignature REST API + CustomFieldsEnvelope customFieldsEnvelope = EnvelopeCustomFieldValuesService.envelopeCustomFieldValues( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId() + ); + DoneExample.createDefault(title) - .withJsonObject( - // Step 3. Call the eSignature REST API - envelopesApi.listCustomFields(session.getAccountId(), session.getEnvelopeId()) - ) + .withJsonObject(customFieldsEnvelope) .withMessage("Results from the Envelope::GetFormData method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index 642ca343..5def9a69 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -14,6 +14,7 @@ import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; +import com.docusign.services.eSignature.examples.AccessCodeAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -32,9 +33,6 @@ @RequestMapping("/eg019") public class EG019ControllerAccessCodeAuthentication extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - private final Session session; private final User user; @@ -54,10 +52,14 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args); + EnvelopeDefinition envelope = AccessCodeAuthenticationService.createEnvelope(args); // Step 3: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary results = AccessCodeAuthenticationService.accessCodeAuthentication( + envelopesApi, + session.getAccountId(), + envelope + ); session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -68,43 +70,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - - Signer signer = new Signer(); - signer.setName(args.getSignerName()); - signer.setEmail(args.getSignerEmail()); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setAccessCode(args.getAccessCode()); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java index 5193395d..e8b5b31a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java @@ -15,6 +15,7 @@ import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; +import com.docusign.services.eSignature.examples.SmsAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -33,8 +34,6 @@ @RequestMapping("/eg020") public class EG020ControllerSmsAuthentication extends AbstractEsignatureController { // For List.of you could even do groups of numbers such as List.of("415-555-1212", "415-555-3434"); - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; private final Session session; private final User user; @@ -57,10 +56,14 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getPhoneNumber()); + EnvelopeDefinition envelope = SmsAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getPhoneNumber()); // Step 4: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); + EnvelopeSummary results = SmsAuthenticationService.smsAuthentication( + envelopesApi, + accountId, + envelope + ); session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -71,48 +74,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); - RecipientSMSAuthentication smsAuth = new RecipientSMSAuthentication(); - smsAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setRequireIdLookup("true"); - signer.setSmsAuthentication(smsAuth); - signer.setIdCheckConfigurationName("SMS Auth $"); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java index 6b087d5f..b7461b75 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java @@ -15,6 +15,7 @@ import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; +import com.docusign.services.eSignature.examples.PhoneAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -32,9 +33,6 @@ @RequestMapping("/eg021") public class EG021ControllerPhoneAuthentication extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - private final Session session; private final User user; @@ -54,10 +52,17 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getPhoneNumber()); + EnvelopeDefinition envelope = PhoneAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getPhoneNumber()); // Step 3: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary results = PhoneAuthenticationService.phoneAuthentication( + envelopesApi, + session.getAccountId(), + envelope + ); session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -68,49 +73,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); - RecipientPhoneAuthentication phoneAuth = new RecipientPhoneAuthentication(); - phoneAuth.setRecipMayProvideNumber("true"); - phoneAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setRequireIdLookup("true"); - signer.setPhoneAuthentication(phoneAuth); - signer.setIdCheckConfigurationName("Phone Auth $"); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - envelope.setDocuments(Arrays.asList(doc)); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index cf4880f7..f07068b0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -14,6 +14,7 @@ import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; +import com.docusign.services.eSignature.examples.KBAAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -31,9 +32,6 @@ @RequestMapping("/eg022") public class EG022ControllerKBAAuthentication extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - private final Session session; private final User user; @@ -53,10 +51,14 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail()); + EnvelopeDefinition envelope = KBAAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail()); // Step 3: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary results = KBAAuthenticationService.kbaAuthentication( + envelopesApi, + session.getAccountId(), + envelope + ); session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -68,43 +70,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setIdCheckConfigurationName("ID Check"); - signer.setRequireIdLookup("true"); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setRecipients(recipients); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index f7d4a21c..f77cb7a3 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -19,6 +19,7 @@ import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; +import com.docusign.services.eSignature.examples.IdvAuthenticationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -40,8 +41,7 @@ public class EG023ControllerIdvAuthentication extends AbstractEsignatureController { private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; + private final Session session; private final User user; @@ -57,19 +57,19 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 1: Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + //Step 2: Retrieve the workflow ID - AccountsApi workflowDetails = new AccountsApi(apiClient); - AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); - List identityVerification = workflowRes.getIdentityVerification(); - if (identityVerification == null || identityVerification.isEmpty()) { - throw new ApiException("Error. Cant get AccountIdentityVerificationWorkflow"); - } - String workflowId = identityVerification.get(0).getWorkflowId(); + String workflowId = IdvAuthenticationService.retrieveWorkflowId(apiClient, session.getAccountId()); + logger.info("workflowId = " + workflowId); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); + EnvelopeDefinition envelope = IdvAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); // Step 4: Create envelope - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary results = IdvAuthenticationService.idvAuthentication( + envelopesApi, + session.getAccountId(), + envelope + ); session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -80,59 +80,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, - String workflowId) { - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign"); - envelopeDefinition.setEmailBlurb("Sample text for email body"); - envelopeDefinition.setStatus("Sent"); - - - byte[] fileBytes = new byte[0]; - try { - fileBytes = EnvelopeHelpers.readFile(DOCUMENT_FILE_NAME); - } catch (IOException e) { - e.printStackTrace(); - } - Document doc1 = new Document(); - doc1.setDocumentBase64(Base64.getEncoder().encodeToString(fileBytes)); - doc1.setDocumentId("1"); - doc1.setFileExtension("pdf"); - doc1.setName("Lorem"); - - SignHere signHere1 = new SignHere(); - signHere1.setName("SignHereTab"); - signHere1.setXPosition("75"); - signHere1.setYPosition("572"); - signHere1.setTabLabel("SignHereTab"); - signHere1.setPageNumber("1"); - signHere1.setDocumentId("1"); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere1.setRecipientId("1"); //represents your {RECIPIENT_ID} - - Tabs signer1Tabs = new Tabs(); - signer1Tabs.setSignHereTabs(Collections.singletonList(signHere1)); - RecipientIdentityVerification workflow = new RecipientIdentityVerification(); - workflow.setWorkflowId(workflowId); - - Signer signer1 = new Signer(); - signer1.setName(signerName); - signer1.setEmail(signerEmail); - signer1.setRoleName(""); - signer1.setNote(""); - signer1.setStatus("created"); - signer1.setDeliveryMethod("email"); - signer1.setRecipientId("1"); //represents your {RECIPIENT_ID} - signer1.setIdentityVerification(workflow); - signer1.setTabs(signer1Tabs); - - Recipients recipients = new Recipients(); - recipients.setSigners(Collections.singletonList(signer1)); - - envelopeDefinition.setRecipients(recipients); - envelopeDefinition.setDocuments(Collections.singletonList(doc1)); - return envelopeDefinition; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java index 999b35d6..a60dc588 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java @@ -8,6 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.eSignature.examples.PermissionCreateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -44,19 +45,13 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 2. Construct your API headers AccountsApi accountsApi = createAccountsApi(session.getBasePath(), user.getAccessToken()); - - // Step 3. Construct your request body - // We're extending the AccountSettings class with AccountSettingsPatch to include the signingUIVersion which is missing in the swagger spec at this time. - Gson gson = new Gson(); - AccountRoleSettings settings = DsModelUtils.createDefaultRoleSettings(); - AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); - newSettings.signingUiVersion("1"); - PermissionProfile profile = new PermissionProfile() - .permissionProfileName(args.getPermissionProfileName()) - .settings(newSettings); // Step 4. Call the eSignature REST API - PermissionProfile newProfile = accountsApi.createPermissionProfile(session.getAccountId(), profile); + PermissionProfile newProfile = PermissionCreateService.createNewProfile( + accountsApi, + session.getAccountId(), + args.getPermissionProfileName() + ); DoneExample.createDefault(title) .withJsonObject(newProfile) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java index b4a0faa9..666c31bc 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java @@ -8,6 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.eSignature.examples.PermissionSetUserGroupsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -66,15 +67,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); - GroupsApi groupsApi = new GroupsApi(apiClient); - - // Step 3: Perform request - Group newGroup = new Group() - .groupId(args.getGroupId()) - .permissionProfileId(args.getProfileId()); - GroupInformation groupInformation = new GroupInformation() - .groups(List.of(newGroup)); - GroupInformation newGroupInfo = groupsApi.updateGroups(session.getAccountId(), groupInformation); + + GroupInformation newGroupInfo = PermissionSetUserGroupsService.permissionSetUserGroups( + apiClient, + args.getGroupId(), + args.getProfileId(), + session.getAccountId() + ); // Step 4: Show result ErrorDetails errorDetails = newGroupInfo.getGroups().get(0).getErrorDetails(); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java index 472eb006..aef41372 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java @@ -14,6 +14,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.eSignature.examples.PermissionChangeSingleSettingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -69,7 +70,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception model.addAttribute(MODEL_CUR_PROFILE_NAME, profiles.get(0).getPermissionProfileName()); model.addAttribute(MODEL_CUR_PROFILE_ID, profiles.get(0).getPermissionProfileId()); - findProfile(profiles, session.getPermissionProfileId()).ifPresent((PermissionProfile curProfile) -> { + PermissionChangeSingleSettingService.findProfile( + profiles, + session.getPermissionProfileId()).ifPresent((PermissionProfile curProfile) -> + { model.addAttribute(MODEL_CUR_PROFILE_NAME, curProfile.getPermissionProfileName()); model.addAttribute(MODEL_CUR_PROFILE_ID, curProfile.getPermissionProfileId()); // model.addAttribute(MODEL_PERMISSIONS, @@ -85,50 +89,16 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String accountId = session.getAccountId(); String curProfileId = args.getProfileId(); - // Step 3. Construct your request body - PermissionProfileInformation permissionsInfo = accountsApi.listPermissions(accountId); - PermissionProfile profile = findProfile(permissionsInfo.getPermissionProfiles(), curProfileId) - .orElseThrow(NoSuchElementException::new); - - // Step 4. Call the eSignature REST API - AccountRoleSettings newSettings = Objects.requireNonNullElse(profile.getSettings(), - DsModelUtils.createDefaultRoleSettings()); - profile.setSettings(changeRandomSettings(newSettings)); - PermissionProfile newProfile = accountsApi.updatePermissionProfile(accountId, curProfileId, profile); + PermissionProfile newProfile = PermissionChangeSingleSettingService.permissionChangeSingleSetting( + accountsApi, + accountId, + curProfileId + ); DoneExample.createDefault(title).withMessage("The permission profile is updated!
Permission profile ID: " + newProfile.getPermissionProfileId() + ".").addToModel(model); return DONE_EXAMPLE_PAGE_COMPARE; } - private static Optional findProfile(List profiles, String profileId) { - - return profiles.stream().filter(p -> p.getPermissionProfileId().equals(profileId)).findFirst(); - } - - // Changes random boolean properties; in a real application, changing properties - // will be read from the page or in a different way - private static AccountRoleSettings changeRandomSettings(AccountRoleSettings settings) { - Gson gson = new Gson(); - // Change this value back to: gson.fromJson(gson.toJson(settings), - // AccountRoleSettings.class); - // as soon as the signinguiversion is added back to the swagger spec. - // Also change the type back from AccountRoleSettingsPatch to AccountRoleSettings - AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); - newSettings.signingUiVersion("1"); - Random random = new Random(System.currentTimeMillis()); - - return newSettings.canCreateWorkspaces(randomBool(random)).allowEnvelopeSending(randomBool(random)) - .allowSignerAttachments(randomBool(random)).allowESealRecipients(randomBool(random)) - .allowTaggingInSendAndCorrect(randomBool(random)).allowWetSigningOverride(randomBool(random)) - .enableApiRequestLogging(randomBool(random)).enableRecipientViewingNotifications(randomBool(random)) - .allowSupplementalDocuments(randomBool(random)).disableDocumentUpload(randomBool(random)); - } - private static String randomBool(Random random) { - if (random.nextBoolean()) { - return DsModelUtils.TRUE; - } - return DsModelUtils.FALSE; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java index 6c4d8708..b050e422 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java @@ -6,6 +6,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.eSignature.examples.PermissionDeleteService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -56,7 +57,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 3: Call the eSignature Rest API to delete profile String curProfileId = args.getProfileId(); - accountsApi.deletePermissionProfile(session.getAccountId(), curProfileId); + PermissionDeleteService.permissionDelete(accountsApi, session.getAccountId(), curProfileId); // Step 4: Show 'done' (successful) page DoneExample.createDefault(title) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java index c6be36de..0a083857 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java @@ -1,25 +1,22 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.common.Languages; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.BrandsResponse; +import com.docusign.services.eSignature.examples.CreateBrandService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import com.docusign.DSConfiguration; -import com.docusign.esign.api.AccountsApi; -import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Brand; -import com.docusign.esign.model.BrandsResponse; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -28,7 +25,7 @@ */ @Controller @RequestMapping("/eg028") -public class EG028ControllerCreateBrand extends AbstractEsignatureController{ +public class EG028ControllerCreateBrand extends AbstractEsignatureController { private static final String MODEL_LIST_LANGUAGE = "listLanguage"; @@ -57,18 +54,18 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 3: Construct your brand JSON body String language = args.getLanguage(); - Brand brand = new Brand() - .brandName(args.getBrandName()) - .defaultBrandLanguage(language) - .brandLanguages(List.of(language)); - // Step 5: Call the eSignature REST API - BrandsResponse brandsResponse = accountsApi.createBrand(session.getAccountId(), brand); + BrandsResponse brandsResponse = CreateBrandService.createBrand( + accountsApi, + args.getBrandName(), + language, + session.getAccountId() + ); DoneExample.createDefault(title) .withJsonObject(brandsResponse) .withMessage("The brand has been created!
Brand ID " - + brandsResponse.getBrands().get(0).getBrandId() + ".") + + brandsResponse.getBrands().get(0).getBrandId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index 6334a03b..a001a74c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -10,6 +10,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.eSignature.examples.ApplyBrandToEnvelopeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -38,10 +39,6 @@ public class EG029ControllerApplyBrandToEnvelope extends AbstractEsignatureController { private static final String MODEL_LIST_BRAND = "listBrands"; - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "EG025 Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; private final Session session; private final User user; @@ -69,10 +66,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeDefinition envelope = ApplyBrandToEnvelopeService.makeEnvelope(args); // Step 5: Call the eSignature REST API - EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = ApplyBrandToEnvelopeService.applyBrandToEnvelope( + envelopesApi, + session.getAccountId(), + envelope + ); DoneExample.createDefault(title) .withJsonObject(envelopeSummary) @@ -81,33 +82,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - // Creates an envelope. The envelope has one recipient who should sign an - // attached document. Attached document is read from a local directory. - // Also the envelope contains a brand Id which is created on EG028 example. - private static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // Reads a file from a local directory and create Document object. - Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - // Create a signer recipient to sign the document and associate sign tab - Tabs tabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); - Signer signer = new Signer() - .email(args.getSignerEmail()) - .name(args.getSignerName()) - .recipientId("1") - .routingOrder("1") - .tabs(tabs); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - // Return envelope definition using created objects: the document, - // the recipients and obtained brand Id. - return new EnvelopeDefinition() - .emailSubject("EG029. Please Sign") - .documents(List.of(document)) - .recipients(recipients) - .brandId(args.getBrandId()) - .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index 239888dc..e426ba29 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -9,6 +9,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.eSignature.examples.ApplyBrandToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -77,10 +78,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeDefinition envelope = ApplyBrandToTemplateService.makeEnvelope(args); // Step 5: Call the eSignature REST API - EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = ApplyBrandToTemplateService.applyBrandToTemplate( + envelopesApi, + session.getAccountId(), + envelope + ); DoneExample.createDefault(title) .withJsonObject(envelopeSummary) @@ -89,22 +94,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition makeEnvelope(WorkArguments args) { - TemplateRole signer = new TemplateRole() - .email(args.getSignerEmail()) - .name(args.getSignerName()) - .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - - TemplateRole cc = new TemplateRole() - .email(args.getCcEmail()) - .name(args.getCcName()) - .roleName(EnvelopeHelpers.CC_ROLE_NAME); - - return new EnvelopeDefinition() - .templateId(args.getTemplateId()) - .templateRoles(Arrays.asList(signer, cc)) - .brandId(args.getBrandId()) - .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index f78c0d67..27510750 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -11,6 +11,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.eSignature.examples.BulkSendEnvelopesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -44,10 +45,6 @@ public class EG031ControllerBulkSendEnvelopes extends AbstractEsignatureController { private static final long BULK_REQUEST_DELAY = 15L; - private static final String BULK_SIGNER_EMAIL_PLACEHOLDER = "MultiBulkRecipients-%s@docusign.com"; - private static final String BULK_SIGNER_NAME_PLACEHOLDER = "Multi Bulk Recipients::%s"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; private final Session session; private final User user; @@ -66,28 +63,16 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 2. Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + BulkEnvelopesApi bulkEnvelopesApi = new BulkEnvelopesApi(apiClient); String accountId = session.getAccountId(); // Step 3. Submit a bulk list - BulkEnvelopesApi bulkEnvelopesApi = new BulkEnvelopesApi(apiClient); - BulkSendingList sendingList = getSendingList(args); - String bulkListId = bulkEnvelopesApi.createBulkSendList(accountId, sendingList).getListId(); - - // Step 4. Create an envelope - EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - String envelopeId = envelopesApi.createEnvelope(accountId, makeEnvelope()).getEnvelopeId(); - - // Step 5. Attach your bulk list ID to the envelope - CustomFields customFields = createCustomFields(bulkListId); - envelopesApi.createCustomFields(accountId, envelopeId, customFields); - - // Step 6. Add placeholder recipients - envelopesApi.createRecipient(accountId, envelopeId, createRecipients()); - - // Step 7. Initiate bulk send - BulkSendRequest request = new BulkSendRequest(); - request.setEnvelopeOrTemplateId(envelopeId); - String batchId = bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); + String batchId = BulkSendEnvelopesService.bulkSendEnvelopes( + bulkEnvelopesApi, + apiClient, + args, + accountId + ); // Step 8. Confirm successful bulk send try { @@ -106,72 +91,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - private static BulkSendingList getSendingList(WorkArguments args) { - List copies = List.of( - createBulkSending(args.getSignerName(), args.getSignerEmail(), args.getCcName(), args.getCcEmail()), - createBulkSending(args.getSignerName2(), args.getSignerEmail2(), args.getCcName2(), args.getCcEmail2()) - ); - return new BulkSendingList() - .name("sample.csv") - .bulkCopies(copies); - } - - private static BulkSendingCopy createBulkSending(String signerName, - String signerEmail, String ccName, String ccEmail) { - BulkSendingCopyRecipient recipient1 = new BulkSendingCopyRecipient() - .name(signerName) - .email(signerEmail) - .tabs(Collections.emptyList()) - .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - BulkSendingCopyRecipient recipient2 = new BulkSendingCopyRecipient() - .name(ccName) - .email(ccEmail) - .tabs(Collections.emptyList()) - .roleName(EnvelopeHelpers.CC_ROLE_NAME); - return new BulkSendingCopy() - .recipients(List.of(recipient1, recipient2)) - .customFields(Collections.emptyList()); - } - private static EnvelopeDefinition makeEnvelope() throws IOException { - Document document = EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "1"); - return new EnvelopeDefinition() - .documents(List.of(document)) - .envelopeIdStamping(DsModelUtils.TRUE) - .emailSubject("EG031 Please sign") - .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); - } - - private static CustomFields createCustomFields(String bulkListId) { - TextCustomField textCustomField = new TextCustomField() - .name("mailingListId") - .required(DsModelUtils.FALSE) - .show(DsModelUtils.FALSE) - .value(bulkListId); - - return new CustomFields() - .listCustomFields(Collections.emptyList()) - .textCustomFields(List.of(textCustomField)); - } - - private static Recipients createRecipients() { - List signers = List.of( - createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, "1"), - createSignerPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, "2")); - return new Recipients() - .signers(signers); - } - - private static Signer createSignerPlaceholder(String roleName, String recipientId) { - return new Signer() - .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) - .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) - .roleName(roleName) - .note("") - .routingOrder("1") - .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) - .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) - .recipientId(recipientId) - .recipientType(EnvelopeHelpers.SIGNER_ROLE_NAME); - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index cad63057..68f13be9 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -4,10 +4,12 @@ import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; -import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.*; +import com.docusign.core.model.User; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.services.eSignature.examples.PauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -15,8 +17,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; /** * This topic demonstrates how to create an envelope where the workflow @@ -26,10 +26,6 @@ @RequestMapping("/eg032") public class EG032ControllerPauseSignatureWorkflow extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "Welcome.txt"; - private static final String DOCUMENT_ID = "1"; - private static final String DOCUMENT_NAME = "Welcome"; - private final Session session; private final User user; @@ -48,74 +44,24 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args); + EnvelopeDefinition envelope = PauseSignatureWorkflowService.createEnvelope(args); // Step 4: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); + EnvelopeSummary results = PauseSignatureWorkflowService.pauseSignatureWorkflow( + envelopesApi, + this.session.getAccountId(), + envelope + ); this.session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(this.title) .withJsonObject(results) .withMessage( "The envelope where the workflow is paused before the envelope is sent to a second recipient " + - "has been created and sent!
Envelope ID " - + this.session.getEnvelopeId() + ".") + "has been created and sent!
Envelope ID " + + this.session.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { - Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); - - WorkflowStep workflowStep = new WorkflowStep(); - workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); - workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); - workflowStep.setItemId("2"); - - Workflow workflow = new Workflow(); - workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); - - SignHere signHere1 = new SignHere(); - signHere1.setName("SignHereTabs"); - signHere1.setXPosition("200"); - signHere1.setYPosition("200"); - signHere1.setTabLabel("Sign Here"); - signHere1.setPageNumber("1"); - signHere1.setDocumentId(document.getDocumentId()); - - Signer signer1 = new Signer(); - signer1.setName(args.getSignerName()); - signer1.setEmail(args.getSignerEmail()); - signer1.setRoutingOrder("1"); - signer1.setRecipientId("1"); - signer1.setTabs(EnvelopeHelpers.createSignerTabs(signHere1)); - - SignHere signHere2 = new SignHere(); - signHere2.setName("SignHereTabs"); - signHere2.setXPosition("300"); - signHere2.setYPosition("200"); - signHere2.setTabLabel("Sign Here"); - signHere2.setPageNumber("1"); - signHere2.setDocumentId(document.getDocumentId()); - - Signer signer2 = new Signer(); - signer2.setName(args.getSignerName2()); - signer2.setEmail(args.getSignerEmail2()); - signer2.setRoutingOrder("2"); - signer2.setRecipientId("2"); - signer2.setTabs(EnvelopeHelpers.createSignerTabs(signHere2)); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer1, signer2)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("EnvelopeWorkflowTest"); - envelope.setDocuments(Collections.singletonList(document)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - envelope.setWorkflow(workflow); - - return envelope; - } } \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index b3b9cfd4..4f6e0d34 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -10,6 +10,7 @@ import com.docusign.esign.model.Envelope; import com.docusign.esign.model.EnvelopeUpdateSummary; import com.docusign.esign.model.Workflow; +import com.docusign.services.eSignature.examples.UnpauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -43,22 +44,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 3: Construct your envelope JSON body - Workflow workflow = new Workflow(); - workflow.setWorkflowStatus(EnvelopeHelpers.WORKFLOW_STATUS_IN_PROGRESS); - - Envelope envelope = new Envelope(); - envelope.setWorkflow(workflow); - - EnvelopesApi.UpdateOptions updateOptions = envelopesApi. new UpdateOptions(); - updateOptions.setResendEnvelope("true"); - - // Step 4: Call the eSignature REST API - EnvelopeUpdateSummary results = envelopesApi.update( + EnvelopeUpdateSummary results = UnpauseSignatureWorkflowService.unpauseSignatureWorkflow( + envelopesApi, this.session.getAccountId(), - this.session.getEnvelopeId(), - envelope, - updateOptions + this.session.getEnvelopeId() ); DoneExample.createDefault(this.title) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index b6b85210..ba3858d2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -7,7 +7,9 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.*; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.services.eSignature.examples.UseConditionalRecipientsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -15,9 +17,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; /** * This topic demonstrates how to create an envelope where the workflow @@ -27,9 +26,6 @@ @RequestMapping("/eg034") public class EG034ControllerUseConditionalRecipients extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "Welcome1.txt"; - private static final String DOCUMENT_ID = "1"; - private static final String DOCUMENT_NAME = "Welcome"; private static final String NOT_ALLOWED_ERROR_MESSAGE = "Update to the workflow with recipient routing is not allowed"; private final Session session; @@ -51,11 +47,16 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args); + EnvelopeDefinition envelope = UseConditionalRecipientsService.createEnvelope(args); // Step 4: Call the eSignature REST API try { - EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); + EnvelopeSummary results = UseConditionalRecipientsService.useConditionalRecipients( + envelopesApi, + this.session.getAccountId(), + envelope + ); + this.session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(this.title) .withJsonObject(results) @@ -78,156 +79,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { - Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); - - WorkflowStep workflowStep = new WorkflowStep(); - workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); - workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); - workflowStep.setItemId("2"); - workflowStep.setStatus("pending"); - workflowStep.setRecipientRouting(createRecipientRouting(args)); - - Workflow workflow = new Workflow(); - workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList( - createApprovalSigner(document.getDocumentId()), - createPurchaserSigner(args, document.getDocumentId()) - )); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("ApproveIfChecked"); - envelope.setDocuments(Collections.singletonList(document)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - envelope.setWorkflow(workflow); - - return envelope; - } - - private static Signer createPurchaserSigner(WorkArguments args, String documentId) { - SignHere signHere = new SignHere(); - signHere.setName("SignHereTabs"); - signHere.setXPosition("200"); - signHere.setYPosition("200"); - signHere.setTabLabel("PurchaserSignature"); - signHere.setPageNumber("1"); - signHere.setDocumentId(documentId); - - Checkbox checkbox = new Checkbox(); - checkbox.setName("ClickToApprove"); - checkbox.setSelected("false"); - checkbox.setXPosition("50"); - checkbox.setYPosition("50"); - checkbox.setTabLabel("ApproveWhenChecked"); - checkbox.setPageNumber("1"); - checkbox.setDocumentId(documentId); - - Tabs tabs = EnvelopeHelpers.createSignerTabs(signHere); - tabs.setCheckboxTabs(Collections.singletonList(checkbox)); - - Signer signer = new Signer(); - signer.setName(args.getSignerName()); - signer.setEmail(args.getSignerEmail()); - signer.setRoutingOrder("1"); - signer.setRecipientId("1"); - signer.setRoleName("Purchaser"); - signer.setTabs(tabs); - - return signer; - } - - private static Signer createApprovalSigner(String documentId) { - SignHere signHere = new SignHere(); - signHere.setName("SignHere"); - signHere.setRecipientId("2"); - signHere.setXPosition("200"); - signHere.setYPosition("300"); - signHere.setTabLabel("ApproverSignature"); - signHere.setPageNumber("1"); - signHere.setDocumentId(documentId); - - Signer signer = new Signer(); - signer.setName("Approver"); - signer.setEmail("placeholder@example.com"); - signer.setRoutingOrder("2"); - signer.setRecipientId("2"); - signer.setRoleName("Approver"); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - return signer; - } - - private static List createConditionalRecipientRuleConditions() { - - ConditionalRecipientRuleFilter filter1 = new ConditionalRecipientRuleFilter(); - filter1.setRecipientId("1"); - filter1.setScope("tabs"); - filter1.setTabId("ApprovalTab"); - filter1.setOperator("equals"); - filter1.setValue("false"); - filter1.setTabType("checkbox"); - filter1.setTabLabel("ApproveWhenChecked"); - - ConditionalRecipientRuleFilter filter2 = new ConditionalRecipientRuleFilter(); - filter2.setRecipientId("1"); - filter2.setScope("tabs"); - filter2.setTabId("ApprovalTab"); - filter2.setOperator("equals"); - filter2.setValue("true"); - filter2.setTabType("checkbox"); - filter2.setTabLabel("ApproveWhenChecked"); - - ConditionalRecipientRuleCondition condition1 = new ConditionalRecipientRuleCondition(); - condition1.setRecipientLabel("signer2a"); - condition1.setOrder("1"); - condition1.setFilters(Collections.singletonList(filter1)); - - ConditionalRecipientRuleCondition condition2 = new ConditionalRecipientRuleCondition(); - condition2.setRecipientLabel("signer2b"); - condition2.setOrder("2"); - condition2.setFilters(Collections.singletonList(filter2)); - return Arrays.asList(condition1, condition2); - } - - private static RecipientGroup createRecipientGroup(WorkArguments args) { - RecipientOption recipientOption1 = new RecipientOption(); - recipientOption1.setRecipientLabel("signer2a"); - recipientOption1.setName(args.getSignerNotCheckedName()); - recipientOption1.setRoleName("Signer when not checked"); - recipientOption1.setEmail(args.getSignerNotCheckedEmail()); - - RecipientOption recipientOption2 = new RecipientOption(); - recipientOption2.setRecipientLabel("signer2b"); - recipientOption2.setName(args.getSignerCheckedName()); - recipientOption2.setRoleName("Signer when checked"); - recipientOption2.setEmail(args.getSignerCheckedEmail()); - - RecipientGroup recipientGroup = new RecipientGroup(); - recipientGroup.setGroupName("Approver"); - recipientGroup.setGroupMessage("Members of this group approve a workflow"); - recipientGroup.setRecipients(Arrays.asList(recipientOption1, recipientOption2)); - return recipientGroup; - } - - private static ConditionalRecipientRule createConditionalRecipientRule(WorkArguments args) { - ConditionalRecipientRule conditionalRecipientRule = new ConditionalRecipientRule(); - conditionalRecipientRule.setRecipientId("2"); - conditionalRecipientRule.setOrder("0"); - conditionalRecipientRule.setRecipientGroup(createRecipientGroup(args)); - conditionalRecipientRule.setConditions(createConditionalRecipientRuleConditions()); - return conditionalRecipientRule; - } - - private static RecipientRouting createRecipientRouting(WorkArguments args) { - RecipientRules recipientRules = new RecipientRules(); - recipientRules.setConditionalRecipients(Collections.singletonList(createConditionalRecipientRule(args))); - - RecipientRouting recipientRouting = new RecipientRouting(); - recipientRouting.setRules(recipientRules); - return recipientRouting; - } - // ***DS.snippet.0.end } \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java index 2c9fe378..9f220e6a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java @@ -16,6 +16,7 @@ import com.docusign.esign.model.RecipientAdditionalNotification; import com.docusign.esign.model.RecipientPhoneNumber; +import com.docusign.services.eSignature.examples.SMSDeliveryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -64,8 +65,12 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = makeEnvelope(args); - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeDefinition envelope = SMSDeliveryService.makeEnvelope(args); + EnvelopeSummary results = SMSDeliveryService.smsDelivery( + envelopesApi, + session.getAccountId(), + envelope + ); // process results session.setEnvelopeId(results.getEnvelopeId()); @@ -76,76 +81,4 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - // document 1 (html) has tag **signature_1** - // document 2 (docx) has tag /sn1/ - // document 3 (pdf) has tag /sn1/ - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. After it is signed, - // a copy is sent to the cc person. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // The DocuSign platform searches throughout your envelope's documents - // for matching anchor strings. So the signHere2 tab will be used in - // both document 2 and 3 since they use the same anchor string for - // their "signer 1" tabs. - Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // Create a signer recipient to sign the document, identified by name - // and email. We're setting the parameters via the object creation. - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signerTabs); - - RecipientAdditionalNotification smsDelivery = new RecipientAdditionalNotification(); - smsDelivery.setSecondaryDeliveryMethod("SMS"); - - RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); - phoneNumber.setCountryCode(args.getCountryCode()); - phoneNumber.setNumber(args.getPhoneNumber()); - smsDelivery.phoneNumber(phoneNumber); - signer.setAdditionalNotifications(Arrays.asList(smsDelivery)); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRecipientId("2"); - cc.setRoutingOrder("2"); - - RecipientAdditionalNotification ccSmsDelivery = new RecipientAdditionalNotification(); - ccSmsDelivery.setSecondaryDeliveryMethod("SMS"); - - RecipientPhoneNumber ccPhoneNumber = new RecipientPhoneNumber(); - ccPhoneNumber.setCountryCode(args.getCcCountryCode()); - ccPhoneNumber.setNumber(args.getCcPhoneNumber()); - ccSmsDelivery.phoneNumber(ccPhoneNumber); - cc.setAdditionalNotifications(Arrays.asList(ccSmsDelivery)); - - // The order in the docs array determines the order in the envelope - byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please sign this document set"); - envelope.setDocuments(Arrays.asList( - EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, - DocumentType.HTML.getDefaultFileExtention(), "1"), - EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), - EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); - envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); - - return envelope; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java index 1e25c3f8..fed25489 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java @@ -49,7 +49,7 @@ private EnvelopeHelpers() {} * @return the new byte array that has been loaded from the file * @throws IOException in case of I/O errors */ - static byte[] readFile(String path) throws IOException { + public static byte[] readFile(String path) throws IOException { ClassPathResource resource = new ClassPathResource(path); return StreamUtils.copyToByteArray(resource.getInputStream()); } @@ -104,7 +104,7 @@ static byte[] createHtmlFromTemplate(Template template, String objectName, Objec * @return array of bytes representing created html document * @throws IOException in case of I/O errors or template parsing error */ - static byte[] createHtmlFromTemplateFile(String path, String objectName, Object value) throws IOException { + public static byte[] createHtmlFromTemplateFile(String path, String objectName, Object value) throws IOException { Template template = loadHtmlTemplate(path); return createHtmlFromTemplate(template, objectName, value); } @@ -133,7 +133,7 @@ public static Document createDocumentFromFile(String fileName, String docName, S * @param documentId identifier of the created document * @return the {@link Document} object */ - static Document createDocument(byte[] data, String documentName, String fileExtention, String documentId) { + public static Document createDocument(byte[] data, String documentName, String fileExtention, String documentId) { Document document = new Document(); document.setDocumentBase64(Base64.getEncoder().encodeToString(data)); document.setName(documentName); @@ -151,7 +151,7 @@ static Document createDocument(byte[] data, String documentName, String fileExte * @param xOffsetPixels the x offset of anchor in pixels * @return the {@link SignHere} object */ - static SignHere createSignHere(String anchorString, int yOffsetPixels, int xOffsetPixels) { + public static SignHere createSignHere(String anchorString, int yOffsetPixels, int xOffsetPixels) { SignHere signHere = new SignHere(); signHere.setAnchorString(anchorString); signHere.setAnchorUnits("pixels"); @@ -179,7 +179,7 @@ public static Tabs createSingleSignerTab(String anchorString, int yOffsetPixels, * @param signs the array of SignHere (see {@link SignHere}) * @return the {@link Tabs} object containing passed SignHere objects */ - static Tabs createSignerTabs(SignHere... signs) { + public static Tabs createSignerTabs(SignHere... signs) { Tabs signerTabs = new Tabs(); signerTabs.setSignHereTabs(Arrays.asList(signs)); return signerTabs; @@ -191,7 +191,7 @@ static Tabs createSignerTabs(SignHere... signs) { * @param cc the cc object * @return the {@link Recipients} object */ - static Recipients createRecipients(Signer signer, CarbonCopy cc) { + public static Recipients createRecipients(Signer signer, CarbonCopy cc) { Recipients recipients = new Recipients(); recipients.setSigners(Arrays.asList(signer)); recipients.setCarbonCopies(Arrays.asList(cc)); diff --git a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java new file mode 100644 index 00000000..484d7756 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java @@ -0,0 +1,61 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; + +public final class AccessCodeAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary accessCodeAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + SignHere signHere = new SignHere(); + signHere.setName("SignHereTab"); + signHere.setXPosition("75"); + signHere.setYPosition("572"); + signHere.setTabLabel("SignHereTab"); + signHere.setPageNumber("1"); + signHere.setDocumentId(doc.getDocumentId()); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. + // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + signHere.setRecipientId("1"); + + Signer signer = new Signer(); + signer.setName(args.getSignerName()); + signer.setEmail(args.getSignerEmail()); + signer.setRoutingOrder("1"); + signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); + signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); + signer.setRecipientId(signHere.getRecipientId()); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + signer.setAccessCode(args.getAccessCode()); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please Sign"); + envelope.setDocuments(Arrays.asList(doc)); + envelope.setEnvelopeIdStamping("true"); + envelope.setEmailBlurb("Sample text for email body"); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java new file mode 100644 index 00000000..e1317214 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java @@ -0,0 +1,129 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; +import com.docusign.core.common.DocumentType; + +import java.io.IOException; +import java.util.Arrays; + +public final class AddDocToTemplateService { + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl"; + private static final String HTML_DOCUMENT_NAME = "Appendix 1--Sales order"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static ViewUrl addDocumentToTemplate( + EnvelopesApi envelopesApi, + WorkArguments args, + String dsReturnUrl, + String dsPingUrl, + String signerId, + String accountId) throws ApiException, IOException { + // Step 2 start + args.setDsReturnUrl(dsReturnUrl); + args.setDsPingUrl(dsPingUrl); + args.setSignerClientId(signerId); + EnvelopeDefinition envelope = AddDocToTemplateService.makeEnvelope(args); + // Step 2 end + + // Step 3 start + EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); + // Step 3 end + + // Step 4 start + RecipientViewRequest viewRequest = AddDocToTemplateService.makeRecipientViewRequest(args); + return envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + viewRequest.setReturnUrl(args.getDsReturnUrl()); + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + viewRequest.setAuthenticationMethod("none"); + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(args.getSignerEmail()); + viewRequest.setUserName(args.getSignerName()); + viewRequest.setClientUserId(args.getSignerClientId()); + + // DocuSign recommends that you redirect to DocuSign for the + // embedded signing. There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + viewRequest.setPingFrequency("600"); + viewRequest.setPingUrl(args.getDsPingUrl()); + + return viewRequest; + } + + // The envelope request object uses Composite Template to include in the envelope: + // 1. A template stored on the DocuSign service + // 2. An additional document which is a custom HTML source document + public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + // Create a signer and cc recipients for the signer role of the server template + CarbonCopy cc1 = new CarbonCopy(); + cc1.setEmail(args.getCcEmail()); + cc1.setName(args.getCcName()); + cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); + cc1.setRecipientId("2"); + + // create a composite template for the Server Template + CompositeTemplate compTemplate1 = new CompositeTemplate(); + compTemplate1.setCompositeTemplateId("1"); + ServerTemplate serverTemplates = new ServerTemplate(); + serverTemplates.setSequence("1"); + serverTemplates.setTemplateId(args.getTemplateId()); + compTemplate1.setServerTemplates(Arrays.asList(serverTemplates)); + + // Add the roles via an inlineTemplate + InlineTemplate inlineTemplate = new InlineTemplate(); + inlineTemplate.setSequence("2"); + inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients(createSigner(args), cc1)); + compTemplate1.setInlineTemplates(Arrays.asList(inlineTemplate)); + + // The signer recipient for the added document with a tab definition: + Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); + Signer signer1AddedDoc = createSigner(args); + signer1AddedDoc.setTabs(signer1Tabs); + + // create the HTML document + byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + + // create a composite template for the added document and add the recipients via an inlineTemplate + CompositeTemplate compTemplate2 = new CompositeTemplate(); + compTemplate2.setCompositeTemplateId("2"); + InlineTemplate inlineTemplate2 = new InlineTemplate(); + inlineTemplate2.setSequence("1"); + inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc1)); + compTemplate2.setInlineTemplates(Arrays.asList(inlineTemplate2)); + compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, + DocumentType.HTML.getDefaultFileExtention(), "1")); + + EnvelopeDefinition env = new EnvelopeDefinition(); + env.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + env.setCompositeTemplates(Arrays.asList(compTemplate1, compTemplate2)); + + return env; + } + + // Adding clientUserId transforms the template recipient into an embedded recipient + private static Signer createSigner(WorkArguments args) { + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + signer.setRecipientId("1"); + signer.setClientUserId(args.getSignerClientId()); + return signer; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java new file mode 100644 index 00000000..8867b617 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java @@ -0,0 +1,55 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +public final class ApplyBrandToEnvelopeService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "EG025 Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static EnvelopeSummary applyBrandToEnvelope( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + // Creates an envelope. The envelope has one recipient who should sign an + // attached document. Attached document is read from a local directory. + // Also the envelope contains a brand Id which is created on EG028 example. + public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + // Reads a file from a local directory and create Document object. + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + // Create a signer recipient to sign the document and associate sign tab + Tabs tabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); + Signer signer = new Signer() + .email(args.getSignerEmail()) + .name(args.getSignerName()) + .recipientId("1") + .routingOrder("1") + .tabs(tabs); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + // Return envelope definition using created objects: the document, + // the recipients and obtained brand Id. + return new EnvelopeDefinition() + .emailSubject("EG029. Please Sign") + .documents(List.of(document)) + .recipients(recipients) + .brandId(args.getBrandId()) + .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java new file mode 100644 index 00000000..6f9facf5 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java @@ -0,0 +1,39 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.TemplateRole; + +import java.util.Arrays; + +public final class ApplyBrandToTemplateService { + public static EnvelopeSummary applyBrandToTemplate( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition makeEnvelope(WorkArguments args) { + TemplateRole signer = new TemplateRole() + .email(args.getSignerEmail()) + .name(args.getSignerName()) + .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + + TemplateRole cc = new TemplateRole() + .email(args.getCcEmail()) + .name(args.getCcName()) + .roleName(EnvelopeHelpers.CC_ROLE_NAME); + + return new EnvelopeDefinition() + .templateId(args.getTemplateId()) + .templateRoles(Arrays.asList(signer, cc)) + .brandId(args.getBrandId()) + .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java new file mode 100644 index 00000000..c4c4c4c6 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java @@ -0,0 +1,117 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.DsModelUtils; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.BulkEnvelopesApi; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +public final class BulkSendEnvelopesService { + private static final String BULK_SIGNER_EMAIL_PLACEHOLDER = "MultiBulkRecipients-%s@docusign.com"; + private static final String BULK_SIGNER_NAME_PLACEHOLDER = "Multi Bulk Recipients::%s"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + + public static String bulkSendEnvelopes( + BulkEnvelopesApi bulkEnvelopesApi, + ApiClient apiClient, + WorkArguments args, + String accountId + ) throws ApiException, IOException { + // Step 3. Submit a bulk list + BulkSendingList sendingList = BulkSendEnvelopesService.getSendingList(args); + String bulkListId = bulkEnvelopesApi.createBulkSendList(accountId, sendingList).getListId(); + + // Step 4. Create an envelope + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + String envelopeId = envelopesApi.createEnvelope(accountId, BulkSendEnvelopesService.makeEnvelope()).getEnvelopeId(); + + // Step 5. Attach your bulk list ID to the envelope + CustomFields customFields = BulkSendEnvelopesService.createCustomFields(bulkListId); + envelopesApi.createCustomFields(accountId, envelopeId, customFields); + + // Step 6. Add placeholder recipients + envelopesApi.createRecipient(accountId, envelopeId, BulkSendEnvelopesService.createRecipients()); + + // Step 7. Initiate bulk send + BulkSendRequest request = new BulkSendRequest(); + request.setEnvelopeOrTemplateId(envelopeId); + return bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); + } + + public static BulkSendingList getSendingList(WorkArguments args) { + List copies = List.of( + createBulkSending(args.getSignerName(), args.getSignerEmail(), args.getCcName(), args.getCcEmail()), + createBulkSending(args.getSignerName2(), args.getSignerEmail2(), args.getCcName2(), args.getCcEmail2()) + ); + return new BulkSendingList() + .name("sample.csv") + .bulkCopies(copies); + } + + private static BulkSendingCopy createBulkSending(String signerName, + String signerEmail, String ccName, String ccEmail) { + BulkSendingCopyRecipient recipient1 = new BulkSendingCopyRecipient() + .name(signerName) + .email(signerEmail) + .tabs(Collections.emptyList()) + .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + BulkSendingCopyRecipient recipient2 = new BulkSendingCopyRecipient() + .name(ccName) + .email(ccEmail) + .tabs(Collections.emptyList()) + .roleName(EnvelopeHelpers.CC_ROLE_NAME); + return new BulkSendingCopy() + .recipients(List.of(recipient1, recipient2)) + .customFields(Collections.emptyList()); + } + + public static EnvelopeDefinition makeEnvelope() throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "1"); + return new EnvelopeDefinition() + .documents(List.of(document)) + .envelopeIdStamping(DsModelUtils.TRUE) + .emailSubject("EG031 Please sign") + .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); + } + + public static CustomFields createCustomFields(String bulkListId) { + TextCustomField textCustomField = new TextCustomField() + .name("mailingListId") + .required(DsModelUtils.FALSE) + .show(DsModelUtils.FALSE) + .value(bulkListId); + + return new CustomFields() + .listCustomFields(Collections.emptyList()) + .textCustomFields(List.of(textCustomField)); + } + + public static Recipients createRecipients() { + List signers = List.of( + createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, "1"), + createSignerPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, "2")); + return new Recipients() + .signers(signers); + } + + private static Signer createSignerPlaceholder(String roleName, String recipientId) { + return new Signer() + .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) + .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) + .roleName(roleName) + .note("") + .routingOrder("1") + .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) + .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) + .recipientId(recipientId) + .recipientType(EnvelopeHelpers.SIGNER_ROLE_NAME); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java new file mode 100644 index 00000000..9df1e6ef --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java @@ -0,0 +1,178 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; +import com.docusign.core.common.DocumentType; +import java.io.IOException; +import java.util.Arrays; + +public final class CollectPaymentService { + private static final String HTML_DOCUMENT_FILE_NAME = "templates/order-form.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order form"; + // Order form constants + private static final String TRUE = "true"; + private static final String FALSE = "false"; + private static final int L1_PRICE = 5; + private static final int L2_PRICE = 150; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + private static final String DEFAULT_FONT = "helvetica"; + private static final String DEFAULT_FONT_SIZE = "size11"; + private static final String ANCHOR_UNITS = "pixels"; + + public static EnvelopeSummary collectPayment( + EnvelopesApi envelopesApi, + EnvelopeDefinition envelope, + String accountId + ) throws ApiException { + // Step 2. call Envelopes::create API method + return envelopesApi.createEnvelope(accountId, envelope); + } + // document 1 (html) has multiple tags: + // /l1q/ and /l2q/ -- quantities: drop down + // /l1e/ and /l2e/ -- extended: payment lines + // /l3t/ -- total -- formula + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. + // After it is signed, a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope( + WorkArguments args, + String gatewayAccountId, + String gatewayName, + String gatewayDisplayName) throws IOException { + byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + + // create a signer recipient to sign the document, identified by name and email + // routingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer() + .email(args.getSignerEmail()) + .name(args.getSignerName()) + .recipientId("1") + .routingOrder("1"); + signer.setTabs(createTabs(gatewayAccountId, gatewayName, gatewayDisplayName)); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy() + .email(args.getCcEmail()) + .name(args.getCcName()) + .routingOrder("2") + .recipientId("2"); + + // Create the envelope definition + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please complete your order"); + envelope.setDocuments(Arrays.asList(EnvelopeHelpers.createDocument(htmlDoc, + HTML_DOCUMENT_NAME, DocumentType.HTML.getDefaultFileExtention(), "1"))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelope; + } + + // creates tabs per signer + public static Tabs createTabs(String gatewayAccountId, String gatewayName, String gatewayDisplayName) { + java.util.List listItems = java.util.List.of( + new ListItem().text("none").value("0"), + new ListItem().text("1").value("1"), + new ListItem().text("2").value("2"), + new ListItem().text("3").value("3"), + new ListItem().text("4").value("4"), + new ListItem().text("5").value("5"), + new ListItem().text("6").value("6"), + new ListItem().text("7").value("7"), + new ListItem().text("8").value("8"), + new ListItem().text("9").value("9"), + new ListItem().text("10").value("10")); + List listl1q = createList("/l1q/", "l1q", listItems); + List listl2q = createList("/l2q/", "l2q", listItems); + + // Create two formula tabs for the extended price on the line items and formula for the total + FormulaTab formulal1e = createFormulaTab("/l1e/", "l1e", L1_PRICE); + FormulaTab formulal2e = createFormulaTab("/l2e/", "l2e", L2_PRICE); + FormulaTab formulal3t = new FormulaTab() + .font(DEFAULT_FONT) + .bold(TRUE) + .fontSize("size12") + .anchorString("/l3t/") + .anchorYOffset("-8") + .anchorUnits(ANCHOR_UNITS) + .anchorXOffset("50") + .tabLabel("l3t") + .formula("[l1e] + [l2e]") + .roundDecimalPlaces("0") + .required(TRUE) + .locked(TRUE) + .disableAutoSize(FALSE); + PaymentLineItem paymentLineIteml1 = new PaymentLineItem() + .name("Harmonica") + .description(String.format("${%d} each", L1_PRICE)) + .amountReference("l1e"); + PaymentLineItem paymentLineIteml2 = new PaymentLineItem() + .name("Xylophone") + .description(String.format("${%d} each", L2_PRICE)) + .amountReference("l2e"); + PaymentDetails paymentDetails = new PaymentDetails() + .gatewayAccountId(gatewayAccountId) + .currencyCode("USD") + .gatewayName(gatewayName) + .gatewayDisplayName(gatewayDisplayName) + .lineItems(Arrays.asList(paymentLineIteml1, paymentLineIteml2)); + // Hidden formula for the payment itself + FormulaTab formulaPayment = new FormulaTab() + .tabLabel("payment") + .formula("([l1e] + [l2e]) * {100}") + .roundDecimalPlaces("0") + .paymentDetails(paymentDetails) + .hidden(TRUE) + .required(TRUE) + .locked(TRUE) + .documentId("1") + .pageNumber("1") + .xPosition("0") + .yPosition("0"); + + Tabs signerTabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); + signerTabs.listTabs(Arrays.asList(listl1q, listl2q)); + signerTabs.formulaTabs(Arrays.asList(formulal1e, formulal2e, formulal3t, formulaPayment)); + return signerTabs; + } + + private static List createList(String anchor, String label, java.util.List items) { + return new List() + .font(DEFAULT_FONT) + .fontSize(DEFAULT_FONT_SIZE) + .anchorString(anchor) + .anchorYOffset("-10") + .anchorUnits(ANCHOR_UNITS) + .anchorXOffset("0") + .listItems(items) + .required(TRUE) + .tabLabel(label); + } + + private static FormulaTab createFormulaTab(String anchor, String label, int price) { + return new FormulaTab() + .font(DEFAULT_FONT) + .fontSize(DEFAULT_FONT_SIZE) + .anchorString(anchor) + .anchorYOffset("-8") + .anchorUnits(ANCHOR_UNITS) + .anchorXOffset("105") + .tabLabel(label) + .formula(String.format("[l1q] * {%d}", price)) + .roundDecimalPlaces("0") + .required(TRUE) + .locked(TRUE) + .disableAutoSize(FALSE); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/CreateBrandService.java b/src/main/java/com/docusign/services/eSignature/examples/CreateBrandService.java new file mode 100644 index 00000000..2397c3f5 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/CreateBrandService.java @@ -0,0 +1,25 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Brand; +import com.docusign.esign.model.BrandsResponse; + +import java.util.List; + +public final class CreateBrandService { + public static BrandsResponse createBrand( + AccountsApi accountsApi, + String brandName, + String language, + String accountId + ) throws ApiException { + Brand brand = new Brand() + .brandName(brandName) + .defaultBrandLanguage(language) + .brandLanguages(List.of(language)); + + // Step 5: Call the eSignature REST API + return accountsApi.createBrand(accountId, brand); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java new file mode 100644 index 00000000..9f1991e7 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java @@ -0,0 +1,171 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.TemplatesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Locale; + +public final class CreateTemplateService { + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_fields.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCUMENT_ID = "1"; + private static final String PAGE_NUMBER = "1"; + private static final String FALSE = "false"; + + public static TemplateSummary createTemplate(ApiClient apiClient, String accountId, EnvelopeTemplate envelopeTemplate) throws ApiException { + TemplatesApi templatesApi = new TemplatesApi(apiClient); + return templatesApi.createTemplate(accountId, envelopeTemplate); + } + + public static EnvelopeTemplateResults searchTemplatesByName(ApiClient apiClient, String accountId, String templateName) throws ApiException { + TemplatesApi templatesApi = new TemplatesApi(apiClient); + TemplatesApi.ListTemplatesOptions options = templatesApi.new ListTemplatesOptions(); + options.setSearchText(templateName); + return templatesApi.listTemplates(accountId, options); + } + + // document 1 (pdf) has tag /sn1/ + // + // The template has two recipient roles. + // recipient 1 - signer + // recipient 2 - cc + // The template will be sent first to the signer. + // After it is signed, a copy is sent to the cc person. + public static EnvelopeTemplate makeTemplate(String templateName) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "1"); + + // Tabs are set per recipient / signer + Tabs signer1Tabs = new Tabs(); + signer1Tabs.setCheckboxTabs(Arrays.asList( + createCheckbox("ckAuthorization", "75", "417"), + createCheckbox("ckAuthentication", "75", "447"), + createCheckbox("ckAgreement", "75", "478"), + createCheckbox("ckAcknowledgement", "75", "508"))); + signer1Tabs.setListTabs(Arrays.asList(createList())); + signer1Tabs.setRadioGroupTabs(Arrays.asList(createRadioGroup())); + signer1Tabs.setSignHereTabs(Arrays.asList(createSignHere())); + signer1Tabs.textTabs(Arrays.asList( + createText("text", "153", "230"), + createText("numbersOnly", "153", "260"))); + + // create a signer recipient to sign the document, identified by name and email + // routingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signer1Tabs); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc1 = new CarbonCopy(); + cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); + cc1.setRoutingOrder("2"); + cc1.setRecipientId("2"); + + // Create the overall template definition. The order in the docs array + // determines the order in the envelope. + EnvelopeTemplate template = new EnvelopeTemplate(); + template.setDocuments(Arrays.asList(doc)); + template.setEmailSubject("Please sign this document"); + template.setName(templateName); + template.setDescription("Example template created via the API"); + template.setShared(FALSE); + template.setRecipients(EnvelopeHelpers.createRecipients(signer, cc1)); + template.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); + + return template; + } + + private static List createList() { + List list = new List(); + list.setDocumentId(DOCUMENT_ID); + list.setPageNumber(PAGE_NUMBER); + list.setXPosition("142"); + list.setYPosition("291"); + list.setFont("helvetica"); + list.setFontSize("size14"); + list.setTabLabel("list"); + list.setRequired(FALSE); + list.setListItems(Arrays.asList( + createListItem("Red"), + createListItem("Orange"), + createListItem("Yellow"), + createListItem("Green"), + createListItem("Blue"), + createListItem("Indigo"), + createListItem("Violet") + )); + return list; + } + + private static ListItem createListItem(String color) { + ListItem item = new ListItem(); + item.setText(color); + item.setValue(color.toLowerCase(Locale.ENGLISH)); + return item; + } + + private static RadioGroup createRadioGroup() { + RadioGroup radioGroup = new RadioGroup(); + radioGroup.setDocumentId(DOCUMENT_ID); + radioGroup.setGroupName("radio1"); + + radioGroup.setRadios(Arrays.asList( + createRadio("white", "142"), + createRadio("red", "74"), + createRadio("blue", "220") + )); + return radioGroup; + } + + private static Radio createRadio(String value, String xPosition) { + Radio radio = new Radio(); + radio.setPageNumber(PAGE_NUMBER); + radio.setValue(value); + radio.setXPosition(xPosition); + radio.setYPosition("384"); + radio.setRequired(FALSE); + return radio; + } + + private static Checkbox createCheckbox(String label, String xPosition, String yPosition) { + Checkbox check = new Checkbox(); + check.setDocumentId(DOCUMENT_ID); + check.setPageNumber(PAGE_NUMBER); + check.setXPosition(xPosition); + check.setYPosition(yPosition); + check.setTabLabel(label); + return check; + } + + private static Text createText(String label, String xPosition, String yPosition) { + Text text = new Text(); + text.setDocumentId(DOCUMENT_ID); + text.setPageNumber(PAGE_NUMBER); + text.setXPosition(xPosition); + text.setYPosition(yPosition); + text.setFont("helvetica"); + text.setFontSize("size14"); + text.setTabLabel(label); + text.setHeight("23"); + text.setWidth("84"); + text.setRequired(FALSE); + return text; + } + + private static SignHere createSignHere() { + SignHere signHere = new SignHere(); + signHere.setDocumentId(DOCUMENT_ID); + signHere.setPageNumber(PAGE_NUMBER); + signHere.setXPosition("191"); + signHere.setYPosition("148"); + return signHere; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedConsoleService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedConsoleService.java new file mode 100644 index 00000000..dd6fd76a --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedConsoleService.java @@ -0,0 +1,28 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.ConsoleViewRequest; +import com.docusign.esign.model.ViewUrl; + +public final class EmbeddedConsoleService { + public static ViewUrl createConsoleView( + EnvelopesApi envelopesApi, + String dsReturnUrl, + String envelopeId, + String startingView, + String accountId) throws ApiException { + // Step 1. Create the Console / Web UI view. + // Set the URL where you want the recipient to go once they are finished in + // the Web UI. There are cases where a user will never click "FINISH" within + // the Web UI, you cannot assume control will be passed back to your application. + ConsoleViewRequest viewRequest = new ConsoleViewRequest(); + viewRequest.setReturnUrl(dsReturnUrl); + if ("envelope".equalsIgnoreCase(startingView) && envelopeId != null) { + viewRequest.setEnvelopeId(envelopeId); + } + + // Step 2. Call the CreateSenderView API + return envelopesApi.createConsoleView(accountId, viewRequest); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java new file mode 100644 index 00000000..b3e1cd14 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java @@ -0,0 +1,28 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.ReturnUrlRequest; +import com.docusign.esign.model.ViewUrl; + +import java.io.IOException; + +public final class EmbeddedSendingService { + public static ViewUrl createSenderView(EnvelopesApi envelopesApi, String accountId, String envelopeId, String dsReturnUrl) throws ApiException { + // Step 2. Create the sender view. + // Set the url where you want the recipient to go once they are done + // signing should typically be a callback route somewhere in your app. + ReturnUrlRequest viewRequest = new ReturnUrlRequest(); + viewRequest.setReturnUrl(dsReturnUrl); + return envelopesApi.createSenderView(accountId, envelopeId, viewRequest); + } + public static EnvelopeSummary createEnvelopeWithDraftStatus(EnvelopesApi envelopesApi, WorkArguments args, String accountId) throws IOException, ApiException { + args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); + EnvelopeDefinition env = SigningViaEmailService.makeEnvelope(args); + return envelopesApi.createEnvelope(accountId, env); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java new file mode 100644 index 00000000..343c2d61 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java @@ -0,0 +1,92 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; + +public final class EmbeddedSigningService { + public static ViewUrl embeddedSigning( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + DSConfiguration config, + String clientUserId) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + // The query parameter is included as an example of how + // to save/recover state information during the redirect to + // the DocuSign signing. It's usually better to use + // the session mechanism of your web framework. Query parameters + // can be changed/spoofed very easily. + viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); + + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + viewRequest.setAuthenticationMethod("none"); + + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(clientUserId); + + // DocuSign recommends that you redirect to DocuSign for the + // embedded signing. There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + viewRequest.setPingFrequency("600"); // seconds + viewRequest.setPingUrl(config.getDsPingUrl()); + + return viewRequest; + } + + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String signerClientId, + Integer anchorOffsetY, + Integer anchorOffsetX, + String documentFileName, + String documentName) throws IOException { + // Create a signer recipient to sign the document, identified by name and email + // We set the clientUserId to enable embedded signing for the recipient + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.clientUserId(signerClientId); + signer.recipientId("1"); + signer.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", anchorOffsetY, anchorOffsetX)); + + // Add the recipient to the envelope object + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document"); + envelopeDefinition.setRecipients(recipients); + Document doc = EnvelopeHelpers.createDocumentFromFile(documentFileName, documentName, "3"); + envelopeDefinition.setDocuments(Arrays.asList(doc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java new file mode 100644 index 00000000..4443859c --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java @@ -0,0 +1,14 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.CustomFieldsEnvelope; + +public final class EnvelopeCustomFieldValuesService { + public static CustomFieldsEnvelope envelopeCustomFieldValues( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId) throws ApiException { + return envelopesApi.listCustomFields(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java new file mode 100644 index 00000000..23213916 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java @@ -0,0 +1,17 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDocument; +import com.docusign.esign.model.EnvelopeDocumentsResult; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public final class EnvelopeDocsService { + public static EnvelopeDocumentsResult envelopeDocs(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + // Step 1. List the envelope's documents + return envelopesApi.listDocuments(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java new file mode 100644 index 00000000..29230097 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java @@ -0,0 +1,25 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.ExampleException; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import java.util.List; + +public final class EnvelopeGetDocService { + + public static byte[] envelopeGetDoc( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + String documentId) throws ApiException { + return envelopesApi.getDocument(accountId, envelopeId, documentId); + } + public static String addExtension(String fileName, String extension) { + if (FilenameUtils.isExtension(fileName, extension)) { + return fileName; + } + return String.join(".", fileName, extension); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java new file mode 100644 index 00000000..88a78c12 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java @@ -0,0 +1,11 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Envelope; + +public final class EnvelopeInfoService { + public static Envelope envelopeInfo(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + return envelopesApi.getEnvelope(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java new file mode 100644 index 00000000..cc1589cb --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java @@ -0,0 +1,11 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Recipients; + +public final class EnvelopeRecipientsService { + public static Recipients envelopeRecipients(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + return envelopesApi.listRecipients(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java new file mode 100644 index 00000000..1dd29162 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java @@ -0,0 +1,11 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeFormData; + +public final class GetTabValuesService { + public static EnvelopeFormData getTabValues(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + return envelopesApi.getFormData(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java new file mode 100644 index 00000000..206f7948 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java @@ -0,0 +1,91 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Base64; +import java.util.Collections; +import java.util.List; + +public final class IdvAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary idvAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static String retrieveWorkflowId(ApiClient apiClient, String accountId) throws ApiException { + AccountsApi workflowDetails = new AccountsApi(apiClient); + AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(accountId); + List identityVerification = workflowRes.getIdentityVerification(); + if (identityVerification == null || identityVerification.isEmpty()) { + throw new ApiException("Error. Cant get AccountIdentityVerificationWorkflow"); + } + return identityVerification.get(0).getWorkflowId(); + } + + public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, + String workflowId) { + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign"); + envelopeDefinition.setEmailBlurb("Sample text for email body"); + envelopeDefinition.setStatus("Sent"); + + + byte[] fileBytes = new byte[0]; + try { + fileBytes = EnvelopeHelpers.readFile(DOCUMENT_FILE_NAME); + } catch (IOException e) { + e.printStackTrace(); + } + Document doc1 = new Document(); + doc1.setDocumentBase64(Base64.getEncoder().encodeToString(fileBytes)); + doc1.setDocumentId("1"); + doc1.setFileExtension("pdf"); + doc1.setName("Lorem"); + + SignHere signHere1 = new SignHere(); + signHere1.setName("SignHereTab"); + signHere1.setXPosition("75"); + signHere1.setYPosition("572"); + signHere1.setTabLabel("SignHereTab"); + signHere1.setPageNumber("1"); + signHere1.setDocumentId("1"); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. + // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + signHere1.setRecipientId("1"); //represents your {RECIPIENT_ID} + + Tabs signer1Tabs = new Tabs(); + signer1Tabs.setSignHereTabs(Collections.singletonList(signHere1)); + RecipientIdentityVerification workflow = new RecipientIdentityVerification(); + workflow.setWorkflowId(workflowId); + + Signer signer1 = new Signer(); + signer1.setName(signerName); + signer1.setEmail(signerEmail); + signer1.setRoleName(""); + signer1.setNote(""); + signer1.setStatus("created"); + signer1.setDeliveryMethod("email"); + signer1.setRecipientId("1"); //represents your {RECIPIENT_ID} + signer1.setIdentityVerification(workflow); + signer1.setTabs(signer1Tabs); + + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer1)); + + envelopeDefinition.setRecipients(recipients); + envelopeDefinition.setDocuments(Collections.singletonList(doc1)); + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java new file mode 100644 index 00000000..99698783 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java @@ -0,0 +1,61 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; + +public final class KBAAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary kbaAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + SignHere signHere = new SignHere(); + signHere.setName("SignHereTab"); + signHere.setXPosition("75"); + signHere.setYPosition("572"); + signHere.setTabLabel("SignHereTab"); + signHere.setPageNumber("1"); + signHere.setDocumentId(doc.getDocumentId()); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. + // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + signHere.setRecipientId("1"); + + Signer signer = new Signer(); + signer.setName(signerName); + signer.setEmail(signerEmail); + signer.setRoutingOrder("1"); + signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); + signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); + signer.setRecipientId(signHere.getRecipientId()); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + signer.setIdCheckConfigurationName("ID Check"); + signer.setRequireIdLookup("true"); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please Sign"); + envelope.setEnvelopeIdStamping("true"); + envelope.setEmailBlurb("Sample text for email body"); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setDocuments(Arrays.asList(doc)); + envelope.setRecipients(recipients); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/ListEnvelopesServices.java b/src/main/java/com/docusign/services/eSignature/examples/ListEnvelopesServices.java new file mode 100644 index 00000000..dbb21d03 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/ListEnvelopesServices.java @@ -0,0 +1,20 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopesInformation; +import java.time.format.DateTimeFormatter; + +import java.time.LocalDate; + +public final class ListEnvelopesServices { + private static final int FROM_DATE_OFFSET_DAYS = 30; + private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd"); + + public static EnvelopesInformation listEnvelopes(EnvelopesApi envelopesApi, String accountId) throws ApiException { + EnvelopesApi.ListStatusChangesOptions options = envelopesApi.new ListStatusChangesOptions(); + LocalDate date = LocalDate.now().minusDays(FROM_DATE_OFFSET_DAYS); + options.setFromDate(DATE_FORMATTER.format(date)); + return envelopesApi.listStatusChanges(accountId, options); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java b/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java new file mode 100644 index 00000000..097be61d --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java @@ -0,0 +1,79 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public final class PauseSignatureWorkflowService { + private static final String DOCUMENT_FILE_NAME = "Welcome.txt"; + private static final String DOCUMENT_ID = "1"; + private static final String DOCUMENT_NAME = "Welcome"; + + public static EnvelopeSummary pauseSignatureWorkflow( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); + workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); + workflowStep.setItemId("2"); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); + + SignHere signHere1 = new SignHere(); + signHere1.setName("SignHereTabs"); + signHere1.setXPosition("200"); + signHere1.setYPosition("200"); + signHere1.setTabLabel("Sign Here"); + signHere1.setPageNumber("1"); + signHere1.setDocumentId(document.getDocumentId()); + + Signer signer1 = new Signer(); + signer1.setName(args.getSignerName()); + signer1.setEmail(args.getSignerEmail()); + signer1.setRoutingOrder("1"); + signer1.setRecipientId("1"); + signer1.setTabs(EnvelopeHelpers.createSignerTabs(signHere1)); + + SignHere signHere2 = new SignHere(); + signHere2.setName("SignHereTabs"); + signHere2.setXPosition("300"); + signHere2.setYPosition("200"); + signHere2.setTabLabel("Sign Here"); + signHere2.setPageNumber("1"); + signHere2.setDocumentId(document.getDocumentId()); + + Signer signer2 = new Signer(); + signer2.setName(args.getSignerName2()); + signer2.setEmail(args.getSignerEmail2()); + signer2.setRoutingOrder("2"); + signer2.setRecipientId("2"); + signer2.setTabs(EnvelopeHelpers.createSignerTabs(signHere2)); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer1, signer2)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("EnvelopeWorkflowTest"); + envelope.setDocuments(Collections.singletonList(document)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + envelope.setWorkflow(workflow); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java new file mode 100644 index 00000000..ad7a34ef --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java @@ -0,0 +1,63 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.DsModelUtils; +import com.docusign.core.model.AccountRoleSettingsPatch; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.AccountRoleSettings; +import com.docusign.esign.model.PermissionProfile; +import com.docusign.esign.model.PermissionProfileInformation; +import com.google.gson.Gson; + +import java.util.*; + +public final class PermissionChangeSingleSettingService { + public static PermissionProfile permissionChangeSingleSetting( + AccountsApi accountsApi, + String accountId, + String curProfileId + ) throws ApiException { + // Step 3. Construct your request body + PermissionProfileInformation permissionsInfo = accountsApi.listPermissions(accountId); + PermissionProfile profile = PermissionChangeSingleSettingService.findProfile( + permissionsInfo.getPermissionProfiles(), curProfileId) + .orElseThrow(NoSuchElementException::new); + + // Step 4. Call the eSignature REST API + AccountRoleSettings newSettings = Objects.requireNonNullElse(profile.getSettings(), + DsModelUtils.createDefaultRoleSettings()); + profile.setSettings(PermissionChangeSingleSettingService.changeRandomSettings(newSettings)); + return accountsApi.updatePermissionProfile(accountId, curProfileId, profile); + } + + public static Optional findProfile(List profiles, String profileId) { + + return profiles.stream().filter(p -> p.getPermissionProfileId().equals(profileId)).findFirst(); + } + + // Changes random boolean properties; in a real application, changing properties + // will be read from the page or in a different way + public static AccountRoleSettings changeRandomSettings(AccountRoleSettings settings) { + Gson gson = new Gson(); + // Change this value back to: gson.fromJson(gson.toJson(settings), + // AccountRoleSettings.class); + // as soon as the signinguiversion is added back to the swagger spec. + // Also change the type back from AccountRoleSettingsPatch to AccountRoleSettings + AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); + newSettings.signingUiVersion("1"); + Random random = new Random(System.currentTimeMillis()); + + return newSettings.canCreateWorkspaces(randomBool(random)).allowEnvelopeSending(randomBool(random)) + .allowSignerAttachments(randomBool(random)).allowESealRecipients(randomBool(random)) + .allowTaggingInSendAndCorrect(randomBool(random)).allowWetSigningOverride(randomBool(random)) + .enableApiRequestLogging(randomBool(random)).enableRecipientViewingNotifications(randomBool(random)) + .allowSupplementalDocuments(randomBool(random)).disableDocumentUpload(randomBool(random)); + } + + private static String randomBool(Random random) { + if (random.nextBoolean()) { + return DsModelUtils.TRUE; + } + return DsModelUtils.FALSE; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java new file mode 100644 index 00000000..9453cdb7 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java @@ -0,0 +1,26 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.DsModelUtils; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.core.model.AccountRoleSettingsPatch; +import com.docusign.esign.model.AccountRoleSettings; +import com.docusign.esign.model.PermissionProfile; +import com.google.gson.Gson; + +public class PermissionCreateService { + public static PermissionProfile createNewProfile(AccountsApi accountsApi, String accountid, String permissionProfileName) throws ApiException { + // Step 3. Construct your request body + // We're extending the AccountSettings class with AccountSettingsPatch to include the signingUIVersion which is missing in the swagger spec at this time. + Gson gson = new Gson(); + AccountRoleSettings settings = DsModelUtils.createDefaultRoleSettings(); + AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); + newSettings.signingUiVersion("1"); + PermissionProfile profile = new PermissionProfile() + .permissionProfileName(permissionProfileName) + .settings(newSettings); + + // Step 4. Call the eSignature REST API + return accountsApi.createPermissionProfile(accountid, profile); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java new file mode 100644 index 00000000..419ef4e9 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java @@ -0,0 +1,14 @@ +package com.docusign.services.eSignature.examples; + + +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; + +public final class PermissionDeleteService { + public static void permissionDelete( + AccountsApi accountsApi, + String accountId, + String curProfileId) throws ApiException { + accountsApi.deletePermissionProfile(accountId, curProfileId); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionSetUserGroupsService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionSetUserGroupsService.java new file mode 100644 index 00000000..da20d80c --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionSetUserGroupsService.java @@ -0,0 +1,28 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.esign.api.GroupsApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Group; +import com.docusign.esign.model.GroupInformation; + +import java.util.List; + +public final class PermissionSetUserGroupsService { + public static GroupInformation permissionSetUserGroups( + ApiClient apiClient, + String groupId, + String profileId, + String accountId + ) throws ApiException { + GroupsApi groupsApi = new GroupsApi(apiClient); + + // Step 3: Perform request + Group newGroup = new Group() + .groupId(groupId) + .permissionProfileId(profileId); + GroupInformation groupInformation = new GroupInformation() + .groups(List.of(newGroup)); + return groupsApi.updateGroups(accountId, groupInformation); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java new file mode 100644 index 00000000..882da322 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java @@ -0,0 +1,67 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +public final class PhoneAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary phoneAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + SignHere signHere = new SignHere(); + signHere.setName("SignHereTab"); + signHere.setXPosition("75"); + signHere.setYPosition("572"); + signHere.setTabLabel("SignHereTab"); + signHere.setPageNumber("1"); + signHere.setDocumentId(doc.getDocumentId()); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. + // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + signHere.setRecipientId("1"); + List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); + RecipientPhoneAuthentication phoneAuth = new RecipientPhoneAuthentication(); + phoneAuth.setRecipMayProvideNumber("true"); + phoneAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); + + Signer signer = new Signer(); + signer.setName(signerName); + signer.setEmail(signerEmail); + signer.setRoutingOrder("1"); + signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); + signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); + signer.setRecipientId(signHere.getRecipientId()); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + signer.setRequireIdLookup("true"); + signer.setPhoneAuthentication(phoneAuth); + signer.setIdCheckConfigurationName("Phone Auth $"); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please Sign"); + envelope.setEnvelopeIdStamping("true"); + envelope.setEmailBlurb("Sample text for email body"); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + envelope.setDocuments(Arrays.asList(doc)); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java b/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java new file mode 100644 index 00000000..6aca229c --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java @@ -0,0 +1,102 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; +import com.docusign.core.common.DocumentType; + +import java.io.IOException; +import java.util.Arrays; + +public final class SMSDeliveryService { + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static EnvelopeSummary smsDelivery( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + // document 1 (html) has tag **signature_1** + // document 2 (docx) has tag /sn1/ + // document 3 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. After it is signed, + // a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. So the signHere2 tab will be used in + // both document 2 and 3 since they use the same anchor string for + // their "signer 1" tabs. + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + RecipientAdditionalNotification smsDelivery = new RecipientAdditionalNotification(); + smsDelivery.setSecondaryDeliveryMethod("SMS"); + + RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); + phoneNumber.setCountryCode(args.getCountryCode()); + phoneNumber.setNumber(args.getPhoneNumber()); + smsDelivery.phoneNumber(phoneNumber); + signer.setAdditionalNotifications(Arrays.asList(smsDelivery)); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy(); + cc.setEmail(args.getCcEmail()); + cc.setName(args.getCcName()); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + + RecipientAdditionalNotification ccSmsDelivery = new RecipientAdditionalNotification(); + ccSmsDelivery.setSecondaryDeliveryMethod("SMS"); + + RecipientPhoneNumber ccPhoneNumber = new RecipientPhoneNumber(); + ccPhoneNumber.setCountryCode(args.getCcCountryCode()); + ccPhoneNumber.setNumber(args.getCcPhoneNumber()); + ccSmsDelivery.phoneNumber(ccPhoneNumber); + cc.setAdditionalNotifications(Arrays.asList(ccSmsDelivery)); + + // The order in the docs array determines the order in the envelope + byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, + DocumentType.HTML.getDefaultFileExtention(), "1"), + EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(args.getStatus()); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java new file mode 100644 index 00000000..34e694a5 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java @@ -0,0 +1,171 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.controller.eSignature.examples.ExampleException; +import com.docusign.core.model.DoneExample; +import com.docusign.esign.model.CarbonCopy; +import com.docusign.esign.model.Signer; +import com.docusign.esign.model.Tabs; +import com.docusign.core.common.DocumentType; +import lombok.Value; +import org.json.JSONArray; +import org.json.JSONObject; +import org.springframework.http.HttpHeaders; +import org.springframework.util.StreamUtils; + +import javax.net.ssl.HttpsURLConnection; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.core.MediaType; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.List; + +public final class SendBinaryDocsService { + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + private static final String HYPHENS = "--"; + private static final String LINE_DELIMITER = "\r\n"; + private static final String BOUNDARY_DELIMITER = "multipartboundary_multipartboundary"; + + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + + public static String sendBinaryDocs(WorkArguments args, String basePath, String accountId, String accessToken) throws IOException { + // Step 1. Gather documents and their headers + List documents = List.of( + new SendBinaryDocsService.DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, + EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)), + new SendBinaryDocsService.DocumentInfo(DOCX_DOCUMENT_NAME, "2", DocumentType.DOCX, + EnvelopeHelpers.readFile(DOCX_DOCUMENT_FILE_NAME)), + new SendBinaryDocsService.DocumentInfo(PDF_DOCUMENT_NAME, "3", DocumentType.PDF, + EnvelopeHelpers.readFile(PDF_DOCUMENT_FILE_NAME)) + ); + + // Step 2. Make the envelope JSON request body + JSONObject envelopeJSON = SendBinaryDocsService.makeEnvelopeJSON(args, documents); + + // Step 3. Create the multipart body + URL uri = new URL(String.format("%s/v2.1/accounts/%s/envelopes", basePath, accountId)); + String contentType = String.join("", MediaType.MULTIPART_FORM_DATA, "; boundary=", BOUNDARY_DELIMITER); + HttpsURLConnection connection = (HttpsURLConnection) uri.openConnection(); + connection.setRequestMethod(HttpMethod.POST); + connection.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + connection.setRequestProperty(HttpHeaders.CONTENT_TYPE, contentType); + connection.setRequestProperty(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); + connection.setDoOutput(true); + + // See https://developers.docusign.com/esign-rest-api/guides/requests-and-responses + DataOutputStream buffer = new DataOutputStream(connection.getOutputStream()); + SendBinaryDocsService.writeBoundaryHeader(buffer, MediaType.APPLICATION_JSON, "form-data"); + buffer.writeBytes(envelopeJSON.toString(DoneExample.JSON_INDENT_FACTOR)); + + for (SendBinaryDocsService.DocumentInfo docInfo : documents) { + String content = String.format("file; filename=\"%s\";documentid=%s", docInfo.getName(), docInfo.getId()); + buffer.writeBytes(LINE_DELIMITER); + SendBinaryDocsService.writeBoundaryHeader(buffer, docInfo.getDocType().getMime(), content); + buffer.write(docInfo.getData()); + } + + SendBinaryDocsService.writeClosingBoundary(buffer); + + int responseCode = connection.getResponseCode(); + if (responseCode < HttpURLConnection.HTTP_OK || responseCode >= HttpURLConnection.HTTP_MULT_CHOICE) { + String error = StreamUtils.copyToString(connection.getErrorStream(), StandardCharsets.UTF_8); + throw new ExampleException(error, null); + } + + return StreamUtils.copyToString(connection.getInputStream(), StandardCharsets.UTF_8); + } + public static void writeBoundaryHeader(DataOutputStream buffer, + String contentType, String contentDisposition) throws IOException { + buffer.writeBytes(HYPHENS); + buffer.writeBytes(BOUNDARY_DELIMITER); + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_TYPE, contentType)); + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_DISPOSITION, contentDisposition)); + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(LINE_DELIMITER); + } + + public static void writeClosingBoundary(DataOutputStream buffer) throws IOException { + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(HYPHENS); + buffer.writeBytes(BOUNDARY_DELIMITER); + buffer.writeBytes(HYPHENS); + buffer.writeBytes(LINE_DELIMITER); + buffer.flush(); + } + + // document 1 (html) has tag **signature_1** + // document 2 (docx) has tag /sn1/ + // document 3 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. + // After it is signed, a copy is sent to the cc person. + public static JSONObject makeEnvelopeJSON(WorkArguments args, List documents) { + // The DocuSign platform searches throughout your envelope's documents for + // matching anchor strings. So the signHere2 tab will be used in both document + // 2 and 3 since they use the same anchor string for their "signer 1" tabs. + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // create a signer recipient to sign the document, identified by name and email + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy(); + cc.setEmail(args.getCcEmail()); + cc.setName(args.getCcName()); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + + // The order in the documents array determines the order in the envelope + JSONArray jsonDocuments = new JSONArray(); + for (DocumentInfo docInfo : documents) { + JSONObject jsonDoc = new JSONObject(); + jsonDoc.put("name", docInfo.getName()); + jsonDoc.put("fileExtension", docInfo.getDocType().getDefaultFileExtention()); + jsonDoc.put("documentId", docInfo.getId()); + jsonDocuments.put(jsonDoc); + } + + // Create the envelope definition. Request that the envelope be sent by + // setting |status| to "sent". To request that the envelope be created + // as a draft, set to "created" + JSONObject envelopeJSON = new JSONObject(); + envelopeJSON.put("emailSubject", "Please sign this document set"); + envelopeJSON.put("documents", jsonDocuments); + envelopeJSON.put("recipients", new JSONObject(EnvelopeHelpers.createRecipients(signer, cc))); + envelopeJSON.put("status", EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeJSON; + } + @Value + public static class DocumentInfo { + private String name; + private String id; + private DocumentType docType; + private byte[] data; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java new file mode 100644 index 00000000..f83f926f --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java @@ -0,0 +1,149 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; + +public final class SetTabValuesService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_salary.docx"; + private static final String DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 20; + private static final int ANCHOR_OFFSET_X = 10; + private static final String SIGNER_CLIENT_ID = "1000"; + + public static ViewUrl createRecipientView(EnvelopesApi envelopesApi, String accountId, String envelopeId, RecipientViewRequest viewRequest) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + String dsReturnUrl, + String dsPingUrl) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + // The query parameter is included as an example of how + // to save/recover state information during the redirect to + // the DocuSign signing. It's usually better to use + // the session mechanism of your web framework. Query parameters + // can be changed/spoofed very easily. + viewRequest.setReturnUrl(dsReturnUrl + "?state=123"); + + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + viewRequest.setAuthenticationMethod("none"); + + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(SIGNER_CLIENT_ID); + + // DocuSign recommends that you redirect to DocuSign for the + // Embedded signing . There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + viewRequest.setPingFrequency("600"); // seconds + viewRequest.setPingUrl(dsPingUrl); + + return viewRequest; + } + + // Step 4. Construct your request body + public static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName) throws IOException { + // Create a signer recipient to sign the document, identified by name and email + // We set the clientUserId to enable embedded signing for the recipient + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.clientUserId(SIGNER_CLIENT_ID); + signer.recipientId("1"); + + // Step 3. Create tabs and CustomFields + SignHere signHere = new SignHere(); + signHere.setAnchorString("/sn1"); + signHere.setAnchorUnits("pixels"); + signHere.setAnchorYOffset("10"); + signHere.setAnchorXOffset("20"); + + Text textLegal = new Text(); + textLegal.setAnchorString("/legal/"); + textLegal.setAnchorUnits("pixels"); + textLegal.setAnchorYOffset("-9"); + textLegal.setAnchorXOffset("5"); + textLegal.setFont("helvetica"); + textLegal.setFontSize("size11"); + textLegal.setBold("true"); + textLegal.setValue(signerName); + textLegal.setLocked("false"); + textLegal.setTabId("legal_name"); + textLegal.setTabLabel("Legal Name"); + + Text textFamiliar = new Text(); + textFamiliar.setAnchorString("/familar/"); + textFamiliar.setAnchorUnits("pixels"); + textFamiliar.setAnchorYOffset("-9"); + textFamiliar.setAnchorXOffset("5"); + textFamiliar.setFont("helvetica"); + textFamiliar.setFontSize("size11"); + textFamiliar.setBold("true"); + textFamiliar.setValue(signerName); + textFamiliar.setLocked("false"); + textFamiliar.setTabId("familiar_name"); + textFamiliar.setTabLabel("Familiar Name"); + + Integer salary = 123000; + + Text textSalary = new Text(); + textSalary.setAnchorString("/salary/"); + textSalary.setAnchorUnits("pixels"); + textSalary.setAnchorYOffset("-9"); + textSalary.setAnchorXOffset("5"); + textSalary.setFont("helvetica"); + textSalary.setFontSize("size11"); + textSalary.setBold("true"); + textSalary.setValue(String.format("$ %d", salary)); + textSalary.setLocked("true"); + textSalary.setTabId("salary"); + textSalary.setTabLabel("salary"); + + TextCustomField salaryCustomField = new TextCustomField(); + salaryCustomField.setName("salary"); + salaryCustomField.setRequired("false"); + salaryCustomField.setShow("true"); // Yes, included in the CoC + salaryCustomField.setValue(String.valueOf(salary)); + + CustomFields cf = new CustomFields(); + cf.setTextCustomFields(Arrays.asList(salaryCustomField)); + + Tabs tabs = new Tabs(); + tabs.setSignHereTabs(Arrays.asList(signHere)); + tabs.setTextTabs(Arrays.asList(textLegal, textFamiliar, textSalary)); + + signer.setTabs(tabs); + + // Add the recipient to the envelope object + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); + envelopeDefinition.setRecipients(recipients); + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "3"); + envelopeDefinition.setDocuments(Arrays.asList(doc)); + envelopeDefinition.setCustomFields(cf); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java new file mode 100644 index 00000000..1075da20 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java @@ -0,0 +1,170 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.util.Arrays; + +public final class SetTemplateTabValuesService { + public static ViewUrl setTemplateTabValues( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + String dsReturnUrl, + String clientUserId, + String dsPingUrl) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + // The query parameter is included as an example of how + // to save/recover state information during the redirect to + // the DocuSign signing. It's usually better to use + // the session mechanism of your web framework. Query parameters + // can be changed/spoofed very easily. + viewRequest.setReturnUrl(dsReturnUrl + "?state=123"); + + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + viewRequest.setAuthenticationMethod("none"); + + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(clientUserId); + + // DocuSign recommends that you redirect to DocuSign for the + // embedded signing. There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + viewRequest.setPingFrequency("600"); // seconds + viewRequest.setPingUrl(dsPingUrl); + + return viewRequest; + } + + + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String templateId, + String clientUserId){ + // Create a signer recipient to sign the document, identified by name and email + // We set the clientUserId to enable embedded signing for the recipient + + // Step 3. Create tabs and CustomFields + List list1 = new List(); + list1.setValue("green"); + list1.setDocumentId("1"); + list1.setPageNumber("1"); + list1.setTabLabel("list"); + + // Checkboxes + Checkbox ck1 = new Checkbox(); + ck1.setTabLabel("ckAuthorization"); + ck1.setSelected("true"); + + Checkbox ck2 = new Checkbox(); + ck2.setTabLabel("ckAgreement"); + ck2.setSelected("true"); + + Radio radio = new Radio(); + radio.setValue("white"); + radio.setSelected("true"); + + RadioGroup rg = new RadioGroup(); + rg.setGroupName("radio1"); + rg.setRadios(Arrays.asList(radio)); + + + Text txt = new Text(); + txt.setTabLabel("text"); + txt.setValue("Jabberywocky!"); + + // We can also add a new tab (field) to the ones already in the template: + + Text txtExtra = new Text(); + txtExtra.setDocumentId("1"); + txtExtra.setPageNumber("1"); + txtExtra.setXPosition("280"); + txtExtra.setYPosition("172"); + txtExtra.setFont("helvetica"); + txtExtra.setFontSize("size14"); + txtExtra.setTabLabel("added text field"); + txtExtra.setHeight("23"); + txtExtra.setWidth("84"); + txtExtra.setRequired("false"); + txtExtra.setBold("true"); + txtExtra.setValue(signerName); + txtExtra.setLocked("false"); + txtExtra.setTabId("name"); + + + // Add the tabs model (including the SignHere tab) to the signer. + // The Tabs object wants arrays of the different field/tab types + // Tabs are set per recipient / signer + + Tabs tabs = new Tabs(); + + tabs.setTextTabs(Arrays.asList(txt, txtExtra)); + tabs.setRadioGroupTabs(Arrays.asList(rg)); + tabs.setCheckboxTabs(Arrays.asList(ck1, ck2)); + tabs.setListTabs(Arrays.asList(list1)); + + + // create a signer recipient to sign the document, identified by name and email + // We're setting the parameters via the object creation + TemplateRole signer = new TemplateRole(); + signer.setEmail(signerEmail); + signer.setName(signerName); + // Setting the client_user_id marks the signer as embedded + signer.setClientUserId(clientUserId); + signer.setRoleName("signer"); + signer.setTabs(tabs); + + TemplateRole cc = new TemplateRole(); + cc.setEmail(ccEmail); + cc.setName(ccName); + cc.setRoleName("cc"); + + // Create an envelope custom field to save our application"s + // Data about the envelope + TextCustomField customField = new TextCustomField(); + customField.setName("app metadata item"); + customField.setValue("1234567"); + customField.setRequired("false"); + customField.show("true"); //Yes, include in the CoC + + + CustomFields cf = new CustomFields(); + cf.setTextCustomFields(Arrays.asList(customField)); + + + // Next, create the top level envelope definition and populate it. + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); + // The Recipients object wants arrays for each recipient type + envelopeDefinition.setTemplateId(templateId); + envelopeDefinition.setTemplateRoles(Arrays.asList(signer, cc)); + envelopeDefinition.setCustomFields(cf); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java b/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java new file mode 100644 index 00000000..440e74e3 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java @@ -0,0 +1,84 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; + +public final class SigningViaEmailService { + + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static EnvelopeSummary signingViaEmail( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope) throws ApiException, IOException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + // document 1 (html) has tag **signature_1** + // document 2 (docx) has tag /sn1/ + // document 3 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. After it is signed, + // a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. So the signHere2 tab will be used in + // both document 2 and 3 since they use the same anchor string for + // their "signer 1" tabs. + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy(); + cc.setEmail(args.getCcEmail()); + cc.setName(args.getCcName()); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + + // The order in the docs array determines the order in the envelope + byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, + DocumentType.HTML.getDefaultFileExtention(), "1"), + EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(args.getStatus()); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java new file mode 100644 index 00000000..a2f90b37 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java @@ -0,0 +1,66 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +public final class SmsAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary smsAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + SignHere signHere = new SignHere(); + signHere.setName("SignHereTab"); + signHere.setXPosition("75"); + signHere.setYPosition("572"); + signHere.setTabLabel("SignHereTab"); + signHere.setPageNumber("1"); + signHere.setDocumentId(doc.getDocumentId()); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. + // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + signHere.setRecipientId("1"); + List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); + RecipientSMSAuthentication smsAuth = new RecipientSMSAuthentication(); + smsAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); + + Signer signer = new Signer(); + signer.setName(signerName); + signer.setEmail(signerEmail); + signer.setRoutingOrder("1"); + signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); + signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); + signer.setRecipientId(signHere.getRecipientId()); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + signer.setRequireIdLookup("true"); + signer.setSmsAuthentication(smsAuth); + signer.setIdCheckConfigurationName("SMS Auth $"); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please Sign"); + envelope.setDocuments(Arrays.asList(doc)); + envelope.setEnvelopeIdStamping("true"); + envelope.setEmailBlurb("Sample text for email body"); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/UnpauseSignatureWorkflowService.java b/src/main/java/com/docusign/services/eSignature/examples/UnpauseSignatureWorkflowService.java new file mode 100644 index 00000000..39328e25 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/UnpauseSignatureWorkflowService.java @@ -0,0 +1,34 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Envelope; +import com.docusign.esign.model.EnvelopeUpdateSummary; +import com.docusign.esign.model.Workflow; + +public class UnpauseSignatureWorkflowService { + public static EnvelopeUpdateSummary unpauseSignatureWorkflow( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { + // Step 3: Construct your envelope JSON body + Workflow workflow = new Workflow(); + workflow.setWorkflowStatus(EnvelopeHelpers.WORKFLOW_STATUS_IN_PROGRESS); + + Envelope envelope = new Envelope(); + envelope.setWorkflow(workflow); + + EnvelopesApi.UpdateOptions updateOptions = envelopesApi.new UpdateOptions(); + updateOptions.setResendEnvelope("true"); + + // Step 4: Call the eSignature REST API + return envelopesApi.update( + accountId, + envelopeId, + envelope, + updateOptions + ); + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java b/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java new file mode 100644 index 00000000..f33ad3b1 --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java @@ -0,0 +1,177 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class UseConditionalRecipientsService { + private static final String DOCUMENT_FILE_NAME = "Welcome1.txt"; + private static final String DOCUMENT_ID = "1"; + private static final String DOCUMENT_NAME = "Welcome"; + + public static EnvelopeSummary useConditionalRecipients( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); + workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); + workflowStep.setItemId("2"); + workflowStep.setStatus("pending"); + workflowStep.setRecipientRouting(createRecipientRouting(args)); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList( + createApprovalSigner(document.getDocumentId()), + createPurchaserSigner(args, document.getDocumentId()) + )); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("ApproveIfChecked"); + envelope.setDocuments(Collections.singletonList(document)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + envelope.setWorkflow(workflow); + + return envelope; + } + + private static Signer createPurchaserSigner(WorkArguments args, String documentId) { + SignHere signHere = new SignHere(); + signHere.setName("SignHereTabs"); + signHere.setXPosition("200"); + signHere.setYPosition("200"); + signHere.setTabLabel("PurchaserSignature"); + signHere.setPageNumber("1"); + signHere.setDocumentId(documentId); + + Checkbox checkbox = new Checkbox(); + checkbox.setName("ClickToApprove"); + checkbox.setSelected("false"); + checkbox.setXPosition("50"); + checkbox.setYPosition("50"); + checkbox.setTabLabel("ApproveWhenChecked"); + checkbox.setPageNumber("1"); + checkbox.setDocumentId(documentId); + + Tabs tabs = EnvelopeHelpers.createSignerTabs(signHere); + tabs.setCheckboxTabs(Collections.singletonList(checkbox)); + + Signer signer = new Signer(); + signer.setName(args.getSignerName()); + signer.setEmail(args.getSignerEmail()); + signer.setRoutingOrder("1"); + signer.setRecipientId("1"); + signer.setRoleName("Purchaser"); + signer.setTabs(tabs); + + return signer; + } + + private static Signer createApprovalSigner(String documentId) { + SignHere signHere = new SignHere(); + signHere.setName("SignHere"); + signHere.setRecipientId("2"); + signHere.setXPosition("200"); + signHere.setYPosition("300"); + signHere.setTabLabel("ApproverSignature"); + signHere.setPageNumber("1"); + signHere.setDocumentId(documentId); + + Signer signer = new Signer(); + signer.setName("Approver"); + signer.setEmail("placeholder@example.com"); + signer.setRoutingOrder("2"); + signer.setRecipientId("2"); + signer.setRoleName("Approver"); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + return signer; + } + + private static List createConditionalRecipientRuleConditions() { + + ConditionalRecipientRuleFilter filter1 = new ConditionalRecipientRuleFilter(); + filter1.setRecipientId("1"); + filter1.setScope("tabs"); + filter1.setTabId("ApprovalTab"); + filter1.setOperator("equals"); + filter1.setValue("false"); + filter1.setTabType("checkbox"); + filter1.setTabLabel("ApproveWhenChecked"); + + ConditionalRecipientRuleFilter filter2 = new ConditionalRecipientRuleFilter(); + filter2.setRecipientId("1"); + filter2.setScope("tabs"); + filter2.setTabId("ApprovalTab"); + filter2.setOperator("equals"); + filter2.setValue("true"); + filter2.setTabType("checkbox"); + filter2.setTabLabel("ApproveWhenChecked"); + + ConditionalRecipientRuleCondition condition1 = new ConditionalRecipientRuleCondition(); + condition1.setRecipientLabel("signer2a"); + condition1.setOrder("1"); + condition1.setFilters(Collections.singletonList(filter1)); + + ConditionalRecipientRuleCondition condition2 = new ConditionalRecipientRuleCondition(); + condition2.setRecipientLabel("signer2b"); + condition2.setOrder("2"); + condition2.setFilters(Collections.singletonList(filter2)); + return Arrays.asList(condition1, condition2); + } + + private static RecipientGroup createRecipientGroup(WorkArguments args) { + RecipientOption recipientOption1 = new RecipientOption(); + recipientOption1.setRecipientLabel("signer2a"); + recipientOption1.setName(args.getSignerNotCheckedName()); + recipientOption1.setRoleName("Signer when not checked"); + recipientOption1.setEmail(args.getSignerNotCheckedEmail()); + + RecipientOption recipientOption2 = new RecipientOption(); + recipientOption2.setRecipientLabel("signer2b"); + recipientOption2.setName(args.getSignerCheckedName()); + recipientOption2.setRoleName("Signer when checked"); + recipientOption2.setEmail(args.getSignerCheckedEmail()); + + RecipientGroup recipientGroup = new RecipientGroup(); + recipientGroup.setGroupName("Approver"); + recipientGroup.setGroupMessage("Members of this group approve a workflow"); + recipientGroup.setRecipients(Arrays.asList(recipientOption1, recipientOption2)); + return recipientGroup; + } + + private static ConditionalRecipientRule createConditionalRecipientRule(WorkArguments args) { + ConditionalRecipientRule conditionalRecipientRule = new ConditionalRecipientRule(); + conditionalRecipientRule.setRecipientId("2"); + conditionalRecipientRule.setOrder("0"); + conditionalRecipientRule.setRecipientGroup(createRecipientGroup(args)); + conditionalRecipientRule.setConditions(createConditionalRecipientRuleConditions()); + return conditionalRecipientRule; + } + + private static RecipientRouting createRecipientRouting(WorkArguments args) { + RecipientRules recipientRules = new RecipientRules(); + recipientRules.setConditionalRecipients(Collections.singletonList(createConditionalRecipientRule(args))); + + RecipientRouting recipientRouting = new RecipientRouting(); + recipientRouting.setRules(recipientRules); + return recipientRouting; + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java new file mode 100644 index 00000000..34cc1bbe --- /dev/null +++ b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java @@ -0,0 +1,35 @@ +package com.docusign.services.eSignature.examples; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.TemplateRole; + +import java.util.Arrays; + +public final class UseTemplateService { + public static EnvelopeSummary createEnvelopeTemplate(EnvelopesApi envelopesApi, String accountId, EnvelopeDefinition envelope) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + public static EnvelopeDefinition makeEnvelope(WorkArguments args) { + TemplateRole signer = new TemplateRole(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + + TemplateRole cc = new TemplateRole(); + cc.setEmail(args.getCcEmail()); + cc.setName(args.getCcName()); + cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setTemplateId(args.getTemplateId()); + envelope.setTemplateRoles(Arrays.asList(signer, cc)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelope; + } +} From 4369a24c4c3a07bc3941c4cd85e5d5fdbc71ddb6 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 1 Sep 2021 13:34:53 +0300 Subject: [PATCH 200/699] Refactoring code examples for Monitor, Click and Rooms --- .../examples/M001GetMonitoringData.java | 44 +---------------- .../examples/R001ControllerCreateRoom.java | 39 +++++---------- .../R002ControllerCreateRoomWithTemplate.java | 42 +++++++--------- .../R003ControllerExportingDataFromRoom.java | 7 ++- .../R004ControllerAddingFormsToRoom.java | 8 +++- .../R005ControllerGetRoomsWithFilters.java | 12 ++--- ...ntrollerCreateExternalFormFillSession.java | 15 +++--- .../R007ControllerCreateFormGroup.java | 13 ++--- ...ontrollerGrantOfficeAccessToFormGroup.java | 9 +++- .../R009ControllerAssignFormToFormGroup.java | 14 +++--- .../examples/ActivateClickwrapService.java | 25 ++++++++++ .../examples/CreateClickwrapService.java | 33 +++++++++++++ .../CreateNewVersionClickwrapService.java | 48 +++++++++++++++++++ .../GetClickwrapResponsesService.java | 15 ++++++ .../examples/GetListClickwrapsService.java | 14 ++++++ .../examples/GetMonitoringDataService.java | 46 ++++++++++++++++++ .../examples/AddingFormsToRoomService.java | 19 ++++++++ .../AssignFormToFormGroupService.java | 24 ++++++++++ .../CreateExternalFormFillSessionService.java | 24 ++++++++++ .../examples/CreateFormGroupService.java | 22 +++++++++ .../rooms/examples/CreateRoomService.java | 33 +++++++++++++ .../CreateRoomWithTemplateService.java | 33 +++++++++++++ .../ExportingDataFromRoomService.java | 14 ++++++ .../examples/GetRoomsWithFiltersService.java | 21 ++++++++ .../GrantOfficeAccessToFormGroupService.java | 19 ++++++++ .../views/pages/click/examples/c003.jsp | 2 +- .../views/pages/click/examples/c004.jsp | 2 +- .../views/pages/click/examples/c005.jsp | 2 +- 28 files changed, 465 insertions(+), 134 deletions(-) create mode 100644 src/main/java/com/docusign/services/click/examples/ActivateClickwrapService.java create mode 100644 src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java create mode 100644 src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java create mode 100644 src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java create mode 100644 src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java create mode 100644 src/main/java/com/docusign/services/monitor/examples/GetMonitoringDataService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 12b35ab4..c3e1fcf1 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -8,6 +8,7 @@ import com.docusign.monitor.api.DataSetApi; import com.docusign.monitor.api.DataSetApi.GetStreamOptions; import com.docusign.monitor.model.CursoredResult; +import com.docusign.services.monitor.examples.GetMonitoringDataService; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -45,7 +46,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse accessToken = ensureUsageOfJWTToken(accessToken, this.session); // step 1 end - JSONArray result = getMonitoringData(accessToken); + JSONArray result = GetMonitoringDataService.getMonitoringData(this.createDataSetApi(accessToken, this.session)); // Cleaning the data from wrong symbols String resultCleaned = result.toString().replaceAll("'", ""); @@ -58,45 +59,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - - protected JSONArray getMonitoringData(String accessToken) throws Exception { - // Declare variables - boolean complete = false; - String cursorValue = ""; -// Integer limit = 1; // Amount of records you want to read in one request - JSONArray result = new JSONArray(); - - DataSetApi datasetApi = this.createDataSetApi(accessToken, this.session); - GetStreamOptions options = datasetApi.new GetStreamOptions(); -// options.setLimit(limit); - - // First call the endpoint with no cursor to get the first records. - // After each call, save the cursor and use it to make the next - // call from the point where the previous one left off when iterating through - // the monitoring records - do - { - if(!cursorValue.isEmpty()) - options.setCursor(cursorValue); - - CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); - - String endCursor = cursoredResult.getEndCursor(); - - // If the endCursor from the response is the same as the one that you already have, - // it means that you have reached the end of the records - if (endCursor.equals(cursorValue)) - { - complete = true; - } - else - { - cursorValue = endCursor; - result.put(new JSONObject(cursoredResult)); - } - } - while (!complete); - - return result; - } } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index c12e8426..e2627d28 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -5,11 +5,11 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.OfficesApi; -import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; -import com.docusign.rooms.model.*; +import com.docusign.rooms.model.RoleSummary; +import com.docusign.rooms.model.Room; +import com.docusign.services.rooms.examples.CreateRoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -40,17 +40,19 @@ public R001ControllerCreateRoom(DSConfiguration config, Session session, User us // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - RoleSummary adminRole = getAdminRole(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + RoleSummary adminRole = getAdminRole( + this.session.getBasePath(), + this.user.getAccessToken(), + this.session.getAccountId()); // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Construct the request body for your room - RoomForCreate roomForCreate = this.createRoom(adminRole.getRoleId(), args.getRoomName()); - String accountId = this.session.getAccountId(); - - // Step 4: Call the v2 Rooms API - Room createdRoom = roomsApi.createRoom(accountId, roomForCreate); + // Step 3: Call the v2 Rooms API + Room createdRoom = CreateRoomService.createRoomFromModel( + roomsApi, + this.session.getAccountId(), + CreateRoomService.createRoomModel(adminRole.getRoleId(), args.getRoomName())); DoneExample.createDefault(this.title) .withJsonObject(createdRoom) @@ -58,22 +60,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private RoomForCreate createRoom(Integer roleId, String roomName) { - return new RoomForCreate() - .name(roomName) - .roleId(roleId) - .transactionSideId("listbuy") - .fieldData( - new FieldDataForCreate() - .putDataItem("address1", "123 EZ Street") - .putDataItem("address2", "unit 10") - .putDataItem("city", "Galaxian") - .putDataItem("state", "US-HI") - .putDataItem("postalCode", "11112") - .putDataItem("companyRoomStatus", "5") - .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") - ); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 62fb83ff..6efb49ee 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -5,12 +5,13 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.OfficesApi; -import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.api.RoomTemplatesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; -import com.docusign.rooms.model.*; +import com.docusign.rooms.model.RoleSummary; +import com.docusign.rooms.model.Room; +import com.docusign.rooms.model.RoomTemplatesSummaryList; +import com.docusign.services.rooms.examples.CreateRoomWithTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -55,16 +56,22 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - RoleSummary adminRole = getAdminRole(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + RoleSummary adminRole = getAdminRole( + this.session.getBasePath(), + this.user.getAccessToken(), + this.session.getAccountId()); // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 4: Construct the request body for your room - RoomForCreate roomForCreate = this.createRoom(adminRole.getRoleId(), args.getRoomName(), args.getRoomTemplateId()); - - // Step 5: Call the v2 Rooms API - Room createdRoom = roomsApi.createRoom(this.session.getAccountId(), roomForCreate); + // Step 4: Call the v2 Rooms API + Room createdRoom = CreateRoomWithTemplateService.createRoomFromModel( + roomsApi, + this.session.getAccountId(), + CreateRoomWithTemplateService.createRoom( + adminRole.getRoleId(), + args.getRoomName(), + args.getRoomTemplateId())); DoneExample.createDefault(this.title) @@ -73,22 +80,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private RoomForCreate createRoom(Integer roleId, String roomName, Integer templateId) { - return new RoomForCreate() - .name(roomName) - .roleId(roleId) - .templateId(templateId) - .fieldData( - new FieldDataForCreate() - .putDataItem("address1", "123 EZ Street") - .putDataItem("address2", "unit 10") - .putDataItem("city", "Galaxian") - .putDataItem("state", "US-HI") - .putDataItem("postalCode", "11112") - .putDataItem("companyRoomStatus", "5") - .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") - ); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index e194b4f7..cf917804 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -11,6 +11,7 @@ import com.docusign.rooms.model.FieldData; import com.docusign.rooms.model.RoleSummaryList; import com.docusign.rooms.model.RoomSummaryList; +import com.docusign.services.rooms.examples.ExportingDataFromRoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -57,8 +58,10 @@ protected Object doWork(WorkArguments args, ModelMap model, RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Call the v2 Rooms API - FieldData fieldData = roomsApi.getRoomFieldData(this.session.getAccountId(), args.getRoomId()); - + FieldData fieldData = ExportingDataFromRoomService.ExportDataFromRoom( + roomsApi, + this.session.getAccountId(), + args.getRoomId()); DoneExample.createDefault(this.title) .withJsonObject(fieldData) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 32dd30fe..33f5ad13 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -10,6 +10,7 @@ import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.*; +import com.docusign.services.rooms.examples.AddingFormsToRoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -63,8 +64,11 @@ protected Object doWork(WorkArguments args, ModelMap model, RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 4. Call the v2 Rooms API - FormForAdd formForAdd = new FormForAdd().formId(args.getFormId()); - RoomDocument roomDocument = roomsApi.addFormToRoom(this.session.getAccountId(), args.getRoomId(), formForAdd); + RoomDocument roomDocument = AddingFormsToRoomService.AddFormsToRoom( + roomsApi, + this.session.getAccountId(), + args.getFormId(), + args.getRoomId()); DoneExample.createDefault(this.title) .withJsonObject(roomDocument) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index 7a5b57fd..24d5407c 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -10,6 +10,7 @@ import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.RoomSummaryList; import com.docusign.rooms.model.RoomTemplatesSummaryList; +import com.docusign.services.rooms.examples.GetRoomsWithFiltersService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -65,13 +66,12 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3. Prepare your request parameters - RoomsApi.GetRoomsOptions options = roomsApi.new GetRoomsOptions(); - options.setFieldDataChangedStartDate(args.getStartDate()); - options.setFieldDataChangedEndDate(args.getEndDate()); - // Step 4. Call the v2 Rooms API - RoomSummaryList rooms = roomsApi.getRooms(this.session.getAccountId(), options); + RoomSummaryList rooms = GetRoomsWithFiltersService.GetRoomsWithFilters( + roomsApi, + this.session.getAccountId(), + args.getStartDate(), + args.getEndDate()); DoneExample.createDefault(this.title) .withJsonObject(rooms) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index 27168d1b..e7175b51 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -13,6 +13,7 @@ import com.docusign.rooms.model.ExternalFormFillSessionForCreate; import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomSummaryList; +import com.docusign.services.rooms.examples.CreateExternalFormFillSessionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -65,14 +66,12 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.getBasePath(), this.user.getAccessToken() ); - // Step 3. Construct your request body - ExternalFormFillSessionForCreate externalFormFillSessionForCreate = new ExternalFormFillSessionForCreate() - .formId(args.getFormId().toString()) - .roomId(args.getRoomId()); - - // Step 4. Call the v2 Rooms API - ExternalFormFillSession externalFormFillSession = externalFormFillSessionsApi.createExternalFormFillSession( - this.session.getAccountId(), externalFormFillSessionForCreate + // Step 3. Call the v2 Rooms API + ExternalFormFillSession externalFormFillSession = CreateExternalFormFillSessionService.CreateExternalFormFillSession( + externalFormFillSessionsApi, + this.session.getAccountId(), + args.getFormId().toString(), + args.getRoomId() ); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 76f4e27e..35dddb6e 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -9,6 +9,7 @@ import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FormGroup; import com.docusign.rooms.model.FormGroupForCreate; +import com.docusign.services.rooms.examples.CreateFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -43,14 +44,10 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.getBasePath(), this.user.getAccessToken() ); - // Step 3 Start - FormGroupForCreate formGroupForCreate = new FormGroupForCreate() - .name(args.getFormGroupName()); - // Step 3 End - - // Step 4 Start - FormGroup formGroup = formGroupsApi.createFormGroup(this.session.getAccountId(), formGroupForCreate); - // Step 4 End + FormGroup formGroup = CreateFormGroupService.CreateFormGroup( + formGroupsApi, + this.session.getAccountId(), + args.getFormGroupName()); DoneExample.createDefault(this.title) .withJsonObject(formGroup) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index 03c82db4..d055ab60 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -9,6 +9,7 @@ import com.docusign.rooms.api.OfficesApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.*; +import com.docusign.services.rooms.examples.GrantOfficeAccessToFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -68,9 +69,13 @@ protected Object doWork(WorkArguments args, ModelMap model, try { // Step 5 Start - this.formGroupsApi.grantOfficeAccessToFormGroup(this.session.getAccountId(), args.getFormGroupId(), args.getOfficeId()); + GrantOfficeAccessToFormGroupService.GrantOfficeAccessToFormGroup( + this.formGroupsApi, + this.session.getAccountId(), + args.getFormGroupId(), + args.getOfficeId()); // Step 5 End - + DoneExample.createDefault(this.title) .withMessage("Office has been granted access to a form group!") .addToModel(model); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 82cccaeb..6f9c41e0 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -10,6 +10,7 @@ import com.docusign.rooms.model.FormGroupFormToAssign; import com.docusign.rooms.model.FormGroupSummaryList; import com.docusign.rooms.model.FormSummary; +import com.docusign.services.rooms.examples.AssignFormToFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -65,16 +66,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - - // Step 5 Start - FormGroupFormToAssign formGroupFormToAssignRequest = new FormGroupFormToAssign() - .formId(args.getFormId()); - // Step 5 End - try { // Step 6 Start - FormGroupFormToAssign formGroupFormToAssign = this.formGroupsApi.assignFormGroupForm( - this.session.getAccountId(), args.getFormGroupId(), formGroupFormToAssignRequest); + FormGroupFormToAssign formGroupFormToAssign = AssignFormToFormGroupService.AssignFormToFormGroup( + this.formGroupsApi, + this.session.getAccountId(), + args.getFormId(), + args.getFormGroupId()); // Step 6 End DoneExample.createDefault(this.title) diff --git a/src/main/java/com/docusign/services/click/examples/ActivateClickwrapService.java b/src/main/java/com/docusign/services/click/examples/ActivateClickwrapService.java new file mode 100644 index 00000000..8a81d559 --- /dev/null +++ b/src/main/java/com/docusign/services/click/examples/ActivateClickwrapService.java @@ -0,0 +1,25 @@ +package com.docusign.services.click.examples; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.controller.click.examples.ClickwrapHelper; + +public final class ActivateClickwrapService { + public static ClickwrapVersionSummaryResponse activateClickwrap( + AccountsApi accountsApi, + String accountId, + String clickwrapId, + String clickwrapVersionNumber) throws ApiException { + // Step 3: Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE); + + // Step 4: Call the v1 Click API + return accountsApi.updateClickwrapVersion( + accountId, + clickwrapId, + clickwrapVersionNumber, + clickwrapRequest); + } +} diff --git a/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java b/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java new file mode 100644 index 00000000..7e801adb --- /dev/null +++ b/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java @@ -0,0 +1,33 @@ +package com.docusign.services.click.examples; + +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.controller.click.examples.ClickwrapHelper; + +import java.io.IOException; + +public final class CreateClickwrapService { + public static ClickwrapRequest createClickwrapRequest( + String clickwrapName, + String fileName, + String documentName, + Integer documentOrder) throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(fileName, documentName, documentOrder); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true) + .documentDisplay("document"); + + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName(clickwrapName) + .requireReacceptance(true) + .displaySettings(displaySettings); + } +} diff --git a/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java b/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java new file mode 100644 index 00000000..886c4ec7 --- /dev/null +++ b/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java @@ -0,0 +1,48 @@ +package com.docusign.services.click.examples; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.controller.click.examples.ClickwrapHelper; + +import java.io.IOException; + +public final class CreateNewVersionClickwrapService { + public static ClickwrapVersionSummaryResponse createNewVersionClickwrap( + AccountsApi accountsApi, + ClickwrapRequest clickwrapRequest, + String accountId, + String clickwrapId) throws ApiException { + // Step 4: Call the v1 Click API + return accountsApi.createClickwrapVersion( + accountId, + clickwrapId, + clickwrapRequest); + } + + public static ClickwrapRequest createClickwrapRequest( + String fileName, + String documentName, + Integer documentOrder) throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(fileName, documentName, documentOrder); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service v2") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true) + .documentDisplay("document"); + + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName("Terms of Service") + .requireReacceptance(true) + .status(ClickwrapHelper.STATUS_ACTIVE) + .displaySettings(displaySettings); + } +} diff --git a/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java b/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java new file mode 100644 index 00000000..64b9d508 --- /dev/null +++ b/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java @@ -0,0 +1,15 @@ +package com.docusign.services.click.examples; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapAgreementsResponse; + +public final class GetClickwrapResponsesService { + public static ClickwrapAgreementsResponse getClickwrapResponses( + AccountsApi accountsApi, + String accountId, + String clickwrapId) throws ApiException { + // Step 3: Call the v1 Click API + return accountsApi.getClickwrapAgreements(accountId, clickwrapId); + } +} diff --git a/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java b/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java new file mode 100644 index 00000000..9e4180c2 --- /dev/null +++ b/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java @@ -0,0 +1,14 @@ +package com.docusign.services.click.examples; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapVersionsResponse; + +public final class GetListClickwrapsService { + public static ClickwrapVersionsResponse getListClickwrap( + AccountsApi accountsApi, + String accountId) throws ApiException { + // Step 3: Call the v1 Click API + return accountsApi.getClickwraps(accountId); + } +} diff --git a/src/main/java/com/docusign/services/monitor/examples/GetMonitoringDataService.java b/src/main/java/com/docusign/services/monitor/examples/GetMonitoringDataService.java new file mode 100644 index 00000000..521210c8 --- /dev/null +++ b/src/main/java/com/docusign/services/monitor/examples/GetMonitoringDataService.java @@ -0,0 +1,46 @@ +package com.docusign.services.monitor.examples; + +import com.docusign.monitor.api.DataSetApi; +import com.docusign.monitor.model.CursoredResult; +import org.json.JSONArray; +import org.json.JSONObject; + +public final class GetMonitoringDataService { + public static JSONArray getMonitoringData(DataSetApi datasetApi) throws Exception { + // Declare variables + boolean complete = false; + String cursorValue = ""; + JSONArray result = new JSONArray(); + + DataSetApi.GetStreamOptions options = datasetApi.new GetStreamOptions(); + + // First call the endpoint with no cursor to get the first records. + // After each call, save the cursor and use it to make the next + // call from the point where the previous one left off when iterating through + // the monitoring records + do + { + if(!cursorValue.isEmpty()) + options.setCursor(cursorValue); + + CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); + + String endCursor = cursoredResult.getEndCursor(); + + // If the endCursor from the response is the same as the one that you already have, + // it means that you have reached the end of the records + if (endCursor.equals(cursorValue)) + { + complete = true; + } + else + { + cursorValue = endCursor; + result.put(new JSONObject(cursoredResult)); + } + } + while (!complete); + + return result; + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java b/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java new file mode 100644 index 00000000..510d60c1 --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java @@ -0,0 +1,19 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormForAdd; +import com.docusign.rooms.model.RoomDocument; + +import java.util.UUID; + +public final class AddingFormsToRoomService { + public static RoomDocument AddFormsToRoom( + RoomsApi roomsApi, + String accountId, + UUID formId, + Integer roomId) throws ApiException { + FormForAdd formForAdd = new FormForAdd().formId(formId); + return roomsApi.addFormToRoom(accountId, roomId, formForAdd); + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java new file mode 100644 index 00000000..f5fa461b --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java @@ -0,0 +1,24 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormGroupFormToAssign; + +import java.util.UUID; + +public final class AssignFormToFormGroupService { + public static FormGroupFormToAssign AssignFormToFormGroup( + FormGroupsApi formGroupsApi, + String accountId, + UUID formId, + UUID formGroupId) throws ApiException { + // Step 5 Start + FormGroupFormToAssign formGroupFormToAssignRequest = new FormGroupFormToAssign() + .formId(formId); + // Step 5 End + // Step 6 Start + return formGroupsApi.assignFormGroupForm( + accountId, formGroupId, formGroupFormToAssignRequest); + // Step 6 End + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java b/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java new file mode 100644 index 00000000..e4e2b2f1 --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java @@ -0,0 +1,24 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.ExternalFormFillSessionsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.ExternalFormFillSession; +import com.docusign.rooms.model.ExternalFormFillSessionForCreate; + +public final class CreateExternalFormFillSessionService { + public static ExternalFormFillSession CreateExternalFormFillSession( + ExternalFormFillSessionsApi externalFormFillSessionsApi, + String accountId, + String formId, + Integer roomId) throws ApiException { + // Step 3. Construct your request body + ExternalFormFillSessionForCreate externalFormFillSessionForCreate = new ExternalFormFillSessionForCreate() + .formId(formId) + .roomId(roomId); + + // Step 4. Call the v2 Rooms API + return externalFormFillSessionsApi.createExternalFormFillSession( + accountId, externalFormFillSessionForCreate + ); + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java new file mode 100644 index 00000000..4871f4e6 --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java @@ -0,0 +1,22 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormGroup; +import com.docusign.rooms.model.FormGroupForCreate; + +public final class CreateFormGroupService { + public static FormGroup CreateFormGroup( + FormGroupsApi formGroupsApi, + String accountId, + String formGroupName) throws ApiException { + // Step 3 Start + FormGroupForCreate formGroupForCreate = new FormGroupForCreate() + .name(formGroupName); + // Step 3 End + + // Step 4 Start + return formGroupsApi.createFormGroup(accountId, formGroupForCreate); + // Step 4 End + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java b/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java new file mode 100644 index 00000000..e80b4b7d --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java @@ -0,0 +1,33 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FieldDataForCreate; +import com.docusign.rooms.model.Room; +import com.docusign.rooms.model.RoomForCreate; + +public final class CreateRoomService { + public static Room createRoomFromModel( + RoomsApi roomsApi, + String accountId, + RoomForCreate roomForCreate) throws ApiException { + return roomsApi.createRoom(accountId, roomForCreate); + } + + public static RoomForCreate createRoomModel(Integer roleId, String roomName) { + return new RoomForCreate() + .name(roomName) + .roleId(roleId) + .transactionSideId("listbuy") + .fieldData( + new FieldDataForCreate() + .putDataItem("address1", "123 EZ Street") + .putDataItem("address2", "unit 10") + .putDataItem("city", "Galaxian") + .putDataItem("state", "US-HI") + .putDataItem("postalCode", "11112") + .putDataItem("companyRoomStatus", "5") + .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + ); + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java new file mode 100644 index 00000000..ae030db6 --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java @@ -0,0 +1,33 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FieldDataForCreate; +import com.docusign.rooms.model.Room; +import com.docusign.rooms.model.RoomForCreate; + +public final class CreateRoomWithTemplateService { + public static Room createRoomFromModel( + RoomsApi roomsApi, + String accountId, + RoomForCreate roomForCreate) throws ApiException { + return roomsApi.createRoom(accountId, roomForCreate); + } + + public static RoomForCreate createRoom(Integer roleId, String roomName, Integer templateId) { + return new RoomForCreate() + .name(roomName) + .roleId(roleId) + .templateId(templateId) + .fieldData( + new FieldDataForCreate() + .putDataItem("address1", "123 EZ Street") + .putDataItem("address2", "unit 10") + .putDataItem("city", "Galaxian") + .putDataItem("state", "US-HI") + .putDataItem("postalCode", "11112") + .putDataItem("companyRoomStatus", "5") + .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + ); + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java b/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java new file mode 100644 index 00000000..b40c526a --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java @@ -0,0 +1,14 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FieldData; + +public final class ExportingDataFromRoomService { + public static FieldData ExportDataFromRoom( + RoomsApi roomsApi, + String accountId, + Integer roomId) throws ApiException { + return roomsApi.getRoomFieldData(accountId, roomId); + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java b/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java new file mode 100644 index 00000000..7a124a9b --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java @@ -0,0 +1,21 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.RoomSummaryList; + +public final class GetRoomsWithFiltersService { + public static RoomSummaryList GetRoomsWithFilters( + RoomsApi roomsApi, + String accountId, + String startDate, + String endDate) throws ApiException { + // Step 3. Prepare your request parameters + RoomsApi.GetRoomsOptions options = roomsApi.new GetRoomsOptions(); + options.setFieldDataChangedStartDate(startDate); + options.setFieldDataChangedEndDate(endDate); + + // Step 4. Call the v2 Rooms API + return roomsApi.getRooms(accountId, options); + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java new file mode 100644 index 00000000..fe11c985 --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java @@ -0,0 +1,19 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; + +import java.util.UUID; + +public final class GrantOfficeAccessToFormGroupService { + public static void GrantOfficeAccessToFormGroup( + FormGroupsApi formGroupsApi, + String accountId, + UUID formGroupId, + Integer officeId) throws ApiException { + formGroupsApi.grantOfficeAccessToFormGroup( + accountId, + formGroupId, + officeId); + } +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 3ee5f8c2..21e3ae72 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

5. Creating a new clickwrap version.

+

3. Creating a new clickwrap version.

This topic demonstrates how to use the Click API to create a new version of a clickwrap. You can specify whether you require users who have previously accepted the clickwrap diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index 2455609e..cc3c7446 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

6. Get a list of clickwraps.

+

4. Get a list of clickwraps.

This topic demonstrates how to use the Click API to get a list of clickwraps associated with a specific DocuSign user. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index 0590a391..c000d94a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

7. Get clickwrap responses.

+

5. Get clickwrap responses.

This topic demonstrates how to use the Click API to get user responses to your clickwrap agreements. From 3a1bb37b49d65723f9857ce2fc3226d37da8fca3 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 1 Sep 2021 16:49:39 +0300 Subject: [PATCH 201/699] Renamed methods, formatted lines --- pom.xml | 5 +++ .../C001ControllerCreateClickwrap.java | 10 ++++- .../EG002ControllerSigningViaEmail.java | 5 ++- .../EG003ControllerListEnvelopes.java | 4 +- .../examples/EG004ControllerEnvelopeInfo.java | 5 ++- .../EG005ControllerEnvelopeRecipients.java | 5 ++- .../EG008ControllerCreateTemplate.java | 5 ++- .../examples/EG009ControllerUseTemplate.java | 5 ++- .../EG011ControllerEmbeddedSending.java | 6 ++- .../EG014ControllerCollectPayment.java | 21 +++------ .../EG020ControllerSmsAuthentication.java | 5 ++- .../EG022ControllerKBAAuthentication.java | 4 +- .../EG023ControllerIdvAuthentication.java | 9 +++- .../EG031ControllerBulkSendEnvelopes.java | 35 +++++---------- ...EG032ControllerPauseSignatureWorkflow.java | 4 +- ...034ControllerUseConditionalRecipients.java | 4 +- .../examples/AbstractRoomsController.java | 45 +++++++++++++++---- .../R002ControllerCreateRoomWithTemplate.java | 4 +- .../R003ControllerExportingDataFromRoom.java | 2 +- .../R004ControllerAddingFormsToRoom.java | 7 ++- .../R005ControllerGetRoomsWithFilters.java | 2 +- ...ntrollerCreateExternalFormFillSession.java | 8 +++- .../R007ControllerCreateFormGroup.java | 2 +- ...ontrollerGrantOfficeAccessToFormGroup.java | 2 +- .../R009ControllerAssignFormToFormGroup.java | 7 ++- .../examples/AddingFormsToRoomService.java | 2 +- .../AssignFormToFormGroupService.java | 2 +- .../CreateExternalFormFillSessionService.java | 2 +- .../examples/CreateFormGroupService.java | 2 +- .../ExportingDataFromRoomService.java | 2 +- .../examples/GetRoomsWithFiltersService.java | 2 +- .../GrantOfficeAccessToFormGroupService.java | 2 +- 32 files changed, 146 insertions(+), 79 deletions(-) diff --git a/pom.xml b/pom.xml index 6261a6f8..3ed14a58 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,11 @@ RELEASE compile + + org.springframework.boot + spring-boot-autoconfigure + 2.4.4 + diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index f7919145..8fa43eb5 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -49,10 +49,16 @@ protected Object doWork(WorkArguments args, ModelMap model, AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3. Construct the request body for your clickwrap - ClickwrapRequest clickwrapRequest = CreateClickwrapService.createClickwrapRequest(args.getClickwrapName(), DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); + ClickwrapRequest clickwrapRequest = CreateClickwrapService.createClickwrapRequest( + args.getClickwrapName(), + DOCUMENT_FILE_NAME, + DOCUMENT_NAME, + DOCUMENT_ORDER); // Step 4. Call the v1 Click API - ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); + ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap( + this.session.getAccountId(), + clickwrapRequest); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index f9a1bb4f..6d83b014 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -55,7 +55,10 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); EnvelopeDefinition envelope = SigningViaEmailService.makeEnvelope(args); - EnvelopeSummary results = SigningViaEmailService.signingViaEmail(envelopesApi, session.getAccountId(), envelope); + EnvelopeSummary results = SigningViaEmailService.signingViaEmail( + envelopesApi, + session.getAccountId(), + envelope); // process results session.setEnvelopeId(results.getEnvelopeId()); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 1d216cfe..9aaa9c54 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -45,7 +45,9 @@ public EG003ControllerListEnvelopes(DSConfiguration config, Session session, Use // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopesInformation envelopesInformation = ListEnvelopesServices.listEnvelopes(envelopesApi, session.getAccountId()); + EnvelopesInformation envelopesInformation = ListEnvelopesServices.listEnvelopes( + envelopesApi, + session.getAccountId()); DoneExample.createDefault(title) .withMessage("Results from the Envelopes::listStatusChanges method:") diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index 85419624..5b49cdcf 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -54,7 +54,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope info EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - Envelope envelope = EnvelopeInfoService.envelopeInfo(envelopesApi, session.getAccountId(), session.getEnvelopeId()); + Envelope envelope = EnvelopeInfoService.envelopeInfo( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); DoneExample.createDefault(title) .withJsonObject(envelope) .withMessage("Results from the Envelopes::get method:") diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index 852d24ce..7a16b717 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -48,7 +48,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope recipients EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - Recipients recipients = EnvelopeRecipientsService.envelopeRecipients(envelopesApi, session.getAccountId(), session.getEnvelopeId()); + Recipients recipients = EnvelopeRecipientsService.envelopeRecipients( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); DoneExample.createDefault(title) .withJsonObject(recipients) .withMessage("Results from the EnvelopeRecipients::list method:") diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index c9bb8b61..27c8306d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -62,7 +62,10 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 1. list existing templates ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); String accountId = session.getAccountId(); - EnvelopeTemplateResults results = CreateTemplateService.searchTemplatesByName(apiClient, accountId, TEMPLATE_NAME); + EnvelopeTemplateResults results = CreateTemplateService.searchTemplatesByName( + apiClient, + accountId, + TEMPLATE_NAME); // Step 2. Process results. If template do not exist, create one if (Integer.parseInt(results.getResultSetSize()) > 0) { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index ef5050d2..b8d85a5b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -64,7 +64,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); EnvelopeDefinition envelope = UseTemplateService.makeEnvelope(args); - EnvelopeSummary result = UseTemplateService.createEnvelopeTemplate(envelopesApi, session.getAccountId(), envelope); + EnvelopeSummary result = UseTemplateService.createEnvelopeTemplate( + envelopesApi, + session.getAccountId(), + envelope); session.setEnvelopeId(result.getEnvelopeId()); DoneExample.createDefault(title) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index 536ab588..9f1e0158 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -59,7 +59,11 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2. Create the sender view. // Set the url where you want the recipient to go once they are done // signing should typically be a callback route somewhere in your app. - ViewUrl viewUrl = EmbeddedSendingService.createSenderView(envelopesApi, accountId, envelopeId, config.getDsReturnUrl()); + ViewUrl viewUrl = EmbeddedSendingService.createSenderView( + envelopesApi, + accountId, + envelopeId, + config.getDsReturnUrl()); // Switch to Recipient and Documents view if requested by the user String url = viewUrl.getUrl(); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index f06237aa..8b633738 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -2,32 +2,21 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.FormulaTab; -import com.docusign.esign.model.List; -import com.docusign.esign.model.ListItem; -import com.docusign.esign.model.PaymentDetails; -import com.docusign.esign.model.PaymentLineItem; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; - import com.docusign.services.eSignature.examples.CollectPaymentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -69,11 +58,15 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) throws ApiException, IOException { + HttpServletResponse response) throws ApiException, IOException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. Make the envelope request body - EnvelopeDefinition envelope = CollectPaymentService.makeEnvelope(args, config.getGatewayAccountId(), config.getGatewayName(), config.getGatewayDisplayName()); + EnvelopeDefinition envelope = CollectPaymentService.makeEnvelope( + args, + config.getGatewayAccountId(), + config.getGatewayName(), + config.getGatewayDisplayName()); // Step 2. call Envelopes::create API method EnvelopeSummary results = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java index e8b5b31a..e4ea5c27 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java @@ -56,7 +56,10 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = SmsAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getPhoneNumber()); + EnvelopeDefinition envelope = SmsAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getPhoneNumber()); // Step 4: Call the eSignature REST API EnvelopeSummary results = SmsAuthenticationService.smsAuthentication( diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index f07068b0..e4a6d3ea 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -51,7 +51,9 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = KBAAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail()); + EnvelopeDefinition envelope = KBAAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail()); // Step 3: Call the eSignature REST API EnvelopeSummary results = KBAAuthenticationService.kbaAuthentication( diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index f77cb7a3..baaa0dc0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -53,7 +53,9 @@ public EG023ControllerIdvAuthentication(DSConfiguration config, Session session, } @Override - protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) + throws ApiException, IOException + { // Step 1: Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); @@ -63,7 +65,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse logger.info("workflowId = " + workflowId); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = IdvAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); + EnvelopeDefinition envelope = IdvAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + workflowId); // Step 4: Create envelope EnvelopeSummary results = IdvAuthenticationService.idvAuthentication( envelopesApi, diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index 27510750..4d809243 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -1,38 +1,23 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.api.BulkEnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.BulkSendBatchStatus; import com.docusign.services.eSignature.examples.BulkSendEnvelopesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import com.docusign.DSConfiguration; -import com.docusign.esign.api.BulkEnvelopesApi; -import com.docusign.esign.api.EnvelopesApi; -import com.docusign.esign.client.ApiClient; -import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.BulkSendBatchStatus; -import com.docusign.esign.model.BulkSendRequest; -import com.docusign.esign.model.BulkSendingCopy; -import com.docusign.esign.model.BulkSendingCopyRecipient; -import com.docusign.esign.model.BulkSendingList; -import com.docusign.esign.model.CustomFields; -import com.docusign.esign.model.Document; -import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.TextCustomField; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.concurrent.TimeUnit; /** * This code example demonstrates how to send envelopes in bulk to multiple @@ -81,7 +66,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse BulkSendBatchStatus status = bulkEnvelopesApi.getBulkSendBatchStatus(accountId, batchId); DoneExample.createDefault(title) .withJsonObject(status) - .withMessage(String.join("", "Bulk request queued to ", status.getQueued(), " user lists.")) + .withMessage(String.join( + "", + "Bulk request queued to ", status.getQueued(), " user lists.")) .addToModel(model); } catch (InterruptedException exception) { Thread.currentThread().interrupt(); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index 68f13be9..cb305f62 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -38,7 +38,9 @@ public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session ses } @Override - protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) + throws ApiException, IOException + { // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index ba3858d2..e16e093e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -41,7 +41,9 @@ public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session s @Override // ***DS.snippet.0.start - protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) + throws ApiException, IOException + { // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index c9e6515f..5d3d31c2 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -88,7 +88,10 @@ protected static OfficesApi createOfficesApiClient(String basePath, String userA * @param userAccessToken user's access token * @return an instance of the {@link ExternalFormFillSessionsApi} */ - protected static ExternalFormFillSessionsApi createExternalFormFillSessionsApiClient(String basePath, String userAccessToken) { + protected static ExternalFormFillSessionsApi createExternalFormFillSessionsApiClient( + String basePath, + String userAccessToken) + { ApiClient apiClient = createApiClient(basePath, userAccessToken); return new ExternalFormFillSessionsApi(apiClient); } @@ -129,7 +132,9 @@ protected static FormGroupsApi createFormGroupsApi(String basePath, String userA return new FormGroupsApi(apiClient); } - protected static RoleSummary getAdminRole(String basePath, String userAccessToken, String accountId) throws ApiException { + protected static RoleSummary getAdminRole(String basePath, String userAccessToken, String accountId) + throws ApiException + { RoleSummaryList roleSummaryList = createRolesApiClient(basePath, userAccessToken).getRoles(accountId); return roleSummaryList.getRoles() .stream() @@ -138,39 +143,63 @@ protected static RoleSummary getAdminRole(String basePath, String userAccessToke .get(); } - protected static List getFormSummaryList(String basePath, String userAccessToken, String accountId) throws ApiException { + protected static List getFormSummaryList(String basePath, String userAccessToken, String accountId) + throws ApiException + { FormLibrariesApi formLibrariesApi = createFormLibrariesApi(basePath, userAccessToken); FormLibrarySummaryList formLibrarySummaryList = formLibrariesApi.getFormLibraries(accountId); List forms = new ArrayList<>(); for (FormLibrarySummary formLibrarySummary : formLibrarySummaryList.getFormsLibrarySummaries()) { - FormSummaryList formSummaryList = formLibrariesApi.getFormLibraryForms(accountId, formLibrarySummary.getFormsLibraryId()); + FormSummaryList formSummaryList = formLibrariesApi.getFormLibraryForms( + accountId, + formLibrarySummary.getFormsLibraryId()); forms.addAll(formSummaryList.getForms()); } return forms; } - protected List getDocumentsByRoomsId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { + protected List getDocumentsByRoomsId( + String basePath, + String accessToken, + String accountId, + WorkArguments roomId) + throws ApiException + { RoomsApi roomsApiClient = createRoomsApiClient(basePath, accessToken); return roomsApiClient.getDocuments(accountId, roomId.getRoomId()).getDocuments(); } - protected RoomSummaryList getRoomSummaryList(String basePath, String accessToken, String accountId) throws ApiException { + protected RoomSummaryList getRoomSummaryList(String basePath, String accessToken, String accountId) + throws ApiException + { RoomsApi roomsApi = createRoomsApiClient(basePath, accessToken); return roomsApi.getRooms(accountId); } - protected List getRoomSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { + protected List getRoomSummariesByRoomId( + String basePath, + String accessToken, + String accountId, + WorkArguments roomId) + throws ApiException + { RoomSummaryList summaryList = getRoomSummaryList(basePath, accessToken, accountId); return summaryList.getRooms().stream() .filter(var -> var.getRoomId().equals(roomId.getRoomId())) .collect(Collectors.toList()); } - protected List getAvailableFormSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { + protected List getAvailableFormSummariesByRoomId( + String basePath, + String accessToken, + String accountId, + WorkArguments roomId) + throws ApiException + { List formsByRoomsId = getDocumentsByRoomsId(basePath, accessToken, accountId, roomId); List formSummaries = getFormSummaryList(basePath, accessToken, accountId); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 6efb49ee..57d2b339 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -47,7 +47,9 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception super.onInitModel(args, model); // Step 3: Retrieve a Rooms Template ID - RoomTemplatesApi templatesApi = createRoomTemplatesApiClient(this.session.getBasePath(), this.user.getAccessToken()); + RoomTemplatesApi templatesApi = createRoomTemplatesApiClient( + this.session.getBasePath(), + this.user.getAccessToken()); RoomTemplatesSummaryList templatesSummaryList = templatesApi.getRoomTemplates(this.session.getAccountId()); model.addAttribute(MODEL_TEMPLATES_LIST, templatesSummaryList.getRoomTemplates()); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index cf917804..7355e113 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -58,7 +58,7 @@ protected Object doWork(WorkArguments args, ModelMap model, RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Call the v2 Rooms API - FieldData fieldData = ExportingDataFromRoomService.ExportDataFromRoom( + FieldData fieldData = ExportingDataFromRoomService.exportDataFromRoom( roomsApi, this.session.getAccountId(), args.getRoomId()); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 33f5ad13..159022ae 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -49,7 +49,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3. Obtain the desired form ID RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); - List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + List forms = getFormSummaryList( + this.session.getBasePath(), + this.user.getAccessToken(), + this.session.getAccountId()); model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); model.addAttribute(MODEL_FORM_LIST, forms); @@ -64,7 +67,7 @@ protected Object doWork(WorkArguments args, ModelMap model, RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 4. Call the v2 Rooms API - RoomDocument roomDocument = AddingFormsToRoomService.AddFormsToRoom( + RoomDocument roomDocument = AddingFormsToRoomService.addFormsToRoom( roomsApi, this.session.getAccountId(), args.getFormId(), diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index 24d5407c..2eb002df 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -67,7 +67,7 @@ protected Object doWork(WorkArguments args, ModelMap model, RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 4. Call the v2 Rooms API - RoomSummaryList rooms = GetRoomsWithFiltersService.GetRoomsWithFilters( + RoomSummaryList rooms = GetRoomsWithFiltersService.getRoomsWithFilters( roomsApi, this.session.getAccountId(), args.getStartDate(), diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index e7175b51..1c6a68fe 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -50,7 +50,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); - List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + List forms = getFormSummaryList( + this.session.getBasePath(), + this.user.getAccessToken(), + this.session.getAccountId()); model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); model.addAttribute(MODEL_FORM_LIST, forms); @@ -67,7 +70,8 @@ protected Object doWork(WorkArguments args, ModelMap model, ); // Step 3. Call the v2 Rooms API - ExternalFormFillSession externalFormFillSession = CreateExternalFormFillSessionService.CreateExternalFormFillSession( + ExternalFormFillSession externalFormFillSession = CreateExternalFormFillSessionService + .createExternalFormFillSession( externalFormFillSessionsApi, this.session.getAccountId(), args.getFormId().toString(), diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 35dddb6e..9646fd0d 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -44,7 +44,7 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.getBasePath(), this.user.getAccessToken() ); - FormGroup formGroup = CreateFormGroupService.CreateFormGroup( + FormGroup formGroup = CreateFormGroupService.createFormGroup( formGroupsApi, this.session.getAccountId(), args.getFormGroupName()); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index d055ab60..15c5eefe 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -69,7 +69,7 @@ protected Object doWork(WorkArguments args, ModelMap model, try { // Step 5 Start - GrantOfficeAccessToFormGroupService.GrantOfficeAccessToFormGroup( + GrantOfficeAccessToFormGroupService.grantOfficeAccessToFormGroup( this.formGroupsApi, this.session.getAccountId(), args.getFormGroupId(), diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 6f9c41e0..24d09f09 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -55,7 +55,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3 End // Step 4 Start - List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + List forms = getFormSummaryList( + this.session.getBasePath(), + this.user.getAccessToken(), + this.session.getAccountId()); // Step 4 End model.addAttribute(MODEL_FORM_GROUP_LIST, formGroupSummaryList.getFormGroups()); @@ -68,7 +71,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { try { // Step 6 Start - FormGroupFormToAssign formGroupFormToAssign = AssignFormToFormGroupService.AssignFormToFormGroup( + FormGroupFormToAssign formGroupFormToAssign = AssignFormToFormGroupService.assignFormToFormGroup( this.formGroupsApi, this.session.getAccountId(), args.getFormId(), diff --git a/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java b/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java index 510d60c1..9c31ff8a 100644 --- a/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java +++ b/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java @@ -8,7 +8,7 @@ import java.util.UUID; public final class AddingFormsToRoomService { - public static RoomDocument AddFormsToRoom( + public static RoomDocument addFormsToRoom( RoomsApi roomsApi, String accountId, UUID formId, diff --git a/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java index f5fa461b..10abd60c 100644 --- a/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java +++ b/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java @@ -7,7 +7,7 @@ import java.util.UUID; public final class AssignFormToFormGroupService { - public static FormGroupFormToAssign AssignFormToFormGroup( + public static FormGroupFormToAssign assignFormToFormGroup( FormGroupsApi formGroupsApi, String accountId, UUID formId, diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java b/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java index e4e2b2f1..ef10d82b 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java @@ -6,7 +6,7 @@ import com.docusign.rooms.model.ExternalFormFillSessionForCreate; public final class CreateExternalFormFillSessionService { - public static ExternalFormFillSession CreateExternalFormFillSession( + public static ExternalFormFillSession createExternalFormFillSession( ExternalFormFillSessionsApi externalFormFillSessionsApi, String accountId, String formId, diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java index 4871f4e6..5b5f68cc 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java @@ -6,7 +6,7 @@ import com.docusign.rooms.model.FormGroupForCreate; public final class CreateFormGroupService { - public static FormGroup CreateFormGroup( + public static FormGroup createFormGroup( FormGroupsApi formGroupsApi, String accountId, String formGroupName) throws ApiException { diff --git a/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java b/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java index b40c526a..5f78e157 100644 --- a/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java +++ b/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java @@ -5,7 +5,7 @@ import com.docusign.rooms.model.FieldData; public final class ExportingDataFromRoomService { - public static FieldData ExportDataFromRoom( + public static FieldData exportDataFromRoom( RoomsApi roomsApi, String accountId, Integer roomId) throws ApiException { diff --git a/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java b/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java index 7a124a9b..3f093ea2 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java +++ b/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java @@ -5,7 +5,7 @@ import com.docusign.rooms.model.RoomSummaryList; public final class GetRoomsWithFiltersService { - public static RoomSummaryList GetRoomsWithFilters( + public static RoomSummaryList getRoomsWithFilters( RoomsApi roomsApi, String accountId, String startDate, diff --git a/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java index fe11c985..8247a0a5 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java +++ b/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java @@ -6,7 +6,7 @@ import java.util.UUID; public final class GrantOfficeAccessToFormGroupService { - public static void GrantOfficeAccessToFormGroup( + public static void grantOfficeAccessToFormGroup( FormGroupsApi formGroupsApi, String accountId, UUID formGroupId, From 29c688535035c9b26ecf9bdf223000c36dd291ee Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Wed, 15 Sep 2021 15:00:03 -0700 Subject: [PATCH 202/699] stack trace fixes (#35) --- .../com/docusign/core/controller/AbstractController.java | 8 +++++++- src/main/java/com/docusign/core/model/DoneExample.java | 6 ++++++ src/main/webapp/WEB-INF/templates/views/error.jsp | 2 +- .../templates/views/pages/ds_must_authenticate.jsp | 7 +++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index 9826bce0..7ac79b41 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -4,6 +4,8 @@ import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; + +import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.oauth2.client.OAuth2ClientContext; import org.springframework.security.oauth2.common.OAuth2AccessToken; @@ -13,6 +15,9 @@ import org.springframework.web.bind.annotation.PostMapping; import javax.servlet.http.HttpServletResponse; + +import java.util.Arrays; +import java.util.List; import java.util.Objects; @@ -116,11 +121,12 @@ protected abstract Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception; private String handleException(Exception exception, ModelMap model) { + String stackTrace = ExceptionUtils.getStackTrace(exception); new DoneExample() .withTitle(exampleName) .withName(title) .withMessage(exception.getMessage()) - .withStackTrace(exception.getStackTrace()) + .withStackTracePrinted(stackTrace) .addToModel(model); return ERROR_PAGE; } diff --git a/src/main/java/com/docusign/core/model/DoneExample.java b/src/main/java/com/docusign/core/model/DoneExample.java index 346b614e..dde6abce 100644 --- a/src/main/java/com/docusign/core/model/DoneExample.java +++ b/src/main/java/com/docusign/core/model/DoneExample.java @@ -38,6 +38,7 @@ public class DoneExample { private String message; private String json; private StackTraceElement[] stackTrace; + private String stackTracePrinted; private Iterable diff; @@ -95,6 +96,11 @@ public DoneExample withStackTrace(StackTraceElement[] stackTrace) { return this; } + public DoneExample withStackTracePrinted(String stackTracePrinted) { + this.stackTracePrinted = stackTracePrinted; + return this; + } + /** * Creates a JSON text from the object and applies it to member * @param object the object to convert to JSON string diff --git a/src/main/webapp/WEB-INF/templates/views/error.jsp b/src/main/webapp/WEB-INF/templates/views/error.jsp index 292c5676..8abdaaf3 100644 --- a/src/main/webapp/WEB-INF/templates/views/error.jsp +++ b/src/main/webapp/WEB-INF/templates/views/error.jsp @@ -13,7 +13,7 @@

Oops, we have encountered a problem.

Message: ${done.message}

-

Dump: ${done.stackTrace}

+

Dump: ${done.stackTracePrinted}

Please check your account configuration. If you are unable to resolve the problem, open a new issue on GitHub.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp index 5b20cfe0..498ffdf2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp @@ -1,14 +1,17 @@ - <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +

Please Authenticate with DocuSign

Please choose your authentication type

-
+ +
+

From f52ab7333acaad444af4cef1c022a3f0254b2647 Mon Sep 17 00:00:00 2001 From: annahileta <80112359+annahileta@users.noreply.github.com> Date: Tue, 21 Sep 2021 15:15:15 +0300 Subject: [PATCH 203/699] changed default version of eSignature from 3.13.0-RC1 to 3.15.0-RC1 (#36) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6261a6f8..dcd50513 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 11 2.5.2 2.11.0 - 3.13.0-RC1 + 3.15.0-RC1 1.1.0-RC1 1.0.0-BETA 1.0.0-BETA From 01bc4ab48aa61eeefccda3dbb26bb3b8b4f8a3f9 Mon Sep 17 00:00:00 2001 From: annahileta Date: Fri, 24 Sep 2021 14:10:25 +0300 Subject: [PATCH 204/699] provide ability to choose multiple APIs (and get their scopes) --- src/main/java/com/docusign/WebSecurityConfig.java | 14 +++++++++++--- .../core/controller/GlobalControllerAdvice.java | 11 +++-------- .../jwt/JWTAuthorizationCodeResourceDetails.java | 5 +---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 3e9d310c..c9018b15 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -1,8 +1,11 @@ package com.docusign; +import com.docusign.common.ApiIndex; import com.docusign.core.security.OAuthProperties; import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; import com.docusign.core.security.jwt.JWTUserInfoTokenService; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.auth.OAuth; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2SsoProperties; import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties; @@ -86,11 +89,16 @@ public FilterRegistrationBean oAuth2ClientFilterRegis private List getScopes() { List scopes = null; - if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { + if (this.dsConfiguration.getApiName().contains(ApiIndex.ESIGNATURE.toString())) { + scopes = Arrays.asList(OAuth.Scope_SIGNATURE); + } + if (this.dsConfiguration.getApiName().contains(ApiIndex.ROOMS.toString())) { scopes = Arrays.asList(this.roomScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("click")) { + } + if (this.dsConfiguration.getApiName().contains(ApiIndex.CLICK.toString())) { scopes = Arrays.asList(this.clickScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("monitor")) { + } + if (this.dsConfiguration.getApiName().contains(ApiIndex.MONITOR.toString())) { scopes = Arrays.asList(this.monitorScopes); } diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 40b49ea7..1a0c905c 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -10,6 +10,8 @@ import com.docusign.core.model.User; import com.docusign.core.utils.AccountsConverter; + +import java.util.*; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; @@ -23,12 +25,6 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.context.WebApplicationContext; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Optional; - /** * This class provides common model attributes for all pages. If you want to @@ -88,8 +84,7 @@ public boolean populateShowDoc() { @ModelAttribute("locals") public Locals populateLocals() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - - ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName()); + ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName().split("\\s+")[0]); session.setApiIndexPath(apiIndex.toString()); if (!(authentication instanceof OAuth2Authentication)) { diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index ede56388..c781aca2 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -44,9 +44,6 @@ public ApiClient getApiClient() { } public List getScopeByApiName(){ -//Only signature scope is needed for eSIgnature api. Impersonation scope is implied. - return dsConfiguration.getApiName().equalsIgnoreCase("esignature") ? - Arrays.asList(OAuth.Scope_SIGNATURE) : - getScope(); + return getScope(); } } From a14f57555a5cd129c20f0cfe0a16b4258d5a7a94 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Tue, 28 Sep 2021 11:53:27 -0700 Subject: [PATCH 205/699] Consolidated phone auth (#38) * add in IDV-enabled check * jwt consent redirect fix * concat test on error.jsp for 1/2 use case Co-authored-by: meihDS <70775251+meihDS@users.noreply.github.com> --- .factorypath | 144 +++++++++--------- ...> EG020ControllerPhoneAuthentication.java} | 66 ++++++-- .../EG021ControllerPhoneAuthentication.java | 116 -------------- .../security/jwt/JWTOAuth2RestTemplate.java | 5 +- .../webapp/WEB-INF/templates/views/error.jsp | 10 +- .../views/pages/esignature/examples/eg020.jsp | 19 ++- .../views/pages/esignature/examples/eg021.jsp | 43 ------ .../views/pages/esignature/index.jsp | 35 ++--- 8 files changed, 158 insertions(+), 280 deletions(-) rename src/main/java/com/docusign/controller/eSignature/examples/{EG020ControllerSmsAuthentication.java => EG020ControllerPhoneAuthentication.java} (61%) delete mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp diff --git a/.factorypath b/.factorypath index ff1dc2ca..f72d3bae 100644 --- a/.factorypath +++ b/.factorypath @@ -1,97 +1,93 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + - - + + - + - + - - - - - - - - - + + + + + + + - - - + + + - + - + + diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java similarity index 61% rename from src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java rename to src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index 5193395d..7697c60d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerSmsAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -5,12 +5,16 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.AccountIdentityVerificationResponse; import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.RecipientSMSAuthentication; +import com.docusign.esign.model.RecipientIdentityInputOption; +import com.docusign.esign.model.RecipientIdentityPhoneNumber; +import com.docusign.esign.model.RecipientIdentityVerification; import com.docusign.esign.model.Recipients; import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; @@ -21,17 +25,17 @@ import org.springframework.web.bind.annotation.RequestMapping; import java.io.IOException; import java.util.Arrays; -import java.util.List; + import javax.servlet.http.HttpServletResponse; /** - * Send an envelope with a recipient using SMS Authentication. + * Example 020: Phone Authentication for recipient */ @Controller @RequestMapping("/eg020") -public class EG020ControllerSmsAuthentication extends AbstractEsignatureController { +public class EG020ControllerPhoneAuthentication extends AbstractEsignatureController { // For List.of you could even do groups of numbers such as List.of("415-555-1212", "415-555-3434"); private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; private static final String DOCUMENT_NAME = "Lorem"; @@ -41,8 +45,8 @@ public class EG020ControllerSmsAuthentication extends AbstractEsignatureControll @Autowired - public EG020ControllerSmsAuthentication(DSConfiguration config, Session session, User user) { - super(config, "eg020", "Signing request by email"); + public EG020ControllerPhoneAuthentication(DSConfiguration config, Session session, User user) { + super(config, "eg020", "Require Phone Authentication for a Recipient"); this.session = session; this.user = user; } @@ -57,7 +61,8 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getPhoneNumber()); + String workFlowId = getWorkflowId(accountId); + EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), args.getPhoneNumber(), workFlowId); // Step 4: Call the eSignature REST API EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); @@ -72,7 +77,7 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { + private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, String phone, String workFlowId) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); @@ -85,9 +90,22 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. signHere.setRecipientId("1"); - List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); - RecipientSMSAuthentication smsAuth = new RecipientSMSAuthentication(); - smsAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); + + RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber(); + phoneNumber.setCountryCode(countryCode); + phoneNumber.setNumber(phone); + + RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption(); + inputOption.setName("phone_number_list"); + inputOption.setValueType("PhoneNumberList"); + inputOption.setPhoneNumberList(Arrays.asList(phoneNumber)); + + RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification(); + + + identityVerifcation.setWorkflowId(workFlowId); + identityVerifcation.setInputOptions(Arrays.asList(inputOption)); + Signer signer = new Signer(); signer.setName(signerName); @@ -97,9 +115,7 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); signer.setRecipientId(signHere.getRecipientId()); signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setRequireIdLookup("true"); - signer.setSmsAuthentication(smsAuth); - signer.setIdCheckConfigurationName("SMS Auth $"); + signer.setIdentityVerification(identityVerifcation); Recipients recipients = new Recipients(); recipients.setSigners(Arrays.asList(signer)); @@ -114,5 +130,25 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe return envelope; } - // ***DS.snippet.0.end + // retreives the workflow ID + private String getWorkflowId(String accountId){ + try { + AccountsApi workflowDetails = createAccountsApi(session.getBasePath(), user.getAccessToken()); + AccountIdentityVerificationResponse workflowResponse = workflowDetails.getAccountIdentityVerification(accountId); + + // Check that idv authentication is enabled + // The workflow ID is a hard-coded value which is unique to this phone authentication workflow + if (workflowResponse.getIdentityVerification() != null) { + return "c368e411-1592-4001-a3df-dca94ac539ae"; + } else { + throw new RuntimeException("Identity Verification is not enabled for this account"); + } + + + } catch (Exception e) { + return null; + } + + } + // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java deleted file mode 100644 index 6b087d5f..00000000 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG021ControllerPhoneAuthentication.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.docusign.controller.eSignature.examples; - -import com.docusign.DSConfiguration; -import com.docusign.common.WorkArguments; -import com.docusign.core.model.DoneExample; -import com.docusign.core.model.Session; -import com.docusign.core.model.User; -import com.docusign.esign.api.EnvelopesApi; -import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Document; -import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.RecipientPhoneAuthentication; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - -/** - * Send an envelope with a recipient using Phone Authentication. - */ -@Controller -@RequestMapping("/eg021") -public class EG021ControllerPhoneAuthentication extends AbstractEsignatureController { - - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - - private final Session session; - private final User user; - - - @Autowired - public EG021ControllerPhoneAuthentication(DSConfiguration config, Session session, User user) { - super(config, "eg021", "Signing request by email"); - this.session = session; - this.user = user; - } - - @Override - // ***DS.snippet.0.start - protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) throws ApiException, IOException { - // Step 1: Construct your API headers - EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - - // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getPhoneNumber()); - - // Step 3: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); - - session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(title) - .withJsonObject(results) - .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") - .addToModel(model); - - return DONE_EXAMPLE_PAGE; - } - - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); - RecipientPhoneAuthentication phoneAuth = new RecipientPhoneAuthentication(); - phoneAuth.setRecipMayProvideNumber("true"); - phoneAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setRequireIdLookup("true"); - signer.setPhoneAuthentication(phoneAuth); - signer.setIdCheckConfigurationName("Phone Auth $"); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - envelope.setDocuments(Arrays.asList(doc)); - - return envelope; - } - // ***DS.snippet.0.end -} diff --git a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java index ad6640c6..36ad4b70 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java @@ -3,11 +3,9 @@ import com.docusign.core.exception.LauncherException; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.client.auth.OAuth; import com.docusign.esign.client.auth.OAuth.OAuthToken; import java.io.IOException; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -81,7 +79,7 @@ private OAuth2AccessToken accessToken() throws LauncherException { // Special handling for consent_required String message = e.getMessage(); String consent_url = ""; - String consent_scopes = String.join(" ", scopes) + " impersonation"; + String consent_scopes = String.join(" ", scopes) + "%20impersonation"; if (message != null && message.contains("consent_required")) { consent_url = String.format("https://%s/oauth/auth?prompt=login&response_type=code&scope=%s" + "&client_id=%s" + @@ -96,6 +94,7 @@ private OAuth2AccessToken accessToken() throws LauncherException { "\n\nIt will ask the user to login and to approve access by your application." + "\nAlternatively, an Administrator can use Organization Administration to" + "\npre-approve one or more users."); + throw new AccessTokenRequiredException(consent_url, resource); } diff --git a/src/main/webapp/WEB-INF/templates/views/error.jsp b/src/main/webapp/WEB-INF/templates/views/error.jsp index 8abdaaf3..47d0fa45 100644 --- a/src/main/webapp/WEB-INF/templates/views/error.jsp +++ b/src/main/webapp/WEB-INF/templates/views/error.jsp @@ -2,15 +2,15 @@ <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> - - +<%-- Used for consent redirect sequence --%> + - - +<%-- using ' ' instead of ':' to prevent issue with delimiter and redirect url --%> + + -

Oops, we have encountered a problem.

Message: ${done.message}

Dump: ${done.stackTracePrinted}

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp index 2525bb22..b026c486 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp @@ -1,7 +1,11 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

20. Send an envelope with a recipient using SMS Authentication.

+

20. Require Phone Authentication for a Recipient

+

Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

+

The envelope includes a PDF file. Anchor text + (AutoPlace) + is used to position the signing fields in the documents.

Documentation about this example.

@@ -17,11 +21,19 @@ +
- - Signer Country Code +
+ +
+ + +
+
- diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp deleted file mode 100644 index 1289e74a..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg021.jsp +++ /dev/null @@ -1,43 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - -

21. Send an envelope with a recipient using Phone Authentication.

- - -

Documentation about this example.

-
- -

API method used: - Envelopes::create. -

- -

- View source file ${sourceFile} on GitHub. -

- - -
- -
- - -
- -
- - - We'll never share your email with anyone else. -
-
- - -
- - -
- - diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 6b4339ef..22332843 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -9,7 +9,7 @@

Java Launcher

-

Welcome to the DocuSign Java examples using multiple OAuth flows (JWT and Authorization Code Grant).

+

Run and explore eSignature REST API code examples with Authorization Code Grant or JWT Grant authentication

@@ -37,13 +37,11 @@
-

Welcome

-

This launcher both demonstrates use of common OAuth2 grant flows and multiple usage examples from the DocuSign eSignature REST API.

Documentation on using OAuth Authorization Code Grant from a Java application.

-

Basic Examples

+

Basic examples

1. Use embedded signing

This example sends an envelope, and then uses embedded signing for the first signer. @@ -151,6 +149,8 @@ EnvelopeViews::createRecipient.

+

Payments

+

14. Send an envelope with an order form and payment field

Anchor text (AutoPlace) @@ -160,9 +160,8 @@ Envelopes::create.

+

Tabs

- -

Tabs Examples

15. Get the tab data from an envelope

This example retrieves the tab (field) values from an envelope.

@@ -193,27 +192,22 @@ EnvelopeCustomFields::list.

- +

Recipient authentication

+

19. Send an envelope with Access Code Authentication

This example sends and envelope that requires an access-code for the purpose of multi-factor authentication.

API method used: Envelopes::create.

-

20. Send an envelope with SMS Authentication

-

This example sends and envelope that requires entering in a six digit code from an text message for the purpose of multi-factor authentication.

-

API method used: - Envelopes::create. -

- -

21. Send an envelope with Phone Authentication

-

This example sends and envelope that requires entering in a voice-based response code for the purpose of multi-factor authentication.

+

20. Require Phone Authentication for a Recipient

+

Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

API method used: Envelopes::create.

22. Send an envelope with Knowledge-Based Authentication

-

This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multi-factor authentication.

+

This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multifactor authentication.

API method used: Envelopes::create.

@@ -226,6 +220,7 @@

Permissions

+

24. Create a new permission profile

@@ -235,7 +230,6 @@ API method used: AccountPermissionProfiles::create.

-

25. Setting a permission profile

This example allows you to set a permission profile on an existing user group.

@@ -244,7 +238,6 @@

26. Updating individual permission profile settings

-

This example will update individual permission settings for a given account.

@@ -258,7 +251,9 @@

API method used: AccountPermissionProfiles::create.

- + +

Brands

+

28. Create a brand

This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

API method used: @@ -335,7 +330,7 @@ Envelopes::create.

-

Premium Features

+

Premium features

35. Send with SMS Delivery

From d1c5c3d7fd3d6bfec247581ea7ab54c49f4ef4dc Mon Sep 17 00:00:00 2001 From: annahileta <80112359+annahileta@users.noreply.github.com> Date: Thu, 7 Oct 2021 12:03:42 +0300 Subject: [PATCH 206/699] Implemented code examples for Admin Api (#33) * Implemented code examples for Admin Api * Admin API Doc standards Changes * add new examples and related code files * adding gist marker snippet steps and explainer comments Co-authored-by: Aaron JacksonWilde Co-authored-by: meihDS <70775251+meihDS@users.noreply.github.com> --- .factorypath | 5 +- .gitignore | 3 + .vscode/launch.json | 21 +++ README.md | 12 +- code-examples-java.iml | 122 +++++++++++++ pom.xml | 10 +- .../java/com/docusign/DSConfiguration.java | 4 +- .../java/com/docusign/WebSecurityConfig.java | 3 + .../java/com/docusign/common/ApiIndex.java | 3 +- .../com/docusign/common/WorkArguments.java | 9 + .../admin/examples/A001AddActiveUser.java | 115 ++++++++++++ .../A002CreateActiveCLMESignUser.java | 142 +++++++++++++++ .../examples/A003BulkExportUserData.java | 115 ++++++++++++ .../examples/A003aCheckRequestStatus.java | 62 +++++++ .../examples/A004BulkImportUserData.java | 67 +++++++ .../A004CheckImportRequestStatus.java | 86 +++++++++ .../admin/examples/A005AuditUsers.java | 85 +++++++++ .../examples/AbstractAdminController.java | 168 ++++++++++++++++++ .../core/controller/AbstractController.java | 3 +- .../controller/GlobalControllerAdvice.java | 2 + .../java/com/docusign/core/model/Session.java | 7 +- .../security/jwt/JWTOAuth2RestTemplate.java | 2 +- src/main/resources/application.example.json | 1 + .../views/pages/admin/examples/a001.jsp | 67 +++++++ .../views/pages/admin/examples/a002.jsp | 92 ++++++++++ .../views/pages/admin/examples/a003.jsp | 26 +++ .../views/pages/admin/examples/a003a.jsp | 35 ++++ .../views/pages/admin/examples/a004.jsp | 26 +++ .../views/pages/admin/examples/a004a.jsp | 35 ++++ .../views/pages/admin/examples/a005.jsp | 29 +++ .../templates/views/pages/admin/index.jsp | 125 +++++++++++++ .../templates/views/pages/example_done.jsp | 11 ++ .../templates/views/pages/example_pending.jsp | 8 + 33 files changed, 1490 insertions(+), 11 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 code-examples-java.iml create mode 100644 src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/example_pending.jsp diff --git a/.factorypath b/.factorypath index f72d3bae..202e6135 100644 --- a/.factorypath +++ b/.factorypath @@ -58,7 +58,7 @@ - + @@ -84,10 +84,11 @@ - + + diff --git a/.gitignore b/.gitignore index 82e6b9da..aad69e3c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,9 @@ private.key application.properties /target/ src/main/resources/application.json +src/main/resources/application.properties +src/main/java/com/docusign/admin/ # according to gitignore.io this shouldnt be shared .factorypath +src/main/resources/ExportedUserData.csv diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..6fcb152c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Launch App", + "request": "launch", + "mainClass": "com.docusign.App", + "projectName": "code-examples-java" + }, + { + "type": "java", + "name": "Launch Java Program", + "request": "launch", + "mainClass": "" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index c9abb6f5..e87f1c54 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ### GitHub repo: [code-examples-java](./README.md) -This GitHub repo includes code examples for the DocuSign eSignature REST API, Rooms API, Click API, and Monitor API. To switch between API code examples, in the application.json file, change the `DS_API_NAME` setting from `ESIGNATURE` to `ROOMS`, `CLICK`, or `MONITOR`. +This GitHub repo includes code examples for the DocuSign Admin API, Click API, eSignature REST API, Monitor API, and Rooms API. To switch between API code examples, in the application.json file, modify the `DS_API_NAME` setting from `ESIGNATURE` to `ADMIN`, `CLICK`, `MONITOR`, or `ROOMS`, . ## Introduction @@ -50,6 +50,16 @@ For information about the scopes used for obtaining authorization to use the Mon For a list of code examples that use the Click API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/monitor-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. + +## Admin API + +**Note:** To use the Admin API, you must [create an organization](https://support.docusign.com/en/guides/org-admin-guide-create-org) in your DocuSign developer account. Also, to run the DocuSign CLM code example, [CLM must be enabled for your organization](https://support.docusign.com/en/articles/DocuSign-and-SpringCM). + +For information about the scopes used for obtaining authorization to use the Admin API, see the [scopes section](https://developers.docusign.com/docs/admin-api/admin101/auth/). + +For a list of code examples that use the Admin API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/admin-api/how-to/code-launchers/#examples-and-languages) on the DocuSign Developer Center. + + ## Installation ### Prerequisites diff --git a/code-examples-java.iml b/code-examples-java.iml new file mode 100644 index 00000000..97a72455 --- /dev/null +++ b/code-examples-java.iml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index dcd50513..edd505e8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent 2.5.3 - + com.docusign @@ -106,6 +106,12 @@ ${monitor.version} + + com.docusign + docusign-admin-java + 1.0.0-BETA + + org.projectlombok lombok @@ -126,4 +132,4 @@ - + \ No newline at end of file diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index f7dbcaa4..b4a63cba 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -54,6 +54,9 @@ public class DSConfiguration { @Value("${DS_MONITOR_BASE_PATH}") private String monitorBasePath; + @Value("${DS_ADMIN_BASE_PATH}") + private String adminBasePath; + public String getDsReturnUrl() { return appUrl + "/ds-return"; } @@ -61,5 +64,4 @@ public String getDsReturnUrl() { public String getDsPingUrl() { return appUrl + "/"; } - } diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index c9018b15..446fc5f9 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -40,6 +40,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public String roomScopes[] = new String[] {"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}; public String clickScopes[] = new String[] {"click.manage", "click.send"}; public String monitorScopes[] = new String[] {"signature", "impersonation"}; + public String adminScopes[] = new String[] {"user_write", "signature", "impersonation", "group_read", "organization_read", "permission_read", "user_read", "account_read", "domain_read", "identity_provider_read"}; @Autowired private DSConfiguration dsConfiguration; @@ -100,6 +101,8 @@ private List getScopes() { } if (this.dsConfiguration.getApiName().contains(ApiIndex.MONITOR.toString())) { scopes = Arrays.asList(this.monitorScopes); + } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("admin")) { + scopes = Arrays.asList(this.adminScopes); } return scopes; diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index e210feea..ff62fec6 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -4,7 +4,8 @@ public enum ApiIndex { ESIGNATURE("/pages/esignature/index", "/restapi"), ROOMS("/pages/rooms/index", "/restapi"), CLICK("/pages/click/index", "/clickapi"), - MONITOR("/pages/monitor/index", ""); + MONITOR("/pages/monitor/index", ""), + ADMIN("/pages/admin/index", "/management"); private final String indexPath; private final String baseUrlSuffix; diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index aea0f629..00222333 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -55,4 +55,13 @@ public class WorkArguments { private String ccPhoneNumber; private String countryCode; private String ccCountryCode; + private String email; + private String userName; + private String firstName; + private String lastName; + private String clmProfileId; + private UUID clmProductId; + private String eSignProfileId; + private UUID eSignProductId; + private UUID dsGroupId; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java new file mode 100644 index 00000000..a69337c3 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -0,0 +1,115 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.*; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.api.GroupsApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.model.GroupInformation; +import com.docusign.esign.model.PermissionProfileInformation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.HttpHeaders; +import java.util.ArrayList; +import java.util.UUID; + +/** + * Create new user + * This example demonstrates how to create a new user with methods from Admin API. + */ +@Controller +@RequestMapping("/a001") +public class A001AddActiveUser extends AbstractAdminController { + + private static final String MODEL_LIST_PROFILES = "listProfiles"; + private static final String MODEL_LIST_GROUPS = "listGroups"; + private final User user; + private final Session session; + + @Autowired + public A001AddActiveUser(DSConfiguration config, Session session, User user) { + super(config, "a001", "Create a new active eSignature user"); + this.user = user; + this.session = session; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi"); + apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); + + // Step 3 start + AccountsApi accountsApi = new AccountsApi(apiClient); + UUID orgId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), orgId); + PermissionProfileInformation permissionsInfo = accountsApi.listPermissions(String.valueOf(accountId)); + // Step 3 end + + model.addAttribute(MODEL_LIST_PROFILES, permissionsInfo.getPermissionProfiles()); + + // Step 4 start + GroupsApi groupsApi = new GroupsApi(apiClient); + GroupInformation groupInformation = groupsApi.listGroups(String.valueOf(accountId)); + // Step 4 end + + model.addAttribute(MODEL_LIST_GROUPS, groupInformation.getGroups()); + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + NewUserResponse result = createNewActiveUser(this.user.getAccessToken(), args); + + // Process results + DoneExample.createDefault(title) + .withMessage("Results from eSignUserManagement:createUser method:") + .withJsonObject(result) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + protected NewUserResponse createNewActiveUser(String accessToken, WorkArguments args) throws Exception { + // Create a users api instance + UsersApi usersApi = createUsersApi(accessToken, this.session.getBasePath()); + + // Collect ids needed for the request + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + + // Step 5 start + UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); + java.util.List groups = new ArrayList<>(); + groups.add(new GroupRequest().id(Long.valueOf(args.getGroupId()))); + + // Fill the request with data from the form + NewUserRequest accountUserRequest = new NewUserRequest() + .defaultAccountId(accountId) + .addAccountsItem( + new NewUserRequestAccountProperties() + .id(accountId) + .permissionProfile( + new PermissionProfileRequest() + .id(Long.valueOf(args.getProfileId())) + ) + .groups(groups) + ) + .email(args.getEmail()) + .userName(args.getUserName()) + .firstName(args.getFirstName()) + .lastName(args.getLastName()) + .autoActivateMemberships(true); + // Step 5 end + + // Step 6 start + return usersApi.createUser(organizationId, accountUserRequest); + // Step 6 end + } +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java new file mode 100644 index 00000000..bb61acac --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -0,0 +1,142 @@ +package com.docusign.controller.admin.examples; + +import java.util.UUID; + +import javax.servlet.http.HttpServletResponse; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.DsGroupsApi; +import com.docusign.admin.api.ProductPermissionProfilesApi; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.AddUserResponse; +import com.docusign.admin.model.DSGroupListResponse; +import com.docusign.admin.model.DSGroupRequest; +import com.docusign.admin.model.NewMultiProductUserAddRequest; +import com.docusign.admin.model.ProductPermissionProfileRequest; +import com.docusign.admin.model.ProductPermissionProfileResponse; +import com.docusign.admin.model.ProductPermissionProfilesResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Create new user This example demonstrates how to create a new user with + * methods from Admin API. + */ +@Controller +@RequestMapping("/a002") +public class A002CreateActiveCLMESignUser extends AbstractAdminController { + + + private final User user; + private final Session session; + + @Autowired + public A002CreateActiveCLMESignUser(DSConfiguration config, Session session, User user) { + + super(config, "a002", "Create new active user for CLM and eSignature"); + this.user = user; + this.session = session; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID accountId = this.getExistingAccountId(user.getAccessToken(), session.getBasePath(), organizationId); + + // Step 3 start + ProductPermissionProfilesApi permissionsInfo = this.createProductPermissionProfilesApi(user.getAccessToken(), + session.getBasePath()); + ProductPermissionProfilesResponse profiles = permissionsInfo.getProductPermissionProfiles(organizationId, + accountId); + ProductPermissionProfileResponse clmProfiles = null; + ProductPermissionProfileResponse eSignProfiles = null; + UUID clmProductId = null; + UUID eSignProductId = null; + // filter by each type per response + for (ProductPermissionProfileResponse eachOne : profiles.getProductPermissionProfiles()) { + // logger.info("ProductName = " + eachOne); + if (eachOne.getProductName().equals("CLM")) { + clmProductId = eachOne.getProductId(); + clmProfiles = eachOne; + } else { + eSignProductId = eachOne.getProductId(); + eSignProfiles = eachOne; + } + } + // Step 3 end + + // Step 4 start + DsGroupsApi groupsApi = this.createDSGroupsApi(user.getAccessToken(), session.getBasePath()); + DSGroupListResponse groups = groupsApi.getDSGroups(organizationId, accountId); + // Step 4 end + + // set CLM permission profiles + model.addAttribute("listCLM", clmProfiles); + model.addAttribute("clmProductId", clmProductId); + + // set eSign permission profiles + model.addAttribute("listeSign", eSignProfiles); + model.addAttribute("eSignProductId", eSignProductId); + + model.addAttribute("listGroups", groups); + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + AddUserResponse result = createNewActiveUser(this.user.getAccessToken(), args); + + // Process results + DoneExample.createDefault(title) + .withMessage("Results from MultiProductUserManagement:addOrUpdateUser method:") + .withJsonObject(result) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + protected AddUserResponse createNewActiveUser(String accessToken, WorkArguments args) throws Exception { + // Create a users api instance + UsersApi usersApi = createUsersApi(accessToken, this.session.getBasePath()); + + // Collect ids needed for the request + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); + + + // Step 5 start + ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest(); + ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest(); + clm.setPermissionProfileId(args.getClmProfileId()); + clm.setProductId(args.getClmProductId()); + + eSign.setPermissionProfileId(args.getESignProfileId()); + eSign.setProductId(args.getESignProductId()); + + DSGroupRequest dsGroup = new DSGroupRequest(); + dsGroup.setDsGroupId(args.getDsGroupId()); + // Fill the request with data from the form + + NewMultiProductUserAddRequest accountAddRequest = new NewMultiProductUserAddRequest() + .defaultAccountId(accountId) + .addProductPermissionProfilesItem(clm) + .addProductPermissionProfilesItem(eSign) + .addDsGroupsItem(dsGroup) + .userName(args.getUserName()) + .firstName(args.getFirstName()) + .lastName(args.getLastName()) + .autoActivateMemberships(true) + .email(args.getEmail()); + // Step 5 end + + // Step 6 start + return usersApi.addOrUpdateUser(organizationId, accountId, accountAddRequest); + // Step 6 end + } +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java new file mode 100644 index 00000000..663b3ba4 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -0,0 +1,115 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.BulkExportsApi; +import com.docusign.admin.model.OrganizationExportResponse; +import com.docusign.admin.model.OrganizationExportRequest; +import com.docusign.admin.model.OrganizationExportsResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.http.HttpHeaders; + +import javax.net.ssl.HttpsURLConnection; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.MediaType; +import java.util.concurrent.TimeUnit; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.net.URL; +import java.nio.file.Paths; + +/** + * How to bulk-export user data This example demonstrates how to bulk-export + * user data from Admin API. + */ +@Controller +@RequestMapping("/a003") +public class A003BulkExportUserData extends AbstractAdminController { + + private static final int BUFFER_SIZE = 4096; + private final Session session; + private final User user; + + @Autowired + public A003BulkExportUserData(DSConfiguration config, Session session, User user) { + super(config, "a003", "Bulk export user data"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + // Step 3 start + BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); + OrganizationExportRequest request = new OrganizationExportRequest(); + request.setType("organization_memberships_export"); + OrganizationExportResponse bulkList = bulkExportsApi.createUserListExport( + this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), request); + // Step 3 end + + TimeUnit.SECONDS.sleep(20); + + // Step 4 start + OrganizationExportResponse data = bulkExportsApi.getUserListExport( + this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), bulkList.getId()); + // Step 4 end + + // Step 5 start +String csvUri = data.getResults().get(0).getUrl(); +URL request_url = new URL(csvUri); + +// Send Web request to download and save the exported CSV data +HttpsURLConnection.setFollowRedirects(true); // Defaults to true +HttpsURLConnection http_conn = (HttpsURLConnection) request_url.openConnection(); +http_conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); +http_conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "mutlipart/form-data"); +http_conn.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); +http_conn.setInstanceFollowRedirects(true); + +ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); +String rootDir = Paths.get(rawPath.getResource("").toURI()).toString(); +// Set the save file path in the project root instead of the compiled folder and +// force forward slash scheme +rootDir = StringUtils.remove(rootDir, "target\\classes"); +rootDir = StringUtils.remove(rootDir, "file:/"); +rootDir = StringUtils.replace(rootDir, "\\", "/"); + +// opens input stream from the HTTP connection +InputStream inputStream = http_conn.getInputStream(); +String saveFilePath = rootDir + "src/main/resources/ExportedUserData.csv"; + +// opens an output stream to save into file +FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); + +int bytesRead = -1; +byte[] buffer = new byte[BUFFER_SIZE]; +while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); +} + +outputStream.close(); +inputStream.close(); +http_conn.disconnect(); + // Step 5 end + + OrganizationExportsResponse results = bulkExportsApi + .getUserListExports(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath())); + // Process results + DoneExample.createDefault(title) + .withMessage("User data exported to " + saveFilePath + "
from UserExport:getUserListExport method:") + .withJsonObject(results).addToModel(model); + return DONE_EXAMPLE_PAGE; + } + +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java new file mode 100644 index 00000000..d32705af --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -0,0 +1,62 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.BulkExportsApi; +import com.docusign.admin.model.OrganizationExportResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.util.UUID; + +/** + * Check request status + * This example demonstrates how to check request status from the Admin API. + */ +@Controller +@RequestMapping("/a003a") +public class A003aCheckRequestStatus extends AbstractAdminController { + private static final String MODEL_EXPORT_OK = "exportOk"; + + private final Session session; + private final User user; + + @Autowired + public A003aCheckRequestStatus(DSConfiguration config, Session session, User user) { + super(config, "a003a", "Check request status"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + model.addAttribute(MODEL_EXPORT_OK, StringUtils.isNotBlank(this.session.getExportId())); + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + OrganizationExportResponse result = checkRequestStatus(this.user.getAccessToken()); + + // Process results + DoneExample.createDefault(title) + .withMessage("Admin API data response output:") + .withJsonObject(result) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + protected OrganizationExportResponse checkRequestStatus(String accessToken) throws Exception { + // Create a bulk exports api instance + BulkExportsApi bulkExportsApi = createBulkExportsApi(accessToken, this.session.getBasePath()); + + return bulkExportsApi.getUserListExport(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), UUID.fromString(this.session.getExportId())); + } +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java new file mode 100644 index 00000000..763986d4 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -0,0 +1,67 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.BulkImportsApi; +import com.docusign.admin.model.OrganizationImportResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.nio.charset.StandardCharsets; +import java.util.UUID; + + +/** + * How to add users via bulk import + * This example demonstrates how to add users via bulk import from the Admin API. + */ +@Controller +@RequestMapping("/a004") +public class A004BulkImportUserData extends AbstractAdminController { + + private final Session session; + private final User user; + + @Autowired + public A004BulkImportUserData(DSConfiguration config, Session session, User user) { + super(config, "a004", "Add users via bulk import"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + + + OrganizationImportResponse result = bulkImportUserData(this.user.getAccessToken()); + + this.session.setImportId(result.getId().toString()); + + // Process results + DoneExample.createDefault(title) + .withMessage("Results from UserImport:addBulkUserImport method:") + .withJsonObject(result) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + protected OrganizationImportResponse bulkImportUserData(String accessToken) throws Exception { + // Collect ids and user data needed for the request + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); + // Make sure you're using a verified domain for auto-activation to work properly + // Step 3 start + String csvUserData = String.format("AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender", accountId, accountId); + byte[] csvDataInBytes = csvUserData.getBytes(StandardCharsets.UTF_8); + BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, this.session.getBasePath()); + + return bulkImportsApi.createBulkImportSingleAccountAddUsersRequest(organizationId, accountId, csvDataInBytes); + // Step 3 end + } +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java new file mode 100644 index 00000000..ec847d3c --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -0,0 +1,86 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.BulkImportsApi; +import com.docusign.admin.model.OrganizationImportResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.servlet.view.RedirectView; + + +import javax.servlet.http.HttpServletResponse; +import java.util.UUID; + + +/** + * Check request status + * This example demonstrates how to check request status from the Admin API. + */ +@Controller +@RequestMapping("/a004a") +public class A004CheckImportRequestStatus extends AbstractAdminController { + private static final String MODEL_IMPORT_OK = "importOk"; + private final Session session; + private final User user; + + @Autowired + public A004CheckImportRequestStatus(DSConfiguration config, Session session, User user) { + super(config, "a004a", "Check request status"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + model.addAttribute(MODEL_IMPORT_OK, StringUtils.isNotBlank(this.session.getImportId())); + } + + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + // Redirects to the front facing example to avoid a Null Pointer Exception + if(this.session.getImportId() == null){ + return new RedirectView("a004"); + } + + OrganizationImportResponse result = checkRequestStatus(this.user.getAccessToken()); + if (result.getStatus().equals("queued")){ + // Return the refresh page + DoneExample.createDefault("Request not complete") + .withMessage("The request has not completed, please refresh this page") + .addToModel(model); + return EXAMPLE_PENDING_PAGE; + + } + + + // Clear the import ID to remove 'Check Status link' from the results page + this.session.setImportId(null); + + // Process results + DoneExample.createDefault(title) + .withMessage("Admin API data response output:") + .withJsonObject(result) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + protected OrganizationImportResponse checkRequestStatus(String accessToken) throws Exception { + // Create a bulk exports api instance + BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, this.session.getBasePath()); + // Step 4a start + return bulkImportsApi.getBulkUserImportRequest(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), UUID.fromString(this.session.getImportId())); + // Step 4a end + } + +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java new file mode 100644 index 00000000..46dbea5f --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -0,0 +1,85 @@ +package com.docusign.controller.admin.examples; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.ArrayList; +import java.util.TimeZone; +import java.util.UUID; + +import javax.servlet.http.HttpServletResponse; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.api.UsersApi.GetUserProfilesOptions; +import com.docusign.admin.api.UsersApi.GetUsersOptions; +import com.docusign.admin.model.OrganizationUserResponse; +import com.docusign.admin.model.OrganizationUsersResponse; +import com.docusign.admin.model.UserDrilldownResponse; +import com.docusign.admin.model.UsersDrilldownResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * Create new user This example demonstrates how to create a new user with + * methods from Admin API. + */ +@Controller +@RequestMapping("/a005") +public class A005AuditUsers extends AbstractAdminController { + + private final User user; + private final Session session; + + @Autowired + public A005AuditUsers(DSConfiguration config, Session session, User user) { + super(config, "a005", "Audit Users"); + this.user = user; + this.session = session; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + ArrayList resultsArr = new ArrayList(); + + + // Collect ids needed for the request + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); + + UsersApi adminApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + + // Step 3 start + GetUsersOptions options = adminApi.new GetUsersOptions(); + options.setAccountId(accountId); + TimeZone tz = TimeZone.getTimeZone("UTC"); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); // Quoted "Z" to indicate UTC, no timezone offset + df.setTimeZone(tz); + String nowAsISO = df.format(new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * 10))); + options.setLastModifiedSince(nowAsISO); + OrganizationUsersResponse modifiedUsers = adminApi.getUsers(organizationId, options); + // Step 3 end + + // Step 5 start +for (OrganizationUserResponse user : modifiedUsers.getUsers()) { + GetUserProfilesOptions profilesOptions = adminApi.new GetUserProfilesOptions(); + profilesOptions.setEmail(user.getEmail()); + UsersDrilldownResponse res = adminApi.getUserProfiles(organizationId, profilesOptions); + resultsArr.add(res.getUsers().get(0)); +} + // Step 5 end + + // Process results + DoneExample.createDefault(title).withMessage("Results from eSignUserManagement:getUserProfiles method:") + .withJsonObject(resultsArr).addToModel(model); + return DONE_EXAMPLE_PAGE; + } + +} diff --git a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java new file mode 100644 index 00000000..a87ed341 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java @@ -0,0 +1,168 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.AccountsApi; +import com.docusign.admin.api.BulkExportsApi; +import com.docusign.admin.api.BulkImportsApi; +import com.docusign.admin.api.DsGroupsApi; +import com.docusign.admin.api.ProductPermissionProfilesApi; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.api.UsersApi.GetUserProfilesOptions; +import com.docusign.admin.client.ApiClient; +import com.docusign.admin.client.ApiException; +import com.docusign.admin.client.auth.AccessTokenListener; +import com.docusign.admin.client.auth.OAuth.Account; +import com.docusign.admin.client.auth.OAuth.Organization; +import com.docusign.admin.model.OrganizationAccountsRequest; +import com.docusign.admin.model.OrganizationsResponse; +import com.docusign.admin.model.ProductPermissionProfileResponse; +import com.docusign.admin.model.UsersDrilldownResponse; +import com.docusign.core.controller.AbstractController; +import com.docusign.core.model.Session; +import com.docusign.esign.api.GroupsApi; +//import com.docusign.esign.client.ApiClient; +import com.docusign.esign.api.OrganizationsApi; + +import org.springframework.http.HttpHeaders; +import org.springframework.stereotype.Controller; + +import java.util.UUID; + +/** + * Abstract base class for all Admin controllers. + */ +@Controller +public abstract class AbstractAdminController extends AbstractController { + + private final DSConfiguration configuration; + private static final String EXAMPLE_PAGES_PATH = "pages/admin/examples/"; + + public AbstractAdminController(DSConfiguration config, String exampleName, String title) { + super(config, exampleName, title); + this.configuration = config; + } + + protected String getExamplePagesPath() { + return AbstractAdminController.EXAMPLE_PAGES_PATH; + } + + /** + * Creates new instance of the Admin API client. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link ApiClient} + */ + protected static ApiClient createApiClient(String accessToken, String basePath) { + // Step 2 start + ApiClient apiClient = new ApiClient(basePath); + apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + accessToken); + // Step 2 end + + return apiClient; + } + + /** + * Creates a new instance of the UsersApi. This method + * creates an instance of the UsersApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link UsersApi} + */ + protected static UsersApi createUsersApi(String accessToken, String basePath) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new UsersApi(apiClient); + } + + /** + * Creates a new instance of the BulkExportsApi. This method + * creates an instance of the BulkExportsApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link BulkExportsApi} + */ + protected static BulkExportsApi createBulkExportsApi(String accessToken, String basePath) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new BulkExportsApi(apiClient); + } + + /** + * Creates a new instance of the BulkImportsApi. This method + * creates an instance of the BulkImportsApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link BulkImportsApi} + */ + protected static BulkImportsApi createBulkImportsApi(String accessToken, String basePath) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new BulkImportsApi(apiClient); + } + + /** + * Creates a request to get current user. + * @param accessToken user's access token + * @param basePath basePath to the server + * @param organizationId the ID of current organization + * @return the account Id + */ + protected UUID getExistingAccountId(String accessToken, String basePath, UUID organizationId) throws Exception { + UsersApi usersApi = createUsersApi(accessToken, basePath); + + // set the signer email to get an information about that user + // new GetUsersOptions() will throw "an enclosing instance that contains com.docusign.admin.api.UsersApi.GetUserProfilesOptions is required" + // at compile time. I used this workaround from stackOverflow: + // https://stackoverflow.com/a/4297913/2226328 + + GetUserProfilesOptions userProfilesOptions = usersApi.new GetUserProfilesOptions(); + userProfilesOptions.setEmail(configuration.getSignerEmail()); + + UsersDrilldownResponse user = usersApi.getUserProfiles(organizationId, userProfilesOptions); + + if (user.getUsers().isEmpty()) { + throw new Exception("Could not get an account id from the request."); + } + + return user.getUsers().get(0).getDefaultAccountId(); + } + + protected UUID getOrganizationId(String accessToken, String basePath) throws ApiException{ + UUID orgId = null; + if (session.getOrgId() == null){ + ApiClient apiClient = createApiClient(accessToken, basePath); + AccountsApi accounts = new AccountsApi(apiClient); + UUID res = accounts.getOrganizations().getOrganizations().get(0).getId(); + session.setOrgId(res); + orgId = res; + } + else { + orgId = session.getOrgId(); + } + return orgId; + } + + + /** + * Creates a new instance of the ProductPermissionProfilesApi. This method + * creates an instance of the ProductPermissionProfilesApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link ProductPermissionProfilesApi} + */ + protected ProductPermissionProfilesApi createProductPermissionProfilesApi(String accessToken, String basePath) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new ProductPermissionProfilesApi(apiClient); + } + + + /** + * Creates a new instance of the AdminGroupsApi. This method + * creates an instance of the AdminGroupsApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link AdminGroupsApi} + */ + protected DsGroupsApi createDSGroupsApi(String accessToken, String basePath) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new DsGroupsApi(apiClient); + } +} + diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index 7ac79b41..9d9d1363 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -39,13 +39,14 @@ public abstract class AbstractController { protected static final String BEARER_AUTHENTICATION = "Bearer "; protected static final String DONE_EXAMPLE_PAGE = "pages/example_done"; protected static final String DONE_EXAMPLE_PAGE_COMPARE = "pages/example_done_compare"; + protected static final String EXAMPLE_PENDING_PAGE = "pages/example_pending"; protected static final String ERROR_PAGE = "error"; @Autowired private OAuth2ClientContext oAuth2ClientContext; @Autowired - private Session session; + protected Session session; protected final String exampleName; protected final String title; diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 1a0c905c..92306d46 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -121,6 +121,8 @@ private String getBaseUrl(ApiIndex apiIndex, OAuth.Account oauthAccount) { return this.config.getClickBasePath(); } else if (apiIndex.equals(ApiIndex.MONITOR)) { return this.config.getMonitorBasePath(); + } else if (apiIndex.equals(ApiIndex.ADMIN)) { + return this.config.getAdminBasePath(); } else { return oauthAccount.getBaseUri(); } diff --git a/src/main/java/com/docusign/core/model/Session.java b/src/main/java/com/docusign/core/model/Session.java index 28256ec3..6efe8c77 100644 --- a/src/main/java/com/docusign/core/model/Session.java +++ b/src/main/java/com/docusign/core/model/Session.java @@ -8,7 +8,7 @@ import java.io.Serializable; import java.util.List; - +import java.util.UUID; @Component @Scope(value = WebApplicationContext.SCOPE_SESSION, @@ -31,5 +31,8 @@ public class Session implements Serializable { private boolean refreshToken = false; private String clickwrapId; private String clickwrapVersionNumber; - + private String exportId; + private String importId; + private UUID orgId; + public UUID bulkListId; } diff --git a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java index 36ad4b70..97aaa7b4 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java @@ -79,7 +79,7 @@ private OAuth2AccessToken accessToken() throws LauncherException { // Special handling for consent_required String message = e.getMessage(); String consent_url = ""; - String consent_scopes = String.join(" ", scopes) + "%20impersonation"; + String consent_scopes = String.join("%20", scopes) + "%20impersonation"; if (message != null && message.contains("consent_required")) { consent_url = String.format("https://%s/oauth/auth?prompt=login&response_type=code&scope=%s" + "&client_id=%s" + diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index 389e4782..57f0d818 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -9,6 +9,7 @@ "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", "DS_CLICK_BASE_PATH": "https://demo.docusign.net", "DS_MONITOR_BASE_PATH": "https://lens-d.docusign.net", + "DS_ADMIN_BASE_PATH": "https://api-d.docusign.net", "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp new file mode 100644 index 00000000..5195395a --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp @@ -0,0 +1,67 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

1. Create a new active eSignature user

+

Demonstrates how to create a new eSignature user and activate their account automatically.

+ +

Documentation about this example.

+
+ + +

API methods used: + AccountPermissionProfiles:list. + Groups:list. + eSignUserManagement:createUser. + +

+

+ View source file ${sourceFile} on GitHub. +

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ + + We'll never share your email with anyone else. +
+ +
+ + +
+ +
+ + +
+ + +
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp new file mode 100644 index 00000000..18e9e4f8 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp @@ -0,0 +1,92 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

2. Create a new active user for CLM and eSignature

+

Demonstrates how to create a new DocuSign user (valid for both CLM and eSignature) and activate their account + automatically.

+ + +

Documentation about this example. +

+
+ + +

API methods used: + MultiProductUserManagement:getProductPermissionProfiles, + MultiProductUserManagement:getDsGroups, + MultiProductUserManagement:addOrUpdateUser. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ + + We'll never share your email with anyone else. +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ + + + +
+ + +
+
+ + +
+
+
+
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp new file mode 100644 index 00000000..6e3c76fb --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp @@ -0,0 +1,26 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

3. Bulk export user data

+

Demonstrates how to bulk export user accounts within an organization into a CSV (comma separated value) file.

+ +

Documentation about this example.

+
+ + +

API methods used: + UserExport:createUserListExport, +UserExport:getUserListExport. +

+

+ View source file ${sourceFile} on GitHub. +

+ +
+ + +
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp new file mode 100644 index 00000000..74178f56 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp @@ -0,0 +1,35 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

3a. Check request status

+

Check the status of your pending request and, if complete, obtain a URL that you can call to download the CSV file containing the export data.

+ +

Documentation about this example.

+
+ + +

API method used: + UserExport:getUserListExport. +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

Uses the export information that was received during previous step

+
+ + +
+
+ +

+ Problem: please first bulk export user data using example 2.
+ Thank you. +

+
+
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp new file mode 100644 index 00000000..b6e3362f --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp @@ -0,0 +1,26 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

4. Add users via bulk import

+

Demonstrates how to bulk import users and add user data from an example CSV (comma-separated value) file into a DocuSign Admin organization.

+ +

Documentation about this example.

+
+ +

API methods used: + UserImport:addBulkUserImport, +UserImport:getBulkUserImportRequest. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ +
+ + +
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp new file mode 100644 index 00000000..d2d5a833 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp @@ -0,0 +1,35 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

4a. Check request status

+

Check the status of your pending request and, if complete, obtain a URL that you can call to download the CSV file containing the data to verify that the updates were made.

+ +

Documentation about this example.

+
+ + +

API method used: + UserImport :getBulkUserImportRequest. +

+

+ View source file ${sourceFile} on GitHub. +

+ + + +

Uses the import information that was received during previous step

+
+ + +
+
+ +

+ Problem: please first bulk import user data example 4.
+ Thank you. +

+
+
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp new file mode 100644 index 00000000..d6077b2d --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp @@ -0,0 +1,29 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + + +

5. Audit users

+

+ Demonstrates how to audit the users in your account by retrieving the profiles of users that were modified after a specified date. +

+ + + +

Documentation about this example.

+
+ +

API methods used: + Users:getUsers, + eSignUserManagement:getUserProfiles. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ +
+ + +
+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp new file mode 100644 index 00000000..a63f7f36 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp @@ -0,0 +1,125 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + + + +
+
+ + + + + + +
+

Java Launcher

+

Run and explore DocuSign Admin API code examples with Authorization Code Grant or JWT Grant authentication

+
+ +
+
+ + +
+ +

Documentation on using OAuth Authorization Code Grant from a Java application.

+
+ + +

Admin API Code Examples

+

1. Create a new active eSignature user

+

+ Demonstrates how to create a new eSignature user and activate their account automatically. +

+

+ API methods used: + AccountPermissionProfiles:list, + Groups:list, + eSignUserManagement:createUser +

+

2. Create a new active user for CLM and eSignature

+

+ Demonstrates how to create a new DocuSign user (valid for both CLM and eSignature) and activate their account automatically. +

+

+ API methods used: + MultiProductUserManagement:getProductPermissionProfiles, + MultiProductUserManagement:getDsGroups, + MultiProductUserManagement:addOrUpdateUser +

+ + + +

3. Bulk export user data

+

+ Demonstrates how to bulk export user accounts within an organization into a CSV (comma-separated value) file. +

+

+ API methods used: + UserExport:createUserListExport, + UserExport:getUserListExport +

+ + + +

4. Add users via bulk import

+

+ Demonstrates how to bulk import users and add user data from an example CSV (comma-separated value) file into a DocuSign Admin organization. +

+

+ API methods used: + UserImport:addBulkUserImport, + UserImport:getBulkUserImportRequest +

+ + + + +

5. Audit users

+

+ Demonstrates how to audit the users in your account by retrieving the profiles of users that were modified after a specified date. +

+

+ API methods used: + Users:getUsers, + eSignUserManagement:getUserProfiles +

+ + + + + + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp b/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp index 9f1609f7..ae29cb63 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp @@ -12,6 +12,17 @@

+ + + +
+ +
+
+ +

Continue

+ + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/example_pending.jsp b/src/main/webapp/WEB-INF/templates/views/pages/example_pending.jsp new file mode 100644 index 00000000..1357b250 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/example_pending.jsp @@ -0,0 +1,8 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

${done.name}

+

${done.message}

+ + + From 206abe931feaed62850fee64de5dc08a40a85b91 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Mon, 11 Oct 2021 09:52:49 -0700 Subject: [PATCH 207/699] comment marker fixes --- .../EG020ControllerPhoneAuthentication.java | 60 ++++++++++--------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index 7697c60d..f3282bf5 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -26,24 +26,22 @@ import java.io.IOException; import java.util.Arrays; - import javax.servlet.http.HttpServletResponse; - /** * Example 020: Phone Authentication for recipient */ @Controller @RequestMapping("/eg020") public class EG020ControllerPhoneAuthentication extends AbstractEsignatureController { - // For List.of you could even do groups of numbers such as List.of("415-555-1212", "415-555-3434"); + // For List.of you could even do groups of numbers such as + // List.of("415-555-1212", "415-555-3434"); private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; private static final String DOCUMENT_NAME = "Lorem"; private final Session session; private final User user; - @Autowired public EG020ControllerPhoneAuthentication(DSConfiguration config, Session session, User user) { super(config, "eg020", "Require Phone Authentication for a Recipient"); @@ -52,32 +50,36 @@ public EG020ControllerPhoneAuthentication(DSConfiguration config, Session sessio } @Override - // ***DS.snippet.0.start - protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) throws ApiException, IOException { + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) + throws ApiException, IOException { String accountId = session.getAccountId(); - // Step 2: Construct your API headers + // Step 2 start EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + // Step 2 end - // Step 3: Construct your envelope JSON body + // Step 3a start String workFlowId = getWorkflowId(accountId); - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), args.getPhoneNumber(), workFlowId); + EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), + args.getPhoneNumber(), workFlowId); + // Step 3a end - // Step 4: Call the eSignature REST API + // Step 4 start EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); + // Step 4 end session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(title) - .withJsonObject(results) - .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") + DoneExample.createDefault(title).withJsonObject(results) + .withMessage( + "The envelope has been created and sent!
Envelope ID " + results.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, String phone, String workFlowId) throws IOException { + // Step 3b start + private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, + String phone, String workFlowId) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); @@ -87,14 +89,16 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe signHere.setTabLabel("SignHereTab"); signHere.setPageNumber("1"); signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your + // own systems. + // This value is referenced in the Tabs element below to assign tabs on a + // per-recipient basis. signHere.setRecipientId("1"); RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber(); phoneNumber.setCountryCode(countryCode); phoneNumber.setNumber(phone); - + RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption(); inputOption.setName("phone_number_list"); inputOption.setValueType("PhoneNumberList"); @@ -102,11 +106,9 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification(); - identityVerifcation.setWorkflowId(workFlowId); identityVerifcation.setInputOptions(Arrays.asList(inputOption)); - Signer signer = new Signer(); signer.setName(signerName); signer.setEmail(signerEmail); @@ -130,25 +132,27 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe return envelope; } + // retreives the workflow ID - private String getWorkflowId(String accountId){ + private String getWorkflowId(String accountId) { try { AccountsApi workflowDetails = createAccountsApi(session.getBasePath(), user.getAccessToken()); - AccountIdentityVerificationResponse workflowResponse = workflowDetails.getAccountIdentityVerification(accountId); + AccountIdentityVerificationResponse workflowResponse = workflowDetails + .getAccountIdentityVerification(accountId); // Check that idv authentication is enabled - // The workflow ID is a hard-coded value which is unique to this phone authentication workflow + // The workflow ID is a hard-coded value which is unique to this phone + // authentication workflow if (workflowResponse.getIdentityVerification() != null) { return "c368e411-1592-4001-a3df-dca94ac539ae"; } else { throw new RuntimeException("Identity Verification is not enabled for this account"); } - } catch (Exception e) { return null; - } - + } + } - // ***DS.snippet.0.end + // Step 3b end } From 1de03d094ba9f7de156c209fbedb1f7c5e2ed35a Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 19 Oct 2021 17:45:55 +0300 Subject: [PATCH 208/699] provide ability to choose multiple APIs (and get their scopes) --- .../java/com/docusign/DSConfiguration.java | 7 +++--- .../java/com/docusign/WebSecurityConfig.java | 11 +++++--- .../com/docusign/common/SelectedApiTypes.java | 25 +++++++++++++++++++ .../controller/GlobalControllerAdvice.java | 3 +-- 4 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/docusign/common/SelectedApiTypes.java diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index f7dbcaa4..7b6ea993 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -1,6 +1,8 @@ package com.docusign; +import com.docusign.common.SelectedApiTypes; import lombok.Getter; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -21,8 +23,8 @@ public class DSConfiguration { @Value("${DS_APP_URL}") private String appUrl; - @Value("${DS_API_NAME}") - private String apiName; + @Autowired + private SelectedApiTypes apiName; @Value("${DS_BASE_PATH}") private String basePath; @@ -61,5 +63,4 @@ public String getDsReturnUrl() { public String getDsPingUrl() { return appUrl + "/"; } - } diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 3e9d310c..a6bb0ff3 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -86,11 +86,16 @@ public FilterRegistrationBean oAuth2ClientFilterRegis private List getScopes() { List scopes = null; - if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { + if (this.dsConfiguration.getApiName().getESIGNATURE()) { + scopes = Arrays.asList(OAuth.Scope_SIGNATURE); + } + if (this.dsConfiguration.getApiName().getROOMS()) { scopes = Arrays.asList(this.roomScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("click")) { + } + if (this.dsConfiguration.getApiName().getCLICK()) { scopes = Arrays.asList(this.clickScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("monitor")) { + } + if (this.dsConfiguration.getApiName().getMONITOR()) { scopes = Arrays.asList(this.monitorScopes); } diff --git a/src/main/java/com/docusign/common/SelectedApiTypes.java b/src/main/java/com/docusign/common/SelectedApiTypes.java new file mode 100644 index 00000000..a07d7f87 --- /dev/null +++ b/src/main/java/com/docusign/common/SelectedApiTypes.java @@ -0,0 +1,25 @@ +package com.docusign.common; + +import lombok.Getter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +@Getter +public class SelectedApiTypes { + @Value("${DS_API_NAME.ESIGNATURE}") + private Boolean ESIGNATURE; + @Value("${DS_API_NAME.ROOMS}") + private Boolean ROOMS; + @Value("${DS_API_NAME.CLICK}") + private Boolean CLICK; + @Value("${DS_API_NAME.MONITOR}") + private Boolean MONITOR; + + public String getFirstSelectedApi() { + return (ESIGNATURE)? ApiIndex.ESIGNATURE.name() + : (ROOMS)? ApiIndex.ROOMS.name() + : (CLICK)? ApiIndex.CLICK.name() + : ApiIndex.MONITOR.name(); + } +} diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 40b49ea7..7583a3d8 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -88,8 +88,7 @@ public boolean populateShowDoc() { @ModelAttribute("locals") public Locals populateLocals() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - - ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName()); + ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName().getFirstSelectedApi()); session.setApiIndexPath(apiIndex.toString()); if (!(authentication instanceof OAuth2Authentication)) { From ffc41dc50cabbf58b7e2a26aeff3c4657852e0f6 Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 19 Oct 2021 18:06:57 +0300 Subject: [PATCH 209/699] revert commit 01bc4ab48aa61eeefccda3dbb26bb3b8b4f8a3f9 --- src/main/java/com/docusign/WebSecurityConfig.java | 14 +++----------- .../core/controller/GlobalControllerAdvice.java | 11 +++++++---- .../jwt/JWTAuthorizationCodeResourceDetails.java | 5 ++++- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 446fc5f9..f4552c6e 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -1,11 +1,8 @@ package com.docusign; -import com.docusign.common.ApiIndex; import com.docusign.core.security.OAuthProperties; import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; import com.docusign.core.security.jwt.JWTUserInfoTokenService; -import com.docusign.esign.client.ApiClient; -import com.docusign.esign.client.auth.OAuth; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2SsoProperties; import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties; @@ -90,16 +87,11 @@ public FilterRegistrationBean oAuth2ClientFilterRegis private List getScopes() { List scopes = null; - if (this.dsConfiguration.getApiName().contains(ApiIndex.ESIGNATURE.toString())) { - scopes = Arrays.asList(OAuth.Scope_SIGNATURE); - } - if (this.dsConfiguration.getApiName().contains(ApiIndex.ROOMS.toString())) { + if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { scopes = Arrays.asList(this.roomScopes); - } - if (this.dsConfiguration.getApiName().contains(ApiIndex.CLICK.toString())) { + } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("click")) { scopes = Arrays.asList(this.clickScopes); - } - if (this.dsConfiguration.getApiName().contains(ApiIndex.MONITOR.toString())) { + } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("monitor")) { scopes = Arrays.asList(this.monitorScopes); } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("admin")) { scopes = Arrays.asList(this.adminScopes); diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 92306d46..0d8ce584 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -10,8 +10,6 @@ import com.docusign.core.model.User; import com.docusign.core.utils.AccountsConverter; - -import java.util.*; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; @@ -24,7 +22,11 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.context.WebApplicationContext; - +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Optional; /** * This class provides common model attributes for all pages. If you want to @@ -84,7 +86,8 @@ public boolean populateShowDoc() { @ModelAttribute("locals") public Locals populateLocals() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName().split("\\s+")[0]); + + ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName()); session.setApiIndexPath(apiIndex.toString()); if (!(authentication instanceof OAuth2Authentication)) { diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index c781aca2..9eabda15 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -44,6 +44,9 @@ public ApiClient getApiClient() { } public List getScopeByApiName(){ - return getScope(); + //Only signature scope is needed for eSIgnature api. Impersonation scope is implied. + return dsConfiguration.getApiName().equalsIgnoreCase("esignature") ? + Arrays.asList(OAuth.Scope_SIGNATURE) : + getScope(); } } From 1bab3726d9728af4df7d24ad60a7fe873cc9cefa Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 19 Oct 2021 18:31:08 +0300 Subject: [PATCH 210/699] fixed appsettings.json file --- src/main/java/com/docusign/WebSecurityConfig.java | 1 + .../security/jwt/JWTAuthorizationCodeResourceDetails.java | 4 +--- src/main/resources/application.example.json | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index a6bb0ff3..e280086b 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -3,6 +3,7 @@ import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; import com.docusign.core.security.jwt.JWTUserInfoTokenService; +import com.docusign.esign.client.auth.OAuth; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2SsoProperties; import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties; diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index ede56388..6cb561c0 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -45,8 +45,6 @@ public ApiClient getApiClient() { public List getScopeByApiName(){ //Only signature scope is needed for eSIgnature api. Impersonation scope is implied. - return dsConfiguration.getApiName().equalsIgnoreCase("esignature") ? - Arrays.asList(OAuth.Scope_SIGNATURE) : - getScope(); + return getScope(); } } diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index 389e4782..a456553f 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -4,7 +4,13 @@ "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", - "DS_API_NAME": "ESIGNATURE", + "DS_API_NAME": { + "ESIGNATURE": true, + "ROOMS": false, + "CLICK": false, + "MONITOR": false, + "ADMIN": false + }, "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", "DS_CLICK_BASE_PATH": "https://demo.docusign.net", From c346fcf406617f84670631a7c8d42d0f98b34e89 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 20 Oct 2021 11:47:20 +0300 Subject: [PATCH 211/699] Moved Admin API examples to services --- .../java/com/docusign/WebSecurityConfig.java | 2 +- .../com/docusign/common/SelectedApiTypes.java | 5 +- .../admin/examples/A001AddActiveUser.java | 51 +++-------- .../A002CreateActiveCLMESignUser.java | 54 ++++-------- .../examples/A003BulkExportUserData.java | 88 ++++++++++--------- .../examples/A003aCheckRequestStatus.java | 18 ++-- .../examples/A004BulkImportUserData.java | 23 ++--- .../A004CheckImportRequestStatus.java | 21 +++-- .../admin/examples/A005AuditUsers.java | 24 +---- .../EG020ControllerPhoneAuthentication.java | 22 +++-- .../admin/examples/AddActiveUserService.java | 56 ++++++++++++ .../admin/examples/AuditUsersService.java | 47 ++++++++++ .../examples/BulkExportUserDataService.java | 35 ++++++++ .../examples/BulkImportUserDataService.java | 23 +++++ .../CheckImportRequestStatusService.java | 18 ++++ .../examples/CheckRequestStatusService.java | 12 +++ .../CreateActiveCLMESignUserService.java | 48 ++++++++++ .../examples/SmsAuthenticationService.java | 66 -------------- 18 files changed, 360 insertions(+), 253 deletions(-) create mode 100644 src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java create mode 100644 src/main/java/com/docusign/services/admin/examples/AuditUsersService.java create mode 100644 src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java create mode 100644 src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java create mode 100644 src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java create mode 100644 src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java create mode 100644 src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java delete mode 100644 src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index cdd10b40..7d77faf8 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -99,7 +99,7 @@ private List getScopes() { } if (this.dsConfiguration.getApiName().getMONITOR()) { scopes = Arrays.asList(this.monitorScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("admin")) { + } else if (this.dsConfiguration.getApiName().getADMIN()) { scopes = Arrays.asList(this.adminScopes); } diff --git a/src/main/java/com/docusign/common/SelectedApiTypes.java b/src/main/java/com/docusign/common/SelectedApiTypes.java index a07d7f87..dc2fb5ea 100644 --- a/src/main/java/com/docusign/common/SelectedApiTypes.java +++ b/src/main/java/com/docusign/common/SelectedApiTypes.java @@ -15,11 +15,14 @@ public class SelectedApiTypes { private Boolean CLICK; @Value("${DS_API_NAME.MONITOR}") private Boolean MONITOR; + @Value("${DS_API_NAME.ADMIN}") + private Boolean ADMIN; public String getFirstSelectedApi() { return (ESIGNATURE)? ApiIndex.ESIGNATURE.name() : (ROOMS)? ApiIndex.ROOMS.name() : (CLICK)? ApiIndex.CLICK.name() - : ApiIndex.MONITOR.name(); + : (MONITOR)? ApiIndex.MONITOR.name() + : ApiIndex.ADMIN.name(); } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index a69337c3..c0cc7c78 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -12,6 +12,7 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; +import com.docusign.services.admin.examples.AddActiveUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -67,7 +68,19 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - NewUserResponse result = createNewActiveUser(this.user.getAccessToken(), args); + UUID organizationId = this.getOrganizationId( + this.user.getAccessToken(), + this.session.getBasePath()); + UUID accountId = this.getExistingAccountId( + this.user.getAccessToken(), + this.session.getBasePath(), + organizationId); + + NewUserResponse result = AddActiveUserService.addActiveUser( + args, + createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + organizationId, + accountId); // Process results DoneExample.createDefault(title) @@ -76,40 +89,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected NewUserResponse createNewActiveUser(String accessToken, WorkArguments args) throws Exception { - // Create a users api instance - UsersApi usersApi = createUsersApi(accessToken, this.session.getBasePath()); - - // Collect ids needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - - // Step 5 start - UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); - java.util.List groups = new ArrayList<>(); - groups.add(new GroupRequest().id(Long.valueOf(args.getGroupId()))); - - // Fill the request with data from the form - NewUserRequest accountUserRequest = new NewUserRequest() - .defaultAccountId(accountId) - .addAccountsItem( - new NewUserRequestAccountProperties() - .id(accountId) - .permissionProfile( - new PermissionProfileRequest() - .id(Long.valueOf(args.getProfileId())) - ) - .groups(groups) - ) - .email(args.getEmail()) - .userName(args.getUserName()) - .firstName(args.getFirstName()) - .lastName(args.getLastName()) - .autoActivateMemberships(true); - // Step 5 end - - // Step 6 start - return usersApi.createUser(organizationId, accountUserRequest); - // Step 6 end - } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index bb61acac..2fc1a0ed 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -20,6 +20,7 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.admin.examples.CreateActiveCLMESignUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -54,7 +55,8 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3 start ProductPermissionProfilesApi permissionsInfo = this.createProductPermissionProfilesApi(user.getAccessToken(), session.getBasePath()); - ProductPermissionProfilesResponse profiles = permissionsInfo.getProductPermissionProfiles(organizationId, + ProductPermissionProfilesResponse profiles = permissionsInfo.getProductPermissionProfiles( + organizationId, accountId); ProductPermissionProfileResponse clmProfiles = null; ProductPermissionProfileResponse eSignProfiles = null; @@ -91,7 +93,18 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - AddUserResponse result = createNewActiveUser(this.user.getAccessToken(), args); + // Create a users api instance + UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + + // Collect ids needed for the request + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); + + AddUserResponse result = CreateActiveCLMESignUserService.createNewActiveUser( + args, + usersApi, + organizationId, + accountId); // Process results DoneExample.createDefault(title) @@ -101,42 +114,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - protected AddUserResponse createNewActiveUser(String accessToken, WorkArguments args) throws Exception { - // Create a users api instance - UsersApi usersApi = createUsersApi(accessToken, this.session.getBasePath()); - // Collect ids needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); - - - // Step 5 start - ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest(); - ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest(); - clm.setPermissionProfileId(args.getClmProfileId()); - clm.setProductId(args.getClmProductId()); - - eSign.setPermissionProfileId(args.getESignProfileId()); - eSign.setProductId(args.getESignProductId()); - - DSGroupRequest dsGroup = new DSGroupRequest(); - dsGroup.setDsGroupId(args.getDsGroupId()); - // Fill the request with data from the form - - NewMultiProductUserAddRequest accountAddRequest = new NewMultiProductUserAddRequest() - .defaultAccountId(accountId) - .addProductPermissionProfilesItem(clm) - .addProductPermissionProfilesItem(eSign) - .addDsGroupsItem(dsGroup) - .userName(args.getUserName()) - .firstName(args.getFirstName()) - .lastName(args.getLastName()) - .autoActivateMemberships(true) - .email(args.getEmail()); - // Step 5 end - - // Step 6 start - return usersApi.addOrUpdateUser(organizationId, accountId, accountAddRequest); - // Step 6 end - } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 663b3ba4..43231781 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -10,6 +10,7 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.admin.examples.BulkExportUserDataService; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +22,7 @@ import javax.net.ssl.HttpsURLConnection; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.MediaType; +import java.util.UUID; import java.util.concurrent.TimeUnit; import java.io.File; @@ -52,59 +54,59 @@ public A003BulkExportUserData(DSConfiguration config, Session session, User user protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { // Step 3 start BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); - OrganizationExportRequest request = new OrganizationExportRequest(); - request.setType("organization_memberships_export"); - OrganizationExportResponse bulkList = bulkExportsApi.createUserListExport( - this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), request); + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + + OrganizationExportResponse bulkList = BulkExportUserDataService + .createUserListExport(bulkExportsApi, organizationId); // Step 3 end TimeUnit.SECONDS.sleep(20); // Step 4 start - OrganizationExportResponse data = bulkExportsApi.getUserListExport( - this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), bulkList.getId()); + OrganizationExportResponse data = BulkExportUserDataService + .bulkExportUserData(bulkExportsApi, organizationId, bulkList.getId()); // Step 4 end // Step 5 start -String csvUri = data.getResults().get(0).getUrl(); -URL request_url = new URL(csvUri); - -// Send Web request to download and save the exported CSV data -HttpsURLConnection.setFollowRedirects(true); // Defaults to true -HttpsURLConnection http_conn = (HttpsURLConnection) request_url.openConnection(); -http_conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); -http_conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "mutlipart/form-data"); -http_conn.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); -http_conn.setInstanceFollowRedirects(true); - -ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); -String rootDir = Paths.get(rawPath.getResource("").toURI()).toString(); -// Set the save file path in the project root instead of the compiled folder and -// force forward slash scheme -rootDir = StringUtils.remove(rootDir, "target\\classes"); -rootDir = StringUtils.remove(rootDir, "file:/"); -rootDir = StringUtils.replace(rootDir, "\\", "/"); - -// opens input stream from the HTTP connection -InputStream inputStream = http_conn.getInputStream(); -String saveFilePath = rootDir + "src/main/resources/ExportedUserData.csv"; - -// opens an output stream to save into file -FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); - -int bytesRead = -1; -byte[] buffer = new byte[BUFFER_SIZE]; -while ((bytesRead = inputStream.read(buffer)) != -1) { - outputStream.write(buffer, 0, bytesRead); -} - -outputStream.close(); -inputStream.close(); -http_conn.disconnect(); + String csvUri = data.getResults().get(0).getUrl(); + URL request_url = new URL(csvUri); + + // Send Web request to download and save the exported CSV data + HttpsURLConnection.setFollowRedirects(true); // Defaults to true + HttpsURLConnection http_conn = (HttpsURLConnection) request_url.openConnection(); + http_conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + http_conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "mutlipart/form-data"); + http_conn.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); + http_conn.setInstanceFollowRedirects(true); + + ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); + String rootDir = Paths.get(rawPath.getResource("").toURI()).toString(); + // Set the save file path in the project root instead of the compiled folder and + // force forward slash scheme + rootDir = StringUtils.remove(rootDir, "target\\classes"); + rootDir = StringUtils.remove(rootDir, "file:/"); + rootDir = StringUtils.replace(rootDir, "\\", "/"); + + // opens input stream from the HTTP connection + InputStream inputStream = http_conn.getInputStream(); + String saveFilePath = rootDir + "src/main/resources/ExportedUserData.csv"; + + // opens an output stream to save into file + FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); + + int bytesRead = -1; + byte[] buffer = new byte[BUFFER_SIZE]; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + outputStream.close(); + inputStream.close(); + http_conn.disconnect(); // Step 5 end - OrganizationExportsResponse results = bulkExportsApi - .getUserListExports(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath())); + OrganizationExportsResponse results = BulkExportUserDataService + .bulkExportsUserData(bulkExportsApi, organizationId); // Process results DoneExample.createDefault(title) .withMessage("User data exported to " + saveFilePath + "
from UserExport:getUserListExport method:") diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index d32705af..896be2b7 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -7,6 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.admin.examples.CheckRequestStatusService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -43,7 +44,15 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - OrganizationExportResponse result = checkRequestStatus(this.user.getAccessToken()); + // Create a bulk exports api instance + BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID exportId = UUID.fromString(this.session.getExportId()); + + OrganizationExportResponse result = CheckRequestStatusService.checkRequestStatus( + bulkExportsApi, + organizationId, + exportId); // Process results DoneExample.createDefault(title) @@ -52,11 +61,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected OrganizationExportResponse checkRequestStatus(String accessToken) throws Exception { - // Create a bulk exports api instance - BulkExportsApi bulkExportsApi = createBulkExportsApi(accessToken, this.session.getBasePath()); - - return bulkExportsApi.getUserListExport(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), UUID.fromString(this.session.getExportId())); - } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 763986d4..6a4e5437 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -7,6 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.admin.examples.BulkImportUserDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -37,9 +38,13 @@ public A004BulkImportUserData(DSConfiguration config, Session session, User user @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + // Collect ids and user data needed for the request + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); + BulkImportsApi bulkImportsApi = createBulkImportsApi(this.user.getAccessToken(), this.session.getBasePath()); - - OrganizationImportResponse result = bulkImportUserData(this.user.getAccessToken()); + OrganizationImportResponse result = BulkImportUserDataService + .bulkImportUserData(bulkImportsApi, organizationId, accountId); this.session.setImportId(result.getId().toString()); @@ -50,18 +55,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected OrganizationImportResponse bulkImportUserData(String accessToken) throws Exception { - // Collect ids and user data needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); - // Make sure you're using a verified domain for auto-activation to work properly - // Step 3 start - String csvUserData = String.format("AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender", accountId, accountId); - byte[] csvDataInBytes = csvUserData.getBytes(StandardCharsets.UTF_8); - BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, this.session.getBasePath()); - - return bulkImportsApi.createBulkImportSingleAccountAddUsersRequest(organizationId, accountId, csvDataInBytes); - // Step 3 end - } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index ec847d3c..08c721b8 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -7,6 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.services.admin.examples.CheckImportRequestStatusService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -53,7 +54,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return new RedirectView("a004"); } - OrganizationImportResponse result = checkRequestStatus(this.user.getAccessToken()); + // Create a bulk exports api instance + BulkImportsApi bulkImportsApi = createBulkImportsApi(this.user.getAccessToken(), this.session.getBasePath()); + + OrganizationImportResponse result = CheckImportRequestStatusService.checkRequestStatus( + bulkImportsApi, + this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), + UUID.fromString(this.session.getImportId()) + ); + if (result.getStatus().equals("queued")){ // Return the refresh page DoneExample.createDefault("Request not complete") @@ -63,7 +72,6 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse } - // Clear the import ID to remove 'Check Status link' from the results page this.session.setImportId(null); @@ -74,13 +82,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected OrganizationImportResponse checkRequestStatus(String accessToken) throws Exception { - // Create a bulk exports api instance - BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, this.session.getBasePath()); - // Step 4a start - return bulkImportsApi.getBulkUserImportRequest(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), UUID.fromString(this.session.getImportId())); - // Step 4a end - } - } diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 46dbea5f..19039df9 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -22,6 +22,7 @@ import com.docusign.core.model.User; +import com.docusign.services.admin.examples.AuditUsersService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -47,34 +48,13 @@ public A005AuditUsers(DSConfiguration config, Session session, User user) { @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - ArrayList resultsArr = new ArrayList(); - - // Collect ids needed for the request UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); UsersApi adminApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); - // Step 3 start - GetUsersOptions options = adminApi.new GetUsersOptions(); - options.setAccountId(accountId); - TimeZone tz = TimeZone.getTimeZone("UTC"); - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); // Quoted "Z" to indicate UTC, no timezone offset - df.setTimeZone(tz); - String nowAsISO = df.format(new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * 10))); - options.setLastModifiedSince(nowAsISO); - OrganizationUsersResponse modifiedUsers = adminApi.getUsers(organizationId, options); - // Step 3 end - - // Step 5 start -for (OrganizationUserResponse user : modifiedUsers.getUsers()) { - GetUserProfilesOptions profilesOptions = adminApi.new GetUserProfilesOptions(); - profilesOptions.setEmail(user.getEmail()); - UsersDrilldownResponse res = adminApi.getUserProfiles(organizationId, profilesOptions); - resultsArr.add(res.getUsers().get(0)); -} - // Step 5 end + ArrayList resultsArr = AuditUsersService.auditUsers(adminApi, organizationId, accountId); // Process results DoneExample.createDefault(title).withMessage("Results from eSignUserManagement:getUserProfiles method:") diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index f3282bf5..5278033e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -19,6 +19,7 @@ import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; +import com.docusign.services.eSignature.examples.PhoneAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -58,15 +59,18 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2 end - // Step 3a start - String workFlowId = getWorkflowId(accountId); - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), - args.getPhoneNumber(), workFlowId); - // Step 3a end - - // Step 4 start - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - // Step 4 end + // Step 2: Construct your envelope JSON body + EnvelopeDefinition envelope = PhoneAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getPhoneNumber()); + + // Step 3: Call the eSignature REST API + EnvelopeSummary results = PhoneAuthenticationService.phoneAuthentication( + envelopesApi, + session.getAccountId(), + envelope + ); session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title).withJsonObject(results) diff --git a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java new file mode 100644 index 00000000..4acffed1 --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java @@ -0,0 +1,56 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.*; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import org.springframework.ui.ModelMap; + +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.UUID; + +public class AddActiveUserService { + public static NewUserResponse addActiveUser( + WorkArguments args, + UsersApi usersApi, + UUID organizationId, + UUID accountId) throws Exception + { + return createNewActiveUser(args, usersApi, organizationId, accountId); + } + + protected static NewUserResponse createNewActiveUser( + WorkArguments args, + UsersApi usersApi, + UUID organizationId, + UUID accountId) throws Exception + { + // Step 5 start + java.util.List groups = new ArrayList<>(); + groups.add(new GroupRequest().id(Long.valueOf(args.getGroupId()))); + + // Fill the request with data from the form + NewUserRequest accountUserRequest = new NewUserRequest() + .defaultAccountId(accountId) + .addAccountsItem( + new NewUserRequestAccountProperties() + .id(accountId) + .permissionProfile( + new PermissionProfileRequest() + .id(Long.valueOf(args.getProfileId())) + ) + .groups(groups) + ) + .email(args.getEmail()) + .userName(args.getUserName()) + .firstName(args.getFirstName()) + .lastName(args.getLastName()) + .autoActivateMemberships(true); + // Step 5 end + + // Step 6 start + return usersApi.createUser(organizationId, accountUserRequest); + // Step 6 end + } +} diff --git a/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java b/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java new file mode 100644 index 00000000..5d989ff3 --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java @@ -0,0 +1,47 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.client.ApiException; +import com.docusign.admin.model.OrganizationUserResponse; +import com.docusign.admin.model.OrganizationUsersResponse; +import com.docusign.admin.model.UserDrilldownResponse; +import com.docusign.admin.model.UsersDrilldownResponse; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; + +public class AuditUsersService { + public static ArrayList auditUsers( + UsersApi usersApi, + UUID organizationId, + UUID accountId) throws ApiException + { + ArrayList resultsArr = new ArrayList(); + + // Step 3 start + UsersApi.GetUsersOptions options = usersApi.new GetUsersOptions(); + options.setAccountId(accountId); + TimeZone tz = TimeZone.getTimeZone("UTC"); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); + // Quoted "Z" to indicate UTC, no timezone offset + df.setTimeZone(tz); + String nowAsISO = df.format(new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * 10))); + options.setLastModifiedSince(nowAsISO); + OrganizationUsersResponse modifiedUsers = usersApi.getUsers(organizationId, options); + // Step 3 end + + // Step 5 start + for (OrganizationUserResponse user : modifiedUsers.getUsers()) { + UsersApi.GetUserProfilesOptions profilesOptions = usersApi.new GetUserProfilesOptions(); + profilesOptions.setEmail(user.getEmail()); + UsersDrilldownResponse res = usersApi.getUserProfiles(organizationId, profilesOptions); + resultsArr.add(res.getUsers().get(0)); + } + // Step 5 end + + return resultsArr; + } +} diff --git a/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java b/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java new file mode 100644 index 00000000..96cc14c1 --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java @@ -0,0 +1,35 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.BulkExportsApi; +import com.docusign.admin.client.ApiException; +import com.docusign.admin.model.OrganizationExportRequest; +import com.docusign.admin.model.OrganizationExportResponse; +import com.docusign.admin.model.OrganizationExportsResponse; + +import java.util.UUID; + +public class BulkExportUserDataService { + public static OrganizationExportsResponse bulkExportsUserData( + BulkExportsApi bulkExportsApi, + UUID organizationId) throws ApiException + { + return bulkExportsApi.getUserListExports(organizationId); + } + + public static OrganizationExportResponse bulkExportUserData( + BulkExportsApi bulkExportsApi, + UUID organizationId, + UUID exportId) throws ApiException + { + return bulkExportsApi.getUserListExport(organizationId, exportId); + } + + public static OrganizationExportResponse createUserListExport( + BulkExportsApi bulkExportsApi, + UUID organizationId) throws ApiException + { + OrganizationExportRequest request = new OrganizationExportRequest(); + request.setType("organization_memberships_export"); + return bulkExportsApi.createUserListExport(organizationId, request); + } +} diff --git a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java new file mode 100644 index 00000000..62bc4d7b --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java @@ -0,0 +1,23 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.BulkImportsApi; +import com.docusign.admin.model.OrganizationImportResponse; + +import java.nio.charset.StandardCharsets; +import java.util.UUID; + +public class BulkImportUserDataService { + public static OrganizationImportResponse bulkImportUserData( + BulkImportsApi bulkImportsApi, + UUID organizationId, + UUID accountId) throws Exception + { + // Make sure you're using a verified domain for auto-activation to work properly + // Step 3 start + String csvUserData = String.format("AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender", accountId, accountId); + byte[] csvDataInBytes = csvUserData.getBytes(StandardCharsets.UTF_8); + + return bulkImportsApi.createBulkImportSingleAccountAddUsersRequest(organizationId, accountId, csvDataInBytes); + // Step 3 end + } +} diff --git a/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java b/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java new file mode 100644 index 00000000..47f65120 --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java @@ -0,0 +1,18 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.BulkImportsApi; +import com.docusign.admin.model.OrganizationImportResponse; + +import java.util.UUID; + +public class CheckImportRequestStatusService { + public static OrganizationImportResponse checkRequestStatus( + BulkImportsApi bulkImportsApi, + UUID organizationId, + UUID importId) throws Exception + { + // Step 4a start + return bulkImportsApi.getBulkUserImportRequest(organizationId, importId); + // Step 4a end + } +} diff --git a/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java b/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java new file mode 100644 index 00000000..90198222 --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java @@ -0,0 +1,12 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.BulkExportsApi; +import com.docusign.admin.model.OrganizationExportResponse; + +import java.util.UUID; + +public class CheckRequestStatusService { + public static OrganizationExportResponse checkRequestStatus(BulkExportsApi bulkExportsApi, UUID organizationId, UUID exportId) throws Exception { + return bulkExportsApi.getUserListExport(organizationId, exportId); + } +} diff --git a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java new file mode 100644 index 00000000..f39952b7 --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java @@ -0,0 +1,48 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.AddUserResponse; +import com.docusign.admin.model.DSGroupRequest; +import com.docusign.admin.model.NewMultiProductUserAddRequest; +import com.docusign.admin.model.ProductPermissionProfileRequest; +import com.docusign.common.WorkArguments; + +import java.util.UUID; + +public class CreateActiveCLMESignUserService { + public static AddUserResponse createNewActiveUser( + WorkArguments args, + UsersApi usersApi, + UUID organizationId, + UUID accountId) throws Exception + { + // Step 5 start + ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest(); + ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest(); + clm.setPermissionProfileId(args.getClmProfileId()); + clm.setProductId(args.getClmProductId()); + + eSign.setPermissionProfileId(args.getESignProfileId()); + eSign.setProductId(args.getESignProductId()); + + DSGroupRequest dsGroup = new DSGroupRequest(); + dsGroup.setDsGroupId(args.getDsGroupId()); + // Fill the request with data from the form + + NewMultiProductUserAddRequest accountAddRequest = new NewMultiProductUserAddRequest() + .defaultAccountId(accountId) + .addProductPermissionProfilesItem(clm) + .addProductPermissionProfilesItem(eSign) + .addDsGroupsItem(dsGroup) + .userName(args.getUserName()) + .firstName(args.getFirstName()) + .lastName(args.getLastName()) + .autoActivateMemberships(true) + .email(args.getEmail()); + // Step 5 end + + // Step 6 start + return usersApi.addOrUpdateUser(organizationId, accountId, accountAddRequest); + // Step 6 end + } +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java deleted file mode 100644 index a2f90b37..00000000 --- a/src/main/java/com/docusign/services/eSignature/examples/SmsAuthenticationService.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.docusign.services.eSignature.examples; - -import com.docusign.controller.eSignature.examples.EnvelopeHelpers; -import com.docusign.esign.api.EnvelopesApi; -import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.*; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -public final class SmsAuthenticationService { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - - public static EnvelopeSummary smsAuthentication( - EnvelopesApi envelopesApi, - String accountId, - EnvelopeDefinition envelope - ) throws ApiException { - return envelopesApi.createEnvelope(accountId, envelope); - } - - public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); - RecipientSMSAuthentication smsAuth = new RecipientSMSAuthentication(); - smsAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setRequireIdLookup("true"); - signer.setSmsAuthentication(smsAuth); - signer.setIdCheckConfigurationName("SMS Auth $"); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - - return envelope; - } -} From 466f32f9088c32a565120be567aba4c0701d71cf Mon Sep 17 00:00:00 2001 From: annahileta Date: Mon, 1 Nov 2021 12:28:45 +0200 Subject: [PATCH 212/699] Transfer arguments without WorkArguments class --- src/main/java/com/docusign/OSDetector.java | 8 +- .../admin/examples/A001AddActiveUser.java | 7 +- .../A002CreateActiveCLMESignUser.java | 15 ++- .../examples/AbstractClickController.java | 2 +- .../C001ControllerCreateClickwrap.java | 4 +- .../C002ControllerActivateClickwrap.java | 2 +- ...03ControllerCreateNewVersionClickwrap.java | 4 +- .../C004ControllerGetListClickwraps.java | 2 +- .../C005ControllerGetClickwrapResponses.java | 2 +- .../examples/EG009ControllerUseTemplate.java | 8 +- .../EG010ControllerSendBinaryDocs.java | 4 + .../EG011ControllerEmbeddedSending.java | 10 +- .../EG013ControllerAddDocToTemplate.java | 12 ++- .../EG014ControllerCollectPayment.java | 8 +- ...019ControllerAccessCodeAuthentication.java | 6 +- .../EG029ControllerApplyBrandToEnvelope.java | 6 +- .../EG030ControllerApplyBrandToTemplate.java | 9 +- .../EG031ControllerBulkSendEnvelopes.java | 9 +- ...EG032ControllerPauseSignatureWorkflow.java | 7 +- ...034ControllerUseConditionalRecipients.java | 9 +- .../examples/EG035ControllerSMSDelivery.java | 13 ++- .../examples/M001GetMonitoringData.java | 2 +- .../controller/GlobalControllerAdvice.java | 2 +- .../security/jwt/JWTOAuth2RestTemplate.java | 4 +- .../security/jwt/JWTUserInfoTokenService.java | 2 +- .../admin/examples/AddActiveUserService.java | 37 +++++-- .../examples/BulkImportUserDataService.java | 5 +- .../examples/CheckRequestStatusService.java | 6 +- .../CreateActiveCLMESignUserService.java | 28 ++++-- .../examples/GetListClickwrapsService.java | 3 +- .../AccessCodeAuthenticationService.java | 13 ++- .../examples/AddDocToTemplateService.java | 99 ++++++++++++++----- .../examples/ApplyBrandToEnvelopeService.java | 12 ++- .../examples/ApplyBrandToTemplateService.java | 21 ++-- .../examples/BulkSendEnvelopesService.java | 47 +++++++-- .../examples/CollectPaymentService.java | 17 ++-- .../examples/CreateTemplateService.java | 12 ++- .../examples/EmbeddedSendingService.java | 26 ++++- .../examples/EmbeddedSigningService.java | 6 +- .../EnvelopeCustomFieldValuesService.java | 3 +- .../examples/EnvelopeDocsService.java | 6 +- .../examples/EnvelopeGetDocService.java | 3 +- .../examples/EnvelopeInfoService.java | 6 +- .../examples/EnvelopeRecipientsService.java | 6 +- .../examples/GetTabValuesService.java | 6 +- .../examples/IdvAuthenticationService.java | 7 +- .../examples/KBAAuthenticationService.java | 5 +- .../PauseSignatureWorkflowService.java | 15 ++- .../examples/PermissionCreateService.java | 6 +- .../examples/PermissionDeleteService.java | 3 +- .../examples/PhoneAuthenticationService.java | 6 +- .../examples/SMSDeliveryService.java | 31 ++++-- .../examples/SendBinaryDocsService.java | 46 +++++++-- .../examples/SetTabValuesService.java | 10 +- .../examples/SetTemplateTabValuesService.java | 33 ++++--- .../examples/SigningViaEmailService.java | 26 +++-- .../UseConditionalRecipientsService.java | 71 ++++++++++--- .../examples/UseTemplateService.java | 24 +++-- .../examples/AddingFormsToRoomService.java | 3 +- .../AssignFormToFormGroupService.java | 3 +- .../CreateExternalFormFillSessionService.java | 3 +- .../examples/CreateFormGroupService.java | 3 +- .../rooms/examples/CreateRoomService.java | 7 +- .../CreateRoomWithTemplateService.java | 3 +- .../ExportingDataFromRoomService.java | 3 +- .../examples/GetRoomsWithFiltersService.java | 3 +- .../GrantOfficeAccessToFormGroupService.java | 3 +- 67 files changed, 620 insertions(+), 213 deletions(-) diff --git a/src/main/java/com/docusign/OSDetector.java b/src/main/java/com/docusign/OSDetector.java index 2cdcb25a..358aba40 100644 --- a/src/main/java/com/docusign/OSDetector.java +++ b/src/main/java/com/docusign/OSDetector.java @@ -6,9 +6,9 @@ */ public class OSDetector { - private static boolean isWindows; - private static boolean isLinux; - private static boolean isMac; + private static final boolean isWindows; + private static final boolean isLinux; + private static final boolean isMac; static { @@ -20,6 +20,6 @@ public class OSDetector public static boolean isWindows() { return isWindows; } public static boolean isLinux() { return isLinux; } - public static boolean isMac() { return isMac; }; + public static boolean isMac() { return isMac; } } \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index c0cc7c78..29b9aeac 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -77,7 +77,12 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse organizationId); NewUserResponse result = AddActiveUserService.addActiveUser( - args, + args.getGroupId(), + args.getProfileId(), + args.getEmail(), + args.getUserName(), + args.getFirstName(), + args.getLastName(), createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), organizationId, accountId); diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 2fc1a0ed..3b0c54bd 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -98,10 +98,21 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Collect ids needed for the request UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); + UUID accountId = this.getExistingAccountId( + this.user.getAccessToken(), + this.session.getBasePath(), o + rganizationId); AddUserResponse result = CreateActiveCLMESignUserService.createNewActiveUser( - args, + args.getClmProfileId(), + args.getClmProductId(), + args.getESignProfileId(), + args.getESignProductId(), + args.getDsGroupId(), + args.getUserName(), + args.getFirstName(), + args.getLastName(), + args.getEmail(), usersApi, organizationId, accountId); diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index accbdcdd..9bc95de7 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -66,7 +66,7 @@ protected boolean isClickwrapExistsAndActive(String basePath, String userAccessT if (StringUtils.isNotBlank(clickwrapId)) { - AccountsApi accountsApi = this.createAccountsApiClient(basePath, userAccessToken); + AccountsApi accountsApi = createAccountsApiClient(basePath, userAccessToken); ClickwrapVersionResponse clickwrapResponse = accountsApi.getClickwrap(accountId, clickwrapId); isClickwrapOk = clickwrapResponse.getClickwrapId().equals(clickwrapId) && diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 8fa43eb5..f6dc5b76 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -46,7 +46,7 @@ public C001ControllerCreateClickwrap(DSConfiguration config, Session session, Us protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { // Step 2. Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3. Construct the request body for your clickwrap ClickwrapRequest clickwrapRequest = CreateClickwrapService.createClickwrapRequest( @@ -61,7 +61,7 @@ protected Object doWork(WorkArguments args, ModelMap model, clickwrapRequest); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); - this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) .withMessage("The clickwrap has been created!
Clickwrap ID " + createdClickwrap.getClickwrapId() + ".") diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index 3e7ce8bd..1ad0943c 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -47,7 +47,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); ClickwrapVersionSummaryResponse updatedClickwrap = ActivateClickwrapService.activateClickwrap( accountsApi, diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index c5732724..2cb996a2 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -54,7 +54,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); ClickwrapVersionSummaryResponse createdClickwrap = CreateNewVersionClickwrapService.createNewVersionClickwrap( accountsApi, @@ -64,7 +64,7 @@ protected Object doWork(WorkArguments args, ModelMap model, ); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); - this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) .withMessage("The new clickwrap version has been created!
" diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index e55e9be1..e7292db4 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -38,7 +38,7 @@ public C004ControllerGetListClickwraps(DSConfiguration config, Session session, protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); ClickwrapVersionsResponse clickwrapsResponse = GetListClickwrapsService.getListClickwrap( accountsApi, diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index eccc85ee..ebb655a4 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -38,7 +38,7 @@ public C005ControllerGetClickwrapResponses(DSConfiguration config, Session sessi protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Call the v1 Click API ClickwrapAgreementsResponse clickwrapAgreementsResponse = GetClickwrapResponsesService.getClickwrapResponses( diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index b8d85a5b..3fc777ca 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -63,7 +63,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = UseTemplateService.makeEnvelope(args); + EnvelopeDefinition envelope = UseTemplateService.makeEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getCcEmail(), + args.getCcName(), + args.getTemplateId() + ); EnvelopeSummary result = UseTemplateService.createEnvelopeTemplate( envelopesApi, session.getAccountId(), diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index 4f746c81..be0d19be 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -70,6 +70,10 @@ public EG010ControllerSendBinaryDocs(DSConfiguration config, Session session, Us protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException { String responseString = SendBinaryDocsService.sendBinaryDocs( args, + args.getSignerName(), + args.getSignerEmail(), + args.getCcName(), + args.getCcEmail(), session.getBasePath(), session.getAccountId(), user.getAccessToken() diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index 9f1e0158..aeef77e0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -53,7 +53,15 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. Make the envelope with "created" (draft) status - EnvelopeSummary results = EmbeddedSendingService.createEnvelopeWithDraftStatus(envelopesApi, args, accountId); + EnvelopeSummary results = EmbeddedSendingService.createEnvelopeWithDraftStatus( + envelopesApi, + args.getSignerEmail(), + args.getSignerName(), + args.getCcEmail(), + args.getCcName(), + args.getStatus(), + args, + accountId); String envelopeId = results.getEnvelopeId(); // Step 2. Create the sender view. diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index cc135c4a..584ffcac 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -45,7 +45,6 @@ public class EG013ControllerAddDocToTemplate extends AbstractEsignatureController { private static final String MODEL_LIST_TEMPLATE = "listTemplates"; - private static final String SIGNER_CLIENT_ID = "1000"; private final Session session; private final User user; @@ -75,11 +74,16 @@ protected Object doWork(WorkArguments args, ModelMap model, ViewUrl viewUrl = AddDocToTemplateService.addDocumentToTemplate( envelopesApi, - args, + args.getSignerEmail(), + args.getSignerName(), + args.getSignerClientId(), + args.getCcEmail(), + args.getCcName(), + args.getTemplateId(), + accountId, config.getDsReturnUrl(), config.getDsPingUrl(), - SIGNER_CLIENT_ID, - accountId + args ); return new RedirectView(viewUrl.getUrl()); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 8b633738..8b42c893 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -63,10 +63,14 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 1. Make the envelope request body EnvelopeDefinition envelope = CollectPaymentService.makeEnvelope( - args, + args.getSignerEmail(), + args.getSignerName(), + args.getCcName(), + args.getCcEmail(), config.getGatewayAccountId(), config.getGatewayName(), - config.getGatewayDisplayName()); + config.getGatewayDisplayName(), + args); // Step 2. call Envelopes::create API method EnvelopeSummary results = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index 5def9a69..29173f14 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -52,7 +52,11 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = AccessCodeAuthenticationService.createEnvelope(args); + EnvelopeDefinition envelope = AccessCodeAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getAccessCode() + ); // Step 3: Call the eSignature REST API EnvelopeSummary results = AccessCodeAuthenticationService.accessCodeAuthentication( diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index a001a74c..6d2a6527 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -66,7 +66,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = ApplyBrandToEnvelopeService.makeEnvelope(args); + EnvelopeDefinition envelope = ApplyBrandToEnvelopeService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getBrandId() + ); // Step 5: Call the eSignature REST API EnvelopeSummary envelopeSummary = ApplyBrandToEnvelopeService.applyBrandToEnvelope( diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index e426ba29..e0e26f9a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -78,7 +78,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = ApplyBrandToTemplateService.makeEnvelope(args); + EnvelopeDefinition envelope = ApplyBrandToTemplateService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getCcEmail(), + args.getCcName(), + args.getTemplateId(), + args.getBrandId() + ); // Step 5: Call the eSignature REST API EnvelopeSummary envelopeSummary = ApplyBrandToTemplateService.applyBrandToTemplate( diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index 4d809243..2c0c7153 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -55,7 +55,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String batchId = BulkSendEnvelopesService.bulkSendEnvelopes( bulkEnvelopesApi, apiClient, - args, + args.getSignerName(), + args.getSignerEmail(), + args.getCcName(), + args.getCcEmail(), + args.getSignerName2(), + args.getSignerEmail2(), + args.getCcName2(), + args.getCcEmail2(), accountId ); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index cb305f62..f69e1bb9 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -46,7 +46,12 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = PauseSignatureWorkflowService.createEnvelope(args); + EnvelopeDefinition envelope = PauseSignatureWorkflowService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getSignerName2(), + args.getSignerEmail2() + ); // Step 4: Call the eSignature REST API EnvelopeSummary results = PauseSignatureWorkflowService.pauseSignatureWorkflow( diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index e16e093e..5551bbcc 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -49,7 +49,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = UseConditionalRecipientsService.createEnvelope(args); + EnvelopeDefinition envelope = UseConditionalRecipientsService.createEnvelope( + args.getSignerNotCheckedName(), + args.getSignerNotCheckedEmail(), + args.getSignerCheckedName(), + args.getSignerCheckedEmail(), + args.getSignerName(), + args.getSignerEmail() + ); // Step 4: Call the eSignature REST API try { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java index 9f220e6a..147c02d1 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java @@ -65,7 +65,18 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = SMSDeliveryService.makeEnvelope(args); + EnvelopeDefinition envelope = SMSDeliveryService.makeEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getCountryCode(), + args.getPhoneNumber(), + args.getCcEmail(), + args.getCcName(), + args.getCcCountryCode(), + args.getCcPhoneNumber(), + args.getStatus(), + args + ); EnvelopeSummary results = SMSDeliveryService.smsDelivery( envelopesApi, session.getAccountId(), diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index c3e1fcf1..5a372f46 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -46,7 +46,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse accessToken = ensureUsageOfJWTToken(accessToken, this.session); // step 1 end - JSONArray result = GetMonitoringDataService.getMonitoringData(this.createDataSetApi(accessToken, this.session)); + JSONArray result = GetMonitoringDataService.getMonitoringData(createDataSetApi(accessToken, this.session)); // Cleaning the data from wrong symbols String resultCleaned = result.toString().replaceAll("'", ""); diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 68cdadc4..b3d7874c 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -53,7 +53,7 @@ public class GlobalControllerAdvice { private final Session session; private final User user; private Optional account; - private AuthType authTypeSelected = AuthType.AGC; + private final AuthType authTypeSelected = AuthType.AGC; @Autowired public GlobalControllerAdvice(DSConfiguration config, Session session, User user, Optional account) { diff --git a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java index 97aaa7b4..61acf12f 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java @@ -26,7 +26,7 @@ public class JWTOAuth2RestTemplate extends OAuth2RestTemplate { private final JWTAuthorizationCodeResourceDetails resource; private final OAuth2ClientContext context; - private ApiClient apiClient; + private final ApiClient apiClient; public JWTOAuth2RestTemplate(JWTAuthorizationCodeResourceDetails resource, OAuth2ClientContext context) { super(resource, context); @@ -66,7 +66,7 @@ private OAuth2AccessToken accessToken() throws LauncherException { throw new AccessTokenRequiredException(e.getMessage(), resource); } - apiClient.setOAuthBasePath((String) resource.getBaseUrl()); + apiClient.setOAuthBasePath(resource.getBaseUrl()); OAuthToken oAuthToken; try { oAuthToken = apiClient.requestJWTUserToken( diff --git a/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java b/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java index febb7ea5..d8fef83f 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java @@ -25,7 +25,7 @@ public class JWTUserInfoTokenService implements ResourceServerTokenServices { private static final String AUTHORITIES = "ROLE_USER"; private final JWTAuthorizationCodeResourceDetails resource; - private ApiClient apiClient; + private final ApiClient apiClient; public JWTUserInfoTokenService(JWTAuthorizationCodeResourceDetails resource) { this.resource = resource; diff --git a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java index 4acffed1..fbb7ff25 100644 --- a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java +++ b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java @@ -12,23 +12,42 @@ public class AddActiveUserService { public static NewUserResponse addActiveUser( - WorkArguments args, + String groupId, + String profileId, + String email, + String userName, + String firstName, + String lastName, UsersApi usersApi, UUID organizationId, UUID accountId) throws Exception { - return createNewActiveUser(args, usersApi, organizationId, accountId); + return createNewActiveUser( + groupId, + profileId, + email, + userName, + firstName, + lastName, + usersApi, + organizationId, + accountId); } protected static NewUserResponse createNewActiveUser( - WorkArguments args, + String groupId, + String profileId, + String email, + String userName, + String firstName, + String lastName, UsersApi usersApi, UUID organizationId, UUID accountId) throws Exception { // Step 5 start java.util.List groups = new ArrayList<>(); - groups.add(new GroupRequest().id(Long.valueOf(args.getGroupId()))); + groups.add(new GroupRequest().id(Long.valueOf(groupId))); // Fill the request with data from the form NewUserRequest accountUserRequest = new NewUserRequest() @@ -38,14 +57,14 @@ protected static NewUserResponse createNewActiveUser( .id(accountId) .permissionProfile( new PermissionProfileRequest() - .id(Long.valueOf(args.getProfileId())) + .id(Long.valueOf(profileId)) ) .groups(groups) ) - .email(args.getEmail()) - .userName(args.getUserName()) - .firstName(args.getFirstName()) - .lastName(args.getLastName()) + .email(email) + .userName(userName) + .firstName(firstName) + .lastName(lastName) .autoActivateMemberships(true); // Step 5 end diff --git a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java index 62bc4d7b..623dd670 100644 --- a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java +++ b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java @@ -14,7 +14,10 @@ public static OrganizationImportResponse bulkImportUserData( { // Make sure you're using a verified domain for auto-activation to work properly // Step 3 start - String csvUserData = String.format("AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender", accountId, accountId); + String csvUserData = String.format( + "AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender", + accountId, + accountId); byte[] csvDataInBytes = csvUserData.getBytes(StandardCharsets.UTF_8); return bulkImportsApi.createBulkImportSingleAccountAddUsersRequest(organizationId, accountId, csvDataInBytes); diff --git a/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java b/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java index 90198222..e9c7f7f9 100644 --- a/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java +++ b/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java @@ -6,7 +6,11 @@ import java.util.UUID; public class CheckRequestStatusService { - public static OrganizationExportResponse checkRequestStatus(BulkExportsApi bulkExportsApi, UUID organizationId, UUID exportId) throws Exception { + public static OrganizationExportResponse checkRequestStatus( + BulkExportsApi bulkExportsApi, + UUID organizationId, + UUID exportId) throws Exception + { return bulkExportsApi.getUserListExport(organizationId, exportId); } } diff --git a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java index f39952b7..d6478506 100644 --- a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java +++ b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java @@ -11,7 +11,15 @@ public class CreateActiveCLMESignUserService { public static AddUserResponse createNewActiveUser( - WorkArguments args, + String clmProfileId, + UUID clmProductId, + String eSignProfileId, + UUID eSignProductId, + UUID dsGroupId, + String userName, + String firstName, + String lastName, + String email, UsersApi usersApi, UUID organizationId, UUID accountId) throws Exception @@ -19,14 +27,14 @@ public static AddUserResponse createNewActiveUser( // Step 5 start ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest(); ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest(); - clm.setPermissionProfileId(args.getClmProfileId()); - clm.setProductId(args.getClmProductId()); + clm.setPermissionProfileId(clmProfileId); + clm.setProductId(clmProductId); - eSign.setPermissionProfileId(args.getESignProfileId()); - eSign.setProductId(args.getESignProductId()); + eSign.setPermissionProfileId(eSignProfileId); + eSign.setProductId(eSignProductId); DSGroupRequest dsGroup = new DSGroupRequest(); - dsGroup.setDsGroupId(args.getDsGroupId()); + dsGroup.setDsGroupId(dsGroupId); // Fill the request with data from the form NewMultiProductUserAddRequest accountAddRequest = new NewMultiProductUserAddRequest() @@ -34,11 +42,11 @@ public static AddUserResponse createNewActiveUser( .addProductPermissionProfilesItem(clm) .addProductPermissionProfilesItem(eSign) .addDsGroupsItem(dsGroup) - .userName(args.getUserName()) - .firstName(args.getFirstName()) - .lastName(args.getLastName()) + .userName(userName) + .firstName(firstName) + .lastName(lastName) .autoActivateMemberships(true) - .email(args.getEmail()); + .email(email); // Step 5 end // Step 6 start diff --git a/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java b/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java index 9e4180c2..80bdb476 100644 --- a/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java +++ b/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java @@ -7,7 +7,8 @@ public final class GetListClickwrapsService { public static ClickwrapVersionsResponse getListClickwrap( AccountsApi accountsApi, - String accountId) throws ApiException { + String accountId) throws ApiException + { // Step 3: Call the v1 Click API return accountsApi.getClickwraps(accountId); } diff --git a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java index 484d7756..74427075 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java @@ -21,7 +21,12 @@ public static EnvelopeSummary accessCodeAuthentication( return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail, + String accessCode + ) throws IOException + { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); @@ -36,14 +41,14 @@ public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOExc signHere.setRecipientId("1"); Signer signer = new Signer(); - signer.setName(args.getSignerName()); - signer.setEmail(args.getSignerEmail()); + signer.setName(signerName); + signer.setEmail(signerEmail); signer.setRoutingOrder("1"); signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); signer.setRecipientId(signHere.getRecipientId()); signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setAccessCode(args.getAccessCode()); + signer.setAccessCode(accessCode); Recipients recipients = new Recipients(); recipients.setSigners(Arrays.asList(signer)); diff --git a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java index e1317214..cdeb57af 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.util.Arrays; +import java.util.UUID; public final class AddDocToTemplateService { private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl"; @@ -18,16 +19,27 @@ public final class AddDocToTemplateService { public static ViewUrl addDocumentToTemplate( EnvelopesApi envelopesApi, - WorkArguments args, + String signerEmail, + String signerName, + String signerClientId, + String ccEmail, + String ccName, + String templateId, + String accountId, String dsReturnUrl, String dsPingUrl, - String signerId, - String accountId) throws ApiException, IOException { + WorkArguments args + ) throws ApiException, IOException { // Step 2 start - args.setDsReturnUrl(dsReturnUrl); - args.setDsPingUrl(dsPingUrl); - args.setSignerClientId(signerId); - EnvelopeDefinition envelope = AddDocToTemplateService.makeEnvelope(args); + EnvelopeDefinition envelope = AddDocToTemplateService.makeEnvelope( + signerEmail, + signerName, + signerClientId, + ccEmail, + ccName, + templateId, + args + ); // Step 2 end // Step 3 start @@ -35,24 +47,36 @@ public static ViewUrl addDocumentToTemplate( // Step 3 end // Step 4 start - RecipientViewRequest viewRequest = AddDocToTemplateService.makeRecipientViewRequest(args); + RecipientViewRequest viewRequest = AddDocToTemplateService.makeRecipientViewRequest( + dsReturnUrl, + signerEmail, + signerName, + signerClientId, + dsPingUrl + ); return envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); } - public static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) { + public static RecipientViewRequest makeRecipientViewRequest( + String dsReturnUrl, + String signerEmail, + String signerName, + String signerClientId, + String dsPingUrl + ) { RecipientViewRequest viewRequest = new RecipientViewRequest(); // Set the url where you want the recipient to go once they are done signing // should typically be a callback route somewhere in your app. - viewRequest.setReturnUrl(args.getDsReturnUrl()); + viewRequest.setReturnUrl(dsReturnUrl); // How has your app authenticated the user? In addition to your app's // authentication, you can include authenticate steps from DocuSign. // Eg, SMS authentication viewRequest.setAuthenticationMethod("none"); // Recipient information must match embedded recipient info // we used to create the envelope. - viewRequest.setEmail(args.getSignerEmail()); - viewRequest.setUserName(args.getSignerName()); - viewRequest.setClientUserId(args.getSignerClientId()); + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(signerClientId); // DocuSign recommends that you redirect to DocuSign for the // embedded signing. There are multiple ways to save state. @@ -61,7 +85,7 @@ public static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address viewRequest.setPingFrequency("600"); - viewRequest.setPingUrl(args.getDsPingUrl()); + viewRequest.setPingUrl(dsPingUrl); return viewRequest; } @@ -69,11 +93,19 @@ public static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) // The envelope request object uses Composite Template to include in the envelope: // 1. A template stored on the DocuSign service // 2. An additional document which is a custom HTML source document - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String signerClientId, + String ccEmail, + String ccName, + String templateId, + WorkArguments args + ) throws IOException { // Create a signer and cc recipients for the signer role of the server template CarbonCopy cc1 = new CarbonCopy(); - cc1.setEmail(args.getCcEmail()); - cc1.setName(args.getCcName()); + cc1.setEmail(ccEmail); + cc1.setName(ccName); cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); cc1.setRecipientId("2"); @@ -82,18 +114,31 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep compTemplate1.setCompositeTemplateId("1"); ServerTemplate serverTemplates = new ServerTemplate(); serverTemplates.setSequence("1"); - serverTemplates.setTemplateId(args.getTemplateId()); + serverTemplates.setTemplateId(templateId); compTemplate1.setServerTemplates(Arrays.asList(serverTemplates)); // Add the roles via an inlineTemplate InlineTemplate inlineTemplate = new InlineTemplate(); inlineTemplate.setSequence("2"); - inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients(createSigner(args), cc1)); + inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients( + createSigner( + signerEmail, + signerName, + signerClientId + ), + cc1)); compTemplate1.setInlineTemplates(Arrays.asList(inlineTemplate)); // The signer recipient for the added document with a tab definition: - Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); - Signer signer1AddedDoc = createSigner(args); + Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab( + "**signature_1**", + ANCHOR_OFFSET_Y, + ANCHOR_OFFSET_X); + Signer signer1AddedDoc = createSigner( + signerEmail, + signerName, + signerClientId + ); signer1AddedDoc.setTabs(signer1Tabs); // create the HTML document @@ -117,13 +162,17 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep } // Adding clientUserId transforms the template recipient into an embedded recipient - private static Signer createSigner(WorkArguments args) { + private static Signer createSigner( + String signerEmail, + String signerName, + String signerClientId + ) { Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); + signer.setEmail(signerEmail); + signer.setName(signerName); signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); signer.setRecipientId("1"); - signer.setClientUserId(args.getSignerClientId()); + signer.setClientUserId(signerClientId); return signer; } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java index 8867b617..77a093e1 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java @@ -27,15 +27,19 @@ public static EnvelopeSummary applyBrandToEnvelope( // Creates an envelope. The envelope has one recipient who should sign an // attached document. Attached document is read from a local directory. // Also the envelope contains a brand Id which is created on EG028 example. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String brandId + ) throws IOException { // Reads a file from a local directory and create Document object. Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); // Create a signer recipient to sign the document and associate sign tab Tabs tabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); Signer signer = new Signer() - .email(args.getSignerEmail()) - .name(args.getSignerName()) + .email(signerEmail) + .name(signerName) .recipientId("1") .routingOrder("1") .tabs(tabs); @@ -49,7 +53,7 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep .emailSubject("EG029. Please Sign") .documents(List.of(document)) .recipients(recipients) - .brandId(args.getBrandId()) + .brandId(brandId) .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java index 6f9facf5..1c0b8551 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java @@ -19,21 +19,28 @@ public static EnvelopeSummary applyBrandToTemplate( return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition makeEnvelope(WorkArguments args) { + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String templateId, + String brandId + ) { TemplateRole signer = new TemplateRole() - .email(args.getSignerEmail()) - .name(args.getSignerName()) + .email(signerEmail) + .name(signerName) .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); TemplateRole cc = new TemplateRole() - .email(args.getCcEmail()) - .name(args.getCcName()) + .email(ccEmail) + .name(ccName) .roleName(EnvelopeHelpers.CC_ROLE_NAME); return new EnvelopeDefinition() - .templateId(args.getTemplateId()) + .templateId(templateId) .templateRoles(Arrays.asList(signer, cc)) - .brandId(args.getBrandId()) + .brandId(brandId) .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java index c4c4c4c6..b1bd1420 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java @@ -22,16 +22,34 @@ public final class BulkSendEnvelopesService { public static String bulkSendEnvelopes( BulkEnvelopesApi bulkEnvelopesApi, ApiClient apiClient, - WorkArguments args, + String signerName, + String signerEmail, + String ccName, + String ccEmail, + String signerName2, + String signerEmail2, + String ccName2, + String ccEmail2, String accountId ) throws ApiException, IOException { // Step 3. Submit a bulk list - BulkSendingList sendingList = BulkSendEnvelopesService.getSendingList(args); + BulkSendingList sendingList = BulkSendEnvelopesService.getSendingList( + signerName, + signerEmail, + ccName, + ccEmail, + signerName2, + signerEmail2, + ccName2, + ccEmail2 + ); String bulkListId = bulkEnvelopesApi.createBulkSendList(accountId, sendingList).getListId(); // Step 4. Create an envelope EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - String envelopeId = envelopesApi.createEnvelope(accountId, BulkSendEnvelopesService.makeEnvelope()).getEnvelopeId(); + String envelopeId = envelopesApi.createEnvelope( + accountId, + BulkSendEnvelopesService.makeEnvelope()).getEnvelopeId(); // Step 5. Attach your bulk list ID to the envelope CustomFields customFields = BulkSendEnvelopesService.createCustomFields(bulkListId); @@ -46,18 +64,31 @@ public static String bulkSendEnvelopes( return bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); } - public static BulkSendingList getSendingList(WorkArguments args) { + public static BulkSendingList getSendingList( + String signerName, + String signerEmail, + String ccName, + String ccEmail, + String signerName2, + String signerEmail2, + String ccName2, + String ccEmail2 + ) { List copies = List.of( - createBulkSending(args.getSignerName(), args.getSignerEmail(), args.getCcName(), args.getCcEmail()), - createBulkSending(args.getSignerName2(), args.getSignerEmail2(), args.getCcName2(), args.getCcEmail2()) + createBulkSending(signerName, signerEmail, ccName, ccEmail), + createBulkSending(signerName2, signerEmail2, ccName2, ccEmail2) ); return new BulkSendingList() .name("sample.csv") .bulkCopies(copies); } - private static BulkSendingCopy createBulkSending(String signerName, - String signerEmail, String ccName, String ccEmail) { + private static BulkSendingCopy createBulkSending( + String signerName, + String signerEmail, + String ccName, + String ccEmail + ) { BulkSendingCopyRecipient recipient1 = new BulkSendingCopyRecipient() .name(signerName) .email(signerEmail) diff --git a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java index 9df1e6ef..a4adb357 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java @@ -42,10 +42,15 @@ public static EnvelopeSummary collectPayment( // The envelope will be sent first to the signer. // After it is signed, a copy is sent to the cc person. public static EnvelopeDefinition makeEnvelope( - WorkArguments args, + String signerEmail, + String signerName, + String ccName, + String ccEmail, String gatewayAccountId, String gatewayName, - String gatewayDisplayName) throws IOException { + String gatewayDisplayName, + WorkArguments args + ) throws IOException { byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); // create a signer recipient to sign the document, identified by name and email @@ -53,16 +58,16 @@ public static EnvelopeDefinition makeEnvelope( // to the recipients. Parallel routing order is supported by using the // same integer as the order for two or more recipients. Signer signer = new Signer() - .email(args.getSignerEmail()) - .name(args.getSignerName()) + .email(signerEmail) + .name(signerName) .recipientId("1") .routingOrder("1"); signer.setTabs(createTabs(gatewayAccountId, gatewayName, gatewayDisplayName)); // create a cc recipient to receive a copy of the documents, identified by name and email CarbonCopy cc = new CarbonCopy() - .email(args.getCcEmail()) - .name(args.getCcName()) + .email(ccEmail) + .name(ccName) .routingOrder("2") .recipientId("2"); diff --git a/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java index 9f1991e7..6044d5ad 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java @@ -17,12 +17,20 @@ public final class CreateTemplateService { private static final String PAGE_NUMBER = "1"; private static final String FALSE = "false"; - public static TemplateSummary createTemplate(ApiClient apiClient, String accountId, EnvelopeTemplate envelopeTemplate) throws ApiException { + public static TemplateSummary createTemplate( + ApiClient apiClient, + String accountId, + EnvelopeTemplate envelopeTemplate + ) throws ApiException { TemplatesApi templatesApi = new TemplatesApi(apiClient); return templatesApi.createTemplate(accountId, envelopeTemplate); } - public static EnvelopeTemplateResults searchTemplatesByName(ApiClient apiClient, String accountId, String templateName) throws ApiException { + public static EnvelopeTemplateResults searchTemplatesByName( + ApiClient apiClient, + String accountId, + String templateName + ) throws ApiException { TemplatesApi templatesApi = new TemplatesApi(apiClient); TemplatesApi.ListTemplatesOptions options = templatesApi.new ListTemplatesOptions(); options.setSearchText(templateName); diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java index b3e1cd14..1818fa86 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java @@ -12,7 +12,12 @@ import java.io.IOException; public final class EmbeddedSendingService { - public static ViewUrl createSenderView(EnvelopesApi envelopesApi, String accountId, String envelopeId, String dsReturnUrl) throws ApiException { + public static ViewUrl createSenderView( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + String dsReturnUrl + ) throws ApiException { // Step 2. Create the sender view. // Set the url where you want the recipient to go once they are done // signing should typically be a callback route somewhere in your app. @@ -20,9 +25,24 @@ public static ViewUrl createSenderView(EnvelopesApi envelopesApi, String account viewRequest.setReturnUrl(dsReturnUrl); return envelopesApi.createSenderView(accountId, envelopeId, viewRequest); } - public static EnvelopeSummary createEnvelopeWithDraftStatus(EnvelopesApi envelopesApi, WorkArguments args, String accountId) throws IOException, ApiException { + public static EnvelopeSummary createEnvelopeWithDraftStatus( + EnvelopesApi envelopesApi, + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String status, + WorkArguments args, + String accountId + ) throws IOException, ApiException { args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); - EnvelopeDefinition env = SigningViaEmailService.makeEnvelope(args); + EnvelopeDefinition env = SigningViaEmailService.makeEnvelope( + signerEmail, + signerName, + ccEmail, + ccName, + status, + args); return envelopesApi.createEnvelope(accountId, env); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java index 343c2d61..6ea9df37 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java @@ -23,7 +23,8 @@ public static RecipientViewRequest makeRecipientViewRequest( String signerEmail, String signerName, DSConfiguration config, - String clientUserId) { + String clientUserId + ) { RecipientViewRequest viewRequest = new RecipientViewRequest(); // Set the url where you want the recipient to go once they are done signing // should typically be a callback route somewhere in your app. @@ -64,7 +65,8 @@ public static EnvelopeDefinition makeEnvelope( Integer anchorOffsetY, Integer anchorOffsetX, String documentFileName, - String documentName) throws IOException { + String documentName + ) throws IOException { // Create a signer recipient to sign the document, identified by name and email // We set the clientUserId to enable embedded signing for the recipient Signer signer = new Signer(); diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java index 4443859c..7d26c8fa 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java @@ -8,7 +8,8 @@ public final class EnvelopeCustomFieldValuesService { public static CustomFieldsEnvelope envelopeCustomFieldValues( EnvelopesApi envelopesApi, String accountId, - String envelopeId) throws ApiException { + String envelopeId + ) throws ApiException { return envelopesApi.listCustomFields(accountId, envelopeId); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java index 23213916..eba90b08 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java @@ -10,7 +10,11 @@ import java.util.List; public final class EnvelopeDocsService { - public static EnvelopeDocumentsResult envelopeDocs(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + public static EnvelopeDocumentsResult envelopeDocs( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { // Step 1. List the envelope's documents return envelopesApi.listDocuments(accountId, envelopeId); } diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java index 29230097..627ff6b1 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java @@ -13,7 +13,8 @@ public static byte[] envelopeGetDoc( EnvelopesApi envelopesApi, String accountId, String envelopeId, - String documentId) throws ApiException { + String documentId + ) throws ApiException { return envelopesApi.getDocument(accountId, envelopeId, documentId); } public static String addExtension(String fileName, String extension) { diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java index 88a78c12..fd837dce 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java @@ -5,7 +5,11 @@ import com.docusign.esign.model.Envelope; public final class EnvelopeInfoService { - public static Envelope envelopeInfo(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + public static Envelope envelopeInfo( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { return envelopesApi.getEnvelope(accountId, envelopeId); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java index cc1589cb..0df8397c 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java @@ -5,7 +5,11 @@ import com.docusign.esign.model.Recipients; public final class EnvelopeRecipientsService { - public static Recipients envelopeRecipients(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + public static Recipients envelopeRecipients( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { return envelopesApi.listRecipients(accountId, envelopeId); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java index 1dd29162..4641725f 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java @@ -5,7 +5,11 @@ import com.docusign.esign.model.EnvelopeFormData; public final class GetTabValuesService { - public static EnvelopeFormData getTabValues(EnvelopesApi envelopesApi, String accountId, String envelopeId) throws ApiException { + public static EnvelopeFormData getTabValues( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { return envelopesApi.getFormData(accountId, envelopeId); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java index 206f7948..3fceac60 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java @@ -34,8 +34,11 @@ public static String retrieveWorkflowId(ApiClient apiClient, String accountId) t return identityVerification.get(0).getWorkflowId(); } - public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, - String workflowId) { + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail, + String workflowId + ) { EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); envelopeDefinition.setEmailSubject("Please sign"); envelopeDefinition.setEmailBlurb("Sample text for email body"); diff --git a/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java index 99698783..211eb5f6 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java @@ -20,7 +20,10 @@ public static EnvelopeSummary kbaAuthentication( return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail) throws IOException { + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail + ) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); diff --git a/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java b/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java index 097be61d..77269f2a 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java @@ -23,7 +23,12 @@ public static EnvelopeSummary pauseSignatureWorkflow( return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail, + String signerName2, + String signerEmail2 + ) throws IOException { Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); WorkflowStep workflowStep = new WorkflowStep(); @@ -43,8 +48,8 @@ public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOExc signHere1.setDocumentId(document.getDocumentId()); Signer signer1 = new Signer(); - signer1.setName(args.getSignerName()); - signer1.setEmail(args.getSignerEmail()); + signer1.setName(signerName); + signer1.setEmail(signerEmail); signer1.setRoutingOrder("1"); signer1.setRecipientId("1"); signer1.setTabs(EnvelopeHelpers.createSignerTabs(signHere1)); @@ -58,8 +63,8 @@ public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOExc signHere2.setDocumentId(document.getDocumentId()); Signer signer2 = new Signer(); - signer2.setName(args.getSignerName2()); - signer2.setEmail(args.getSignerEmail2()); + signer2.setName(signerName2); + signer2.setEmail(signerEmail2); signer2.setRoutingOrder("2"); signer2.setRecipientId("2"); signer2.setTabs(EnvelopeHelpers.createSignerTabs(signHere2)); diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java index 9453cdb7..e29a0835 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java @@ -9,7 +9,11 @@ import com.google.gson.Gson; public class PermissionCreateService { - public static PermissionProfile createNewProfile(AccountsApi accountsApi, String accountid, String permissionProfileName) throws ApiException { + public static PermissionProfile createNewProfile( + AccountsApi accountsApi, + String accountid, + String permissionProfileName + ) throws ApiException { // Step 3. Construct your request body // We're extending the AccountSettings class with AccountSettingsPatch to include the signingUIVersion which is missing in the swagger spec at this time. Gson gson = new Gson(); diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java index 419ef4e9..49e4c9f8 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java @@ -8,7 +8,8 @@ public final class PermissionDeleteService { public static void permissionDelete( AccountsApi accountsApi, String accountId, - String curProfileId) throws ApiException { + String curProfileId + ) throws ApiException { accountsApi.deletePermissionProfile(accountId, curProfileId); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java index 882da322..d1615ea5 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java @@ -21,7 +21,11 @@ public static EnvelopeSummary phoneAuthentication( return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String phoneNumber) throws IOException { + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail, + String phoneNumber + ) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); diff --git a/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java b/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java index 6aca229c..bbfe80f8 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java @@ -37,7 +37,18 @@ public static EnvelopeSummary smsDelivery( // recipient 2 - cc // The envelope will be sent first to the signer. After it is signed, // a copy is sent to the cc person. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + public static EnvelopeDefinition makeEnvelope( + String signerName, + String signerEmail, + String countryCode, + String phoneNumberFromRecipient, + String ccEmail, + String ccName, + String ccCountryCode, + String ccPhoneNumberFromRecipient, + String status, + WorkArguments args + ) throws IOException { // The DocuSign platform searches throughout your envelope's documents // for matching anchor strings. So the signHere2 tab will be used in // both document 2 and 3 since they use the same anchor string for @@ -52,8 +63,8 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep // to the recipients. Parallel routing order is supported by using the // same integer as the order for two or more recipients. Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); + signer.setEmail(signerEmail); + signer.setName(signerName); signer.setRecipientId("1"); signer.setRoutingOrder("1"); signer.setTabs(signerTabs); @@ -62,15 +73,15 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep smsDelivery.setSecondaryDeliveryMethod("SMS"); RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); - phoneNumber.setCountryCode(args.getCountryCode()); - phoneNumber.setNumber(args.getPhoneNumber()); + phoneNumber.setCountryCode(countryCode); + phoneNumber.setNumber(phoneNumberFromRecipient); smsDelivery.phoneNumber(phoneNumber); signer.setAdditionalNotifications(Arrays.asList(smsDelivery)); // create a cc recipient to receive a copy of the documents, identified by name and email CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); + cc.setEmail(ccEmail); + cc.setName(ccName); cc.setRecipientId("2"); cc.setRoutingOrder("2"); @@ -78,8 +89,8 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep ccSmsDelivery.setSecondaryDeliveryMethod("SMS"); RecipientPhoneNumber ccPhoneNumber = new RecipientPhoneNumber(); - ccPhoneNumber.setCountryCode(args.getCcCountryCode()); - ccPhoneNumber.setNumber(args.getCcPhoneNumber()); + ccPhoneNumber.setCountryCode(ccCountryCode); + ccPhoneNumber.setNumber(ccPhoneNumberFromRecipient); ccSmsDelivery.phoneNumber(ccPhoneNumber); cc.setAdditionalNotifications(Arrays.asList(ccSmsDelivery)); @@ -95,7 +106,7 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); // Request that the envelope be sent by setting |status| to "sent". // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); + envelope.setStatus(status); return envelope; } diff --git a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java index 34e694a5..0fe3a86d 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java @@ -38,7 +38,16 @@ public final class SendBinaryDocsService { private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - public static String sendBinaryDocs(WorkArguments args, String basePath, String accountId, String accessToken) throws IOException { + public static String sendBinaryDocs( + WorkArguments args, + String signerName, + String signerEmail, + String ccName, + String ccEmail, + String basePath, + String accountId, + String accessToken + ) throws IOException { // Step 1. Gather documents and their headers List documents = List.of( new SendBinaryDocsService.DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, @@ -50,11 +59,19 @@ public static String sendBinaryDocs(WorkArguments args, String basePath, String ); // Step 2. Make the envelope JSON request body - JSONObject envelopeJSON = SendBinaryDocsService.makeEnvelopeJSON(args, documents); + JSONObject envelopeJSON = SendBinaryDocsService.makeEnvelopeJSON( + signerName, + signerEmail, + ccName, + ccEmail, + documents); // Step 3. Create the multipart body URL uri = new URL(String.format("%s/v2.1/accounts/%s/envelopes", basePath, accountId)); - String contentType = String.join("", MediaType.MULTIPART_FORM_DATA, "; boundary=", BOUNDARY_DELIMITER); + String contentType = String.join( + "", + MediaType.MULTIPART_FORM_DATA, + "; boundary=", BOUNDARY_DELIMITER); HttpsURLConnection connection = (HttpsURLConnection) uri.openConnection(); connection.setRequestMethod(HttpMethod.POST); connection.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); @@ -84,8 +101,11 @@ public static String sendBinaryDocs(WorkArguments args, String basePath, String return StreamUtils.copyToString(connection.getInputStream(), StandardCharsets.UTF_8); } - public static void writeBoundaryHeader(DataOutputStream buffer, - String contentType, String contentDisposition) throws IOException { + public static void writeBoundaryHeader( + DataOutputStream buffer, + String contentType, + String contentDisposition + ) throws IOException { buffer.writeBytes(HYPHENS); buffer.writeBytes(BOUNDARY_DELIMITER); buffer.writeBytes(LINE_DELIMITER); @@ -114,7 +134,13 @@ public static void writeClosingBoundary(DataOutputStream buffer) throws IOExcept // recipient 2 - cc // The envelope will be sent first to the signer. // After it is signed, a copy is sent to the cc person. - public static JSONObject makeEnvelopeJSON(WorkArguments args, List documents) { + public static JSONObject makeEnvelopeJSON( + String signerName, + String signerEmail, + String ccName, + String ccEmail, + List documents + ) { // The DocuSign platform searches throughout your envelope's documents for // matching anchor strings. So the signHere2 tab will be used in both document // 2 and 3 since they use the same anchor string for their "signer 1" tabs. @@ -127,16 +153,16 @@ public static JSONObject makeEnvelopeJSON(WorkArguments args, List // to the recipients. Parallel routing order is supported by using the // same integer as the order for two or more recipients. Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); + signer.setEmail(signerName); + signer.setName(signerEmail); signer.setRecipientId("1"); signer.setRoutingOrder("1"); signer.setTabs(signerTabs); // create a cc recipient to receive a copy of the documents, identified by name and email CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); + cc.setEmail(ccName); + cc.setName(ccEmail); cc.setRecipientId("2"); cc.setRoutingOrder("2"); diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java index f83f926f..1e906260 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java @@ -15,7 +15,12 @@ public final class SetTabValuesService { private static final int ANCHOR_OFFSET_X = 10; private static final String SIGNER_CLIENT_ID = "1000"; - public static ViewUrl createRecipientView(EnvelopesApi envelopesApi, String accountId, String envelopeId, RecipientViewRequest viewRequest) throws ApiException { + public static ViewUrl createRecipientView( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); } @@ -23,7 +28,8 @@ public static RecipientViewRequest makeRecipientViewRequest( String signerEmail, String signerName, String dsReturnUrl, - String dsPingUrl) { + String dsPingUrl + ) { RecipientViewRequest viewRequest = new RecipientViewRequest(); // Set the url where you want the recipient to go once they are done signing // should typically be a callback route somewhere in your app. diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java index 1075da20..086df6f1 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java @@ -9,19 +9,21 @@ public final class SetTemplateTabValuesService { public static ViewUrl setTemplateTabValues( - EnvelopesApi envelopesApi, - String accountId, - String envelopeId, - RecipientViewRequest viewRequest) throws ApiException { + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); } public static RecipientViewRequest makeRecipientViewRequest( - String signerEmail, - String signerName, - String dsReturnUrl, - String clientUserId, - String dsPingUrl) { + String signerEmail, + String signerName, + String dsReturnUrl, + String clientUserId, + String dsPingUrl + ) { RecipientViewRequest viewRequest = new RecipientViewRequest(); // Set the url where you want the recipient to go once they are done signing // should typically be a callback route somewhere in your app. @@ -57,12 +59,13 @@ public static RecipientViewRequest makeRecipientViewRequest( public static EnvelopeDefinition makeEnvelope( - String signerEmail, - String signerName, - String ccEmail, - String ccName, - String templateId, - String clientUserId){ + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String templateId, + String clientUserId + ){ // Create a signer recipient to sign the document, identified by name and email // We set the clientUserId to enable embedded signing for the recipient diff --git a/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java b/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java index 440e74e3..3d48d024 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java @@ -22,9 +22,10 @@ public final class SigningViaEmailService { private static final int ANCHOR_OFFSET_X = 20; public static EnvelopeSummary signingViaEmail( - EnvelopesApi envelopesApi, - String accountId, - EnvelopeDefinition envelope) throws ApiException, IOException { + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException, IOException { return envelopesApi.createEnvelope(accountId, envelope); } @@ -37,7 +38,14 @@ public static EnvelopeSummary signingViaEmail( // recipient 2 - cc // The envelope will be sent first to the signer. After it is signed, // a copy is sent to the cc person. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String status, + WorkArguments args + ) throws IOException { // The DocuSign platform searches throughout your envelope's documents // for matching anchor strings. So the signHere2 tab will be used in // both document 2 and 3 since they use the same anchor string for @@ -52,16 +60,16 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep // to the recipients. Parallel routing order is supported by using the // same integer as the order for two or more recipients. Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); + signer.setEmail(signerEmail); + signer.setName(signerName); signer.setRecipientId("1"); signer.setRoutingOrder("1"); signer.setTabs(signerTabs); // create a cc recipient to receive a copy of the documents, identified by name and email CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); + cc.setEmail(ccEmail); + cc.setName(ccName); cc.setRecipientId("2"); cc.setRoutingOrder("2"); @@ -77,7 +85,7 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); // Request that the envelope be sent by setting |status| to "sent". // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); + envelope.setStatus(status); return envelope; } diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java b/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java index f33ad3b1..68f0a7ff 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java @@ -24,7 +24,14 @@ public static EnvelopeSummary useConditionalRecipients( return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { + public static EnvelopeDefinition createEnvelope( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail, + String signerName, + String signerEmail + ) throws IOException { Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); WorkflowStep workflowStep = new WorkflowStep(); @@ -32,7 +39,12 @@ public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOExc workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); workflowStep.setItemId("2"); workflowStep.setStatus("pending"); - workflowStep.setRecipientRouting(createRecipientRouting(args)); + workflowStep.setRecipientRouting(createRecipientRouting( + signerNotCheckedName, + signerNotCheckedEmail, + signerCheckedName, + signerCheckedEmail + )); Workflow workflow = new Workflow(); workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); @@ -40,7 +52,7 @@ public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOExc Recipients recipients = new Recipients(); recipients.setSigners(Arrays.asList( createApprovalSigner(document.getDocumentId()), - createPurchaserSigner(args, document.getDocumentId()) + createPurchaserSigner(signerName, signerEmail, document.getDocumentId()) )); EnvelopeDefinition envelope = new EnvelopeDefinition(); @@ -53,7 +65,11 @@ public static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOExc return envelope; } - private static Signer createPurchaserSigner(WorkArguments args, String documentId) { + private static Signer createPurchaserSigner( + String signerName, + String signerEmail, + String documentId + ) { SignHere signHere = new SignHere(); signHere.setName("SignHereTabs"); signHere.setXPosition("200"); @@ -75,8 +91,8 @@ private static Signer createPurchaserSigner(WorkArguments args, String documentI tabs.setCheckboxTabs(Collections.singletonList(checkbox)); Signer signer = new Signer(); - signer.setName(args.getSignerName()); - signer.setEmail(args.getSignerEmail()); + signer.setName(signerName); + signer.setEmail(signerEmail); signer.setRoutingOrder("1"); signer.setRecipientId("1"); signer.setRoleName("Purchaser"); @@ -137,18 +153,23 @@ private static List createConditionalRecipien return Arrays.asList(condition1, condition2); } - private static RecipientGroup createRecipientGroup(WorkArguments args) { + private static RecipientGroup createRecipientGroup( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail + ) { RecipientOption recipientOption1 = new RecipientOption(); recipientOption1.setRecipientLabel("signer2a"); - recipientOption1.setName(args.getSignerNotCheckedName()); + recipientOption1.setName(signerNotCheckedName); recipientOption1.setRoleName("Signer when not checked"); - recipientOption1.setEmail(args.getSignerNotCheckedEmail()); + recipientOption1.setEmail(signerNotCheckedEmail); RecipientOption recipientOption2 = new RecipientOption(); recipientOption2.setRecipientLabel("signer2b"); - recipientOption2.setName(args.getSignerCheckedName()); + recipientOption2.setName(signerCheckedName); recipientOption2.setRoleName("Signer when checked"); - recipientOption2.setEmail(args.getSignerCheckedEmail()); + recipientOption2.setEmail(signerCheckedEmail); RecipientGroup recipientGroup = new RecipientGroup(); recipientGroup.setGroupName("Approver"); @@ -157,18 +178,38 @@ private static RecipientGroup createRecipientGroup(WorkArguments args) { return recipientGroup; } - private static ConditionalRecipientRule createConditionalRecipientRule(WorkArguments args) { + private static ConditionalRecipientRule createConditionalRecipientRule( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail + ) { ConditionalRecipientRule conditionalRecipientRule = new ConditionalRecipientRule(); conditionalRecipientRule.setRecipientId("2"); conditionalRecipientRule.setOrder("0"); - conditionalRecipientRule.setRecipientGroup(createRecipientGroup(args)); + conditionalRecipientRule.setRecipientGroup(createRecipientGroup( + signerNotCheckedName, + signerNotCheckedEmail, + signerCheckedName, + signerCheckedEmail + )); conditionalRecipientRule.setConditions(createConditionalRecipientRuleConditions()); return conditionalRecipientRule; } - private static RecipientRouting createRecipientRouting(WorkArguments args) { + private static RecipientRouting createRecipientRouting( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail + ) { RecipientRules recipientRules = new RecipientRules(); - recipientRules.setConditionalRecipients(Collections.singletonList(createConditionalRecipientRule(args))); + recipientRules.setConditionalRecipients(Collections.singletonList(createConditionalRecipientRule( + signerNotCheckedName, + signerNotCheckedEmail, + signerCheckedName, + signerCheckedEmail + ))); RecipientRouting recipientRouting = new RecipientRouting(); recipientRouting.setRules(recipientRules); diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java index 34cc1bbe..d31f7934 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java @@ -11,22 +11,32 @@ import java.util.Arrays; public final class UseTemplateService { - public static EnvelopeSummary createEnvelopeTemplate(EnvelopesApi envelopesApi, String accountId, EnvelopeDefinition envelope) throws ApiException { + public static EnvelopeSummary createEnvelopeTemplate( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition makeEnvelope(WorkArguments args) { + public static EnvelopeDefinition makeEnvelope( + String signerName, + String signerEmail, + String ccEmail, + String ccName, + String templateId + ) { TemplateRole signer = new TemplateRole(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); + signer.setEmail(signerEmail); + signer.setName(signerName); signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); TemplateRole cc = new TemplateRole(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); + cc.setEmail(ccEmail); + cc.setName(ccName); cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setTemplateId(args.getTemplateId()); + envelope.setTemplateId(templateId); envelope.setTemplateRoles(Arrays.asList(signer, cc)); envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); diff --git a/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java b/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java index 9c31ff8a..11b6c885 100644 --- a/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java +++ b/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java @@ -12,7 +12,8 @@ public static RoomDocument addFormsToRoom( RoomsApi roomsApi, String accountId, UUID formId, - Integer roomId) throws ApiException { + Integer roomId + ) throws ApiException { FormForAdd formForAdd = new FormForAdd().formId(formId); return roomsApi.addFormToRoom(accountId, roomId, formForAdd); } diff --git a/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java index 10abd60c..5f727b60 100644 --- a/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java +++ b/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java @@ -11,7 +11,8 @@ public static FormGroupFormToAssign assignFormToFormGroup( FormGroupsApi formGroupsApi, String accountId, UUID formId, - UUID formGroupId) throws ApiException { + UUID formGroupId + ) throws ApiException { // Step 5 Start FormGroupFormToAssign formGroupFormToAssignRequest = new FormGroupFormToAssign() .formId(formId); diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java b/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java index ef10d82b..fa2c7e5e 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java @@ -10,7 +10,8 @@ public static ExternalFormFillSession createExternalFormFillSession( ExternalFormFillSessionsApi externalFormFillSessionsApi, String accountId, String formId, - Integer roomId) throws ApiException { + Integer roomId + ) throws ApiException { // Step 3. Construct your request body ExternalFormFillSessionForCreate externalFormFillSessionForCreate = new ExternalFormFillSessionForCreate() .formId(formId) diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java index 5b5f68cc..e2d30965 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java @@ -9,7 +9,8 @@ public final class CreateFormGroupService { public static FormGroup createFormGroup( FormGroupsApi formGroupsApi, String accountId, - String formGroupName) throws ApiException { + String formGroupName + ) throws ApiException { // Step 3 Start FormGroupForCreate formGroupForCreate = new FormGroupForCreate() .name(formGroupName); diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java b/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java index e80b4b7d..eb25c23d 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java @@ -10,7 +10,8 @@ public final class CreateRoomService { public static Room createRoomFromModel( RoomsApi roomsApi, String accountId, - RoomForCreate roomForCreate) throws ApiException { + RoomForCreate roomForCreate + ) throws ApiException { return roomsApi.createRoom(accountId, roomForCreate); } @@ -27,7 +28,9 @@ public static RoomForCreate createRoomModel(Integer roleId, String roomName) { .putDataItem("state", "US-HI") .putDataItem("postalCode", "11112") .putDataItem("companyRoomStatus", "5") - .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + .putDataItem( + "comments", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") ); } } diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java index ae030db6..e7aeffab 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java @@ -10,7 +10,8 @@ public final class CreateRoomWithTemplateService { public static Room createRoomFromModel( RoomsApi roomsApi, String accountId, - RoomForCreate roomForCreate) throws ApiException { + RoomForCreate roomForCreate + ) throws ApiException { return roomsApi.createRoom(accountId, roomForCreate); } diff --git a/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java b/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java index 5f78e157..cc728e96 100644 --- a/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java +++ b/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java @@ -8,7 +8,8 @@ public final class ExportingDataFromRoomService { public static FieldData exportDataFromRoom( RoomsApi roomsApi, String accountId, - Integer roomId) throws ApiException { + Integer roomId + ) throws ApiException { return roomsApi.getRoomFieldData(accountId, roomId); } } diff --git a/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java b/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java index 3f093ea2..0ba295f8 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java +++ b/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java @@ -9,7 +9,8 @@ public static RoomSummaryList getRoomsWithFilters( RoomsApi roomsApi, String accountId, String startDate, - String endDate) throws ApiException { + String endDate + ) throws ApiException { // Step 3. Prepare your request parameters RoomsApi.GetRoomsOptions options = roomsApi.new GetRoomsOptions(); options.setFieldDataChangedStartDate(startDate); diff --git a/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java b/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java index 8247a0a5..969dd399 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java +++ b/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java @@ -10,7 +10,8 @@ public static void grantOfficeAccessToFormGroup( FormGroupsApi formGroupsApi, String accountId, UUID formGroupId, - Integer officeId) throws ApiException { + Integer officeId + ) throws ApiException { formGroupsApi.grantOfficeAccessToFormGroup( accountId, formGroupId, From c728211ce21895da9dd251d56bde77d3b9f953d7 Mon Sep 17 00:00:00 2001 From: annahileta Date: Mon, 1 Nov 2021 13:08:41 +0200 Subject: [PATCH 213/699] Made some methods private --- .../com/docusign/common/SelectedApiTypes.java | 5 ++++- .../examples/A002CreateActiveCLMESignUser.java | 4 ++-- .../admin/examples/A003BulkExportUserData.java | 14 +++++++------- .../admin/examples/AbstractAdminController.java | 16 +++++----------- .../click/examples/AbstractClickController.java | 8 ++++++-- .../examples/EG002ControllerSigningViaEmail.java | 9 ++++++++- .../core/controller/GlobalControllerAdvice.java | 2 ++ .../admin/examples/AddActiveUserService.java | 2 +- .../admin/examples/AuditUsersService.java | 4 ++-- .../examples/BulkExportUserDataService.java | 4 ++-- .../examples/BulkImportUserDataService.java | 10 +++++----- .../CheckImportRequestStatusService.java | 4 ++-- .../examples/CheckRequestStatusService.java | 4 ++-- .../CreateActiveCLMESignUserService.java | 4 ++-- .../click/examples/CreateClickwrapService.java | 3 ++- .../CreateNewVersionClickwrapService.java | 6 ++++-- .../examples/GetClickwrapResponsesService.java | 3 ++- .../click/examples/GetListClickwrapsService.java | 4 ++-- .../AccessCodeAuthenticationService.java | 3 +-- .../examples/AddDocToTemplateService.java | 4 ++-- .../examples/BulkSendEnvelopesService.java | 6 +++--- .../examples/CollectPaymentService.java | 2 +- .../examples/EmbeddedSendingService.java | 1 + .../examples/EnvelopeGetDocService.java | 1 + .../examples/IdvAuthenticationService.java | 1 - .../PermissionChangeSingleSettingService.java | 3 +-- .../examples/SendBinaryDocsService.java | 7 ++++--- .../eSignature/examples/SetTabValuesService.java | 2 -- .../examples/SetTemplateTabValuesService.java | 1 - .../examples/SigningViaEmailService.java | 2 +- .../eSignature/examples/UseTemplateService.java | 1 + .../examples/CreateRoomWithTemplateService.java | 4 +++- 32 files changed, 79 insertions(+), 65 deletions(-) diff --git a/src/main/java/com/docusign/common/SelectedApiTypes.java b/src/main/java/com/docusign/common/SelectedApiTypes.java index dc2fb5ea..93724999 100644 --- a/src/main/java/com/docusign/common/SelectedApiTypes.java +++ b/src/main/java/com/docusign/common/SelectedApiTypes.java @@ -1,5 +1,6 @@ package com.docusign.common; +import com.docusign.monitor.client.ApiException; import lombok.Getter; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -17,12 +18,14 @@ public class SelectedApiTypes { private Boolean MONITOR; @Value("${DS_API_NAME.ADMIN}") private Boolean ADMIN; + private final String SELECTED_API_NOT_SUPPORTED = "Currently selected api is not supported by launcher. Please, check appsettings.json file"; public String getFirstSelectedApi() { return (ESIGNATURE)? ApiIndex.ESIGNATURE.name() : (ROOMS)? ApiIndex.ROOMS.name() : (CLICK)? ApiIndex.CLICK.name() : (MONITOR)? ApiIndex.MONITOR.name() - : ApiIndex.ADMIN.name(); + : (ADMIN)? ApiIndex.ADMIN.name() + : SELECTED_API_NOT_SUPPORTED; } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 3b0c54bd..4ab3864e 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -100,8 +100,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); UUID accountId = this.getExistingAccountId( this.user.getAccessToken(), - this.session.getBasePath(), o - rganizationId); + this.session.getBasePath(), + organizationId); AddUserResponse result = CreateActiveCLMESignUserService.createNewActiveUser( args.getClmProfileId(), diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 43231781..d876b52e 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -56,19 +56,18 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - OrganizationExportResponse bulkList = BulkExportUserDataService - .createUserListExport(bulkExportsApi, organizationId); + OrganizationExportResponse bulkList = BulkExportUserDataService.createUserListExport( + bulkExportsApi, + organizationId); // Step 3 end TimeUnit.SECONDS.sleep(20); // Step 4 start - OrganizationExportResponse data = BulkExportUserDataService - .bulkExportUserData(bulkExportsApi, organizationId, bulkList.getId()); + String csvUri = BulkExportUserDataService.bulkExportUserData(bulkExportsApi, organizationId, bulkList.getId()); // Step 4 end // Step 5 start - String csvUri = data.getResults().get(0).getUrl(); URL request_url = new URL(csvUri); // Send Web request to download and save the exported CSV data @@ -105,8 +104,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse http_conn.disconnect(); // Step 5 end - OrganizationExportsResponse results = BulkExportUserDataService - .bulkExportsUserData(bulkExportsApi, organizationId); + OrganizationExportsResponse results = BulkExportUserDataService.bulkExportsUserData( + bulkExportsApi, + organizationId); // Process results DoneExample.createDefault(title) .withMessage("User data exported to " + saveFilePath + "
from UserExport:getUserListExport method:") diff --git a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java index a87ed341..9d53246f 100644 --- a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java +++ b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java @@ -10,18 +10,8 @@ import com.docusign.admin.api.UsersApi.GetUserProfilesOptions; import com.docusign.admin.client.ApiClient; import com.docusign.admin.client.ApiException; -import com.docusign.admin.client.auth.AccessTokenListener; -import com.docusign.admin.client.auth.OAuth.Account; -import com.docusign.admin.client.auth.OAuth.Organization; -import com.docusign.admin.model.OrganizationAccountsRequest; -import com.docusign.admin.model.OrganizationsResponse; -import com.docusign.admin.model.ProductPermissionProfileResponse; import com.docusign.admin.model.UsersDrilldownResponse; import com.docusign.core.controller.AbstractController; -import com.docusign.core.model.Session; -import com.docusign.esign.api.GroupsApi; -//import com.docusign.esign.client.ApiClient; -import com.docusign.esign.api.OrganizationsApi; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; @@ -104,7 +94,11 @@ protected static BulkImportsApi createBulkImportsApi(String accessToken, String * @param organizationId the ID of current organization * @return the account Id */ - protected UUID getExistingAccountId(String accessToken, String basePath, UUID organizationId) throws Exception { + protected UUID getExistingAccountId( + String accessToken, + String basePath, + UUID organizationId + ) throws Exception { UsersApi usersApi = createUsersApi(accessToken, basePath); // set the signer email to get an information about that user diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index 9bc95de7..065b4b2f 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -60,8 +60,12 @@ protected static AccountsApi createAccountsApiClient(String basePath, String use * @param clickwrapId clickwrap's id * @return an boolean value */ - protected boolean isClickwrapExistsAndActive(String basePath, String userAccessToken, - String accountId, String clickwrapId) throws ApiException { + protected boolean isClickwrapExistsAndActive( + String basePath, + String userAccessToken, + String accountId, + String clickwrapId + ) throws ApiException { boolean isClickwrapOk = false; if (StringUtils.isNotBlank(clickwrapId)) { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index 6d83b014..852278ce 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -54,7 +54,14 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = SigningViaEmailService.makeEnvelope(args); + EnvelopeDefinition envelope = SigningViaEmailService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getCcEmail(), + args.getCcName(), + args.getStatus(), + args + ); EnvelopeSummary results = SigningViaEmailService.signingViaEmail( envelopesApi, session.getAccountId(), diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index b3d7874c..decec973 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -11,6 +11,8 @@ import com.docusign.core.utils.AccountsConverter; import java.util.stream.Collectors; + +import com.docusign.monitor.client.ApiException; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java index fbb7ff25..42b96e9f 100644 --- a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java +++ b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java @@ -34,7 +34,7 @@ public static NewUserResponse addActiveUser( accountId); } - protected static NewUserResponse createNewActiveUser( + private static NewUserResponse createNewActiveUser( String groupId, String profileId, String email, diff --git a/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java b/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java index 5d989ff3..8d008577 100644 --- a/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java +++ b/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java @@ -17,8 +17,8 @@ public class AuditUsersService { public static ArrayList auditUsers( UsersApi usersApi, UUID organizationId, - UUID accountId) throws ApiException - { + UUID accountId + ) throws ApiException { ArrayList resultsArr = new ArrayList(); // Step 3 start diff --git a/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java b/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java index 96cc14c1..c5794d92 100644 --- a/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java +++ b/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java @@ -16,12 +16,12 @@ public static OrganizationExportsResponse bulkExportsUserData( return bulkExportsApi.getUserListExports(organizationId); } - public static OrganizationExportResponse bulkExportUserData( + public static String bulkExportUserData( BulkExportsApi bulkExportsApi, UUID organizationId, UUID exportId) throws ApiException { - return bulkExportsApi.getUserListExport(organizationId, exportId); + return bulkExportsApi.getUserListExport(organizationId, exportId).getResults().get(0).getUrl(); } public static OrganizationExportResponse createUserListExport( diff --git a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java index 623dd670..47dca1e1 100644 --- a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java +++ b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java @@ -7,11 +7,11 @@ import java.util.UUID; public class BulkImportUserDataService { - public static OrganizationImportResponse bulkImportUserData( - BulkImportsApi bulkImportsApi, - UUID organizationId, - UUID accountId) throws Exception - { + public static OrganizationImportResponse bulkImportUserData( + BulkImportsApi bulkImportsApi, + UUID organizationId, + UUID accountId + ) throws Exception{ // Make sure you're using a verified domain for auto-activation to work properly // Step 3 start String csvUserData = String.format( diff --git a/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java b/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java index 47f65120..2a66aae8 100644 --- a/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java +++ b/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java @@ -9,8 +9,8 @@ public class CheckImportRequestStatusService { public static OrganizationImportResponse checkRequestStatus( BulkImportsApi bulkImportsApi, UUID organizationId, - UUID importId) throws Exception - { + UUID importId + ) throws Exception { // Step 4a start return bulkImportsApi.getBulkUserImportRequest(organizationId, importId); // Step 4a end diff --git a/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java b/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java index e9c7f7f9..fa5dfaba 100644 --- a/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java +++ b/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java @@ -9,8 +9,8 @@ public class CheckRequestStatusService { public static OrganizationExportResponse checkRequestStatus( BulkExportsApi bulkExportsApi, UUID organizationId, - UUID exportId) throws Exception - { + UUID exportId + ) throws Exception { return bulkExportsApi.getUserListExport(organizationId, exportId); } } diff --git a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java index d6478506..5ed80393 100644 --- a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java +++ b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java @@ -22,8 +22,8 @@ public static AddUserResponse createNewActiveUser( String email, UsersApi usersApi, UUID organizationId, - UUID accountId) throws Exception - { + UUID accountId + ) throws Exception{ // Step 5 start ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest(); ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest(); diff --git a/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java b/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java index 7e801adb..39982e84 100644 --- a/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java +++ b/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java @@ -12,7 +12,8 @@ public static ClickwrapRequest createClickwrapRequest( String clickwrapName, String fileName, String documentName, - Integer documentOrder) throws IOException { + Integer documentOrder + ) throws IOException { Document document = ClickwrapHelper.createDocumentFromFile(fileName, documentName, documentOrder); DisplaySettings displaySettings = new DisplaySettings() .displayName("Terms of Service") diff --git a/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java b/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java index 886c4ec7..14665a63 100644 --- a/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java +++ b/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java @@ -15,7 +15,8 @@ public static ClickwrapVersionSummaryResponse createNewVersionClickwrap( AccountsApi accountsApi, ClickwrapRequest clickwrapRequest, String accountId, - String clickwrapId) throws ApiException { + String clickwrapId + ) throws ApiException { // Step 4: Call the v1 Click API return accountsApi.createClickwrapVersion( accountId, @@ -26,7 +27,8 @@ public static ClickwrapVersionSummaryResponse createNewVersionClickwrap( public static ClickwrapRequest createClickwrapRequest( String fileName, String documentName, - Integer documentOrder) throws IOException { + Integer documentOrder + ) throws IOException { Document document = ClickwrapHelper.createDocumentFromFile(fileName, documentName, documentOrder); DisplaySettings displaySettings = new DisplaySettings() .displayName("Terms of Service v2") diff --git a/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java b/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java index 64b9d508..6e3f4649 100644 --- a/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java +++ b/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java @@ -8,7 +8,8 @@ public final class GetClickwrapResponsesService { public static ClickwrapAgreementsResponse getClickwrapResponses( AccountsApi accountsApi, String accountId, - String clickwrapId) throws ApiException { + String clickwrapId + ) throws ApiException { // Step 3: Call the v1 Click API return accountsApi.getClickwrapAgreements(accountId, clickwrapId); } diff --git a/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java b/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java index 80bdb476..6cb1d314 100644 --- a/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java +++ b/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java @@ -7,8 +7,8 @@ public final class GetListClickwrapsService { public static ClickwrapVersionsResponse getListClickwrap( AccountsApi accountsApi, - String accountId) throws ApiException - { + String accountId + ) throws ApiException{ // Step 3: Call the v1 Click API return accountsApi.getClickwraps(accountId); } diff --git a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java index 74427075..d57e449a 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java @@ -25,8 +25,7 @@ public static EnvelopeDefinition createEnvelope( String signerName, String signerEmail, String accessCode - ) throws IOException - { + ) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); diff --git a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java index cdeb57af..337af449 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java @@ -57,7 +57,7 @@ public static ViewUrl addDocumentToTemplate( return envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); } - public static RecipientViewRequest makeRecipientViewRequest( + private static RecipientViewRequest makeRecipientViewRequest( String dsReturnUrl, String signerEmail, String signerName, @@ -93,7 +93,7 @@ public static RecipientViewRequest makeRecipientViewRequest( // The envelope request object uses Composite Template to include in the envelope: // 1. A template stored on the DocuSign service // 2. An additional document which is a custom HTML source document - public static EnvelopeDefinition makeEnvelope( + private static EnvelopeDefinition makeEnvelope( String signerEmail, String signerName, String signerClientId, diff --git a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java index b1bd1420..a4543641 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java @@ -64,7 +64,7 @@ public static String bulkSendEnvelopes( return bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); } - public static BulkSendingList getSendingList( + private static BulkSendingList getSendingList( String signerName, String signerEmail, String ccName, @@ -113,7 +113,7 @@ public static EnvelopeDefinition makeEnvelope() throws IOException { .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); } - public static CustomFields createCustomFields(String bulkListId) { + private static CustomFields createCustomFields(String bulkListId) { TextCustomField textCustomField = new TextCustomField() .name("mailingListId") .required(DsModelUtils.FALSE) @@ -125,7 +125,7 @@ public static CustomFields createCustomFields(String bulkListId) { .textCustomFields(List.of(textCustomField)); } - public static Recipients createRecipients() { + private static Recipients createRecipients() { List signers = List.of( createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, "1"), createSignerPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, "2")); diff --git a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java index a4adb357..3d5bacfd 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java @@ -85,7 +85,7 @@ public static EnvelopeDefinition makeEnvelope( } // creates tabs per signer - public static Tabs createTabs(String gatewayAccountId, String gatewayName, String gatewayDisplayName) { + private static Tabs createTabs(String gatewayAccountId, String gatewayName, String gatewayDisplayName) { java.util.List listItems = java.util.List.of( new ListItem().text("none").value("0"), new ListItem().text("1").value("1"), diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java index 1818fa86..968a88ab 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java @@ -25,6 +25,7 @@ public static ViewUrl createSenderView( viewRequest.setReturnUrl(dsReturnUrl); return envelopesApi.createSenderView(accountId, envelopeId, viewRequest); } + public static EnvelopeSummary createEnvelopeWithDraftStatus( EnvelopesApi envelopesApi, String signerEmail, diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java index 627ff6b1..03cb5d80 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java @@ -17,6 +17,7 @@ public static byte[] envelopeGetDoc( ) throws ApiException { return envelopesApi.getDocument(accountId, envelopeId, documentId); } + public static String addExtension(String fileName, String extension) { if (FilenameUtils.isExtension(fileName, extension)) { return fileName; diff --git a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java index 3fceac60..0532ff62 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java @@ -14,7 +14,6 @@ public final class IdvAuthenticationService { private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; public static EnvelopeSummary idvAuthentication( EnvelopesApi envelopesApi, diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java index ad7a34ef..e8942fea 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java @@ -31,13 +31,12 @@ public static PermissionProfile permissionChangeSingleSetting( } public static Optional findProfile(List profiles, String profileId) { - return profiles.stream().filter(p -> p.getPermissionProfileId().equals(profileId)).findFirst(); } // Changes random boolean properties; in a real application, changing properties // will be read from the page or in a different way - public static AccountRoleSettings changeRandomSettings(AccountRoleSettings settings) { + private static AccountRoleSettings changeRandomSettings(AccountRoleSettings settings) { Gson gson = new Gson(); // Change this value back to: gson.fromJson(gson.toJson(settings), // AccountRoleSettings.class); diff --git a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java index 0fe3a86d..d947b377 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java @@ -101,7 +101,8 @@ public static String sendBinaryDocs( return StreamUtils.copyToString(connection.getInputStream(), StandardCharsets.UTF_8); } - public static void writeBoundaryHeader( + + private static void writeBoundaryHeader( DataOutputStream buffer, String contentType, String contentDisposition @@ -116,7 +117,7 @@ public static void writeBoundaryHeader( buffer.writeBytes(LINE_DELIMITER); } - public static void writeClosingBoundary(DataOutputStream buffer) throws IOException { + private static void writeClosingBoundary(DataOutputStream buffer) throws IOException { buffer.writeBytes(LINE_DELIMITER); buffer.writeBytes(HYPHENS); buffer.writeBytes(BOUNDARY_DELIMITER); @@ -134,7 +135,7 @@ public static void writeClosingBoundary(DataOutputStream buffer) throws IOExcept // recipient 2 - cc // The envelope will be sent first to the signer. // After it is signed, a copy is sent to the cc person. - public static JSONObject makeEnvelopeJSON( + private static JSONObject makeEnvelopeJSON( String signerName, String signerEmail, String ccName, diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java index 1e906260..19438f3c 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java @@ -11,8 +11,6 @@ public final class SetTabValuesService { private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_salary.docx"; private static final String DOCUMENT_NAME = "Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = 20; - private static final int ANCHOR_OFFSET_X = 10; private static final String SIGNER_CLIENT_ID = "1000"; public static ViewUrl createRecipientView( diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java index 086df6f1..dc40218e 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java @@ -57,7 +57,6 @@ public static RecipientViewRequest makeRecipientViewRequest( return viewRequest; } - public static EnvelopeDefinition makeEnvelope( String signerEmail, String signerName, diff --git a/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java b/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java index 3d48d024..97e344ee 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java @@ -25,7 +25,7 @@ public static EnvelopeSummary signingViaEmail( EnvelopesApi envelopesApi, String accountId, EnvelopeDefinition envelope - ) throws ApiException, IOException { + ) throws ApiException { return envelopesApi.createEnvelope(accountId, envelope); } diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java index d31f7934..984be2f4 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java @@ -18,6 +18,7 @@ public static EnvelopeSummary createEnvelopeTemplate( ) throws ApiException { return envelopesApi.createEnvelope(accountId, envelope); } + public static EnvelopeDefinition makeEnvelope( String signerName, String signerEmail, diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java index e7aeffab..7000c96b 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java @@ -28,7 +28,9 @@ public static RoomForCreate createRoom(Integer roleId, String roomName, Integer .putDataItem("state", "US-HI") .putDataItem("postalCode", "11112") .putDataItem("companyRoomStatus", "5") - .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + .putDataItem( + "comments", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") ); } } From 7fb1acaa71742ece645c69cfeb3eef6a2605cfbf Mon Sep 17 00:00:00 2001 From: annahileta Date: Mon, 1 Nov 2021 16:00:41 +0200 Subject: [PATCH 214/699] removed extra imports and empty lines --- .../admin/examples/A001AddActiveUser.java | 4 +- .../A002CreateActiveCLMESignUser.java | 12 +-- .../examples/A003BulkExportUserData.java | 15 ++- .../examples/A004BulkImportUserData.java | 1 - .../A004CheckImportRequestStatus.java | 1 - .../admin/examples/A005AuditUsers.java | 20 +--- .../C001ControllerCreateClickwrap.java | 3 - .../C002ControllerActivateClickwrap.java | 1 - ...03ControllerCreateNewVersionClickwrap.java | 4 - .../EG002ControllerSigningViaEmail.java | 10 +- .../EG003ControllerListEnvelopes.java | 9 +- .../examples/EG004ControllerEnvelopeInfo.java | 1 - .../EG005ControllerEnvelopeRecipients.java | 1 - .../EG007ControllerEnvelopeGetDoc.java | 13 +-- .../EG008ControllerCreateTemplate.java | 18 +--- .../examples/EG009ControllerUseTemplate.java | 5 - .../EG010ControllerSendBinaryDocs.java | 30 ------ .../EG011ControllerEmbeddedSending.java | 8 +- .../EG012ControllerEmbeddedConsole.java | 7 +- .../EG013ControllerAddDocToTemplate.java | 19 +--- .../examples/EG015ControllerGetTabValues.java | 1 - .../examples/EG016ControllerSetTabValues.java | 11 +-- .../EG017ControllerSetTemplateTabValues.java | 6 -- ...18ControllerEnvelopeCustomFieldValues.java | 1 - ...019ControllerAccessCodeAuthentication.java | 9 +- .../EG020ControllerPhoneAuthentication.java | 92 +------------------ .../EG022ControllerKBAAuthentication.java | 10 +- .../EG023ControllerIdvAuthentication.java | 15 +-- .../EG024ControllerPermissionCreate.java | 3 - ...G025ControllerPermissionSetUserGroups.java | 22 ++--- ...ntrollerPermissionChangeSingleSetting.java | 31 ++----- .../EG027ControllerPermissionDelete.java | 2 - .../examples/EG028ControllerCreateBrand.java | 2 - .../EG029ControllerApplyBrandToEnvelope.java | 28 ++---- .../EG030ControllerApplyBrandToTemplate.java | 2 - .../EG031ControllerBulkSendEnvelopes.java | 5 - ...EG032ControllerPauseSignatureWorkflow.java | 1 - ...033ControllerUnpauseSignatureWorkflow.java | 3 - ...034ControllerUseConditionalRecipients.java | 4 - .../examples/EG035ControllerSMSDelivery.java | 20 +--- .../examples/M001GetMonitoringData.java | 5 - .../examples/R001ControllerCreateRoom.java | 1 - .../R002ControllerCreateRoomWithTemplate.java | 4 - .../R003ControllerExportingDataFromRoom.java | 4 - .../R004ControllerAddingFormsToRoom.java | 9 +- .../R005ControllerGetRoomsWithFilters.java | 5 - ...ntrollerCreateExternalFormFillSession.java | 15 +-- .../R007ControllerCreateFormGroup.java | 1 - ...ontrollerGrantOfficeAccessToFormGroup.java | 2 - .../R009ControllerAssignFormToFormGroup.java | 2 - .../JWTAuthorizationCodeResourceDetails.java | 2 +- .../admin/examples/AddActiveUserService.java | 5 - .../admin/examples/AuditUsersService.java | 8 +- .../examples/BulkImportUserDataService.java | 6 +- .../CreateActiveCLMESignUserService.java | 1 - .../AccessCodeAuthenticationService.java | 27 +----- .../examples/AddDocToTemplateService.java | 14 +-- .../examples/ApplyBrandToEnvelopeService.java | 5 +- .../examples/ApplyBrandToTemplateService.java | 1 - .../examples/BulkSendEnvelopesService.java | 1 - .../examples/CollectPaymentService.java | 3 +- .../examples/CreateTemplateService.java | 9 +- .../examples/EmbeddedSigningService.java | 6 +- .../examples/EnvelopeDocsService.java | 5 - .../examples/EnvelopeGetDocService.java | 3 - .../examples/KBAAuthenticationService.java | 22 +++-- .../PauseSignatureWorkflowService.java | 1 - .../examples/PermissionCreateService.java | 4 +- .../examples/PhoneAuthenticationService.java | 26 +----- .../examples/SMSDeliveryService.java | 5 +- .../examples/SendBinaryDocsService.java | 8 +- .../examples/SetTabValuesService.java | 9 +- .../examples/SetTemplateTabValuesService.java | 9 +- .../UseConditionalRecipientsService.java | 1 - .../examples/UseTemplateService.java | 1 - .../CreateRoomWithTemplateService.java | 4 +- 76 files changed, 142 insertions(+), 542 deletions(-) diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index 29b9aeac..97233f46 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -1,8 +1,7 @@ package com.docusign.controller.admin.examples; import com.docusign.DSConfiguration; -import com.docusign.admin.api.UsersApi; -import com.docusign.admin.model.*; +import com.docusign.admin.model.NewUserResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; @@ -20,7 +19,6 @@ import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.HttpHeaders; -import java.util.ArrayList; import java.util.UUID; /** diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 4ab3864e..0c88ff38 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -1,31 +1,26 @@ package com.docusign.controller.admin.examples; -import java.util.UUID; - -import javax.servlet.http.HttpServletResponse; - import com.docusign.DSConfiguration; import com.docusign.admin.api.DsGroupsApi; import com.docusign.admin.api.ProductPermissionProfilesApi; import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.AddUserResponse; import com.docusign.admin.model.DSGroupListResponse; -import com.docusign.admin.model.DSGroupRequest; -import com.docusign.admin.model.NewMultiProductUserAddRequest; -import com.docusign.admin.model.ProductPermissionProfileRequest; import com.docusign.admin.model.ProductPermissionProfileResponse; import com.docusign.admin.model.ProductPermissionProfilesResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; - import com.docusign.services.admin.examples.CreateActiveCLMESignUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; +import java.util.UUID; + /** * Create new user This example demonstrates how to create a new user with * methods from Admin API. @@ -34,7 +29,6 @@ @RequestMapping("/a002") public class A002CreateActiveCLMESignUser extends AbstractAdminController { - private final User user; private final Session session; diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index d876b52e..bdf2ecbf 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -3,33 +3,31 @@ import com.docusign.DSConfiguration; import com.docusign.admin.api.BulkExportsApi; import com.docusign.admin.model.OrganizationExportResponse; -import com.docusign.admin.model.OrganizationExportRequest; import com.docusign.admin.model.OrganizationExportsResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; - import com.docusign.services.admin.examples.BulkExportUserDataService; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.http.HttpHeaders; import javax.net.ssl.HttpsURLConnection; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.core.MediaType; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.URL; import java.nio.file.Paths; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.TimeUnit; /** * How to bulk-export user data This example demonstrates how to bulk-export @@ -79,7 +77,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse http_conn.setInstanceFollowRedirects(true); ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); - String rootDir = Paths.get(rawPath.getResource("").toURI()).toString(); + String rootDir = Paths.get(Objects.requireNonNull(rawPath.getResource("")).toURI()).toString(); // Set the save file path in the project root instead of the compiled folder and // force forward slash scheme rootDir = StringUtils.remove(rootDir, "target\\classes"); @@ -93,7 +91,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // opens an output stream to save into file FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); - int bytesRead = -1; + int bytesRead; byte[] buffer = new byte[BUFFER_SIZE]; while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); @@ -113,5 +111,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .withJsonObject(results).addToModel(model); return DONE_EXAMPLE_PAGE; } - } diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 6a4e5437..6d5818cb 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import java.nio.charset.StandardCharsets; import java.util.UUID; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index 08c721b8..3bce7098 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -46,7 +46,6 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception model.addAttribute(MODEL_IMPORT_OK, StringUtils.isNotBlank(this.session.getImportId())); } - @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { // Redirects to the front facing example to avoid a Null Pointer Exception diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 19039df9..54ee5299 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -1,33 +1,22 @@ package com.docusign.controller.admin.examples; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.ArrayList; -import java.util.TimeZone; -import java.util.UUID; - -import javax.servlet.http.HttpServletResponse; - import com.docusign.DSConfiguration; import com.docusign.admin.api.UsersApi; -import com.docusign.admin.api.UsersApi.GetUserProfilesOptions; -import com.docusign.admin.api.UsersApi.GetUsersOptions; -import com.docusign.admin.model.OrganizationUserResponse; -import com.docusign.admin.model.OrganizationUsersResponse; import com.docusign.admin.model.UserDrilldownResponse; -import com.docusign.admin.model.UsersDrilldownResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; - - import com.docusign.services.admin.examples.AuditUsersService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.UUID; + /** * Create new user This example demonstrates how to create a new user with * methods from Admin API. @@ -61,5 +50,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .withJsonObject(resultsArr).addToModel(model); return DONE_EXAMPLE_PAGE; } - } diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index f6dc5b76..925433fc 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -5,8 +5,6 @@ import com.docusign.click.client.ApiException; import com.docusign.click.model.ClickwrapRequest; import com.docusign.click.model.ClickwrapVersionSummaryResponse; -import com.docusign.click.model.DisplaySettings; -import com.docusign.click.model.Document; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; @@ -30,7 +28,6 @@ public class C001ControllerCreateClickwrap extends AbstractClickController { private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; private static final Integer DOCUMENT_ORDER = 0; private static final String DOCUMENT_NAME = "Terms of Service"; - private final Session session; private final User user; diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index 1ad0943c..2e9ab2ef 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -25,7 +25,6 @@ public class C002ControllerActivateClickwrap extends AbstractClickController { private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; - private final Session session; private final User user; diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index 2cb996a2..ed41f714 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -3,10 +3,7 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; -import com.docusign.click.model.ClickwrapRequest; import com.docusign.click.model.ClickwrapVersionSummaryResponse; -import com.docusign.click.model.DisplaySettings; -import com.docusign.click.model.Document; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; @@ -32,7 +29,6 @@ public class C003ControllerCreateNewVersionClickwrap extends AbstractClickContro private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; private static final Integer DOCUMENT_ORDER = 0; private static final String DOCUMENT_NAME = "Terms of Service"; - private final Session session; private final User user; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index 852278ce..b9f3c67f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -2,27 +2,21 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; - import com.docusign.services.eSignature.examples.SigningViaEmailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -76,6 +70,4 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 9aaa9c54..31fc0ea7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -6,14 +6,7 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; -import com.docusign.esign.api.EnvelopesApi.ListStatusChangesOptions; import com.docusign.esign.client.ApiException; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -import javax.servlet.http.HttpServletResponse; - import com.docusign.esign.model.EnvelopesInformation; import com.docusign.services.eSignature.examples.ListEnvelopesServices; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +14,8 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; + /** * List envelopes in the user's account.
diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index 5b49cdcf..03d651b8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -35,7 +35,6 @@ public class EG004ControllerEnvelopeInfo extends AbstractEsignatureController { private final Session session; private final User user; - @Autowired public EG004ControllerEnvelopeInfo(DSConfiguration config, Session session, User user) { super(config, "eg004", "Get envelope information"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index 7a16b717..7086b127 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -29,7 +29,6 @@ public class EG005ControllerEnvelopeRecipients extends AbstractEsignatureControl private final Session session; private final User user; - @Autowired public EG005ControllerEnvelopeRecipients(DSConfiguration config, Session session, User user) { super(config, "eg005", "List envelope recipients"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index 66997040..addf2e8f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -3,12 +3,13 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.common.DocumentType; -import com.docusign.core.model.*; +import com.docusign.core.model.EnvelopeDocumentInfo; +import com.docusign.core.model.OptionItem; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; - import com.docusign.services.eSignature.examples.EnvelopeGetDocService; -import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; @@ -16,13 +17,12 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; -import javax.servlet.http.HttpServletResponse; - /** * Download a document from an envelope.
@@ -36,11 +36,9 @@ public class EG007ControllerEnvelopeGetDoc extends AbstractEsignatureController private static final String MODEL_DOCUMENT_OPTIONS = "documentOptions"; private static final String HTTP_CONTENT_DISPOSITION_VALUE = "inline;filename="; private static final String ZIP_EXTENSION = "zip"; - private final Session session; private final User user; - @Autowired public EG007ControllerEnvelopeGetDoc(DSConfiguration config, Session session, User user) { super(config, "eg007", "Download a document"); @@ -114,7 +112,6 @@ private static EnvelopeDocumentInfo find(List documents, S return docInfo; } } - throw new ExampleException("Requested document is not found.", null); } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index 27c8306d..fb4b9c81 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -5,34 +5,19 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.esign.api.TemplatesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; -import com.docusign.esign.model.Checkbox; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeTemplate; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.List; -import com.docusign.esign.model.ListItem; -import com.docusign.esign.model.Radio; -import com.docusign.esign.model.RadioGroup; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; import com.docusign.esign.model.TemplateSummary; -import com.docusign.esign.model.Text; import com.docusign.services.eSignature.examples.CreateTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; -import java.util.Locale; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -87,7 +72,6 @@ protected Object doWork(WorkArguments args, ModelMap model, template.getName(), template.getTemplateId())) .addToModel(model); } - return DONE_EXAMPLE_PAGE; } // ***DS.snippet.0.end diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index 3fc777ca..d4010246 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -12,14 +12,11 @@ import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.TemplateRole; - import com.docusign.services.eSignature.examples.UseTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; @@ -38,11 +35,9 @@ public class EG009ControllerUseTemplate extends AbstractEsignatureController { private static final String MODEL_LIST_TEMPLATE = "listTemplates"; - private final Session session; private final User user; - @Autowired public EG009ControllerUseTemplate(DSConfiguration config, Session session, User user) { super(config, "eg009", "Envelope sent"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index be0d19be..dd1e79e3 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -2,37 +2,18 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.esign.model.CarbonCopy; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; - import com.docusign.services.eSignature.examples.SendBinaryDocsService; -import lombok.Value; - -import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.util.StreamUtils; import org.springframework.web.bind.annotation.RequestMapping; -import javax.net.ssl.HttpsURLConnection; import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.MediaType; - -import java.io.DataOutputStream; import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.List; /** @@ -44,20 +25,9 @@ @RequestMapping("/eg010") public class EG010ControllerSendBinaryDocs extends AbstractEsignatureController { - private static final String LINE_DELIMITER = "\r\n"; - private static final String BOUNDARY_DELIMITER = "multipartboundary_multipartboundary"; - - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private final Session session; private final User user; - @Autowired public EG010ControllerSendBinaryDocs(DSConfiguration config, Session session, User user) { super(config, "eg010", "Send envelope with multipart mime"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index aeef77e0..cd76306f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -6,22 +6,17 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.ReturnUrlRequest; import com.docusign.esign.model.ViewUrl; - import com.docusign.services.eSignature.examples.EmbeddedSendingService; -import com.docusign.services.eSignature.examples.SigningViaEmailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; -import java.io.IOException; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -37,7 +32,6 @@ public class EG011ControllerEmbeddedSending extends AbstractEsignatureController private final Session session; private final User user; - @Autowired public EG011ControllerEmbeddedSending(DSConfiguration config, Session session, User user) { super(config, "eg011", "Signing request by email"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java index 059c28f1..e782fef3 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java @@ -6,11 +6,7 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.ConsoleViewRequest; import com.docusign.esign.model.ViewUrl; - -import javax.servlet.http.HttpServletResponse; - import com.docusign.services.eSignature.examples.EmbeddedConsoleService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -19,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; +import javax.servlet.http.HttpServletResponse; + /** * Embedded the DocuSign Web UI.
@@ -34,7 +32,6 @@ public class EG012ControllerEmbeddedConsole extends AbstractEsignatureController private final Session session; private final User user; - @Autowired public EG012ControllerEmbeddedConsole(DSConfiguration config, Session session, User user) { super(config, "eg012", "Embedded DocuSign web tool"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index 584ffcac..876eb60f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -2,25 +2,14 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.api.TemplatesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; -import com.docusign.esign.model.CompositeTemplate; -import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.InlineTemplate; -import com.docusign.esign.model.RecipientViewRequest; -import com.docusign.esign.model.ServerTemplate; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; import com.docusign.esign.model.ViewUrl; - import com.docusign.services.eSignature.examples.AddDocToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -28,10 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; -import java.io.IOException; -import java.util.Arrays; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -45,11 +32,9 @@ public class EG013ControllerAddDocToTemplate extends AbstractEsignatureController { private static final String MODEL_LIST_TEMPLATE = "listTemplates"; - private final Session session; private final User user; - @Autowired public EG013ControllerAddDocToTemplate(DSConfiguration config, Session session, User user) { super(config, "eg013", "Use embedded signing from template and extra doc"); @@ -89,6 +74,4 @@ protected Object doWork(WorkArguments args, ModelMap model, return new RedirectView(viewUrl.getUrl()); // Step 4 end } - - } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java index 7b3bc22a..4a683c6d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java @@ -29,7 +29,6 @@ public class EG015ControllerGetTabValues extends AbstractEsignatureController { private final Session session; private final User user; - @Autowired public EG015ControllerGetTabValues(DSConfiguration config, Session session, User user) { super(config, "eg015", "Get Envelope Tabs"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java index 199005bb..52740434 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java @@ -7,8 +7,10 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; - -import com.docusign.esign.model.*; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.RecipientViewRequest; +import com.docusign.esign.model.ViewUrl; import com.docusign.services.eSignature.examples.SetTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -16,10 +18,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; -import java.io.IOException; -import java.util.Arrays; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; @Controller @@ -29,7 +29,6 @@ public class EG016ControllerSetTabValues extends AbstractEsignatureController { private final Session session; private final User user; - @Autowired public EG016ControllerSetTabValues(DSConfiguration config, Session session, User user) { super(config, "eg016", "Set envelope tab values"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index 09825760..188a3aa5 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -9,8 +9,6 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; -import com.docusign.esign.model.Checkbox; -import com.docusign.esign.model.List; import com.docusign.services.eSignature.examples.SetTemplateTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -20,21 +18,17 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; @Controller @RequestMapping("/eg017") public class EG017ControllerSetTemplateTabValues extends AbstractEsignatureController { - private static final String MODEL_LIST_TEMPLATE = "listTemplates"; private static final String SIGNER_CLIENT_ID = "1000"; - private final Session session; private final User user; - @Autowired public EG017ControllerSetTemplateTabValues(DSConfiguration config, Session session, User user) { super(config, "eg017", "Set template tab values"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java index a24f4209..0dc00cb9 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java @@ -29,7 +29,6 @@ public class EG018ControllerEnvelopeCustomFieldValues extends AbstractEsignature private final Session session; private final User user; - @Autowired public EG018ControllerEnvelopeCustomFieldValues(DSConfiguration config, Session session, User user) { super(config, "eg018", "Get Envelope Custom Field Data"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index 29173f14..30a61e83 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -7,22 +7,16 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; - import com.docusign.services.eSignature.examples.AccessCodeAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -36,7 +30,6 @@ public class EG019ControllerAccessCodeAuthentication extends AbstractEsignatureC private final Session session; private final User user; - @Autowired public EG019ControllerAccessCodeAuthentication(DSConfiguration config, Session session, User user) { super(config, "eg019", "Signing request by email"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index 5278033e..287cfaae 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -5,29 +5,18 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.AccountIdentityVerificationResponse; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.RecipientIdentityInputOption; -import com.docusign.esign.model.RecipientIdentityPhoneNumber; -import com.docusign.esign.model.RecipientIdentityVerification; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; - import com.docusign.services.eSignature.examples.PhoneAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** * Example 020: Phone Authentication for recipient @@ -80,83 +69,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - - // Step 3b start - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, - String phone, String workFlowId) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your - // own systems. - // This value is referenced in the Tabs element below to assign tabs on a - // per-recipient basis. - signHere.setRecipientId("1"); - - RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber(); - phoneNumber.setCountryCode(countryCode); - phoneNumber.setNumber(phone); - - RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption(); - inputOption.setName("phone_number_list"); - inputOption.setValueType("PhoneNumberList"); - inputOption.setPhoneNumberList(Arrays.asList(phoneNumber)); - - RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification(); - - identityVerifcation.setWorkflowId(workFlowId); - identityVerifcation.setInputOptions(Arrays.asList(inputOption)); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setIdentityVerification(identityVerifcation); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - - return envelope; - } - - // retreives the workflow ID - private String getWorkflowId(String accountId) { - try { - AccountsApi workflowDetails = createAccountsApi(session.getBasePath(), user.getAccessToken()); - AccountIdentityVerificationResponse workflowResponse = workflowDetails - .getAccountIdentityVerification(accountId); - - // Check that idv authentication is enabled - // The workflow ID is a hard-coded value which is unique to this phone - // authentication workflow - if (workflowResponse.getIdentityVerification() != null) { - return "c368e411-1592-4001-a3df-dca94ac539ae"; - } else { - throw new RuntimeException("Identity Verification is not enabled for this account"); - } - - } catch (Exception e) { - return null; - } - - } - // Step 3b end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index e4a6d3ea..8515934d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -7,22 +7,16 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; - import com.docusign.services.eSignature.examples.KBAAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -35,7 +29,6 @@ public class EG022ControllerKBAAuthentication extends AbstractEsignatureControll private final Session session; private final User user; - @Autowired public EG022ControllerKBAAuthentication(DSConfiguration config, Session session, User user) { super(config, "eg022", "Signing request by email"); @@ -71,6 +64,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index baaa0dc0..afbe1165 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -5,20 +5,11 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.AccountIdentityVerificationResponse; -import com.docusign.esign.model.AccountIdentityVerificationWorkflow; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.RecipientIdentityVerification; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; import com.docusign.services.eSignature.examples.IdvAuthenticationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -27,11 +18,8 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Base64; -import java.util.Collections; -import java.util.List; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** * ID Verification authentication @@ -41,7 +29,6 @@ public class EG023ControllerIdvAuthentication extends AbstractEsignatureController { private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); - private final Session session; private final User user; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java index a60dc588..9ed940d5 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java @@ -4,7 +4,6 @@ import javax.servlet.http.HttpServletResponse; import com.docusign.common.WorkArguments; -import com.docusign.core.model.AccountRoleSettingsPatch; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -16,9 +15,7 @@ import com.docusign.DSConfiguration; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.AccountRoleSettings; import com.docusign.esign.model.PermissionProfile; -import com.google.gson.Gson; /** * Permission profiles are collections of account settings that determine the * behavior and actions available to the user groups to which they're applied. diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java index 666c31bc..e74e55df 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java @@ -1,28 +1,24 @@ package com.docusign.controller.eSignature.examples; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.eSignature.examples.PermissionSetUserGroupsService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; - -import com.docusign.DSConfiguration; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.GroupsApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.ErrorDetails; -import com.docusign.esign.model.Group; import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; +import com.docusign.services.eSignature.examples.PermissionSetUserGroupsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; /** @@ -37,11 +33,9 @@ public class EG025ControllerPermissionSetUserGroups extends AbstractEsignatureCo private static final String MODEL_LIST_PROFILES = "listProfiles"; private static final String MODEL_LIST_GROUPS = "listGroups"; - private final Session session; private final User user; - @Autowired public EG025ControllerPermissionSetUserGroups(DSConfiguration config, Session session, User user) { super(config, "eg025", "Setting a permission profile"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java index aef41372..27e4c9de 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java @@ -1,19 +1,14 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Optional; -import java.util.Random; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.model.AccountRoleSettingsPatch; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.PermissionProfile; +import com.docusign.esign.model.PermissionProfileInformation; import com.docusign.services.eSignature.examples.PermissionChangeSingleSettingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -22,13 +17,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import com.docusign.DSConfiguration; -import com.docusign.esign.api.AccountsApi; -import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.AccountRoleSettings; -import com.docusign.esign.model.PermissionProfile; -import com.docusign.esign.model.PermissionProfileInformation; -import com.google.gson.Gson; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; /** * This code example demonstrates how to edit individual permission settings on @@ -38,11 +29,9 @@ @RequestMapping("/eg026") public class EG026ControllerPermissionChangeSingleSetting extends AbstractEsignatureController { - private static final String MODEL_PERMISSIONS = "permissions"; private static final String MODEL_CUR_PROFILE_NAME = "permissionProfileName"; private static final String MODEL_CUR_PROFILE_ID = "profileId"; private static final String MODEL_LIST_PROFILES = "listProfiles"; - private final Session session; private final User user; @@ -76,8 +65,6 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { model.addAttribute(MODEL_CUR_PROFILE_NAME, curProfile.getPermissionProfileName()); model.addAttribute(MODEL_CUR_PROFILE_ID, curProfile.getPermissionProfileId()); - // model.addAttribute(MODEL_PERMISSIONS, - // Utils.compareFields(curProfile.getSettings(), null, true)); }); } @@ -99,6 +86,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse + newProfile.getPermissionProfileId() + ".").addToModel(model); return DONE_EXAMPLE_PAGE_COMPARE; } - - } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java index b050e422..5309e098 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java @@ -29,11 +29,9 @@ public class EG027ControllerPermissionDelete extends AbstractEsignatureController { private static final String MODEL_LIST_PROFILES = "listProfiles"; - private final Session session; private final User user; - @Autowired public EG027ControllerPermissionDelete(DSConfiguration config, Session session, User user) { super(config, "eg027", "Deleting a permission profile"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java index 0a083857..539f402d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java @@ -28,11 +28,9 @@ public class EG028ControllerCreateBrand extends AbstractEsignatureController { private static final String MODEL_LIST_LANGUAGE = "listLanguage"; - private final Session session; private final User user; - @Autowired public EG028ControllerCreateBrand(DSConfiguration config, Session session, User user) { super(config, "eg028", "Creating a brand"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index 6d2a6527..c0140161 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -1,32 +1,24 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.eSignature.examples.ApplyBrandToEnvelopeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; - -import com.docusign.DSConfiguration; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.BrandsResponse; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; +import com.docusign.services.eSignature.examples.ApplyBrandToEnvelopeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -39,11 +31,9 @@ public class EG029ControllerApplyBrandToEnvelope extends AbstractEsignatureController { private static final String MODEL_LIST_BRAND = "listBrands"; - private final Session session; private final User user; - @Autowired public EG029ControllerApplyBrandToEnvelope(DSConfiguration config, Session session, User user) { super(config, "eg029", "Apply brand to envelope"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index e0e26f9a..d459aa5e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -44,11 +44,9 @@ public class EG030ControllerApplyBrandToTemplate extends AbstractEsignatureContr private static final String MODEL_LIST_BRAND = "listBrands"; private static final String MODEL_LIST_TEMPLATE = "listTemplates"; - private final Session session; private final User user; - @Autowired public EG030ControllerApplyBrandToTemplate(DSConfiguration config, Session session, User user) { super(config, "eg030", "Apply brand to template"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index 2c0c7153..b0916989 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -30,11 +30,9 @@ public class EG031ControllerBulkSendEnvelopes extends AbstractEsignatureController { private static final long BULK_REQUEST_DELAY = 15L; - private final Session session; private final User user; - @Autowired public EG031ControllerBulkSendEnvelopes(DSConfiguration config, Session session, User user) { super(config, "eg031", "Bulk sending envelopes to multiple recipients"); @@ -81,9 +79,6 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse Thread.currentThread().interrupt(); return null; } - return DONE_EXAMPLE_PAGE; } - - } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index f69e1bb9..55991b78 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -29,7 +29,6 @@ public class EG032ControllerPauseSignatureWorkflow extends AbstractEsignatureCon private final Session session; private final User user; - @Autowired public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session session, User user) { super(config, "eg032", "Pause a signature workflow."); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index 4f6e0d34..05597dc9 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -7,9 +7,7 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Envelope; import com.docusign.esign.model.EnvelopeUpdateSummary; -import com.docusign.esign.model.Workflow; import com.docusign.services.eSignature.examples.UnpauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -29,7 +27,6 @@ public class EG033ControllerUnpauseSignatureWorkflow extends AbstractEsignatureC private final Session session; private final User user; - @Autowired public EG033ControllerUnpauseSignatureWorkflow(DSConfiguration config, Session session, User user) { super(config, "eg033", "Unpause a signature workflow"); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index 5551bbcc..5b58a5a7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -27,11 +27,9 @@ public class EG034ControllerUseConditionalRecipients extends AbstractEsignatureController { private static final String NOT_ALLOWED_ERROR_MESSAGE = "Update to the workflow with recipient routing is not allowed"; - private final Session session; private final User user; - @Autowired public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session session, User user) { super(config, "eg034", "Use conditional recipients."); @@ -44,7 +42,6 @@ public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session s protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); @@ -87,6 +84,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - // ***DS.snippet.0.end } \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java index 147c02d1..78968b87 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java @@ -2,30 +2,21 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; -import com.docusign.esign.model.RecipientAdditionalNotification; -import com.docusign.esign.model.RecipientPhoneNumber; - import com.docusign.services.eSignature.examples.SMSDeliveryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; - +import java.io.IOException; /** * Send an envelope with a remote (email) signer and cc recipient.
@@ -36,15 +27,6 @@ @RequestMapping("/eg035") public class EG035ControllerSMSDelivery extends AbstractEsignatureController { - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private final Session session; private final User user; diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 5a372f46..e1e5b343 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -5,12 +5,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.monitor.api.DataSetApi; -import com.docusign.monitor.api.DataSetApi.GetStreamOptions; -import com.docusign.monitor.model.CursoredResult; import com.docusign.services.monitor.examples.GetMonitoringDataService; import org.json.JSONArray; -import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -18,7 +14,6 @@ import javax.servlet.http.HttpServletResponse; - /** * Get monitoring data
* This example demonstrates how to get monitoring data from the Monitor API. diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index e2627d28..71a618bb 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -28,7 +28,6 @@ public class R001ControllerCreateRoom extends AbstractRoomsController { private final Session session; private final User user; - @Autowired public R001ControllerCreateRoom(DSConfiguration config, Session session, User user) { super(config, "r001", "Create a room"); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 57d2b339..887c183c 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -28,12 +28,9 @@ public class R002ControllerCreateRoomWithTemplate extends AbstractRoomsController { private static final String MODEL_TEMPLATES_LIST = "templateList"; - - private final Session session; private final User user; - @Autowired public R002ControllerCreateRoomWithTemplate(DSConfiguration config, Session session, User user) { super(config, "r002", "Create a room with template"); @@ -75,7 +72,6 @@ protected Object doWork(WorkArguments args, ModelMap model, args.getRoomName(), args.getRoomTemplateId())); - DoneExample.createDefault(this.title) .withJsonObject(createdRoom) .withMessage("The room has been created!
Room ID " + createdRoom.getRoomId() + ".") diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index 7355e113..eee36f16 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -5,11 +5,9 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FieldData; -import com.docusign.rooms.model.RoleSummaryList; import com.docusign.rooms.model.RoomSummaryList; import com.docusign.services.rooms.examples.ExportingDataFromRoomService; import org.springframework.beans.factory.annotation.Autowired; @@ -29,11 +27,9 @@ public class R003ControllerExportingDataFromRoom extends AbstractRoomsController { private static final String MODEL_ROOM_LIST = "roomList"; - private final Session session; private final User user; - @Autowired public R003ControllerExportingDataFromRoom(DSConfiguration config, Session session, User user) { super(config, "r003", "Exporting data from a room"); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 159022ae..1dcfb542 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -5,11 +5,11 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.FormDetailsApi; -import com.docusign.rooms.api.FormLibrariesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; -import com.docusign.rooms.model.*; +import com.docusign.rooms.model.FormSummary; +import com.docusign.rooms.model.RoomDocument; +import com.docusign.rooms.model.RoomSummaryList; import com.docusign.services.rooms.examples.AddingFormsToRoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -30,11 +30,9 @@ public class R004ControllerAddingFormsToRoom extends AbstractRoomsController { private static final String MODEL_FORM_LIST = "formList"; private static final String MODEL_ROOM_LIST = "roomList"; - private final Session session; private final User user; - @Autowired public R004ControllerAddingFormsToRoom(DSConfiguration config, Session session, User user) { super(config, "r004", "Adding forms to a room"); @@ -56,7 +54,6 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); model.addAttribute(MODEL_FORM_LIST, forms); - } @Override diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index 2eb002df..e2bc1abe 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -5,11 +5,9 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.RoomTemplatesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.RoomSummaryList; -import com.docusign.rooms.model.RoomTemplatesSummaryList; import com.docusign.services.rooms.examples.GetRoomsWithFiltersService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -31,15 +29,12 @@ public class R005ControllerGetRoomsWithFilters extends AbstractRoomsController { private static final String MODEL_START_DATE = "startDate"; private static final String MODEL_END_DATE = "endDate"; - private static final int FROM_DATE_OFFSET_DAYS = 10; private static final int FROM_DATE_FORWARD_DAYS = 1; private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - private final Session session; private final User user; - @Autowired public R005ControllerGetRoomsWithFilters(DSConfiguration config, Session session, User user) { super(config, "r005", "Get Rooms with filters"); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index 1c6a68fe..1f9c2a98 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -6,11 +6,9 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.rooms.api.ExternalFormFillSessionsApi; -import com.docusign.rooms.api.FormLibrariesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.ExternalFormFillSession; -import com.docusign.rooms.model.ExternalFormFillSessionForCreate; import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomSummaryList; import com.docusign.services.rooms.examples.CreateExternalFormFillSessionService; @@ -23,7 +21,6 @@ import java.io.IOException; import java.util.List; - /** * Creating an external form fill session. */ @@ -57,7 +54,6 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); model.addAttribute(MODEL_FORM_LIST, forms); - } @Override @@ -72,12 +68,11 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 3. Call the v2 Rooms API ExternalFormFillSession externalFormFillSession = CreateExternalFormFillSessionService .createExternalFormFillSession( - externalFormFillSessionsApi, - this.session.getAccountId(), - args.getFormId().toString(), - args.getRoomId() - ); - + externalFormFillSessionsApi, + this.session.getAccountId(), + args.getFormId().toString(), + args.getRoomId() + ); DoneExample.createDefault(this.title) .withJsonObject(externalFormFillSession) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 9646fd0d..ed4a7084 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -8,7 +8,6 @@ import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FormGroup; -import com.docusign.rooms.model.FormGroupForCreate; import com.docusign.services.rooms.examples.CreateFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index 15c5eefe..9683803a 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -28,10 +28,8 @@ public class R008ControllerGrantOfficeAccessToFormGroup extends AbstractRoomsCon private static final String MODEL_OFFICE_LIST = "officeList"; private static final String MODEL_FORM_GROUP_LIST = "formGroupList"; private static final String OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP_ERROR_MESSAGE = "OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP"; - private final Session session; private final User user; - private FormGroupsApi formGroupsApi; @Autowired diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 24d09f09..c72668e2 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -30,8 +30,6 @@ public class R009ControllerAssignFormToFormGroup extends AbstractRoomsController private static final String MODEL_FORM_LIST = "formList"; private static final String MODEL_FORM_GROUP_LIST = "formGroupList"; private static final String FORM_ALREADY_EXISTS_ERROR_MESSAGE = "Form in the form group already exists"; - - private final Session session; private final User user; private FormGroupsApi formGroupsApi; diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 6cb561c0..27e5d603 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -44,7 +44,7 @@ public ApiClient getApiClient() { } public List getScopeByApiName(){ -//Only signature scope is needed for eSIgnature api. Impersonation scope is implied. + //Only signature scope is needed for eSignature api. Impersonation scope is implied. return getScope(); } } diff --git a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java index 42b96e9f..769aacf0 100644 --- a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java +++ b/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java @@ -2,11 +2,6 @@ import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.*; -import com.docusign.common.WorkArguments; -import com.docusign.core.model.DoneExample; -import org.springframework.ui.ModelMap; - -import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.UUID; diff --git a/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java b/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java index 8d008577..db98c051 100644 --- a/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java +++ b/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java @@ -19,13 +19,15 @@ public static ArrayList auditUsers( UUID organizationId, UUID accountId ) throws ApiException { - ArrayList resultsArr = new ArrayList(); + ArrayList resultsArr = new ArrayList<>(); // Step 3 start UsersApi.GetUsersOptions options = usersApi.new GetUsersOptions(); options.setAccountId(accountId); - TimeZone tz = TimeZone.getTimeZone("UTC"); - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); + String timeZoneId = "UTC"; + String simpleDateFormat = "yyyy-MM-dd'T'HH:mm'Z'"; + TimeZone tz = TimeZone.getTimeZone(timeZoneId); + SimpleDateFormat df = new SimpleDateFormat(simpleDateFormat); // Quoted "Z" to indicate UTC, no timezone offset df.setTimeZone(tz); String nowAsISO = df.format(new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * 10))); diff --git a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java index 47dca1e1..3cc06775 100644 --- a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java +++ b/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java @@ -7,6 +7,7 @@ import java.util.UUID; public class BulkImportUserDataService { + private static final String BULK_IMPORT_TEXT = "AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender"; public static OrganizationImportResponse bulkImportUserData( BulkImportsApi bulkImportsApi, UUID organizationId, @@ -14,10 +15,7 @@ public static OrganizationImportResponse bulkImportUserData( ) throws Exception{ // Make sure you're using a verified domain for auto-activation to work properly // Step 3 start - String csvUserData = String.format( - "AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender", - accountId, - accountId); + String csvUserData = String.format(BULK_IMPORT_TEXT, accountId, accountId); byte[] csvDataInBytes = csvUserData.getBytes(StandardCharsets.UTF_8); return bulkImportsApi.createBulkImportSingleAccountAddUsersRequest(organizationId, accountId, csvDataInBytes); diff --git a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java index 5ed80393..aa6cd468 100644 --- a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java +++ b/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java @@ -5,7 +5,6 @@ import com.docusign.admin.model.DSGroupRequest; import com.docusign.admin.model.NewMultiProductUserAddRequest; import com.docusign.admin.model.ProductPermissionProfileRequest; -import com.docusign.common.WorkArguments; import java.util.UUID; diff --git a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java index d57e449a..c3ba1eaf 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java @@ -1,13 +1,12 @@ package com.docusign.services.eSignature.examples; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; import java.io.IOException; -import java.util.Arrays; +import java.util.Collections; public final class AccessCodeAuthenticationService { private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; @@ -28,33 +27,15 @@ public static EnvelopeDefinition createEnvelope( ) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + Signer signer = KBAAuthenticationService.setSignHereAndSignerForEnvelope(signerName, signerEmail); signer.setAccessCode(accessCode); Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); + recipients.setSigners(Collections.singletonList(signer)); EnvelopeDefinition envelope = new EnvelopeDefinition(); envelope.setEmailSubject("Please Sign"); - envelope.setDocuments(Arrays.asList(doc)); + envelope.setDocuments(Collections.singletonList(doc)); envelope.setEnvelopeIdStamping("true"); envelope.setEmailBlurb("Sample text for email body"); envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); diff --git a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java index 337af449..a323f86e 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java @@ -9,7 +9,7 @@ import java.io.IOException; import java.util.Arrays; -import java.util.UUID; +import java.util.Collections; public final class AddDocToTemplateService { private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl"; @@ -71,7 +71,8 @@ private static RecipientViewRequest makeRecipientViewRequest( // How has your app authenticated the user? In addition to your app's // authentication, you can include authenticate steps from DocuSign. // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); + String authenticationMethod = "none"; + viewRequest.setAuthenticationMethod(authenticationMethod); // Recipient information must match embedded recipient info // we used to create the envelope. viewRequest.setEmail(signerEmail); @@ -84,7 +85,8 @@ private static RecipientViewRequest makeRecipientViewRequest( // parameter. It causes the DocuSign signing web page // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); + String pingFrequency = "600"; + viewRequest.setPingFrequency(pingFrequency); viewRequest.setPingUrl(dsPingUrl); return viewRequest; @@ -115,7 +117,7 @@ private static EnvelopeDefinition makeEnvelope( ServerTemplate serverTemplates = new ServerTemplate(); serverTemplates.setSequence("1"); serverTemplates.setTemplateId(templateId); - compTemplate1.setServerTemplates(Arrays.asList(serverTemplates)); + compTemplate1.setServerTemplates(Collections.singletonList(serverTemplates)); // Add the roles via an inlineTemplate InlineTemplate inlineTemplate = new InlineTemplate(); @@ -127,7 +129,7 @@ private static EnvelopeDefinition makeEnvelope( signerClientId ), cc1)); - compTemplate1.setInlineTemplates(Arrays.asList(inlineTemplate)); + compTemplate1.setInlineTemplates(Collections.singletonList(inlineTemplate)); // The signer recipient for the added document with a tab definition: Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab( @@ -150,7 +152,7 @@ private static EnvelopeDefinition makeEnvelope( InlineTemplate inlineTemplate2 = new InlineTemplate(); inlineTemplate2.setSequence("1"); inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc1)); - compTemplate2.setInlineTemplates(Arrays.asList(inlineTemplate2)); + compTemplate2.setInlineTemplates(Collections.singletonList(inlineTemplate2)); compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, DocumentType.HTML.getDefaultFileExtention(), "1")); diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java index 77a093e1..2a078950 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java @@ -1,13 +1,12 @@ package com.docusign.services.eSignature.examples; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; import java.io.IOException; -import java.util.Arrays; +import java.util.Collections; import java.util.List; public final class ApplyBrandToEnvelopeService { @@ -45,7 +44,7 @@ public static EnvelopeDefinition makeEnvelope( .tabs(tabs); Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); + recipients.setSigners(Collections.singletonList(signer)); // Return envelope definition using created objects: the document, // the recipients and obtained brand Id. diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java index 1c0b8551..d08f50c6 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java @@ -1,6 +1,5 @@ package com.docusign.services.eSignature.examples; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java index a4543641..e6738fdd 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java @@ -1,6 +1,5 @@ package com.docusign.services.eSignature.examples; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.DsModelUtils; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.BulkEnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java index 3d5bacfd..895543c9 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java @@ -8,6 +8,7 @@ import com.docusign.core.common.DocumentType; import java.io.IOException; import java.util.Arrays; +import java.util.Collections; public final class CollectPaymentService { private static final String HTML_DOCUMENT_FILE_NAME = "templates/order-form.ftl"; @@ -76,7 +77,7 @@ public static EnvelopeDefinition makeEnvelope( // To request that the envelope be created as a draft, set to "created" EnvelopeDefinition envelope = new EnvelopeDefinition(); envelope.setEmailSubject("Please complete your order"); - envelope.setDocuments(Arrays.asList(EnvelopeHelpers.createDocument(htmlDoc, + envelope.setDocuments(Collections.singletonList(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, DocumentType.HTML.getDefaultFileExtention(), "1"))); envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); diff --git a/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java index 6044d5ad..9e25755d 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.util.Arrays; +import java.util.Collections; import java.util.Locale; public final class CreateTemplateService { @@ -54,9 +55,9 @@ public static EnvelopeTemplate makeTemplate(String templateName) throws IOExcept createCheckbox("ckAuthentication", "75", "447"), createCheckbox("ckAgreement", "75", "478"), createCheckbox("ckAcknowledgement", "75", "508"))); - signer1Tabs.setListTabs(Arrays.asList(createList())); - signer1Tabs.setRadioGroupTabs(Arrays.asList(createRadioGroup())); - signer1Tabs.setSignHereTabs(Arrays.asList(createSignHere())); + signer1Tabs.setListTabs(Collections.singletonList(createList())); + signer1Tabs.setRadioGroupTabs(Collections.singletonList(createRadioGroup())); + signer1Tabs.setSignHereTabs(Collections.singletonList(createSignHere())); signer1Tabs.textTabs(Arrays.asList( createText("text", "153", "230"), createText("numbersOnly", "153", "260"))); @@ -80,7 +81,7 @@ public static EnvelopeTemplate makeTemplate(String templateName) throws IOExcept // Create the overall template definition. The order in the docs array // determines the order in the envelope. EnvelopeTemplate template = new EnvelopeTemplate(); - template.setDocuments(Arrays.asList(doc)); + template.setDocuments(Collections.singletonList(doc)); template.setEmailSubject("Please sign this document"); template.setName(templateName); template.setDescription("Example template created via the API"); diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java index 6ea9df37..6add7e77 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java @@ -7,7 +7,7 @@ import com.docusign.esign.model.*; import java.io.IOException; -import java.util.Arrays; +import java.util.Collections; public final class EmbeddedSigningService { public static ViewUrl embeddedSigning( @@ -78,13 +78,13 @@ public static EnvelopeDefinition makeEnvelope( // Add the recipient to the envelope object Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); + recipients.setSigners(Collections.singletonList(signer)); EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); envelopeDefinition.setEmailSubject("Please sign this document"); envelopeDefinition.setRecipients(recipients); Document doc = EnvelopeHelpers.createDocumentFromFile(documentFileName, documentName, "3"); - envelopeDefinition.setDocuments(Arrays.asList(doc)); + envelopeDefinition.setDocuments(Collections.singletonList(doc)); // Request that the envelope be sent by setting |status| to "sent". // To request that the envelope be created as a draft, set to "created" envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java index eba90b08..d91d92b8 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java @@ -2,12 +2,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.EnvelopeDocument; import com.docusign.esign.model.EnvelopeDocumentsResult; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; public final class EnvelopeDocsService { public static EnvelopeDocumentsResult envelopeDocs( diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java index 03cb5d80..5fdb3ea1 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java @@ -1,11 +1,8 @@ package com.docusign.services.eSignature.examples; -import com.docusign.controller.eSignature.examples.ExampleException; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.StringUtils; -import java.util.List; public final class EnvelopeGetDocService { diff --git a/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java index 211eb5f6..9ad28ebb 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java @@ -6,7 +6,7 @@ import com.docusign.esign.model.*; import java.io.IOException; -import java.util.Arrays; +import java.util.Collections; public final class KBAAuthenticationService { private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; @@ -20,12 +20,10 @@ public static EnvelopeSummary kbaAuthentication( return envelopesApi.createEnvelope(accountId, envelope); } - public static EnvelopeDefinition createEnvelope( + public static Signer setSignHereAndSignerForEnvelope( String signerName, - String signerEmail - ) throws IOException { + String signerEmail) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - SignHere signHere = new SignHere(); signHere.setName("SignHereTab"); signHere.setXPosition("75"); @@ -45,18 +43,28 @@ public static EnvelopeDefinition createEnvelope( signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); signer.setRecipientId(signHere.getRecipientId()); signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + + return signer; + } + + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail + ) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + Signer signer = setSignHereAndSignerForEnvelope(signerName, signerEmail); signer.setIdCheckConfigurationName("ID Check"); signer.setRequireIdLookup("true"); Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); + recipients.setSigners(Collections.singletonList(signer)); EnvelopeDefinition envelope = new EnvelopeDefinition(); envelope.setEmailSubject("Please Sign"); envelope.setEnvelopeIdStamping("true"); envelope.setEmailBlurb("Sample text for email body"); envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setDocuments(Arrays.asList(doc)); + envelope.setDocuments(Collections.singletonList(doc)); envelope.setRecipients(recipients); return envelope; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java b/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java index 77269f2a..dfc73ab5 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java @@ -1,6 +1,5 @@ package com.docusign.services.eSignature.examples; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java b/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java index e29a0835..e905b221 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java @@ -11,7 +11,7 @@ public class PermissionCreateService { public static PermissionProfile createNewProfile( AccountsApi accountsApi, - String accountid, + String accountId, String permissionProfileName ) throws ApiException { // Step 3. Construct your request body @@ -25,6 +25,6 @@ public static PermissionProfile createNewProfile( .settings(newSettings); // Step 4. Call the eSignature REST API - return accountsApi.createPermissionProfile(accountid, profile); + return accountsApi.createPermissionProfile(accountId, profile); } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java index d1615ea5..4c4623e9 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java @@ -6,7 +6,7 @@ import com.docusign.esign.model.*; import java.io.IOException; -import java.util.Arrays; +import java.util.Collections; import java.util.List; public final class PhoneAuthenticationService { @@ -28,35 +28,19 @@ public static EnvelopeDefinition createEnvelope( ) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); + Signer signer = KBAAuthenticationService.setSignHereAndSignerForEnvelope(signerName, signerEmail); + List RECIPIENT_PHONE_NUMBERS = List.of(phoneNumber); RecipientPhoneAuthentication phoneAuth = new RecipientPhoneAuthentication(); phoneAuth.setRecipMayProvideNumber("true"); phoneAuth.setSenderProvidedNumbers(RECIPIENT_PHONE_NUMBERS); - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); signer.setRequireIdLookup("true"); signer.setPhoneAuthentication(phoneAuth); signer.setIdCheckConfigurationName("Phone Auth $"); Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); + recipients.setSigners(Collections.singletonList(signer)); EnvelopeDefinition envelope = new EnvelopeDefinition(); envelope.setEmailSubject("Please Sign"); @@ -64,7 +48,7 @@ public static EnvelopeDefinition createEnvelope( envelope.setEmailBlurb("Sample text for email body"); envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); envelope.setRecipients(recipients); - envelope.setDocuments(Arrays.asList(doc)); + envelope.setDocuments(Collections.singletonList(doc)); return envelope; } diff --git a/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java b/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java index bbfe80f8..74c7bf5e 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.util.Arrays; +import java.util.Collections; public final class SMSDeliveryService { private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; @@ -76,7 +77,7 @@ public static EnvelopeDefinition makeEnvelope( phoneNumber.setCountryCode(countryCode); phoneNumber.setNumber(phoneNumberFromRecipient); smsDelivery.phoneNumber(phoneNumber); - signer.setAdditionalNotifications(Arrays.asList(smsDelivery)); + signer.setAdditionalNotifications(Collections.singletonList(smsDelivery)); // create a cc recipient to receive a copy of the documents, identified by name and email CarbonCopy cc = new CarbonCopy(); @@ -92,7 +93,7 @@ public static EnvelopeDefinition makeEnvelope( ccPhoneNumber.setCountryCode(ccCountryCode); ccPhoneNumber.setNumber(ccPhoneNumberFromRecipient); ccSmsDelivery.phoneNumber(ccPhoneNumber); - cc.setAdditionalNotifications(Arrays.asList(ccSmsDelivery)); + cc.setAdditionalNotifications(Collections.singletonList(ccSmsDelivery)); // The order in the docs array determines the order in the envelope byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); diff --git a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java index d947b377..3083599c 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java @@ -190,9 +190,9 @@ private static JSONObject makeEnvelopeJSON( } @Value public static class DocumentInfo { - private String name; - private String id; - private DocumentType docType; - private byte[] data; + String name; + String id; + DocumentType docType; + byte[] data; } } diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java index 19438f3c..c053f107 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.util.Arrays; +import java.util.Collections; public final class SetTabValuesService { private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_salary.docx"; @@ -126,23 +127,23 @@ public static EnvelopeDefinition makeEnvelope(String signerEmail, String signerN salaryCustomField.setValue(String.valueOf(salary)); CustomFields cf = new CustomFields(); - cf.setTextCustomFields(Arrays.asList(salaryCustomField)); + cf.setTextCustomFields(Collections.singletonList(salaryCustomField)); Tabs tabs = new Tabs(); - tabs.setSignHereTabs(Arrays.asList(signHere)); + tabs.setSignHereTabs(Collections.singletonList(signHere)); tabs.setTextTabs(Arrays.asList(textLegal, textFamiliar, textSalary)); signer.setTabs(tabs); // Add the recipient to the envelope object Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); + recipients.setSigners(Collections.singletonList(signer)); EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); envelopeDefinition.setRecipients(recipients); Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "3"); - envelopeDefinition.setDocuments(Arrays.asList(doc)); + envelopeDefinition.setDocuments(Collections.singletonList(doc)); envelopeDefinition.setCustomFields(cf); // Request that the envelope be sent by setting |status| to "sent". // To request that the envelope be created as a draft, set to "created" diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java index dc40218e..4484ef19 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java @@ -6,6 +6,7 @@ import com.docusign.esign.model.*; import java.util.Arrays; +import java.util.Collections; public final class SetTemplateTabValuesService { public static ViewUrl setTemplateTabValues( @@ -90,7 +91,7 @@ public static EnvelopeDefinition makeEnvelope( RadioGroup rg = new RadioGroup(); rg.setGroupName("radio1"); - rg.setRadios(Arrays.asList(radio)); + rg.setRadios(Collections.singletonList(radio)); Text txt = new Text(); @@ -123,9 +124,9 @@ public static EnvelopeDefinition makeEnvelope( Tabs tabs = new Tabs(); tabs.setTextTabs(Arrays.asList(txt, txtExtra)); - tabs.setRadioGroupTabs(Arrays.asList(rg)); + tabs.setRadioGroupTabs(Collections.singletonList(rg)); tabs.setCheckboxTabs(Arrays.asList(ck1, ck2)); - tabs.setListTabs(Arrays.asList(list1)); + tabs.setListTabs(Collections.singletonList(list1)); // create a signer recipient to sign the document, identified by name and email @@ -153,7 +154,7 @@ public static EnvelopeDefinition makeEnvelope( CustomFields cf = new CustomFields(); - cf.setTextCustomFields(Arrays.asList(customField)); + cf.setTextCustomFields(Collections.singletonList(customField)); // Next, create the top level envelope definition and populate it. diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java b/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java index 68f0a7ff..62dd4ebf 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java @@ -1,6 +1,5 @@ package com.docusign.services.eSignature.examples; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java index 984be2f4..9abf45cc 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java @@ -1,6 +1,5 @@ package com.docusign.services.eSignature.examples; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java index 7000c96b..e7aeffab 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java +++ b/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java @@ -28,9 +28,7 @@ public static RoomForCreate createRoom(Integer roleId, String roomName, Integer .putDataItem("state", "US-HI") .putDataItem("postalCode", "11112") .putDataItem("companyRoomStatus", "5") - .putDataItem( - "comments", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") ); } } From 343af960e5cd54b4789d91191780e84d8135c3e9 Mon Sep 17 00:00:00 2001 From: annahileta Date: Mon, 1 Nov 2021 16:53:50 +0200 Subject: [PATCH 215/699] removed duplicates --- .../admin/examples/A001AddActiveUser.java | 12 ++- .../A002CreateActiveCLMESignUser.java | 12 ++- .../examples/A004BulkImportUserData.java | 6 +- .../admin/examples/A005AuditUsers.java | 6 +- .../examples/AbstractAdminController.java | 47 +---------- .../examples/AbstractClickController.java | 28 ------- .../examples/AbstractRoomsController.java | 80 ------------------- .../examples/R001ControllerCreateRoom.java | 6 +- .../R002ControllerCreateRoomWithTemplate.java | 6 +- .../R004ControllerAddingFormsToRoom.java | 6 +- ...ntrollerCreateExternalFormFillSession.java | 6 +- .../R009ControllerAssignFormToFormGroup.java | 6 +- .../controller/GlobalControllerAdvice.java | 20 ++--- .../examples/GetExistingAccountIdService.java | 38 +++++++++ .../examples/AddDocToTemplateService.java | 27 ++----- .../examples/EmbeddedSigningService.java | 9 ++- .../examples/IdvAuthenticationService.java | 6 +- .../examples/SetTabValuesService.java | 22 ++++- .../examples/SetTemplateTabValuesService.java | 31 ++----- .../rooms/examples/GetAdminRolesService.java | 19 +++++ .../examples/GetFormSummaryListService.java | 30 +++++++ 21 files changed, 178 insertions(+), 245 deletions(-) create mode 100644 src/main/java/com/docusign/services/admin/examples/GetExistingAccountIdService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/GetAdminRolesService.java create mode 100644 src/main/java/com/docusign/services/rooms/examples/GetFormSummaryListService.java diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index 97233f46..e81da65d 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -12,6 +12,7 @@ import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; import com.docusign.services.admin.examples.AddActiveUserService; +import com.docusign.services.admin.examples.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -50,7 +51,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3 start AccountsApi accountsApi = new AccountsApi(apiClient); UUID orgId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), orgId); + UUID accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + config.getSignerEmail(), + orgId); PermissionProfileInformation permissionsInfo = accountsApi.listPermissions(String.valueOf(accountId)); // Step 3 end @@ -69,9 +73,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse UUID organizationId = this.getOrganizationId( this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId( - this.user.getAccessToken(), - this.session.getBasePath(), + UUID accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + config.getSignerEmail(), organizationId); NewUserResponse result = AddActiveUserService.addActiveUser( diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 0c88ff38..6d1ad2db 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -13,6 +13,7 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.services.admin.examples.CreateActiveCLMESignUserService; +import com.docusign.services.admin.examples.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -44,7 +45,10 @@ public A002CreateActiveCLMESignUser(DSConfiguration config, Session session, Use protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(user.getAccessToken(), session.getBasePath(), organizationId); + UUID accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + config.getSignerEmail(), + organizationId); // Step 3 start ProductPermissionProfilesApi permissionsInfo = this.createProductPermissionProfilesApi(user.getAccessToken(), @@ -92,9 +96,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Collect ids needed for the request UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId( - this.user.getAccessToken(), - this.session.getBasePath(), + UUID accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + config.getSignerEmail(), organizationId); AddUserResponse result = CreateActiveCLMESignUserService.createNewActiveUser( diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 6d5818cb..1bfea7df 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -8,6 +8,7 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.services.admin.examples.BulkImportUserDataService; +import com.docusign.services.admin.examples.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -39,7 +40,10 @@ public A004BulkImportUserData(DSConfiguration config, Session session, User user protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { // Collect ids and user data needed for the request UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); + UUID accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + config.getSignerEmail(), + organizationId); BulkImportsApi bulkImportsApi = createBulkImportsApi(this.user.getAccessToken(), this.session.getBasePath()); OrganizationImportResponse result = BulkImportUserDataService diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 54ee5299..65cdd81a 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -8,6 +8,7 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.services.admin.examples.AuditUsersService; +import com.docusign.services.admin.examples.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -39,7 +40,10 @@ public A005AuditUsers(DSConfiguration config, Session session, User user) { protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { // Collect ids needed for the request UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); + UUID accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + config.getSignerEmail(), + organizationId); UsersApi adminApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); diff --git a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java index 9d53246f..2d3a23cc 100644 --- a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java +++ b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java @@ -1,18 +1,10 @@ package com.docusign.controller.admin.examples; import com.docusign.DSConfiguration; -import com.docusign.admin.api.AccountsApi; -import com.docusign.admin.api.BulkExportsApi; -import com.docusign.admin.api.BulkImportsApi; -import com.docusign.admin.api.DsGroupsApi; -import com.docusign.admin.api.ProductPermissionProfilesApi; -import com.docusign.admin.api.UsersApi; -import com.docusign.admin.api.UsersApi.GetUserProfilesOptions; +import com.docusign.admin.api.*; import com.docusign.admin.client.ApiClient; import com.docusign.admin.client.ApiException; -import com.docusign.admin.model.UsersDrilldownResponse; import com.docusign.core.controller.AbstractController; - import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; @@ -24,12 +16,10 @@ @Controller public abstract class AbstractAdminController extends AbstractController { - private final DSConfiguration configuration; private static final String EXAMPLE_PAGES_PATH = "pages/admin/examples/"; public AbstractAdminController(DSConfiguration config, String exampleName, String title) { super(config, exampleName, title); - this.configuration = config; } protected String getExamplePagesPath() { @@ -87,39 +77,8 @@ protected static BulkImportsApi createBulkImportsApi(String accessToken, String return new BulkImportsApi(apiClient); } - /** - * Creates a request to get current user. - * @param accessToken user's access token - * @param basePath basePath to the server - * @param organizationId the ID of current organization - * @return the account Id - */ - protected UUID getExistingAccountId( - String accessToken, - String basePath, - UUID organizationId - ) throws Exception { - UsersApi usersApi = createUsersApi(accessToken, basePath); - - // set the signer email to get an information about that user - // new GetUsersOptions() will throw "an enclosing instance that contains com.docusign.admin.api.UsersApi.GetUserProfilesOptions is required" - // at compile time. I used this workaround from stackOverflow: - // https://stackoverflow.com/a/4297913/2226328 - - GetUserProfilesOptions userProfilesOptions = usersApi.new GetUserProfilesOptions(); - userProfilesOptions.setEmail(configuration.getSignerEmail()); - - UsersDrilldownResponse user = usersApi.getUserProfiles(organizationId, userProfilesOptions); - - if (user.getUsers().isEmpty()) { - throw new Exception("Could not get an account id from the request."); - } - - return user.getUsers().get(0).getDefaultAccountId(); - } - protected UUID getOrganizationId(String accessToken, String basePath) throws ApiException{ - UUID orgId = null; + UUID orgId; if (session.getOrgId() == null){ ApiClient apiClient = createApiClient(accessToken, basePath); AccountsApi accounts = new AccountsApi(apiClient); @@ -152,7 +111,7 @@ protected ProductPermissionProfilesApi createProductPermissionProfilesApi(String * creates an instance of the AdminGroupsApi class silently. * @param accessToken user's access token * @param basePath basePath to the server - * @return an instance of the {@link AdminGroupsApi} + * @return an instance of the {@link DsGroupsApi} */ protected DsGroupsApi createDSGroupsApi(String accessToken, String basePath) { ApiClient apiClient = createApiClient(accessToken, basePath); diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index 065b4b2f..0ef1f773 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -51,33 +51,5 @@ protected static AccountsApi createAccountsApiClient(String basePath, String use ApiClient apiClient = createApiClient(basePath, userAccessToken); return new AccountsApi(apiClient); } - - /** - * Checks a clickwrap and return true IF clickwrap exists and is activated. - * @param basePath URL to Click API - * @param userAccessToken user's access token - * @param accountId user's account id - * @param clickwrapId clickwrap's id - * @return an boolean value - */ - protected boolean isClickwrapExistsAndActive( - String basePath, - String userAccessToken, - String accountId, - String clickwrapId - ) throws ApiException { - boolean isClickwrapOk = false; - - if (StringUtils.isNotBlank(clickwrapId)) { - - AccountsApi accountsApi = createAccountsApiClient(basePath, userAccessToken); - ClickwrapVersionResponse clickwrapResponse = accountsApi.getClickwrap(accountId, clickwrapId); - - isClickwrapOk = clickwrapResponse.getClickwrapId().equals(clickwrapId) && - clickwrapResponse.getStatus().equals(ClickwrapHelper.STATUS_ACTIVE); - } - - return isClickwrapOk; - } } diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index 5d3d31c2..74c8b4d1 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -131,84 +131,4 @@ protected static FormGroupsApi createFormGroupsApi(String basePath, String userA ApiClient apiClient = createApiClient(basePath, userAccessToken); return new FormGroupsApi(apiClient); } - - protected static RoleSummary getAdminRole(String basePath, String userAccessToken, String accountId) - throws ApiException - { - RoleSummaryList roleSummaryList = createRolesApiClient(basePath, userAccessToken).getRoles(accountId); - return roleSummaryList.getRoles() - .stream() - .filter(RoleSummary::isIsDefaultForAdmin) - .findFirst() - .get(); - } - - protected static List getFormSummaryList(String basePath, String userAccessToken, String accountId) - throws ApiException - { - FormLibrariesApi formLibrariesApi = createFormLibrariesApi(basePath, userAccessToken); - FormLibrarySummaryList formLibrarySummaryList = formLibrariesApi.getFormLibraries(accountId); - - List forms = new ArrayList<>(); - - for (FormLibrarySummary formLibrarySummary : formLibrarySummaryList.getFormsLibrarySummaries()) { - FormSummaryList formSummaryList = formLibrariesApi.getFormLibraryForms( - accountId, - formLibrarySummary.getFormsLibraryId()); - forms.addAll(formSummaryList.getForms()); - } - return forms; - } - - protected List getDocumentsByRoomsId( - String basePath, - String accessToken, - String accountId, - WorkArguments roomId) - throws ApiException - { - RoomsApi roomsApiClient = createRoomsApiClient(basePath, accessToken); - - return roomsApiClient.getDocuments(accountId, roomId.getRoomId()).getDocuments(); - } - - protected RoomSummaryList getRoomSummaryList(String basePath, String accessToken, String accountId) - throws ApiException - { - RoomsApi roomsApi = createRoomsApiClient(basePath, accessToken); - - return roomsApi.getRooms(accountId); - } - - protected List getRoomSummariesByRoomId( - String basePath, - String accessToken, - String accountId, - WorkArguments roomId) - throws ApiException - { - RoomSummaryList summaryList = getRoomSummaryList(basePath, accessToken, accountId); - return summaryList.getRooms().stream() - .filter(var -> var.getRoomId().equals(roomId.getRoomId())) - .collect(Collectors.toList()); - } - - protected List getAvailableFormSummariesByRoomId( - String basePath, - String accessToken, - String accountId, - WorkArguments roomId) - throws ApiException - { - List formsByRoomsId = getDocumentsByRoomsId(basePath, accessToken, accountId, roomId); - List formSummaries = getFormSummaryList(basePath, accessToken, accountId); - - List formListByRoomId = formsByRoomsId.stream() - .map(var -> var.getName().replaceAll("\\.pdf", "")) - .collect(Collectors.toList()); - - return formSummaries.stream() - .filter(form -> !formListByRoomId.contains(form.getName())) - .collect(Collectors.toList()); - } } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index 71a618bb..1537bfde 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -10,6 +10,7 @@ import com.docusign.rooms.model.RoleSummary; import com.docusign.rooms.model.Room; import com.docusign.services.rooms.examples.CreateRoomService; +import com.docusign.services.rooms.examples.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -39,9 +40,8 @@ public R001ControllerCreateRoom(DSConfiguration config, Session session, User us // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - RoleSummary adminRole = getAdminRole( - this.session.getBasePath(), - this.user.getAccessToken(), + RoleSummary adminRole = GetAdminRolesService.getAdminRole( + createRolesApiClient(this.session.getBasePath(), this.user.getAccessToken()), this.session.getAccountId()); // Step 2: Construct your API headers diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 887c183c..fe1a7aa9 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -12,6 +12,7 @@ import com.docusign.rooms.model.Room; import com.docusign.rooms.model.RoomTemplatesSummaryList; import com.docusign.services.rooms.examples.CreateRoomWithTemplateService; +import com.docusign.services.rooms.examples.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -55,9 +56,8 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - RoleSummary adminRole = getAdminRole( - this.session.getBasePath(), - this.user.getAccessToken(), + RoleSummary adminRole = GetAdminRolesService.getAdminRole( + createRolesApiClient(this.session.getBasePath(), this.user.getAccessToken()), this.session.getAccountId()); // Step 2: Construct your API headers diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 1dcfb542..ff57ee0f 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -11,6 +11,7 @@ import com.docusign.rooms.model.RoomDocument; import com.docusign.rooms.model.RoomSummaryList; import com.docusign.services.rooms.examples.AddingFormsToRoomService; +import com.docusign.services.rooms.examples.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -47,9 +48,8 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3. Obtain the desired form ID RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); - List forms = getFormSummaryList( - this.session.getBasePath(), - this.user.getAccessToken(), + List forms = GetFormSummaryListService.getFormSummaryList( + createFormLibrariesApi(session.getBasePath(), this.user.getAccessToken()), this.session.getAccountId()); model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index 1f9c2a98..f047558b 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -12,6 +12,7 @@ import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomSummaryList; import com.docusign.services.rooms.examples.CreateExternalFormFillSessionService; +import com.docusign.services.rooms.examples.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -47,9 +48,8 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); - List forms = getFormSummaryList( - this.session.getBasePath(), - this.user.getAccessToken(), + List forms = GetFormSummaryListService.getFormSummaryList( + createFormLibrariesApi(session.getBasePath(), this.user.getAccessToken()), this.session.getAccountId()); model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index c72668e2..6391becc 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -11,6 +11,7 @@ import com.docusign.rooms.model.FormGroupSummaryList; import com.docusign.rooms.model.FormSummary; import com.docusign.services.rooms.examples.AssignFormToFormGroupService; +import com.docusign.services.rooms.examples.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -53,9 +54,8 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3 End // Step 4 Start - List forms = getFormSummaryList( - this.session.getBasePath(), - this.user.getAccessToken(), + List forms = GetFormSummaryListService.getFormSummaryList( + createFormLibrariesApi(session.getBasePath(), this.user.getAccessToken()), this.session.getAccountId()); // Step 4 End diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index decec973..4d67abda 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -2,17 +2,9 @@ import com.docusign.DSConfiguration; import com.docusign.common.ApiIndex; -import com.docusign.esign.client.auth.OAuth; -import com.docusign.core.model.AuthType; -import com.docusign.core.model.AuthTypeItem; -import com.docusign.core.model.Locals; -import com.docusign.core.model.Session; -import com.docusign.core.model.User; - +import com.docusign.core.model.*; import com.docusign.core.utils.AccountsConverter; -import java.util.stream.Collectors; - -import com.docusign.monitor.client.ApiException; +import com.docusign.esign.client.auth.OAuth; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -24,11 +16,9 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.context.WebApplicationContext; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Optional; + +import java.util.*; +import java.util.stream.Collectors; /** * This class provides common model attributes for all pages. If you want to diff --git a/src/main/java/com/docusign/services/admin/examples/GetExistingAccountIdService.java b/src/main/java/com/docusign/services/admin/examples/GetExistingAccountIdService.java new file mode 100644 index 00000000..bd180619 --- /dev/null +++ b/src/main/java/com/docusign/services/admin/examples/GetExistingAccountIdService.java @@ -0,0 +1,38 @@ +package com.docusign.services.admin.examples; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.UsersDrilldownResponse; + +import java.util.UUID; + +public final class GetExistingAccountIdService { + /** + * Creates a request to get current user. + * @param usersApi instance of users api + * @param signerEmail signer email + * @param organizationId the ID of current organization + * @return the account Id + */ + public static UUID getExistingAccountId( + UsersApi usersApi, + String signerEmail, + UUID organizationId + ) throws Exception { + // set the signer email to get an information about that user + // new GetUsersOptions() will throw "an enclosing instance that contains com.docusign.admin.api.UsersApi.GetUserProfilesOptions is required" + // at compile time. I used this workaround from stackOverflow: + // https://stackoverflow.com/a/4297913/2226328 + + UsersApi.GetUserProfilesOptions userProfilesOptions = usersApi.new GetUserProfilesOptions(); + userProfilesOptions.setEmail(signerEmail); + + UsersDrilldownResponse user = usersApi.getUserProfiles(organizationId, userProfilesOptions); + + if (user.getUsers().isEmpty()) { + throw new Exception("Could not get an account id from the request."); + } + + return user.getUsers().get(0).getDefaultAccountId(); + } + +} diff --git a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java index a323f86e..450d801d 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java @@ -68,28 +68,11 @@ private static RecipientViewRequest makeRecipientViewRequest( // Set the url where you want the recipient to go once they are done signing // should typically be a callback route somewhere in your app. viewRequest.setReturnUrl(dsReturnUrl); - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - String authenticationMethod = "none"; - viewRequest.setAuthenticationMethod(authenticationMethod); - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(signerClientId); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - String pingFrequency = "600"; - viewRequest.setPingFrequency(pingFrequency); - viewRequest.setPingUrl(dsPingUrl); - - return viewRequest; + return SetTabValuesService.setEmailAndSignerNameForRecipientViewRequest( + viewRequest, + signerEmail, + signerName, + dsPingUrl); } // The envelope request object uses Composite Template to include in the envelope: diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java index 6add7e77..59727557 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java @@ -33,12 +33,14 @@ public static RecipientViewRequest makeRecipientViewRequest( // the DocuSign signing. It's usually better to use // the session mechanism of your web framework. Query parameters // can be changed/spoofed very easily. - viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); + String stateValue = "?state=123"; + viewRequest.setReturnUrl(config.getDsReturnUrl() + stateValue); // How has your app authenticated the user? In addition to your app's // authentication, you can include authenticate steps from DocuSign. // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); + String authenticationMethod = "none"; + viewRequest.setAuthenticationMethod(authenticationMethod); // Recipient information must match embedded recipient info // we used to create the envelope. @@ -52,7 +54,8 @@ public static RecipientViewRequest makeRecipientViewRequest( // parameter. It causes the DocuSign signing web page // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds + String pingFrequency = "600"; + viewRequest.setPingFrequency(pingFrequency); // seconds viewRequest.setPingUrl(config.getDsPingUrl()); return viewRequest; diff --git a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java index 0532ff62..63593ab5 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java @@ -72,13 +72,15 @@ public static EnvelopeDefinition createEnvelope( RecipientIdentityVerification workflow = new RecipientIdentityVerification(); workflow.setWorkflowId(workflowId); + String status = "created"; + String deliveryMethod = "email"; Signer signer1 = new Signer(); signer1.setName(signerName); signer1.setEmail(signerEmail); signer1.setRoleName(""); signer1.setNote(""); - signer1.setStatus("created"); - signer1.setDeliveryMethod("email"); + signer1.setStatus(status); + signer1.setDeliveryMethod(deliveryMethod); signer1.setRecipientId("1"); //represents your {RECIPIENT_ID} signer1.setIdentityVerification(workflow); signer1.setTabs(signer1Tabs); diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java index c053f107..7b9451fa 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java @@ -37,12 +37,27 @@ public static RecipientViewRequest makeRecipientViewRequest( // the DocuSign signing. It's usually better to use // the session mechanism of your web framework. Query parameters // can be changed/spoofed very easily. - viewRequest.setReturnUrl(dsReturnUrl + "?state=123"); + String state = "?state=123"; + viewRequest.setReturnUrl(dsReturnUrl + state); + + return setEmailAndSignerNameForRecipientViewRequest( + viewRequest, + signerEmail, + signerName, + dsPingUrl); + } + public static RecipientViewRequest setEmailAndSignerNameForRecipientViewRequest( + RecipientViewRequest viewRequest, + String signerEmail, + String signerName, + String dsPingUrl + ) { // How has your app authenticated the user? In addition to your app's // authentication, you can include authenticate steps from DocuSign. // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); + String authenticationMethod = "none"; + viewRequest.setAuthenticationMethod(authenticationMethod); // Recipient information must match embedded recipient info // we used to create the envelope. @@ -56,7 +71,8 @@ public static RecipientViewRequest makeRecipientViewRequest( // parameter. It causes the DocuSign signing web page // (not the DocuSign server) to send pings via AJAX to your app. // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds + String pingFrequency = "600"; + viewRequest.setPingFrequency(pingFrequency); // seconds viewRequest.setPingUrl(dsPingUrl); return viewRequest; diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java index 4484ef19..346238b3 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java +++ b/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java @@ -33,29 +33,14 @@ public static RecipientViewRequest makeRecipientViewRequest( // the DocuSign signing. It's usually better to use // the session mechanism of your web framework. Query parameters // can be changed/spoofed very easily. - viewRequest.setReturnUrl(dsReturnUrl + "?state=123"); - - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(clientUserId); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds - viewRequest.setPingUrl(dsPingUrl); - - return viewRequest; + String state = "?state=123"; + viewRequest.setReturnUrl(dsReturnUrl + state); + + return SetTabValuesService.setEmailAndSignerNameForRecipientViewRequest( + viewRequest, + signerEmail, + signerName, + dsPingUrl); } public static EnvelopeDefinition makeEnvelope( diff --git a/src/main/java/com/docusign/services/rooms/examples/GetAdminRolesService.java b/src/main/java/com/docusign/services/rooms/examples/GetAdminRolesService.java new file mode 100644 index 00000000..3ff1e282 --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/GetAdminRolesService.java @@ -0,0 +1,19 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.RolesApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.RoleSummary; +import com.docusign.rooms.model.RoleSummaryList; + +public final class GetAdminRolesService { + public static RoleSummary getAdminRole(RolesApi rolesApi, String accountId) + throws ApiException + { + RoleSummaryList roleSummaryList = rolesApi.getRoles(accountId); + return roleSummaryList.getRoles() + .stream() + .filter(RoleSummary::isIsDefaultForAdmin) + .findFirst() + .get(); + } +} diff --git a/src/main/java/com/docusign/services/rooms/examples/GetFormSummaryListService.java b/src/main/java/com/docusign/services/rooms/examples/GetFormSummaryListService.java new file mode 100644 index 00000000..60f89652 --- /dev/null +++ b/src/main/java/com/docusign/services/rooms/examples/GetFormSummaryListService.java @@ -0,0 +1,30 @@ +package com.docusign.services.rooms.examples; + +import com.docusign.rooms.api.FormLibrariesApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormLibrarySummary; +import com.docusign.rooms.model.FormLibrarySummaryList; +import com.docusign.rooms.model.FormSummary; +import com.docusign.rooms.model.FormSummaryList; + +import java.util.ArrayList; +import java.util.List; + +public final class GetFormSummaryListService { + public static List getFormSummaryList( + FormLibrariesApi formLibrariesApi, + String accountId + ) throws ApiException { + FormLibrarySummaryList formLibrarySummaryList = formLibrariesApi.getFormLibraries(accountId); + + List forms = new ArrayList<>(); + + for (FormLibrarySummary formLibrarySummary : formLibrarySummaryList.getFormsLibrarySummaries()) { + FormSummaryList formSummaryList = formLibrariesApi.getFormLibraryForms( + accountId, + formLibrarySummary.getFormsLibraryId()); + forms.addAll(formSummaryList.getForms()); + } + return forms; + } +} From 6d6334e1ce5b71390d58113031aaab9d98577bef Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 2 Nov 2021 14:59:17 +0200 Subject: [PATCH 216/699] Moved writing export to file into service --- .../examples/A003BulkExportUserData.java | 52 ++--------------- .../examples/BulkExportUserDataService.java | 58 +++++++++++++++++++ 2 files changed, 63 insertions(+), 47 deletions(-) diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index bdf2ecbf..0fb02a0d 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -9,23 +9,12 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.services.admin.examples.BulkExportUserDataService; -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import javax.net.ssl.HttpsURLConnection; import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.core.MediaType; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Objects; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -65,42 +54,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String csvUri = BulkExportUserDataService.bulkExportUserData(bulkExportsApi, organizationId, bulkList.getId()); // Step 4 end - // Step 5 start - URL request_url = new URL(csvUri); - - // Send Web request to download and save the exported CSV data - HttpsURLConnection.setFollowRedirects(true); // Defaults to true - HttpsURLConnection http_conn = (HttpsURLConnection) request_url.openConnection(); - http_conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); - http_conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "mutlipart/form-data"); - http_conn.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); - http_conn.setInstanceFollowRedirects(true); - - ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); - String rootDir = Paths.get(Objects.requireNonNull(rawPath.getResource("")).toURI()).toString(); - // Set the save file path in the project root instead of the compiled folder and - // force forward slash scheme - rootDir = StringUtils.remove(rootDir, "target\\classes"); - rootDir = StringUtils.remove(rootDir, "file:/"); - rootDir = StringUtils.replace(rootDir, "\\", "/"); - - // opens input stream from the HTTP connection - InputStream inputStream = http_conn.getInputStream(); - String saveFilePath = rootDir + "src/main/resources/ExportedUserData.csv"; - - // opens an output stream to save into file - FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); - - int bytesRead; - byte[] buffer = new byte[BUFFER_SIZE]; - while ((bytesRead = inputStream.read(buffer)) != -1) { - outputStream.write(buffer, 0, bytesRead); - } - - outputStream.close(); - inputStream.close(); - http_conn.disconnect(); - // Step 5 end + String saveFilePath = BulkExportUserDataService.moveUserListExportToFile( + csvUri, + BEARER_AUTHENTICATION, + user.getAccessToken(), + BUFFER_SIZE); OrganizationExportsResponse results = BulkExportUserDataService.bulkExportsUserData( bulkExportsApi, diff --git a/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java b/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java index c5794d92..925abdca 100644 --- a/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java +++ b/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java @@ -5,7 +5,20 @@ import com.docusign.admin.model.OrganizationExportRequest; import com.docusign.admin.model.OrganizationExportResponse; import com.docusign.admin.model.OrganizationExportsResponse; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpHeaders; +import javax.net.ssl.HttpsURLConnection; +import javax.ws.rs.core.MediaType; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Paths; +import java.util.Objects; import java.util.UUID; public class BulkExportUserDataService { @@ -32,4 +45,49 @@ public static OrganizationExportResponse createUserListExport( request.setType("organization_memberships_export"); return bulkExportsApi.createUserListExport(organizationId, request); } + + public static String moveUserListExportToFile( + String csvUri, + String bearerAuthentication, + String accessToken, + Integer bufferSize) throws IOException, URISyntaxException { + // Step 5 start + URL request_url = new URL(csvUri); + + // Send Web request to download and save the exported CSV data + HttpsURLConnection.setFollowRedirects(true); // Defaults to true + HttpsURLConnection http_conn = (HttpsURLConnection) request_url.openConnection(); + http_conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + http_conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "mutlipart/form-data"); + http_conn.setRequestProperty(HttpHeaders.AUTHORIZATION, bearerAuthentication + accessToken); + http_conn.setInstanceFollowRedirects(true); + + ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); + String rootDir = Paths.get(Objects.requireNonNull(rawPath.getResource("")).toURI()).toString(); + // Set the save file path in the project root instead of the compiled folder and + // force forward slash scheme + rootDir = StringUtils.remove(rootDir, "target\\classes"); + rootDir = StringUtils.remove(rootDir, "file:/"); + rootDir = StringUtils.replace(rootDir, "\\", "/"); + + // opens input stream from the HTTP connection + InputStream inputStream = http_conn.getInputStream(); + String saveFilePath = rootDir + "src/main/resources/ExportedUserData.csv"; + + // opens an output stream to save into file + FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); + + int bytesRead; + byte[] buffer = new byte[bufferSize]; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + outputStream.close(); + inputStream.close(); + http_conn.disconnect(); + // Step 5 end + + return saveFilePath; + } } From ed1b4d726d77949cc5d76ef7a841465e0d02d99c Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 2 Nov 2021 16:22:27 +0200 Subject: [PATCH 217/699] Fixed comments --- .../docusign/EG001ControllerEmbeddedSigning.java | 5 +---- .../admin/examples/A001AddActiveUser.java | 4 ++-- .../examples/A002CreateActiveCLMESignUser.java | 4 ++-- .../admin/examples/A003BulkExportUserData.java | 2 +- .../admin/examples/A003aCheckRequestStatus.java | 2 +- .../admin/examples/A004BulkImportUserData.java | 4 ++-- .../examples/A004CheckImportRequestStatus.java | 2 +- .../controller/admin/examples/A005AuditUsers.java | 4 ++-- .../examples/C001ControllerCreateClickwrap.java | 2 +- .../examples/C002ControllerActivateClickwrap.java | 2 +- .../C003ControllerCreateNewVersionClickwrap.java | 2 +- .../examples/C004ControllerGetListClickwraps.java | 2 +- .../C005ControllerGetClickwrapResponses.java | 2 +- .../examples/EG002ControllerSigningViaEmail.java | 2 +- .../examples/EG003ControllerListEnvelopes.java | 2 +- .../examples/EG004ControllerEnvelopeInfo.java | 4 +--- .../EG005ControllerEnvelopeRecipients.java | 2 +- .../examples/EG006ControllerEnvelopeDocs.java | 3 +-- .../examples/EG007ControllerEnvelopeGetDoc.java | 2 +- .../examples/EG008ControllerCreateTemplate.java | 2 +- .../examples/EG009ControllerUseTemplate.java | 2 +- .../examples/EG010ControllerSendBinaryDocs.java | 2 +- .../examples/EG011ControllerEmbeddedSending.java | 2 +- .../examples/EG012ControllerEmbeddedConsole.java | 2 +- .../examples/EG013ControllerAddDocToTemplate.java | 2 +- .../examples/EG014ControllerCollectPayment.java | 2 +- .../examples/EG015ControllerGetTabValues.java | 2 +- .../examples/EG016ControllerSetTabValues.java | 2 +- .../EG017ControllerSetTemplateTabValues.java | 2 +- .../EG018ControllerEnvelopeCustomFieldValues.java | 2 +- .../EG019ControllerAccessCodeAuthentication.java | 2 +- .../EG020ControllerPhoneAuthentication.java | 2 +- .../examples/EG022ControllerKBAAuthentication.java | 2 +- .../examples/EG023ControllerIdvAuthentication.java | 2 +- .../examples/EG024ControllerPermissionCreate.java | 2 +- .../EG025ControllerPermissionSetUserGroups.java | 2 +- ...026ControllerPermissionChangeSingleSetting.java | 2 +- .../examples/EG027ControllerPermissionDelete.java | 2 +- .../examples/EG028ControllerCreateBrand.java | 2 +- .../EG029ControllerApplyBrandToEnvelope.java | 2 +- .../EG030ControllerApplyBrandToTemplate.java | 2 +- .../examples/EG031ControllerBulkSendEnvelopes.java | 2 +- .../EG032ControllerPauseSignatureWorkflow.java | 2 +- .../EG033ControllerUnpauseSignatureWorkflow.java | 2 +- .../EG034ControllerUseConditionalRecipients.java | 2 +- .../examples/EG035ControllerSMSDelivery.java | 2 +- .../monitor/examples/M001GetMonitoringData.java | 2 +- .../rooms/examples/R001ControllerCreateRoom.java | 4 ++-- .../R002ControllerCreateRoomWithTemplate.java | 4 ++-- .../R003ControllerExportingDataFromRoom.java | 2 +- .../examples/R004ControllerAddingFormsToRoom.java | 4 ++-- .../R005ControllerGetRoomsWithFilters.java | 2 +- ...006ControllerCreateExternalFormFillSession.java | 4 ++-- .../examples/R007ControllerCreateFormGroup.java | 2 +- ...R008ControllerGrantOfficeAccessToFormGroup.java | 2 +- .../R009ControllerAssignFormToFormGroup.java | 4 ++-- .../core/controller/GlobalControllerAdvice.java | 8 +++++++- .../admin}/AddActiveUserService.java | 3 ++- .../admin}/AuditUsersService.java | 7 ++++--- .../admin}/BulkExportUserDataService.java | 2 +- .../admin}/BulkImportUserDataService.java | 2 +- .../admin}/CheckImportRequestStatusService.java | 2 +- .../admin}/CheckRequestStatusService.java | 2 +- .../admin}/CreateActiveCLMESignUserService.java | 2 +- .../admin}/GetExistingAccountIdService.java | 2 +- .../click}/ActivateClickwrapService.java | 2 +- .../click}/CreateClickwrapService.java | 2 +- .../click}/CreateNewVersionClickwrapService.java | 2 +- .../click}/GetClickwrapResponsesService.java | 2 +- .../click}/GetListClickwrapsService.java | 2 +- .../AccessCodeAuthenticationService.java | 2 +- .../eSignature}/AddDocToTemplateService.java | 4 ++-- .../eSignature}/ApplyBrandToEnvelopeService.java | 2 +- .../eSignature}/ApplyBrandToTemplateService.java | 2 +- .../eSignature}/BulkSendEnvelopesService.java | 2 +- .../eSignature}/CollectPaymentService.java | 5 +++-- .../eSignature}/CreateBrandService.java | 2 +- .../eSignature}/CreateTemplateService.java | 2 +- .../eSignature}/EmbeddedConsoleService.java | 2 +- .../eSignature}/EmbeddedSendingService.java | 2 +- .../eSignature}/EmbeddedSigningService.java | 2 +- .../EnvelopeCustomFieldValuesService.java | 2 +- .../eSignature}/EnvelopeDocsService.java | 2 +- .../eSignature}/EnvelopeGetDocService.java | 2 +- .../eSignature}/EnvelopeInfoService.java | 2 +- .../eSignature}/EnvelopeRecipientsService.java | 2 +- .../eSignature}/GetTabValuesService.java | 2 +- .../eSignature}/IdvAuthenticationService.java | 2 +- .../eSignature}/KBAAuthenticationService.java | 2 +- .../eSignature}/ListEnvelopesServices.java | 4 ++-- .../eSignature}/PauseSignatureWorkflowService.java | 2 +- .../PermissionChangeSingleSettingService.java | 2 +- .../eSignature}/PermissionCreateService.java | 4 ++-- .../eSignature}/PermissionDeleteService.java | 2 +- .../PermissionSetUserGroupsService.java | 2 +- .../eSignature}/PhoneAuthenticationService.java | 2 +- .../eSignature}/SMSDeliveryService.java | 4 ++-- .../eSignature}/SendBinaryDocsService.java | 14 +++++++------- .../eSignature}/SetTabValuesService.java | 2 +- .../eSignature}/SetTemplateTabValuesService.java | 2 +- .../eSignature}/SigningViaEmailService.java | 2 +- .../UnpauseSignatureWorkflowService.java | 2 +- .../UseConditionalRecipientsService.java | 2 +- .../eSignature}/UseTemplateService.java | 2 +- .../monitor}/GetMonitoringDataService.java | 2 +- .../rooms}/AddingFormsToRoomService.java | 2 +- .../rooms}/AssignFormToFormGroupService.java | 2 +- .../CreateExternalFormFillSessionService.java | 2 +- .../rooms}/CreateFormGroupService.java | 2 +- .../rooms}/CreateRoomService.java | 2 +- .../rooms}/CreateRoomWithTemplateService.java | 2 +- .../rooms}/ExportingDataFromRoomService.java | 2 +- .../rooms}/GetAdminRolesService.java | 2 +- .../rooms}/GetFormSummaryListService.java | 2 +- .../rooms}/GetRoomsWithFiltersService.java | 2 +- .../GrantOfficeAccessToFormGroupService.java | 2 +- 116 files changed, 147 insertions(+), 144 deletions(-) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/AddActiveUserService.java (97%) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/AuditUsersService.java (92%) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/BulkExportUserDataService.java (98%) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/BulkImportUserDataService.java (95%) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/CheckImportRequestStatusService.java (91%) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/CheckRequestStatusService.java (90%) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/CreateActiveCLMESignUserService.java (97%) rename src/main/java/com/{docusign/services/admin/examples => services/admin}/GetExistingAccountIdService.java (96%) rename src/main/java/com/{docusign/services/click/examples => services/click}/ActivateClickwrapService.java (95%) rename src/main/java/com/{docusign/services/click/examples => services/click}/CreateClickwrapService.java (96%) rename src/main/java/com/{docusign/services/click/examples => services/click}/CreateNewVersionClickwrapService.java (97%) rename src/main/java/com/{docusign/services/click/examples => services/click}/GetClickwrapResponsesService.java (91%) rename src/main/java/com/{docusign/services/click/examples => services/click}/GetListClickwrapsService.java (90%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/AccessCodeAuthenticationService.java (97%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/AddDocToTemplateService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/ApplyBrandToEnvelopeService.java (97%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/ApplyBrandToTemplateService.java (96%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/BulkSendEnvelopesService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/CollectPaymentService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/CreateBrandService.java (93%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/CreateTemplateService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EmbeddedConsoleService.java (95%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EmbeddedSendingService.java (97%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EmbeddedSigningService.java (98%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EnvelopeCustomFieldValuesService.java (90%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EnvelopeDocsService.java (90%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EnvelopeGetDocService.java (93%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EnvelopeInfoService.java (89%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/EnvelopeRecipientsService.java (89%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/GetTabValuesService.java (89%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/IdvAuthenticationService.java (98%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/KBAAuthenticationService.java (98%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/ListEnvelopesServices.java (94%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/PauseSignatureWorkflowService.java (98%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/PermissionChangeSingleSettingService.java (98%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/PermissionCreateService.java (96%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/PermissionDeleteService.java (88%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/PermissionSetUserGroupsService.java (94%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/PhoneAuthenticationService.java (97%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/SMSDeliveryService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/SendBinaryDocsService.java (94%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/SetTabValuesService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/SetTemplateTabValuesService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/SigningViaEmailService.java (98%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/UnpauseSignatureWorkflowService.java (95%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/UseConditionalRecipientsService.java (99%) rename src/main/java/com/{docusign/services/eSignature/examples => services/eSignature}/UseTemplateService.java (96%) rename src/main/java/com/{docusign/services/monitor/examples => services/monitor}/GetMonitoringDataService.java (96%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/AddingFormsToRoomService.java (92%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/AssignFormToFormGroupService.java (94%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/CreateExternalFormFillSessionService.java (95%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/CreateFormGroupService.java (93%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/CreateRoomService.java (97%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/CreateRoomWithTemplateService.java (97%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/ExportingDataFromRoomService.java (90%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/GetAdminRolesService.java (92%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/GetFormSummaryListService.java (95%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/GetRoomsWithFiltersService.java (94%) rename src/main/java/com/{docusign/services/rooms/examples => services/rooms}/GrantOfficeAccessToFormGroupService.java (92%) diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 8b448a7f..a55ef740 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -12,11 +12,9 @@ import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.RecipientViewRequest; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.Signer; import com.docusign.esign.model.ViewUrl; -import com.docusign.services.eSignature.examples.EmbeddedSigningService; +import com.services.eSignature.EmbeddedSigningService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -24,7 +22,6 @@ import org.springframework.web.servlet.view.RedirectView; import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index e81da65d..700c161a 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -11,8 +11,8 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; -import com.docusign.services.admin.examples.AddActiveUserService; -import com.docusign.services.admin.examples.GetExistingAccountIdService; +import com.services.admin.AddActiveUserService; +import com.services.admin.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 6d1ad2db..5a8e6628 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -12,8 +12,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.admin.examples.CreateActiveCLMESignUserService; -import com.docusign.services.admin.examples.GetExistingAccountIdService; +import com.services.admin.CreateActiveCLMESignUserService; +import com.services.admin.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 0fb02a0d..c88acf9a 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.admin.examples.BulkExportUserDataService; +import com.services.admin.BulkExportUserDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index 896be2b7..8c7d7e12 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -7,7 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.admin.examples.CheckRequestStatusService; +import com.services.admin.CheckRequestStatusService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 1bfea7df..b92f6d4a 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -7,8 +7,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.admin.examples.BulkImportUserDataService; -import com.docusign.services.admin.examples.GetExistingAccountIdService; +import com.services.admin.BulkImportUserDataService; +import com.services.admin.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index 3bce7098..6206a7e6 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -7,7 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.admin.examples.CheckImportRequestStatusService; +import com.services.admin.CheckImportRequestStatusService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 65cdd81a..da6eb7ed 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -7,8 +7,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.admin.examples.AuditUsersService; -import com.docusign.services.admin.examples.GetExistingAccountIdService; +import com.services.admin.AuditUsersService; +import com.services.admin.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 925433fc..ecebc1be 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -9,7 +9,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.click.examples.CreateClickwrapService; +import com.services.click.CreateClickwrapService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index 2e9ab2ef..4eaeef68 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.click.examples.ActivateClickwrapService; +import com.services.click.ActivateClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index ed41f714..48015190 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.click.examples.CreateNewVersionClickwrapService; +import com.services.click.CreateNewVersionClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index e7292db4..5f4952d2 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.click.examples.GetListClickwrapsService; +import com.services.click.GetListClickwrapsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index ebb655a4..acbeb757 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.click.examples.GetClickwrapResponsesService; +import com.services.click.GetClickwrapResponsesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index b9f3c67f..ed1f6150 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.SigningViaEmailService; +import com.services.eSignature.SigningViaEmailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 31fc0ea7..936273bb 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopesInformation; -import com.docusign.services.eSignature.examples.ListEnvelopesServices; +import com.services.eSignature.ListEnvelopesServices; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index 03d651b8..22b676a4 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -7,11 +7,9 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; - import javax.servlet.http.HttpServletResponse; - import com.docusign.esign.model.Envelope; -import com.docusign.services.eSignature.examples.EnvelopeInfoService; +import com.services.eSignature.EnvelopeInfoService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index 7086b127..7e616bea 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.Recipients; -import com.docusign.services.eSignature.examples.EnvelopeRecipientsService; +import com.services.eSignature.EnvelopeRecipientsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java index 2a61bdf7..13579882 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java @@ -13,10 +13,9 @@ import java.util.ArrayList; import java.util.List; - import javax.servlet.http.HttpServletResponse; -import com.docusign.services.eSignature.examples.EnvelopeDocsService; +import com.services.eSignature.EnvelopeDocsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index addf2e8f..dcfa2b93 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -9,7 +9,7 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.services.eSignature.examples.EnvelopeGetDocService; +import com.services.eSignature.EnvelopeGetDocService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index fb4b9c81..a11e941d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -10,7 +10,7 @@ import com.docusign.esign.model.EnvelopeTemplate; import com.docusign.esign.model.EnvelopeTemplateResults; import com.docusign.esign.model.TemplateSummary; -import com.docusign.services.eSignature.examples.CreateTemplateService; +import com.services.eSignature.CreateTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index d4010246..e32d145a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -12,7 +12,7 @@ import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.services.eSignature.examples.UseTemplateService; +import com.services.eSignature.UseTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index dd1e79e3..3c836d1e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -5,7 +5,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.eSignature.examples.SendBinaryDocsService; +import com.services.eSignature.SendBinaryDocsService; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index cd76306f..10f57122 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -8,7 +8,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.ViewUrl; -import com.docusign.services.eSignature.examples.EmbeddedSendingService; +import com.services.eSignature.EmbeddedSendingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java index e782fef3..580d7f96 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java @@ -7,7 +7,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.ViewUrl; -import com.docusign.services.eSignature.examples.EmbeddedConsoleService; +import com.services.eSignature.EmbeddedConsoleService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index 876eb60f..3e722b9b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -10,7 +10,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeTemplateResults; import com.docusign.esign.model.ViewUrl; -import com.docusign.services.eSignature.examples.AddDocToTemplateService; +import com.services.eSignature.AddDocToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 8b42c893..09c3a00e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.CollectPaymentService; +import com.services.eSignature.CollectPaymentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java index 4a683c6d..5a53d955 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeFormData; -import com.docusign.services.eSignature.examples.GetTabValuesService; +import com.services.eSignature.GetTabValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java index 52740434..916591f0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java @@ -11,7 +11,7 @@ import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.RecipientViewRequest; import com.docusign.esign.model.ViewUrl; -import com.docusign.services.eSignature.examples.SetTabValuesService; +import com.services.eSignature.SetTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index 188a3aa5..629749cf 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; -import com.docusign.services.eSignature.examples.SetTemplateTabValuesService; +import com.services.eSignature.SetTemplateTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java index 0dc00cb9..edd30e6a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.CustomFieldsEnvelope; -import com.docusign.services.eSignature.examples.EnvelopeCustomFieldValuesService; +import com.services.eSignature.EnvelopeCustomFieldValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index 30a61e83..7f26e8f6 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.AccessCodeAuthenticationService; +import com.services.eSignature.AccessCodeAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index 287cfaae..f27c509d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.PhoneAuthenticationService; +import com.services.eSignature.PhoneAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index 8515934d..935c6687 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.KBAAuthenticationService; +import com.services.eSignature.KBAAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index afbe1165..48e7f0f6 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -10,7 +10,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.IdvAuthenticationService; +import com.services.eSignature.IdvAuthenticationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java index 9ed940d5..d45f232a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java @@ -7,7 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.eSignature.examples.PermissionCreateService; +import com.services.eSignature.PermissionCreateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java index e74e55df..3ae1c54d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java @@ -12,7 +12,7 @@ import com.docusign.esign.model.ErrorDetails; import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; -import com.docusign.services.eSignature.examples.PermissionSetUserGroupsService; +import com.services.eSignature.PermissionSetUserGroupsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java index 27e4c9de..8cb89db3 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.PermissionProfile; import com.docusign.esign.model.PermissionProfileInformation; -import com.docusign.services.eSignature.examples.PermissionChangeSingleSettingService; +import com.services.eSignature.PermissionChangeSingleSettingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java index 5309e098..cdff9df8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java @@ -6,7 +6,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.eSignature.examples.PermissionDeleteService; +import com.services.eSignature.PermissionDeleteService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java index 539f402d..10ca0e25 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java @@ -9,7 +9,7 @@ import com.docusign.esign.api.AccountsApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.BrandsResponse; -import com.docusign.services.eSignature.examples.CreateBrandService; +import com.services.eSignature.CreateBrandService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index c0140161..9942d00d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -11,7 +11,7 @@ import com.docusign.esign.model.BrandsResponse; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.ApplyBrandToEnvelopeService; +import com.services.eSignature.ApplyBrandToEnvelopeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index d459aa5e..fb870a54 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -9,7 +9,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.eSignature.examples.ApplyBrandToTemplateService; +import com.services.eSignature.ApplyBrandToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index b0916989..5d43b260 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.BulkSendBatchStatus; -import com.docusign.services.eSignature.examples.BulkSendEnvelopesService; +import com.services.eSignature.BulkSendEnvelopesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index 55991b78..8cecde33 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -9,7 +9,7 @@ import com.docusign.core.model.User; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.PauseSignatureWorkflowService; +import com.services.eSignature.PauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index 05597dc9..d38c2322 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeUpdateSummary; -import com.docusign.services.eSignature.examples.UnpauseSignatureWorkflowService; +import com.services.eSignature.UnpauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index 5b58a5a7..2c721aa7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.UseConditionalRecipientsService; +import com.services.eSignature.UseConditionalRecipientsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java index 78968b87..3880a128 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.services.eSignature.examples.SMSDeliveryService; +import com.services.eSignature.SMSDeliveryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index e1e5b343..0a80f2a8 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -5,7 +5,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.services.monitor.examples.GetMonitoringDataService; +import com.services.monitor.GetMonitoringDataService; import org.json.JSONArray; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index 1537bfde..c8dd4898 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -9,8 +9,8 @@ import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.RoleSummary; import com.docusign.rooms.model.Room; -import com.docusign.services.rooms.examples.CreateRoomService; -import com.docusign.services.rooms.examples.GetAdminRolesService; +import com.services.rooms.CreateRoomService; +import com.services.rooms.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index fe1a7aa9..db6c22c9 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -11,8 +11,8 @@ import com.docusign.rooms.model.RoleSummary; import com.docusign.rooms.model.Room; import com.docusign.rooms.model.RoomTemplatesSummaryList; -import com.docusign.services.rooms.examples.CreateRoomWithTemplateService; -import com.docusign.services.rooms.examples.GetAdminRolesService; +import com.services.rooms.CreateRoomWithTemplateService; +import com.services.rooms.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index eee36f16..704bd687 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -9,7 +9,7 @@ import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FieldData; import com.docusign.rooms.model.RoomSummaryList; -import com.docusign.services.rooms.examples.ExportingDataFromRoomService; +import com.services.rooms.ExportingDataFromRoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index ff57ee0f..15499b35 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -10,8 +10,8 @@ import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomDocument; import com.docusign.rooms.model.RoomSummaryList; -import com.docusign.services.rooms.examples.AddingFormsToRoomService; -import com.docusign.services.rooms.examples.GetFormSummaryListService; +import com.services.rooms.AddingFormsToRoomService; +import com.services.rooms.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index e2bc1abe..ad29c3cb 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -8,7 +8,7 @@ import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.RoomSummaryList; -import com.docusign.services.rooms.examples.GetRoomsWithFiltersService; +import com.services.rooms.GetRoomsWithFiltersService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index f047558b..40262393 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -11,8 +11,8 @@ import com.docusign.rooms.model.ExternalFormFillSession; import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomSummaryList; -import com.docusign.services.rooms.examples.CreateExternalFormFillSessionService; -import com.docusign.services.rooms.examples.GetFormSummaryListService; +import com.services.rooms.CreateExternalFormFillSessionService; +import com.services.rooms.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index ed4a7084..f64424f0 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -8,7 +8,7 @@ import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FormGroup; -import com.docusign.services.rooms.examples.CreateFormGroupService; +import com.services.rooms.CreateFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index 9683803a..f881f076 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -9,7 +9,7 @@ import com.docusign.rooms.api.OfficesApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.*; -import com.docusign.services.rooms.examples.GrantOfficeAccessToFormGroupService; +import com.services.rooms.GrantOfficeAccessToFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 6391becc..8088db79 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -10,8 +10,8 @@ import com.docusign.rooms.model.FormGroupFormToAssign; import com.docusign.rooms.model.FormGroupSummaryList; import com.docusign.rooms.model.FormSummary; -import com.docusign.services.rooms.examples.AssignFormToFormGroupService; -import com.docusign.services.rooms.examples.GetFormSummaryListService; +import com.services.rooms.AssignFormToFormGroupService; +import com.services.rooms.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 4d67abda..d0e48e23 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -5,6 +5,7 @@ import com.docusign.core.model.*; import com.docusign.core.utils.AccountsConverter; import com.docusign.esign.client.auth.OAuth; +import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.ModelAndView; import java.util.*; import java.util.stream.Collectors; @@ -78,7 +80,11 @@ public boolean populateShowDoc() { @ModelAttribute("locals") public Locals populateLocals() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName().getFirstSelectedApi()); + String selectedApi = config.getApiName().getFirstSelectedApi(); + if (!EnumUtils.isValidEnum(ApiIndex.class, selectedApi)){ + throw new NoSuchElementException(selectedApi); + } + ApiIndex apiIndex = ApiIndex.valueOf(selectedApi); session.setApiIndexPath(apiIndex.toString()); if (!(authentication instanceof OAuth2Authentication)) { diff --git a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java b/src/main/java/com/services/admin/AddActiveUserService.java similarity index 97% rename from src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java rename to src/main/java/com/services/admin/AddActiveUserService.java index 769aacf0..f7d69919 100644 --- a/src/main/java/com/docusign/services/admin/examples/AddActiveUserService.java +++ b/src/main/java/com/services/admin/AddActiveUserService.java @@ -1,7 +1,8 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.*; + import java.util.ArrayList; import java.util.UUID; diff --git a/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java b/src/main/java/com/services/admin/AuditUsersService.java similarity index 92% rename from src/main/java/com/docusign/services/admin/examples/AuditUsersService.java rename to src/main/java/com/services/admin/AuditUsersService.java index db98c051..da8dd0af 100644 --- a/src/main/java/com/docusign/services/admin/examples/AuditUsersService.java +++ b/src/main/java/com/services/admin/AuditUsersService.java @@ -1,4 +1,4 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.UsersApi; import com.docusign.admin.client.ApiException; @@ -14,6 +14,9 @@ import java.util.UUID; public class AuditUsersService { + private static final String timeZoneId = "UTC"; + private static final String simpleDateFormat = "yyyy-MM-dd'T'HH:mm'Z'"; + public static ArrayList auditUsers( UsersApi usersApi, UUID organizationId, @@ -24,8 +27,6 @@ public static ArrayList auditUsers( // Step 3 start UsersApi.GetUsersOptions options = usersApi.new GetUsersOptions(); options.setAccountId(accountId); - String timeZoneId = "UTC"; - String simpleDateFormat = "yyyy-MM-dd'T'HH:mm'Z'"; TimeZone tz = TimeZone.getTimeZone(timeZoneId); SimpleDateFormat df = new SimpleDateFormat(simpleDateFormat); // Quoted "Z" to indicate UTC, no timezone offset diff --git a/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java b/src/main/java/com/services/admin/BulkExportUserDataService.java similarity index 98% rename from src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java rename to src/main/java/com/services/admin/BulkExportUserDataService.java index 925abdca..fc3db3ae 100644 --- a/src/main/java/com/docusign/services/admin/examples/BulkExportUserDataService.java +++ b/src/main/java/com/services/admin/BulkExportUserDataService.java @@ -1,4 +1,4 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.BulkExportsApi; import com.docusign.admin.client.ApiException; diff --git a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java b/src/main/java/com/services/admin/BulkImportUserDataService.java similarity index 95% rename from src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java rename to src/main/java/com/services/admin/BulkImportUserDataService.java index 3cc06775..057faadb 100644 --- a/src/main/java/com/docusign/services/admin/examples/BulkImportUserDataService.java +++ b/src/main/java/com/services/admin/BulkImportUserDataService.java @@ -1,4 +1,4 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.BulkImportsApi; import com.docusign.admin.model.OrganizationImportResponse; diff --git a/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java b/src/main/java/com/services/admin/CheckImportRequestStatusService.java similarity index 91% rename from src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java rename to src/main/java/com/services/admin/CheckImportRequestStatusService.java index 2a66aae8..67146425 100644 --- a/src/main/java/com/docusign/services/admin/examples/CheckImportRequestStatusService.java +++ b/src/main/java/com/services/admin/CheckImportRequestStatusService.java @@ -1,4 +1,4 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.BulkImportsApi; import com.docusign.admin.model.OrganizationImportResponse; diff --git a/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java b/src/main/java/com/services/admin/CheckRequestStatusService.java similarity index 90% rename from src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java rename to src/main/java/com/services/admin/CheckRequestStatusService.java index fa5dfaba..2a2f28f9 100644 --- a/src/main/java/com/docusign/services/admin/examples/CheckRequestStatusService.java +++ b/src/main/java/com/services/admin/CheckRequestStatusService.java @@ -1,4 +1,4 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.BulkExportsApi; import com.docusign.admin.model.OrganizationExportResponse; diff --git a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java b/src/main/java/com/services/admin/CreateActiveCLMESignUserService.java similarity index 97% rename from src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java rename to src/main/java/com/services/admin/CreateActiveCLMESignUserService.java index aa6cd468..33ac6ef9 100644 --- a/src/main/java/com/docusign/services/admin/examples/CreateActiveCLMESignUserService.java +++ b/src/main/java/com/services/admin/CreateActiveCLMESignUserService.java @@ -1,4 +1,4 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.AddUserResponse; diff --git a/src/main/java/com/docusign/services/admin/examples/GetExistingAccountIdService.java b/src/main/java/com/services/admin/GetExistingAccountIdService.java similarity index 96% rename from src/main/java/com/docusign/services/admin/examples/GetExistingAccountIdService.java rename to src/main/java/com/services/admin/GetExistingAccountIdService.java index bd180619..382cb9c7 100644 --- a/src/main/java/com/docusign/services/admin/examples/GetExistingAccountIdService.java +++ b/src/main/java/com/services/admin/GetExistingAccountIdService.java @@ -1,4 +1,4 @@ -package com.docusign.services.admin.examples; +package com.services.admin; import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.UsersDrilldownResponse; diff --git a/src/main/java/com/docusign/services/click/examples/ActivateClickwrapService.java b/src/main/java/com/services/click/ActivateClickwrapService.java similarity index 95% rename from src/main/java/com/docusign/services/click/examples/ActivateClickwrapService.java rename to src/main/java/com/services/click/ActivateClickwrapService.java index 8a81d559..1f6af0b6 100644 --- a/src/main/java/com/docusign/services/click/examples/ActivateClickwrapService.java +++ b/src/main/java/com/services/click/ActivateClickwrapService.java @@ -1,4 +1,4 @@ -package com.docusign.services.click.examples; +package com.services.click; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java b/src/main/java/com/services/click/CreateClickwrapService.java similarity index 96% rename from src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java rename to src/main/java/com/services/click/CreateClickwrapService.java index 39982e84..4308153b 100644 --- a/src/main/java/com/docusign/services/click/examples/CreateClickwrapService.java +++ b/src/main/java/com/services/click/CreateClickwrapService.java @@ -1,4 +1,4 @@ -package com.docusign.services.click.examples; +package com.services.click; import com.docusign.click.model.ClickwrapRequest; import com.docusign.click.model.DisplaySettings; diff --git a/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java b/src/main/java/com/services/click/CreateNewVersionClickwrapService.java similarity index 97% rename from src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java rename to src/main/java/com/services/click/CreateNewVersionClickwrapService.java index 14665a63..e81cbcfb 100644 --- a/src/main/java/com/docusign/services/click/examples/CreateNewVersionClickwrapService.java +++ b/src/main/java/com/services/click/CreateNewVersionClickwrapService.java @@ -1,4 +1,4 @@ -package com.docusign.services.click.examples; +package com.services.click; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java b/src/main/java/com/services/click/GetClickwrapResponsesService.java similarity index 91% rename from src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java rename to src/main/java/com/services/click/GetClickwrapResponsesService.java index 6e3f4649..9b6a8f60 100644 --- a/src/main/java/com/docusign/services/click/examples/GetClickwrapResponsesService.java +++ b/src/main/java/com/services/click/GetClickwrapResponsesService.java @@ -1,4 +1,4 @@ -package com.docusign.services.click.examples; +package com.services.click; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java b/src/main/java/com/services/click/GetListClickwrapsService.java similarity index 90% rename from src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java rename to src/main/java/com/services/click/GetListClickwrapsService.java index 6cb1d314..525bf332 100644 --- a/src/main/java/com/docusign/services/click/examples/GetListClickwrapsService.java +++ b/src/main/java/com/services/click/GetListClickwrapsService.java @@ -1,4 +1,4 @@ -package com.docusign.services.click.examples; +package com.services.click; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java b/src/main/java/com/services/eSignature/AccessCodeAuthenticationService.java similarity index 97% rename from src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java rename to src/main/java/com/services/eSignature/AccessCodeAuthenticationService.java index c3ba1eaf..92009601 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AccessCodeAuthenticationService.java +++ b/src/main/java/com/services/eSignature/AccessCodeAuthenticationService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java b/src/main/java/com/services/eSignature/AddDocToTemplateService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java rename to src/main/java/com/services/eSignature/AddDocToTemplateService.java index 450d801d..b963931c 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/AddDocToTemplateService.java +++ b/src/main/java/com/services/eSignature/AddDocToTemplateService.java @@ -1,11 +1,11 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; -import com.docusign.core.common.DocumentType; import java.io.IOException; import java.util.Arrays; diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java b/src/main/java/com/services/eSignature/ApplyBrandToEnvelopeService.java similarity index 97% rename from src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java rename to src/main/java/com/services/eSignature/ApplyBrandToEnvelopeService.java index 2a078950..4acb1fe4 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToEnvelopeService.java +++ b/src/main/java/com/services/eSignature/ApplyBrandToEnvelopeService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java b/src/main/java/com/services/eSignature/ApplyBrandToTemplateService.java similarity index 96% rename from src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java rename to src/main/java/com/services/eSignature/ApplyBrandToTemplateService.java index d08f50c6..928e53a4 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/ApplyBrandToTemplateService.java +++ b/src/main/java/com/services/eSignature/ApplyBrandToTemplateService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java b/src/main/java/com/services/eSignature/BulkSendEnvelopesService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java rename to src/main/java/com/services/eSignature/BulkSendEnvelopesService.java index e6738fdd..d84bd01d 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/BulkSendEnvelopesService.java +++ b/src/main/java/com/services/eSignature/BulkSendEnvelopesService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.DsModelUtils; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java b/src/main/java/com/services/eSignature/CollectPaymentService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java rename to src/main/java/com/services/eSignature/CollectPaymentService.java index 895543c9..f4c18b48 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CollectPaymentService.java +++ b/src/main/java/com/services/eSignature/CollectPaymentService.java @@ -1,11 +1,12 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; -import com.docusign.core.common.DocumentType; + import java.io.IOException; import java.util.Arrays; import java.util.Collections; diff --git a/src/main/java/com/docusign/services/eSignature/examples/CreateBrandService.java b/src/main/java/com/services/eSignature/CreateBrandService.java similarity index 93% rename from src/main/java/com/docusign/services/eSignature/examples/CreateBrandService.java rename to src/main/java/com/services/eSignature/CreateBrandService.java index 2397c3f5..44888f2d 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CreateBrandService.java +++ b/src/main/java/com/services/eSignature/CreateBrandService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java b/src/main/java/com/services/eSignature/CreateTemplateService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java rename to src/main/java/com/services/eSignature/CreateTemplateService.java index 9e25755d..c915a728 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/CreateTemplateService.java +++ b/src/main/java/com/services/eSignature/CreateTemplateService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.TemplatesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedConsoleService.java b/src/main/java/com/services/eSignature/EmbeddedConsoleService.java similarity index 95% rename from src/main/java/com/docusign/services/eSignature/examples/EmbeddedConsoleService.java rename to src/main/java/com/services/eSignature/EmbeddedConsoleService.java index dd6fd76a..02fb2ec9 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedConsoleService.java +++ b/src/main/java/com/services/eSignature/EmbeddedConsoleService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java b/src/main/java/com/services/eSignature/EmbeddedSendingService.java similarity index 97% rename from src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java rename to src/main/java/com/services/eSignature/EmbeddedSendingService.java index 968a88ab..961da4a5 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSendingService.java +++ b/src/main/java/com/services/eSignature/EmbeddedSendingService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java b/src/main/java/com/services/eSignature/EmbeddedSigningService.java similarity index 98% rename from src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java rename to src/main/java/com/services/eSignature/EmbeddedSigningService.java index 59727557..93e0d773 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EmbeddedSigningService.java +++ b/src/main/java/com/services/eSignature/EmbeddedSigningService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.DSConfiguration; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java b/src/main/java/com/services/eSignature/EnvelopeCustomFieldValuesService.java similarity index 90% rename from src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java rename to src/main/java/com/services/eSignature/EnvelopeCustomFieldValuesService.java index 7d26c8fa..d936aaa0 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeCustomFieldValuesService.java +++ b/src/main/java/com/services/eSignature/EnvelopeCustomFieldValuesService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java b/src/main/java/com/services/eSignature/EnvelopeDocsService.java similarity index 90% rename from src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java rename to src/main/java/com/services/eSignature/EnvelopeDocsService.java index d91d92b8..107242ed 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeDocsService.java +++ b/src/main/java/com/services/eSignature/EnvelopeDocsService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java b/src/main/java/com/services/eSignature/EnvelopeGetDocService.java similarity index 93% rename from src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java rename to src/main/java/com/services/eSignature/EnvelopeGetDocService.java index 5fdb3ea1..dac44932 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeGetDocService.java +++ b/src/main/java/com/services/eSignature/EnvelopeGetDocService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java b/src/main/java/com/services/eSignature/EnvelopeInfoService.java similarity index 89% rename from src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java rename to src/main/java/com/services/eSignature/EnvelopeInfoService.java index fd837dce..e2fa4bd7 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeInfoService.java +++ b/src/main/java/com/services/eSignature/EnvelopeInfoService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java b/src/main/java/com/services/eSignature/EnvelopeRecipientsService.java similarity index 89% rename from src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java rename to src/main/java/com/services/eSignature/EnvelopeRecipientsService.java index 0df8397c..1412e6b2 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/EnvelopeRecipientsService.java +++ b/src/main/java/com/services/eSignature/EnvelopeRecipientsService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java b/src/main/java/com/services/eSignature/GetTabValuesService.java similarity index 89% rename from src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java rename to src/main/java/com/services/eSignature/GetTabValuesService.java index 4641725f..aab7c977 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/GetTabValuesService.java +++ b/src/main/java/com/services/eSignature/GetTabValuesService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java b/src/main/java/com/services/eSignature/IdvAuthenticationService.java similarity index 98% rename from src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java rename to src/main/java/com/services/eSignature/IdvAuthenticationService.java index 63593ab5..2774e803 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/IdvAuthenticationService.java +++ b/src/main/java/com/services/eSignature/IdvAuthenticationService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.AccountsApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java b/src/main/java/com/services/eSignature/KBAAuthenticationService.java similarity index 98% rename from src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java rename to src/main/java/com/services/eSignature/KBAAuthenticationService.java index 9ad28ebb..a4d8eb05 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/KBAAuthenticationService.java +++ b/src/main/java/com/services/eSignature/KBAAuthenticationService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/ListEnvelopesServices.java b/src/main/java/com/services/eSignature/ListEnvelopesServices.java similarity index 94% rename from src/main/java/com/docusign/services/eSignature/examples/ListEnvelopesServices.java rename to src/main/java/com/services/eSignature/ListEnvelopesServices.java index dbb21d03..68703916 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/ListEnvelopesServices.java +++ b/src/main/java/com/services/eSignature/ListEnvelopesServices.java @@ -1,11 +1,11 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopesInformation; -import java.time.format.DateTimeFormatter; import java.time.LocalDate; +import java.time.format.DateTimeFormatter; public final class ListEnvelopesServices { private static final int FROM_DATE_OFFSET_DAYS = 30; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java b/src/main/java/com/services/eSignature/PauseSignatureWorkflowService.java similarity index 98% rename from src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java rename to src/main/java/com/services/eSignature/PauseSignatureWorkflowService.java index dfc73ab5..bcd4346b 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PauseSignatureWorkflowService.java +++ b/src/main/java/com/services/eSignature/PauseSignatureWorkflowService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java b/src/main/java/com/services/eSignature/PermissionChangeSingleSettingService.java similarity index 98% rename from src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java rename to src/main/java/com/services/eSignature/PermissionChangeSingleSettingService.java index e8942fea..335c4148 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionChangeSingleSettingService.java +++ b/src/main/java/com/services/eSignature/PermissionChangeSingleSettingService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.DsModelUtils; import com.docusign.core.model.AccountRoleSettingsPatch; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java b/src/main/java/com/services/eSignature/PermissionCreateService.java similarity index 96% rename from src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java rename to src/main/java/com/services/eSignature/PermissionCreateService.java index e905b221..966cf223 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionCreateService.java +++ b/src/main/java/com/services/eSignature/PermissionCreateService.java @@ -1,9 +1,9 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.DsModelUtils; +import com.docusign.core.model.AccountRoleSettingsPatch; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.client.ApiException; -import com.docusign.core.model.AccountRoleSettingsPatch; import com.docusign.esign.model.AccountRoleSettings; import com.docusign.esign.model.PermissionProfile; import com.google.gson.Gson; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java b/src/main/java/com/services/eSignature/PermissionDeleteService.java similarity index 88% rename from src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java rename to src/main/java/com/services/eSignature/PermissionDeleteService.java index 49e4c9f8..6df358b9 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionDeleteService.java +++ b/src/main/java/com/services/eSignature/PermissionDeleteService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.AccountsApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PermissionSetUserGroupsService.java b/src/main/java/com/services/eSignature/PermissionSetUserGroupsService.java similarity index 94% rename from src/main/java/com/docusign/services/eSignature/examples/PermissionSetUserGroupsService.java rename to src/main/java/com/services/eSignature/PermissionSetUserGroupsService.java index da20d80c..8a06c166 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PermissionSetUserGroupsService.java +++ b/src/main/java/com/services/eSignature/PermissionSetUserGroupsService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.esign.api.GroupsApi; import com.docusign.esign.client.ApiClient; diff --git a/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java b/src/main/java/com/services/eSignature/PhoneAuthenticationService.java similarity index 97% rename from src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java rename to src/main/java/com/services/eSignature/PhoneAuthenticationService.java index 4c4623e9..046d26cb 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/PhoneAuthenticationService.java +++ b/src/main/java/com/services/eSignature/PhoneAuthenticationService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java b/src/main/java/com/services/eSignature/SMSDeliveryService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java rename to src/main/java/com/services/eSignature/SMSDeliveryService.java index 74c7bf5e..968abf5b 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SMSDeliveryService.java +++ b/src/main/java/com/services/eSignature/SMSDeliveryService.java @@ -1,11 +1,11 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; -import com.docusign.core.common.DocumentType; import java.io.IOException; import java.util.Arrays; diff --git a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java b/src/main/java/com/services/eSignature/SendBinaryDocsService.java similarity index 94% rename from src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java rename to src/main/java/com/services/eSignature/SendBinaryDocsService.java index 3083599c..9c6c972b 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SendBinaryDocsService.java +++ b/src/main/java/com/services/eSignature/SendBinaryDocsService.java @@ -1,13 +1,13 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.controller.eSignature.examples.ExampleException; +import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; -import com.docusign.core.common.DocumentType; import lombok.Value; import org.json.JSONArray; import org.json.JSONObject; @@ -49,12 +49,12 @@ public static String sendBinaryDocs( String accessToken ) throws IOException { // Step 1. Gather documents and their headers - List documents = List.of( - new SendBinaryDocsService.DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, + List documents = List.of( + new DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)), - new SendBinaryDocsService.DocumentInfo(DOCX_DOCUMENT_NAME, "2", DocumentType.DOCX, + new DocumentInfo(DOCX_DOCUMENT_NAME, "2", DocumentType.DOCX, EnvelopeHelpers.readFile(DOCX_DOCUMENT_FILE_NAME)), - new SendBinaryDocsService.DocumentInfo(PDF_DOCUMENT_NAME, "3", DocumentType.PDF, + new DocumentInfo(PDF_DOCUMENT_NAME, "3", DocumentType.PDF, EnvelopeHelpers.readFile(PDF_DOCUMENT_FILE_NAME)) ); @@ -84,7 +84,7 @@ public static String sendBinaryDocs( SendBinaryDocsService.writeBoundaryHeader(buffer, MediaType.APPLICATION_JSON, "form-data"); buffer.writeBytes(envelopeJSON.toString(DoneExample.JSON_INDENT_FACTOR)); - for (SendBinaryDocsService.DocumentInfo docInfo : documents) { + for (DocumentInfo docInfo : documents) { String content = String.format("file; filename=\"%s\";documentid=%s", docInfo.getName(), docInfo.getId()); buffer.writeBytes(LINE_DELIMITER); SendBinaryDocsService.writeBoundaryHeader(buffer, docInfo.getDocType().getMime(), content); diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java b/src/main/java/com/services/eSignature/SetTabValuesService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java rename to src/main/java/com/services/eSignature/SetTabValuesService.java index 7b9451fa..86a0d90f 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTabValuesService.java +++ b/src/main/java/com/services/eSignature/SetTabValuesService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java b/src/main/java/com/services/eSignature/SetTemplateTabValuesService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java rename to src/main/java/com/services/eSignature/SetTemplateTabValuesService.java index 346238b3..0a816b23 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SetTemplateTabValuesService.java +++ b/src/main/java/com/services/eSignature/SetTemplateTabValuesService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java b/src/main/java/com/services/eSignature/SigningViaEmailService.java similarity index 98% rename from src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java rename to src/main/java/com/services/eSignature/SigningViaEmailService.java index 97e344ee..a86a5b87 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/SigningViaEmailService.java +++ b/src/main/java/com/services/eSignature/SigningViaEmailService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/docusign/services/eSignature/examples/UnpauseSignatureWorkflowService.java b/src/main/java/com/services/eSignature/UnpauseSignatureWorkflowService.java similarity index 95% rename from src/main/java/com/docusign/services/eSignature/examples/UnpauseSignatureWorkflowService.java rename to src/main/java/com/services/eSignature/UnpauseSignatureWorkflowService.java index 39328e25..7c35c92c 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UnpauseSignatureWorkflowService.java +++ b/src/main/java/com/services/eSignature/UnpauseSignatureWorkflowService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java b/src/main/java/com/services/eSignature/UseConditionalRecipientsService.java similarity index 99% rename from src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java rename to src/main/java/com/services/eSignature/UseConditionalRecipientsService.java index 62dd4ebf..e594ae97 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UseConditionalRecipientsService.java +++ b/src/main/java/com/services/eSignature/UseConditionalRecipientsService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java b/src/main/java/com/services/eSignature/UseTemplateService.java similarity index 96% rename from src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java rename to src/main/java/com/services/eSignature/UseTemplateService.java index 9abf45cc..e179c026 100644 --- a/src/main/java/com/docusign/services/eSignature/examples/UseTemplateService.java +++ b/src/main/java/com/services/eSignature/UseTemplateService.java @@ -1,4 +1,4 @@ -package com.docusign.services.eSignature.examples; +package com.services.eSignature; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/services/monitor/examples/GetMonitoringDataService.java b/src/main/java/com/services/monitor/GetMonitoringDataService.java similarity index 96% rename from src/main/java/com/docusign/services/monitor/examples/GetMonitoringDataService.java rename to src/main/java/com/services/monitor/GetMonitoringDataService.java index 521210c8..a4f99b5c 100644 --- a/src/main/java/com/docusign/services/monitor/examples/GetMonitoringDataService.java +++ b/src/main/java/com/services/monitor/GetMonitoringDataService.java @@ -1,4 +1,4 @@ -package com.docusign.services.monitor.examples; +package com.services.monitor; import com.docusign.monitor.api.DataSetApi; import com.docusign.monitor.model.CursoredResult; diff --git a/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java b/src/main/java/com/services/rooms/AddingFormsToRoomService.java similarity index 92% rename from src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java rename to src/main/java/com/services/rooms/AddingFormsToRoomService.java index 11b6c885..c99118dd 100644 --- a/src/main/java/com/docusign/services/rooms/examples/AddingFormsToRoomService.java +++ b/src/main/java/com/services/rooms/AddingFormsToRoomService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java b/src/main/java/com/services/rooms/AssignFormToFormGroupService.java similarity index 94% rename from src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java rename to src/main/java/com/services/rooms/AssignFormToFormGroupService.java index 5f727b60..4a42d0d9 100644 --- a/src/main/java/com/docusign/services/rooms/examples/AssignFormToFormGroupService.java +++ b/src/main/java/com/services/rooms/AssignFormToFormGroupService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java b/src/main/java/com/services/rooms/CreateExternalFormFillSessionService.java similarity index 95% rename from src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java rename to src/main/java/com/services/rooms/CreateExternalFormFillSessionService.java index fa2c7e5e..52fdf399 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateExternalFormFillSessionService.java +++ b/src/main/java/com/services/rooms/CreateExternalFormFillSessionService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.ExternalFormFillSessionsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java b/src/main/java/com/services/rooms/CreateFormGroupService.java similarity index 93% rename from src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java rename to src/main/java/com/services/rooms/CreateFormGroupService.java index e2d30965..6cafa3d5 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateFormGroupService.java +++ b/src/main/java/com/services/rooms/CreateFormGroupService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java b/src/main/java/com/services/rooms/CreateRoomService.java similarity index 97% rename from src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java rename to src/main/java/com/services/rooms/CreateRoomService.java index eb25c23d..cb13f47a 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateRoomService.java +++ b/src/main/java/com/services/rooms/CreateRoomService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java b/src/main/java/com/services/rooms/CreateRoomWithTemplateService.java similarity index 97% rename from src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java rename to src/main/java/com/services/rooms/CreateRoomWithTemplateService.java index e7aeffab..b3235acd 100644 --- a/src/main/java/com/docusign/services/rooms/examples/CreateRoomWithTemplateService.java +++ b/src/main/java/com/services/rooms/CreateRoomWithTemplateService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java b/src/main/java/com/services/rooms/ExportingDataFromRoomService.java similarity index 90% rename from src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java rename to src/main/java/com/services/rooms/ExportingDataFromRoomService.java index cc728e96..cc7f081a 100644 --- a/src/main/java/com/docusign/services/rooms/examples/ExportingDataFromRoomService.java +++ b/src/main/java/com/services/rooms/ExportingDataFromRoomService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/GetAdminRolesService.java b/src/main/java/com/services/rooms/GetAdminRolesService.java similarity index 92% rename from src/main/java/com/docusign/services/rooms/examples/GetAdminRolesService.java rename to src/main/java/com/services/rooms/GetAdminRolesService.java index 3ff1e282..a255d0fa 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GetAdminRolesService.java +++ b/src/main/java/com/services/rooms/GetAdminRolesService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/GetFormSummaryListService.java b/src/main/java/com/services/rooms/GetFormSummaryListService.java similarity index 95% rename from src/main/java/com/docusign/services/rooms/examples/GetFormSummaryListService.java rename to src/main/java/com/services/rooms/GetFormSummaryListService.java index 60f89652..afed41e2 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GetFormSummaryListService.java +++ b/src/main/java/com/services/rooms/GetFormSummaryListService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.FormLibrariesApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java b/src/main/java/com/services/rooms/GetRoomsWithFiltersService.java similarity index 94% rename from src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java rename to src/main/java/com/services/rooms/GetRoomsWithFiltersService.java index 0ba295f8..007bb412 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GetRoomsWithFiltersService.java +++ b/src/main/java/com/services/rooms/GetRoomsWithFiltersService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java b/src/main/java/com/services/rooms/GrantOfficeAccessToFormGroupService.java similarity index 92% rename from src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java rename to src/main/java/com/services/rooms/GrantOfficeAccessToFormGroupService.java index 969dd399..360d4315 100644 --- a/src/main/java/com/docusign/services/rooms/examples/GrantOfficeAccessToFormGroupService.java +++ b/src/main/java/com/services/rooms/GrantOfficeAccessToFormGroupService.java @@ -1,4 +1,4 @@ -package com.docusign.services.rooms.examples; +package com.services.rooms; import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; From b21d17977fdb95bcc7b2c561893298d1a5fea69d Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 2 Nov 2021 16:36:02 +0200 Subject: [PATCH 218/699] moved services closer to controllers --- .../java/com/docusign/EG001ControllerEmbeddedSigning.java | 4 +--- .../docusign/controller/admin/examples/A001AddActiveUser.java | 4 ++-- .../admin/examples/A002CreateActiveCLMESignUser.java | 4 ++-- .../controller/admin/examples/A003BulkExportUserData.java | 2 +- .../controller/admin/examples/A003aCheckRequestStatus.java | 2 +- .../controller/admin/examples/A004BulkImportUserData.java | 4 ++-- .../admin/examples/A004CheckImportRequestStatus.java | 2 +- .../docusign/controller/admin/examples/A005AuditUsers.java | 4 ++-- .../controller/admin/services}/AddActiveUserService.java | 2 +- .../controller/admin/services}/AuditUsersService.java | 2 +- .../controller/admin/services}/BulkExportUserDataService.java | 2 +- .../controller/admin/services}/BulkImportUserDataService.java | 2 +- .../admin/services}/CheckImportRequestStatusService.java | 2 +- .../controller/admin/services}/CheckRequestStatusService.java | 2 +- .../admin/services}/CreateActiveCLMESignUserService.java | 2 +- .../admin/services}/GetExistingAccountIdService.java | 2 +- .../click/examples/C001ControllerCreateClickwrap.java | 2 +- .../click/examples/C002ControllerActivateClickwrap.java | 2 +- .../examples/C003ControllerCreateNewVersionClickwrap.java | 2 +- .../click/examples/C004ControllerGetListClickwraps.java | 2 +- .../click/examples/C005ControllerGetClickwrapResponses.java | 2 +- .../controller/click/services}/ActivateClickwrapService.java | 2 +- .../controller/click/services}/CreateClickwrapService.java | 2 +- .../click/services}/CreateNewVersionClickwrapService.java | 2 +- .../click/services}/GetClickwrapResponsesService.java | 2 +- .../controller/click/services}/GetListClickwrapsService.java | 2 +- .../eSignature/examples/EG002ControllerSigningViaEmail.java | 2 +- .../eSignature/examples/EG003ControllerListEnvelopes.java | 2 +- .../eSignature/examples/EG004ControllerEnvelopeInfo.java | 2 +- .../examples/EG005ControllerEnvelopeRecipients.java | 2 +- .../eSignature/examples/EG006ControllerEnvelopeDocs.java | 2 +- .../eSignature/examples/EG007ControllerEnvelopeGetDoc.java | 2 +- .../eSignature/examples/EG008ControllerCreateTemplate.java | 2 +- .../eSignature/examples/EG009ControllerUseTemplate.java | 2 +- .../eSignature/examples/EG010ControllerSendBinaryDocs.java | 2 +- .../eSignature/examples/EG011ControllerEmbeddedSending.java | 2 +- .../eSignature/examples/EG012ControllerEmbeddedConsole.java | 2 +- .../eSignature/examples/EG013ControllerAddDocToTemplate.java | 2 +- .../eSignature/examples/EG014ControllerCollectPayment.java | 2 +- .../eSignature/examples/EG015ControllerGetTabValues.java | 2 +- .../eSignature/examples/EG016ControllerSetTabValues.java | 2 +- .../examples/EG017ControllerSetTemplateTabValues.java | 2 +- .../examples/EG018ControllerEnvelopeCustomFieldValues.java | 2 +- .../examples/EG019ControllerAccessCodeAuthentication.java | 2 +- .../examples/EG020ControllerPhoneAuthentication.java | 2 +- .../eSignature/examples/EG022ControllerKBAAuthentication.java | 2 +- .../eSignature/examples/EG023ControllerIdvAuthentication.java | 2 +- .../eSignature/examples/EG024ControllerPermissionCreate.java | 2 +- .../examples/EG025ControllerPermissionSetUserGroups.java | 2 +- .../EG026ControllerPermissionChangeSingleSetting.java | 2 +- .../eSignature/examples/EG027ControllerPermissionDelete.java | 2 +- .../eSignature/examples/EG028ControllerCreateBrand.java | 2 +- .../examples/EG029ControllerApplyBrandToEnvelope.java | 2 +- .../examples/EG030ControllerApplyBrandToTemplate.java | 4 +--- .../eSignature/examples/EG031ControllerBulkSendEnvelopes.java | 2 +- .../examples/EG032ControllerPauseSignatureWorkflow.java | 2 +- .../examples/EG033ControllerUnpauseSignatureWorkflow.java | 2 +- .../examples/EG034ControllerUseConditionalRecipients.java | 2 +- .../eSignature/examples/EG035ControllerSMSDelivery.java | 2 +- .../eSignature/services}/AccessCodeAuthenticationService.java | 2 +- .../eSignature/services}/AddDocToTemplateService.java | 2 +- .../eSignature/services}/ApplyBrandToEnvelopeService.java | 2 +- .../eSignature/services}/ApplyBrandToTemplateService.java | 2 +- .../eSignature/services}/BulkSendEnvelopesService.java | 2 +- .../eSignature/services}/CollectPaymentService.java | 2 +- .../controller/eSignature/services}/CreateBrandService.java | 2 +- .../eSignature/services}/CreateTemplateService.java | 2 +- .../eSignature/services}/EmbeddedConsoleService.java | 2 +- .../eSignature/services}/EmbeddedSendingService.java | 2 +- .../eSignature/services}/EmbeddedSigningService.java | 2 +- .../services}/EnvelopeCustomFieldValuesService.java | 2 +- .../controller/eSignature/services}/EnvelopeDocsService.java | 2 +- .../eSignature/services}/EnvelopeGetDocService.java | 2 +- .../controller/eSignature/services}/EnvelopeInfoService.java | 2 +- .../eSignature/services}/EnvelopeRecipientsService.java | 2 +- .../controller/eSignature/services}/GetTabValuesService.java | 2 +- .../eSignature/services}/IdvAuthenticationService.java | 2 +- .../eSignature/services}/KBAAuthenticationService.java | 2 +- .../eSignature/services}/ListEnvelopesServices.java | 2 +- .../eSignature/services}/PauseSignatureWorkflowService.java | 2 +- .../services}/PermissionChangeSingleSettingService.java | 2 +- .../eSignature/services}/PermissionCreateService.java | 2 +- .../eSignature/services}/PermissionDeleteService.java | 2 +- .../eSignature/services}/PermissionSetUserGroupsService.java | 2 +- .../eSignature/services}/PhoneAuthenticationService.java | 2 +- .../controller/eSignature/services}/SMSDeliveryService.java | 2 +- .../eSignature/services}/SendBinaryDocsService.java | 2 +- .../controller/eSignature/services}/SetTabValuesService.java | 2 +- .../eSignature/services}/SetTemplateTabValuesService.java | 2 +- .../eSignature/services}/SigningViaEmailService.java | 2 +- .../eSignature/services}/UnpauseSignatureWorkflowService.java | 2 +- .../eSignature/services}/UseConditionalRecipientsService.java | 2 +- .../controller/eSignature/services}/UseTemplateService.java | 2 +- .../controller/monitor/examples/M001GetMonitoringData.java | 2 +- .../monitor/services}/GetMonitoringDataService.java | 2 +- .../controller/rooms/examples/R001ControllerCreateRoom.java | 4 ++-- .../rooms/examples/R002ControllerCreateRoomWithTemplate.java | 4 ++-- .../rooms/examples/R003ControllerExportingDataFromRoom.java | 2 +- .../rooms/examples/R004ControllerAddingFormsToRoom.java | 4 ++-- .../rooms/examples/R005ControllerGetRoomsWithFilters.java | 2 +- .../examples/R006ControllerCreateExternalFormFillSession.java | 4 ++-- .../rooms/examples/R007ControllerCreateFormGroup.java | 2 +- .../examples/R008ControllerGrantOfficeAccessToFormGroup.java | 2 +- .../rooms/examples/R009ControllerAssignFormToFormGroup.java | 4 ++-- .../controller/rooms/services}/AddingFormsToRoomService.java | 2 +- .../rooms/services}/AssignFormToFormGroupService.java | 2 +- .../rooms/services}/CreateExternalFormFillSessionService.java | 2 +- .../controller/rooms/services}/CreateFormGroupService.java | 2 +- .../controller/rooms/services}/CreateRoomService.java | 2 +- .../rooms/services}/CreateRoomWithTemplateService.java | 2 +- .../rooms/services}/ExportingDataFromRoomService.java | 2 +- .../controller/rooms/services}/GetAdminRolesService.java | 2 +- .../controller/rooms/services}/GetFormSummaryListService.java | 2 +- .../rooms/services}/GetRoomsWithFiltersService.java | 2 +- .../rooms/services}/GrantOfficeAccessToFormGroupService.java | 2 +- 115 files changed, 124 insertions(+), 128 deletions(-) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/AddActiveUserService.java (97%) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/AuditUsersService.java (97%) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/BulkExportUserDataService.java (98%) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/BulkImportUserDataService.java (95%) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/CheckImportRequestStatusService.java (91%) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/CheckRequestStatusService.java (90%) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/CreateActiveCLMESignUserService.java (97%) rename src/main/java/com/{services/admin => docusign/controller/admin/services}/GetExistingAccountIdService.java (96%) rename src/main/java/com/{services/click => docusign/controller/click/services}/ActivateClickwrapService.java (95%) rename src/main/java/com/{services/click => docusign/controller/click/services}/CreateClickwrapService.java (96%) rename src/main/java/com/{services/click => docusign/controller/click/services}/CreateNewVersionClickwrapService.java (97%) rename src/main/java/com/{services/click => docusign/controller/click/services}/GetClickwrapResponsesService.java (91%) rename src/main/java/com/{services/click => docusign/controller/click/services}/GetListClickwrapsService.java (90%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/AccessCodeAuthenticationService.java (96%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/AddDocToTemplateService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/ApplyBrandToEnvelopeService.java (97%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/ApplyBrandToTemplateService.java (96%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/BulkSendEnvelopesService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/CollectPaymentService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/CreateBrandService.java (93%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/CreateTemplateService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EmbeddedConsoleService.java (95%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EmbeddedSendingService.java (96%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EmbeddedSigningService.java (98%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EnvelopeCustomFieldValuesService.java (89%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EnvelopeDocsService.java (90%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EnvelopeGetDocService.java (92%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EnvelopeInfoService.java (88%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/EnvelopeRecipientsService.java (89%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/GetTabValuesService.java (89%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/IdvAuthenticationService.java (98%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/KBAAuthenticationService.java (98%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/ListEnvelopesServices.java (94%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/PauseSignatureWorkflowService.java (98%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/PermissionChangeSingleSettingService.java (98%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/PermissionCreateService.java (96%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/PermissionDeleteService.java (87%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/PermissionSetUserGroupsService.java (94%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/PhoneAuthenticationService.java (97%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/SMSDeliveryService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/SendBinaryDocsService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/SetTabValuesService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/SetTemplateTabValuesService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/SigningViaEmailService.java (98%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/UnpauseSignatureWorkflowService.java (95%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/UseConditionalRecipientsService.java (99%) rename src/main/java/com/{services/eSignature => docusign/controller/eSignature/services}/UseTemplateService.java (96%) rename src/main/java/com/{services/monitor => docusign/controller/monitor/services}/GetMonitoringDataService.java (96%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/AddingFormsToRoomService.java (92%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/AssignFormToFormGroupService.java (94%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/CreateExternalFormFillSessionService.java (95%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/CreateFormGroupService.java (93%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/CreateRoomService.java (97%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/CreateRoomWithTemplateService.java (97%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/ExportingDataFromRoomService.java (89%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/GetAdminRolesService.java (91%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/GetFormSummaryListService.java (95%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/GetRoomsWithFiltersService.java (93%) rename src/main/java/com/{services/rooms => docusign/controller/rooms/services}/GrantOfficeAccessToFormGroupService.java (91%) diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index a55ef740..949d7630 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -2,19 +2,17 @@ import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.AbstractEsignatureController; -import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.RecipientViewRequest; import com.docusign.esign.model.ViewUrl; -import com.services.eSignature.EmbeddedSigningService; +import com.docusign.controller.eSignature.services.EmbeddedSigningService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index 700c161a..9c0095d2 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -11,8 +11,8 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; -import com.services.admin.AddActiveUserService; -import com.services.admin.GetExistingAccountIdService; +import com.docusign.controller.admin.services.AddActiveUserService; +import com.docusign.controller.admin.services.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 5a8e6628..a24de2d9 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -12,8 +12,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.admin.CreateActiveCLMESignUserService; -import com.services.admin.GetExistingAccountIdService; +import com.docusign.controller.admin.services.CreateActiveCLMESignUserService; +import com.docusign.controller.admin.services.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index c88acf9a..910c7134 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.admin.BulkExportUserDataService; +import com.docusign.controller.admin.services.BulkExportUserDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index 8c7d7e12..f102e4b1 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -7,7 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.admin.CheckRequestStatusService; +import com.docusign.controller.admin.services.CheckRequestStatusService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index b92f6d4a..157aa939 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -7,8 +7,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.admin.BulkImportUserDataService; -import com.services.admin.GetExistingAccountIdService; +import com.docusign.controller.admin.services.BulkImportUserDataService; +import com.docusign.controller.admin.services.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index 6206a7e6..48e708f5 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -7,7 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.admin.CheckImportRequestStatusService; +import com.docusign.controller.admin.services.CheckImportRequestStatusService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index da6eb7ed..594a2ca4 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -7,8 +7,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.admin.AuditUsersService; -import com.services.admin.GetExistingAccountIdService; +import com.docusign.controller.admin.services.AuditUsersService; +import com.docusign.controller.admin.services.GetExistingAccountIdService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/services/admin/AddActiveUserService.java b/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java similarity index 97% rename from src/main/java/com/services/admin/AddActiveUserService.java rename to src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java index f7d69919..3bc6a00e 100644 --- a/src/main/java/com/services/admin/AddActiveUserService.java +++ b/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.*; diff --git a/src/main/java/com/services/admin/AuditUsersService.java b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java similarity index 97% rename from src/main/java/com/services/admin/AuditUsersService.java rename to src/main/java/com/docusign/controller/admin/services/AuditUsersService.java index da8dd0af..6ade0f1d 100644 --- a/src/main/java/com/services/admin/AuditUsersService.java +++ b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.UsersApi; import com.docusign.admin.client.ApiException; diff --git a/src/main/java/com/services/admin/BulkExportUserDataService.java b/src/main/java/com/docusign/controller/admin/services/BulkExportUserDataService.java similarity index 98% rename from src/main/java/com/services/admin/BulkExportUserDataService.java rename to src/main/java/com/docusign/controller/admin/services/BulkExportUserDataService.java index fc3db3ae..0cd87095 100644 --- a/src/main/java/com/services/admin/BulkExportUserDataService.java +++ b/src/main/java/com/docusign/controller/admin/services/BulkExportUserDataService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.BulkExportsApi; import com.docusign.admin.client.ApiException; diff --git a/src/main/java/com/services/admin/BulkImportUserDataService.java b/src/main/java/com/docusign/controller/admin/services/BulkImportUserDataService.java similarity index 95% rename from src/main/java/com/services/admin/BulkImportUserDataService.java rename to src/main/java/com/docusign/controller/admin/services/BulkImportUserDataService.java index 057faadb..915db22e 100644 --- a/src/main/java/com/services/admin/BulkImportUserDataService.java +++ b/src/main/java/com/docusign/controller/admin/services/BulkImportUserDataService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.BulkImportsApi; import com.docusign.admin.model.OrganizationImportResponse; diff --git a/src/main/java/com/services/admin/CheckImportRequestStatusService.java b/src/main/java/com/docusign/controller/admin/services/CheckImportRequestStatusService.java similarity index 91% rename from src/main/java/com/services/admin/CheckImportRequestStatusService.java rename to src/main/java/com/docusign/controller/admin/services/CheckImportRequestStatusService.java index 67146425..2674e9a9 100644 --- a/src/main/java/com/services/admin/CheckImportRequestStatusService.java +++ b/src/main/java/com/docusign/controller/admin/services/CheckImportRequestStatusService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.BulkImportsApi; import com.docusign.admin.model.OrganizationImportResponse; diff --git a/src/main/java/com/services/admin/CheckRequestStatusService.java b/src/main/java/com/docusign/controller/admin/services/CheckRequestStatusService.java similarity index 90% rename from src/main/java/com/services/admin/CheckRequestStatusService.java rename to src/main/java/com/docusign/controller/admin/services/CheckRequestStatusService.java index 2a2f28f9..55cc39e5 100644 --- a/src/main/java/com/services/admin/CheckRequestStatusService.java +++ b/src/main/java/com/docusign/controller/admin/services/CheckRequestStatusService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.BulkExportsApi; import com.docusign.admin.model.OrganizationExportResponse; diff --git a/src/main/java/com/services/admin/CreateActiveCLMESignUserService.java b/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java similarity index 97% rename from src/main/java/com/services/admin/CreateActiveCLMESignUserService.java rename to src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java index 33ac6ef9..f5816049 100644 --- a/src/main/java/com/services/admin/CreateActiveCLMESignUserService.java +++ b/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.AddUserResponse; diff --git a/src/main/java/com/services/admin/GetExistingAccountIdService.java b/src/main/java/com/docusign/controller/admin/services/GetExistingAccountIdService.java similarity index 96% rename from src/main/java/com/services/admin/GetExistingAccountIdService.java rename to src/main/java/com/docusign/controller/admin/services/GetExistingAccountIdService.java index 382cb9c7..05445709 100644 --- a/src/main/java/com/services/admin/GetExistingAccountIdService.java +++ b/src/main/java/com/docusign/controller/admin/services/GetExistingAccountIdService.java @@ -1,4 +1,4 @@ -package com.services.admin; +package com.docusign.controller.admin.services; import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.UsersDrilldownResponse; diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index ecebc1be..3a557a59 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -9,7 +9,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.click.CreateClickwrapService; +import com.docusign.controller.click.services.CreateClickwrapService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index 4eaeef68..468f7475 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.click.ActivateClickwrapService; +import com.docusign.controller.click.services.ActivateClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index 48015190..747b6b58 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.click.CreateNewVersionClickwrapService; +import com.docusign.controller.click.services.CreateNewVersionClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index 5f4952d2..12e76862 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.click.GetListClickwrapsService; +import com.docusign.controller.click.services.GetListClickwrapsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index acbeb757..73eb9dbc 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.click.GetClickwrapResponsesService; +import com.docusign.controller.click.services.GetClickwrapResponsesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/services/click/ActivateClickwrapService.java b/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java similarity index 95% rename from src/main/java/com/services/click/ActivateClickwrapService.java rename to src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java index 1f6af0b6..71335a20 100644 --- a/src/main/java/com/services/click/ActivateClickwrapService.java +++ b/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java @@ -1,4 +1,4 @@ -package com.services.click; +package com.docusign.controller.click.services; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/services/click/CreateClickwrapService.java b/src/main/java/com/docusign/controller/click/services/CreateClickwrapService.java similarity index 96% rename from src/main/java/com/services/click/CreateClickwrapService.java rename to src/main/java/com/docusign/controller/click/services/CreateClickwrapService.java index 4308153b..905729a9 100644 --- a/src/main/java/com/services/click/CreateClickwrapService.java +++ b/src/main/java/com/docusign/controller/click/services/CreateClickwrapService.java @@ -1,4 +1,4 @@ -package com.services.click; +package com.docusign.controller.click.services; import com.docusign.click.model.ClickwrapRequest; import com.docusign.click.model.DisplaySettings; diff --git a/src/main/java/com/services/click/CreateNewVersionClickwrapService.java b/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java similarity index 97% rename from src/main/java/com/services/click/CreateNewVersionClickwrapService.java rename to src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java index e81cbcfb..ba06ee5c 100644 --- a/src/main/java/com/services/click/CreateNewVersionClickwrapService.java +++ b/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java @@ -1,4 +1,4 @@ -package com.services.click; +package com.docusign.controller.click.services; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/services/click/GetClickwrapResponsesService.java b/src/main/java/com/docusign/controller/click/services/GetClickwrapResponsesService.java similarity index 91% rename from src/main/java/com/services/click/GetClickwrapResponsesService.java rename to src/main/java/com/docusign/controller/click/services/GetClickwrapResponsesService.java index 9b6a8f60..0c6efb6c 100644 --- a/src/main/java/com/services/click/GetClickwrapResponsesService.java +++ b/src/main/java/com/docusign/controller/click/services/GetClickwrapResponsesService.java @@ -1,4 +1,4 @@ -package com.services.click; +package com.docusign.controller.click.services; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/services/click/GetListClickwrapsService.java b/src/main/java/com/docusign/controller/click/services/GetListClickwrapsService.java similarity index 90% rename from src/main/java/com/services/click/GetListClickwrapsService.java rename to src/main/java/com/docusign/controller/click/services/GetListClickwrapsService.java index 525bf332..d6eced5b 100644 --- a/src/main/java/com/services/click/GetListClickwrapsService.java +++ b/src/main/java/com/docusign/controller/click/services/GetListClickwrapsService.java @@ -1,4 +1,4 @@ -package com.services.click; +package com.docusign.controller.click.services; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index ed1f6150..6d6c3718 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.SigningViaEmailService; +import com.docusign.controller.eSignature.services.SigningViaEmailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 936273bb..6ef6ba3e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopesInformation; -import com.services.eSignature.ListEnvelopesServices; +import com.docusign.controller.eSignature.services.ListEnvelopesServices; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index 22b676a4..87a84d4c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import javax.servlet.http.HttpServletResponse; import com.docusign.esign.model.Envelope; -import com.services.eSignature.EnvelopeInfoService; +import com.docusign.controller.eSignature.services.EnvelopeInfoService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index 7e616bea..2fca5c28 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.Recipients; -import com.services.eSignature.EnvelopeRecipientsService; +import com.docusign.controller.eSignature.services.EnvelopeRecipientsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java index 13579882..0819f959 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java @@ -15,7 +15,7 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; -import com.services.eSignature.EnvelopeDocsService; +import com.docusign.controller.eSignature.services.EnvelopeDocsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index dcfa2b93..3a0edea0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -9,7 +9,7 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.services.eSignature.EnvelopeGetDocService; +import com.docusign.controller.eSignature.services.EnvelopeGetDocService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index a11e941d..3a88e930 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -10,7 +10,7 @@ import com.docusign.esign.model.EnvelopeTemplate; import com.docusign.esign.model.EnvelopeTemplateResults; import com.docusign.esign.model.TemplateSummary; -import com.services.eSignature.CreateTemplateService; +import com.docusign.controller.eSignature.services.CreateTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index e32d145a..a6a355d9 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -12,7 +12,7 @@ import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.services.eSignature.UseTemplateService; +import com.docusign.controller.eSignature.services.UseTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index 3c836d1e..29e8ae6c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -5,7 +5,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.eSignature.SendBinaryDocsService; +import com.docusign.controller.eSignature.services.SendBinaryDocsService; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index 10f57122..9b874b68 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -8,7 +8,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.ViewUrl; -import com.services.eSignature.EmbeddedSendingService; +import com.docusign.controller.eSignature.services.EmbeddedSendingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java index 580d7f96..99dcf832 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java @@ -7,7 +7,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.ViewUrl; -import com.services.eSignature.EmbeddedConsoleService; +import com.docusign.controller.eSignature.services.EmbeddedConsoleService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index 3e722b9b..0e6b8f3b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -10,7 +10,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeTemplateResults; import com.docusign.esign.model.ViewUrl; -import com.services.eSignature.AddDocToTemplateService; +import com.docusign.controller.eSignature.services.AddDocToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 09c3a00e..458594fd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.CollectPaymentService; +import com.docusign.controller.eSignature.services.CollectPaymentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java index 5a53d955..6ffc15cf 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeFormData; -import com.services.eSignature.GetTabValuesService; +import com.docusign.controller.eSignature.services.GetTabValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java index 916591f0..84e46145 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java @@ -11,7 +11,7 @@ import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.RecipientViewRequest; import com.docusign.esign.model.ViewUrl; -import com.services.eSignature.SetTabValuesService; +import com.docusign.controller.eSignature.services.SetTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index 629749cf..3069d7e1 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; -import com.services.eSignature.SetTemplateTabValuesService; +import com.docusign.controller.eSignature.services.SetTemplateTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java index edd30e6a..6e0c461b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.CustomFieldsEnvelope; -import com.services.eSignature.EnvelopeCustomFieldValuesService; +import com.docusign.controller.eSignature.services.EnvelopeCustomFieldValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index 7f26e8f6..fbec717b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.AccessCodeAuthenticationService; +import com.docusign.controller.eSignature.services.AccessCodeAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index f27c509d..fc038ffd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.PhoneAuthenticationService; +import com.docusign.controller.eSignature.services.PhoneAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index 935c6687..da3cc755 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.KBAAuthenticationService; +import com.docusign.controller.eSignature.services.KBAAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index 48e7f0f6..00c0ef03 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -10,7 +10,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.IdvAuthenticationService; +import com.docusign.controller.eSignature.services.IdvAuthenticationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java index d45f232a..8ec4eab4 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java @@ -7,7 +7,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.eSignature.PermissionCreateService; +import com.docusign.controller.eSignature.services.PermissionCreateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java index 3ae1c54d..05ece245 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java @@ -12,7 +12,7 @@ import com.docusign.esign.model.ErrorDetails; import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; -import com.services.eSignature.PermissionSetUserGroupsService; +import com.docusign.controller.eSignature.services.PermissionSetUserGroupsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java index 8cb89db3..7580b1e6 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.PermissionProfile; import com.docusign.esign.model.PermissionProfileInformation; -import com.services.eSignature.PermissionChangeSingleSettingService; +import com.docusign.controller.eSignature.services.PermissionChangeSingleSettingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java index cdff9df8..d0ff6c29 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java @@ -6,7 +6,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.eSignature.PermissionDeleteService; +import com.docusign.controller.eSignature.services.PermissionDeleteService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java index 10ca0e25..c619302d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java @@ -9,7 +9,7 @@ import com.docusign.esign.api.AccountsApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.BrandsResponse; -import com.services.eSignature.CreateBrandService; +import com.docusign.controller.eSignature.services.CreateBrandService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index 9942d00d..ee741abc 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -11,7 +11,7 @@ import com.docusign.esign.model.BrandsResponse; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.ApplyBrandToEnvelopeService; +import com.docusign.controller.eSignature.services.ApplyBrandToEnvelopeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index fb870a54..a8632ecd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -1,7 +1,6 @@ package com.docusign.controller.eSignature.examples; import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; @@ -9,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.eSignature.ApplyBrandToTemplateService; +import com.docusign.controller.eSignature.services.ApplyBrandToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -25,7 +24,6 @@ import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.TemplateRole; /** diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index 5d43b260..7b9a3c72 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.BulkSendBatchStatus; -import com.services.eSignature.BulkSendEnvelopesService; +import com.docusign.controller.eSignature.services.BulkSendEnvelopesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index 8cecde33..c16d2ff6 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -9,7 +9,7 @@ import com.docusign.core.model.User; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.PauseSignatureWorkflowService; +import com.docusign.controller.eSignature.services.PauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index d38c2322..5732e8ee 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -8,7 +8,7 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeUpdateSummary; -import com.services.eSignature.UnpauseSignatureWorkflowService; +import com.docusign.controller.eSignature.services.UnpauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index 2c721aa7..ce310082 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.UseConditionalRecipientsService; +import com.docusign.controller.eSignature.services.UseConditionalRecipientsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java index 3880a128..d882b4e2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java @@ -9,7 +9,7 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.services.eSignature.SMSDeliveryService; +import com.docusign.controller.eSignature.services.SMSDeliveryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/services/eSignature/AccessCodeAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/AccessCodeAuthenticationService.java similarity index 96% rename from src/main/java/com/services/eSignature/AccessCodeAuthenticationService.java rename to src/main/java/com/docusign/controller/eSignature/services/AccessCodeAuthenticationService.java index 92009601..9225e14e 100644 --- a/src/main/java/com/services/eSignature/AccessCodeAuthenticationService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/AccessCodeAuthenticationService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/AddDocToTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java similarity index 99% rename from src/main/java/com/services/eSignature/AddDocToTemplateService.java rename to src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java index b963931c..2f906399 100644 --- a/src/main/java/com/services/eSignature/AddDocToTemplateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/ApplyBrandToEnvelopeService.java b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToEnvelopeService.java similarity index 97% rename from src/main/java/com/services/eSignature/ApplyBrandToEnvelopeService.java rename to src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToEnvelopeService.java index 4acb1fe4..bdee0e8d 100644 --- a/src/main/java/com/services/eSignature/ApplyBrandToEnvelopeService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToEnvelopeService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/ApplyBrandToTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToTemplateService.java similarity index 96% rename from src/main/java/com/services/eSignature/ApplyBrandToTemplateService.java rename to src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToTemplateService.java index 928e53a4..0aee7212 100644 --- a/src/main/java/com/services/eSignature/ApplyBrandToTemplateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToTemplateService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/BulkSendEnvelopesService.java b/src/main/java/com/docusign/controller/eSignature/services/BulkSendEnvelopesService.java similarity index 99% rename from src/main/java/com/services/eSignature/BulkSendEnvelopesService.java rename to src/main/java/com/docusign/controller/eSignature/services/BulkSendEnvelopesService.java index d84bd01d..5a189faf 100644 --- a/src/main/java/com/services/eSignature/BulkSendEnvelopesService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/BulkSendEnvelopesService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.DsModelUtils; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/CollectPaymentService.java b/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java similarity index 99% rename from src/main/java/com/services/eSignature/CollectPaymentService.java rename to src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java index f4c18b48..224bf507 100644 --- a/src/main/java/com/services/eSignature/CollectPaymentService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/CreateBrandService.java b/src/main/java/com/docusign/controller/eSignature/services/CreateBrandService.java similarity index 93% rename from src/main/java/com/services/eSignature/CreateBrandService.java rename to src/main/java/com/docusign/controller/eSignature/services/CreateBrandService.java index 44888f2d..dfd73b2f 100644 --- a/src/main/java/com/services/eSignature/CreateBrandService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/CreateBrandService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/CreateTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/CreateTemplateService.java similarity index 99% rename from src/main/java/com/services/eSignature/CreateTemplateService.java rename to src/main/java/com/docusign/controller/eSignature/services/CreateTemplateService.java index c915a728..53203c23 100644 --- a/src/main/java/com/services/eSignature/CreateTemplateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/CreateTemplateService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.TemplatesApi; diff --git a/src/main/java/com/services/eSignature/EmbeddedConsoleService.java b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedConsoleService.java similarity index 95% rename from src/main/java/com/services/eSignature/EmbeddedConsoleService.java rename to src/main/java/com/docusign/controller/eSignature/services/EmbeddedConsoleService.java index 02fb2ec9..bb4d881d 100644 --- a/src/main/java/com/services/eSignature/EmbeddedConsoleService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedConsoleService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/EmbeddedSendingService.java b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSendingService.java similarity index 96% rename from src/main/java/com/services/eSignature/EmbeddedSendingService.java rename to src/main/java/com/docusign/controller/eSignature/services/EmbeddedSendingService.java index 961da4a5..de341e2c 100644 --- a/src/main/java/com/services/eSignature/EmbeddedSendingService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSendingService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/EmbeddedSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSigningService.java similarity index 98% rename from src/main/java/com/services/eSignature/EmbeddedSigningService.java rename to src/main/java/com/docusign/controller/eSignature/services/EmbeddedSigningService.java index 93e0d773..e5277280 100644 --- a/src/main/java/com/services/eSignature/EmbeddedSigningService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSigningService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.DSConfiguration; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/EnvelopeCustomFieldValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeCustomFieldValuesService.java similarity index 89% rename from src/main/java/com/services/eSignature/EnvelopeCustomFieldValuesService.java rename to src/main/java/com/docusign/controller/eSignature/services/EnvelopeCustomFieldValuesService.java index d936aaa0..0e7a02bb 100644 --- a/src/main/java/com/services/eSignature/EnvelopeCustomFieldValuesService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeCustomFieldValuesService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/EnvelopeDocsService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeDocsService.java similarity index 90% rename from src/main/java/com/services/eSignature/EnvelopeDocsService.java rename to src/main/java/com/docusign/controller/eSignature/services/EnvelopeDocsService.java index 107242ed..1a6c9657 100644 --- a/src/main/java/com/services/eSignature/EnvelopeDocsService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeDocsService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/EnvelopeGetDocService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeGetDocService.java similarity index 92% rename from src/main/java/com/services/eSignature/EnvelopeGetDocService.java rename to src/main/java/com/docusign/controller/eSignature/services/EnvelopeGetDocService.java index dac44932..2930912a 100644 --- a/src/main/java/com/services/eSignature/EnvelopeGetDocService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeGetDocService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/EnvelopeInfoService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeInfoService.java similarity index 88% rename from src/main/java/com/services/eSignature/EnvelopeInfoService.java rename to src/main/java/com/docusign/controller/eSignature/services/EnvelopeInfoService.java index e2fa4bd7..cd184bef 100644 --- a/src/main/java/com/services/eSignature/EnvelopeInfoService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeInfoService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/EnvelopeRecipientsService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeRecipientsService.java similarity index 89% rename from src/main/java/com/services/eSignature/EnvelopeRecipientsService.java rename to src/main/java/com/docusign/controller/eSignature/services/EnvelopeRecipientsService.java index 1412e6b2..1d0e3139 100644 --- a/src/main/java/com/services/eSignature/EnvelopeRecipientsService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeRecipientsService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/GetTabValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/GetTabValuesService.java similarity index 89% rename from src/main/java/com/services/eSignature/GetTabValuesService.java rename to src/main/java/com/docusign/controller/eSignature/services/GetTabValuesService.java index aab7c977..4a41e140 100644 --- a/src/main/java/com/services/eSignature/GetTabValuesService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/GetTabValuesService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/IdvAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/IdvAuthenticationService.java similarity index 98% rename from src/main/java/com/services/eSignature/IdvAuthenticationService.java rename to src/main/java/com/docusign/controller/eSignature/services/IdvAuthenticationService.java index 2774e803..4f8925ee 100644 --- a/src/main/java/com/services/eSignature/IdvAuthenticationService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/IdvAuthenticationService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.AccountsApi; diff --git a/src/main/java/com/services/eSignature/KBAAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/KBAAuthenticationService.java similarity index 98% rename from src/main/java/com/services/eSignature/KBAAuthenticationService.java rename to src/main/java/com/docusign/controller/eSignature/services/KBAAuthenticationService.java index a4d8eb05..370ce449 100644 --- a/src/main/java/com/services/eSignature/KBAAuthenticationService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/KBAAuthenticationService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/ListEnvelopesServices.java b/src/main/java/com/docusign/controller/eSignature/services/ListEnvelopesServices.java similarity index 94% rename from src/main/java/com/services/eSignature/ListEnvelopesServices.java rename to src/main/java/com/docusign/controller/eSignature/services/ListEnvelopesServices.java index 68703916..2178bd71 100644 --- a/src/main/java/com/services/eSignature/ListEnvelopesServices.java +++ b/src/main/java/com/docusign/controller/eSignature/services/ListEnvelopesServices.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; diff --git a/src/main/java/com/services/eSignature/PauseSignatureWorkflowService.java b/src/main/java/com/docusign/controller/eSignature/services/PauseSignatureWorkflowService.java similarity index 98% rename from src/main/java/com/services/eSignature/PauseSignatureWorkflowService.java rename to src/main/java/com/docusign/controller/eSignature/services/PauseSignatureWorkflowService.java index bcd4346b..69592214 100644 --- a/src/main/java/com/services/eSignature/PauseSignatureWorkflowService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PauseSignatureWorkflowService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/PermissionChangeSingleSettingService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java similarity index 98% rename from src/main/java/com/services/eSignature/PermissionChangeSingleSettingService.java rename to src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java index 335c4148..22630b64 100644 --- a/src/main/java/com/services/eSignature/PermissionChangeSingleSettingService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.DsModelUtils; import com.docusign.core.model.AccountRoleSettingsPatch; diff --git a/src/main/java/com/services/eSignature/PermissionCreateService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java similarity index 96% rename from src/main/java/com/services/eSignature/PermissionCreateService.java rename to src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java index 966cf223..65b5703f 100644 --- a/src/main/java/com/services/eSignature/PermissionCreateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.DsModelUtils; import com.docusign.core.model.AccountRoleSettingsPatch; diff --git a/src/main/java/com/services/eSignature/PermissionDeleteService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionDeleteService.java similarity index 87% rename from src/main/java/com/services/eSignature/PermissionDeleteService.java rename to src/main/java/com/docusign/controller/eSignature/services/PermissionDeleteService.java index 6df358b9..0436faaf 100644 --- a/src/main/java/com/services/eSignature/PermissionDeleteService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionDeleteService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.AccountsApi; diff --git a/src/main/java/com/services/eSignature/PermissionSetUserGroupsService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionSetUserGroupsService.java similarity index 94% rename from src/main/java/com/services/eSignature/PermissionSetUserGroupsService.java rename to src/main/java/com/docusign/controller/eSignature/services/PermissionSetUserGroupsService.java index 8a06c166..1ab37589 100644 --- a/src/main/java/com/services/eSignature/PermissionSetUserGroupsService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionSetUserGroupsService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.esign.api.GroupsApi; import com.docusign.esign.client.ApiClient; diff --git a/src/main/java/com/services/eSignature/PhoneAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/PhoneAuthenticationService.java similarity index 97% rename from src/main/java/com/services/eSignature/PhoneAuthenticationService.java rename to src/main/java/com/docusign/controller/eSignature/services/PhoneAuthenticationService.java index 046d26cb..76a76afa 100644 --- a/src/main/java/com/services/eSignature/PhoneAuthenticationService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PhoneAuthenticationService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/SMSDeliveryService.java b/src/main/java/com/docusign/controller/eSignature/services/SMSDeliveryService.java similarity index 99% rename from src/main/java/com/services/eSignature/SMSDeliveryService.java rename to src/main/java/com/docusign/controller/eSignature/services/SMSDeliveryService.java index 968abf5b..b34c9dd4 100644 --- a/src/main/java/com/services/eSignature/SMSDeliveryService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SMSDeliveryService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/SendBinaryDocsService.java b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java similarity index 99% rename from src/main/java/com/services/eSignature/SendBinaryDocsService.java rename to src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java index 9c6c972b..9c3da4d1 100644 --- a/src/main/java/com/services/eSignature/SendBinaryDocsService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/SetTabValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/SetTabValuesService.java similarity index 99% rename from src/main/java/com/services/eSignature/SetTabValuesService.java rename to src/main/java/com/docusign/controller/eSignature/services/SetTabValuesService.java index 86a0d90f..3e41d4f0 100644 --- a/src/main/java/com/services/eSignature/SetTabValuesService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SetTabValuesService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/SetTemplateTabValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/SetTemplateTabValuesService.java similarity index 99% rename from src/main/java/com/services/eSignature/SetTemplateTabValuesService.java rename to src/main/java/com/docusign/controller/eSignature/services/SetTemplateTabValuesService.java index 0a816b23..3019776d 100644 --- a/src/main/java/com/services/eSignature/SetTemplateTabValuesService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SetTemplateTabValuesService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/SigningViaEmailService.java b/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java similarity index 98% rename from src/main/java/com/services/eSignature/SigningViaEmailService.java rename to src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java index a86a5b87..a844b140 100644 --- a/src/main/java/com/services/eSignature/SigningViaEmailService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; diff --git a/src/main/java/com/services/eSignature/UnpauseSignatureWorkflowService.java b/src/main/java/com/docusign/controller/eSignature/services/UnpauseSignatureWorkflowService.java similarity index 95% rename from src/main/java/com/services/eSignature/UnpauseSignatureWorkflowService.java rename to src/main/java/com/docusign/controller/eSignature/services/UnpauseSignatureWorkflowService.java index 7c35c92c..189ffabb 100644 --- a/src/main/java/com/services/eSignature/UnpauseSignatureWorkflowService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/UnpauseSignatureWorkflowService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/UseConditionalRecipientsService.java b/src/main/java/com/docusign/controller/eSignature/services/UseConditionalRecipientsService.java similarity index 99% rename from src/main/java/com/services/eSignature/UseConditionalRecipientsService.java rename to src/main/java/com/docusign/controller/eSignature/services/UseConditionalRecipientsService.java index e594ae97..31d37c41 100644 --- a/src/main/java/com/services/eSignature/UseConditionalRecipientsService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/UseConditionalRecipientsService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/services/eSignature/UseTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/UseTemplateService.java similarity index 96% rename from src/main/java/com/services/eSignature/UseTemplateService.java rename to src/main/java/com/docusign/controller/eSignature/services/UseTemplateService.java index e179c026..d88e78a2 100644 --- a/src/main/java/com/services/eSignature/UseTemplateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/UseTemplateService.java @@ -1,4 +1,4 @@ -package com.services.eSignature; +package com.docusign.controller.eSignature.services; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.api.EnvelopesApi; diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 0a80f2a8..8608eb53 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -5,7 +5,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.services.monitor.GetMonitoringDataService; +import com.docusign.controller.monitor.services.GetMonitoringDataService; import org.json.JSONArray; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/services/monitor/GetMonitoringDataService.java b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java similarity index 96% rename from src/main/java/com/services/monitor/GetMonitoringDataService.java rename to src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java index a4f99b5c..9bd50bab 100644 --- a/src/main/java/com/services/monitor/GetMonitoringDataService.java +++ b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java @@ -1,4 +1,4 @@ -package com.services.monitor; +package com.docusign.controller.monitor.services; import com.docusign.monitor.api.DataSetApi; import com.docusign.monitor.model.CursoredResult; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index c8dd4898..1bb05e9d 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -9,8 +9,8 @@ import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.RoleSummary; import com.docusign.rooms.model.Room; -import com.services.rooms.CreateRoomService; -import com.services.rooms.GetAdminRolesService; +import com.docusign.controller.rooms.services.CreateRoomService; +import com.docusign.controller.rooms.services.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index db6c22c9..2d5931cd 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -11,8 +11,8 @@ import com.docusign.rooms.model.RoleSummary; import com.docusign.rooms.model.Room; import com.docusign.rooms.model.RoomTemplatesSummaryList; -import com.services.rooms.CreateRoomWithTemplateService; -import com.services.rooms.GetAdminRolesService; +import com.docusign.controller.rooms.services.CreateRoomWithTemplateService; +import com.docusign.controller.rooms.services.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index 704bd687..30e35f7f 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -9,7 +9,7 @@ import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FieldData; import com.docusign.rooms.model.RoomSummaryList; -import com.services.rooms.ExportingDataFromRoomService; +import com.docusign.controller.rooms.services.ExportingDataFromRoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 15499b35..61e24951 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -10,8 +10,8 @@ import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomDocument; import com.docusign.rooms.model.RoomSummaryList; -import com.services.rooms.AddingFormsToRoomService; -import com.services.rooms.GetFormSummaryListService; +import com.docusign.controller.rooms.services.AddingFormsToRoomService; +import com.docusign.controller.rooms.services.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index ad29c3cb..f81031ac 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -8,7 +8,7 @@ import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.RoomSummaryList; -import com.services.rooms.GetRoomsWithFiltersService; +import com.docusign.controller.rooms.services.GetRoomsWithFiltersService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index 40262393..a6d111b2 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -11,8 +11,8 @@ import com.docusign.rooms.model.ExternalFormFillSession; import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomSummaryList; -import com.services.rooms.CreateExternalFormFillSessionService; -import com.services.rooms.GetFormSummaryListService; +import com.docusign.controller.rooms.services.CreateExternalFormFillSessionService; +import com.docusign.controller.rooms.services.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index f64424f0..41ac71b0 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -8,7 +8,7 @@ import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FormGroup; -import com.services.rooms.CreateFormGroupService; +import com.docusign.controller.rooms.services.CreateFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index f881f076..0b9651d6 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -9,7 +9,7 @@ import com.docusign.rooms.api.OfficesApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.*; -import com.services.rooms.GrantOfficeAccessToFormGroupService; +import com.docusign.controller.rooms.services.GrantOfficeAccessToFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 8088db79..8272d769 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -10,8 +10,8 @@ import com.docusign.rooms.model.FormGroupFormToAssign; import com.docusign.rooms.model.FormGroupSummaryList; import com.docusign.rooms.model.FormSummary; -import com.services.rooms.AssignFormToFormGroupService; -import com.services.rooms.GetFormSummaryListService; +import com.docusign.controller.rooms.services.AssignFormToFormGroupService; +import com.docusign.controller.rooms.services.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; diff --git a/src/main/java/com/services/rooms/AddingFormsToRoomService.java b/src/main/java/com/docusign/controller/rooms/services/AddingFormsToRoomService.java similarity index 92% rename from src/main/java/com/services/rooms/AddingFormsToRoomService.java rename to src/main/java/com/docusign/controller/rooms/services/AddingFormsToRoomService.java index c99118dd..25fe945d 100644 --- a/src/main/java/com/services/rooms/AddingFormsToRoomService.java +++ b/src/main/java/com/docusign/controller/rooms/services/AddingFormsToRoomService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/AssignFormToFormGroupService.java b/src/main/java/com/docusign/controller/rooms/services/AssignFormToFormGroupService.java similarity index 94% rename from src/main/java/com/services/rooms/AssignFormToFormGroupService.java rename to src/main/java/com/docusign/controller/rooms/services/AssignFormToFormGroupService.java index 4a42d0d9..5cc0e8c1 100644 --- a/src/main/java/com/services/rooms/AssignFormToFormGroupService.java +++ b/src/main/java/com/docusign/controller/rooms/services/AssignFormToFormGroupService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/CreateExternalFormFillSessionService.java b/src/main/java/com/docusign/controller/rooms/services/CreateExternalFormFillSessionService.java similarity index 95% rename from src/main/java/com/services/rooms/CreateExternalFormFillSessionService.java rename to src/main/java/com/docusign/controller/rooms/services/CreateExternalFormFillSessionService.java index 52fdf399..f0e12e44 100644 --- a/src/main/java/com/services/rooms/CreateExternalFormFillSessionService.java +++ b/src/main/java/com/docusign/controller/rooms/services/CreateExternalFormFillSessionService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.ExternalFormFillSessionsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/CreateFormGroupService.java b/src/main/java/com/docusign/controller/rooms/services/CreateFormGroupService.java similarity index 93% rename from src/main/java/com/services/rooms/CreateFormGroupService.java rename to src/main/java/com/docusign/controller/rooms/services/CreateFormGroupService.java index 6cafa3d5..d1e25ab6 100644 --- a/src/main/java/com/services/rooms/CreateFormGroupService.java +++ b/src/main/java/com/docusign/controller/rooms/services/CreateFormGroupService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/CreateRoomService.java b/src/main/java/com/docusign/controller/rooms/services/CreateRoomService.java similarity index 97% rename from src/main/java/com/services/rooms/CreateRoomService.java rename to src/main/java/com/docusign/controller/rooms/services/CreateRoomService.java index cb13f47a..a7ca337c 100644 --- a/src/main/java/com/services/rooms/CreateRoomService.java +++ b/src/main/java/com/docusign/controller/rooms/services/CreateRoomService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/CreateRoomWithTemplateService.java b/src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java similarity index 97% rename from src/main/java/com/services/rooms/CreateRoomWithTemplateService.java rename to src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java index b3235acd..cc9e09bb 100644 --- a/src/main/java/com/services/rooms/CreateRoomWithTemplateService.java +++ b/src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/ExportingDataFromRoomService.java b/src/main/java/com/docusign/controller/rooms/services/ExportingDataFromRoomService.java similarity index 89% rename from src/main/java/com/services/rooms/ExportingDataFromRoomService.java rename to src/main/java/com/docusign/controller/rooms/services/ExportingDataFromRoomService.java index cc7f081a..2be2fde5 100644 --- a/src/main/java/com/services/rooms/ExportingDataFromRoomService.java +++ b/src/main/java/com/docusign/controller/rooms/services/ExportingDataFromRoomService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/GetAdminRolesService.java b/src/main/java/com/docusign/controller/rooms/services/GetAdminRolesService.java similarity index 91% rename from src/main/java/com/services/rooms/GetAdminRolesService.java rename to src/main/java/com/docusign/controller/rooms/services/GetAdminRolesService.java index a255d0fa..ec6f22e9 100644 --- a/src/main/java/com/services/rooms/GetAdminRolesService.java +++ b/src/main/java/com/docusign/controller/rooms/services/GetAdminRolesService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/GetFormSummaryListService.java b/src/main/java/com/docusign/controller/rooms/services/GetFormSummaryListService.java similarity index 95% rename from src/main/java/com/services/rooms/GetFormSummaryListService.java rename to src/main/java/com/docusign/controller/rooms/services/GetFormSummaryListService.java index afed41e2..e33729a3 100644 --- a/src/main/java/com/services/rooms/GetFormSummaryListService.java +++ b/src/main/java/com/docusign/controller/rooms/services/GetFormSummaryListService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.FormLibrariesApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/GetRoomsWithFiltersService.java b/src/main/java/com/docusign/controller/rooms/services/GetRoomsWithFiltersService.java similarity index 93% rename from src/main/java/com/services/rooms/GetRoomsWithFiltersService.java rename to src/main/java/com/docusign/controller/rooms/services/GetRoomsWithFiltersService.java index 007bb412..7e595ff2 100644 --- a/src/main/java/com/services/rooms/GetRoomsWithFiltersService.java +++ b/src/main/java/com/docusign/controller/rooms/services/GetRoomsWithFiltersService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; diff --git a/src/main/java/com/services/rooms/GrantOfficeAccessToFormGroupService.java b/src/main/java/com/docusign/controller/rooms/services/GrantOfficeAccessToFormGroupService.java similarity index 91% rename from src/main/java/com/services/rooms/GrantOfficeAccessToFormGroupService.java rename to src/main/java/com/docusign/controller/rooms/services/GrantOfficeAccessToFormGroupService.java index 360d4315..61b48dbf 100644 --- a/src/main/java/com/services/rooms/GrantOfficeAccessToFormGroupService.java +++ b/src/main/java/com/docusign/controller/rooms/services/GrantOfficeAccessToFormGroupService.java @@ -1,4 +1,4 @@ -package com.services.rooms; +package com.docusign.controller.rooms.services; import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; From ea8912e960afdfd2dc2ec888002c28f929900d0a Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 2 Nov 2021 17:22:40 +0200 Subject: [PATCH 219/699] return error page in case the api type is not supported --- .../controller/GlobalControllerAdvice.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index d0e48e23..8397a40b 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -2,6 +2,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.ApiIndex; +import com.docusign.core.exception.LauncherException; import com.docusign.core.model.*; import com.docusign.core.utils.AccountsConverter; import com.docusign.esign.client.auth.OAuth; @@ -14,14 +15,17 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; +import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.servlet.ModelAndView; import java.util.*; import java.util.stream.Collectors; +import static com.docusign.core.controller.AbstractController.ERROR_PAGE; + /** * This class provides common model attributes for all pages. If you want to * refresh tokens use the next code to access to expiration time: @@ -78,11 +82,13 @@ public boolean populateShowDoc() { } @ModelAttribute("locals") - public Locals populateLocals() { + public Locals populateLocals(ModelMap model) throws LauncherException { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + String selectedApi = config.getApiName().getFirstSelectedApi(); if (!EnumUtils.isValidEnum(ApiIndex.class, selectedApi)){ - throw new NoSuchElementException(selectedApi); + handleException("Wrong api name", selectedApi, model); + return null; } ApiIndex apiIndex = ApiIndex.valueOf(selectedApi); session.setApiIndexPath(apiIndex.toString()); @@ -114,6 +120,16 @@ public Locals populateLocals() { return new Locals(config, session, user, ""); } + @PostMapping + private String handleException(String errorName, String errorMethod, ModelMap model) { + new DoneExample() + .withTitle(errorName) + .withName(errorName) + .withMessage(errorMethod) + .addToModel(model); + return ERROR_PAGE; + } + private String getBaseUrl(ApiIndex apiIndex, OAuth.Account oauthAccount) { if (apiIndex.equals(ApiIndex.ROOMS)) { return this.config.getRoomsBasePath(); From fa8d3c2f77255c94d8f3cba3f581cc2569ada84e Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 2 Nov 2021 17:24:43 +0200 Subject: [PATCH 220/699] removed unnecessary throws --- .../com/docusign/core/controller/GlobalControllerAdvice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 8397a40b..d623b7fc 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -82,7 +82,7 @@ public boolean populateShowDoc() { } @ModelAttribute("locals") - public Locals populateLocals(ModelMap model) throws LauncherException { + public Locals populateLocals(ModelMap model) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String selectedApi = config.getApiName().getFirstSelectedApi(); From 8a5ac26462927c2f4a8b78d2aea817eb2e334f4a Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 2 Nov 2021 17:36:06 +0200 Subject: [PATCH 221/699] removed calling custom error page --- .../controller/GlobalControllerAdvice.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index d623b7fc..14137190 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -2,7 +2,6 @@ import com.docusign.DSConfiguration; import com.docusign.common.ApiIndex; -import com.docusign.core.exception.LauncherException; import com.docusign.core.model.*; import com.docusign.core.utils.AccountsConverter; import com.docusign.esign.client.auth.OAuth; @@ -15,17 +14,13 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; -import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.context.WebApplicationContext; import java.util.*; import java.util.stream.Collectors; -import static com.docusign.core.controller.AbstractController.ERROR_PAGE; - /** * This class provides common model attributes for all pages. If you want to * refresh tokens use the next code to access to expiration time: @@ -82,13 +77,12 @@ public boolean populateShowDoc() { } @ModelAttribute("locals") - public Locals populateLocals(ModelMap model) { + public Locals populateLocals() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String selectedApi = config.getApiName().getFirstSelectedApi(); if (!EnumUtils.isValidEnum(ApiIndex.class, selectedApi)){ - handleException("Wrong api name", selectedApi, model); - return null; + throw new NoSuchElementException(selectedApi); } ApiIndex apiIndex = ApiIndex.valueOf(selectedApi); session.setApiIndexPath(apiIndex.toString()); @@ -120,16 +114,6 @@ public Locals populateLocals(ModelMap model) { return new Locals(config, session, user, ""); } - @PostMapping - private String handleException(String errorName, String errorMethod, ModelMap model) { - new DoneExample() - .withTitle(errorName) - .withName(errorName) - .withMessage(errorMethod) - .addToModel(model); - return ERROR_PAGE; - } - private String getBaseUrl(ApiIndex apiIndex, OAuth.Account oauthAccount) { if (apiIndex.equals(ApiIndex.ROOMS)) { return this.config.getRoomsBasePath(); From 490032b08f08fdc6b735bff59fb3457fe69946fa Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 2 Nov 2021 17:44:46 +0200 Subject: [PATCH 222/699] Moved error message constant to GlobalControllerAdvice --- src/main/java/com/docusign/common/SelectedApiTypes.java | 4 +--- .../com/docusign/core/controller/GlobalControllerAdvice.java | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/docusign/common/SelectedApiTypes.java b/src/main/java/com/docusign/common/SelectedApiTypes.java index 93724999..267a2d1c 100644 --- a/src/main/java/com/docusign/common/SelectedApiTypes.java +++ b/src/main/java/com/docusign/common/SelectedApiTypes.java @@ -1,6 +1,5 @@ package com.docusign.common; -import com.docusign.monitor.client.ApiException; import lombok.Getter; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -18,7 +17,6 @@ public class SelectedApiTypes { private Boolean MONITOR; @Value("${DS_API_NAME.ADMIN}") private Boolean ADMIN; - private final String SELECTED_API_NOT_SUPPORTED = "Currently selected api is not supported by launcher. Please, check appsettings.json file"; public String getFirstSelectedApi() { return (ESIGNATURE)? ApiIndex.ESIGNATURE.name() @@ -26,6 +24,6 @@ public String getFirstSelectedApi() { : (CLICK)? ApiIndex.CLICK.name() : (MONITOR)? ApiIndex.MONITOR.name() : (ADMIN)? ApiIndex.ADMIN.name() - : SELECTED_API_NOT_SUPPORTED; + : null; } } diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 14137190..b552d496 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -41,7 +41,7 @@ public class GlobalControllerAdvice { private static final String ERROR_ACCOUNT_NOT_FOUND = "Could not find account information for the user"; - + private static final String SELECTED_API_NOT_SUPPORTED = "Currently selected api is not supported by launcher. Please, check appsettings.json file."; private final DSConfiguration config; private final Session session; private final User user; @@ -82,7 +82,7 @@ public Locals populateLocals() { String selectedApi = config.getApiName().getFirstSelectedApi(); if (!EnumUtils.isValidEnum(ApiIndex.class, selectedApi)){ - throw new NoSuchElementException(selectedApi); + throw new NoSuchElementException(SELECTED_API_NOT_SUPPORTED); } ApiIndex apiIndex = ApiIndex.valueOf(selectedApi); session.setApiIndexPath(apiIndex.toString()); From 77f5f26706b2c3c33ef3ee713fdc0868c402363b Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 3 Nov 2021 12:11:48 +0200 Subject: [PATCH 223/699] Fixed white-spaces and variable naming issues --- .../admin/examples/A001AddActiveUser.java | 29 ++++++++-------- .../A002CreateActiveCLMESignUser.java | 34 +++++++++---------- .../examples/A003BulkExportUserData.java | 8 +++-- .../examples/A003aCheckRequestStatus.java | 6 ++-- .../examples/A004BulkImportUserData.java | 8 +++-- .../A004CheckImportRequestStatus.java | 7 ++-- .../admin/examples/A005AuditUsers.java | 8 +++-- .../admin/services/AddActiveUserService.java | 4 +-- .../CreateActiveCLMESignUserService.java | 4 +-- .../EG002ControllerSigningViaEmail.java | 8 ++--- .../examples/EG006ControllerEnvelopeDocs.java | 6 ++-- .../EG007ControllerEnvelopeGetDoc.java | 6 ++-- .../EG008ControllerCreateTemplate.java | 6 ++-- .../examples/EG009ControllerUseTemplate.java | 8 ++--- .../EG011ControllerEmbeddedSending.java | 4 +-- .../EG014ControllerCollectPayment.java | 4 +-- .../EG017ControllerSetTemplateTabValues.java | 2 -- ...019ControllerAccessCodeAuthentication.java | 6 ++-- .../EG020ControllerPhoneAuthentication.java | 8 ++--- .../EG022ControllerKBAAuthentication.java | 8 ++--- .../EG023ControllerIdvAuthentication.java | 8 ++--- ...EG032ControllerPauseSignatureWorkflow.java | 9 +++-- .../services/AddDocToTemplateService.java | 14 ++++---- .../PermissionChangeSingleSettingService.java | 3 +- .../services/PermissionCreateService.java | 3 +- .../java/com/docusign/core/model/Locals.java | 1 - 26 files changed, 108 insertions(+), 104 deletions(-) diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index 9c0095d2..658244ea 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -1,6 +1,7 @@ package com.docusign.controller.admin.examples; import com.docusign.DSConfiguration; +import com.docusign.admin.client.ApiException; import com.docusign.admin.model.NewUserResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; @@ -34,12 +35,23 @@ public class A001AddActiveUser extends AbstractAdminController { private static final String MODEL_LIST_GROUPS = "listGroups"; private final User user; private final Session session; + private final String accessToken; + private final String basePath; + private final UUID organizationId; + private final UUID accountId; @Autowired - public A001AddActiveUser(DSConfiguration config, Session session, User user) { + public A001AddActiveUser(DSConfiguration config, Session session, User user) throws Exception { super(config, "a001", "Create a new active eSignature user"); this.user = user; this.session = session; + this.accessToken = this.user.getAccessToken(); + this.basePath = this.session.getBasePath(); + this.organizationId = this.getOrganizationId(accessToken, basePath); + this.accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(accessToken, basePath), + config.getSignerEmail(), + organizationId); } @Override @@ -50,11 +62,6 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3 start AccountsApi accountsApi = new AccountsApi(apiClient); - UUID orgId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = GetExistingAccountIdService.getExistingAccountId( - createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), - config.getSignerEmail(), - orgId); PermissionProfileInformation permissionsInfo = accountsApi.listPermissions(String.valueOf(accountId)); // Step 3 end @@ -70,14 +77,6 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - UUID organizationId = this.getOrganizationId( - this.user.getAccessToken(), - this.session.getBasePath()); - UUID accountId = GetExistingAccountIdService.getExistingAccountId( - createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), - config.getSignerEmail(), - organizationId); - NewUserResponse result = AddActiveUserService.addActiveUser( args.getGroupId(), args.getProfileId(), @@ -85,7 +84,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getUserName(), args.getFirstName(), args.getLastName(), - createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + createUsersApi(accessToken, basePath), organizationId, accountId); diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index a24de2d9..088be68f 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -4,6 +4,7 @@ import com.docusign.admin.api.DsGroupsApi; import com.docusign.admin.api.ProductPermissionProfilesApi; import com.docusign.admin.api.UsersApi; +import com.docusign.admin.client.ApiException; import com.docusign.admin.model.AddUserResponse; import com.docusign.admin.model.DSGroupListResponse; import com.docusign.admin.model.ProductPermissionProfileResponse; @@ -32,27 +33,31 @@ public class A002CreateActiveCLMESignUser extends AbstractAdminController { private final User user; private final Session session; + private final String accessToken; + private final String basePath; + private final UUID organizationId; + private final UUID accountId; @Autowired - public A002CreateActiveCLMESignUser(DSConfiguration config, Session session, User user) { + public A002CreateActiveCLMESignUser(DSConfiguration config, Session session, User user) throws Exception { super(config, "a002", "Create new active user for CLM and eSignature"); this.user = user; this.session = session; + this.accessToken = this.user.getAccessToken(); + this.basePath = this.session.getBasePath(); + this.organizationId = this.getOrganizationId(accessToken, basePath); + this.accountId = GetExistingAccountIdService.getExistingAccountId( + createUsersApi(accessToken, basePath), + config.getSignerEmail(), + organizationId); } @Override protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = GetExistingAccountIdService.getExistingAccountId( - createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), - config.getSignerEmail(), - organizationId); - // Step 3 start - ProductPermissionProfilesApi permissionsInfo = this.createProductPermissionProfilesApi(user.getAccessToken(), - session.getBasePath()); + ProductPermissionProfilesApi permissionsInfo = this.createProductPermissionProfilesApi(accessToken, basePath); ProductPermissionProfilesResponse profiles = permissionsInfo.getProductPermissionProfiles( organizationId, accountId); @@ -74,7 +79,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3 end // Step 4 start - DsGroupsApi groupsApi = this.createDSGroupsApi(user.getAccessToken(), session.getBasePath()); + DsGroupsApi groupsApi = this.createDSGroupsApi(accessToken, basePath); DSGroupListResponse groups = groupsApi.getDSGroups(organizationId, accountId); // Step 4 end @@ -92,14 +97,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { // Create a users api instance - UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); - - // Collect ids needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = GetExistingAccountIdService.getExistingAccountId( - createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), - config.getSignerEmail(), - organizationId); + UsersApi usersApi = createUsersApi(accessToken, basePath); AddUserResponse result = CreateActiveCLMESignUserService.createNewActiveUser( args.getClmProfileId(), diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 910c7134..9a0df04c 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -39,9 +39,11 @@ public A003BulkExportUserData(DSConfiguration config, Session session, User user @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + String accessToken = this.user.getAccessToken(); + String basePath = this.session.getBasePath(); // Step 3 start - BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + BulkExportsApi bulkExportsApi = createBulkExportsApi(accessToken, basePath); + UUID organizationId = this.getOrganizationId(accessToken, basePath); OrganizationExportResponse bulkList = BulkExportUserDataService.createUserListExport( bulkExportsApi, @@ -57,7 +59,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String saveFilePath = BulkExportUserDataService.moveUserListExportToFile( csvUri, BEARER_AUTHENTICATION, - user.getAccessToken(), + accessToken, BUFFER_SIZE); OrganizationExportsResponse results = BulkExportUserDataService.bulkExportsUserData( diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index f102e4b1..e59831d6 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -44,9 +44,11 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + String accessToken = this.user.getAccessToken(); + String basePath = this.session.getBasePath(); // Create a bulk exports api instance - BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + BulkExportsApi bulkExportsApi = createBulkExportsApi(accessToken, basePath); + UUID organizationId = this.getOrganizationId(accessToken, basePath); UUID exportId = UUID.fromString(this.session.getExportId()); OrganizationExportResponse result = CheckRequestStatusService.checkRequestStatus( diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 157aa939..10a7e964 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -38,13 +38,15 @@ public A004BulkImportUserData(DSConfiguration config, Session session, User user @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + String accessToken = this.user.getAccessToken(); + String basePath = this.session.getBasePath(); // Collect ids and user data needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID organizationId = this.getOrganizationId(accessToken, basePath); UUID accountId = GetExistingAccountIdService.getExistingAccountId( - createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + createUsersApi(accessToken, basePath), config.getSignerEmail(), organizationId); - BulkImportsApi bulkImportsApi = createBulkImportsApi(this.user.getAccessToken(), this.session.getBasePath()); + BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, basePath); OrganizationImportResponse result = BulkImportUserDataService .bulkImportUserData(bulkImportsApi, organizationId, accountId); diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index 48e708f5..7b4f4f04 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -53,12 +53,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return new RedirectView("a004"); } + String accessToken = this.user.getAccessToken(); + String basePath = this.session.getBasePath(); + // Create a bulk exports api instance - BulkImportsApi bulkImportsApi = createBulkImportsApi(this.user.getAccessToken(), this.session.getBasePath()); + BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, basePath); OrganizationImportResponse result = CheckImportRequestStatusService.checkRequestStatus( bulkImportsApi, - this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), + this.getOrganizationId(accessToken, basePath), UUID.fromString(this.session.getImportId()) ); diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 594a2ca4..9ab957e7 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -38,14 +38,16 @@ public A005AuditUsers(DSConfiguration config, Session session, User user) { @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + String accessToken = this.user.getAccessToken(); + String basePath = this.session.getBasePath(); // Collect ids needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID organizationId = this.getOrganizationId(accessToken, basePath); UUID accountId = GetExistingAccountIdService.getExistingAccountId( - createUsersApi(this.user.getAccessToken(), this.session.getBasePath()), + createUsersApi(accessToken, basePath), config.getSignerEmail(), organizationId); - UsersApi adminApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + UsersApi adminApi = createUsersApi(accessToken, basePath); ArrayList resultsArr = AuditUsersService.auditUsers(adminApi, organizationId, accountId); diff --git a/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java b/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java index 3bc6a00e..d102fd0e 100644 --- a/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java +++ b/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java @@ -46,7 +46,7 @@ private static NewUserResponse createNewActiveUser( groups.add(new GroupRequest().id(Long.valueOf(groupId))); // Fill the request with data from the form - NewUserRequest accountUserRequest = new NewUserRequest() + NewUserRequest userRequest = new NewUserRequest() .defaultAccountId(accountId) .addAccountsItem( new NewUserRequestAccountProperties() @@ -65,7 +65,7 @@ private static NewUserResponse createNewActiveUser( // Step 5 end // Step 6 start - return usersApi.createUser(organizationId, accountUserRequest); + return usersApi.createUser(organizationId, userRequest); // Step 6 end } } diff --git a/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java b/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java index f5816049..1098bbc6 100644 --- a/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java +++ b/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java @@ -36,7 +36,7 @@ public static AddUserResponse createNewActiveUser( dsGroup.setDsGroupId(dsGroupId); // Fill the request with data from the form - NewMultiProductUserAddRequest accountAddRequest = new NewMultiProductUserAddRequest() + NewMultiProductUserAddRequest multiProductUserAddRequest = new NewMultiProductUserAddRequest() .defaultAccountId(accountId) .addProductPermissionProfilesItem(clm) .addProductPermissionProfilesItem(eSign) @@ -49,7 +49,7 @@ public static AddUserResponse createNewActiveUser( // Step 5 end // Step 6 start - return usersApi.addOrUpdateUser(organizationId, accountId, accountAddRequest); + return usersApi.addOrUpdateUser(organizationId, accountId, multiProductUserAddRequest); // Step 6 end } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index 6d6c3718..80c6687b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -56,17 +56,17 @@ protected Object doWork(WorkArguments args, ModelMap model, args.getStatus(), args ); - EnvelopeSummary results = SigningViaEmailService.signingViaEmail( + EnvelopeSummary envelopeSummary = SigningViaEmailService.signingViaEmail( envelopesApi, session.getAccountId(), envelope); // process results - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") - .withJsonObject(results) + + envelopeSummary.getEnvelopeId() + ".") + .withJsonObject(envelopeSummary) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java index 0819f959..8e06f624 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java @@ -56,7 +56,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. List the envelope's documents - EnvelopeDocumentsResult result = EnvelopeDocsService.envelopeDocs( + EnvelopeDocumentsResult envelopeDocumentsResult = EnvelopeDocsService.envelopeDocs( envelopesApi, session.getAccountId(), session.getEnvelopeId()); @@ -69,7 +69,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopeDocItems.add(new EnvelopeDocumentInfo("Combined", "content", "combined")); envelopeDocItems.add(new EnvelopeDocumentInfo("Zip archive", "zip", "archive")); - for (EnvelopeDocument doc : result.getEnvelopeDocuments()) { + for (EnvelopeDocument doc : envelopeDocumentsResult.getEnvelopeDocuments()) { String documentName = doc.getName(); if (StringUtils.equals(doc.getDocumentId(), "certificate")) { documentName = "Certificate of completion"; @@ -78,7 +78,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse } DoneExample.createDefault(title) - .withJsonObject(result) + .withJsonObject(envelopeDocumentsResult) .withMessage("Results from the EnvelopeDocuments::list method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index 3a0edea0..9a3a4277 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -77,7 +77,7 @@ protected Object doWork(WorkArguments args, ModelMap model, // Exceptions will be caught by the calling function String documentId = args.getDocSelect(); // Step 3 start - byte[] results = EnvelopeGetDocService.envelopeGetDoc( + byte[] envelopeDocument = EnvelopeGetDocService.envelopeGetDoc( envelopesApi, session.getAccountId(), session.getEnvelopeId(), @@ -99,9 +99,9 @@ protected Object doWork(WorkArguments args, ModelMap model, } response.setContentType(URLConnection.guessContentTypeFromName(docName)); - response.setContentLength(results.length); + response.setContentLength(envelopeDocument.length); response.setHeader(HttpHeaders.CONTENT_DISPOSITION, HTTP_CONTENT_DISPOSITION_VALUE + docName); - response.getOutputStream().write(results); + response.getOutputStream().write(envelopeDocument); response.flushBuffer(); return null; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index 3a88e930..045ae00c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -47,14 +47,14 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 1. list existing templates ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); String accountId = session.getAccountId(); - EnvelopeTemplateResults results = CreateTemplateService.searchTemplatesByName( + EnvelopeTemplateResults envelopeTemplateResults = CreateTemplateService.searchTemplatesByName( apiClient, accountId, TEMPLATE_NAME); // Step 2. Process results. If template do not exist, create one - if (Integer.parseInt(results.getResultSetSize()) > 0) { - EnvelopeTemplate template = results.getEnvelopeTemplates().get(0); + if (Integer.parseInt(envelopeTemplateResults.getResultSetSize()) > 0) { + EnvelopeTemplate template = envelopeTemplateResults.getEnvelopeTemplates().get(0); DoneExample.createDefault(title) .withMessage(String.format( "The template already exists in your account.
Template name: %s, ID %s.", diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index a6a355d9..050313a7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -65,16 +65,16 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getCcName(), args.getTemplateId() ); - EnvelopeSummary result = UseTemplateService.createEnvelopeTemplate( + EnvelopeSummary envelopeSummary = UseTemplateService.createEnvelopeTemplate( envelopesApi, session.getAccountId(), envelope); - session.setEnvelopeId(result.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(result) + .withJsonObject(envelopeSummary) .withMessage("The envelope has been created and sent!
Envelope ID " - + result.getEnvelopeId() + ".") + + envelopeSummary.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index 9b874b68..e3edb1cb 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -47,7 +47,7 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. Make the envelope with "created" (draft) status - EnvelopeSummary results = EmbeddedSendingService.createEnvelopeWithDraftStatus( + EnvelopeSummary envelopeSummary = EmbeddedSendingService.createEnvelopeWithDraftStatus( envelopesApi, args.getSignerEmail(), args.getSignerName(), @@ -56,7 +56,7 @@ protected Object doWork(WorkArguments args, ModelMap model, args.getStatus(), args, accountId); - String envelopeId = results.getEnvelopeId(); + String envelopeId = envelopeSummary.getEnvelopeId(); // Step 2. Create the sender view. // Set the url where you want the recipient to go once they are done diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 458594fd..d81e13ea 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -73,11 +73,11 @@ protected Object doWork(WorkArguments args, ModelMap model, args); // Step 2. call Envelopes::create API method - EnvelopeSummary results = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); + EnvelopeSummary envelopeSummary = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); DoneExample.createDefault(title) .withMessage(String.join("", "The envelope has been created and sent!
Envelope ID ", - results.getEnvelopeId(), ".")) + envelopeSummary.getEnvelopeId(), ".")) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index 3069d7e1..93a235d5 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -19,7 +19,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; - @Controller @RequestMapping("/eg017") public class EG017ControllerSetTemplateTabValues extends AbstractEsignatureController { @@ -55,7 +54,6 @@ protected Object doWork(WorkArguments args, ModelMap model, String ccEmail = args.getCcEmail(); String templateId = args.getTemplateId(); - // Step 2. Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index fbec717b..c37b030f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -52,15 +52,15 @@ protected Object doWork(WorkArguments args, ModelMap model, ); // Step 3: Call the eSignature REST API - EnvelopeSummary results = AccessCodeAuthenticationService.accessCodeAuthentication( + EnvelopeSummary envelopeSummary = AccessCodeAuthenticationService.accessCodeAuthentication( envelopesApi, session.getAccountId(), envelope ); - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage("The envelope has been created and sent!
Envelope ID " + session.getEnvelopeId() + ".") .addToModel(model); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index fc038ffd..c9b2f5e8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -55,14 +55,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getPhoneNumber()); // Step 3: Call the eSignature REST API - EnvelopeSummary results = PhoneAuthenticationService.phoneAuthentication( + EnvelopeSummary envelopeSummary = PhoneAuthenticationService.phoneAuthentication( envelopesApi, - session.getAccountId(), + accountId, envelope ); - session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(title).withJsonObject(results) + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); + DoneExample.createDefault(title).withJsonObject(envelopeSummary) .withMessage( "The envelope has been created and sent!
Envelope ID " + results.getEnvelopeId() + ".") .addToModel(model); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index da3cc755..9a203b82 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -49,17 +49,17 @@ protected Object doWork(WorkArguments args, ModelMap model, args.getSignerEmail()); // Step 3: Call the eSignature REST API - EnvelopeSummary results = KBAAuthenticationService.kbaAuthentication( + EnvelopeSummary envelopeSummary = KBAAuthenticationService.kbaAuthentication( envelopesApi, session.getAccountId(), envelope ); - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") + + envelopeSummary.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index 00c0ef03..a8c520cc 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -57,17 +57,17 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getSignerEmail(), workflowId); // Step 4: Create envelope - EnvelopeSummary results = IdvAuthenticationService.idvAuthentication( + EnvelopeSummary envelopeSummary = IdvAuthenticationService.idvAuthentication( envelopesApi, session.getAccountId(), envelope ); - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") + + envelopeSummary.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index c16d2ff6..3068cf2b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -53,19 +53,18 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse ); // Step 4: Call the eSignature REST API - EnvelopeSummary results = PauseSignatureWorkflowService.pauseSignatureWorkflow( + EnvelopeSummary envelopeSummary = PauseSignatureWorkflowService.pauseSignatureWorkflow( envelopesApi, this.session.getAccountId(), envelope ); - this.session.setEnvelopeId(results.getEnvelopeId()); + this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage( "The envelope where the workflow is paused before the envelope is sent to a second recipient " + - "has been created and sent!
Envelope ID " - + this.session.getEnvelopeId() + ".") + "has been created and sent!
Envelope ID " + this.session.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java index 2f906399..29ab8fcd 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java @@ -30,7 +30,6 @@ public static ViewUrl addDocumentToTemplate( String dsPingUrl, WorkArguments args ) throws ApiException, IOException { - // Step 2 start EnvelopeDefinition envelope = AddDocToTemplateService.makeEnvelope( signerEmail, signerName, @@ -40,10 +39,9 @@ public static ViewUrl addDocumentToTemplate( templateId, args ); - // Step 2 end // Step 3 start - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); // Step 3 end // Step 4 start @@ -54,7 +52,7 @@ public static ViewUrl addDocumentToTemplate( signerClientId, dsPingUrl ); - return envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); + return envelopesApi.createRecipientView(accountId, envelopeSummary.getEnvelopeId(), viewRequest); } private static RecipientViewRequest makeRecipientViewRequest( @@ -139,11 +137,11 @@ private static EnvelopeDefinition makeEnvelope( compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, DocumentType.HTML.getDefaultFileExtention(), "1")); - EnvelopeDefinition env = new EnvelopeDefinition(); - env.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - env.setCompositeTemplates(Arrays.asList(compTemplate1, compTemplate2)); + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelopeDefinition.setCompositeTemplates(Arrays.asList(compTemplate1, compTemplate2)); - return env; + return envelopeDefinition; } // Adding clientUserId transforms the template recipient into an embedded recipient diff --git a/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java index 22630b64..5934e43a 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java @@ -38,12 +38,13 @@ public static Optional findProfile(List pr // will be read from the page or in a different way private static AccountRoleSettings changeRandomSettings(AccountRoleSettings settings) { Gson gson = new Gson(); + String signingUiVersion = "1"; // Change this value back to: gson.fromJson(gson.toJson(settings), // AccountRoleSettings.class); // as soon as the signinguiversion is added back to the swagger spec. // Also change the type back from AccountRoleSettingsPatch to AccountRoleSettings AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); - newSettings.signingUiVersion("1"); + newSettings.signingUiVersion(signingUiVersion); Random random = new Random(System.currentTimeMillis()); return newSettings.canCreateWorkspaces(randomBool(random)).allowEnvelopeSending(randomBool(random)) diff --git a/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java index 65b5703f..904d7774 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java @@ -17,9 +17,10 @@ public static PermissionProfile createNewProfile( // Step 3. Construct your request body // We're extending the AccountSettings class with AccountSettingsPatch to include the signingUIVersion which is missing in the swagger spec at this time. Gson gson = new Gson(); + String signingUiVersion = "1"; AccountRoleSettings settings = DsModelUtils.createDefaultRoleSettings(); AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); - newSettings.signingUiVersion("1"); + newSettings.signingUiVersion(signingUiVersion); PermissionProfile profile = new PermissionProfile() .permissionProfileName(permissionProfileName) .settings(newSettings); diff --git a/src/main/java/com/docusign/core/model/Locals.java b/src/main/java/com/docusign/core/model/Locals.java index 61b83539..0acd00e0 100644 --- a/src/main/java/com/docusign/core/model/Locals.java +++ b/src/main/java/com/docusign/core/model/Locals.java @@ -4,7 +4,6 @@ import lombok.Data; import com.docusign.DSConfiguration; - @Data @AllArgsConstructor public class Locals { From 141df75e178a6ec6275cd27e983dde785568807c Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 3 Nov 2021 12:53:42 +0200 Subject: [PATCH 224/699] Moved magic number to separate variable with self-explanatory name --- .../docusign/controller/admin/services/AuditUsersService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java index 6ade0f1d..138e3f37 100644 --- a/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java +++ b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java @@ -31,7 +31,8 @@ public static ArrayList auditUsers( SimpleDateFormat df = new SimpleDateFormat(simpleDateFormat); // Quoted "Z" to indicate UTC, no timezone offset df.setTimeZone(tz); - String nowAsISO = df.format(new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * 10))); + Integer tenDaysBeforeToday = 1000 * 60 * 60 * 24 * 10; + String nowAsISO = df.format(new Date(System.currentTimeMillis() - tenDaysBeforeToday)); options.setLastModifiedSince(nowAsISO); OrganizationUsersResponse modifiedUsers = usersApi.getUsers(organizationId, options); // Step 3 end From 492477b882f3c6276b350194708683b592ee8946 Mon Sep 17 00:00:00 2001 From: annahileta Date: Thu, 4 Nov 2021 09:56:48 +0200 Subject: [PATCH 225/699] changed result to self-explanatory namings --- .../controller/admin/examples/A001AddActiveUser.java | 4 ++-- .../admin/examples/A002CreateActiveCLMESignUser.java | 4 ++-- .../controller/admin/examples/A003BulkExportUserData.java | 4 ++-- .../admin/examples/A003aCheckRequestStatus.java | 4 ++-- .../controller/admin/examples/A004BulkImportUserData.java | 6 +++--- .../admin/examples/A004CheckImportRequestStatus.java | 6 +++--- .../controller/admin/examples/A005AuditUsers.java | 4 ++-- .../controller/admin/services/AuditUsersService.java | 6 +++--- .../examples/EG020ControllerPhoneAuthentication.java | 2 +- .../examples/EG033ControllerUnpauseSignatureWorkflow.java | 4 ++-- .../examples/EG034ControllerUseConditionalRecipients.java | 6 +++--- .../eSignature/examples/EG035ControllerSMSDelivery.java | 8 ++++---- .../monitor/examples/M001GetMonitoringData.java | 6 +++--- .../monitor/services/GetMonitoringDataService.java | 6 +++--- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index 658244ea..46378c93 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -77,7 +77,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - NewUserResponse result = AddActiveUserService.addActiveUser( + NewUserResponse userResponse = AddActiveUserService.addActiveUser( args.getGroupId(), args.getProfileId(), args.getEmail(), @@ -91,7 +91,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample.createDefault(title) .withMessage("Results from eSignUserManagement:createUser method:") - .withJsonObject(result) + .withJsonObject(userResponse) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 088be68f..6ddcafd0 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -99,7 +99,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Create a users api instance UsersApi usersApi = createUsersApi(accessToken, basePath); - AddUserResponse result = CreateActiveCLMESignUserService.createNewActiveUser( + AddUserResponse userResponse = CreateActiveCLMESignUserService.createNewActiveUser( args.getClmProfileId(), args.getClmProductId(), args.getESignProfileId(), @@ -116,7 +116,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample.createDefault(title) .withMessage("Results from MultiProductUserManagement:addOrUpdateUser method:") - .withJsonObject(result) + .withJsonObject(userResponse) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 9a0df04c..204508d5 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -62,13 +62,13 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse accessToken, BUFFER_SIZE); - OrganizationExportsResponse results = BulkExportUserDataService.bulkExportsUserData( + OrganizationExportsResponse exportResponse = BulkExportUserDataService.bulkExportsUserData( bulkExportsApi, organizationId); // Process results DoneExample.createDefault(title) .withMessage("User data exported to " + saveFilePath + "
from UserExport:getUserListExport method:") - .withJsonObject(results).addToModel(model); + .withJsonObject(exportResponse).addToModel(model); return DONE_EXAMPLE_PAGE; } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index e59831d6..dfc38a2d 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -51,7 +51,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse UUID organizationId = this.getOrganizationId(accessToken, basePath); UUID exportId = UUID.fromString(this.session.getExportId()); - OrganizationExportResponse result = CheckRequestStatusService.checkRequestStatus( + OrganizationExportResponse exportResponse = CheckRequestStatusService.checkRequestStatus( bulkExportsApi, organizationId, exportId); @@ -59,7 +59,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample.createDefault(title) .withMessage("Admin API data response output:") - .withJsonObject(result) + .withJsonObject(exportResponse) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 10a7e964..72e42c3c 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -48,15 +48,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse organizationId); BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, basePath); - OrganizationImportResponse result = BulkImportUserDataService + OrganizationImportResponse importResponse = BulkImportUserDataService .bulkImportUserData(bulkImportsApi, organizationId, accountId); - this.session.setImportId(result.getId().toString()); + this.session.setImportId(importResponse.getId().toString()); // Process results DoneExample.createDefault(title) .withMessage("Results from UserImport:addBulkUserImport method:") - .withJsonObject(result) + .withJsonObject(importResponse) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index 7b4f4f04..31969b51 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -59,13 +59,13 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Create a bulk exports api instance BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, basePath); - OrganizationImportResponse result = CheckImportRequestStatusService.checkRequestStatus( + OrganizationImportResponse importResponse = CheckImportRequestStatusService.checkRequestStatus( bulkImportsApi, this.getOrganizationId(accessToken, basePath), UUID.fromString(this.session.getImportId()) ); - if (result.getStatus().equals("queued")){ + if (importResponse.getStatus().equals("queued")){ // Return the refresh page DoneExample.createDefault("Request not complete") .withMessage("The request has not completed, please refresh this page") @@ -80,7 +80,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample.createDefault(title) .withMessage("Admin API data response output:") - .withJsonObject(result) + .withJsonObject(importResponse) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 9ab957e7..dfd35251 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -49,11 +49,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse UsersApi adminApi = createUsersApi(accessToken, basePath); - ArrayList resultsArr = AuditUsersService.auditUsers(adminApi, organizationId, accountId); + ArrayList auditedUsers = AuditUsersService.auditUsers(adminApi, organizationId, accountId); // Process results DoneExample.createDefault(title).withMessage("Results from eSignUserManagement:getUserProfiles method:") - .withJsonObject(resultsArr).addToModel(model); + .withJsonObject(auditedUsers).addToModel(model); return DONE_EXAMPLE_PAGE; } } diff --git a/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java index 138e3f37..5c0e5208 100644 --- a/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java +++ b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java @@ -22,7 +22,7 @@ public static ArrayList auditUsers( UUID organizationId, UUID accountId ) throws ApiException { - ArrayList resultsArr = new ArrayList<>(); + ArrayList auditedUsers = new ArrayList<>(); // Step 3 start UsersApi.GetUsersOptions options = usersApi.new GetUsersOptions(); @@ -42,10 +42,10 @@ public static ArrayList auditUsers( UsersApi.GetUserProfilesOptions profilesOptions = usersApi.new GetUserProfilesOptions(); profilesOptions.setEmail(user.getEmail()); UsersDrilldownResponse res = usersApi.getUserProfiles(organizationId, profilesOptions); - resultsArr.add(res.getUsers().get(0)); + auditedUsers.add(res.getUsers().get(0)); } // Step 5 end - return resultsArr; + return auditedUsers; } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index c9b2f5e8..1c2b2860 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -64,7 +64,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title).withJsonObject(envelopeSummary) .withMessage( - "The envelope has been created and sent!
Envelope ID " + results.getEnvelopeId() + ".") + "The envelope has been created and sent!
Envelope ID " + envelopeSummary.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index 5732e8ee..7276cdc8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -41,14 +41,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeUpdateSummary results = UnpauseSignatureWorkflowService.unpauseSignatureWorkflow( + EnvelopeUpdateSummary envelopeUpdateSummary = UnpauseSignatureWorkflowService.unpauseSignatureWorkflow( envelopesApi, this.session.getAccountId(), this.session.getEnvelopeId() ); DoneExample.createDefault(this.title) - .withJsonObject(results) + .withJsonObject(envelopeUpdateSummary) .withMessage("A paused envelope was resumed.") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index ce310082..4657b8ce 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -57,15 +57,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 4: Call the eSignature REST API try { - EnvelopeSummary results = UseConditionalRecipientsService.useConditionalRecipients( + EnvelopeSummary envelopeSummary = UseConditionalRecipientsService.useConditionalRecipients( envelopesApi, this.session.getAccountId(), envelope ); - this.session.setEnvelopeId(results.getEnvelopeId()); + this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage( "An envelope where the workflow is routed to different recipients based on the value of a transaction " + "has been created and sent!
Envelope ID " diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java index d882b4e2..fc828787 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java @@ -59,18 +59,18 @@ protected Object doWork(WorkArguments args, ModelMap model, args.getStatus(), args ); - EnvelopeSummary results = SMSDeliveryService.smsDelivery( + EnvelopeSummary envelopeSummary = SMSDeliveryService.smsDelivery( envelopesApi, session.getAccountId(), envelope ); // process results - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") - .withJsonObject(results) + + envelopeSummary.getEnvelopeId() + ".") + .withJsonObject(envelopeSummary) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 8608eb53..03873f7e 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -41,15 +41,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse accessToken = ensureUsageOfJWTToken(accessToken, this.session); // step 1 end - JSONArray result = GetMonitoringDataService.getMonitoringData(createDataSetApi(accessToken, this.session)); + JSONArray monitoringData = GetMonitoringDataService.getMonitoringData(createDataSetApi(accessToken, this.session)); // Cleaning the data from wrong symbols - String resultCleaned = result.toString().replaceAll("'", ""); + String monitoringDataCleaned = monitoringData.toString().replaceAll("'", ""); // Process results DoneExample.createDefault(title) .withMessage("Results from DataSet:getStream method:") - .withJsonObject(resultCleaned) + .withJsonObject(monitoringDataCleaned) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java index 9bd50bab..a5a29530 100644 --- a/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java +++ b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java @@ -10,7 +10,7 @@ public static JSONArray getMonitoringData(DataSetApi datasetApi) throws Exceptio // Declare variables boolean complete = false; String cursorValue = ""; - JSONArray result = new JSONArray(); + JSONArray monitoringData = new JSONArray(); DataSetApi.GetStreamOptions options = datasetApi.new GetStreamOptions(); @@ -36,11 +36,11 @@ public static JSONArray getMonitoringData(DataSetApi datasetApi) throws Exceptio else { cursorValue = endCursor; - result.put(new JSONObject(cursoredResult)); + monitoringData.put(new JSONObject(cursoredResult)); } } while (!complete); - return result; + return monitoringData; } } From c9f6a0510b916155937ab66f90c38dd02dd7f3c9 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Fri, 19 Nov 2021 15:59:06 -0800 Subject: [PATCH 226/699] Updated Step 3 to 4, Step 4 to 5 numbering --- .../examples/EG020ControllerPhoneAuthentication.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index f3282bf5..9b5d8e9b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -58,15 +58,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2 end - // Step 3a start + // Step 4a start String workFlowId = getWorkflowId(accountId); EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), args.getPhoneNumber(), workFlowId); - // Step 3a end + // Step 4a end - // Step 4 start + // Step 5 start EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - // Step 4 end + // Step 5 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title).withJsonObject(results) @@ -77,7 +77,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - // Step 3b start + // Step 4b start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, String phone, String workFlowId) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); @@ -154,5 +154,5 @@ private String getWorkflowId(String accountId) { } } - // Step 3b end + // Step 4b end } From d9eff5cdb22864423e4d649b190287514b2f4d3f Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 14:28:05 -0800 Subject: [PATCH 227/699] added JDK, Maven instructions --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e87f1c54..0d254a94 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,9 @@ For a list of code examples that use the Admin API, select the Java tab under [E where {base_url} is the URL for the web app. -1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later -1. [Maven](https://maven.apache.org/download.cgi) +1. Download [JDK 11](https://jdk.java.net/java-se-ri/11) or later and extract to C:\Program Files\Java +1. Download [Maven](https://maven.apache.org/download.cgi) and extract to C: + 1. Follow these [instructions](https://maven.apache.org/install.html) to add both JDK and Maven to the `PATH` environment variable ### Installation steps From 310c7bd7f4392c9f6bc36bb0eb31b65f81f7b1bb Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 14:29:55 -0800 Subject: [PATCH 228/699] remove comma --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d254a94..a079759f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ### GitHub repo: [code-examples-java](./README.md) -This GitHub repo includes code examples for the DocuSign Admin API, Click API, eSignature REST API, Monitor API, and Rooms API. To switch between API code examples, in the application.json file, modify the `DS_API_NAME` setting from `ESIGNATURE` to `ADMIN`, `CLICK`, `MONITOR`, or `ROOMS`, . +This GitHub repo includes code examples for the DocuSign Admin API, Click API, eSignature REST API, Monitor API, and Rooms API. To switch between API code examples, in the application.json file, modify the `DS_API_NAME` setting from `ESIGNATURE` to `ADMIN`, `CLICK`, `MONITOR`, or `ROOMS`. ## Introduction From e5ad3d669d660af330e1fb32899037496ae11ac8 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 14:31:20 -0800 Subject: [PATCH 229/699] sub bullet --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a079759f..4b653811 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ For a list of code examples that use the Admin API, select the Java tab under [E 1. Download [JDK 11](https://jdk.java.net/java-se-ri/11) or later and extract to C:\Program Files\Java 1. Download [Maven](https://maven.apache.org/download.cgi) and extract to C: - 1. Follow these [instructions](https://maven.apache.org/install.html) to add both JDK and Maven to the `PATH` environment variable + * Follow these [instructions](https://maven.apache.org/install.html) to add both JDK and Maven to the `PATH` environment variable ### Installation steps From 52a9f3f2f4a31cf5476d8408b91a3415cdd19c15 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:01:40 -0800 Subject: [PATCH 230/699] java --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4b653811..a0baf9b6 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ For a list of code examples that use the Admin API, select the Java tab under [E 1. Download [JDK 11](https://jdk.java.net/java-se-ri/11) or later and extract to C:\Program Files\Java 1. Download [Maven](https://maven.apache.org/download.cgi) and extract to C: - * Follow these [instructions](https://maven.apache.org/install.html) to add both JDK and Maven to the `PATH` environment variable + * Follow these [instructions](https://maven.apache.org/install.html) to add both Java and Maven to the `PATH` environment variable ### Installation steps From bd5c5d0d18a23e085f1494d55a2070f77c9074b2 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:02:25 -0800 Subject: [PATCH 231/699] synced with updated java-private README --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e87f1c54..a0baf9b6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ### GitHub repo: [code-examples-java](./README.md) -This GitHub repo includes code examples for the DocuSign Admin API, Click API, eSignature REST API, Monitor API, and Rooms API. To switch between API code examples, in the application.json file, modify the `DS_API_NAME` setting from `ESIGNATURE` to `ADMIN`, `CLICK`, `MONITOR`, or `ROOMS`, . +This GitHub repo includes code examples for the DocuSign Admin API, Click API, eSignature REST API, Monitor API, and Rooms API. To switch between API code examples, in the application.json file, modify the `DS_API_NAME` setting from `ESIGNATURE` to `ADMIN`, `CLICK`, `MONITOR`, or `ROOMS`. ## Introduction @@ -87,8 +87,9 @@ For a list of code examples that use the Admin API, select the Java tab under [E where {base_url} is the URL for the web app. -1. [JDK 11](https://jdk.java.net/java-se-ri/11) or later -1. [Maven](https://maven.apache.org/download.cgi) +1. Download [JDK 11](https://jdk.java.net/java-se-ri/11) or later and extract to C:\Program Files\Java +1. Download [Maven](https://maven.apache.org/download.cgi) and extract to C: + * Follow these [instructions](https://maven.apache.org/install.html) to add both Java and Maven to the `PATH` environment variable ### Installation steps From 2b4c2c02c56770f3e6eab1972a41fb6d51989d03 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:09:56 -0800 Subject: [PATCH 232/699] add Git Bash --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index a0baf9b6..72c21352 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ For a list of code examples that use the Admin API, select the Java tab under [E 1. Download [JDK 11](https://jdk.java.net/java-se-ri/11) or later and extract to C:\Program Files\Java 1. Download [Maven](https://maven.apache.org/download.cgi) and extract to C: * Follow these [instructions](https://maven.apache.org/install.html) to add both Java and Maven to the `PATH` environment variable +1. [Git Bash command line](https://gitforwindows.org/), macOS Terminal, or Linux shell ### Installation steps From d5d070f1d43d8e3c4addccd8ec25a23edbb7a6d7 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:25:26 -0800 Subject: [PATCH 233/699] add period --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72c21352..fe3c78fa 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ For a list of code examples that use the Admin API, select the Java tab under [E 1. Download [JDK 11](https://jdk.java.net/java-se-ri/11) or later and extract to C:\Program Files\Java 1. Download [Maven](https://maven.apache.org/download.cgi) and extract to C: - * Follow these [instructions](https://maven.apache.org/install.html) to add both Java and Maven to the `PATH` environment variable + * Follow these [instructions](https://maven.apache.org/install.html) to add both Java and Maven to the `PATH` environment variable. 1. [Git Bash command line](https://gitforwindows.org/), macOS Terminal, or Linux shell From 0ae9a67e86b1b6d11f606cbcc0ae936b9bb0d489 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:26:03 -0800 Subject: [PATCH 234/699] sync with private repo --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a0baf9b6..fe3c78fa 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,8 @@ For a list of code examples that use the Admin API, select the Java tab under [E 1. Download [JDK 11](https://jdk.java.net/java-se-ri/11) or later and extract to C:\Program Files\Java 1. Download [Maven](https://maven.apache.org/download.cgi) and extract to C: - * Follow these [instructions](https://maven.apache.org/install.html) to add both Java and Maven to the `PATH` environment variable + * Follow these [instructions](https://maven.apache.org/install.html) to add both Java and Maven to the `PATH` environment variable. +1. [Git Bash command line](https://gitforwindows.org/), macOS Terminal, or Linux shell ### Installation steps From b91961a553642bc05a783078859886396ac272e6 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 23 Nov 2021 12:22:33 -0800 Subject: [PATCH 235/699] DEVDOCS-6123 - IDV checks for WorkflowID the right way and complains about not having IDV the same way, adding correct step comments --- .../EG023ControllerIdvAuthentication.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index f7d4a21c..5be7f8cd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -54,22 +54,34 @@ public EG023ControllerIdvAuthentication(DSConfiguration config, Session session, @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - // Step 1: Construct your API headers + // Step 2 start ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + // Step 2 end EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - //Step 2: Retrieve the workflow ID + // Step 3 start AccountsApi workflowDetails = new AccountsApi(apiClient); AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); List identityVerification = workflowRes.getIdentityVerification(); - if (identityVerification == null || identityVerification.isEmpty()) { - throw new ApiException("Error. Cant get AccountIdentityVerificationWorkflow"); + String workflowId = ""; + for (int i = 0; i < identityVerification.size(); i++) + { + if (identityVerification.get(i).getDefaultName().equals("DocuSign ID Verification")) + { + workflowId = identityVerification.get(i).getWorkflowId(); + } } - String workflowId = identityVerification.get(0).getWorkflowId(); logger.info("workflowId = " + workflowId); - // Step 3: Construct your envelope JSON body + // Step 3 end + if (workflowId.equals("")) + { + throw new ApiException(0, "Please contact DocuSign Support to enable IDV in your account."); + } + // Step 4.1 start EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); - // Step 4: Create envelope + // Step 4.1 end + // Step 5 start EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + // step 5 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -81,6 +93,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } + // Step 4.2 start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String workflowId) { EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); @@ -135,4 +148,5 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe envelopeDefinition.setDocuments(Collections.singletonList(doc1)); return envelopeDefinition; } + // Step 4.2 end } From ca9bfc4d7f58d103b7e01a78504b4252d28f45e2 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 30 Nov 2021 10:48:48 -0800 Subject: [PATCH 236/699] Fixing location of SignHere tab --- .../eSignature/examples/EG023ControllerIdvAuthentication.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index 5be7f8cd..cc0e8977 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -116,8 +116,8 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe SignHere signHere1 = new SignHere(); signHere1.setName("SignHereTab"); - signHere1.setXPosition("75"); - signHere1.setYPosition("572"); + signHere1.setXPosition("200"); + signHere1.setYPosition("160"); signHere1.setTabLabel("SignHereTab"); signHere1.setPageNumber("1"); signHere1.setDocumentId("1"); From 7759d78f55c03dfccdeda7f4fd3e02166f7ad80d Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:27:50 -0800 Subject: [PATCH 237/699] synced eSign19-23 with Code example launchers page --- .../templates/views/pages/esignature/index.jsp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 22332843..1447d071 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -194,26 +194,26 @@

Recipient authentication

-

19. Send an envelope with Access Code Authentication

-

This example sends and envelope that requires an access-code for the purpose of multi-factor authentication.

+

19. Require access code authentication for a recipient

+

Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

API method used: Envelopes::create.

-

20. Require Phone Authentication for a Recipient

+

20. Require phone authentication for a recipient

Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

API method used: Envelopes::create.

-

22. Send an envelope with Knowledge-Based Authentication

-

This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multifactor authentication.

+

22. Require knowledge-based authentication (KBA) for a recipient

+

Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

API method used: Envelopes::create.

-

23. Send an envelope with ID Verification Authentication

-

Submit an envelope that requires verification of a government issued identity.

+

23. Require ID verification (IDV) for a recipient

+

Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

API method used: Envelopes::create. @@ -222,10 +222,6 @@

Permissions

24. Create a new permission profile

- -

- Creating new permission profile. -

API method used: AccountPermissionProfiles::create. From cbebb9c95812a10ce794bd0d17b3011fc98cfe98 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Tue, 30 Nov 2021 11:29:00 -0800 Subject: [PATCH 238/699] updated step comments --- .../examples/EG023ControllerIdvAuthentication.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index cc0e8977..05f67568 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -76,12 +76,12 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse { throw new ApiException(0, "Please contact DocuSign Support to enable IDV in your account."); } - // Step 4.1 start + // Step 4-1 start EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); - // Step 4.1 end + // Step 4-1 end // Step 5 start EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); - // step 5 end + // Step 5 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -93,7 +93,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - // Step 4.2 start + // Step 4-2 start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String workflowId) { EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); @@ -148,5 +148,5 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe envelopeDefinition.setDocuments(Collections.singletonList(doc1)); return envelopeDefinition; } - // Step 4.2 end + // Step 4-2 end } From f80c181ecaa4cf69848803af9a5161c5572b1f8a Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 30 Nov 2021 15:28:43 -0800 Subject: [PATCH 239/699] DEVDOCS-6115 - Changes to phone auth to fetch the workflowID dynamically --- .../EG020ControllerPhoneAuthentication.java | 69 +++++++++---------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index f3282bf5..c30925ac 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -7,8 +7,10 @@ import com.docusign.core.model.User; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.AccountIdentityVerificationResponse; +import com.docusign.esign.model.AccountIdentityVerificationWorkflow; import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; @@ -18,13 +20,16 @@ import com.docusign.esign.model.Recipients; import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; + import java.io.IOException; import java.util.Arrays; +import java.util.List; import javax.servlet.http.HttpServletResponse; @@ -34,8 +39,8 @@ @Controller @RequestMapping("/eg020") public class EG020ControllerPhoneAuthentication extends AbstractEsignatureController { - // For List.of you could even do groups of numbers such as - // List.of("415-555-1212", "415-555-3434"); + + private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; private static final String DOCUMENT_NAME = "Lorem"; @@ -55,18 +60,29 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String accountId = session.getAccountId(); // Step 2 start - EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); // Step 2 end - - // Step 3a start - String workFlowId = getWorkflowId(accountId); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + + // Step 3 start + AccountsApi workflowDetails = new AccountsApi(apiClient); + AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); + List identityVerification = workflowRes.getIdentityVerification(); + String workflowId = ""; + for (int i = 0; i < identityVerification.size(); i++) + { + if (identityVerification.get(i).getDefaultName().equals("Phone Authentication")) + { + workflowId = identityVerification.get(i).getWorkflowId(); + } + } + logger.info("workflowId = " + workflowId); + // Step 3 end EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), - args.getPhoneNumber(), workFlowId); - // Step 3a end - - // Step 4 start + args.getPhoneNumber(), workflowId); + // Step 4.1 start EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - // Step 4 end + // Step 4.1 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title).withJsonObject(results) @@ -77,15 +93,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - // Step 3b start + // Step 4.2 start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, String phone, String workFlowId) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); + signHere.setXPosition("200"); + signHere.setYPosition("160"); signHere.setTabLabel("SignHereTab"); signHere.setPageNumber("1"); signHere.setDocumentId(doc.getDocumentId()); @@ -132,27 +148,6 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe return envelope; } + // Step 4.2 end - // retreives the workflow ID - private String getWorkflowId(String accountId) { - try { - AccountsApi workflowDetails = createAccountsApi(session.getBasePath(), user.getAccessToken()); - AccountIdentityVerificationResponse workflowResponse = workflowDetails - .getAccountIdentityVerification(accountId); - - // Check that idv authentication is enabled - // The workflow ID is a hard-coded value which is unique to this phone - // authentication workflow - if (workflowResponse.getIdentityVerification() != null) { - return "c368e411-1592-4001-a3df-dca94ac539ae"; - } else { - throw new RuntimeException("Identity Verification is not enabled for this account"); - } - - } catch (Exception e) { - return null; - } - - } - // Step 3b end } From 1e7bb6fe26e03ee3eacacde773dfe5a162aefa19 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 1 Dec 2021 13:58:27 -0800 Subject: [PATCH 240/699] Adding check for situation where account doesn't have phone auth. Fixing step 3 end comment so it doesn't include logger line --- .../EG020ControllerPhoneAuthentication.java | 9 ++++-- .../EG023ControllerIdvAuthentication.java | 32 +++++++++++++------ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index c30925ac..be93b3fd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -39,7 +39,7 @@ @Controller @RequestMapping("/eg020") public class EG020ControllerPhoneAuthentication extends AbstractEsignatureController { - + private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; private static final String DOCUMENT_NAME = "Lorem"; @@ -76,9 +76,12 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse workflowId = identityVerification.get(i).getWorkflowId(); } } - logger.info("workflowId = " + workflowId); // Step 3 end - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), + logger.info("workflowId = " + workflowId); + if (workflowId.equals("")) + { + throw new ApiException(0, "Please contact DocuSign Support to enable Phone Auth in your account."); + }EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), args.getPhoneNumber(), workflowId); // Step 4.1 start EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index f7d4a21c..caea8ead 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -54,22 +54,34 @@ public EG023ControllerIdvAuthentication(DSConfiguration config, Session session, @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - // Step 1: Construct your API headers + // Step 2 start ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + // Step 2 end EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - //Step 2: Retrieve the workflow ID + // Step 3 start AccountsApi workflowDetails = new AccountsApi(apiClient); AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); List identityVerification = workflowRes.getIdentityVerification(); - if (identityVerification == null || identityVerification.isEmpty()) { - throw new ApiException("Error. Cant get AccountIdentityVerificationWorkflow"); + String workflowId = ""; + for (int i = 0; i < identityVerification.size(); i++) + { + if (identityVerification.get(i).getDefaultName().equals("DocuSign ID Verification")) + { + workflowId = identityVerification.get(i).getWorkflowId(); + } } - String workflowId = identityVerification.get(0).getWorkflowId(); + // Step 3 end logger.info("workflowId = " + workflowId); - // Step 3: Construct your envelope JSON body + if (workflowId.equals("")) + { + throw new ApiException(0, "Please contact DocuSign Support to enable IDV in your account."); + } + // Step 4.1 start EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); - // Step 4: Create envelope + // Step 4.1 end + // Step 5 start EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + // step 5 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -81,6 +93,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } + // Step 4.2 start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String workflowId) { EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); @@ -103,8 +116,8 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe SignHere signHere1 = new SignHere(); signHere1.setName("SignHereTab"); - signHere1.setXPosition("75"); - signHere1.setYPosition("572"); + signHere1.setXPosition("200"); + signHere1.setYPosition("160"); signHere1.setTabLabel("SignHereTab"); signHere1.setPageNumber("1"); signHere1.setDocumentId("1"); @@ -135,4 +148,5 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe envelopeDefinition.setDocuments(Collections.singletonList(doc1)); return envelopeDefinition; } + // Step 4.2 end } From c1c30ebe134c4be623292f8fa1d33c2afd857374 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 1 Dec 2021 14:51:58 -0800 Subject: [PATCH 241/699] Updating to fix merge conflict --- .../examples/EG023ControllerIdvAuthentication.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index caea8ead..05f67568 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -70,18 +70,18 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse workflowId = identityVerification.get(i).getWorkflowId(); } } - // Step 3 end logger.info("workflowId = " + workflowId); + // Step 3 end if (workflowId.equals("")) { throw new ApiException(0, "Please contact DocuSign Support to enable IDV in your account."); } - // Step 4.1 start + // Step 4-1 start EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); - // Step 4.1 end + // Step 4-1 end // Step 5 start EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); - // step 5 end + // Step 5 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -93,7 +93,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - // Step 4.2 start + // Step 4-2 start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String workflowId) { EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); @@ -148,5 +148,5 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe envelopeDefinition.setDocuments(Collections.singletonList(doc1)); return envelopeDefinition; } - // Step 4.2 end + // Step 4-2 end } From 8911abaf953447dbd4b74cc385246fcc1889ee5f Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Thu, 2 Dec 2021 11:52:26 -0800 Subject: [PATCH 242/699] Updating Phone Auth and IDV code examples (eg20 and eg23) with updated method to find the workflowId. --- .../EG020ControllerPhoneAuthentication.java | 74 +++++++++---------- .../EG023ControllerIdvAuthentication.java | 32 +++++--- .../views/pages/esignature/index.jsp | 18 ++--- 3 files changed, 66 insertions(+), 58 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index 9b5d8e9b..be93b3fd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -7,8 +7,10 @@ import com.docusign.core.model.User; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.AccountIdentityVerificationResponse; +import com.docusign.esign.model.AccountIdentityVerificationWorkflow; import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; @@ -18,13 +20,16 @@ import com.docusign.esign.model.Recipients; import com.docusign.esign.model.SignHere; import com.docusign.esign.model.Signer; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; + import java.io.IOException; import java.util.Arrays; +import java.util.List; import javax.servlet.http.HttpServletResponse; @@ -34,8 +39,8 @@ @Controller @RequestMapping("/eg020") public class EG020ControllerPhoneAuthentication extends AbstractEsignatureController { - // For List.of you could even do groups of numbers such as - // List.of("415-555-1212", "415-555-3434"); + + private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; private static final String DOCUMENT_NAME = "Lorem"; @@ -55,18 +60,32 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String accountId = session.getAccountId(); // Step 2 start - EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); // Step 2 end - - // Step 4a start - String workFlowId = getWorkflowId(accountId); - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), - args.getPhoneNumber(), workFlowId); - // Step 4a end - - // Step 5 start + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + + // Step 3 start + AccountsApi workflowDetails = new AccountsApi(apiClient); + AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); + List identityVerification = workflowRes.getIdentityVerification(); + String workflowId = ""; + for (int i = 0; i < identityVerification.size(); i++) + { + if (identityVerification.get(i).getDefaultName().equals("Phone Authentication")) + { + workflowId = identityVerification.get(i).getWorkflowId(); + } + } + // Step 3 end + logger.info("workflowId = " + workflowId); + if (workflowId.equals("")) + { + throw new ApiException(0, "Please contact DocuSign Support to enable Phone Auth in your account."); + }EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), + args.getPhoneNumber(), workflowId); + // Step 4.1 start EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - // Step 5 end + // Step 4.1 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title).withJsonObject(results) @@ -77,15 +96,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - // Step 4b start + // Step 4.2 start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, String phone, String workFlowId) throws IOException { Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); SignHere signHere = new SignHere(); signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); + signHere.setXPosition("200"); + signHere.setYPosition("160"); signHere.setTabLabel("SignHereTab"); signHere.setPageNumber("1"); signHere.setDocumentId(doc.getDocumentId()); @@ -132,27 +151,6 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe return envelope; } + // Step 4.2 end - // retreives the workflow ID - private String getWorkflowId(String accountId) { - try { - AccountsApi workflowDetails = createAccountsApi(session.getBasePath(), user.getAccessToken()); - AccountIdentityVerificationResponse workflowResponse = workflowDetails - .getAccountIdentityVerification(accountId); - - // Check that idv authentication is enabled - // The workflow ID is a hard-coded value which is unique to this phone - // authentication workflow - if (workflowResponse.getIdentityVerification() != null) { - return "c368e411-1592-4001-a3df-dca94ac539ae"; - } else { - throw new RuntimeException("Identity Verification is not enabled for this account"); - } - - } catch (Exception e) { - return null; - } - - } - // Step 4b end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index f7d4a21c..05f67568 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -54,22 +54,34 @@ public EG023ControllerIdvAuthentication(DSConfiguration config, Session session, @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - // Step 1: Construct your API headers + // Step 2 start ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + // Step 2 end EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - //Step 2: Retrieve the workflow ID + // Step 3 start AccountsApi workflowDetails = new AccountsApi(apiClient); AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); List identityVerification = workflowRes.getIdentityVerification(); - if (identityVerification == null || identityVerification.isEmpty()) { - throw new ApiException("Error. Cant get AccountIdentityVerificationWorkflow"); + String workflowId = ""; + for (int i = 0; i < identityVerification.size(); i++) + { + if (identityVerification.get(i).getDefaultName().equals("DocuSign ID Verification")) + { + workflowId = identityVerification.get(i).getWorkflowId(); + } } - String workflowId = identityVerification.get(0).getWorkflowId(); logger.info("workflowId = " + workflowId); - // Step 3: Construct your envelope JSON body + // Step 3 end + if (workflowId.equals("")) + { + throw new ApiException(0, "Please contact DocuSign Support to enable IDV in your account."); + } + // Step 4-1 start EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); - // Step 4: Create envelope + // Step 4-1 end + // Step 5 start EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + // Step 5 end session.setEnvelopeId(results.getEnvelopeId()); DoneExample.createDefault(title) @@ -81,6 +93,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } + // Step 4-2 start private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String workflowId) { EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); @@ -103,8 +116,8 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe SignHere signHere1 = new SignHere(); signHere1.setName("SignHereTab"); - signHere1.setXPosition("75"); - signHere1.setYPosition("572"); + signHere1.setXPosition("200"); + signHere1.setYPosition("160"); signHere1.setTabLabel("SignHereTab"); signHere1.setPageNumber("1"); signHere1.setDocumentId("1"); @@ -135,4 +148,5 @@ private static EnvelopeDefinition createEnvelope(String signerName, String signe envelopeDefinition.setDocuments(Collections.singletonList(doc1)); return envelopeDefinition; } + // Step 4-2 end } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 22332843..1447d071 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -194,26 +194,26 @@

Recipient authentication

-

19. Send an envelope with Access Code Authentication

-

This example sends and envelope that requires an access-code for the purpose of multi-factor authentication.

+

19. Require access code authentication for a recipient

+

Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

API method used: Envelopes::create.

-

20. Require Phone Authentication for a Recipient

+

20. Require phone authentication for a recipient

Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

API method used: Envelopes::create.

-

22. Send an envelope with Knowledge-Based Authentication

-

This example sends and envelope that requires passing a Public records check to validate identity for the purpose of multifactor authentication.

+

22. Require knowledge-based authentication (KBA) for a recipient

+

Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

API method used: Envelopes::create.

-

23. Send an envelope with ID Verification Authentication

-

Submit an envelope that requires verification of a government issued identity.

+

23. Require ID verification (IDV) for a recipient

+

Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

API method used: Envelopes::create. @@ -222,10 +222,6 @@

Permissions

24. Create a new permission profile

- -

- Creating new permission profile. -

API method used: AccountPermissionProfiles::create. From 9dec0123a4cd17d365967213ed64106bebaa4b13 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Mon, 6 Dec 2021 10:48:39 -0800 Subject: [PATCH 243/699] Add SignHere tabs for signers, and updated recipient routing and step comments. --- .../EG031ControllerBulkSendEnvelopes.java | 76 ++++++++++++++----- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index f78c0d67..7ff87ffe 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -26,6 +26,7 @@ import com.docusign.esign.model.BulkSendingCopy; import com.docusign.esign.model.BulkSendingCopyRecipient; import com.docusign.esign.model.BulkSendingList; +import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.CustomFields; import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; @@ -46,8 +47,10 @@ public class EG031ControllerBulkSendEnvelopes extends AbstractEsignatureControll private static final long BULK_REQUEST_DELAY = 15L; private static final String BULK_SIGNER_EMAIL_PLACEHOLDER = "MultiBulkRecipients-%s@docusign.com"; private static final String BULK_SIGNER_NAME_PLACEHOLDER = "Multi Bulk Recipients::%s"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 20; + private static final int ANCHOR_OFFSET_X = 10; private final Session session; private final User user; @@ -64,36 +67,50 @@ public EG031ControllerBulkSendEnvelopes(DSConfiguration config, Session session, protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - // Step 2. Construct your API headers + // Construct your API headers + // Step 2 start ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); - String accountId = session.getAccountId(); + // Step 2 end - // Step 3. Submit a bulk list + // Submit a bulk list + // Step 3-1 start + String accountId = session.getAccountId(); BulkEnvelopesApi bulkEnvelopesApi = new BulkEnvelopesApi(apiClient); BulkSendingList sendingList = getSendingList(args); String bulkListId = bulkEnvelopesApi.createBulkSendList(accountId, sendingList).getListId(); + // Step 3-1 end - // Step 4. Create an envelope + // Create an envelope + // Step 4-1 start EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); String envelopeId = envelopesApi.createEnvelope(accountId, makeEnvelope()).getEnvelopeId(); + // Step 4-1 end - // Step 5. Attach your bulk list ID to the envelope + // Attach your bulk list ID to the envelope + // Step 5 start CustomFields customFields = createCustomFields(bulkListId); envelopesApi.createCustomFields(accountId, envelopeId, customFields); + // Step 5 end - // Step 6. Add placeholder recipients - envelopesApi.createRecipient(accountId, envelopeId, createRecipients()); + // Add placeholder recipients + // Step 6 start + envelopesApi.createRecipient(accountId, envelopeId, envelopesApi.listRecipients(accountId, envelopeId)); + // Step 6 end - // Step 7. Initiate bulk send + // Initiate bulk send + // Step 7 start BulkSendRequest request = new BulkSendRequest(); request.setEnvelopeOrTemplateId(envelopeId); String batchId = bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); + // Step 7 end - // Step 8. Confirm successful bulk send + // Confirm successful bulk send + // Step 8 start try { TimeUnit.SECONDS.sleep(BULK_REQUEST_DELAY); // For 2000 recipients, it can take about an hour BulkSendBatchStatus status = bulkEnvelopesApi.getBulkSendBatchStatus(accountId, batchId); + // Step 8 end DoneExample.createDefault(title) .withJsonObject(status) .withMessage(String.join("", "Bulk request queued to ", status.getQueued(), " user lists.")) @@ -106,6 +123,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } + // Step 3-2 start private static BulkSendingList getSendingList(WorkArguments args) { List copies = List.of( createBulkSending(args.getSignerName(), args.getSignerEmail(), args.getCcName(), args.getCcEmail()), @@ -115,6 +133,7 @@ private static BulkSendingList getSendingList(WorkArguments args) { .name("sample.csv") .bulkCopies(copies); } + // Step 3-2 end private static BulkSendingCopy createBulkSending(String signerName, String signerEmail, String ccName, String ccEmail) { @@ -133,14 +152,17 @@ private static BulkSendingCopy createBulkSending(String signerName, .customFields(Collections.emptyList()); } + // Step 4-2 start private static EnvelopeDefinition makeEnvelope() throws IOException { - Document document = EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "1"); + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); return new EnvelopeDefinition() .documents(List.of(document)) .envelopeIdStamping(DsModelUtils.TRUE) .emailSubject("EG031 Please sign") - .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); + .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED) + .recipients(createRecipients()); } + // Step 4-2 end private static CustomFields createCustomFields(String bulkListId) { TextCustomField textCustomField = new TextCustomField() @@ -155,23 +177,37 @@ private static CustomFields createCustomFields(String bulkListId) { } private static Recipients createRecipients() { - List signers = List.of( - createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, "1"), - createSignerPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, "2")); + Signer signer = createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, "1", "1"); + CarbonCopy cc = createCCPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, "2", "2"); return new Recipients() - .signers(signers); + .signers(List.of(signer)) + .carbonCopies(List.of(cc)); } - private static Signer createSignerPlaceholder(String roleName, String recipientId) { + private static Signer createSignerPlaceholder(String roleName, String recipientId, String routingOrder) { return new Signer() .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) .roleName(roleName) .note("") - .routingOrder("1") + .routingOrder(routingOrder) + .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) + .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) + .recipientId(recipientId) + .recipientType(roleName) + .tabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + } + + private static CarbonCopy createCCPlaceholder(String roleName, String recipientId, String routingOrder) { + return new CarbonCopy() + .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) + .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) + .roleName(roleName) + .note("") + .routingOrder(routingOrder) .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) .recipientId(recipientId) - .recipientType(EnvelopeHelpers.SIGNER_ROLE_NAME); + .recipientType(roleName); } } From 821c8c5614bf35a7318241794af131e757e0e430 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Mon, 6 Dec 2021 16:01:23 -0800 Subject: [PATCH 244/699] Updated success page. --- .../eSignature/examples/EG031ControllerBulkSendEnvelopes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index 7ff87ffe..f920b9ee 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -58,7 +58,7 @@ public class EG031ControllerBulkSendEnvelopes extends AbstractEsignatureControll @Autowired public EG031ControllerBulkSendEnvelopes(DSConfiguration config, Session session, User user) { - super(config, "eg031", "Bulk sending envelopes to multiple recipients"); + super(config, "eg031", "Bulk send envelopes"); this.session = session; this.user = user; } @@ -113,7 +113,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 8 end DoneExample.createDefault(title) .withJsonObject(status) - .withMessage(String.join("", "Bulk request queued to ", status.getQueued(), " user lists.")) + .withMessage(String.join("", "Results from BulkSend:getBulkSendBatchStatus method:")) .addToModel(model); } catch (InterruptedException exception) { Thread.currentThread().interrupt(); From 363c9ebd2f55ca1be4410883d436d257c837b230 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Mon, 6 Dec 2021 16:29:31 -0800 Subject: [PATCH 245/699] Remove period for consistency. --- .../WEB-INF/templates/views/pages/esignature/examples/eg031.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index cee266c5..e0d8742c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

31. ${title}.

+

31. ${title}

This code example demonstrates how to send envelopes in bulk to multiple recipients with the From f77e2d9a284f7cbc4be45eeb595b1393c4350678 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Tue, 7 Dec 2021 11:06:24 -0800 Subject: [PATCH 246/699] Moved SignHere tab. --- .../eSignature/examples/EG031ControllerBulkSendEnvelopes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index f920b9ee..d31ab4e1 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -49,8 +49,8 @@ public class EG031ControllerBulkSendEnvelopes extends AbstractEsignatureControll private static final String BULK_SIGNER_NAME_PLACEHOLDER = "Multi Bulk Recipients::%s"; private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; private static final String DOCUMENT_NAME = "Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = 20; - private static final int ANCHOR_OFFSET_X = 10; + private static final int ANCHOR_OFFSET_Y = -5; + private static final int ANCHOR_OFFSET_X = 15; private final Session session; private final User user; From a479ed123186db2ab6e63e2026a3abaf64f68085 Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Tue, 7 Dec 2021 14:12:05 -0800 Subject: [PATCH 247/699] Standardized pages and removed step 6 for bulk sending. --- .../EG031ControllerBulkSendEnvelopes.java | 13 +-- .../views/pages/esignature/examples/eg031.jsp | 79 ++++++++++++++++--- .../views/pages/esignature/index.jsp | 15 ++-- 3 files changed, 81 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index d31ab4e1..e44fd547 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -92,25 +92,20 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi.createCustomFields(accountId, envelopeId, customFields); // Step 5 end - // Add placeholder recipients - // Step 6 start - envelopesApi.createRecipient(accountId, envelopeId, envelopesApi.listRecipients(accountId, envelopeId)); - // Step 6 end - // Initiate bulk send - // Step 7 start + // Step 6 start BulkSendRequest request = new BulkSendRequest(); request.setEnvelopeOrTemplateId(envelopeId); String batchId = bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); - // Step 7 end + // Step 6 end // Confirm successful bulk send - // Step 8 start + // Step 7 start try { TimeUnit.SECONDS.sleep(BULK_REQUEST_DELAY); // For 2000 recipients, it can take about an hour BulkSendBatchStatus status = bulkEnvelopesApi.getBulkSendBatchStatus(accountId, batchId); - // Step 8 end + // Step 7 end DoneExample.createDefault(title) .withJsonObject(status) .withMessage(String.join("", "Results from BulkSend:getBulkSendBatchStatus method:")) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index e0d8742c..8056e1b8 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -4,11 +4,9 @@

31. ${title}

- This code example demonstrates how to send envelopes in bulk to multiple recipients with the - eSignature API. To accomplish the task, you will first create a bulk send recipients list, - and then create an envelope. From there, you will combine the envelope and bulk list to - initiate bulk send. Method BulkSend::createBulkSendList creates a bulk send list that you can - use to send an envelope to up to 1,000 recipients at once. + Demonstrates how to send envelopes in bulk to multiple recipients. First, this example + creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk + envelope sending.

@@ -16,11 +14,11 @@

API methods used: - EnvelopeRecipients::create, + BulkSend::createBulkSendList, Envelopes::create, EnvelopeCustomFields::create, - BulkSend::createBulkSendList - EnvelopeRecipients::create. + BulkSend::createBulkSendRequest, + BulkSend::getBulkSendBatchStatus.

@@ -29,7 +27,68 @@

-
+
+
+
Bulk copy #1
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+
Bulk copy #2
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+ + +
+ diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 1447d071..75b4f68c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -270,19 +270,20 @@

Bulk operations

-

31. Bulk sending envelopes to multiple recipients

+

31. Bulk send envelopes

- This example will show you how to bulk send envelopes to multiple recipients. + Demonstrates how to send envelopes in bulk to multiple recipients. First, this example + creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk + envelope sending.

API methods used: - EnvelopeRecipients::create, + BulkSend::createBulkSendList, Envelopes::create, - BulkEnvelopes::get, - EnvelopeCustomFields::create, - BulkSend::createBulkSendList - EnvelopeRecipients::create. + EnvelopeCustomFields::create, + BulkSend::createBulkSendRequest, + BulkSend::getBulkSendBatchStatus.

Advanced recipient routing

From 02a84045f379faec9549878691cd129b120bcefa Mon Sep 17 00:00:00 2001 From: Emily Wang Date: Tue, 7 Dec 2021 14:18:03 -0800 Subject: [PATCH 248/699] Remove commented code. --- .../views/pages/esignature/examples/eg031.jsp | 52 ------------------- 1 file changed, 52 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index 8056e1b8..4a0d5e9f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -88,58 +88,6 @@
- From 0e9cf9ae88f1b6f7beca86adb69e80bf8e99adc8 Mon Sep 17 00:00:00 2001 From: robert-knight Date: Tue, 28 Dec 2021 15:18:43 -0800 Subject: [PATCH 249/699] Remove .factorypath from repo. --- .factorypath | 94 ---------------------------------------------------- 1 file changed, 94 deletions(-) delete mode 100644 .factorypath diff --git a/.factorypath b/.factorypath deleted file mode 100644 index 202e6135..00000000 --- a/.factorypath +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From d0a3a712e17a32dc663cb127e098af5ee0888ada Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Mon, 3 Jan 2022 14:39:31 -0800 Subject: [PATCH 250/699] ZIP file to answer S/O question https://stackoverflow.com/questions/70310240/docusign-oauth-2-0-for-system-to-system-integration/70310270?noredirect=1 --- docs/ds-java-auth-final.zip | Bin 0 -> 83899 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/ds-java-auth-final.zip diff --git a/docs/ds-java-auth-final.zip b/docs/ds-java-auth-final.zip new file mode 100644 index 0000000000000000000000000000000000000000..c18317e4f4e5ce225427489308bb4cf2663173f2 GIT binary patch literal 83899 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 WEDk| literal 0 HcmV?d00001 From 79ba74a96ab726aab4b506b0318ef5807da628dc Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Wed, 12 Jan 2022 10:57:42 -0800 Subject: [PATCH 251/699] bump log4j-to-slf4j version --- code-examples-java.iml | 146 ++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 75 deletions(-) diff --git a/code-examples-java.iml b/code-examples-java.iml index 97a72455..c5ffa924 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -22,101 +22,97 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + - - + + - + - + - - - - - - - - - + + + + + + + - - - + + + - + - - + + + \ No newline at end of file From 196d4503bd6bdf5264d98bc47bb6602f687e91ff Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Thu, 13 Jan 2022 16:14:19 -0800 Subject: [PATCH 252/699] Edited text in Click ex1-6 to match standard --- .../C001ControllerCreateClickwrap.java | 2 +- .../C002ControllerActivateClickwrap.java | 2 +- ...003ControllerCreateNewVersionClickwrap.java | 7 ++++--- .../C004ControllerGetListClickwraps.java | 2 +- .../C005ControllerGetClickwrapResponses.java | 2 +- .../views/pages/click/examples/c001.jsp | 5 ++--- .../views/pages/click/examples/c002.jsp | 8 ++++---- .../views/pages/click/examples/c003.jsp | 11 +++++++---- .../views/pages/click/examples/c004.jsp | 6 +++--- .../views/pages/click/examples/c005.jsp | 9 ++++++--- .../templates/views/pages/click/index.jsp | 18 +++++------------- 11 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 48af20bf..b61c4faa 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -57,7 +57,7 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) - .withMessage("The clickwrap has been created!
Clickwrap ID " + createdClickwrap.getClickwrapId() + ".") + .withMessage("The clickwrap " + createdClickwrap.getClickwrapName() + " has been created.") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index bf74b88f..7e8cd9d9 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -61,7 +61,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(updatedClickwrap) - .withMessage("The clickwrap has been activated!
Clickwrap ID " + updatedClickwrap.getClickwrapId() + ".") + .withMessage("The clickwrap " + updatedClickwrap.getClickwrapName() + " has been activated.") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index 284e2802..ed539771 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -64,13 +64,14 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.getClickwrapId(), clickwrapRequest); + + this.session.setClickwrapId(createdClickwrap.getClickwrapId()); this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) - .withMessage("The new clickwrap version has been created!
" - + "Clickwrap ID " + createdClickwrap.getClickwrapId() - + ".
Version number " + createdClickwrap.getVersionNumber()) + .withMessage("Version " + createdClickwrap.getVersionNumber() + " of clickwrap " + + createdClickwrap.getClickwrapName() + " has been created.") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index 18725d4a..8500a26e 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -45,7 +45,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(clickwrapsResponse) - .withMessage("Clickwraps have been returned!") + .withMessage("Results from the Click::getClickwraps method:") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index 0ff8a185..e9be721d 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -46,7 +46,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(clickwrapAgreementsResponse) - .withMessage("Clickwrap responses have been returned!") + .withMessage("Results from the ClickWraps::getClickwrapAgreements method") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index 7701e3b1..9f655151 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -3,9 +3,8 @@

1. Creating a clickwrap.

-

This topic describes how to use DocuSign Click - to create a clickwrap that you can embed in your website or app.
- To learn how to generate a clickwrap automatically by using the UI, see the Click User Guide. +

+ Creates a clickwrap that you can embed in your website or app.

API methods used: ClickWraps:createClickwrap. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index 24e34455..e05c0094 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -3,9 +3,9 @@

2. Activating a clickwrap.

-

This topic describes how to use DocuSign Click - to activate a new clickwrap that you have already created. - By default, new clickwraps are inactive. You must activate your clickwrap before you can use it. +

+ Activates a new clickwrap that you have already created. By default, new clickwraps are
+ inactive. You must activate your clickwrap before you can use it.

API methods used: ClickWraps:updateClickwrapVersion. @@ -16,7 +16,7 @@ -

The clickwrap you created via example 1 will be activated.

+

The clickwrap you created via example 1 will be queried.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 3ee5f8c2..996721f6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -1,10 +1,13 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

5. Creating a new clickwrap version.

+

3. Creating a new clickwrap version.

-

This topic demonstrates how to use the Click API to create a new version of a clickwrap. - You can specify whether you require users who have previously accepted the clickwrap +

+ Creates a new version of a clickwrap. +

+

+ You can specify whether you require users who have previously accepted the clickwrap
to accept the new version when they return to your website.

API methods used: @@ -16,7 +19,7 @@ -

For the clickwrap you created via example 1 new version will be created.

+

The clickwrap you created via example 1 will be queried.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index 2455609e..a563ea89 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -1,10 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

6. Get a list of clickwraps.

+

4. Get a list of clickwraps.

-

This topic demonstrates how to use the Click API to get a list of clickwraps - associated with a specific DocuSign user. +

+ Gets a list of clickwraps associated with a specific DocuSign user.

API methods used: ClickWraps:getClickwraps diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index 0590a391..6dc44ab4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -1,10 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

7. Get clickwrap responses.

+

5. Get clickwrap responses.

-

This topic demonstrates how to use the Click API to get user responses to - your clickwrap agreements. +

+ Gets user responses to your clickwrap agreements.

API methods used: ClickWraps:getClickwrapAgreements @@ -12,6 +12,9 @@

View source file ${sourceFile} on GitHub.

+

+ The clickwrap you created via example 1 will be queried. +

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index 0983548a..fa6bcda1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -30,43 +30,35 @@

Click Examples

1. Create a clickwrap

-

This topic describes how to use DocuSign Click - to create a clickwrap that you can embed in your website or app.
- To learn how to generate a clickwrap automatically by using the UI, see the Click User Guide. +

Creates a clickwrap that you can embed in your website or app.

API methods used: ClickWraps:createClickwrap.

2. Activate a clickwrap

-

This topic describes how to use DocuSign Click - to activate a new clickwrap that you have already created. - By default, new clickwraps are inactive. You must activate your clickwrap before you can use it. +

Activates a new clickwrap that you have already created.

API methods used: ClickWraps:updateClickwrapVersion

3. How to create a new clickwrap version

-

This topic demonstrates how to use the Click API to create a new version of a clickwrap. - You can specify whether you require users who have previously accepted the clickwrap - to accept the new version when they return to your website. +

Creates a new version of a clickwrap.

API methods used: ClickWraps:updateClickwrapVersion

4. Get a list of clickwraps

-

This topic demonstrates how to use the Click API to get a list of clickwraps - associated with a specific DocuSign user. +

Gets a list of clickwraps associated with a specific DocuSign user.

API methods used: ClickWraps:getClickwraps

5. Get clickwrap responses

-

This topic demonstrates how to use the Click API to get user responses to - your clickwrap agreements. +

Gets user responses to your clickwrap agreements.

API methods used: ClickWraps:getClickwrapAgreements From f7924b3e942aa23b87d0fa11e77c7c8a5136ccc0 Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Fri, 14 Jan 2022 11:53:57 -0800 Subject: [PATCH 253/699] Edited some titles on click 1-3 --- .../WEB-INF/templates/views/pages/click/examples/c001.jsp | 2 +- .../WEB-INF/templates/views/pages/click/examples/c002.jsp | 2 +- .../WEB-INF/templates/views/pages/click/examples/c003.jsp | 2 +- .../webapp/WEB-INF/templates/views/pages/click/index.jsp | 6 +----- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index 9f655151..b6af0edb 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

1. Creating a clickwrap.

+

1. Create a clickwrap.

Creates a clickwrap that you can embed in your website or app. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index e05c0094..ddaf76c4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

2. Activating a clickwrap.

+

2. Activate a clickwrap.

Activates a new clickwrap that you have already created. By default, new clickwraps are
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 996721f6..1eccf197 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

3. Creating a new clickwrap version.

+

3. Create a new clickwrap version.

Creates a new version of a clickwrap. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index fa6bcda1..fbbcb47c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -21,14 +21,10 @@

-

Welcome

-

This launcher both demonstrates use of common OAuth2 grant flows and multiple usage examples from the DocuSign Rooms REST API.

Documentation on using OAuth Authorization Code Grant from a Java application.

-

Click Examples

-

1. Create a clickwrap

Creates a clickwrap that you can embed in your website or app.

@@ -43,7 +39,7 @@ ClickWraps:updateClickwrapVersion

-

3. How to create a new clickwrap version

+

3. Create a new clickwrap version

Creates a new version of a clickwrap.

API methods used: From 8375b4cd16011ab1e15602353e6d91e569e57db5 Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Wed, 19 Jan 2022 14:05:30 -0800 Subject: [PATCH 254/699] Changed API Username GUID > User ID GUID in README --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fe3c78fa..f7dcb6ba 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ For a list of code examples that use the Admin API, select the Java tab under [E To use [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/), you will need an integration key and a secret key. See [Installation steps](#installation-steps) for details. - To use [JWT Grant](https://developers.docusign.com/platform/auth/jwt/), you will need an integration key, an RSA key pair, and the API Username GUID of the impersonated user. See [Installation steps for JWT Grant authentication](#installation-steps-for-jwt-grant-authentication) for details. + To use [JWT Grant](https://developers.docusign.com/platform/auth/jwt/), you will need an integration key, an RSA key pair, and the User ID GUID of the impersonated user. See [Installation steps for JWT Grant authentication](#installation-steps-for-jwt-grant-authentication) for details. For both authentication flows: @@ -102,7 +102,7 @@ For a list of code examples that use the Admin API, select the Java tab under [E `cd ` or `cd code-examples-java` 1. Package the code: `mvn package` 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. - 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. + 1. Add your User ID. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **User ID** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. @@ -120,7 +120,7 @@ Also, in order to select JSON Web Token authentication in the launcher, in src/m 1. In your command-line environment, switch to the folder: `cd ` or `cd code-examples-java` 1. Package the code: `mvn package` 1. To configure the launcher for [JWT Grant](https://developers.docusign.com/platform/auth/jwt/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. - 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID` and as your `jwt.grant.client.impersonated-user-guid`. + 1. Add your User ID. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **User ID** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID` and as your `jwt.grant.client.impersonated-user-guid`. 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `jwt.grant.client.client-id`. 1. Generate an RSA key pair, if you don’t already have one. Under **Authentication**, select **+ GENERATE RSA**. Copy the private key, and save it in a new file named src/main/resources/private.key. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=jwt. Select **SAVE**. @@ -142,7 +142,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. - 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. + 1. Add your User ID. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **User ID** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. @@ -167,7 +167,7 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition 1. Extract the Quickstart ZIP file or download or clone the code-examples-java repository. 1. To configure the launcher for [Authorization Code Grant](https://developers.docusign.com/platform/auth/authcode/) authentication, create a copy of the file src/main/resources/application.example.json and save the copy as src/main/resources/application.json. - 1. Add your API Username. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **API Username** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. + 1. Add your User ID. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **My Account Information**, copy the **User ID** GUID and save it in application.json as your `DS_TARGET_ACCOUNT_ID`. 1. Add your integration key. On the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=apiIntegratorKey) page, under **Apps and Integration Keys**, choose the app to use, then select **Actions > Edit**. Under **General Info**, copy the **Integration Key** GUID and save it in application.json as your `authorization.code.grant.client.client-id`. 1. Generate a secret key, if you don’t already have one. Under **Authentication**, select **+ ADD SECRET KEY**. Copy the secret key and save it in application.json as your `authorization.code.grant.client.client-secret`. 1. Add the launcher’s redirect URI. Under **Additional settings**, select **+ ADD URI**, and set a redirect URI of http://localhost:8080/login&type=acg. Select **SAVE**. From a889c6c188856075697e160ac2cad3de5c383330 Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Thu, 20 Jan 2022 15:28:51 -0800 Subject: [PATCH 255/699] Made some minor text updates --- .../click/examples/C005ControllerGetClickwrapResponses.java | 2 +- .../WEB-INF/templates/views/pages/click/examples/c002.jsp | 2 +- .../WEB-INF/templates/views/pages/click/examples/c003.jsp | 4 ++-- src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index e9be721d..d6a8d4fc 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -46,7 +46,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(clickwrapAgreementsResponse) - .withMessage("Results from the ClickWraps::getClickwrapAgreements method") + .withMessage("Results from the ClickWraps::getClickwrapAgreements method:") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index ddaf76c4..ed8a0280 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -4,7 +4,7 @@

2. Activate a clickwrap.

- Activates a new clickwrap that you have already created. By default, new clickwraps are
+ Activates a new clickwrap that you have already created. By default, new clickwraps are inactive. You must activate your clickwrap before you can use it.

API methods used: diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 1eccf197..4389592b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -7,11 +7,11 @@ Creates a new version of a clickwrap.

- You can specify whether you require users who have previously accepted the clickwrap
+ You can specify whether you require users who have previously accepted the clickwrap to accept the new version when they return to your website.

API methods used: - ClickWraps:updateClickwrapVersion + ClickWraps:createClickwrapVersion

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index fbbcb47c..736e965c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -43,7 +43,7 @@

Creates a new version of a clickwrap.

API methods used: - ClickWraps:updateClickwrapVersion + ClickWraps:createClickwrapVersion

4. Get a list of clickwraps

From ffa2c142ae3deacfe631fe77c1436b13efb13ff0 Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Thu, 20 Jan 2022 15:36:39 -0800 Subject: [PATCH 256/699] Added some spaces in click 2 and 3 --- .../WEB-INF/templates/views/pages/click/examples/c002.jsp | 2 +- .../WEB-INF/templates/views/pages/click/examples/c003.jsp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index ed8a0280..365076a4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -4,7 +4,7 @@

2. Activate a clickwrap.

- Activates a new clickwrap that you have already created. By default, new clickwraps are + Activates a new clickwrap that you have already created. By default, new clickwraps are inactive. You must activate your clickwrap before you can use it.

API methods used: diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 4389592b..c5a35e9f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -7,7 +7,7 @@ Creates a new version of a clickwrap.

- You can specify whether you require users who have previously accepted the clickwrap + You can specify whether you require users who have previously accepted the clickwrap to accept the new version when they return to your website.

API methods used: From ac6e7da92778c8d9a244aaff6bf2ae2b9a7c5533 Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Mon, 24 Jan 2022 08:24:24 -0800 Subject: [PATCH 257/699] Minor changes to click 1-5 --- .../templates/views/pages/click/examples/c001.jsp | 2 +- .../templates/views/pages/click/examples/c002.jsp | 2 +- .../templates/views/pages/click/examples/c003.jsp | 4 ++-- .../templates/views/pages/click/examples/c004.jsp | 2 +- .../templates/views/pages/click/examples/c005.jsp | 2 +- .../WEB-INF/templates/views/pages/click/index.jsp | 12 ++++++------ 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index b6af0edb..93f85f40 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -6,7 +6,7 @@

Creates a clickwrap that you can embed in your website or app.

-

API methods used: +

API method used: ClickWraps:createClickwrap.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index 365076a4..59feab3c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -7,7 +7,7 @@ Activates a new clickwrap that you have already created. By default, new clickwraps are inactive. You must activate your clickwrap before you can use it.

-

API methods used: +

API method used: ClickWraps:updateClickwrapVersion.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index c5a35e9f..78c9d4c4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -10,8 +10,8 @@ You can specify whether you require users who have previously accepted the clickwrap to accept the new version when they return to your website.

-

API methods used: - ClickWraps:createClickwrapVersion +

API method used: + ClickWraps:createClickwrapVersion

View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index a563ea89..c88e070a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -6,7 +6,7 @@

Gets a list of clickwraps associated with a specific DocuSign user.

-

API methods used: +

API method used: ClickWraps:getClickwraps

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index 6dc44ab4..7b040a69 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -6,7 +6,7 @@

Gets user responses to your clickwrap agreements.

-

API methods used: +

API method used: ClickWraps:getClickwrapAgreements

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index 736e965c..bf65722a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -28,35 +28,35 @@

1. Create a clickwrap

Creates a clickwrap that you can embed in your website or app.

-

API methods used: +

API method used: ClickWraps:createClickwrap.

2. Activate a clickwrap

Activates a new clickwrap that you have already created.

-

API methods used: +

API method used: ClickWraps:updateClickwrapVersion

3. Create a new clickwrap version

Creates a new version of a clickwrap.

-

API methods used: - ClickWraps:createClickwrapVersion +

API method used: + ClickWraps:createClickwrapVersion

4. Get a list of clickwraps

Gets a list of clickwraps associated with a specific DocuSign user.

-

API methods used: +

API method used: ClickWraps:getClickwraps

5. Get clickwrap responses

Gets user responses to your clickwrap agreements.

-

API methods used: +

API method used: ClickWraps:getClickwrapAgreements

From 544a4c59383136fcd0b8c012bd8d5a8bbfbacdfc Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 2 Feb 2022 14:53:28 -0800 Subject: [PATCH 258/699] Adding initial files for this --- JWT Console App/pom.xml | 60 +++++++++++++++++++ .../main/java/com/docusign/JWTConsoleApp.java | 32 ++++++++++ 2 files changed, 92 insertions(+) create mode 100644 JWT Console App/pom.xml create mode 100644 JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java diff --git a/JWT Console App/pom.xml b/JWT Console App/pom.xml new file mode 100644 index 00000000..82452b98 --- /dev/null +++ b/JWT Console App/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + docusign.jwtconsoleapp + code-examples-java-JWT + 1.0-SNAPSHOT + + Docusign Java JWT Console App + + + UTF-8 + 11 + 11 + + + + + + commons-cli + commons-cli + 1.4 + + + + com.opencsv + opencsv + 4.6 + + + + org.apache.commons + commons-math3 + 3.6.1 + + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + + docusign.jwtconsoleapp.JWTConsoleApp + + + + + + + + \ No newline at end of file diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java new file mode 100644 index 00000000..ecb97612 --- /dev/null +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -0,0 +1,32 @@ +package docusign.jwtconsoleapp; + +import com.opencsv.CSVReaderBuilder; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.DefaultParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.math3.stat.StatUtils; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; + +/** + * Starter class for JWTConsoleApp application. + */ + +public class JWTConsoleApp { + + /** + * Application entry point. + * + * @param args application command line arguments + */ + public static void main(String[] args) { + System.out.println("Hello World!"); + } +} \ No newline at end of file From b19971dbdd4ab65b3a3623cdab82c4ae4cac884e Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 2 Feb 2022 15:47:48 -0800 Subject: [PATCH 259/699] Some updates --- JWT Console App/pom.xml | 6 ++++++ .../src/main/java/com/docusign/JWTConsoleApp.java | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/JWT Console App/pom.xml b/JWT Console App/pom.xml index 82452b98..a4d328c2 100644 --- a/JWT Console App/pom.xml +++ b/JWT Console App/pom.xml @@ -36,6 +36,12 @@ commons-math3 3.6.1 + + + com.docusign + docusign-esign-java + 3.15.0 + diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java index ecb97612..4c1e00d1 100644 --- a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -10,10 +10,12 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.math3.stat.StatUtils; + import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Scanner; /** * Starter class for JWTConsoleApp application. @@ -27,6 +29,16 @@ public class JWTConsoleApp { * @param args application command line arguments */ public static void main(String[] args) { - System.out.println("Hello World!"); + + Scanner scanner = new Scanner(System. in); + System.out.print ("Welcome to the JWT Code example! "); + System.out.print("Enter the signer's email address: "); + String signerEmail = scanner. nextLine(); + System.out.print("Enter the signer's name: "); + String signerName = scanner. nextLine(); + System.out.print("Enter the carbon copy's email address: "); + String ccEmail = scanner. nextLine(); + System.out.print("Enter the carbon copy's name: "); + String ccName = scanner. nextLine(); } } \ No newline at end of file From 2194fecb6f583b6a556741910e088ea9053e662d Mon Sep 17 00:00:00 2001 From: connorl-docusign <93227695+connorl-docusign@users.noreply.github.com> Date: Thu, 3 Feb 2022 08:49:15 -0800 Subject: [PATCH 260/699] Updated favicon (#48) --- src/main/resources/public/assets/favicon.ico | Bin 7406 -> 33310 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/public/assets/favicon.ico b/src/main/resources/public/assets/favicon.ico index b3b2dc49c82e19f6982d4f17e033fb9aa26931ea..fd990b6942f717e57af521d6c65eb20998282e55 100644 GIT binary patch literal 33310 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 RZ?k$1)N`Po1HQ_E{{uWiH2VMm literal 7406 zcmeHKNo*WN6n&naeeLeq_nxt5F}AUZ!5P_(WyNIicx;vfIUpe<1cW<65IDdAB!sxY z5s3?8JHQno5Ni-i0$w0-!V*hhLx>_F42ZL=Ay{rc}$*L+pK z{snY_1J8qcD-N505de}@wqLOV&(qw{P{now`>ExLLm?mL3U&wrDI#jQD1mu4W&=FkiC8$qmTWBiD%EFf951+=eJS% zgyIVn|M@odzVItX?*AUs?{1)fb{VD5wlMw9MeKgy2TZ-Vj^c-#=r5h57@B|kB6i*N z9r}y3&KKLt-t>{40X+j(Bm>@Nq#NM129k9MSdFeo9b85((M1p(4ngh{TzNTC9=>j2 zKAK8Jl?guTvDrMzgwJFVMT^N-i4ffOpurHdyM@X`nloE0W-eV@F(f&iQmAHnt^Ro2 zZ&hq>EF6y2nO^xn)!WMW-zHhsS&7;tHCdk-jOC8~R&=)b{sw8~4(6y;^-$K%;d@s| zUl&k#cnuTJoX5b;%ji3B0@vN~Ez@6Fd*>E+aNvzUnMRI1aTdi7HksyLd+RBtv$FQi ze6)#yo0c(r&l&P>AbZ0+4!(H-g(Is>m&YDIi@yC|F|8lC zHUo7cdX<$K131zn`q3Tv4DDIX7fs454;bml85w7uX3L#@E<>)E9dmO2h zG1N%#@jM?-SY(1F5hugflm$8j9?>oP-J*w#Cbw)Fs(wQYXD9qp%uR?%D(iRIy8VQ1 zTUYDnC)4GVnpSbsVP#NtUk!))%XMWua-Bj~MBGWOR;Sp=sG?G*$Tdpgp;cC=Ouf90 zJx`y*!M848^0{Bw{jYcLm$-)7;BBXoA74b_!BtGXv|g)KhHn1`<4^v~YL$Jj|H1B$ z`H3a;Qk$i_WZ}pf@?(n_zHbGikN(K+jpI+9WA)11!Vard1`mCW{GKJ`M~QcM1^Zt6 z9fOBXvwCIb=w@}tdaq|d&p?MWAnE9M21JdhJlK-g2#Xvbnj-d;CfFk;QIe3c=3<(V zvt>XJuyAIL;Mj)fvu@CYq(R>Q{{dpqXbe*BG(rr<{r-T(jq From 7df27833b64ed54105c44d11bca62bc2ad708371 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 3 Feb 2022 08:51:26 -0800 Subject: [PATCH 261/699] Devdocs 6315 (#45) * ZIP file to answer S/O question https://stackoverflow.com/questions/70310240/docusign-oauth-2-0-for-system-to-system-integration/70310270?noredirect=1 * log4j + exception handling on no orgID * small bugfix to stop code execution after exception is thrown * bump the change to 30 seconds to fix imports Co-authored-by: meihDS <70775251+meihDS@users.noreply.github.com> --- .../examples/A003BulkExportUserData.java | 2 +- .../examples/AbstractAdminController.java | 285 ++++++++++-------- 2 files changed, 161 insertions(+), 126 deletions(-) diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 663b3ba4..3a29eed7 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -58,7 +58,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), request); // Step 3 end - TimeUnit.SECONDS.sleep(20); + TimeUnit.SECONDS.sleep(30); // Step 4 start OrganizationExportResponse data = bulkExportsApi.getUserListExport( diff --git a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java index a87ed341..353861da 100644 --- a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java +++ b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java @@ -22,147 +22,182 @@ import com.docusign.esign.api.GroupsApi; //import com.docusign.esign.client.ApiClient; import com.docusign.esign.api.OrganizationsApi; - +import java.util.UUID; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; -import java.util.UUID; - /** * Abstract base class for all Admin controllers. */ @Controller public abstract class AbstractAdminController extends AbstractController { - private final DSConfiguration configuration; - private static final String EXAMPLE_PAGES_PATH = "pages/admin/examples/"; - - public AbstractAdminController(DSConfiguration config, String exampleName, String title) { - super(config, exampleName, title); - this.configuration = config; - } - - protected String getExamplePagesPath() { - return AbstractAdminController.EXAMPLE_PAGES_PATH; - } - - /** - * Creates new instance of the Admin API client. - * @param accessToken user's access token - * @param basePath basePath to the server - * @return an instance of the {@link ApiClient} - */ - protected static ApiClient createApiClient(String accessToken, String basePath) { - // Step 2 start - ApiClient apiClient = new ApiClient(basePath); - apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + accessToken); - // Step 2 end - - return apiClient; - } - - /** - * Creates a new instance of the UsersApi. This method - * creates an instance of the UsersApi class silently. - * @param accessToken user's access token - * @param basePath basePath to the server - * @return an instance of the {@link UsersApi} - */ - protected static UsersApi createUsersApi(String accessToken, String basePath) { - ApiClient apiClient = createApiClient(accessToken, basePath); - return new UsersApi(apiClient); - } - - /** - * Creates a new instance of the BulkExportsApi. This method - * creates an instance of the BulkExportsApi class silently. - * @param accessToken user's access token - * @param basePath basePath to the server - * @return an instance of the {@link BulkExportsApi} - */ - protected static BulkExportsApi createBulkExportsApi(String accessToken, String basePath) { - ApiClient apiClient = createApiClient(accessToken, basePath); - return new BulkExportsApi(apiClient); + private final DSConfiguration configuration; + private static final String EXAMPLE_PAGES_PATH = "pages/admin/examples/"; + + public AbstractAdminController( + DSConfiguration config, + String exampleName, + String title + ) { + super(config, exampleName, title); + this.configuration = config; + } + + protected String getExamplePagesPath() { + return AbstractAdminController.EXAMPLE_PAGES_PATH; + } + + /** + * Creates new instance of the Admin API client. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link ApiClient} + */ + protected static ApiClient createApiClient( + String accessToken, + String basePath + ) { + // Step 2 start + ApiClient apiClient = new ApiClient(basePath); + apiClient.addDefaultHeader( + HttpHeaders.AUTHORIZATION, + BEARER_AUTHENTICATION + accessToken + ); + // Step 2 end + + return apiClient; + } + + /** + * Creates a new instance of the UsersApi. This method + * creates an instance of the UsersApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link UsersApi} + */ + protected static UsersApi createUsersApi( + String accessToken, + String basePath + ) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new UsersApi(apiClient); + } + + /** + * Creates a new instance of the BulkExportsApi. This method + * creates an instance of the BulkExportsApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link BulkExportsApi} + */ + protected static BulkExportsApi createBulkExportsApi( + String accessToken, + String basePath + ) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new BulkExportsApi(apiClient); + } + + /** + * Creates a new instance of the BulkImportsApi. This method + * creates an instance of the BulkImportsApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link BulkImportsApi} + */ + protected static BulkImportsApi createBulkImportsApi( + String accessToken, + String basePath + ) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new BulkImportsApi(apiClient); + } + + /** + * Creates a request to get current user. + * @param accessToken user's access token + * @param basePath basePath to the server + * @param organizationId the ID of current organization + * @return the account Id + */ + protected UUID getExistingAccountId( + String accessToken, + String basePath, + UUID organizationId + ) + throws Exception { + UsersApi usersApi = createUsersApi(accessToken, basePath); + + // set the signer email to get an information about that user + // new GetUsersOptions() will throw "an enclosing instance that contains com.docusign.admin.api.UsersApi.GetUserProfilesOptions is required" + // at compile time. I used this workaround from stackOverflow: + // https://stackoverflow.com/a/4297913/2226328 + + GetUserProfilesOptions userProfilesOptions = + usersApi.new GetUserProfilesOptions(); + userProfilesOptions.setEmail(configuration.getSignerEmail()); + + UsersDrilldownResponse user = usersApi.getUserProfiles( + organizationId, + userProfilesOptions + ); + + if (user.getUsers().isEmpty()) { + throw new Exception("Could not get an account id from the request."); } - /** - * Creates a new instance of the BulkImportsApi. This method - * creates an instance of the BulkImportsApi class silently. - * @param accessToken user's access token - * @param basePath basePath to the server - * @return an instance of the {@link BulkImportsApi} - */ - protected static BulkImportsApi createBulkImportsApi(String accessToken, String basePath) { - ApiClient apiClient = createApiClient(accessToken, basePath); - return new BulkImportsApi(apiClient); - } + return user.getUsers().get(0).getDefaultAccountId(); + } - /** - * Creates a request to get current user. - * @param accessToken user's access token - * @param basePath basePath to the server - * @param organizationId the ID of current organization - * @return the account Id - */ - protected UUID getExistingAccountId(String accessToken, String basePath, UUID organizationId) throws Exception { - UsersApi usersApi = createUsersApi(accessToken, basePath); - - // set the signer email to get an information about that user - // new GetUsersOptions() will throw "an enclosing instance that contains com.docusign.admin.api.UsersApi.GetUserProfilesOptions is required" - // at compile time. I used this workaround from stackOverflow: - // https://stackoverflow.com/a/4297913/2226328 - - GetUserProfilesOptions userProfilesOptions = usersApi.new GetUserProfilesOptions(); - userProfilesOptions.setEmail(configuration.getSignerEmail()); - - UsersDrilldownResponse user = usersApi.getUserProfiles(organizationId, userProfilesOptions); - - if (user.getUsers().isEmpty()) { - throw new Exception("Could not get an account id from the request."); - } + protected UUID getOrganizationId(String accessToken, String basePath) + throws ApiException { + UUID orgId = null; + if (session.getOrgId() == null) { - return user.getUsers().get(0).getDefaultAccountId(); - } - - protected UUID getOrganizationId(String accessToken, String basePath) throws ApiException{ - UUID orgId = null; - if (session.getOrgId() == null){ ApiClient apiClient = createApiClient(accessToken, basePath); AccountsApi accounts = new AccountsApi(apiClient); - UUID res = accounts.getOrganizations().getOrganizations().get(0).getId(); - session.setOrgId(res); - orgId = res; - } - else { - orgId = session.getOrgId(); + OrganizationsResponse orgs = accounts.getOrganizations(); + if (orgs.getOrganizations().isEmpty()) { + throw new ApiException( + "No organizations found on this account, please create an organization first." + ); + } else { + orgId = orgs.getOrganizations().get(0).getId(); + session.setOrgId(orgId); } - return orgId; - } - - - /** - * Creates a new instance of the ProductPermissionProfilesApi. This method - * creates an instance of the ProductPermissionProfilesApi class silently. - * @param accessToken user's access token - * @param basePath basePath to the server - * @return an instance of the {@link ProductPermissionProfilesApi} - */ - protected ProductPermissionProfilesApi createProductPermissionProfilesApi(String accessToken, String basePath) { - ApiClient apiClient = createApiClient(accessToken, basePath); - return new ProductPermissionProfilesApi(apiClient); - } - - /** - * Creates a new instance of the AdminGroupsApi. This method - * creates an instance of the AdminGroupsApi class silently. - * @param accessToken user's access token - * @param basePath basePath to the server - * @return an instance of the {@link AdminGroupsApi} - */ - protected DsGroupsApi createDSGroupsApi(String accessToken, String basePath) { - ApiClient apiClient = createApiClient(accessToken, basePath); - return new DsGroupsApi(apiClient); + } else { + orgId = session.getOrgId(); } -} + return orgId; + } + + /** + * Creates a new instance of the ProductPermissionProfilesApi. This method + * creates an instance of the ProductPermissionProfilesApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link ProductPermissionProfilesApi} + */ + protected ProductPermissionProfilesApi createProductPermissionProfilesApi( + String accessToken, + String basePath + ) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new ProductPermissionProfilesApi(apiClient); + } + + /** + * Creates a new instance of the AdminGroupsApi. This method + * creates an instance of the AdminGroupsApi class silently. + * @param accessToken user's access token + * @param basePath basePath to the server + * @return an instance of the {@link AdminGroupsApi} + */ + protected DsGroupsApi createDSGroupsApi(String accessToken, String basePath) { + ApiClient apiClient = createApiClient(accessToken, basePath); + return new DsGroupsApi(apiClient); + } +} From 1c7e7bd9a165fca363af84009957d9c71363cdfa Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Thu, 3 Feb 2022 13:25:36 -0800 Subject: [PATCH 262/699] Work in progress --- JWT Console App/pom.xml | 42 ++++++++++++++----- .../main/java/com/docusign/JWTConsoleApp.java | 31 ++++++++++++-- 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/JWT Console App/pom.xml b/JWT Console App/pom.xml index a4d328c2..fe688227 100644 --- a/JWT Console App/pom.xml +++ b/JWT Console App/pom.xml @@ -25,12 +25,6 @@ 1.4 - - com.opencsv - opencsv - 4.6 - - org.apache.commons commons-math3 @@ -43,20 +37,48 @@ 3.15.0 + + commons-io + commons-io + 2.11.0 + + + org.apache.maven.plugins + maven-dependency-plugin + 2.1 + + + copy-dependencies + package + + copy-dependencies + + + C:\Src\Public\code-examples-java-private\JWT Console App\target\lib + false + false + true + + + + + org.apache.maven.plugins maven-jar-plugin - 3.1.0 + 2.4 - - docusign.jwtconsoleapp.JWTConsoleApp - + + true + lib/ + com.docusign.jwtconsoleapp.JWTConsoleApp + diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java index 4c1e00d1..ae807ada 100644 --- a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -1,17 +1,18 @@ -package docusign.jwtconsoleapp; +package com.docusign.jwtconsoleapp; -import com.opencsv.CSVReaderBuilder; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.math3.stat.StatUtils; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.auth.OAuth; +import com.docusign.esign.client.auth.OAuth.OAuthToken; import java.io.IOException; +import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; @@ -40,5 +41,27 @@ public static void main(String[] args) { String ccEmail = scanner. nextLine(); System.out.print("Enter the carbon copy's name: "); String ccName = scanner. nextLine(); + + try + { + ApiClient apiClient = new ApiClient(); + apiClient.setOAuthBasePath("account-d.docusign.com"); + ArrayList scopes = new ArrayList(); + scopes.add("signature"); + scopes.add("impersonation"); + byte[] privateKeyBytes = Files.readAllBytes(Paths.get("C:\\Src\\Public\\code-examples-csharp-private\\JWT-Console\\private.key")); + OAuthToken oAuthToken = apiClient.requestJWTUserToken( + "f2b6bea6-ca9e-414c-8102-56ec32a3074d", + "ee76c29e-9b6f-4b6e-896f-a0f95cd8e225", + scopes, + privateKeyBytes, + 3600); + System.out.print ("Got Token!!! "); + } + catch (Exception e) + { + System.out.print ("Error!!! "); + System.out.print (e.getMessage()); + } } } \ No newline at end of file From bf38386ee9d5185ba8b93f3ed24b1a4fcda17d54 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 8 Feb 2022 14:38:05 -0800 Subject: [PATCH 263/699] Work in progress... --- .gitignore | 1 + JWT Console App/app.config.example | 3 +++ .../main/java/com/docusign/JWTConsoleApp.java | 21 +++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 JWT Console App/app.config.example diff --git a/.gitignore b/.gitignore index aad69e3c..890ff2ec 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ src/main/java/com/docusign/admin/ # according to gitignore.io this shouldnt be shared .factorypath src/main/resources/ExportedUserData.csv +app.config \ No newline at end of file diff --git a/JWT Console App/app.config.example b/JWT Console App/app.config.example new file mode 100644 index 00000000..25f4225d --- /dev/null +++ b/JWT Console App/app.config.example @@ -0,0 +1,3 @@ +clientId={INTEGRATION_KEY_JWT} +userId={IMPERSONATED_USER_ID} +rsaKeyFile=private.key \ No newline at end of file diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java index ae807ada..fb87ecf3 100644 --- a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -11,12 +11,10 @@ import com.docusign.esign.client.auth.OAuth; import com.docusign.esign.client.auth.OAuth.OAuthToken; -import java.io.IOException; -import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Scanner; +import java.util.*; +import java.io.*; /** * Starter class for JWTConsoleApp application. @@ -32,7 +30,7 @@ public class JWTConsoleApp { public static void main(String[] args) { Scanner scanner = new Scanner(System. in); - System.out.print ("Welcome to the JWT Code example! "); + System.out.println ("Welcome to the JWT Code example! "); System.out.print("Enter the signer's email address: "); String signerEmail = scanner. nextLine(); System.out.print("Enter the signer's name: "); @@ -44,19 +42,24 @@ public static void main(String[] args) { try { + Properties prop = new Properties(); + String fileName = "app.config"; + FileInputStream fis = new FileInputStream(fileName); + prop.load(fis); ApiClient apiClient = new ApiClient(); apiClient.setOAuthBasePath("account-d.docusign.com"); ArrayList scopes = new ArrayList(); scopes.add("signature"); scopes.add("impersonation"); - byte[] privateKeyBytes = Files.readAllBytes(Paths.get("C:\\Src\\Public\\code-examples-csharp-private\\JWT-Console\\private.key")); + byte[] privateKeyBytes = Files.readAllBytes(Paths.get(prop.getProperty("rsaKeyFile"))); OAuthToken oAuthToken = apiClient.requestJWTUserToken( - "f2b6bea6-ca9e-414c-8102-56ec32a3074d", - "ee76c29e-9b6f-4b6e-896f-a0f95cd8e225", + prop.getProperty("clientId"), + prop.getProperty("userId"), scopes, privateKeyBytes, 3600); - System.out.print ("Got Token!!! "); + System.out.println ("Got Token!!! "); + System.out.println (oAuthToken.getAccessToken()); } catch (Exception e) { From bf86363149b1216a54dc45d0bf4f90407489df1a Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 8 Feb 2022 15:10:21 -0800 Subject: [PATCH 264/699] Removing unnecessary part of the pom.xml --- JWT Console App/pom.xml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/JWT Console App/pom.xml b/JWT Console App/pom.xml index fe688227..a00349f3 100644 --- a/JWT Console App/pom.xml +++ b/JWT Console App/pom.xml @@ -48,26 +48,6 @@ - org.apache.maven.plugins - maven-dependency-plugin - 2.1 - - - copy-dependencies - package - - copy-dependencies - - - C:\Src\Public\code-examples-java-private\JWT Console App\target\lib - false - false - true - - - - - org.apache.maven.plugins maven-jar-plugin From a508c46021ef2a9a194507e89e3648ccb96fcb8a Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 8 Feb 2022 16:09:21 -0800 Subject: [PATCH 265/699] making progress... --- .../main/java/com/docusign/JWTConsoleApp.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java index fb87ecf3..c5be3bbb 100644 --- a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -7,9 +7,18 @@ import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; +import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.auth.OAuth; import com.docusign.esign.client.auth.OAuth.OAuthToken; +import com.docusign.esign.client.auth.OAuth.UserInfo; +import com.docusign.esign.client.auth.OAuth.Account; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.CarbonCopy; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.Signer; +import com.docusign.esign.model.Tabs; import java.nio.file.Files; import java.nio.file.Paths; @@ -46,7 +55,7 @@ public static void main(String[] args) { String fileName = "app.config"; FileInputStream fis = new FileInputStream(fileName); prop.load(fis); - ApiClient apiClient = new ApiClient(); + ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi"); apiClient.setOAuthBasePath("account-d.docusign.com"); ArrayList scopes = new ArrayList(); scopes.add("signature"); @@ -58,8 +67,19 @@ public static void main(String[] args) { scopes, privateKeyBytes, 3600); - System.out.println ("Got Token!!! "); - System.out.println (oAuthToken.getAccessToken()); + String accessToken = oAuthToken.getAccessToken(); + UserInfo userInfo = apiClient.getUserInfo(accessToken); + String accountId = userInfo.getAccounts().get(0).getAccountId(); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setStatus("sent"); + + apiClient.addDefaultHeader("Authorization", "Bearer " + accessToken); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + + envelopesApi.createEnvelope(accountId, envelope); + } catch (Exception e) { From 3e72a534ca7d47e53d26ec887ac3d11b878b058a Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 8 Feb 2022 16:23:48 -0800 Subject: [PATCH 266/699] Finishing this project --- .../main/java/com/docusign/JWTConsoleApp.java | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java index c5be3bbb..28d9eb07 100644 --- a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -14,9 +14,11 @@ import com.docusign.esign.client.auth.OAuth.UserInfo; import com.docusign.esign.client.auth.OAuth.Account; import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Document; import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.Recipients; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; @@ -51,10 +53,12 @@ public static void main(String[] args) { try { + // Get information fro app.config Properties prop = new Properties(); String fileName = "app.config"; FileInputStream fis = new FileInputStream(fileName); prop.load(fis); + // Get access token and accountId ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi"); apiClient.setOAuthBasePath("account-d.docusign.com"); ArrayList scopes = new ArrayList(); @@ -71,15 +75,38 @@ public static void main(String[] args) { UserInfo userInfo = apiClient.getUserInfo(accessToken); String accountId = userInfo.getAccounts().get(0).getAccountId(); + // Create envelopeDefinition object EnvelopeDefinition envelope = new EnvelopeDefinition(); envelope.setEmailSubject("Please sign this document set"); envelope.setStatus("sent"); + // Set recipients + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.recipientId("1"); + CarbonCopy cc = new CarbonCopy(); + cc.setEmail(ccEmail); + cc.setName(ccName); + cc.recipientId("2"); + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + recipients.setCarbonCopies(Arrays.asList(cc)); + envelope.setRecipients(recipients); + + // Add document + Document document = new Document(); + document.setDocumentBase64("VGhhbmtzIGZvciByZXZpZXdpbmcgdGhpcyEKCldlJ2xsIG1vdmUgZm9yd2FyZCBhcyBzb29uIGFzIHdlIGhlYXIgYmFjay4="); + document.setName("doc1.txt"); + document.setFileExtension("txt"); + document.setDocumentId("1"); + envelope.setDocuments(Arrays.asList(document)); + + // Send envelope apiClient.addDefaultHeader("Authorization", "Bearer " + accessToken); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - - envelopesApi.createEnvelope(accountId, envelope); - + EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); + System.out.println("Successfully sent envelope with envelopeId " + results.getEnvelopeId()); } catch (Exception e) { From 34e409d1c4b12882b70bcfa366efe1d0e81e0bc3 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 9 Feb 2022 09:44:19 -0800 Subject: [PATCH 267/699] Finishing touch, adding the tab --- .../src/main/java/com/docusign/JWTConsoleApp.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java index 28d9eb07..11b84e68 100644 --- a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -21,6 +21,7 @@ import com.docusign.esign.model.Recipients; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; +import com.docusign.esign.model.SignHere; import java.nio.file.Files; import java.nio.file.Paths; @@ -80,11 +81,20 @@ public static void main(String[] args) { envelope.setEmailSubject("Please sign this document set"); envelope.setStatus("sent"); + // Create tabs object + SignHere signHere = new SignHere(); + signHere.setDocumentId("1"); + signHere.setPageNumber("1"); + signHere.setXPosition("191"); + signHere.setYPosition("148"); + Tabs tabs = new Tabs(); + tabs.setSignHereTabs(Arrays.asList(signHere)); // Set recipients Signer signer = new Signer(); signer.setEmail(signerEmail); signer.setName(signerName); signer.recipientId("1"); + signer.setTabs(tabs); CarbonCopy cc = new CarbonCopy(); cc.setEmail(ccEmail); cc.setName(ccName); From 9649dc3d5416097f40c9f690f26d5b71aaf66f3f Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Thu, 10 Feb 2022 13:55:05 -0800 Subject: [PATCH 268/699] Adding consent check and popup of consent dialog. --- .../main/java/com/docusign/JWTConsoleApp.java | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java index 11b84e68..7f8f0f4b 100644 --- a/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java +++ b/JWT Console App/src/main/java/com/docusign/JWTConsoleApp.java @@ -27,6 +27,8 @@ import java.nio.file.Paths; import java.util.*; import java.io.*; +import java.awt.Desktop; +import java.net.URI; /** * Starter class for JWTConsoleApp application. @@ -34,12 +36,13 @@ public class JWTConsoleApp { + static String DevCenterPage = "https://developers.docusign.com/platform/auth/consent"; /** * Application entry point. * * @param args application command line arguments */ - public static void main(String[] args) { + public static void main(String[] args) throws java.io.IOException { Scanner scanner = new Scanner(System. in); System.out.println ("Welcome to the JWT Code example! "); @@ -52,13 +55,13 @@ public static void main(String[] args) { System.out.print("Enter the carbon copy's name: "); String ccName = scanner. nextLine(); + // Get information fro app.config + Properties prop = new Properties(); + String fileName = "app.config"; + FileInputStream fis = new FileInputStream(fileName); + prop.load(fis); try { - // Get information fro app.config - Properties prop = new Properties(); - String fileName = "app.config"; - FileInputStream fis = new FileInputStream(fileName); - prop.load(fis); // Get access token and accountId ApiClient apiClient = new ApiClient("https://demo.docusign.net/restapi"); apiClient.setOAuthBasePath("account-d.docusign.com"); @@ -118,6 +121,22 @@ public static void main(String[] args) { EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); System.out.println("Successfully sent envelope with envelopeId " + results.getEnvelopeId()); } + catch (ApiException exp) + { + if (exp.getMessage().contains("consent_required")) + { + try + { + System.out.println ("Consent required, please provide consent in browser window and then run this app again."); + Desktop.getDesktop().browse(new URI("https://account-d.docusign.com/oauth/auth?response_type=code&scope=impersonation%20signature&client_id=" + prop.getProperty("clientId") + "&redirect_uri=" + DevCenterPage)); + } + catch (Exception e) + { + System.out.print ("Error!!! "); + System.out.print (e.getMessage()); + } + } + } catch (Exception e) { System.out.print ("Error!!! "); From da8b5330352c8aef652433964aa4f9d6ca68122d Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Mon, 7 Mar 2022 16:02:11 -0800 Subject: [PATCH 269/699] Edited eSign18 text --- .../templates/views/pages/esignature/examples/eg018.jsp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index d49f8c27..51296439 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -31,7 +31,7 @@

The last envelope you created with this example launcher will be queried. - Recommendation: use example 9, then this example, since example 9 includes many tabs of different types. + Recommendation: Create an envelope using example 16 then use this example in order to see an example of custom tab values.

@@ -39,8 +39,7 @@
-

Problem: please first create an envelope using example 9.
- Thank you.

+

Problem: Please first create an envelope using example 16.

From c1954b2eda72c7818d26ab38da451a744654e3f8 Mon Sep 17 00:00:00 2001 From: MattLusher Date: Mon, 7 Mar 2022 20:16:32 -0500 Subject: [PATCH 270/699] Updates to index pages (#37) Co-authored-by: Matthew Lusher Co-authored-by: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> --- .../templates/views/pages/click/index.jsp | 1 + .../views/pages/esignature/index.jsp | 197 ++++++++++-------- .../templates/views/pages/monitor/index.jsp | 2 +- .../templates/views/pages/rooms/index.jsp | 2 +- 4 files changed, 111 insertions(+), 91 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index bf65722a..e5ac4ffc 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -25,6 +25,7 @@

Documentation on using OAuth Authorization Code Grant from a Java application.

+

Click examples

1. Create a clickwrap

Creates a clickwrap that you can embed in your website or app.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 75b4f68c..fecd7d96 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -8,8 +8,10 @@
-

Java Launcher

-

Run and explore eSignature REST API code examples with Authorization Code Grant or JWT Grant authentication

+ +

DocuSign Code Launcher: Java

+

This launcher both demonstrates use of Authorization Code Grant and JWT OAuth flows and includes multiple usage examples for the DocuSign eSignature REST API.

+
@@ -34,18 +36,19 @@ %> - +

Documentation on using OAuth Authorization Code Grant from a Java application.

-

Basic examples

+ +

Basic examples

1. Use embedded signing

-

This example sends an envelope, and then uses embedded signing for the first signer. - With embedded signing, the DocuSign signing is initiated from your website. +

This example sends an envelope and then uses embedded signing for the first signer. + With embedded signing, the DocuSign signing experience is initiated from your website.

API methods used: Envelopes::create and @@ -53,7 +56,7 @@

2. Send an envelope with a remote (email) signer and cc recipient

-

The envelope includes a pdf, Word, and HTML document. Anchor text +

The envelope includes three documents: one each in PDF, Word, and HTML format. Anchor text (AutoPlace) is used to position the signing fields in the documents.

@@ -61,39 +64,39 @@ Envelopes::create.

-

3. List envelopes in the user's account

-

List the envelopes created in the last 30 days. +

3. List envelopes whose status has changed

+

This example lists the envelopes whose status has changed within the last 30 days.

API method used: Envelopes::listStatusChanges.

4. Get an envelope's basic information and status

-

List the basic information about an envelope, including its overall status. +

This example lists the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the - envelope, its documents, recipients, etc. + envelope, its documents, recipients, and more.

API method used: Envelopes::get.

5. List an envelope's recipients and their status

-

List the envelope's recipients, including their current status. +

This example lists the envelope's recipients, including their current status.

API method used: EnvelopeRecipients::list.

6. List an envelope's documents

-

List the envelope's documents. A Certificate of Completion document - is also associated with every envelope. +

This example demonstrates how to list an envelope's documents. A Certificate of Completion document + is also associated with every envelope.

API method used: EnvelopeDocuments::list.

7. Download a document from an envelope

-

An envelope's documents can be downloaded one by one or as a complete set. +

This example demonstrates how to download a document from a given envelope. An envelope's documents can be downloaded one by one or as a complete set.

API method used: EnvelopeDocuments::get. @@ -102,45 +105,42 @@

8. Create a template

Create a template with two roles, signer and cc.

API methods used: - Templates::list, + Templates::list and Templates::create.

9. Send an envelope using a template

-

The envelope is defined by the template. - The signer and cc recipient name and email are used to fill in the template's roles.

+

This example demonstrates a common pattern for DocuSign integrations: envelopes will be sent programmatically, defined by a template. The signer and cc recipient name and email are used to fill in the template's roles.

API method used: Envelopes::create.

10. Send an envelope using binary document transfer

-

The envelope includes a pdf, Word, and HTML document.

+

The envelope includes three documents: one each in PDF, Word, and HTML format.

Multipart data transfer is used to send the documents in binary format to DocuSign. - Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. - Binary transfer is not yet supported by the SDK. + Binary transfer is 33% more efficient than Base64 encoding and is recommended for documents over 15 MB. Binary transfer is not yet supported by the SDK.

API method used: Envelopes::create.

11. Use embedded sending

-

An envelope will be created in draft mode. The DocuSign - web tool (NDSE) will then be shown, enabling further updates - to the envelope before it is sent. +

This example demonstrates how to embed the DocuSign sender view within your web app. An envelope will be created in draft mode. + Your browser will then be redirected to the DocuSign UI, where the envelope can be (optionally) updated and then sent.

API methods used: - Envelopes::create, + Envelopes::create and EnvelopeViews::createSender. -

12. Embedded DocuSign web tool

-

Redirect the user to the DocuSign web tool.

+

12. Embed the DocuSign UI

+

This example demonstrates how to embed the DocuSign UI in your app. Use this API call to open the DocuSign UI with the user + already logged in.

API method used: EnvelopeViews::createConsole.

13. Use embedded signing from a template with an added document

-

This example sends an envelope based on a template.

-

In addition to the template's document(s), the example adds an +

This example sends an envelope based on a template. In addition to the template's document(s), the example adds an additional document to the envelope by using the Composite Templates feature.

@@ -149,7 +149,7 @@ EnvelopeViews::createRecipient.

-

Payments

+

Payments Example

14. Send an envelope with an order form and payment field

Anchor text @@ -160,130 +160,157 @@ Envelopes::create.

-

Tabs

+ +

Tabs examples

15. Get the tab data from an envelope

-

This example retrieves the tab (field) values from an envelope.

+

This example retrieves the tab (field) values from an + envelope for all of the envelope's recipients.

API method used: EnvelopeFormData::get.

16. Set tab values for an envelope

-

This example sets the tab (field) values for an envelope including tabs that can and cannot be changed by the signer.

+

This example sets the tab (field) values for an envelope, including tabs that can and cannot be changed by the signer.

- API method used: + API methods used: Envelopes::create and EnvelopeViews::createRecipient.

17. Set template tab values

-

This example sets the tab (field) values for a template being used by an envelope.

+

This example sets the tab (field) values for a template being used by an envelope. It includes setting radio button and checkbox tabs.

- API method used: + API methods used: Envelopes::create and EnvelopeViews::createRecipient.

18. List envelope custom metadata field values

-

This example lists the envelope's custom metadata field values.

+

This example lists an envelope's custom metadata field values.

API method used: EnvelopeCustomFields::list.

-

Recipient authentication

-

19. Require access code authentication for a recipient

-

Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

+

19. Send an envelope with access code authentication

+

This example sends an envelope requiring the recipient to enter an access code for multifactor authentication.

+

API method used: + Envelopes::create. +

+ +

20. Send an envelope with SMS authentication

+

This example sends an envelope requiring the recipient enter a code received via an SMS message for multifactor authentication.

API method used: Envelopes::create.

-

20. Require phone authentication for a recipient

-

Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

+ +

21. Send an envelope with phone authentication

+

This example sends an envelope requiring the recipient enter a code received via a telephone call for multifactor authentication.

API method used: Envelopes::create.

-

22. Require knowledge-based authentication (KBA) for a recipient

-

Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

+ +

22. Send an envelope with knowledge-based authentication (KBA)

+

This example sends an envelope requiring the recipient answer multiple-choice, public records–based questions for multifactor authentication.

+

API method used: Envelopes::create.

-

23. Require ID verification (IDV) for a recipient

-

Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

+ +

23. Send an envelope with ID verification (IDV) authentication

+

This example sends an envelope requiring the recipient authenticate themselves by electronically presenting a government-issued identification (such as a passport, driver's license, or e-ID).

+

- API method used: - Envelopes::create. + API methods used: + Accounts::getAccountIdentityVerificationsList + and Envelopes::create.

Permissions

-

24. Create a new permission profile

+

24. Create a permission profile

+ +

+ This example creates a user group’s permission profile. +

API method used: AccountPermissionProfiles::create.

-

25. Setting a permission profile

-

This example allows you to set a permission profile on an existing user group.

+

25. Set a permission profile

+

This example updates the group name and modifies, or sets, the permission profile for the group.

API method used: Groups::update.

-

26. Updating individual permission profile settings

-

- This example will update individual permission settings for a given account. + +

26. Update individual permission profile settings

+ +

This example updates an individual setting on a user group’s permission profile. +

API method used: AccountPermissionProfiles::update.

-

27. Deleting a permission profile

-

This example lists all available permissions profiles and allows you to delete any without associated users. Please note that you cannot remove "Everyone" nor "Administrator" permission profiles.

+

27. Delete a permission profile

+

This example lists all available permissions profiles and allows you to delete any without associated users. Note: You cannot remove "Everyone" nor "Administrator" permission profiles.

API method used: AccountPermissionProfiles::create.

- + +

Brands

- +

28. Create a brand

-

This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

+

This example creates an account brand that can be used to apply customization to your envelopes, including your own logo, colors, and text elements.

API method used: AccountBrands::create.

-

29. Applying a brand to an envelope

-

This example will show you how to create an envelope using any of the created brands on your account.

+

29. Apply a brand to an envelope

+

This example creates an envelope using any of the created brands on your account.

API method used: Envelopes::create.

-

30. Applying a brand to a template

-

This example will show you how to create an envelope using a brand

+

30. Apply a brand and template to an envelope

+

This example creates an envelope from a template while applying any of the created brands on your account.

API method used: Envelopes::create.

Bulk operations

-

31. Bulk send envelopes

- Demonstrates how to send envelopes in bulk to multiple recipients. First, this example - creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk - envelope sending. -

-

- API methods used: - BulkSend::createBulkSendList, - Envelopes::create, - EnvelopeCustomFields::create, - BulkSend::createBulkSendRequest, - BulkSend::getBulkSendBatchStatus. + This example creates and sends an envelope to multiple recipients using bulk lists. +

API methods used: + Envelopes::create, + EnvelopeCustomFields::create, + EnvelopeRecipients::create, + BulkSend::createBulkSendList, + BulkSend::createBulkSendRequest, + and + BulkSend::getBulkSendBatchStatus +

Advanced recipient routing

@@ -291,11 +318,7 @@

32. Pause a signature workflow

- This topic demonstrates how to create an envelope where the workflow is paused before the - envelope is sent to a second recipient. For information on resuming a workflow see - - How to unpause a signature workflow - . + This example creates an envelope where the workflow is paused before the envelope is sent to a second recipient.

API methods used: @@ -305,11 +328,7 @@

33. Unpause a signature workflow

- This topic demonstrates how to resume an envelope workflow that has been paused. - For information on creating an envelope with a paused workflow, see - - How to pause a signature workflow - . + This example resumes a signature workflow for an envelope whose workflow has been paused.

API methods used: @@ -319,8 +338,7 @@

34. Use conditional recipients

- This topic demonstrates how to create an envelope where the workflow is routed to - different recipients based on the value of a transaction. + This example creates an envelope whose workflow routes it to different recipients based on the value of a transaction.

API methods used: @@ -329,10 +347,10 @@

Premium features

-

35. Send with SMS Delivery

+

35. Send an envelope by SMS delivery

- This topic demonstrates how to send an envelope using SMS delivery. + This example demonstrates how to send an envelope via an SMS message for a signer (and CC) to read and sign.

API methods used: @@ -346,3 +364,4 @@ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 543688f6..1d9b9295 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -23,7 +23,7 @@

Documentation on using OAuth Authorization Code Grant from a Java application.

-

Monitor API Code Examples

+

Monitor API Code examples

1. Get monitoring data

Demonstrates how to get and display all of your organization's monitoring data.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp index 6ec29119..4d3e40a6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp @@ -27,7 +27,7 @@

Documentation on using OAuth Authorization Code Grant from a Java application.

-

Rooms Examples

+

Rooms examples

1. Creating a room with data

This example demonstrates creating a DocuSign room. From d8601b6f0a1c037c04c40965fe2a16ac8df443a9 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 10 Mar 2022 12:45:19 -0800 Subject: [PATCH 271/699] Devdocs 6730 & 6972 - DR/SS & SMS updates (#51) * UI base & move ex35 to ex37 * add in eSignature index link/desc. from python * finished controller updates, bumped up DS SDK versions * small template fixes * small bit of padding on bottom for smaller screens * fixed working code * DEVDOCS-6972 updates for SMS delivery * link fixes on index.jsp * tab placement on DR and example titles updated to match PHP * revert the overwrite from merging internal repos * small fixes * small typo * roll back eSignature index page updates * update launcher text * remove "sending" * replace curly apostrophe with straight * gist markers Co-authored-by: meihDS <70775251+meihDS@users.noreply.github.com> --- pom.xml | 23 +- .../com/docusign/common/WorkArguments.java | 2 + .../EG035ControllerScheduledSending.java | 145 +++++++++++ .../EG036ControllerDelayedRouting.java | 161 +++++++++++++ ...y.java => EG037ControllerSMSDelivery.java} | 53 ++-- .../eSignature/examples/EnvelopeHelpers.java | 12 + .../views/pages/esignature/examples/eg035.jsp | 80 ++----- .../views/pages/esignature/examples/eg036.jsp | 56 +++++ .../views/pages/esignature/examples/eg037.jsp | 67 ++++++ .../views/pages/esignature/index.jsp | 226 +++++++++--------- 10 files changed, 620 insertions(+), 205 deletions(-) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java rename src/main/java/com/docusign/controller/eSignature/examples/{EG035ControllerSMSDelivery.java => EG037ControllerSMSDelivery.java} (77%) create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp diff --git a/pom.xml b/pom.xml index edd505e8..54e9fcab 100644 --- a/pom.xml +++ b/pom.xml @@ -20,10 +20,11 @@ 11 2.5.2 2.11.0 - 3.15.0-RC1 - 1.1.0-RC1 + 3.17.1 + 1.1.0 1.0.0-BETA 1.0.0-BETA + 1.0.0-BETA @@ -109,7 +110,7 @@ com.docusign docusign-admin-java - 1.0.0-BETA + ${admin.version} @@ -132,4 +133,20 @@ + + + + + + + + + org.bouncycastle + bcprov-jdk15on + 1.69 + + + + + \ No newline at end of file diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index 00222333..0a625591 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -64,4 +64,6 @@ public class WorkArguments { private String eSignProfileId; private UUID eSignProductId; private UUID dsGroupId; + private String resumeDate; + private String delay; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java new file mode 100644 index 00000000..bfaf4d2f --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java @@ -0,0 +1,145 @@ +package com.docusign.controller.eSignature.examples; + +import java.io.IOException; +import java.util.Arrays; + +import javax.servlet.http.HttpServletResponse; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeDelayRuleApiModel; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.ScheduledSendingApiModel; +import com.docusign.esign.model.Signer; +import com.docusign.esign.model.Tabs; +import com.docusign.esign.model.Workflow; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + + +/** + * Send an envelope with a remote (email) signer and cc recipient.
+ * The envelope includes a pdf, Word, and HTML document. Anchor text is used to + * position the signing fields in the documents. + */ +@Controller +@RequestMapping("/eg035") +public class EG035ControllerScheduledSending extends AbstractEsignatureController { + + + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + + private final Session session; + private final User user; + + @Autowired + public EG035ControllerScheduledSending(DSConfiguration config, Session session, User user) { + super(config, "eg035", "Schedule an Envelope"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + // Set status for the makeEnvelope method + if (!EnvelopeHelpers.ENVELOPE_STATUS_CREATED.equalsIgnoreCase(args.getStatus())) { + args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } + + EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + + + System.out.println("RESUMEDATE"); + System.out.println(args.getResumeDate()+"T00:00:00Z"); + + EnvelopeDefinition envelope = makeEnvelope(args); + + + // Step 3 start + EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + // Step 3 end + + System.out.println("ENVELOPE"); + System.out.println(results.getEnvelopeId()); + + // process results + session.setEnvelopeId(results.getEnvelopeId()); + DoneExample.createDefault(title) + .withMessage("The envelope has been created and sent!
Envelope ID " + + results.getEnvelopeId() + ".") + .withJsonObject(results) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + // document 1 (PDF) has sign here anchor tag /sn1/ + // + // The envelope has one recipient. + // recipient 1 - signer + + // create the envelope definition + + public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. + + // Step 2 start + + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + + // The order in the docs array determines the order in the envelope + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "1"))); + envelope.setRecipients(EnvelopeHelpers.createSingleRecipient(signer)); + + // Add the workflow to schedule the envelope with a delay + EnvelopeDelayRuleApiModel delayRule = new EnvelopeDelayRuleApiModel(); + + delayRule.setResumeDate(args.getResumeDate()+"T00:00:00Z"); + + ScheduledSendingApiModel scheduledSendingApiModel = new ScheduledSendingApiModel(); + scheduledSendingApiModel.setRules(Arrays.asList(delayRule)); + + Workflow workflow = new Workflow(); + workflow.setScheduledSending(scheduledSendingApiModel); + envelope.setWorkflow(workflow); + + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(args.getStatus()); + + return envelope; + + // Step 2 end + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java new file mode 100644 index 00000000..4e5fabdb --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java @@ -0,0 +1,161 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.DelayedRoutingApiModel; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeDelayRuleApiModel; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.Signer; +import com.docusign.esign.model.Tabs; +import com.docusign.esign.model.Workflow; +import com.docusign.esign.model.WorkflowStep; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import java.io.IOException; +import java.util.Arrays; + +import javax.servlet.http.HttpServletResponse; + + +/** + * Send an envelope with a remote (email) signer and cc recipient.
+ * The envelope includes a pdf, Word, and HTML document. Anchor text is used to + * position the signing fields in the documents. + */ +@Controller +@RequestMapping("/eg036") +public class EG036ControllerDelayedRouting extends AbstractEsignatureController { + + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + private static final int ANCHOR_OFFSET_X_2 = 120; + + private final Session session; + private final User user; + + @Autowired + public EG036ControllerDelayedRouting(DSConfiguration config, Session session, User user) { + super(config, "eg036", "Send an envelope with delayed routing"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + // Set status for the makeEnvelope method + if (!EnvelopeHelpers.ENVELOPE_STATUS_CREATED.equalsIgnoreCase(args.getStatus())) { + args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } + + EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + + EnvelopeDefinition envelope = makeEnvelope(args); + + // Step 3 start + EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + // Step 3 end + + + // process results + session.setEnvelopeId(results.getEnvelopeId()); + DoneExample.createDefault(title) + .withMessage("The envelope has been created and sent!
Envelope ID " + + results.getEnvelopeId() + ".") + .withJsonObject(results) + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } + + // document 1 (docx) has tag /sn1/ + // document 2 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. After it is signed, + // a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. So the signHere2 tab will be used in + // both document 2 and 3 since they use the same anchor string for + // their "signer 1" tabs. + + // Step 2 start + + Tabs signer1Tabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + Tabs signer2Tabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X_2)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signer1Tabs); + + Signer signer2 = new Signer(); + signer2.setEmail(args.getSignerEmail2()); + signer2.setName(args.getSignerName2()); + signer2.setRecipientId("2"); + signer2.setRoutingOrder("2"); + signer2.setTabs(signer2Tabs); + + // The order in the docs array determines the order in the envelope + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); + envelope.setRecipients(EnvelopeHelpers.createTwoSigners(signer, signer2)); + + // Add the workflow to delay the second recipient + + String delay = args.getDelay() + ":00:00"; + EnvelopeDelayRuleApiModel rule = new EnvelopeDelayRuleApiModel(); + rule.setDelay(delay); + + DelayedRoutingApiModel delayedRouting = new DelayedRoutingApiModel(); + delayedRouting.setRules(Arrays.asList(rule)); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction("pause_before"); + workflowStep.setTriggerOnItem("routing_order"); + workflowStep.setItemId("2"); + workflowStep.setStatus("pending"); + workflowStep.setDelayedRouting(delayedRouting); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Arrays.asList(workflowStep)); + envelope.setWorkflow(workflow); + + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(args.getStatus()); + + return envelope; + + // Step 2 end + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java similarity index 77% rename from src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java rename to src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java index 2c9fe378..10076453 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java @@ -32,11 +32,10 @@ * position the signing fields in the documents. */ @Controller -@RequestMapping("/eg035") -public class EG035ControllerSMSDelivery extends AbstractEsignatureController { +@RequestMapping("/eg037") +public class EG037ControllerSMSDelivery extends AbstractEsignatureController { + - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; @@ -48,8 +47,8 @@ public class EG035ControllerSMSDelivery extends AbstractEsignatureController { private final User user; @Autowired - public EG035ControllerSMSDelivery(DSConfiguration config, Session session, User user) { - super(config, "eg035", "Signing request by email"); + public EG037ControllerSMSDelivery(DSConfiguration config, Session session, User user) { + super(config, "eg037", "Send an email with SMS delivery"); this.session = session; this.user = user; } @@ -77,7 +76,6 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - // document 1 (html) has tag **signature_1** // document 2 (docx) has tag /sn1/ // document 3 (pdf) has tag /sn1/ // @@ -92,53 +90,42 @@ public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOExcep // both document 2 and 3 since they use the same anchor string for // their "signer 1" tabs. Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); // Create a signer recipient to sign the document, identified by name - // and email. We're setting the parameters via the object creation. + // and phone number. We're setting the parameters via the object creation. // RoutingOrder (lower means earlier) determines the order of deliveries // to the recipients. Parallel routing order is supported by using the // same integer as the order for two or more recipients. + + RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); + phoneNumber.setCountryCode(args.getCountryCode()); + phoneNumber.setNumber(args.getPhoneNumber()); + Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); signer.setName(args.getSignerName()); + signer.setPhoneNumber(phoneNumber); signer.setRecipientId("1"); signer.setRoutingOrder("1"); signer.setTabs(signerTabs); - RecipientAdditionalNotification smsDelivery = new RecipientAdditionalNotification(); - smsDelivery.setSecondaryDeliveryMethod("SMS"); - RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); - phoneNumber.setCountryCode(args.getCountryCode()); - phoneNumber.setNumber(args.getPhoneNumber()); - smsDelivery.phoneNumber(phoneNumber); - signer.setAdditionalNotifications(Arrays.asList(smsDelivery)); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRecipientId("2"); - cc.setRoutingOrder("2"); - - RecipientAdditionalNotification ccSmsDelivery = new RecipientAdditionalNotification(); - ccSmsDelivery.setSecondaryDeliveryMethod("SMS"); - + // create a cc recipient to receive a copy of the documents, identified by name and phone number RecipientPhoneNumber ccPhoneNumber = new RecipientPhoneNumber(); ccPhoneNumber.setCountryCode(args.getCcCountryCode()); ccPhoneNumber.setNumber(args.getCcPhoneNumber()); - ccSmsDelivery.phoneNumber(ccPhoneNumber); - cc.setAdditionalNotifications(Arrays.asList(ccSmsDelivery)); + + CarbonCopy cc = new CarbonCopy(); + cc.setName(args.getCcName()); + cc.setPhoneNumber(ccPhoneNumber); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + // The order in the docs array determines the order in the envelope - byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); EnvelopeDefinition envelope = new EnvelopeDefinition(); envelope.setEmailSubject("Please sign this document set"); envelope.setDocuments(Arrays.asList( - EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, - DocumentType.HTML.getDefaultFileExtention(), "1"), EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java index 1e25c3f8..48faef48 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java @@ -197,4 +197,16 @@ static Recipients createRecipients(Signer signer, CarbonCopy cc) { recipients.setCarbonCopies(Arrays.asList(cc)); return recipients; } + + public static Recipients createSingleRecipient(Signer signer) { + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + return recipients; + } + + public static Recipients createTwoSigners(Signer signer, Signer signer2) { + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer, signer2)); + return recipients; + } } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp index 3b30bb7d..7f5f06d1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp @@ -1,77 +1,45 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

2. Send an envelope via SMS delivery

-

The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

-

This is a general example of creating and sending an envelope (a signing request) to a recipient and notifying that recipient with an SMS message..

+

35. Schedule an envelope

+

Demonstrates how to schedule an envelope using the scheduled sending feature.

+ -

Documentation about this example.

+

Documentation about this example.

-

API method used: - Envelopes::create. + +

API method used: + Envelopes::create.

- View source file ${sourceFile} on GitHub. + View source file ${sourceFile} on GitHub.

- -
- - The country code for the phone number below. -
-
- - - We'll never share your phone number with anyone else. -
-
- - - We'll never share your email with anyone else. -
-
- - -
-
- - The country code for the phone number below. -
- - - We'll never share your phone number with anyone else. + + + We'll never share your email with anyone else.
- - - The email and/or name for the cc recipient must be different - from the signer. - + +
- - + + + Please choose a date in the future.
- + - + +
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp new file mode 100644 index 00000000..c55c1b5c --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp @@ -0,0 +1,56 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

36. Send an envelope with delayed routing

+

Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature.

+ + +

Documentation about this example.

+
+ + +

API method used: + Envelopes::create. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ +
+
+ + + We'll never share your email with anyone else. +
+
+ + +
+
+ + + The email for the cc recipient must be different from the signer's email. +
+
+ + +
+
+ + +
+ + +
+
+
+
+ + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp new file mode 100644 index 00000000..f5474099 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp @@ -0,0 +1,67 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

37. Send an envelope via SMS delivery

+

The envelope includes a pdf, Word, and HTML document. Anchor text + (AutoPlace) + is used to position the signing fields in the documents. +

+

This is a general example of creating and sending an envelope (a signing request) to a recipient and notifying that recipient with an SMS message..

+ +

Documentation about this example.

+
+ +

API method used: + Envelopes::create. +

+ +

+ View source file ${sourceFile} on GitHub. +

+ +
+ +
+ + + The country code for the phone number below. +
+
+ + + We'll never share your phone number with anyone else. +
+
+ + +
+
+ + + The country code for the phone number below. +
+
+ + + We'll never share your phone number with anyone else. +
+
+ + +
+ + +
+ +
+
+
+ + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index fecd7d96..c0d03885 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -8,10 +8,8 @@
- -

DocuSign Code Launcher: Java

-

This launcher both demonstrates use of Authorization Code Grant and JWT OAuth flows and includes multiple usage examples for the DocuSign eSignature REST API.

- +

Java Launcher

+

Run and explore eSignature REST API code examples with Authorization Code Grant or JWT Grant authentication

@@ -27,8 +25,6 @@ <% - - // New location to be redirected String site = new String("/eg001"); response.setStatus(response.SC_MOVED_TEMPORARILY); @@ -36,19 +32,18 @@ %> - +

Documentation on using OAuth Authorization Code Grant from a Java application.

- -

Basic examples

+

1. Use embedded signing

-

This example sends an envelope and then uses embedded signing for the first signer. - With embedded signing, the DocuSign signing experience is initiated from your website. +

This example sends an envelope, and then uses embedded signing for the first signer. + With embedded signing, the DocuSign signing is initiated from your website.

API methods used: Envelopes::create and @@ -56,7 +51,7 @@

2. Send an envelope with a remote (email) signer and cc recipient

-

The envelope includes three documents: one each in PDF, Word, and HTML format. Anchor text +

The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents.

@@ -64,39 +59,39 @@ Envelopes::create.

-

3. List envelopes whose status has changed

-

This example lists the envelopes whose status has changed within the last 30 days. +

3. List envelopes in the user's account

+

List the envelopes created in the last 30 days.

API method used: Envelopes::listStatusChanges.

4. Get an envelope's basic information and status

-

This example lists the basic information about an envelope, including its overall status. +

List the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the - envelope, its documents, recipients, and more. + envelope, its documents, recipients, etc.

API method used: Envelopes::get.

5. List an envelope's recipients and their status

-

This example lists the envelope's recipients, including their current status. +

List the envelope's recipients, including their current status.

API method used: EnvelopeRecipients::list.

6. List an envelope's documents

-

This example demonstrates how to list an envelope's documents. A Certificate of Completion document - is also associated with every envelope. +

List the envelope's documents. A Certificate of Completion document + is also associated with every envelope.

API method used: EnvelopeDocuments::list.

7. Download a document from an envelope

-

This example demonstrates how to download a document from a given envelope. An envelope's documents can be downloaded one by one or as a complete set. +

An envelope's documents can be downloaded one by one or as a complete set.

API method used: EnvelopeDocuments::get. @@ -105,42 +100,45 @@

8. Create a template

Create a template with two roles, signer and cc.

API methods used: - Templates::list and + Templates::list, Templates::create.

9. Send an envelope using a template

-

This example demonstrates a common pattern for DocuSign integrations: envelopes will be sent programmatically, defined by a template. The signer and cc recipient name and email are used to fill in the template's roles.

+

The envelope is defined by the template. + The signer and cc recipient name and email are used to fill in the template's roles.

API method used: Envelopes::create.

10. Send an envelope using binary document transfer

-

The envelope includes three documents: one each in PDF, Word, and HTML format.

+

The envelope includes a pdf, Word, and HTML document.

Multipart data transfer is used to send the documents in binary format to DocuSign. - Binary transfer is 33% more efficient than Base64 encoding and is recommended for documents over 15 MB. Binary transfer is not yet supported by the SDK. + Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. + Binary transfer is not yet supported by the SDK.

API method used: Envelopes::create.

11. Use embedded sending

-

This example demonstrates how to embed the DocuSign sender view within your web app. An envelope will be created in draft mode. - Your browser will then be redirected to the DocuSign UI, where the envelope can be (optionally) updated and then sent. +

An envelope will be created in draft mode. The DocuSign + web tool (NDSE) will then be shown, enabling further updates + to the envelope before it is sent.

API methods used: - Envelopes::create and + Envelopes::create, EnvelopeViews::createSender. -

12. Embed the DocuSign UI

-

This example demonstrates how to embed the DocuSign UI in your app. Use this API call to open the DocuSign UI with the user - already logged in.

+

12. Embedded DocuSign web tool

+

Redirect the user to the DocuSign web tool.

API method used: EnvelopeViews::createConsole.

13. Use embedded signing from a template with an added document

-

This example sends an envelope based on a template. In addition to the template's document(s), the example adds an +

This example sends an envelope based on a template.

+

In addition to the template's document(s), the example adds an additional document to the envelope by using the Composite Templates feature.

@@ -149,7 +147,7 @@ EnvelopeViews::createRecipient.

-

Payments Example

+

Payments

14. Send an envelope with an order form and payment field

Anchor text @@ -160,157 +158,130 @@ Envelopes::create.

- -

Tabs examples

+

Tabs

15. Get the tab data from an envelope

-

This example retrieves the tab (field) values from an - envelope for all of the envelope's recipients.

+

This example retrieves the tab (field) values from an envelope.

API method used: EnvelopeFormData::get.

16. Set tab values for an envelope

-

This example sets the tab (field) values for an envelope, including tabs that can and cannot be changed by the signer.

+

This example sets the tab (field) values for an envelope including tabs that can and cannot be changed by the signer.

- API methods used: + API method used: Envelopes::create and EnvelopeViews::createRecipient.

17. Set template tab values

-

This example sets the tab (field) values for a template being used by an envelope. It includes setting radio button and checkbox tabs.

+

This example sets the tab (field) values for a template being used by an envelope.

- API methods used: + API method used: Envelopes::create and EnvelopeViews::createRecipient.

18. List envelope custom metadata field values

-

This example lists an envelope's custom metadata field values.

+

This example lists the envelope's custom metadata field values.

API method used: EnvelopeCustomFields::list.

+

Recipient authentication

-

19. Send an envelope with access code authentication

-

This example sends an envelope requiring the recipient to enter an access code for multifactor authentication.

+

19. Require access code authentication for a recipient

+

Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

API method used: Envelopes::create.

-

20. Send an envelope with SMS authentication

-

This example sends an envelope requiring the recipient enter a code received via an SMS message for multifactor authentication.

+

20. Require phone authentication for a recipient

+

Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

API method used: Envelopes::create.

- -

21. Send an envelope with phone authentication

-

This example sends an envelope requiring the recipient enter a code received via a telephone call for multifactor authentication.

-

API method used: - Envelopes::create. -

- - -

22. Send an envelope with knowledge-based authentication (KBA)

-

This example sends an envelope requiring the recipient answer multiple-choice, public records–based questions for multifactor authentication.

- +

22. Require knowledge-based authentication (KBA) for a recipient

+

Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

API method used: Envelopes::create.

- -

23. Send an envelope with ID verification (IDV) authentication

-

This example sends an envelope requiring the recipient authenticate themselves by electronically presenting a government-issued identification (such as a passport, driver's license, or e-ID).

- +

23. Require ID verification (IDV) for a recipient

+

Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

- API methods used: - Accounts::getAccountIdentityVerificationsList - and Envelopes::create. + API method used: + Envelopes::create.

Permissions

-

24. Create a permission profile

- -

- This example creates a user group’s permission profile. -

+

24. Create a new permission profile

API method used: AccountPermissionProfiles::create.

-

25. Set a permission profile

-

This example updates the group name and modifies, or sets, the permission profile for the group.

+

25. Setting a permission profile

+

This example allows you to set a permission profile on an existing user group.

API method used: Groups::update.

- -

26. Update individual permission profile settings

- -

This example updates an individual setting on a user group’s permission profile. - +

26. Updating individual permission profile settings

+

+ This example will update individual permission settings for a given account.

API method used: AccountPermissionProfiles::update.

-

27. Delete a permission profile

-

This example lists all available permissions profiles and allows you to delete any without associated users. Note: You cannot remove "Everyone" nor "Administrator" permission profiles.

+

27. Deleting a permission profile

+

This example lists all available permissions profiles and allows you to delete any without associated users. Please note that you cannot remove "Everyone" nor "Administrator" permission profiles.

API method used: AccountPermissionProfiles::create.

- - +

Brands

- +

28. Create a brand

-

This example creates an account brand that can be used to apply customization to your envelopes, including your own logo, colors, and text elements.

+

This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

API method used: AccountBrands::create.

-

29. Apply a brand to an envelope

-

This example creates an envelope using any of the created brands on your account.

+

29. Applying a brand to an envelope

+

This example will show you how to create an envelope using any of the created brands on your account.

API method used: Envelopes::create.

-

30. Apply a brand and template to an envelope

-

This example creates an envelope from a template while applying any of the created brands on your account.

+

30. Applying a brand to a template

+

This example will show you how to create an envelope using a brand

API method used: Envelopes::create.

Bulk operations

+

31. Bulk send envelopes

- This example creates and sends an envelope to multiple recipients using bulk lists. -

API methods used: - Envelopes::create, - EnvelopeCustomFields::create, - EnvelopeRecipients::create, - BulkSend::createBulkSendList, - BulkSend::createBulkSendRequest, - and - BulkSend::getBulkSendBatchStatus - + Demonstrates how to send envelopes in bulk to multiple recipients. First, this example + creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk + envelope sending. +

+

+ API methods used: + BulkSend::createBulkSendList, + Envelopes::create, + EnvelopeCustomFields::create, + BulkSend::createBulkSendRequest, + BulkSend::getBulkSendBatchStatus.

Advanced recipient routing

@@ -318,7 +289,11 @@

32. Pause a signature workflow

- This example creates an envelope where the workflow is paused before the envelope is sent to a second recipient. + This topic demonstrates how to create an envelope where the workflow is paused before the + envelope is sent to a second recipient. For information on resuming a workflow see + + How to unpause a signature workflow + .

API methods used: @@ -328,7 +303,11 @@

33. Unpause a signature workflow

- This example resumes a signature workflow for an envelope whose workflow has been paused. + This topic demonstrates how to resume an envelope workflow that has been paused. + For information on creating an envelope with a paused workflow, see + + How to pause a signature workflow + .

API methods used: @@ -338,30 +317,51 @@

34. Use conditional recipients

- This example creates an envelope whose workflow routes it to different recipients based on the value of a transaction. + This topic demonstrates how to create an envelope where the workflow is routed to + different recipients based on the value of a transaction.

API methods used: Envelopes::create.

-

Premium features

+

35. Schedule an envelope

+

+ Demonstrates how to schedule an envelope using the scheduled sending feature. +

+

+ API method used: + Envelopes::create. +

-

35. Send an envelope by SMS delivery

+

36. Send an envelope with delayed routing

+

+ Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature. +

+

+ API method used: + Envelopes::create. +

+

Premium features

+

37. Request a signature by SMS delivery

- This example demonstrates how to send an envelope via an SMS message for a signer (and CC) to read and sign. + Demonstrates how to send a signature request via an SMS message using the Create Envelope method.

- API methods used: - Envelopes::create. + API method used: + Envelopes::create.

+
+ - \ No newline at end of file From 9fc1be951a3b3e0d9515ab4b6abceea16ebf3ebb Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Mon, 21 Mar 2022 18:59:22 +0200 Subject: [PATCH 272/699] Refactoring code examples (#39) * Refactoring eSignture examples * Refactoring code examples for Monitor, Click and Rooms * Renamed methods, formatted lines * provide ability to choose multiple APIs (and get their scopes) * fixed appsettings.json file * Moved Admin API examples to services * Transfer arguments without WorkArguments class * Made some methods private * removed extra imports and empty lines * removed duplicates * Moved writing export to file into service * Fixed comments * moved services closer to controllers * return error page in case the api type is not supported * removed unnecessary throws * removed calling custom error page * Moved error message constant to GlobalControllerAdvice * Fixed white-spaces and variable naming issues * Moved magic number to separate variable with self-explanatory name * changed result to self-explanatory namings --- .factorypath | 94 ++++++++ code-examples-java.iml | 146 ++++++------ pom.xml | 5 + .../java/com/docusign/DSConfiguration.java | 6 +- .../EG001ControllerEmbeddedSigning.java | 89 ++----- src/main/java/com/docusign/OSDetector.java | 8 +- .../java/com/docusign/WebSecurityConfig.java | 14 +- .../com/docusign/common/SelectedApiTypes.java | 29 +++ .../admin/examples/A001AddActiveUser.java | 58 ++--- .../A002CreateActiveCLMESignUser.java | 63 ++--- .../examples/A003BulkExportUserData.java | 64 ++---- .../examples/A003aCheckRequestStatus.java | 16 +- .../examples/A004BulkImportUserData.java | 5 +- .../A004CheckImportRequestStatus.java | 6 +- .../admin/examples/A005AuditUsers.java | 26 +-- .../admin/services/AddActiveUserService.java | 48 ++++ .../admin/services/AuditUsersService.java | 51 ++++ .../services/BulkExportUserDataService.java | 93 ++++++++ .../services/BulkImportUserDataService.java | 24 ++ .../CheckImportRequestStatusService.java | 18 ++ .../services/CheckRequestStatusService.java | 16 ++ .../CreateActiveCLMESignUserService.java | 55 +++++ .../examples/AbstractClickController.java | 24 -- .../C001ControllerCreateClickwrap.java | 37 +-- .../C002ControllerActivateClickwrap.java | 17 +- ...03ControllerCreateNewVersionClickwrap.java | 41 +--- .../C004ControllerGetListClickwraps.java | 11 +- .../C005ControllerGetClickwrapResponses.java | 10 +- .../services/ActivateClickwrapService.java | 25 ++ .../services/CreateClickwrapService.java | 34 +++ .../CreateNewVersionClickwrapService.java | 50 ++++ .../GetClickwrapResponsesService.java | 16 ++ .../services/GetListClickwrapsService.java | 15 ++ .../EG002ControllerSigningViaEmail.java | 92 ++------ .../EG003ControllerListEnvelopes.java | 23 +- .../examples/EG004ControllerEnvelopeInfo.java | 11 +- .../EG005ControllerEnvelopeRecipients.java | 14 +- .../examples/EG006ControllerEnvelopeDocs.java | 11 +- .../EG007ControllerEnvelopeGetDoc.java | 45 ++-- .../EG008ControllerCreateTemplate.java | 185 ++------------- .../examples/EG009ControllerUseTemplate.java | 46 ++-- .../EG010ControllerSendBinaryDocs.java | 175 +------------- .../EG011ControllerEmbeddedSending.java | 30 +-- .../EG012ControllerEmbeddedConsole.java | 27 +-- .../EG013ControllerAddDocToTemplate.java | 139 ++--------- .../EG014ControllerCollectPayment.java | 185 ++------------- .../examples/EG015ControllerGetTabValues.java | 9 +- .../examples/EG016ControllerSetTabValues.java | 153 ++---------- .../EG017ControllerSetTemplateTabValues.java | 173 ++------------ ...18ControllerEnvelopeCustomFieldValues.java | 15 +- ...019ControllerAccessCodeAuthentication.java | 67 ++---- .../EG020ControllerPhoneAuthentication.java | 68 +----- .../EG022ControllerKBAAuthentication.java | 68 ++---- .../EG023ControllerIdvAuthentication.java | 88 +------ .../EG024ControllerPermissionCreate.java | 20 +- ...G025ControllerPermissionSetUserGroups.java | 35 ++- ...ntrollerPermissionChangeSingleSetting.java | 81 ++----- .../EG027ControllerPermissionDelete.java | 5 +- .../examples/EG028ControllerCreateBrand.java | 35 ++- .../EG029ControllerApplyBrandToEnvelope.java | 72 ++---- .../EG030ControllerApplyBrandToTemplate.java | 38 ++- .../EG031ControllerBulkSendEnvelopes.java | 155 +++---------- ...EG032ControllerPauseSignatureWorkflow.java | 91 ++------ ...033ControllerUnpauseSignatureWorkflow.java | 24 +- ...034ControllerUseConditionalRecipients.java | 189 ++------------- .../EG035ControllerScheduledSending.java | 73 +----- .../EG036ControllerDelayedRouting.java | 95 +------- .../examples/EG037ControllerSMSDelivery.java | 107 ++------- .../eSignature/examples/EnvelopeHelpers.java | 12 +- .../AccessCodeAuthenticationService.java | 46 ++++ .../services/AddDocToTemplateService.java | 161 +++++++++++++ .../services/ApplyBrandToEnvelopeService.java | 58 +++++ .../services/ApplyBrandToTemplateService.java | 45 ++++ .../services/BulkSendEnvelopesService.java | 171 ++++++++++++++ .../services/CollectPaymentService.java | 185 +++++++++++++++ .../services/CreateBrandService.java | 25 ++ .../services/CreateTemplateService.java | 180 +++++++++++++++ .../services/DelayedRoutingService.java | 102 ++++++++ .../services/EmbeddedConsoleService.java | 28 +++ .../services/EmbeddedSendingService.java | 49 ++++ .../services/EmbeddedSigningService.java | 97 ++++++++ .../EnvelopeCustomFieldValuesService.java | 15 ++ .../services/EnvelopeDocsService.java | 16 ++ .../services/EnvelopeGetDocService.java | 24 ++ .../services/EnvelopeInfoService.java | 15 ++ .../services/EnvelopeRecipientsService.java | 15 ++ .../services/GetTabValuesService.java | 15 ++ .../services/IdvAuthenticationService.java | 102 ++++++++ .../services/KBAAuthenticationService.java | 72 ++++++ .../services/ListEnvelopesServices.java | 20 ++ .../PauseSignatureWorkflowService.java | 83 +++++++ .../PermissionChangeSingleSettingService.java | 63 +++++ .../services/PermissionCreateService.java | 31 +++ .../services/PermissionDeleteService.java | 15 ++ .../PermissionSetUserGroupsService.java | 28 +++ .../services/PhoneAuthenticationService.java | 81 +++++++ .../services/SMSDeliveryService.java | 95 ++++++++ .../services/ScheduledSendlingService.java | 73 ++++++ .../services/SendBinaryDocsService.java | 198 ++++++++++++++++ .../services/SetTabValuesService.java | 170 ++++++++++++++ .../services/SetTemplateTabValuesService.java | 158 +++++++++++++ .../services/SigningViaEmailService.java | 92 ++++++++ .../UnpauseSignatureWorkflowService.java | 34 +++ .../UseConditionalRecipientsService.java | 217 ++++++++++++++++++ .../services/UseTemplateService.java | 45 ++++ .../examples/M001GetMonitoringData.java | 53 +---- .../services/GetMonitoringDataService.java | 46 ++++ .../examples/AbstractRoomsController.java | 59 +---- .../examples/R001ControllerCreateRoom.java | 40 +--- .../R002ControllerCreateRoomWithTemplate.java | 50 ++-- .../R003ControllerExportingDataFromRoom.java | 11 +- .../R004ControllerAddingFormsToRoom.java | 22 +- .../R005ControllerGetRoomsWithFilters.java | 17 +- ...ntrollerCreateExternalFormFillSession.java | 28 ++- .../R007ControllerCreateFormGroup.java | 14 +- ...ontrollerGrantOfficeAccessToFormGroup.java | 11 +- .../R009ControllerAssignFormToFormGroup.java | 21 +- .../services/AddingFormsToRoomService.java | 20 ++ .../AssignFormToFormGroupService.java | 25 ++ .../CreateExternalFormFillSessionService.java | 25 ++ .../services/CreateFormGroupService.java | 23 ++ .../rooms/services/CreateRoomService.java | 36 +++ .../CreateRoomWithTemplateService.java | 34 +++ .../ExportingDataFromRoomService.java | 15 ++ .../rooms/services/GetAdminRolesService.java | 19 ++ .../services/GetFormSummaryListService.java | 30 +++ .../services/GetRoomsWithFiltersService.java | 22 ++ .../GrantOfficeAccessToFormGroupService.java | 20 ++ .../controller/GlobalControllerAdvice.java | 29 ++- .../java/com/docusign/core/model/Locals.java | 1 - .../JWTAuthorizationCodeResourceDetails.java | 6 +- .../security/jwt/JWTOAuth2RestTemplate.java | 4 +- .../security/jwt/JWTUserInfoTokenService.java | 2 +- src/main/resources/application.example.json | 8 +- 134 files changed, 4526 insertions(+), 2859 deletions(-) create mode 100644 .factorypath create mode 100644 src/main/java/com/docusign/common/SelectedApiTypes.java create mode 100644 src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java create mode 100644 src/main/java/com/docusign/controller/admin/services/AuditUsersService.java create mode 100644 src/main/java/com/docusign/controller/admin/services/BulkExportUserDataService.java create mode 100644 src/main/java/com/docusign/controller/admin/services/BulkImportUserDataService.java create mode 100644 src/main/java/com/docusign/controller/admin/services/CheckImportRequestStatusService.java create mode 100644 src/main/java/com/docusign/controller/admin/services/CheckRequestStatusService.java create mode 100644 src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java create mode 100644 src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java create mode 100644 src/main/java/com/docusign/controller/click/services/CreateClickwrapService.java create mode 100644 src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java create mode 100644 src/main/java/com/docusign/controller/click/services/GetClickwrapResponsesService.java create mode 100644 src/main/java/com/docusign/controller/click/services/GetListClickwrapsService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/AccessCodeAuthenticationService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToEnvelopeService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToTemplateService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/BulkSendEnvelopesService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/CreateBrandService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/CreateTemplateService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EmbeddedConsoleService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EmbeddedSendingService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EmbeddedSigningService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EnvelopeCustomFieldValuesService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EnvelopeDocsService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EnvelopeGetDocService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EnvelopeInfoService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/EnvelopeRecipientsService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/GetTabValuesService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/IdvAuthenticationService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/KBAAuthenticationService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/ListEnvelopesServices.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/PauseSignatureWorkflowService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/PermissionDeleteService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/PermissionSetUserGroupsService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/PhoneAuthenticationService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/SMSDeliveryService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/SetTabValuesService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/SetTemplateTabValuesService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/UnpauseSignatureWorkflowService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/UseConditionalRecipientsService.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/UseTemplateService.java create mode 100644 src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/AddingFormsToRoomService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/AssignFormToFormGroupService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/CreateExternalFormFillSessionService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/CreateFormGroupService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/CreateRoomService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/ExportingDataFromRoomService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/GetAdminRolesService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/GetFormSummaryListService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/GetRoomsWithFiltersService.java create mode 100644 src/main/java/com/docusign/controller/rooms/services/GrantOfficeAccessToFormGroupService.java diff --git a/.factorypath b/.factorypath new file mode 100644 index 00000000..202e6135 --- /dev/null +++ b/.factorypath @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code-examples-java.iml b/code-examples-java.iml index c5ffa924..97a72455 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -22,97 +22,101 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - + + + + - - + + - + - + + - - - - - - - + + + + + + + + - - - + + + - + - - + + - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 54e9fcab..f7926a16 100644 --- a/pom.xml +++ b/pom.xml @@ -119,6 +119,11 @@ RELEASE compile + + org.springframework.boot + spring-boot-autoconfigure + 2.4.4 + diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index b4a63cba..8f885599 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -1,6 +1,8 @@ package com.docusign; +import com.docusign.common.SelectedApiTypes; import lombok.Getter; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -21,8 +23,8 @@ public class DSConfiguration { @Value("${DS_APP_URL}") private String appUrl; - @Value("${DS_API_NAME}") - private String apiName; + @Autowired + private SelectedApiTypes apiName; @Value("${DS_BASE_PATH}") private String basePath; diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 6132daaa..949d7630 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -2,20 +2,17 @@ import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.AbstractEsignatureController; -import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.RecipientViewRequest; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.Signer; import com.docusign.esign.model.ViewUrl; +import com.docusign.controller.eSignature.services.EmbeddedSigningService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -23,7 +20,6 @@ import org.springframework.web.servlet.view.RedirectView; import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; @@ -63,7 +59,14 @@ protected Object doWork(WorkArguments args, ModelMap model, String accountId = session.getAccountId(); // Step 1. Create the envelope definition - EnvelopeDefinition envelope = makeEnvelope(signerEmail, signerName); + EnvelopeDefinition envelope = EmbeddedSigningService.makeEnvelope( + signerEmail, + signerName, + SIGNER_CLIENT_ID, + ANCHOR_OFFSET_Y, + ANCHOR_OFFSET_X, + DOCUMENT_FILE_NAME, + DOCUMENT_NAME); // Step 2. Call DocuSign to create the envelope ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); @@ -74,8 +77,18 @@ protected Object doWork(WorkArguments args, ModelMap model, session.setEnvelopeId(envelopeId); // Step 3. create the recipient view, the embedded signing - RecipientViewRequest viewRequest = makeRecipientViewRequest(signerEmail, signerName); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + RecipientViewRequest viewRequest = EmbeddedSigningService.makeRecipientViewRequest( + signerEmail, + signerName, + config, + SIGNER_CLIENT_ID); + + ViewUrl viewUrl = EmbeddedSigningService.embeddedSigning( + envelopesApi, + accountId, + envelopeId, + viewRequest + ); // Step 4. Redirect the user to the embedded signing // Don't use an iFrame! @@ -83,64 +96,4 @@ protected Object doWork(WorkArguments args, ModelMap model, // query parameter on the returnUrl (see the makeRecipientViewRequest method) return new RedirectView(viewUrl.getUrl()); } - - private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String signerName) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - // The query parameter is included as an example of how - // to save/recover state information during the redirect to - // the DocuSign signing. It's usually better to use - // the session mechanism of your web framework. Query parameters - // can be changed/spoofed very easily. - viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); - - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(SIGNER_CLIENT_ID); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds - viewRequest.setPingUrl(config.getDsPingUrl()); - - return viewRequest; - } - - private static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName) throws IOException { - // Create a signer recipient to sign the document, identified by name and email - // We set the clientUserId to enable embedded signing for the recipient - Signer signer = new Signer(); - signer.setEmail(signerEmail); - signer.setName(signerName); - signer.clientUserId(SIGNER_CLIENT_ID); - signer.recipientId("1"); - signer.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // Add the recipient to the envelope object - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign this document"); - envelopeDefinition.setRecipients(recipients); - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "3"); - envelopeDefinition.setDocuments(Arrays.asList(doc)); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeDefinition; - } } diff --git a/src/main/java/com/docusign/OSDetector.java b/src/main/java/com/docusign/OSDetector.java index 2cdcb25a..358aba40 100644 --- a/src/main/java/com/docusign/OSDetector.java +++ b/src/main/java/com/docusign/OSDetector.java @@ -6,9 +6,9 @@ */ public class OSDetector { - private static boolean isWindows; - private static boolean isLinux; - private static boolean isMac; + private static final boolean isWindows; + private static final boolean isLinux; + private static final boolean isMac; static { @@ -20,6 +20,6 @@ public class OSDetector public static boolean isWindows() { return isWindows; } public static boolean isLinux() { return isLinux; } - public static boolean isMac() { return isMac; }; + public static boolean isMac() { return isMac; } } \ No newline at end of file diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index f4552c6e..7d77faf8 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -3,6 +3,7 @@ import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; import com.docusign.core.security.jwt.JWTUserInfoTokenService; +import com.docusign.esign.client.auth.OAuth; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2SsoProperties; import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties; @@ -87,13 +88,18 @@ public FilterRegistrationBean oAuth2ClientFilterRegis private List getScopes() { List scopes = null; - if (this.dsConfiguration.getApiName().equalsIgnoreCase("rooms")) { + if (this.dsConfiguration.getApiName().getESIGNATURE()) { + scopes = Arrays.asList(OAuth.Scope_SIGNATURE); + } + if (this.dsConfiguration.getApiName().getROOMS()) { scopes = Arrays.asList(this.roomScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("click")) { + } + if (this.dsConfiguration.getApiName().getCLICK()) { scopes = Arrays.asList(this.clickScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("monitor")) { + } + if (this.dsConfiguration.getApiName().getMONITOR()) { scopes = Arrays.asList(this.monitorScopes); - } else if (this.dsConfiguration.getApiName().equalsIgnoreCase("admin")) { + } else if (this.dsConfiguration.getApiName().getADMIN()) { scopes = Arrays.asList(this.adminScopes); } diff --git a/src/main/java/com/docusign/common/SelectedApiTypes.java b/src/main/java/com/docusign/common/SelectedApiTypes.java new file mode 100644 index 00000000..267a2d1c --- /dev/null +++ b/src/main/java/com/docusign/common/SelectedApiTypes.java @@ -0,0 +1,29 @@ +package com.docusign.common; + +import lombok.Getter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Component +@Getter +public class SelectedApiTypes { + @Value("${DS_API_NAME.ESIGNATURE}") + private Boolean ESIGNATURE; + @Value("${DS_API_NAME.ROOMS}") + private Boolean ROOMS; + @Value("${DS_API_NAME.CLICK}") + private Boolean CLICK; + @Value("${DS_API_NAME.MONITOR}") + private Boolean MONITOR; + @Value("${DS_API_NAME.ADMIN}") + private Boolean ADMIN; + + public String getFirstSelectedApi() { + return (ESIGNATURE)? ApiIndex.ESIGNATURE.name() + : (ROOMS)? ApiIndex.ROOMS.name() + : (CLICK)? ApiIndex.CLICK.name() + : (MONITOR)? ApiIndex.MONITOR.name() + : (ADMIN)? ApiIndex.ADMIN.name() + : null; + } +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index a69337c3..a1c6b4cd 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -4,6 +4,7 @@ import com.docusign.admin.api.UsersApi; import com.docusign.admin.model.*; import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.AddActiveUserService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -67,7 +68,26 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - NewUserResponse result = createNewActiveUser(this.user.getAccessToken(), args); + String accessToken = this.user.getAccessToken(); + String basePath = this.session.getBasePath(); + // Create a users api instance + UsersApi usersApi = createUsersApi(accessToken, basePath); + + // Collect ids needed for the request + UUID organizationId = this.getOrganizationId(accessToken, basePath); + + // Step 5 start + UUID accountId = this.getExistingAccountId(accessToken, basePath, organizationId); + NewUserResponse result = AddActiveUserService.createNewActiveUser( + args.getGroupId(), + args.getProfileId(), + args.getEmail(), + args.getUserName(), + args.getFirstName(), + args.getLastName(), + usersApi, + organizationId, + accountId); // Process results DoneExample.createDefault(title) @@ -76,40 +96,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected NewUserResponse createNewActiveUser(String accessToken, WorkArguments args) throws Exception { - // Create a users api instance - UsersApi usersApi = createUsersApi(accessToken, this.session.getBasePath()); - - // Collect ids needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - - // Step 5 start - UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); - java.util.List groups = new ArrayList<>(); - groups.add(new GroupRequest().id(Long.valueOf(args.getGroupId()))); - - // Fill the request with data from the form - NewUserRequest accountUserRequest = new NewUserRequest() - .defaultAccountId(accountId) - .addAccountsItem( - new NewUserRequestAccountProperties() - .id(accountId) - .permissionProfile( - new PermissionProfileRequest() - .id(Long.valueOf(args.getProfileId())) - ) - .groups(groups) - ) - .email(args.getEmail()) - .userName(args.getUserName()) - .firstName(args.getFirstName()) - .lastName(args.getLastName()) - .autoActivateMemberships(true); - // Step 5 end - - // Step 6 start - return usersApi.createUser(organizationId, accountUserRequest); - // Step 6 end - } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index bb61acac..7c102afd 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -16,6 +16,7 @@ import com.docusign.admin.model.ProductPermissionProfileResponse; import com.docusign.admin.model.ProductPermissionProfilesResponse; import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.CreateActiveCLMESignUserService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -91,7 +92,28 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - AddUserResponse result = createNewActiveUser(this.user.getAccessToken(), args); + String accessToken = this.user.getAccessToken(); + String basePath = this.session.getBasePath(); + // Create a users api instance + UsersApi usersApi = createUsersApi(accessToken, basePath); + + // Collect ids needed for the request + UUID organizationId = this.getOrganizationId(accessToken, basePath); + UUID accountId = this.getExistingAccountId(accessToken, basePath, organizationId); + + AddUserResponse result = CreateActiveCLMESignUserService.createNewActiveUser( + args.getClmProfileId(), + args.getClmProductId(), + args.getESignProfileId(), + args.getESignProductId(), + args.getDsGroupId(), + args.getUserName(), + args.getFirstName(), + args.getLastName(), + args.getEmail(), + usersApi, + organizationId, + accountId); // Process results DoneExample.createDefault(title) @@ -100,43 +122,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected AddUserResponse createNewActiveUser(String accessToken, WorkArguments args) throws Exception { - // Create a users api instance - UsersApi usersApi = createUsersApi(accessToken, this.session.getBasePath()); - - // Collect ids needed for the request - UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); - UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); - - - // Step 5 start - ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest(); - ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest(); - clm.setPermissionProfileId(args.getClmProfileId()); - clm.setProductId(args.getClmProductId()); - - eSign.setPermissionProfileId(args.getESignProfileId()); - eSign.setProductId(args.getESignProductId()); - - DSGroupRequest dsGroup = new DSGroupRequest(); - dsGroup.setDsGroupId(args.getDsGroupId()); - // Fill the request with data from the form - - NewMultiProductUserAddRequest accountAddRequest = new NewMultiProductUserAddRequest() - .defaultAccountId(accountId) - .addProductPermissionProfilesItem(clm) - .addProductPermissionProfilesItem(eSign) - .addDsGroupsItem(dsGroup) - .userName(args.getUserName()) - .firstName(args.getFirstName()) - .lastName(args.getLastName()) - .autoActivateMemberships(true) - .email(args.getEmail()); - // Step 5 end - - // Step 6 start - return usersApi.addOrUpdateUser(organizationId, accountId, accountAddRequest); - // Step 6 end - } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 3a29eed7..8b763ec5 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -6,6 +6,7 @@ import com.docusign.admin.model.OrganizationExportRequest; import com.docusign.admin.model.OrganizationExportsResponse; import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.BulkExportUserDataService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -52,59 +53,32 @@ public A003BulkExportUserData(DSConfiguration config, Session session, User user protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { // Step 3 start BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); - OrganizationExportRequest request = new OrganizationExportRequest(); - request.setType("organization_memberships_export"); - OrganizationExportResponse bulkList = bulkExportsApi.createUserListExport( - this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), request); + + OrganizationExportResponse bulkList = BulkExportUserDataService.createUserListExport( + bulkExportsApi, + this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath())); // Step 3 end TimeUnit.SECONDS.sleep(30); // Step 4 start - OrganizationExportResponse data = bulkExportsApi.getUserListExport( - this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), bulkList.getId()); + OrganizationExportResponse data = BulkExportUserDataService.bulkExportUserData( + bulkExportsApi, + this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), + bulkList.getId()); // Step 4 end // Step 5 start -String csvUri = data.getResults().get(0).getUrl(); -URL request_url = new URL(csvUri); - -// Send Web request to download and save the exported CSV data -HttpsURLConnection.setFollowRedirects(true); // Defaults to true -HttpsURLConnection http_conn = (HttpsURLConnection) request_url.openConnection(); -http_conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); -http_conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "mutlipart/form-data"); -http_conn.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); -http_conn.setInstanceFollowRedirects(true); - -ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); -String rootDir = Paths.get(rawPath.getResource("").toURI()).toString(); -// Set the save file path in the project root instead of the compiled folder and -// force forward slash scheme -rootDir = StringUtils.remove(rootDir, "target\\classes"); -rootDir = StringUtils.remove(rootDir, "file:/"); -rootDir = StringUtils.replace(rootDir, "\\", "/"); - -// opens input stream from the HTTP connection -InputStream inputStream = http_conn.getInputStream(); -String saveFilePath = rootDir + "src/main/resources/ExportedUserData.csv"; - -// opens an output stream to save into file -FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); - -int bytesRead = -1; -byte[] buffer = new byte[BUFFER_SIZE]; -while ((bytesRead = inputStream.read(buffer)) != -1) { - outputStream.write(buffer, 0, bytesRead); -} - -outputStream.close(); -inputStream.close(); -http_conn.disconnect(); - // Step 5 end - - OrganizationExportsResponse results = bulkExportsApi - .getUserListExports(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath())); + String csvUri = data.getResults().get(0).getUrl(); + String saveFilePath = BulkExportUserDataService.moveUserListExportToFile( + csvUri, + BEARER_AUTHENTICATION, + this.user.getAccessToken(), + BUFFER_SIZE + ); + + OrganizationExportsResponse results = BulkExportUserDataService + .bulkExportsUserData(bulkExportsApi, this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath())); // Process results DoneExample.createDefault(title) .withMessage("User data exported to " + saveFilePath + "
from UserExport:getUserListExport method:") diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index d32705af..96e79efd 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -4,6 +4,7 @@ import com.docusign.admin.api.BulkExportsApi; import com.docusign.admin.model.OrganizationExportResponse; import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.CheckRequestStatusService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -43,7 +44,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - OrganizationExportResponse result = checkRequestStatus(this.user.getAccessToken()); + // Create a bulk exports api instance + BulkExportsApi bulkExportsApi = createBulkExportsApi(this.user.getAccessToken(), this.session.getBasePath()); + + OrganizationExportResponse result = CheckRequestStatusService.checkRequestStatus( + bulkExportsApi, + this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), + UUID.fromString(this.session.getExportId())); // Process results DoneExample.createDefault(title) @@ -52,11 +59,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected OrganizationExportResponse checkRequestStatus(String accessToken) throws Exception { - // Create a bulk exports api instance - BulkExportsApi bulkExportsApi = createBulkExportsApi(accessToken, this.session.getBasePath()); - - return bulkExportsApi.getUserListExport(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), UUID.fromString(this.session.getExportId())); - } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 763986d4..7bbf26a9 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -4,6 +4,7 @@ import com.docusign.admin.api.BulkImportsApi; import com.docusign.admin.model.OrganizationImportResponse; import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.BulkImportUserDataService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -57,11 +58,9 @@ protected OrganizationImportResponse bulkImportUserData(String accessToken) thro UUID accountId = this.getExistingAccountId(accessToken, this.session.getBasePath(), organizationId); // Make sure you're using a verified domain for auto-activation to work properly // Step 3 start - String csvUserData = String.format("AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender", accountId, accountId); - byte[] csvDataInBytes = csvUserData.getBytes(StandardCharsets.UTF_8); BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, this.session.getBasePath()); - return bulkImportsApi.createBulkImportSingleAccountAddUsersRequest(organizationId, accountId, csvDataInBytes); + return BulkImportUserDataService.bulkImportUserData(bulkImportsApi, organizationId, accountId); // Step 3 end } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index ec847d3c..ccd5cfa4 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -4,6 +4,7 @@ import com.docusign.admin.api.BulkImportsApi; import com.docusign.admin.model.OrganizationImportResponse; import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.CheckImportRequestStatusService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -79,7 +80,10 @@ protected OrganizationImportResponse checkRequestStatus(String accessToken) thro // Create a bulk exports api instance BulkImportsApi bulkImportsApi = createBulkImportsApi(accessToken, this.session.getBasePath()); // Step 4a start - return bulkImportsApi.getBulkUserImportRequest(this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), UUID.fromString(this.session.getImportId())); + return CheckImportRequestStatusService.checkRequestStatus( + bulkImportsApi, + this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()), + UUID.fromString(this.session.getImportId())); // Step 4a end } diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 46dbea5f..0c37205f 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -17,6 +17,7 @@ import com.docusign.admin.model.UserDrilldownResponse; import com.docusign.admin.model.UsersDrilldownResponse; import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.AuditUsersService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -47,34 +48,13 @@ public A005AuditUsers(DSConfiguration config, Session session, User user) { @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { - ArrayList resultsArr = new ArrayList(); - - // Collect ids needed for the request UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); UUID accountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); - UsersApi adminApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); - // Step 3 start - GetUsersOptions options = adminApi.new GetUsersOptions(); - options.setAccountId(accountId); - TimeZone tz = TimeZone.getTimeZone("UTC"); - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); // Quoted "Z" to indicate UTC, no timezone offset - df.setTimeZone(tz); - String nowAsISO = df.format(new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 24 * 10))); - options.setLastModifiedSince(nowAsISO); - OrganizationUsersResponse modifiedUsers = adminApi.getUsers(organizationId, options); - // Step 3 end - - // Step 5 start -for (OrganizationUserResponse user : modifiedUsers.getUsers()) { - GetUserProfilesOptions profilesOptions = adminApi.new GetUserProfilesOptions(); - profilesOptions.setEmail(user.getEmail()); - UsersDrilldownResponse res = adminApi.getUserProfiles(organizationId, profilesOptions); - resultsArr.add(res.getUsers().get(0)); -} - // Step 5 end + ArrayList resultsArr = AuditUsersService.auditUsers(usersApi, organizationId, accountId); // Process results DoneExample.createDefault(title).withMessage("Results from eSignUserManagement:getUserProfiles method:") diff --git a/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java b/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java new file mode 100644 index 00000000..94955602 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/AddActiveUserService.java @@ -0,0 +1,48 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.*; + +import java.util.ArrayList; +import java.util.UUID; + +public class AddActiveUserService { + + public static NewUserResponse createNewActiveUser( + String groupId, + String profileId, + String email, + String userName, + String firstName, + String lastName, + UsersApi usersApi, + UUID organizationId, + UUID accountId) throws Exception + { + java.util.List groups = new ArrayList<>(); + groups.add(new GroupRequest().id(Long.valueOf(groupId))); + + // Fill the request with data from the form + NewUserRequest accountUserRequest = new NewUserRequest() + .defaultAccountId(accountId) + .addAccountsItem( + new NewUserRequestAccountProperties() + .id(accountId) + .permissionProfile( + new PermissionProfileRequest() + .id(Long.valueOf(profileId)) + ) + .groups(groups) + ) + .email(email) + .userName(userName) + .firstName(firstName) + .lastName(lastName) + .autoActivateMemberships(true); + // Step 5 end + + // Step 6 start + return usersApi.createUser(organizationId, accountUserRequest); + // Step 6 end + } +} diff --git a/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java new file mode 100644 index 00000000..5c0e5208 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/AuditUsersService.java @@ -0,0 +1,51 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.client.ApiException; +import com.docusign.admin.model.OrganizationUserResponse; +import com.docusign.admin.model.OrganizationUsersResponse; +import com.docusign.admin.model.UserDrilldownResponse; +import com.docusign.admin.model.UsersDrilldownResponse; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.TimeZone; +import java.util.UUID; + +public class AuditUsersService { + private static final String timeZoneId = "UTC"; + private static final String simpleDateFormat = "yyyy-MM-dd'T'HH:mm'Z'"; + + public static ArrayList auditUsers( + UsersApi usersApi, + UUID organizationId, + UUID accountId + ) throws ApiException { + ArrayList auditedUsers = new ArrayList<>(); + + // Step 3 start + UsersApi.GetUsersOptions options = usersApi.new GetUsersOptions(); + options.setAccountId(accountId); + TimeZone tz = TimeZone.getTimeZone(timeZoneId); + SimpleDateFormat df = new SimpleDateFormat(simpleDateFormat); + // Quoted "Z" to indicate UTC, no timezone offset + df.setTimeZone(tz); + Integer tenDaysBeforeToday = 1000 * 60 * 60 * 24 * 10; + String nowAsISO = df.format(new Date(System.currentTimeMillis() - tenDaysBeforeToday)); + options.setLastModifiedSince(nowAsISO); + OrganizationUsersResponse modifiedUsers = usersApi.getUsers(organizationId, options); + // Step 3 end + + // Step 5 start + for (OrganizationUserResponse user : modifiedUsers.getUsers()) { + UsersApi.GetUserProfilesOptions profilesOptions = usersApi.new GetUserProfilesOptions(); + profilesOptions.setEmail(user.getEmail()); + UsersDrilldownResponse res = usersApi.getUserProfiles(organizationId, profilesOptions); + auditedUsers.add(res.getUsers().get(0)); + } + // Step 5 end + + return auditedUsers; + } +} diff --git a/src/main/java/com/docusign/controller/admin/services/BulkExportUserDataService.java b/src/main/java/com/docusign/controller/admin/services/BulkExportUserDataService.java new file mode 100644 index 00000000..ae26ff94 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/BulkExportUserDataService.java @@ -0,0 +1,93 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.BulkExportsApi; +import com.docusign.admin.client.ApiException; +import com.docusign.admin.model.OrganizationExportRequest; +import com.docusign.admin.model.OrganizationExportResponse; +import com.docusign.admin.model.OrganizationExportsResponse; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpHeaders; + +import javax.net.ssl.HttpsURLConnection; +import javax.ws.rs.core.MediaType; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Paths; +import java.util.Objects; +import java.util.UUID; + +public class BulkExportUserDataService { + public static OrganizationExportsResponse bulkExportsUserData( + BulkExportsApi bulkExportsApi, + UUID organizationId) throws ApiException + { + return bulkExportsApi.getUserListExports(organizationId); + } + + public static OrganizationExportResponse bulkExportUserData( + BulkExportsApi bulkExportsApi, + UUID organizationId, + UUID exportId) throws ApiException + { + return bulkExportsApi.getUserListExport(organizationId, exportId); + } + + public static OrganizationExportResponse createUserListExport( + BulkExportsApi bulkExportsApi, + UUID organizationId) throws ApiException + { + OrganizationExportRequest request = new OrganizationExportRequest(); + request.setType("organization_memberships_export"); + return bulkExportsApi.createUserListExport(organizationId, request); + } + + public static String moveUserListExportToFile( + String csvUri, + String bearerAuthentication, + String accessToken, + Integer bufferSize) throws IOException, URISyntaxException { + // Step 5 start + URL request_url = new URL(csvUri); + + // Send Web request to download and save the exported CSV data + HttpsURLConnection.setFollowRedirects(true); // Defaults to true + HttpsURLConnection http_conn = (HttpsURLConnection) request_url.openConnection(); + http_conn.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + http_conn.setRequestProperty(HttpHeaders.CONTENT_TYPE, "mutlipart/form-data"); + http_conn.setRequestProperty(HttpHeaders.AUTHORIZATION, bearerAuthentication + accessToken); + http_conn.setInstanceFollowRedirects(true); + + ClassLoader rawPath = Thread.currentThread().getContextClassLoader(); + String rootDir = Paths.get(Objects.requireNonNull(rawPath.getResource("")).toURI()).toString(); + // Set the save file path in the project root instead of the compiled folder and + // force forward slash scheme + rootDir = StringUtils.remove(rootDir, "target\\classes"); + rootDir = StringUtils.remove(rootDir, "file:/"); + rootDir = StringUtils.replace(rootDir, "\\", "/"); + + // opens input stream from the HTTP connection + InputStream inputStream = http_conn.getInputStream(); + String saveFilePath = rootDir + "src/main/resources/ExportedUserData.csv"; + + // opens an output stream to save into file + FileOutputStream outputStream = FileUtils.openOutputStream(new File(saveFilePath)); + + int bytesRead; + byte[] buffer = new byte[bufferSize]; + while ((bytesRead = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, bytesRead); + } + + outputStream.close(); + inputStream.close(); + http_conn.disconnect(); + // Step 5 end + + return saveFilePath; + } +} diff --git a/src/main/java/com/docusign/controller/admin/services/BulkImportUserDataService.java b/src/main/java/com/docusign/controller/admin/services/BulkImportUserDataService.java new file mode 100644 index 00000000..915db22e --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/BulkImportUserDataService.java @@ -0,0 +1,24 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.BulkImportsApi; +import com.docusign.admin.model.OrganizationImportResponse; + +import java.nio.charset.StandardCharsets; +import java.util.UUID; + +public class BulkImportUserDataService { + private static final String BULK_IMPORT_TEXT = "AccountID,UserName,UserEmail,PermissionSet\n%s,FirstLast1,User1java@example.com,DS Admin\n%s,FirstLast2,User2java@example.com,DS Sender"; + public static OrganizationImportResponse bulkImportUserData( + BulkImportsApi bulkImportsApi, + UUID organizationId, + UUID accountId + ) throws Exception{ + // Make sure you're using a verified domain for auto-activation to work properly + // Step 3 start + String csvUserData = String.format(BULK_IMPORT_TEXT, accountId, accountId); + byte[] csvDataInBytes = csvUserData.getBytes(StandardCharsets.UTF_8); + + return bulkImportsApi.createBulkImportSingleAccountAddUsersRequest(organizationId, accountId, csvDataInBytes); + // Step 3 end + } +} diff --git a/src/main/java/com/docusign/controller/admin/services/CheckImportRequestStatusService.java b/src/main/java/com/docusign/controller/admin/services/CheckImportRequestStatusService.java new file mode 100644 index 00000000..2674e9a9 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/CheckImportRequestStatusService.java @@ -0,0 +1,18 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.BulkImportsApi; +import com.docusign.admin.model.OrganizationImportResponse; + +import java.util.UUID; + +public class CheckImportRequestStatusService { + public static OrganizationImportResponse checkRequestStatus( + BulkImportsApi bulkImportsApi, + UUID organizationId, + UUID importId + ) throws Exception { + // Step 4a start + return bulkImportsApi.getBulkUserImportRequest(organizationId, importId); + // Step 4a end + } +} diff --git a/src/main/java/com/docusign/controller/admin/services/CheckRequestStatusService.java b/src/main/java/com/docusign/controller/admin/services/CheckRequestStatusService.java new file mode 100644 index 00000000..55cc39e5 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/CheckRequestStatusService.java @@ -0,0 +1,16 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.BulkExportsApi; +import com.docusign.admin.model.OrganizationExportResponse; + +import java.util.UUID; + +public class CheckRequestStatusService { + public static OrganizationExportResponse checkRequestStatus( + BulkExportsApi bulkExportsApi, + UUID organizationId, + UUID exportId + ) throws Exception { + return bulkExportsApi.getUserListExport(organizationId, exportId); + } +} diff --git a/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java b/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java new file mode 100644 index 00000000..1098bbc6 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java @@ -0,0 +1,55 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.AddUserResponse; +import com.docusign.admin.model.DSGroupRequest; +import com.docusign.admin.model.NewMultiProductUserAddRequest; +import com.docusign.admin.model.ProductPermissionProfileRequest; + +import java.util.UUID; + +public class CreateActiveCLMESignUserService { + public static AddUserResponse createNewActiveUser( + String clmProfileId, + UUID clmProductId, + String eSignProfileId, + UUID eSignProductId, + UUID dsGroupId, + String userName, + String firstName, + String lastName, + String email, + UsersApi usersApi, + UUID organizationId, + UUID accountId + ) throws Exception{ + // Step 5 start + ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest(); + ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest(); + clm.setPermissionProfileId(clmProfileId); + clm.setProductId(clmProductId); + + eSign.setPermissionProfileId(eSignProfileId); + eSign.setProductId(eSignProductId); + + DSGroupRequest dsGroup = new DSGroupRequest(); + dsGroup.setDsGroupId(dsGroupId); + // Fill the request with data from the form + + NewMultiProductUserAddRequest multiProductUserAddRequest = new NewMultiProductUserAddRequest() + .defaultAccountId(accountId) + .addProductPermissionProfilesItem(clm) + .addProductPermissionProfilesItem(eSign) + .addDsGroupsItem(dsGroup) + .userName(userName) + .firstName(firstName) + .lastName(lastName) + .autoActivateMemberships(true) + .email(email); + // Step 5 end + + // Step 6 start + return usersApi.addOrUpdateUser(organizationId, accountId, multiProductUserAddRequest); + // Step 6 end + } +} diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index accbdcdd..0ef1f773 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -51,29 +51,5 @@ protected static AccountsApi createAccountsApiClient(String basePath, String use ApiClient apiClient = createApiClient(basePath, userAccessToken); return new AccountsApi(apiClient); } - - /** - * Checks a clickwrap and return true IF clickwrap exists and is activated. - * @param basePath URL to Click API - * @param userAccessToken user's access token - * @param accountId user's account id - * @param clickwrapId clickwrap's id - * @return an boolean value - */ - protected boolean isClickwrapExistsAndActive(String basePath, String userAccessToken, - String accountId, String clickwrapId) throws ApiException { - boolean isClickwrapOk = false; - - if (StringUtils.isNotBlank(clickwrapId)) { - - AccountsApi accountsApi = this.createAccountsApiClient(basePath, userAccessToken); - ClickwrapVersionResponse clickwrapResponse = accountsApi.getClickwrap(accountId, clickwrapId); - - isClickwrapOk = clickwrapResponse.getClickwrapId().equals(clickwrapId) && - clickwrapResponse.getStatus().equals(ClickwrapHelper.STATUS_ACTIVE); - } - - return isClickwrapOk; - } } diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index b61c4faa..0269b17c 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -5,12 +5,11 @@ import com.docusign.click.client.ApiException; import com.docusign.click.model.ClickwrapRequest; import com.docusign.click.model.ClickwrapVersionSummaryResponse; -import com.docusign.click.model.DisplaySettings; -import com.docusign.click.model.Document; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.click.services.CreateClickwrapService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -29,7 +28,6 @@ public class C001ControllerCreateClickwrap extends AbstractClickController { private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; private static final Integer DOCUMENT_ORDER = 0; private static final String DOCUMENT_NAME = "Terms of Service"; - private final Session session; private final User user; @@ -45,40 +43,27 @@ public C001ControllerCreateClickwrap(DSConfiguration config, Session session, Us protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { // Step 2. Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3. Construct the request body for your clickwrap - ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(args.getClickwrapName()); + ClickwrapRequest clickwrapRequest = CreateClickwrapService.createClickwrapRequest( + args.getClickwrapName(), + DOCUMENT_FILE_NAME, + DOCUMENT_NAME, + DOCUMENT_ORDER); // Step 4. Call the v1 Click API - ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap(this.session.getAccountId(), clickwrapRequest); + ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrap( + this.session.getAccountId(), + clickwrapRequest); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); - this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) .withMessage("The clickwrap " + createdClickwrap.getClickwrapName() + " has been created.") .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private ClickwrapRequest createClickwrapRequest(String clickwrapName) throws IOException { - Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); - DisplaySettings displaySettings = new DisplaySettings() - .displayName("Terms of Service") - .consentButtonText("I Agree") - .downloadable(true) - .format("modal") - .mustRead(true) - .mustView(true) - .requireAccept(true) - .documentDisplay("document"); - - return new ClickwrapRequest() - .addDocumentsItem(document) - .clickwrapName(clickwrapName) - .requireReacceptance(true) - .displaySettings(displaySettings); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index 7e8cd9d9..bd7b3383 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -3,11 +3,12 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; -import com.docusign.click.model.*; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.click.services.ActivateClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; /** * Activate a clickwrap. @@ -25,7 +25,6 @@ public class C002ControllerActivateClickwrap extends AbstractClickController { private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; - private final Session session; private final User user; @@ -47,17 +46,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - - // Step 3: Construct the request body for your clickwrap - ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 4: Call the v1 Click API - ClickwrapVersionSummaryResponse updatedClickwrap = accountsApi.updateClickwrapVersion( + ClickwrapVersionSummaryResponse updatedClickwrap = ActivateClickwrapService.activateClickwrap( + accountsApi, this.session.getAccountId(), this.session.getClickwrapId(), - this.session.getClickwrapVersionNumber(), - clickwrapRequest); + this.session.getClickwrapVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(updatedClickwrap) diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index ed539771..fd0a2de3 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -3,14 +3,12 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; -import com.docusign.click.model.ClickwrapRequest; import com.docusign.click.model.ClickwrapVersionSummaryResponse; -import com.docusign.click.model.DisplaySettings; -import com.docusign.click.model.Document; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.click.services.CreateNewVersionClickwrapService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -31,7 +29,6 @@ public class C003ControllerCreateNewVersionClickwrap extends AbstractClickContro private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; private static final Integer DOCUMENT_ORDER = 0; private static final String DOCUMENT_NAME = "Terms of Service"; - private final Session session; private final User user; @@ -53,21 +50,19 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - - // Step 3: Construct the request body for your clickwrap - ClickwrapRequest clickwrapRequest = this.createClickwrapRequest(); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 4: Call the v1 Click API - ClickwrapVersionSummaryResponse createdClickwrap = accountsApi.createClickwrapVersion( + ClickwrapVersionSummaryResponse createdClickwrap = CreateNewVersionClickwrapService.createNewVersionClickwrap( + accountsApi, + CreateNewVersionClickwrapService.createClickwrapRequest(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER), this.session.getAccountId(), - this.session.getClickwrapId(), - clickwrapRequest); + this.session.getClickwrapId() + ); this.session.setClickwrapId(createdClickwrap.getClickwrapId()); - this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber().toString()); + this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) .withMessage("Version " + createdClickwrap.getVersionNumber() + " of clickwrap " + @@ -75,25 +70,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private ClickwrapRequest createClickwrapRequest() throws IOException { - Document document = ClickwrapHelper.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER); - DisplaySettings displaySettings = new DisplaySettings() - .displayName("Terms of Service v2") - .consentButtonText("I Agree") - .downloadable(true) - .format("modal") - .mustRead(true) - .mustView(true) - .requireAccept(true) - .documentDisplay("document"); - - return new ClickwrapRequest() - .addDocumentsItem(document) - .clickwrapName("Terms of Service") - .requireReacceptance(true) - .status(ClickwrapHelper.STATUS_ACTIVE) - .displaySettings(displaySettings); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index 8500a26e..5d597e1c 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -3,18 +3,18 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; -import com.docusign.click.model.*; +import com.docusign.click.model.ClickwrapVersionsResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.click.services.GetListClickwrapsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; /** * Get a list of clickwraps. @@ -38,10 +38,11 @@ public C004ControllerGetListClickwraps(DSConfiguration config, Session session, protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Call the v1 Click API - ClickwrapVersionsResponse clickwrapsResponse = accountsApi.getClickwraps(this.session.getAccountId()); + ClickwrapVersionsResponse clickwrapsResponse = GetListClickwrapsService.getListClickwrap( + accountsApi, + this.session.getAccountId()); DoneExample.createDefault(this.title) .withJsonObject(clickwrapsResponse) diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index d6a8d4fc..88b2a643 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -8,13 +8,13 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.click.services.GetClickwrapResponsesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; /** * Get clickwrap responses. @@ -38,11 +38,13 @@ public C005ControllerGetClickwrapResponses(DSConfiguration config, Session sessi protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers - AccountsApi accountsApi = this.createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Call the v1 Click API - ClickwrapAgreementsResponse clickwrapAgreementsResponse = accountsApi.getClickwrapAgreements( - this.session.getAccountId(), this.session.getClickwrapId()); + ClickwrapAgreementsResponse clickwrapAgreementsResponse = GetClickwrapResponsesService.getClickwrapResponses( + accountsApi, + this.session.getAccountId(), + this.session.getClickwrapId()); DoneExample.createDefault(this.title) .withJsonObject(clickwrapAgreementsResponse) diff --git a/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java b/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java new file mode 100644 index 00000000..71335a20 --- /dev/null +++ b/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java @@ -0,0 +1,25 @@ +package com.docusign.controller.click.services; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.controller.click.examples.ClickwrapHelper; + +public final class ActivateClickwrapService { + public static ClickwrapVersionSummaryResponse activateClickwrap( + AccountsApi accountsApi, + String accountId, + String clickwrapId, + String clickwrapVersionNumber) throws ApiException { + // Step 3: Construct the request body for your clickwrap + ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE); + + // Step 4: Call the v1 Click API + return accountsApi.updateClickwrapVersion( + accountId, + clickwrapId, + clickwrapVersionNumber, + clickwrapRequest); + } +} diff --git a/src/main/java/com/docusign/controller/click/services/CreateClickwrapService.java b/src/main/java/com/docusign/controller/click/services/CreateClickwrapService.java new file mode 100644 index 00000000..905729a9 --- /dev/null +++ b/src/main/java/com/docusign/controller/click/services/CreateClickwrapService.java @@ -0,0 +1,34 @@ +package com.docusign.controller.click.services; + +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.controller.click.examples.ClickwrapHelper; + +import java.io.IOException; + +public final class CreateClickwrapService { + public static ClickwrapRequest createClickwrapRequest( + String clickwrapName, + String fileName, + String documentName, + Integer documentOrder + ) throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(fileName, documentName, documentOrder); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true) + .documentDisplay("document"); + + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName(clickwrapName) + .requireReacceptance(true) + .displaySettings(displaySettings); + } +} diff --git a/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java b/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java new file mode 100644 index 00000000..ba06ee5c --- /dev/null +++ b/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java @@ -0,0 +1,50 @@ +package com.docusign.controller.click.services; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapRequest; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.click.model.DisplaySettings; +import com.docusign.click.model.Document; +import com.docusign.controller.click.examples.ClickwrapHelper; + +import java.io.IOException; + +public final class CreateNewVersionClickwrapService { + public static ClickwrapVersionSummaryResponse createNewVersionClickwrap( + AccountsApi accountsApi, + ClickwrapRequest clickwrapRequest, + String accountId, + String clickwrapId + ) throws ApiException { + // Step 4: Call the v1 Click API + return accountsApi.createClickwrapVersion( + accountId, + clickwrapId, + clickwrapRequest); + } + + public static ClickwrapRequest createClickwrapRequest( + String fileName, + String documentName, + Integer documentOrder + ) throws IOException { + Document document = ClickwrapHelper.createDocumentFromFile(fileName, documentName, documentOrder); + DisplaySettings displaySettings = new DisplaySettings() + .displayName("Terms of Service v2") + .consentButtonText("I Agree") + .downloadable(true) + .format("modal") + .mustRead(true) + .mustView(true) + .requireAccept(true) + .documentDisplay("document"); + + return new ClickwrapRequest() + .addDocumentsItem(document) + .clickwrapName("Terms of Service") + .requireReacceptance(true) + .status(ClickwrapHelper.STATUS_ACTIVE) + .displaySettings(displaySettings); + } +} diff --git a/src/main/java/com/docusign/controller/click/services/GetClickwrapResponsesService.java b/src/main/java/com/docusign/controller/click/services/GetClickwrapResponsesService.java new file mode 100644 index 00000000..0c6efb6c --- /dev/null +++ b/src/main/java/com/docusign/controller/click/services/GetClickwrapResponsesService.java @@ -0,0 +1,16 @@ +package com.docusign.controller.click.services; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapAgreementsResponse; + +public final class GetClickwrapResponsesService { + public static ClickwrapAgreementsResponse getClickwrapResponses( + AccountsApi accountsApi, + String accountId, + String clickwrapId + ) throws ApiException { + // Step 3: Call the v1 Click API + return accountsApi.getClickwrapAgreements(accountId, clickwrapId); + } +} diff --git a/src/main/java/com/docusign/controller/click/services/GetListClickwrapsService.java b/src/main/java/com/docusign/controller/click/services/GetListClickwrapsService.java new file mode 100644 index 00000000..d6eced5b --- /dev/null +++ b/src/main/java/com/docusign/controller/click/services/GetListClickwrapsService.java @@ -0,0 +1,15 @@ +package com.docusign.controller.click.services; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapVersionsResponse; + +public final class GetListClickwrapsService { + public static ClickwrapVersionsResponse getListClickwrap( + AccountsApi accountsApi, + String accountId + ) throws ApiException{ + // Step 3: Call the v1 Click API + return accountsApi.getClickwraps(accountId); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index 7a91b168..80c6687b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -2,26 +2,21 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; - +import com.docusign.controller.eSignature.services.SigningViaEmailService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -33,15 +28,6 @@ @RequestMapping("/eg002") public class EG002ControllerSigningViaEmail extends AbstractEsignatureController { - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private final Session session; private final User user; @@ -62,70 +48,26 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = makeEnvelope(args); - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeDefinition envelope = SigningViaEmailService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getCcEmail(), + args.getCcName(), + args.getStatus(), + args + ); + EnvelopeSummary envelopeSummary = SigningViaEmailService.signingViaEmail( + envelopesApi, + session.getAccountId(), + envelope); // process results - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") - .withJsonObject(results) + + envelopeSummary.getEnvelopeId() + ".") + .withJsonObject(envelopeSummary) .addToModel(model); return DONE_EXAMPLE_PAGE; } - - // document 1 (html) has tag **signature_1** - // document 2 (docx) has tag /sn1/ - // document 3 (pdf) has tag /sn1/ - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. After it is signed, - // a copy is sent to the cc person. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // The DocuSign platform searches throughout your envelope's documents - // for matching anchor strings. So the signHere2 tab will be used in - // both document 2 and 3 since they use the same anchor string for - // their "signer 1" tabs. - Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // Create a signer recipient to sign the document, identified by name - // and email. We're setting the parameters via the object creation. - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signerTabs); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRecipientId("2"); - cc.setRoutingOrder("2"); - - // The order in the docs array determines the order in the envelope - byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please sign this document set"); - envelope.setDocuments(Arrays.asList( - EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, - DocumentType.HTML.getDefaultFileExtention(), "1"), - EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), - EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); - envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); - - return envelope; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 1c91bfb0..6ef6ba3e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -6,19 +6,16 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; -import com.docusign.esign.api.EnvelopesApi.ListStatusChangesOptions; import com.docusign.esign.client.ApiException; - -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.esign.model.EnvelopesInformation; +import com.docusign.controller.eSignature.services.ListEnvelopesServices; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; + /** * List envelopes in the user's account.
@@ -29,13 +26,9 @@ @RequestMapping("/eg003") public class EG003ControllerListEnvelopes extends AbstractEsignatureController { - private static final int FROM_DATE_OFFSET_DAYS = 30; - private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd"); - private final Session session; private final User user; - @Autowired public EG003ControllerListEnvelopes(DSConfiguration config, Session session, User user) { super(config, "eg003", "List envelopes"); @@ -47,13 +40,13 @@ public EG003ControllerListEnvelopes(DSConfiguration config, Session session, Use // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - ListStatusChangesOptions options = envelopesApi.new ListStatusChangesOptions(); - LocalDate date = LocalDate.now().minusDays(FROM_DATE_OFFSET_DAYS); - options.setFromDate(DATE_FORMATTER.format(date)); + EnvelopesInformation envelopesInformation = ListEnvelopesServices.listEnvelopes( + envelopesApi, + session.getAccountId()); DoneExample.createDefault(title) .withMessage("Results from the Envelopes::listStatusChanges method:") - .withJsonObject(envelopesApi.listStatusChanges(session.getAccountId(), options)) + .withJsonObject(envelopesInformation) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index 6c707a8f..87a84d4c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -7,9 +7,9 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; - import javax.servlet.http.HttpServletResponse; - +import com.docusign.esign.model.Envelope; +import com.docusign.controller.eSignature.services.EnvelopeInfoService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -33,7 +33,6 @@ public class EG004ControllerEnvelopeInfo extends AbstractEsignatureController { private final Session session; private final User user; - @Autowired public EG004ControllerEnvelopeInfo(DSConfiguration config, Session session, User user) { super(config, "eg004", "Get envelope information"); @@ -52,8 +51,12 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope info EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + Envelope envelope = EnvelopeInfoService.envelopeInfo( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(envelopesApi.getEnvelope(session.getAccountId(), session.getEnvelopeId())) + .withJsonObject(envelope) .withMessage("Results from the Envelopes::get method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index b493d394..2fca5c28 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -7,15 +7,16 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.esign.model.Recipients; +import com.docusign.controller.eSignature.services.EnvelopeRecipientsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; + /** * List an envelope's recipients and their status.
@@ -28,7 +29,6 @@ public class EG005ControllerEnvelopeRecipients extends AbstractEsignatureControl private final Session session; private final User user; - @Autowired public EG005ControllerEnvelopeRecipients(DSConfiguration config, Session session, User user) { super(config, "eg005", "List envelope recipients"); @@ -47,8 +47,12 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope recipients EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + Recipients recipients = EnvelopeRecipientsService.envelopeRecipients( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(envelopesApi.listRecipients(session.getAccountId(), session.getEnvelopeId())) + .withJsonObject(recipients) .withMessage("Results from the EnvelopeRecipients::list method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java index a4c152e8..8e06f624 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java @@ -13,9 +13,9 @@ import java.util.ArrayList; import java.util.List; - import javax.servlet.http.HttpServletResponse; +import com.docusign.controller.eSignature.services.EnvelopeDocsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -56,7 +56,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. List the envelope's documents - EnvelopeDocumentsResult result = envelopesApi.listDocuments(session.getAccountId(), session.getEnvelopeId()); + EnvelopeDocumentsResult envelopeDocumentsResult = EnvelopeDocsService.envelopeDocs( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); // Step 2. Process results // Save the envelopeId and its list of documents in the session so @@ -66,7 +69,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopeDocItems.add(new EnvelopeDocumentInfo("Combined", "content", "combined")); envelopeDocItems.add(new EnvelopeDocumentInfo("Zip archive", "zip", "archive")); - for (EnvelopeDocument doc : result.getEnvelopeDocuments()) { + for (EnvelopeDocument doc : envelopeDocumentsResult.getEnvelopeDocuments()) { String documentName = doc.getName(); if (StringUtils.equals(doc.getDocumentId(), "certificate")) { documentName = "Certificate of completion"; @@ -75,7 +78,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse } DoneExample.createDefault(title) - .withJsonObject(result) + .withJsonObject(envelopeDocumentsResult) .withMessage("Results from the EnvelopeDocuments::list method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index ee20df48..9a3a4277 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -3,11 +3,13 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.common.DocumentType; -import com.docusign.core.model.*; +import com.docusign.core.model.EnvelopeDocumentInfo; +import com.docusign.core.model.OptionItem; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; - -import org.apache.commons.io.FilenameUtils; +import com.docusign.controller.eSignature.services.EnvelopeGetDocService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; @@ -15,13 +17,12 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; -import javax.servlet.http.HttpServletResponse; - /** * Download a document from an envelope.
@@ -35,11 +36,9 @@ public class EG007ControllerEnvelopeGetDoc extends AbstractEsignatureController private static final String MODEL_DOCUMENT_OPTIONS = "documentOptions"; private static final String HTTP_CONTENT_DISPOSITION_VALUE = "inline;filename="; private static final String ZIP_EXTENSION = "zip"; - private final Session session; private final User user; - @Autowired public EG007ControllerEnvelopeGetDoc(DSConfiguration config, Session session, User user) { super(config, "eg007", "Download a document"); @@ -73,13 +72,17 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2 start EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2 end - + // EnvelopeDocuments::get. - // Exceptions will be caught by the calling function + // Exceptions will be caught by the calling function String documentId = args.getDocSelect(); - // Step 3 start - byte[] results = envelopesApi.getDocument(session.getAccountId(), session.getEnvelopeId(), documentId); - // Step 3 end + // Step 3 start + byte[] envelopeDocument = EnvelopeGetDocService.envelopeGetDoc( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId(), + documentId); + // Step 3 end // Process results List envelopeDocuments = session.getEnvelopeDocuments(); @@ -89,34 +92,26 @@ protected Object doWork(WorkArguments args, ModelMap model, String docType = docItem.getType(); String pdfExtention = DocumentType.PDF.getDefaultFileExtention(); if (StringUtils.equalsAny(docType, "content", "summary", pdfExtention)) { - docName = addExtension(docName, pdfExtention); + docName = EnvelopeGetDocService.addExtension(docName, pdfExtention); } if (ZIP_EXTENSION.equals(docType)) { - docName = addExtension(docName, ZIP_EXTENSION); + docName = EnvelopeGetDocService.addExtension(docName, ZIP_EXTENSION); } response.setContentType(URLConnection.guessContentTypeFromName(docName)); - response.setContentLength(results.length); + response.setContentLength(envelopeDocument.length); response.setHeader(HttpHeaders.CONTENT_DISPOSITION, HTTP_CONTENT_DISPOSITION_VALUE + docName); - response.getOutputStream().write(results); + response.getOutputStream().write(envelopeDocument); response.flushBuffer(); return null; } - private static String addExtension(String fileName, String extension) { - if (FilenameUtils.isExtension(fileName, extension)) { - return fileName; - } - return String.join(".", fileName, extension); - } - private static EnvelopeDocumentInfo find(List documents, String documentId) { for (EnvelopeDocumentInfo docInfo : documents) { if (StringUtils.equalsIgnoreCase(docInfo.getDocumentId(), documentId)) { return docInfo; } } - throw new ExampleException("Requested document is not found.", null); - } + } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index c438af47..045ae00c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -5,33 +5,19 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.esign.api.TemplatesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; -import com.docusign.esign.model.Checkbox; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeTemplate; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.List; -import com.docusign.esign.model.ListItem; -import com.docusign.esign.model.Radio; -import com.docusign.esign.model.RadioGroup; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; import com.docusign.esign.model.TemplateSummary; -import com.docusign.esign.model.Text; +import com.docusign.controller.eSignature.services.CreateTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; -import java.util.Locale; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -43,16 +29,9 @@ @RequestMapping("/eg008") public class EG008ControllerCreateTemplate extends AbstractEsignatureController { - private static final String TEMPLATE_NAME = "Example Signer and CC template"; - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_fields.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCUMENT_ID = "1"; - private static final String PAGE_NUMBER = "1"; - private static final String FALSE = "false"; - private final Session session; private final User user; - + private static final String TEMPLATE_NAME = "Example Signer and CC template"; @Autowired public EG008ControllerCreateTemplate(DSConfiguration config, Session session, User user) { @@ -67,15 +46,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { // Step 1. list existing templates ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); - TemplatesApi templatesApi = new TemplatesApi(apiClient); - TemplatesApi.ListTemplatesOptions options = templatesApi.new ListTemplatesOptions(); - options.setSearchText(TEMPLATE_NAME); String accountId = session.getAccountId(); - EnvelopeTemplateResults results = templatesApi.listTemplates(accountId, options); + EnvelopeTemplateResults envelopeTemplateResults = CreateTemplateService.searchTemplatesByName( + apiClient, + accountId, + TEMPLATE_NAME); // Step 2. Process results. If template do not exist, create one - if (Integer.parseInt(results.getResultSetSize()) > 0) { - EnvelopeTemplate template = results.getEnvelopeTemplates().get(0); + if (Integer.parseInt(envelopeTemplateResults.getResultSetSize()) > 0) { + EnvelopeTemplate template = envelopeTemplateResults.getEnvelopeTemplates().get(0); DoneExample.createDefault(title) .withMessage(String.format( "The template already exists in your account.
Template name: %s, ID %s.", @@ -83,155 +62,17 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); } else { session.setTemplateName(TEMPLATE_NAME); - TemplateSummary template = templatesApi.createTemplate(accountId, makeTemplate()); + TemplateSummary template = CreateTemplateService.createTemplate( + apiClient, + accountId, + CreateTemplateService.makeTemplate(session.getTemplateName())); DoneExample.createDefault(title) .withMessage(String.format( "The template has been created!
Template name: %s, ID %s.", template.getName(), template.getTemplateId())) .addToModel(model); } - return DONE_EXAMPLE_PAGE; } - - // document 1 (pdf) has tag /sn1/ - // - // The template has two recipient roles. - // recipient 1 - signer - // recipient 2 - cc - // The template will be sent first to the signer. - // After it is signed, a copy is sent to the cc person. - private EnvelopeTemplate makeTemplate() throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "1"); - - // Tabs are set per recipient / signer - Tabs signer1Tabs = new Tabs(); - signer1Tabs.setCheckboxTabs(Arrays.asList( - createCheckbox("ckAuthorization", "75", "417"), - createCheckbox("ckAuthentication", "75", "447"), - createCheckbox("ckAgreement", "75", "478"), - createCheckbox("ckAcknowledgement", "75", "508"))); - signer1Tabs.setListTabs(Arrays.asList(createList())); - signer1Tabs.setRadioGroupTabs(Arrays.asList(createRadioGroup())); - signer1Tabs.setSignHereTabs(Arrays.asList(createSignHere())); - signer1Tabs.textTabs(Arrays.asList( - createText("text", "153", "230"), - createText("numbersOnly", "153", "260"))); - - // create a signer recipient to sign the document, identified by name and email - // routingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signer1Tabs); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc1 = new CarbonCopy(); - cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); - cc1.setRoutingOrder("2"); - cc1.setRecipientId("2"); - - // Create the overall template definition. The order in the docs array - // determines the order in the envelope. - EnvelopeTemplate template = new EnvelopeTemplate(); - template.setDocuments(Arrays.asList(doc)); - template.setEmailSubject("Please sign this document"); - template.setName(session.getTemplateName()); - template.setDescription("Example template created via the API"); - template.setShared(FALSE); - template.setRecipients(EnvelopeHelpers.createRecipients(signer, cc1)); - template.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); - - return template; - } - - private static List createList() { - List list = new List(); - list.setDocumentId(DOCUMENT_ID); - list.setPageNumber(PAGE_NUMBER); - list.setXPosition("142"); - list.setYPosition("291"); - list.setFont("helvetica"); - list.setFontSize("size14"); - list.setTabLabel("list"); - list.setRequired(FALSE); - list.setListItems(Arrays.asList( - createListItem("Red"), - createListItem("Orange"), - createListItem("Yellow"), - createListItem("Green"), - createListItem("Blue"), - createListItem("Indigo"), - createListItem("Violet") - )); - return list; - } - - private static ListItem createListItem(String color) { - ListItem item = new ListItem(); - item.setText(color); - item.setValue(color.toLowerCase(Locale.ENGLISH)); - return item; - } - - private static RadioGroup createRadioGroup() { - RadioGroup radioGroup = new RadioGroup(); - radioGroup.setDocumentId(DOCUMENT_ID); - radioGroup.setGroupName("radio1"); - - radioGroup.setRadios(Arrays.asList( - createRadio("white", "142"), - createRadio("red", "74"), - createRadio("blue", "220") - )); - return radioGroup; - } - - private static Radio createRadio(String value, String xPosition) { - Radio radio = new Radio(); - radio.setPageNumber(PAGE_NUMBER); - radio.setValue(value); - radio.setXPosition(xPosition); - radio.setYPosition("384"); - radio.setRequired(FALSE); - return radio; - } - - private static Checkbox createCheckbox(String label, String xPosition, String yPosition) { - Checkbox check = new Checkbox(); - check.setDocumentId(DOCUMENT_ID); - check.setPageNumber(PAGE_NUMBER); - check.setXPosition(xPosition); - check.setYPosition(yPosition); - check.setTabLabel(label); - return check; - } - - private static Text createText(String label, String xPosition, String yPosition) { - Text text = new Text(); - text.setDocumentId(DOCUMENT_ID); - text.setPageNumber(PAGE_NUMBER); - text.setXPosition(xPosition); - text.setYPosition(yPosition); - text.setFont("helvetica"); - text.setFontSize("size14"); - text.setTabLabel(label); - text.setHeight("23"); - text.setWidth("84"); - text.setRequired(FALSE); - return text; - } - - private static SignHere createSignHere() { - SignHere signHere = new SignHere(); - signHere.setDocumentId(DOCUMENT_ID); - signHere.setPageNumber(PAGE_NUMBER); - signHere.setXPosition("191"); - signHere.setYPosition("148"); - return signHere; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index 6f040944..050313a7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -12,13 +12,11 @@ import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.TemplateRole; - +import com.docusign.controller.eSignature.services.UseTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; @@ -37,11 +35,9 @@ public class EG009ControllerUseTemplate extends AbstractEsignatureController { private static final String MODEL_LIST_TEMPLATE = "listTemplates"; - private final Session session; private final User user; - @Autowired public EG009ControllerUseTemplate(DSConfiguration config, Session session, User user) { super(config, "eg009", "Envelope sent"); @@ -62,35 +58,25 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = makeEnvelope(args); - EnvelopeSummary result = envelopesApi.createEnvelope(session.getAccountId(), envelope); - - session.setEnvelopeId(result.getEnvelopeId()); + EnvelopeDefinition envelope = UseTemplateService.makeEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getCcEmail(), + args.getCcName(), + args.getTemplateId() + ); + EnvelopeSummary envelopeSummary = UseTemplateService.createEnvelopeTemplate( + envelopesApi, + session.getAccountId(), + envelope); + + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(result) + .withJsonObject(envelopeSummary) .withMessage("The envelope has been created and sent!
Envelope ID " - + result.getEnvelopeId() + ".") + + envelopeSummary.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition makeEnvelope(WorkArguments args) { - TemplateRole signer = new TemplateRole(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - - TemplateRole cc = new TemplateRole(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setTemplateId(args.getTemplateId()); - envelope.setTemplateRoles(Arrays.asList(signer, cc)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index 4c04ed38..29e8ae6c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -2,35 +2,18 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.esign.model.CarbonCopy; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; - -import lombok.Value; - -import org.json.JSONArray; +import com.docusign.controller.eSignature.services.SendBinaryDocsService; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.util.StreamUtils; import org.springframework.web.bind.annotation.RequestMapping; -import javax.net.ssl.HttpsURLConnection; -import javax.servlet.http.HttpServletResponse; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.core.MediaType; -import java.io.DataOutputStream; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.List; /** @@ -42,23 +25,9 @@ @RequestMapping("/eg010") public class EG010ControllerSendBinaryDocs extends AbstractEsignatureController { - private static final String HYPHENS = "--"; - private static final String LINE_DELIMITER = "\r\n"; - private static final String BOUNDARY_DELIMITER = "multipartboundary_multipartboundary"; - - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private final Session session; private final User user; - @Autowired public EG010ControllerSendBinaryDocs(DSConfiguration config, Session session, User user) { super(config, "eg010", "Send envelope with multipart mime"); @@ -69,50 +38,16 @@ public EG010ControllerSendBinaryDocs(DSConfiguration config, Session session, Us @Override // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException { - // Step 1. Gather documents and their headers - List documents = List.of( - new DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, - EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)), - new DocumentInfo(DOCX_DOCUMENT_NAME, "2", DocumentType.DOCX, - EnvelopeHelpers.readFile(DOCX_DOCUMENT_FILE_NAME)), - new DocumentInfo(PDF_DOCUMENT_NAME, "3", DocumentType.PDF, - EnvelopeHelpers.readFile(PDF_DOCUMENT_FILE_NAME)) - ); - - // Step 2. Make the envelope JSON request body - JSONObject envelopeJSON = makeEnvelopeJSON(args, documents); - - // Step 3. Create the multipart body - URL uri = new URL(String.format("%s/v2.1/accounts/%s/envelopes", session.getBasePath(), session.getAccountId())); - String contentType = String.join("",MediaType.MULTIPART_FORM_DATA, "; boundary=", BOUNDARY_DELIMITER); - HttpsURLConnection connection = (HttpsURLConnection) uri.openConnection(); - connection.setRequestMethod(HttpMethod.POST); - connection.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); - connection.setRequestProperty(HttpHeaders.CONTENT_TYPE, contentType); - connection.setRequestProperty(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + user.getAccessToken()); - connection.setDoOutput(true); - - // See https://developers.docusign.com/esign-rest-api/guides/requests-and-responses - DataOutputStream buffer = new DataOutputStream(connection.getOutputStream()); - writeBoundaryHeader(buffer, MediaType.APPLICATION_JSON, "form-data"); - buffer.writeBytes(envelopeJSON.toString(DoneExample.JSON_INDENT_FACTOR)); - - for (DocumentInfo docInfo : documents) { - String content = String.format("file; filename=\"%s\";documentid=%s", docInfo.getName(), docInfo.getId()); - buffer.writeBytes(LINE_DELIMITER); - writeBoundaryHeader(buffer, docInfo.getDocType().getMime(), content); - buffer.write(docInfo.getData()); - } - - writeClosingBoundary(buffer); - - int responseCode = connection.getResponseCode(); - if (responseCode < HttpURLConnection.HTTP_OK || responseCode >= HttpURLConnection.HTTP_MULT_CHOICE) { - String error = StreamUtils.copyToString(connection.getErrorStream(), StandardCharsets.UTF_8); - throw new ExampleException(error, null); - } - - String responseString = StreamUtils.copyToString(connection.getInputStream(), StandardCharsets.UTF_8); + String responseString = SendBinaryDocsService.sendBinaryDocs( + args, + args.getSignerName(), + args.getSignerEmail(), + args.getCcName(), + args.getCcEmail(), + session.getBasePath(), + session.getAccountId(), + user.getAccessToken() + ); JSONObject obj = new JSONObject(responseString); String envelopeId = obj.getString("envelopeId"); session.setEnvelopeId(envelopeId); @@ -122,91 +57,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static void writeBoundaryHeader(DataOutputStream buffer, - String contentType, String contentDisposition) throws IOException { - buffer.writeBytes(HYPHENS); - buffer.writeBytes(BOUNDARY_DELIMITER); - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_TYPE, contentType)); - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_DISPOSITION, contentDisposition)); - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(LINE_DELIMITER); - } - - private static void writeClosingBoundary(DataOutputStream buffer) throws IOException { - buffer.writeBytes(LINE_DELIMITER); - buffer.writeBytes(HYPHENS); - buffer.writeBytes(BOUNDARY_DELIMITER); - buffer.writeBytes(HYPHENS); - buffer.writeBytes(LINE_DELIMITER); - buffer.flush(); - } - - // document 1 (html) has tag **signature_1** - // document 2 (docx) has tag /sn1/ - // document 3 (pdf) has tag /sn1/ - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. - // After it is signed, a copy is sent to the cc person. - private static JSONObject makeEnvelopeJSON(WorkArguments args, List documents) { - // The DocuSign platform searches throughout your envelope's documents for - // matching anchor strings. So the signHere2 tab will be used in both document - // 2 and 3 since they use the same anchor string for their "signer 1" tabs. - Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // create a signer recipient to sign the document, identified by name and email - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signerTabs); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy(); - cc.setEmail(args.getCcEmail()); - cc.setName(args.getCcName()); - cc.setRecipientId("2"); - cc.setRoutingOrder("2"); - - // The order in the documents array determines the order in the envelope - JSONArray jsonDocuments = new JSONArray(); - for (DocumentInfo docInfo : documents) { - JSONObject jsonDoc = new JSONObject(); - jsonDoc.put("name", docInfo.getName()); - jsonDoc.put("fileExtension", docInfo.getDocType().getDefaultFileExtention()); - jsonDoc.put("documentId", docInfo.getId()); - jsonDocuments.put(jsonDoc); - } - - // Create the envelope definition. Request that the envelope be sent by - // setting |status| to "sent". To request that the envelope be created - // as a draft, set to "created" - JSONObject envelopeJSON = new JSONObject(); - envelopeJSON.put("emailSubject", "Please sign this document set"); - envelopeJSON.put("documents", jsonDocuments); - envelopeJSON.put("recipients", new JSONObject(EnvelopeHelpers.createRecipients(signer, cc))); - envelopeJSON.put("status", EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeJSON; - } - - @Value - private static class DocumentInfo { - private String name; - private String id; - private DocumentType docType; - private byte[] data; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index 40d494b4..e3edb1cb 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -6,20 +6,17 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.ReturnUrlRequest; import com.docusign.esign.model.ViewUrl; - +import com.docusign.controller.eSignature.services.EmbeddedSendingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; -import java.io.IOException; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -35,7 +32,6 @@ public class EG011ControllerEmbeddedSending extends AbstractEsignatureController private final Session session; private final User user; - @Autowired public EG011ControllerEmbeddedSending(DSConfiguration config, Session session, User user) { super(config, "eg011", "Signing request by email"); @@ -51,17 +47,25 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. Make the envelope with "created" (draft) status - args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); - EnvelopeDefinition env = EG002ControllerSigningViaEmail.makeEnvelope(args); - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, env); - String envelopeId = results.getEnvelopeId(); + EnvelopeSummary envelopeSummary = EmbeddedSendingService.createEnvelopeWithDraftStatus( + envelopesApi, + args.getSignerEmail(), + args.getSignerName(), + args.getCcEmail(), + args.getCcName(), + args.getStatus(), + args, + accountId); + String envelopeId = envelopeSummary.getEnvelopeId(); // Step 2. Create the sender view. // Set the url where you want the recipient to go once they are done // signing should typically be a callback route somewhere in your app. - ReturnUrlRequest viewRequest = new ReturnUrlRequest(); - viewRequest.setReturnUrl(config.getDsReturnUrl()); - ViewUrl viewUrl = envelopesApi.createSenderView(accountId, envelopeId, viewRequest); + ViewUrl viewUrl = EmbeddedSendingService.createSenderView( + envelopesApi, + accountId, + envelopeId, + config.getDsReturnUrl()); // Switch to Recipient and Documents view if requested by the user String url = viewUrl.getUrl(); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java index 2b315a62..99dcf832 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java @@ -6,11 +6,8 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.ConsoleViewRequest; import com.docusign.esign.model.ViewUrl; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.controller.eSignature.services.EmbeddedConsoleService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -18,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; +import javax.servlet.http.HttpServletResponse; + /** * Embedded the DocuSign Web UI.
@@ -33,7 +32,6 @@ public class EG012ControllerEmbeddedConsole extends AbstractEsignatureController private final Session session; private final User user; - @Autowired public EG012ControllerEmbeddedConsole(DSConfiguration config, Session session, User user) { super(config, "eg012", "Embedded DocuSign web tool"); @@ -54,19 +52,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 1. Create the Console / Web UI view. - // Set the URL where you want the recipient to go once they are finished in - // the Web UI. There are cases where a user will never click "FINISH" within - // the Web UI, you cannot assume control will be passed back to your application. - ConsoleViewRequest viewRequest = new ConsoleViewRequest(); - viewRequest.setReturnUrl(config.getDsReturnUrl()); - String envelopeId = session.getEnvelopeId(); - if ("envelope".equalsIgnoreCase(args.getStartingView()) && envelopeId != null) { - viewRequest.setEnvelopeId(envelopeId); - } - // Step 2. Call the CreateSenderView API - ViewUrl viewUrl = envelopesApi.createConsoleView(session.getAccountId(), viewRequest); + ViewUrl viewUrl = EmbeddedConsoleService.createConsoleView( + envelopesApi, + config.getDsReturnUrl(), + session.getEnvelopeId(), + args.getStartingView(), + session.getAccountId()); + return new RedirectView(viewUrl.getUrl()); } // ***DS.snippet.0.end diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index 3d7a8630..0e6b8f3b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -2,35 +2,23 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.api.TemplatesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; -import com.docusign.esign.model.CompositeTemplate; -import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.InlineTemplate; -import com.docusign.esign.model.RecipientViewRequest; -import com.docusign.esign.model.ServerTemplate; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; import com.docusign.esign.model.ViewUrl; - +import com.docusign.controller.eSignature.services.AddDocToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; -import java.io.IOException; -import java.util.Arrays; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -44,16 +32,9 @@ public class EG013ControllerAddDocToTemplate extends AbstractEsignatureController { private static final String MODEL_LIST_TEMPLATE = "listTemplates"; - private static final String SIGNER_CLIENT_ID = "1000"; - private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl"; - private static final String HTML_DOCUMENT_NAME = "Appendix 1--Sales order"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private final Session session; private final User user; - @Autowired public EG013ControllerAddDocToTemplate(DSConfiguration config, Session session, User user) { super(config, "eg013", "Use embedded signing from template and extra doc"); @@ -76,109 +57,21 @@ protected Object doWork(WorkArguments args, ModelMap model, String accountId = session.getAccountId(); EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 2 start - args.setDsReturnUrl(config.getDsReturnUrl()); - args.setDsPingUrl(config.getDsPingUrl()); - args.setSignerClientId(SIGNER_CLIENT_ID); - EnvelopeDefinition envelope = makeEnvelope(args); - // Step 2 end - - // Step 3 start - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); - // Step 3 end - - // Step 4 start - RecipientViewRequest viewRequest = makeRecipientViewRequest(args); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); + ViewUrl viewUrl = AddDocToTemplateService.addDocumentToTemplate( + envelopesApi, + args.getSignerEmail(), + args.getSignerName(), + args.getSignerClientId(), + args.getCcEmail(), + args.getCcName(), + args.getTemplateId(), + accountId, + config.getDsReturnUrl(), + config.getDsPingUrl(), + args + ); + return new RedirectView(viewUrl.getUrl()); // Step 4 end } - - private static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - viewRequest.setReturnUrl(args.getDsReturnUrl()); - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(args.getSignerEmail()); - viewRequest.setUserName(args.getSignerName()); - viewRequest.setClientUserId(args.getSignerClientId()); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); - viewRequest.setPingUrl(args.getDsPingUrl()); - - return viewRequest; - } - - // The envelope request object uses Composite Template to include in the envelope: - // 1. A template stored on the DocuSign service - // 2. An additional document which is a custom HTML source document - private EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // Create a signer and cc recipients for the signer role of the server template - CarbonCopy cc1 = new CarbonCopy(); - cc1.setEmail(args.getCcEmail()); - cc1.setName(args.getCcName()); - cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); - cc1.setRecipientId("2"); - - // create a composite template for the Server Template - CompositeTemplate compTemplate1 = new CompositeTemplate(); - compTemplate1.setCompositeTemplateId("1"); - ServerTemplate serverTemplates = new ServerTemplate(); - serverTemplates.setSequence("1"); - serverTemplates.setTemplateId(args.getTemplateId()); - compTemplate1.setServerTemplates(Arrays.asList(serverTemplates)); - - // Add the roles via an inlineTemplate - InlineTemplate inlineTemplate = new InlineTemplate(); - inlineTemplate.setSequence("2"); - inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients(createSigner(args), cc1)); - compTemplate1.setInlineTemplates(Arrays.asList(inlineTemplate)); - - // The signer recipient for the added document with a tab definition: - Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); - Signer signer1AddedDoc = createSigner(args); - signer1AddedDoc.setTabs(signer1Tabs); - - // create the HTML document - byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); - - // create a composite template for the added document and add the recipients via an inlineTemplate - CompositeTemplate compTemplate2 = new CompositeTemplate(); - compTemplate2.setCompositeTemplateId("2"); - InlineTemplate inlineTemplate2 = new InlineTemplate(); - inlineTemplate2.setSequence("1"); - inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc1)); - compTemplate2.setInlineTemplates(Arrays.asList(inlineTemplate2)); - compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, - DocumentType.HTML.getDefaultFileExtention(), "1")); - - EnvelopeDefinition env = new EnvelopeDefinition(); - env.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - env.setCompositeTemplates(Arrays.asList(compTemplate1, compTemplate2)); - - return env; - } - - // Adding clientUserId transforms the template recipient into an embedded recipient - private static Signer createSigner(WorkArguments args) { - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - signer.setRecipientId("1"); - signer.setClientUserId(args.getSignerClientId()); - return signer; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 4df3a2aa..d81e13ea 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -2,31 +2,21 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.FormulaTab; -import com.docusign.esign.model.List; -import com.docusign.esign.model.ListItem; -import com.docusign.esign.model.PaymentDetails; -import com.docusign.esign.model.PaymentLineItem; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; - +import com.docusign.controller.eSignature.services.CollectPaymentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -49,23 +39,9 @@ public class EG014ControllerCollectPayment extends AbstractEsignatureController { private static final String MODEL_GATEWAY_OK = "gatewayOk"; - private static final String HTML_DOCUMENT_FILE_NAME = "templates/order-form.ftl"; - private static final String HTML_DOCUMENT_NAME = "Order form"; - // Order form constants - private static final String TRUE = "true"; - private static final String FALSE = "false"; - private static final int L1_PRICE = 5; - private static final int L2_PRICE = 150; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private static final String DEFAULT_FONT = "helvetica"; - private static final String DEFAULT_FONT_SIZE = "size11"; - private static final String ANCHOR_UNITS = "pixels"; - private final Session session; private final User user; - @Autowired public EG014ControllerCollectPayment(DSConfiguration config, Session session, User user) { super(config, "eg014", "Envelope sent"); @@ -82,161 +58,28 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) throws ApiException, IOException { + HttpServletResponse response) throws ApiException, IOException { EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 1. Make the envelope request body - EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeDefinition envelope = CollectPaymentService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getCcName(), + args.getCcEmail(), + config.getGatewayAccountId(), + config.getGatewayName(), + config.getGatewayDisplayName(), + args); // Step 2. call Envelopes::create API method - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); DoneExample.createDefault(title) .withMessage(String.join("", "The envelope has been created and sent!
Envelope ID ", - results.getEnvelopeId(), ".")) + envelopeSummary.getEnvelopeId(), ".")) .addToModel(model); return DONE_EXAMPLE_PAGE; } - - // document 1 (html) has multiple tags: - // /l1q/ and /l2q/ -- quantities: drop down - // /l1e/ and /l2e/ -- extended: payment lines - // /l3t/ -- total -- formula - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. - // After it is signed, a copy is sent to the cc person. - private EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); - - // create a signer recipient to sign the document, identified by name and email - // routingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer() - .email(args.getSignerEmail()) - .name(args.getSignerName()) - .recipientId("1") - .routingOrder("1"); - signer.setTabs(createTabs()); - - // create a cc recipient to receive a copy of the documents, identified by name and email - CarbonCopy cc = new CarbonCopy() - .email(args.getCcEmail()) - .name(args.getCcName()) - .routingOrder("2") - .recipientId("2"); - - // Create the envelope definition - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please complete your order"); - envelope.setDocuments(Arrays.asList(EnvelopeHelpers.createDocument(htmlDoc, - HTML_DOCUMENT_NAME, DocumentType.HTML.getDefaultFileExtention(), "1"))); - envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelope; - } - - // creates tabs per signer - private Tabs createTabs() { - java.util.List listItems = java.util.List.of( - new ListItem().text("none").value("0"), - new ListItem().text("1").value("1"), - new ListItem().text("2").value("2"), - new ListItem().text("3").value("3"), - new ListItem().text("4").value("4"), - new ListItem().text("5").value("5"), - new ListItem().text("6").value("6"), - new ListItem().text("7").value("7"), - new ListItem().text("8").value("8"), - new ListItem().text("9").value("9"), - new ListItem().text("10").value("10")); - List listl1q = createList("/l1q/", "l1q", listItems); - List listl2q = createList("/l2q/", "l2q", listItems); - - // Create two formula tabs for the extended price on the line items and formula for the total - FormulaTab formulal1e = createFormulaTab("/l1e/", "l1e", L1_PRICE); - FormulaTab formulal2e = createFormulaTab("/l2e/", "l2e", L2_PRICE); - FormulaTab formulal3t = new FormulaTab() - .font(DEFAULT_FONT) - .bold(TRUE) - .fontSize("size12") - .anchorString("/l3t/") - .anchorYOffset("-8") - .anchorUnits(ANCHOR_UNITS) - .anchorXOffset("50") - .tabLabel("l3t") - .formula("[l1e] + [l2e]") - .roundDecimalPlaces("0") - .required(TRUE) - .locked(TRUE) - .disableAutoSize(FALSE); - PaymentLineItem paymentLineIteml1 = new PaymentLineItem() - .name("Harmonica") - .description(String.format("${%d} each", L1_PRICE)) - .amountReference("l1e"); - PaymentLineItem paymentLineIteml2 = new PaymentLineItem() - .name("Xylophone") - .description(String.format("${%d} each", L2_PRICE)) - .amountReference("l2e"); - PaymentDetails paymentDetails = new PaymentDetails() - .gatewayAccountId(config.getGatewayAccountId()) - .currencyCode("USD") - .gatewayName(config.getGatewayName()) - .gatewayDisplayName(config.getGatewayDisplayName()) - .lineItems(Arrays.asList(paymentLineIteml1, paymentLineIteml2)); - // Hidden formula for the payment itself - FormulaTab formulaPayment = new FormulaTab() - .tabLabel("payment") - .formula("([l1e] + [l2e]) * {100}") - .roundDecimalPlaces("0") - .paymentDetails(paymentDetails) - .hidden(TRUE) - .required(TRUE) - .locked(TRUE) - .documentId("1") - .pageNumber("1") - .xPosition("0") - .yPosition("0"); - - Tabs signerTabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); - signerTabs.listTabs(Arrays.asList(listl1q, listl2q)); - signerTabs.formulaTabs(Arrays.asList(formulal1e, formulal2e, formulal3t, formulaPayment)); - return signerTabs; - } - - private static List createList(String anchor, String label, java.util.List items) { - return new List() - .font(DEFAULT_FONT) - .fontSize(DEFAULT_FONT_SIZE) - .anchorString(anchor) - .anchorYOffset("-10") - .anchorUnits(ANCHOR_UNITS) - .anchorXOffset("0") - .listItems(items) - .required(TRUE) - .tabLabel(label); - } - - private static FormulaTab createFormulaTab(String anchor, String label, int price) { - return new FormulaTab() - .font(DEFAULT_FONT) - .fontSize(DEFAULT_FONT_SIZE) - .anchorString(anchor) - .anchorYOffset("-8") - .anchorUnits(ANCHOR_UNITS) - .anchorXOffset("105") - .tabLabel(label) - .formula(String.format("[l1q] * {%d}", price)) - .roundDecimalPlaces("0") - .required(TRUE) - .locked(TRUE) - .disableAutoSize(FALSE); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java index 18001930..6ffc15cf 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java @@ -7,6 +7,8 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeFormData; +import com.docusign.controller.eSignature.services.GetTabValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -27,7 +29,6 @@ public class EG015ControllerGetTabValues extends AbstractEsignatureController { private final Session session; private final User user; - @Autowired public EG015ControllerGetTabValues(DSConfiguration config, Session session, User user) { super(config, "eg015", "Get Envelope Tabs"); @@ -46,8 +47,12 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 1. get envelope recipients EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + EnvelopeFormData envelopeFormData = GetTabValuesService.getTabValues( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(envelopesApi.getFormData(session.getAccountId(), session.getEnvelopeId())) + .withJsonObject(envelopeFormData) .withMessage("Results from the Envelope::GetFormData method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java index 59f4d74f..84e46145 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java @@ -7,34 +7,28 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; - -import com.docusign.esign.model.*; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.RecipientViewRequest; +import com.docusign.esign.model.ViewUrl; +import com.docusign.controller.eSignature.services.SetTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; -import java.io.IOException; -import java.util.Arrays; - import javax.servlet.http.HttpServletResponse; +import java.io.IOException; @Controller @RequestMapping("/eg016") public class EG016ControllerSetTabValues extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_salary.docx"; - private static final String DOCUMENT_NAME = "Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = 20; - private static final int ANCHOR_OFFSET_X = 10; - private static final String SIGNER_CLIENT_ID = "1000"; - private final Session session; private final User user; - @Autowired public EG016ControllerSetTabValues(DSConfiguration config, Session session, User user) { super(config, "eg016", "Set envelope tab values"); @@ -49,8 +43,7 @@ protected Object doWork(WorkArguments args, ModelMap model, String signerEmail = args.getSignerEmail(); String accountId = session.getAccountId(); - - EnvelopeDefinition envelope = makeEnvelope(signerEmail, signerName); + EnvelopeDefinition envelope = SetTabValuesService.makeEnvelope(signerEmail, signerName); // Step 2. Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); @@ -63,135 +56,15 @@ protected Object doWork(WorkArguments args, ModelMap model, session.setEnvelopeId(envelopeId); // Step 6. Create the view request - RecipientViewRequest viewRequest = makeRecipientViewRequest(signerEmail, signerName); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + RecipientViewRequest viewRequest = SetTabValuesService.makeRecipientViewRequest( + signerEmail, + signerName, + config.getDsReturnUrl(), + config.getDsPingUrl()); + ViewUrl viewUrl = SetTabValuesService.createRecipientView(envelopesApi, accountId, envelopeId, viewRequest); // State can be stored/recovered using the framework's session or a // query parameter on the returnUrl (see the makeRecipientViewRequest method) return new RedirectView(viewUrl.getUrl()); } - - private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String signerName) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - // The query parameter is included as an example of how - // to save/recover state information during the redirect to - // the DocuSign signing. It's usually better to use - // the session mechanism of your web framework. Query parameters - // can be changed/spoofed very easily. - viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); - - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(SIGNER_CLIENT_ID); - - // DocuSign recommends that you redirect to DocuSign for the - // Embedded signing . There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds - viewRequest.setPingUrl(config.getDsPingUrl()); - - return viewRequest; - } - - // Step 4. Construct your request body - private static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName) throws IOException { - // Create a signer recipient to sign the document, identified by name and email - // We set the clientUserId to enable embedded signing for the recipient - Signer signer = new Signer(); - signer.setEmail(signerEmail); - signer.setName(signerName); - signer.clientUserId(SIGNER_CLIENT_ID); - signer.recipientId("1"); - - // Step 3. Create tabs and CustomFields - SignHere signHere = new SignHere(); - signHere.setAnchorString("/sn1"); - signHere.setAnchorUnits("pixels"); - signHere.setAnchorYOffset("10"); - signHere.setAnchorXOffset("20"); - - Text textLegal = new Text(); - textLegal.setAnchorString("/legal/"); - textLegal.setAnchorUnits("pixels"); - textLegal.setAnchorYOffset("-9"); - textLegal.setAnchorXOffset("5"); - textLegal.setFont("helvetica"); - textLegal.setFontSize("size11"); - textLegal.setBold("true"); - textLegal.setValue(signerName); - textLegal.setLocked("false"); - textLegal.setTabId("legal_name"); - textLegal.setTabLabel("Legal Name"); - - Text textFamiliar = new Text(); - textFamiliar.setAnchorString("/familar/"); - textFamiliar.setAnchorUnits("pixels"); - textFamiliar.setAnchorYOffset("-9"); - textFamiliar.setAnchorXOffset("5"); - textFamiliar.setFont("helvetica"); - textFamiliar.setFontSize("size11"); - textFamiliar.setBold("true"); - textFamiliar.setValue(signerName); - textFamiliar.setLocked("false"); - textFamiliar.setTabId("familiar_name"); - textFamiliar.setTabLabel("Familiar Name"); - - Integer salary = 123000; - - Text textSalary = new Text(); - textSalary.setAnchorString("/salary/"); - textSalary.setAnchorUnits("pixels"); - textSalary.setAnchorYOffset("-9"); - textSalary.setAnchorXOffset("5"); - textSalary.setFont("helvetica"); - textSalary.setFontSize("size11"); - textSalary.setBold("true"); - textSalary.setValue(String.format("$ %d", salary)); - textSalary.setLocked("true"); - textSalary.setTabId("salary"); - textSalary.setTabLabel("salary"); - - TextCustomField salaryCustomField = new TextCustomField(); - salaryCustomField.setName("salary"); - salaryCustomField.setRequired("false"); - salaryCustomField.setShow("true"); // Yes, included in the CoC - salaryCustomField.setValue(String.valueOf(salary)); - - CustomFields cf = new CustomFields(); - cf.setTextCustomFields(Arrays.asList(salaryCustomField)); - - Tabs tabs = new Tabs(); - tabs.setSignHereTabs(Arrays.asList(signHere)); - tabs.setTextTabs(Arrays.asList(textLegal, textFamiliar, textSalary)); - - signer.setTabs(tabs); - - // Add the recipient to the envelope object - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); - envelopeDefinition.setRecipients(recipients); - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "3"); - envelopeDefinition.setDocuments(Arrays.asList(doc)); - envelopeDefinition.setCustomFields(cf); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeDefinition; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index 76561549..93a235d5 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -9,8 +9,7 @@ import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.*; -import com.docusign.esign.model.Checkbox; -import com.docusign.esign.model.List; +import com.docusign.controller.eSignature.services.SetTemplateTabValuesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -19,21 +18,16 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; - @Controller @RequestMapping("/eg017") public class EG017ControllerSetTemplateTabValues extends AbstractEsignatureController { - private static final String MODEL_LIST_TEMPLATE = "listTemplates"; private static final String SIGNER_CLIENT_ID = "1000"; - private final Session session; private final User user; - @Autowired public EG017ControllerSetTemplateTabValues(DSConfiguration config, Session session, User user) { super(config, "eg017", "Set template tab values"); @@ -60,14 +54,19 @@ protected Object doWork(WorkArguments args, ModelMap model, String ccEmail = args.getCcEmail(); String templateId = args.getTemplateId(); - // Step 2. Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); // Step 3. is shown in the makeEnvelope method below // Step 4. Construct your request body - EnvelopeDefinition envelope = makeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId); + EnvelopeDefinition envelope = SetTemplateTabValuesService.makeEnvelope( + signerEmail, + signerName, + ccEmail, + ccName, + templateId, + SIGNER_CLIENT_ID); // Step 5. Call the eSignature REST API EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); @@ -75,152 +74,22 @@ protected Object doWork(WorkArguments args, ModelMap model, session.setEnvelopeId(envelopeId); // Step 6. Create the view request - RecipientViewRequest viewRequest = makeRecipientViewRequest(signerEmail, signerName); - ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + RecipientViewRequest viewRequest = SetTemplateTabValuesService.makeRecipientViewRequest( + signerEmail, + signerName, + config.getDsReturnUrl(), + SIGNER_CLIENT_ID, + config.getDsPingUrl()); + + ViewUrl viewUrl = SetTemplateTabValuesService.setTemplateTabValues( + envelopesApi, + accountId, + envelopeId, + viewRequest + ); // State can be stored/recovered using the framework's session or a // query parameter on the returnUrl (see the makeRecipientViewRequest method) return new RedirectView(viewUrl.getUrl()); } - - private RecipientViewRequest makeRecipientViewRequest(String signerEmail, String signerName) { - RecipientViewRequest viewRequest = new RecipientViewRequest(); - // Set the url where you want the recipient to go once they are done signing - // should typically be a callback route somewhere in your app. - // The query parameter is included as an example of how - // to save/recover state information during the redirect to - // the DocuSign signing. It's usually better to use - // the session mechanism of your web framework. Query parameters - // can be changed/spoofed very easily. - viewRequest.setReturnUrl(config.getDsReturnUrl() + "?state=123"); - - // How has your app authenticated the user? In addition to your app's - // authentication, you can include authenticate steps from DocuSign. - // Eg, SMS authentication - viewRequest.setAuthenticationMethod("none"); - - // Recipient information must match embedded recipient info - // we used to create the envelope. - viewRequest.setEmail(signerEmail); - viewRequest.setUserName(signerName); - viewRequest.setClientUserId(SIGNER_CLIENT_ID); - - // DocuSign recommends that you redirect to DocuSign for the - // embedded signing. There are multiple ways to save state. - // To maintain your application's session, use the pingUrl - // parameter. It causes the DocuSign signing web page - // (not the DocuSign server) to send pings via AJAX to your app. - // NOTE: The pings will only be sent if the pingUrl is an https address - viewRequest.setPingFrequency("600"); // seconds - viewRequest.setPingUrl(config.getDsPingUrl()); - - return viewRequest; - } - - - private static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName, String ccEmail, String ccName, String templateId){ - // Create a signer recipient to sign the document, identified by name and email - // We set the clientUserId to enable embedded signing for the recipient - - // Step 3. Create tabs and CustomFields - List list1 = new List(); - list1.setValue("green"); - list1.setDocumentId("1"); - list1.setPageNumber("1"); - list1.setTabLabel("list"); - - // Checkboxes - Checkbox ck1 = new Checkbox(); - ck1.setTabLabel("ckAuthorization"); - ck1.setSelected("true"); - - Checkbox ck2 = new Checkbox(); - ck2.setTabLabel("ckAgreement"); - ck2.setSelected("true"); - - Radio radio = new Radio(); - radio.setValue("white"); - radio.setSelected("true"); - - RadioGroup rg = new RadioGroup(); - rg.setGroupName("radio1"); - rg.setRadios(Arrays.asList(radio)); - - - Text txt = new Text(); - txt.setTabLabel("text"); - txt.setValue("Jabberywocky!"); - - // We can also add a new tab (field) to the ones already in the template: - - Text txtExtra = new Text(); - txtExtra.setDocumentId("1"); - txtExtra.setPageNumber("1"); - txtExtra.setXPosition("280"); - txtExtra.setYPosition("172"); - txtExtra.setFont("helvetica"); - txtExtra.setFontSize("size14"); - txtExtra.setTabLabel("added text field"); - txtExtra.setHeight("23"); - txtExtra.setWidth("84"); - txtExtra.setRequired("false"); - txtExtra.setBold("true"); - txtExtra.setValue(signerName); - txtExtra.setLocked("false"); - txtExtra.setTabId("name"); - - - // Add the tabs model (including the SignHere tab) to the signer. - // The Tabs object wants arrays of the different field/tab types - // Tabs are set per recipient / signer - - Tabs tabs = new Tabs(); - - tabs.setTextTabs(Arrays.asList(txt, txtExtra)); - tabs.setRadioGroupTabs(Arrays.asList(rg)); - tabs.setCheckboxTabs(Arrays.asList(ck1, ck2)); - tabs.setListTabs(Arrays.asList(list1)); - - - // create a signer recipient to sign the document, identified by name and email - // We're setting the parameters via the object creation - TemplateRole signer = new TemplateRole(); - signer.setEmail(signerEmail); - signer.setName(signerName); - // Setting the client_user_id marks the signer as embedded - signer.setClientUserId(SIGNER_CLIENT_ID); - signer.setRoleName("signer"); - signer.setTabs(tabs); - - TemplateRole cc = new TemplateRole(); - cc.setEmail(ccEmail); - cc.setName(ccName); - cc.setRoleName("cc"); - - // Create an envelope custom field to save our application"s - // Data about the envelope - TextCustomField customField = new TextCustomField(); - customField.setName("app metadata item"); - customField.setValue("1234567"); - customField.setRequired("false"); - customField.show("true"); //Yes, include in the CoC - - - CustomFields cf = new CustomFields(); - cf.setTextCustomFields(Arrays.asList(customField)); - - - // Next, create the top level envelope definition and populate it. - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); - // The Recipients object wants arrays for each recipient type - envelopeDefinition.setTemplateId(templateId); - envelopeDefinition.setTemplateRoles(Arrays.asList(signer, cc)); - envelopeDefinition.setCustomFields(cf); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - - return envelopeDefinition; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java index ea90bbd1..6e0c461b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java @@ -7,6 +7,8 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.CustomFieldsEnvelope; +import com.docusign.controller.eSignature.services.EnvelopeCustomFieldValuesService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -27,7 +29,6 @@ public class EG018ControllerEnvelopeCustomFieldValues extends AbstractEsignature private final Session session; private final User user; - @Autowired public EG018ControllerEnvelopeCustomFieldValues(DSConfiguration config, Session session, User user) { super(config, "eg018", "Get Envelope Custom Field Data"); @@ -46,11 +47,15 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2. Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); + // Step 3. Call the eSignature REST API + CustomFieldsEnvelope customFieldsEnvelope = EnvelopeCustomFieldValuesService.envelopeCustomFieldValues( + envelopesApi, + session.getAccountId(), + session.getEnvelopeId() + ); + DoneExample.createDefault(title) - .withJsonObject( - // Step 3. Call the eSignature REST API - envelopesApi.listCustomFields(session.getAccountId(), session.getEnvelopeId()) - ) + .withJsonObject(customFieldsEnvelope) .withMessage("Results from the Envelope::GetFormData method:") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index 642ca343..c37b030f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -7,21 +7,16 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; - +import com.docusign.controller.eSignature.services.AccessCodeAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -32,13 +27,9 @@ @RequestMapping("/eg019") public class EG019ControllerAccessCodeAuthentication extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - private final Session session; private final User user; - @Autowired public EG019ControllerAccessCodeAuthentication(DSConfiguration config, Session session, User user) { super(config, "eg019", "Signing request by email"); @@ -54,57 +45,27 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args); + EnvelopeDefinition envelope = AccessCodeAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getAccessCode() + ); // Step 3: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = AccessCodeAuthenticationService.accessCodeAuthentication( + envelopesApi, + session.getAccountId(), + envelope + ); - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage("The envelope has been created and sent!
Envelope ID " + session.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - - Signer signer = new Signer(); - signer.setName(args.getSignerName()); - signer.setEmail(args.getSignerEmail()); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setAccessCode(args.getAccessCode()); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index be93b3fd..638f1a88 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -2,6 +2,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.PhoneAuthenticationService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -26,12 +27,12 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; - import java.io.IOException; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** * Example 020: Phone Authentication for recipient @@ -41,9 +42,6 @@ public class EG020ControllerPhoneAuthentication extends AbstractEsignatureController { private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - private final Session session; private final User user; @@ -81,10 +79,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse if (workflowId.equals("")) { throw new ApiException(0, "Please contact DocuSign Support to enable Phone Auth in your account."); - }EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), + }EnvelopeDefinition envelope = PhoneAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), args.getPhoneNumber(), workflowId); // Step 4.1 start - EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); + EnvelopeSummary results = PhoneAuthenticationService.phoneAuthentication(envelopesApi, accountId, envelope); // Step 4.1 end session.setEnvelopeId(results.getEnvelopeId()); @@ -95,62 +93,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - - // Step 4.2 start - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, - String phone, String workFlowId) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("200"); - signHere.setYPosition("160"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your - // own systems. - // This value is referenced in the Tabs element below to assign tabs on a - // per-recipient basis. - signHere.setRecipientId("1"); - - RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber(); - phoneNumber.setCountryCode(countryCode); - phoneNumber.setNumber(phone); - - RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption(); - inputOption.setName("phone_number_list"); - inputOption.setValueType("PhoneNumberList"); - inputOption.setPhoneNumberList(Arrays.asList(phoneNumber)); - - RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification(); - - identityVerifcation.setWorkflowId(workFlowId); - identityVerifcation.setInputOptions(Arrays.asList(inputOption)); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setIdentityVerification(identityVerifcation); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - - return envelope; - } - // Step 4.2 end - } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index cf4880f7..9a203b82 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -7,21 +7,16 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; - +import com.docusign.controller.eSignature.services.KBAAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -31,13 +26,9 @@ @RequestMapping("/eg022") public class EG022ControllerKBAAuthentication extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; - private final Session session; private final User user; - @Autowired public EG022ControllerKBAAuthentication(DSConfiguration config, Session session, User user) { super(config, "eg022", "Signing request by email"); @@ -53,58 +44,25 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 2: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail()); + EnvelopeDefinition envelope = KBAAuthenticationService.createEnvelope( + args.getSignerName(), + args.getSignerEmail()); // Step 3: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = KBAAuthenticationService.kbaAuthentication( + envelopesApi, + session.getAccountId(), + envelope + ); - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") + + envelopeSummary.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail) throws IOException { - Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - SignHere signHere = new SignHere(); - signHere.setName("SignHereTab"); - signHere.setXPosition("75"); - signHere.setYPosition("572"); - signHere.setTabLabel("SignHereTab"); - signHere.setPageNumber("1"); - signHere.setDocumentId(doc.getDocumentId()); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere.setRecipientId("1"); - - Signer signer = new Signer(); - signer.setName(signerName); - signer.setEmail(signerEmail); - signer.setRoutingOrder("1"); - signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); - signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); - signer.setRecipientId(signHere.getRecipientId()); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - signer.setIdCheckConfigurationName("ID Check"); - signer.setRequireIdLookup("true"); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please Sign"); - envelope.setEnvelopeIdStamping("true"); - envelope.setEmailBlurb("Sample text for email body"); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setDocuments(Arrays.asList(doc)); - envelope.setRecipients(recipients); - - return envelope; - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index 05f67568..9d874daf 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -11,14 +11,9 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.AccountIdentityVerificationResponse; import com.docusign.esign.model.AccountIdentityVerificationWorkflow; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.RecipientIdentityVerification; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.SignHere; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; +import com.docusign.controller.eSignature.services.IdvAuthenticationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -26,11 +21,9 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Base64; -import java.util.Collections; import java.util.List; -import javax.servlet.http.HttpServletResponse; /** * ID Verification authentication @@ -40,8 +33,6 @@ public class EG023ControllerIdvAuthentication extends AbstractEsignatureController { private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem"; private final Session session; private final User user; @@ -58,29 +49,17 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); // Step 2 end EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - // Step 3 start - AccountsApi workflowDetails = new AccountsApi(apiClient); - AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); - List identityVerification = workflowRes.getIdentityVerification(); - String workflowId = ""; - for (int i = 0; i < identityVerification.size(); i++) - { - if (identityVerification.get(i).getDefaultName().equals("DocuSign ID Verification")) - { - workflowId = identityVerification.get(i).getWorkflowId(); - } - } + String workflowId = IdvAuthenticationService.retrieveWorkflowId(apiClient, session.getAccountId()); logger.info("workflowId = " + workflowId); - // Step 3 end if (workflowId.equals("")) { throw new ApiException(0, "Please contact DocuSign Support to enable IDV in your account."); } // Step 4-1 start - EnvelopeDefinition envelope = createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); + EnvelopeDefinition envelope = IdvAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); // Step 4-1 end // Step 5 start - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary results = IdvAuthenticationService.idvAuthentication(envelopesApi, session.getAccountId(), envelope); // Step 5 end session.setEnvelopeId(results.getEnvelopeId()); @@ -92,61 +71,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - - // Step 4-2 start - private static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, - String workflowId) { - EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); - envelopeDefinition.setEmailSubject("Please sign"); - envelopeDefinition.setEmailBlurb("Sample text for email body"); - envelopeDefinition.setStatus("Sent"); - - - byte[] fileBytes = new byte[0]; - try { - fileBytes = EnvelopeHelpers.readFile(DOCUMENT_FILE_NAME); - } catch (IOException e) { - e.printStackTrace(); - } - Document doc1 = new Document(); - doc1.setDocumentBase64(Base64.getEncoder().encodeToString(fileBytes)); - doc1.setDocumentId("1"); - doc1.setFileExtension("pdf"); - doc1.setName("Lorem"); - - SignHere signHere1 = new SignHere(); - signHere1.setName("SignHereTab"); - signHere1.setXPosition("200"); - signHere1.setYPosition("160"); - signHere1.setTabLabel("SignHereTab"); - signHere1.setPageNumber("1"); - signHere1.setDocumentId("1"); - // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. - // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. - signHere1.setRecipientId("1"); //represents your {RECIPIENT_ID} - - Tabs signer1Tabs = new Tabs(); - signer1Tabs.setSignHereTabs(Collections.singletonList(signHere1)); - RecipientIdentityVerification workflow = new RecipientIdentityVerification(); - workflow.setWorkflowId(workflowId); - - Signer signer1 = new Signer(); - signer1.setName(signerName); - signer1.setEmail(signerEmail); - signer1.setRoleName(""); - signer1.setNote(""); - signer1.setStatus("created"); - signer1.setDeliveryMethod("email"); - signer1.setRecipientId("1"); //represents your {RECIPIENT_ID} - signer1.setIdentityVerification(workflow); - signer1.setTabs(signer1Tabs); - - Recipients recipients = new Recipients(); - recipients.setSigners(Collections.singletonList(signer1)); - - envelopeDefinition.setRecipients(recipients); - envelopeDefinition.setDocuments(Collections.singletonList(doc1)); - return envelopeDefinition; - } - // Step 4-2 end } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java index 999b35d6..8ec4eab4 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java @@ -4,10 +4,10 @@ import javax.servlet.http.HttpServletResponse; import com.docusign.common.WorkArguments; -import com.docusign.core.model.AccountRoleSettingsPatch; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.eSignature.services.PermissionCreateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -15,9 +15,7 @@ import com.docusign.DSConfiguration; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.AccountRoleSettings; import com.docusign.esign.model.PermissionProfile; -import com.google.gson.Gson; /** * Permission profiles are collections of account settings that determine the * behavior and actions available to the user groups to which they're applied. @@ -44,19 +42,13 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 2. Construct your API headers AccountsApi accountsApi = createAccountsApi(session.getBasePath(), user.getAccessToken()); - - // Step 3. Construct your request body - // We're extending the AccountSettings class with AccountSettingsPatch to include the signingUIVersion which is missing in the swagger spec at this time. - Gson gson = new Gson(); - AccountRoleSettings settings = DsModelUtils.createDefaultRoleSettings(); - AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); - newSettings.signingUiVersion("1"); - PermissionProfile profile = new PermissionProfile() - .permissionProfileName(args.getPermissionProfileName()) - .settings(newSettings); // Step 4. Call the eSignature REST API - PermissionProfile newProfile = accountsApi.createPermissionProfile(session.getAccountId(), profile); + PermissionProfile newProfile = PermissionCreateService.createNewProfile( + accountsApi, + session.getAccountId(), + args.getPermissionProfileName() + ); DoneExample.createDefault(title) .withJsonObject(newProfile) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java index b4a0faa9..05ece245 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java @@ -1,27 +1,24 @@ package com.docusign.controller.eSignature.examples; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; - -import com.docusign.DSConfiguration; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.GroupsApi; import com.docusign.esign.client.ApiClient; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.ErrorDetails; -import com.docusign.esign.model.Group; import com.docusign.esign.model.GroupInformation; import com.docusign.esign.model.PermissionProfileInformation; +import com.docusign.controller.eSignature.services.PermissionSetUserGroupsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; /** @@ -36,11 +33,9 @@ public class EG025ControllerPermissionSetUserGroups extends AbstractEsignatureCo private static final String MODEL_LIST_PROFILES = "listProfiles"; private static final String MODEL_LIST_GROUPS = "listGroups"; - private final Session session; private final User user; - @Autowired public EG025ControllerPermissionSetUserGroups(DSConfiguration config, Session session, User user) { super(config, "eg025", "Setting a permission profile"); @@ -66,15 +61,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { // Step 2: Construct your API headers ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); - GroupsApi groupsApi = new GroupsApi(apiClient); - // Step 3: Perform request - Group newGroup = new Group() - .groupId(args.getGroupId()) - .permissionProfileId(args.getProfileId()); - GroupInformation groupInformation = new GroupInformation() - .groups(List.of(newGroup)); - GroupInformation newGroupInfo = groupsApi.updateGroups(session.getAccountId(), groupInformation); + GroupInformation newGroupInfo = PermissionSetUserGroupsService.permissionSetUserGroups( + apiClient, + args.getGroupId(), + args.getProfileId(), + session.getAccountId() + ); // Step 4: Show result ErrorDetails errorDetails = newGroupInfo.getGroups().get(0).getErrorDetails(); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java index 472eb006..7580b1e6 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java @@ -1,19 +1,15 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Objects; -import java.util.Optional; -import java.util.Random; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.model.AccountRoleSettingsPatch; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.PermissionProfile; +import com.docusign.esign.model.PermissionProfileInformation; +import com.docusign.controller.eSignature.services.PermissionChangeSingleSettingService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -21,13 +17,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import com.docusign.DSConfiguration; -import com.docusign.esign.api.AccountsApi; -import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.AccountRoleSettings; -import com.docusign.esign.model.PermissionProfile; -import com.docusign.esign.model.PermissionProfileInformation; -import com.google.gson.Gson; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; /** * This code example demonstrates how to edit individual permission settings on @@ -37,11 +29,9 @@ @RequestMapping("/eg026") public class EG026ControllerPermissionChangeSingleSetting extends AbstractEsignatureController { - private static final String MODEL_PERMISSIONS = "permissions"; private static final String MODEL_CUR_PROFILE_NAME = "permissionProfileName"; private static final String MODEL_CUR_PROFILE_ID = "profileId"; private static final String MODEL_LIST_PROFILES = "listProfiles"; - private final Session session; private final User user; @@ -69,11 +59,12 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception model.addAttribute(MODEL_CUR_PROFILE_NAME, profiles.get(0).getPermissionProfileName()); model.addAttribute(MODEL_CUR_PROFILE_ID, profiles.get(0).getPermissionProfileId()); - findProfile(profiles, session.getPermissionProfileId()).ifPresent((PermissionProfile curProfile) -> { + PermissionChangeSingleSettingService.findProfile( + profiles, + session.getPermissionProfileId()).ifPresent((PermissionProfile curProfile) -> + { model.addAttribute(MODEL_CUR_PROFILE_NAME, curProfile.getPermissionProfileName()); model.addAttribute(MODEL_CUR_PROFILE_ID, curProfile.getPermissionProfileId()); - // model.addAttribute(MODEL_PERMISSIONS, - // Utils.compareFields(curProfile.getSettings(), null, true)); }); } @@ -85,50 +76,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String accountId = session.getAccountId(); String curProfileId = args.getProfileId(); - // Step 3. Construct your request body - PermissionProfileInformation permissionsInfo = accountsApi.listPermissions(accountId); - PermissionProfile profile = findProfile(permissionsInfo.getPermissionProfiles(), curProfileId) - .orElseThrow(NoSuchElementException::new); - - // Step 4. Call the eSignature REST API - AccountRoleSettings newSettings = Objects.requireNonNullElse(profile.getSettings(), - DsModelUtils.createDefaultRoleSettings()); - profile.setSettings(changeRandomSettings(newSettings)); - PermissionProfile newProfile = accountsApi.updatePermissionProfile(accountId, curProfileId, profile); + PermissionProfile newProfile = PermissionChangeSingleSettingService.permissionChangeSingleSetting( + accountsApi, + accountId, + curProfileId + ); DoneExample.createDefault(title).withMessage("The permission profile is updated!
Permission profile ID: " + newProfile.getPermissionProfileId() + ".").addToModel(model); return DONE_EXAMPLE_PAGE_COMPARE; } - - private static Optional findProfile(List profiles, String profileId) { - - return profiles.stream().filter(p -> p.getPermissionProfileId().equals(profileId)).findFirst(); - } - - // Changes random boolean properties; in a real application, changing properties - // will be read from the page or in a different way - private static AccountRoleSettings changeRandomSettings(AccountRoleSettings settings) { - Gson gson = new Gson(); - // Change this value back to: gson.fromJson(gson.toJson(settings), - // AccountRoleSettings.class); - // as soon as the signinguiversion is added back to the swagger spec. - // Also change the type back from AccountRoleSettingsPatch to AccountRoleSettings - AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); - newSettings.signingUiVersion("1"); - Random random = new Random(System.currentTimeMillis()); - - return newSettings.canCreateWorkspaces(randomBool(random)).allowEnvelopeSending(randomBool(random)) - .allowSignerAttachments(randomBool(random)).allowESealRecipients(randomBool(random)) - .allowTaggingInSendAndCorrect(randomBool(random)).allowWetSigningOverride(randomBool(random)) - .enableApiRequestLogging(randomBool(random)).enableRecipientViewingNotifications(randomBool(random)) - .allowSupplementalDocuments(randomBool(random)).disableDocumentUpload(randomBool(random)); - } - - private static String randomBool(Random random) { - if (random.nextBoolean()) { - return DsModelUtils.TRUE; - } - return DsModelUtils.FALSE; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java index 6c4d8708..d0ff6c29 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java @@ -6,6 +6,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.eSignature.services.PermissionDeleteService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -28,11 +29,9 @@ public class EG027ControllerPermissionDelete extends AbstractEsignatureController { private static final String MODEL_LIST_PROFILES = "listProfiles"; - private final Session session; private final User user; - @Autowired public EG027ControllerPermissionDelete(DSConfiguration config, Session session, User user) { super(config, "eg027", "Deleting a permission profile"); @@ -56,7 +55,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 3: Call the eSignature Rest API to delete profile String curProfileId = args.getProfileId(); - accountsApi.deletePermissionProfile(session.getAccountId(), curProfileId); + PermissionDeleteService.permissionDelete(accountsApi, session.getAccountId(), curProfileId); // Step 4: Show 'done' (successful) page DoneExample.createDefault(title) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java index c6be36de..c619302d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java @@ -1,25 +1,22 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.common.Languages; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.BrandsResponse; +import com.docusign.controller.eSignature.services.CreateBrandService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import com.docusign.DSConfiguration; -import com.docusign.esign.api.AccountsApi; -import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Brand; -import com.docusign.esign.model.BrandsResponse; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -28,14 +25,12 @@ */ @Controller @RequestMapping("/eg028") -public class EG028ControllerCreateBrand extends AbstractEsignatureController{ +public class EG028ControllerCreateBrand extends AbstractEsignatureController { private static final String MODEL_LIST_LANGUAGE = "listLanguage"; - private final Session session; private final User user; - @Autowired public EG028ControllerCreateBrand(DSConfiguration config, Session session, User user) { super(config, "eg028", "Creating a brand"); @@ -57,18 +52,18 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 3: Construct your brand JSON body String language = args.getLanguage(); - Brand brand = new Brand() - .brandName(args.getBrandName()) - .defaultBrandLanguage(language) - .brandLanguages(List.of(language)); - // Step 5: Call the eSignature REST API - BrandsResponse brandsResponse = accountsApi.createBrand(session.getAccountId(), brand); + BrandsResponse brandsResponse = CreateBrandService.createBrand( + accountsApi, + args.getBrandName(), + language, + session.getAccountId() + ); DoneExample.createDefault(title) .withJsonObject(brandsResponse) .withMessage("The brand has been created!
Brand ID " - + brandsResponse.getBrands().get(0).getBrandId() + ".") + + brandsResponse.getBrands().get(0).getBrandId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index 6334a03b..ee741abc 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -1,31 +1,24 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; - -import com.docusign.DSConfiguration; import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.BrandsResponse; -import com.docusign.esign.model.Document; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Recipients; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; +import com.docusign.controller.eSignature.services.ApplyBrandToEnvelopeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; /** @@ -38,15 +31,9 @@ public class EG029ControllerApplyBrandToEnvelope extends AbstractEsignatureController { private static final String MODEL_LIST_BRAND = "listBrands"; - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "EG025 Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private final Session session; private final User user; - @Autowired public EG029ControllerApplyBrandToEnvelope(DSConfiguration config, Session session, User user) { super(config, "eg029", "Apply brand to envelope"); @@ -69,10 +56,18 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeDefinition envelope = ApplyBrandToEnvelopeService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getBrandId() + ); // Step 5: Call the eSignature REST API - EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = ApplyBrandToEnvelopeService.applyBrandToEnvelope( + envelopesApi, + session.getAccountId(), + envelope + ); DoneExample.createDefault(title) .withJsonObject(envelopeSummary) @@ -81,33 +76,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - // Creates an envelope. The envelope has one recipient who should sign an - // attached document. Attached document is read from a local directory. - // Also the envelope contains a brand Id which is created on EG028 example. - private static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // Reads a file from a local directory and create Document object. - Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - - // Create a signer recipient to sign the document and associate sign tab - Tabs tabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); - Signer signer = new Signer() - .email(args.getSignerEmail()) - .name(args.getSignerName()) - .recipientId("1") - .routingOrder("1") - .tabs(tabs); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer)); - - // Return envelope definition using created objects: the document, - // the recipients and obtained brand Id. - return new EnvelopeDefinition() - .emailSubject("EG029. Please Sign") - .documents(List.of(document)) - .recipients(recipients) - .brandId(args.getBrandId()) - .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index 239888dc..a8632ecd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -1,7 +1,6 @@ package com.docusign.controller.eSignature.examples; import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; @@ -9,6 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.eSignature.services.ApplyBrandToTemplateService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -24,7 +24,6 @@ import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.EnvelopeTemplateResults; -import com.docusign.esign.model.TemplateRole; /** @@ -43,11 +42,9 @@ public class EG030ControllerApplyBrandToTemplate extends AbstractEsignatureContr private static final String MODEL_LIST_BRAND = "listBrands"; private static final String MODEL_LIST_TEMPLATE = "listTemplates"; - private final Session session; private final User user; - @Autowired public EG030ControllerApplyBrandToTemplate(DSConfiguration config, Session session, User user) { super(config, "eg030", "Apply brand to template"); @@ -77,10 +74,21 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeDefinition envelope = ApplyBrandToTemplateService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getCcEmail(), + args.getCcName(), + args.getTemplateId(), + args.getBrandId() + ); // Step 5: Call the eSignature REST API - EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = ApplyBrandToTemplateService.applyBrandToTemplate( + envelopesApi, + session.getAccountId(), + envelope + ); DoneExample.createDefault(title) .withJsonObject(envelopeSummary) @@ -89,22 +97,4 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition makeEnvelope(WorkArguments args) { - TemplateRole signer = new TemplateRole() - .email(args.getSignerEmail()) - .name(args.getSignerName()) - .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - - TemplateRole cc = new TemplateRole() - .email(args.getCcEmail()) - .name(args.getCcName()) - .roleName(EnvelopeHelpers.CC_ROLE_NAME); - - return new EnvelopeDefinition() - .templateId(args.getTemplateId()) - .templateRoles(Arrays.asList(signer, cc)) - .brandId(args.getBrandId()) - .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index e44fd547..c8454b12 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -1,21 +1,19 @@ package com.docusign.controller.eSignature.examples; -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import javax.servlet.http.HttpServletResponse; - +import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.api.BulkEnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.BulkSendBatchStatus; +import com.docusign.controller.eSignature.services.BulkSendEnvelopesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; - import com.docusign.DSConfiguration; import com.docusign.esign.api.BulkEnvelopesApi; import com.docusign.esign.api.EnvelopesApi; @@ -34,6 +32,12 @@ import com.docusign.esign.model.Signer; import com.docusign.esign.model.TextCustomField; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; + /** * This code example demonstrates how to send envelopes in bulk to multiple * recipients with the eSignature API. To accomplish the task, you will first @@ -45,17 +49,9 @@ public class EG031ControllerBulkSendEnvelopes extends AbstractEsignatureController { private static final long BULK_REQUEST_DELAY = 15L; - private static final String BULK_SIGNER_EMAIL_PLACEHOLDER = "MultiBulkRecipients-%s@docusign.com"; - private static final String BULK_SIGNER_NAME_PLACEHOLDER = "Multi Bulk Recipients::%s"; - private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_NAME = "Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = -5; - private static final int ANCHOR_OFFSET_X = 15; - private final Session session; private final User user; - @Autowired public EG031ControllerBulkSendEnvelopes(DSConfiguration config, Session session, User user) { super(config, "eg031", "Bulk send envelopes"); @@ -76,28 +72,19 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 3-1 start String accountId = session.getAccountId(); BulkEnvelopesApi bulkEnvelopesApi = new BulkEnvelopesApi(apiClient); - BulkSendingList sendingList = getSendingList(args); - String bulkListId = bulkEnvelopesApi.createBulkSendList(accountId, sendingList).getListId(); - // Step 3-1 end - - // Create an envelope - // Step 4-1 start - EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - String envelopeId = envelopesApi.createEnvelope(accountId, makeEnvelope()).getEnvelopeId(); - // Step 4-1 end - - // Attach your bulk list ID to the envelope - // Step 5 start - CustomFields customFields = createCustomFields(bulkListId); - envelopesApi.createCustomFields(accountId, envelopeId, customFields); - // Step 5 end - - // Initiate bulk send - // Step 6 start - BulkSendRequest request = new BulkSendRequest(); - request.setEnvelopeOrTemplateId(envelopeId); - String batchId = bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); - // Step 6 end + String batchId = BulkSendEnvelopesService.bulkSendEnvelopes( + bulkEnvelopesApi, + apiClient, + args.getSignerName(), + args.getSignerEmail(), + args.getCcName(), + args.getCcEmail(), + args.getSignerName2(), + args.getSignerEmail2(), + args.getCcName2(), + args.getCcEmail2(), + session.getAccountId() + ); // Confirm successful bulk send // Step 7 start @@ -108,101 +95,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 7 end DoneExample.createDefault(title) .withJsonObject(status) + .withMessage(String.join( + "", + "Bulk request queued to ", status.getQueued(), " user lists.")) .withMessage(String.join("", "Results from BulkSend:getBulkSendBatchStatus method:")) .addToModel(model); } catch (InterruptedException exception) { Thread.currentThread().interrupt(); return null; } - return DONE_EXAMPLE_PAGE; } - - // Step 3-2 start - private static BulkSendingList getSendingList(WorkArguments args) { - List copies = List.of( - createBulkSending(args.getSignerName(), args.getSignerEmail(), args.getCcName(), args.getCcEmail()), - createBulkSending(args.getSignerName2(), args.getSignerEmail2(), args.getCcName2(), args.getCcEmail2()) - ); - return new BulkSendingList() - .name("sample.csv") - .bulkCopies(copies); - } - // Step 3-2 end - - private static BulkSendingCopy createBulkSending(String signerName, - String signerEmail, String ccName, String ccEmail) { - BulkSendingCopyRecipient recipient1 = new BulkSendingCopyRecipient() - .name(signerName) - .email(signerEmail) - .tabs(Collections.emptyList()) - .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); - BulkSendingCopyRecipient recipient2 = new BulkSendingCopyRecipient() - .name(ccName) - .email(ccEmail) - .tabs(Collections.emptyList()) - .roleName(EnvelopeHelpers.CC_ROLE_NAME); - return new BulkSendingCopy() - .recipients(List.of(recipient1, recipient2)) - .customFields(Collections.emptyList()); - } - - // Step 4-2 start - private static EnvelopeDefinition makeEnvelope() throws IOException { - Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); - return new EnvelopeDefinition() - .documents(List.of(document)) - .envelopeIdStamping(DsModelUtils.TRUE) - .emailSubject("EG031 Please sign") - .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED) - .recipients(createRecipients()); - } - // Step 4-2 end - - private static CustomFields createCustomFields(String bulkListId) { - TextCustomField textCustomField = new TextCustomField() - .name("mailingListId") - .required(DsModelUtils.FALSE) - .show(DsModelUtils.FALSE) - .value(bulkListId); - - return new CustomFields() - .listCustomFields(Collections.emptyList()) - .textCustomFields(List.of(textCustomField)); - } - - private static Recipients createRecipients() { - Signer signer = createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, "1", "1"); - CarbonCopy cc = createCCPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, "2", "2"); - return new Recipients() - .signers(List.of(signer)) - .carbonCopies(List.of(cc)); - } - - private static Signer createSignerPlaceholder(String roleName, String recipientId, String routingOrder) { - return new Signer() - .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) - .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) - .roleName(roleName) - .note("") - .routingOrder(routingOrder) - .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) - .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) - .recipientId(recipientId) - .recipientType(roleName) - .tabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - } - - private static CarbonCopy createCCPlaceholder(String roleName, String recipientId, String routingOrder) { - return new CarbonCopy() - .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) - .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) - .roleName(roleName) - .note("") - .routingOrder(routingOrder) - .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) - .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) - .recipientId(recipientId) - .recipientType(roleName); - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index cad63057..3068cf2b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -4,10 +4,12 @@ import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; -import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.*; +import com.docusign.core.model.User; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.controller.eSignature.services.PauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -15,8 +17,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; /** * This topic demonstrates how to create an envelope where the workflow @@ -26,14 +26,9 @@ @RequestMapping("/eg032") public class EG032ControllerPauseSignatureWorkflow extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "Welcome.txt"; - private static final String DOCUMENT_ID = "1"; - private static final String DOCUMENT_NAME = "Welcome"; - private final Session session; private final User user; - @Autowired public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session session, User user) { super(config, "eg032", "Pause a signature workflow."); @@ -42,80 +37,36 @@ public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session ses } @Override - protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) + throws ApiException, IOException + { // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args); + EnvelopeDefinition envelope = PauseSignatureWorkflowService.createEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getSignerName2(), + args.getSignerEmail2() + ); // Step 4: Call the eSignature REST API - EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); + EnvelopeSummary envelopeSummary = PauseSignatureWorkflowService.pauseSignatureWorkflow( + envelopesApi, + this.session.getAccountId(), + envelope + ); - this.session.setEnvelopeId(results.getEnvelopeId()); + this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage( "The envelope where the workflow is paused before the envelope is sent to a second recipient " + - "has been created and sent!
Envelope ID " - + this.session.getEnvelopeId() + ".") + "has been created and sent!
Envelope ID " + this.session.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { - Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); - - WorkflowStep workflowStep = new WorkflowStep(); - workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); - workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); - workflowStep.setItemId("2"); - - Workflow workflow = new Workflow(); - workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); - - SignHere signHere1 = new SignHere(); - signHere1.setName("SignHereTabs"); - signHere1.setXPosition("200"); - signHere1.setYPosition("200"); - signHere1.setTabLabel("Sign Here"); - signHere1.setPageNumber("1"); - signHere1.setDocumentId(document.getDocumentId()); - - Signer signer1 = new Signer(); - signer1.setName(args.getSignerName()); - signer1.setEmail(args.getSignerEmail()); - signer1.setRoutingOrder("1"); - signer1.setRecipientId("1"); - signer1.setTabs(EnvelopeHelpers.createSignerTabs(signHere1)); - - SignHere signHere2 = new SignHere(); - signHere2.setName("SignHereTabs"); - signHere2.setXPosition("300"); - signHere2.setYPosition("200"); - signHere2.setTabLabel("Sign Here"); - signHere2.setPageNumber("1"); - signHere2.setDocumentId(document.getDocumentId()); - - Signer signer2 = new Signer(); - signer2.setName(args.getSignerName2()); - signer2.setEmail(args.getSignerEmail2()); - signer2.setRoutingOrder("2"); - signer2.setRecipientId("2"); - signer2.setTabs(EnvelopeHelpers.createSignerTabs(signHere2)); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList(signer1, signer2)); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("EnvelopeWorkflowTest"); - envelope.setDocuments(Collections.singletonList(document)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - envelope.setWorkflow(workflow); - - return envelope; - } } \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index b3b9cfd4..7276cdc8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -7,9 +7,8 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.Envelope; import com.docusign.esign.model.EnvelopeUpdateSummary; -import com.docusign.esign.model.Workflow; +import com.docusign.controller.eSignature.services.UnpauseSignatureWorkflowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -28,7 +27,6 @@ public class EG033ControllerUnpauseSignatureWorkflow extends AbstractEsignatureC private final Session session; private final User user; - @Autowired public EG033ControllerUnpauseSignatureWorkflow(DSConfiguration config, Session session, User user) { super(config, "eg033", "Unpause a signature workflow"); @@ -43,26 +41,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - // Step 3: Construct your envelope JSON body - Workflow workflow = new Workflow(); - workflow.setWorkflowStatus(EnvelopeHelpers.WORKFLOW_STATUS_IN_PROGRESS); - - Envelope envelope = new Envelope(); - envelope.setWorkflow(workflow); - - EnvelopesApi.UpdateOptions updateOptions = envelopesApi. new UpdateOptions(); - updateOptions.setResendEnvelope("true"); - - // Step 4: Call the eSignature REST API - EnvelopeUpdateSummary results = envelopesApi.update( + EnvelopeUpdateSummary envelopeUpdateSummary = UnpauseSignatureWorkflowService.unpauseSignatureWorkflow( + envelopesApi, this.session.getAccountId(), - this.session.getEnvelopeId(), - envelope, - updateOptions + this.session.getEnvelopeId() ); DoneExample.createDefault(this.title) - .withJsonObject(results) + .withJsonObject(envelopeUpdateSummary) .withMessage("A paused envelope was resumed.") .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index b6b85210..4657b8ce 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -7,7 +7,9 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.*; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.controller.eSignature.services.UseConditionalRecipientsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -15,9 +17,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; /** * This topic demonstrates how to create an envelope where the workflow @@ -27,15 +26,10 @@ @RequestMapping("/eg034") public class EG034ControllerUseConditionalRecipients extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME = "Welcome1.txt"; - private static final String DOCUMENT_ID = "1"; - private static final String DOCUMENT_NAME = "Welcome"; private static final String NOT_ALLOWED_ERROR_MESSAGE = "Update to the workflow with recipient routing is not allowed"; - private final Session session; private final User user; - @Autowired public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session session, User user) { super(config, "eg034", "Use conditional recipients."); @@ -45,20 +39,33 @@ public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session s @Override // ***DS.snippet.0.start - protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) + throws ApiException, IOException + { // Step 2: Construct your API headers EnvelopesApi envelopesApi = createEnvelopesApi(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = createEnvelope(args); + EnvelopeDefinition envelope = UseConditionalRecipientsService.createEnvelope( + args.getSignerNotCheckedName(), + args.getSignerNotCheckedEmail(), + args.getSignerCheckedName(), + args.getSignerCheckedEmail(), + args.getSignerName(), + args.getSignerEmail() + ); // Step 4: Call the eSignature REST API try { - EnvelopeSummary results = envelopesApi.createEnvelope(this.session.getAccountId(), envelope); - this.session.setEnvelopeId(results.getEnvelopeId()); + EnvelopeSummary envelopeSummary = UseConditionalRecipientsService.useConditionalRecipients( + envelopesApi, + this.session.getAccountId(), + envelope + ); + + this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) - .withJsonObject(results) + .withJsonObject(envelopeSummary) .withMessage( "An envelope where the workflow is routed to different recipients based on the value of a transaction " + "has been created and sent!
Envelope ID " @@ -77,157 +84,5 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse return DONE_EXAMPLE_PAGE; } - - private static EnvelopeDefinition createEnvelope(WorkArguments args) throws IOException { - Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); - - WorkflowStep workflowStep = new WorkflowStep(); - workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); - workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); - workflowStep.setItemId("2"); - workflowStep.setStatus("pending"); - workflowStep.setRecipientRouting(createRecipientRouting(args)); - - Workflow workflow = new Workflow(); - workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); - - Recipients recipients = new Recipients(); - recipients.setSigners(Arrays.asList( - createApprovalSigner(document.getDocumentId()), - createPurchaserSigner(args, document.getDocumentId()) - )); - - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("ApproveIfChecked"); - envelope.setDocuments(Collections.singletonList(document)); - envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); - envelope.setRecipients(recipients); - envelope.setWorkflow(workflow); - - return envelope; - } - - private static Signer createPurchaserSigner(WorkArguments args, String documentId) { - SignHere signHere = new SignHere(); - signHere.setName("SignHereTabs"); - signHere.setXPosition("200"); - signHere.setYPosition("200"); - signHere.setTabLabel("PurchaserSignature"); - signHere.setPageNumber("1"); - signHere.setDocumentId(documentId); - - Checkbox checkbox = new Checkbox(); - checkbox.setName("ClickToApprove"); - checkbox.setSelected("false"); - checkbox.setXPosition("50"); - checkbox.setYPosition("50"); - checkbox.setTabLabel("ApproveWhenChecked"); - checkbox.setPageNumber("1"); - checkbox.setDocumentId(documentId); - - Tabs tabs = EnvelopeHelpers.createSignerTabs(signHere); - tabs.setCheckboxTabs(Collections.singletonList(checkbox)); - - Signer signer = new Signer(); - signer.setName(args.getSignerName()); - signer.setEmail(args.getSignerEmail()); - signer.setRoutingOrder("1"); - signer.setRecipientId("1"); - signer.setRoleName("Purchaser"); - signer.setTabs(tabs); - - return signer; - } - - private static Signer createApprovalSigner(String documentId) { - SignHere signHere = new SignHere(); - signHere.setName("SignHere"); - signHere.setRecipientId("2"); - signHere.setXPosition("200"); - signHere.setYPosition("300"); - signHere.setTabLabel("ApproverSignature"); - signHere.setPageNumber("1"); - signHere.setDocumentId(documentId); - - Signer signer = new Signer(); - signer.setName("Approver"); - signer.setEmail("placeholder@example.com"); - signer.setRoutingOrder("2"); - signer.setRecipientId("2"); - signer.setRoleName("Approver"); - signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); - return signer; - } - - private static List createConditionalRecipientRuleConditions() { - - ConditionalRecipientRuleFilter filter1 = new ConditionalRecipientRuleFilter(); - filter1.setRecipientId("1"); - filter1.setScope("tabs"); - filter1.setTabId("ApprovalTab"); - filter1.setOperator("equals"); - filter1.setValue("false"); - filter1.setTabType("checkbox"); - filter1.setTabLabel("ApproveWhenChecked"); - - ConditionalRecipientRuleFilter filter2 = new ConditionalRecipientRuleFilter(); - filter2.setRecipientId("1"); - filter2.setScope("tabs"); - filter2.setTabId("ApprovalTab"); - filter2.setOperator("equals"); - filter2.setValue("true"); - filter2.setTabType("checkbox"); - filter2.setTabLabel("ApproveWhenChecked"); - - ConditionalRecipientRuleCondition condition1 = new ConditionalRecipientRuleCondition(); - condition1.setRecipientLabel("signer2a"); - condition1.setOrder("1"); - condition1.setFilters(Collections.singletonList(filter1)); - - ConditionalRecipientRuleCondition condition2 = new ConditionalRecipientRuleCondition(); - condition2.setRecipientLabel("signer2b"); - condition2.setOrder("2"); - condition2.setFilters(Collections.singletonList(filter2)); - return Arrays.asList(condition1, condition2); - } - - private static RecipientGroup createRecipientGroup(WorkArguments args) { - RecipientOption recipientOption1 = new RecipientOption(); - recipientOption1.setRecipientLabel("signer2a"); - recipientOption1.setName(args.getSignerNotCheckedName()); - recipientOption1.setRoleName("Signer when not checked"); - recipientOption1.setEmail(args.getSignerNotCheckedEmail()); - - RecipientOption recipientOption2 = new RecipientOption(); - recipientOption2.setRecipientLabel("signer2b"); - recipientOption2.setName(args.getSignerCheckedName()); - recipientOption2.setRoleName("Signer when checked"); - recipientOption2.setEmail(args.getSignerCheckedEmail()); - - RecipientGroup recipientGroup = new RecipientGroup(); - recipientGroup.setGroupName("Approver"); - recipientGroup.setGroupMessage("Members of this group approve a workflow"); - recipientGroup.setRecipients(Arrays.asList(recipientOption1, recipientOption2)); - return recipientGroup; - } - - private static ConditionalRecipientRule createConditionalRecipientRule(WorkArguments args) { - ConditionalRecipientRule conditionalRecipientRule = new ConditionalRecipientRule(); - conditionalRecipientRule.setRecipientId("2"); - conditionalRecipientRule.setOrder("0"); - conditionalRecipientRule.setRecipientGroup(createRecipientGroup(args)); - conditionalRecipientRule.setConditions(createConditionalRecipientRuleConditions()); - return conditionalRecipientRule; - } - - private static RecipientRouting createRecipientRouting(WorkArguments args) { - RecipientRules recipientRules = new RecipientRules(); - recipientRules.setConditionalRecipients(Collections.singletonList(createConditionalRecipientRule(args))); - - RecipientRouting recipientRouting = new RecipientRouting(); - recipientRouting.setRules(recipientRules); - return recipientRouting; - } - // ***DS.snippet.0.end } \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java index bfaf4d2f..37888f60 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java @@ -7,6 +7,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.ScheduledSendlingService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -34,14 +35,6 @@ @Controller @RequestMapping("/eg035") public class EG035ControllerScheduledSending extends AbstractEsignatureController { - - - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - - private final Session session; private final User user; @@ -66,8 +59,11 @@ protected Object doWork(WorkArguments args, ModelMap model, System.out.println("RESUMEDATE"); System.out.println(args.getResumeDate()+"T00:00:00Z"); - EnvelopeDefinition envelope = makeEnvelope(args); - + EnvelopeDefinition envelope = ScheduledSendlingService.makeEnvelope( + args.getSignerEmail(), + args.getSignerName(), + args.getResumeDate(), + args.getStatus()); // Step 3 start EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); @@ -86,60 +82,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - // document 1 (PDF) has sign here anchor tag /sn1/ - // - // The envelope has one recipient. - // recipient 1 - signer - - // create the envelope definition - - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // The DocuSign platform searches throughout your envelope's documents - // for matching anchor strings. - - // Step 2 start - - Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // Create a signer recipient to sign the document, identified by name - // and email. We're setting the parameters via the object creation. - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signerTabs); - - - // The order in the docs array determines the order in the envelope - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please sign this document"); - envelope.setDocuments(Arrays.asList( - EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "1"))); - envelope.setRecipients(EnvelopeHelpers.createSingleRecipient(signer)); - - // Add the workflow to schedule the envelope with a delay - EnvelopeDelayRuleApiModel delayRule = new EnvelopeDelayRuleApiModel(); - - delayRule.setResumeDate(args.getResumeDate()+"T00:00:00Z"); - - ScheduledSendingApiModel scheduledSendingApiModel = new ScheduledSendingApiModel(); - scheduledSendingApiModel.setRules(Arrays.asList(delayRule)); - - Workflow workflow = new Workflow(); - workflow.setScheduledSending(scheduledSendingApiModel); - envelope.setWorkflow(workflow); - - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); - - return envelope; - - // Step 2 end - } + } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java index 4e5fabdb..415a6c1c 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java @@ -2,6 +2,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.DelayedRoutingService; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -34,16 +35,6 @@ @Controller @RequestMapping("/eg036") public class EG036ControllerDelayedRouting extends AbstractEsignatureController { - - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - - private static final int ANCHOR_OFFSET_X_2 = 120; - private final Session session; private final User user; @@ -64,7 +55,13 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = makeEnvelope(args); + EnvelopeDefinition envelope = DelayedRoutingService.makeEnvelope( + args.getSignerName(), + args.getSignerEmail(), + args.getSignerName2(), + args.getSignerEmail2(), + args.getDelay(), + args.getStatus()); // Step 3 start EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); @@ -81,81 +78,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return DONE_EXAMPLE_PAGE; } - // document 1 (docx) has tag /sn1/ - // document 2 (pdf) has tag /sn1/ - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. After it is signed, - // a copy is sent to the cc person. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // The DocuSign platform searches throughout your envelope's documents - // for matching anchor strings. So the signHere2 tab will be used in - // both document 2 and 3 since they use the same anchor string for - // their "signer 1" tabs. - - // Step 2 start - - Tabs signer1Tabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - Tabs signer2Tabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X_2)); - - // Create a signer recipient to sign the document, identified by name - // and email. We're setting the parameters via the object creation. - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - Signer signer = new Signer(); - signer.setEmail(args.getSignerEmail()); - signer.setName(args.getSignerName()); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signer1Tabs); - - Signer signer2 = new Signer(); - signer2.setEmail(args.getSignerEmail2()); - signer2.setName(args.getSignerName2()); - signer2.setRecipientId("2"); - signer2.setRoutingOrder("2"); - signer2.setTabs(signer2Tabs); - - // The order in the docs array determines the order in the envelope - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please sign this document set"); - envelope.setDocuments(Arrays.asList( - EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), - EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); - envelope.setRecipients(EnvelopeHelpers.createTwoSigners(signer, signer2)); - - // Add the workflow to delay the second recipient - - String delay = args.getDelay() + ":00:00"; - EnvelopeDelayRuleApiModel rule = new EnvelopeDelayRuleApiModel(); - rule.setDelay(delay); - DelayedRoutingApiModel delayedRouting = new DelayedRoutingApiModel(); - delayedRouting.setRules(Arrays.asList(rule)); - - WorkflowStep workflowStep = new WorkflowStep(); - workflowStep.setAction("pause_before"); - workflowStep.setTriggerOnItem("routing_order"); - workflowStep.setItemId("2"); - workflowStep.setStatus("pending"); - workflowStep.setDelayedRouting(delayedRouting); - - Workflow workflow = new Workflow(); - workflow.setWorkflowSteps(Arrays.asList(workflowStep)); - envelope.setWorkflow(workflow); - - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); - - return envelope; - - // Step 2 end - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java index 10076453..3b23f39d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java @@ -2,29 +2,21 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; -import com.docusign.core.common.DocumentType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.CarbonCopy; -import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.Signer; -import com.docusign.esign.model.Tabs; -import com.docusign.esign.model.RecipientAdditionalNotification; -import com.docusign.esign.model.RecipientPhoneNumber; - +import com.docusign.esign.model.*; +import com.docusign.controller.eSignature.services.SMSDeliveryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; -import java.io.IOException; -import java.util.Arrays; import javax.servlet.http.HttpServletResponse; - +import java.io.IOException; +import java.util.Arrays; /** * Send an envelope with a remote (email) signer and cc recipient.
@@ -34,15 +26,6 @@ @Controller @RequestMapping("/eg037") public class EG037ControllerSMSDelivery extends AbstractEsignatureController { - - - private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; - private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; - private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; - private static final int ANCHOR_OFFSET_Y = 10; - private static final int ANCHOR_OFFSET_X = 20; - private final Session session; private final User user; @@ -63,76 +46,28 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - EnvelopeDefinition envelope = makeEnvelope(args); - EnvelopeSummary results = envelopesApi.createEnvelope(session.getAccountId(), envelope); + EnvelopeDefinition envelope = SMSDeliveryService.makeEnvelope( + args.getCountryCode(), + args.getPhoneNumber(), + args.getSignerName(), + args.getCcCountryCode(), + args.getCcPhoneNumber(), + args.getCcName(), + args.getStatus() + ); + EnvelopeSummary envelopeSummary = SMSDeliveryService.smsDelivery( + envelopesApi, + session.getAccountId(), + envelope + ); // process results - session.setEnvelopeId(results.getEnvelopeId()); + session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(title) .withMessage("The envelope has been created and sent!
Envelope ID " - + results.getEnvelopeId() + ".") - .withJsonObject(results) + + envelopeSummary.getEnvelopeId() + ".") + .withJsonObject(envelopeSummary) .addToModel(model); return DONE_EXAMPLE_PAGE; } - - // document 2 (docx) has tag /sn1/ - // document 3 (pdf) has tag /sn1/ - // - // The envelope has two recipients. - // recipient 1 - signer - // recipient 2 - cc - // The envelope will be sent first to the signer. After it is signed, - // a copy is sent to the cc person. - public static EnvelopeDefinition makeEnvelope(WorkArguments args) throws IOException { - // The DocuSign platform searches throughout your envelope's documents - // for matching anchor strings. So the signHere2 tab will be used in - // both document 2 and 3 since they use the same anchor string for - // their "signer 1" tabs. - Tabs signerTabs = EnvelopeHelpers.createSignerTabs( - EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); - - // Create a signer recipient to sign the document, identified by name - // and phone number. We're setting the parameters via the object creation. - // RoutingOrder (lower means earlier) determines the order of deliveries - // to the recipients. Parallel routing order is supported by using the - // same integer as the order for two or more recipients. - - RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); - phoneNumber.setCountryCode(args.getCountryCode()); - phoneNumber.setNumber(args.getPhoneNumber()); - - Signer signer = new Signer(); - signer.setName(args.getSignerName()); - signer.setPhoneNumber(phoneNumber); - signer.setRecipientId("1"); - signer.setRoutingOrder("1"); - signer.setTabs(signerTabs); - - - // create a cc recipient to receive a copy of the documents, identified by name and phone number - RecipientPhoneNumber ccPhoneNumber = new RecipientPhoneNumber(); - ccPhoneNumber.setCountryCode(args.getCcCountryCode()); - ccPhoneNumber.setNumber(args.getCcPhoneNumber()); - - CarbonCopy cc = new CarbonCopy(); - cc.setName(args.getCcName()); - cc.setPhoneNumber(ccPhoneNumber); - cc.setRecipientId("2"); - cc.setRoutingOrder("2"); - - - // The order in the docs array determines the order in the envelope - EnvelopeDefinition envelope = new EnvelopeDefinition(); - envelope.setEmailSubject("Please sign this document set"); - envelope.setDocuments(Arrays.asList( - EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), - EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); - envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); - // Request that the envelope be sent by setting |status| to "sent". - // To request that the envelope be created as a draft, set to "created" - envelope.setStatus(args.getStatus()); - - return envelope; - } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java index 48faef48..f0b6492b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java @@ -49,7 +49,7 @@ private EnvelopeHelpers() {} * @return the new byte array that has been loaded from the file * @throws IOException in case of I/O errors */ - static byte[] readFile(String path) throws IOException { + public static byte[] readFile(String path) throws IOException { ClassPathResource resource = new ClassPathResource(path); return StreamUtils.copyToByteArray(resource.getInputStream()); } @@ -104,7 +104,7 @@ static byte[] createHtmlFromTemplate(Template template, String objectName, Objec * @return array of bytes representing created html document * @throws IOException in case of I/O errors or template parsing error */ - static byte[] createHtmlFromTemplateFile(String path, String objectName, Object value) throws IOException { + public static byte[] createHtmlFromTemplateFile(String path, String objectName, Object value) throws IOException { Template template = loadHtmlTemplate(path); return createHtmlFromTemplate(template, objectName, value); } @@ -133,7 +133,7 @@ public static Document createDocumentFromFile(String fileName, String docName, S * @param documentId identifier of the created document * @return the {@link Document} object */ - static Document createDocument(byte[] data, String documentName, String fileExtention, String documentId) { + public static Document createDocument(byte[] data, String documentName, String fileExtention, String documentId) { Document document = new Document(); document.setDocumentBase64(Base64.getEncoder().encodeToString(data)); document.setName(documentName); @@ -151,7 +151,7 @@ static Document createDocument(byte[] data, String documentName, String fileExte * @param xOffsetPixels the x offset of anchor in pixels * @return the {@link SignHere} object */ - static SignHere createSignHere(String anchorString, int yOffsetPixels, int xOffsetPixels) { + public static SignHere createSignHere(String anchorString, int yOffsetPixels, int xOffsetPixels) { SignHere signHere = new SignHere(); signHere.setAnchorString(anchorString); signHere.setAnchorUnits("pixels"); @@ -179,7 +179,7 @@ public static Tabs createSingleSignerTab(String anchorString, int yOffsetPixels, * @param signs the array of SignHere (see {@link SignHere}) * @return the {@link Tabs} object containing passed SignHere objects */ - static Tabs createSignerTabs(SignHere... signs) { + public static Tabs createSignerTabs(SignHere... signs) { Tabs signerTabs = new Tabs(); signerTabs.setSignHereTabs(Arrays.asList(signs)); return signerTabs; @@ -191,7 +191,7 @@ static Tabs createSignerTabs(SignHere... signs) { * @param cc the cc object * @return the {@link Recipients} object */ - static Recipients createRecipients(Signer signer, CarbonCopy cc) { + public static Recipients createRecipients(Signer signer, CarbonCopy cc) { Recipients recipients = new Recipients(); recipients.setSigners(Arrays.asList(signer)); recipients.setCarbonCopies(Arrays.asList(cc)); diff --git a/src/main/java/com/docusign/controller/eSignature/services/AccessCodeAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/AccessCodeAuthenticationService.java new file mode 100644 index 00000000..9225e14e --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/AccessCodeAuthenticationService.java @@ -0,0 +1,46 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; + +public final class AccessCodeAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary accessCodeAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail, + String accessCode + ) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + Signer signer = KBAAuthenticationService.setSignHereAndSignerForEnvelope(signerName, signerEmail); + signer.setAccessCode(accessCode); + + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please Sign"); + envelope.setDocuments(Collections.singletonList(doc)); + envelope.setEnvelopeIdStamping("true"); + envelope.setEmailBlurb("Sample text for email body"); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java new file mode 100644 index 00000000..29ab8fcd --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java @@ -0,0 +1,161 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public final class AddDocToTemplateService { + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl"; + private static final String HTML_DOCUMENT_NAME = "Appendix 1--Sales order"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static ViewUrl addDocumentToTemplate( + EnvelopesApi envelopesApi, + String signerEmail, + String signerName, + String signerClientId, + String ccEmail, + String ccName, + String templateId, + String accountId, + String dsReturnUrl, + String dsPingUrl, + WorkArguments args + ) throws ApiException, IOException { + EnvelopeDefinition envelope = AddDocToTemplateService.makeEnvelope( + signerEmail, + signerName, + signerClientId, + ccEmail, + ccName, + templateId, + args + ); + + // Step 3 start + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + // Step 3 end + + // Step 4 start + RecipientViewRequest viewRequest = AddDocToTemplateService.makeRecipientViewRequest( + dsReturnUrl, + signerEmail, + signerName, + signerClientId, + dsPingUrl + ); + return envelopesApi.createRecipientView(accountId, envelopeSummary.getEnvelopeId(), viewRequest); + } + + private static RecipientViewRequest makeRecipientViewRequest( + String dsReturnUrl, + String signerEmail, + String signerName, + String signerClientId, + String dsPingUrl + ) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + viewRequest.setReturnUrl(dsReturnUrl); + return SetTabValuesService.setEmailAndSignerNameForRecipientViewRequest( + viewRequest, + signerEmail, + signerName, + dsPingUrl); + } + + // The envelope request object uses Composite Template to include in the envelope: + // 1. A template stored on the DocuSign service + // 2. An additional document which is a custom HTML source document + private static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String signerClientId, + String ccEmail, + String ccName, + String templateId, + WorkArguments args + ) throws IOException { + // Create a signer and cc recipients for the signer role of the server template + CarbonCopy cc1 = new CarbonCopy(); + cc1.setEmail(ccEmail); + cc1.setName(ccName); + cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); + cc1.setRecipientId("2"); + + // create a composite template for the Server Template + CompositeTemplate compTemplate1 = new CompositeTemplate(); + compTemplate1.setCompositeTemplateId("1"); + ServerTemplate serverTemplates = new ServerTemplate(); + serverTemplates.setSequence("1"); + serverTemplates.setTemplateId(templateId); + compTemplate1.setServerTemplates(Collections.singletonList(serverTemplates)); + + // Add the roles via an inlineTemplate + InlineTemplate inlineTemplate = new InlineTemplate(); + inlineTemplate.setSequence("2"); + inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients( + createSigner( + signerEmail, + signerName, + signerClientId + ), + cc1)); + compTemplate1.setInlineTemplates(Collections.singletonList(inlineTemplate)); + + // The signer recipient for the added document with a tab definition: + Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab( + "**signature_1**", + ANCHOR_OFFSET_Y, + ANCHOR_OFFSET_X); + Signer signer1AddedDoc = createSigner( + signerEmail, + signerName, + signerClientId + ); + signer1AddedDoc.setTabs(signer1Tabs); + + // create the HTML document + byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + + // create a composite template for the added document and add the recipients via an inlineTemplate + CompositeTemplate compTemplate2 = new CompositeTemplate(); + compTemplate2.setCompositeTemplateId("2"); + InlineTemplate inlineTemplate2 = new InlineTemplate(); + inlineTemplate2.setSequence("1"); + inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc1)); + compTemplate2.setInlineTemplates(Collections.singletonList(inlineTemplate2)); + compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, + DocumentType.HTML.getDefaultFileExtention(), "1")); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelopeDefinition.setCompositeTemplates(Arrays.asList(compTemplate1, compTemplate2)); + + return envelopeDefinition; + } + + // Adding clientUserId transforms the template recipient into an embedded recipient + private static Signer createSigner( + String signerEmail, + String signerName, + String signerClientId + ) { + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + signer.setRecipientId("1"); + signer.setClientUserId(signerClientId); + return signer; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToEnvelopeService.java b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToEnvelopeService.java new file mode 100644 index 00000000..bdee0e8d --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToEnvelopeService.java @@ -0,0 +1,58 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +public final class ApplyBrandToEnvelopeService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "EG025 Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static EnvelopeSummary applyBrandToEnvelope( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + // Creates an envelope. The envelope has one recipient who should sign an + // attached document. Attached document is read from a local directory. + // Also the envelope contains a brand Id which is created on EG028 example. + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String brandId + ) throws IOException { + // Reads a file from a local directory and create Document object. + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + // Create a signer recipient to sign the document and associate sign tab + Tabs tabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); + Signer signer = new Signer() + .email(signerEmail) + .name(signerName) + .recipientId("1") + .routingOrder("1") + .tabs(tabs); + + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer)); + + // Return envelope definition using created objects: the document, + // the recipients and obtained brand Id. + return new EnvelopeDefinition() + .emailSubject("EG029. Please Sign") + .documents(List.of(document)) + .recipients(recipients) + .brandId(brandId) + .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToTemplateService.java new file mode 100644 index 00000000..0aee7212 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/ApplyBrandToTemplateService.java @@ -0,0 +1,45 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.TemplateRole; + +import java.util.Arrays; + +public final class ApplyBrandToTemplateService { + public static EnvelopeSummary applyBrandToTemplate( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String templateId, + String brandId + ) { + TemplateRole signer = new TemplateRole() + .email(signerEmail) + .name(signerName) + .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + + TemplateRole cc = new TemplateRole() + .email(ccEmail) + .name(ccName) + .roleName(EnvelopeHelpers.CC_ROLE_NAME); + + return new EnvelopeDefinition() + .templateId(templateId) + .templateRoles(Arrays.asList(signer, cc)) + .brandId(brandId) + .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/BulkSendEnvelopesService.java b/src/main/java/com/docusign/controller/eSignature/services/BulkSendEnvelopesService.java new file mode 100644 index 00000000..1e3654c7 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/BulkSendEnvelopesService.java @@ -0,0 +1,171 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.DsModelUtils; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.BulkEnvelopesApi; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +public final class BulkSendEnvelopesService { + private static final String BULK_SIGNER_EMAIL_PLACEHOLDER = "MultiBulkRecipients-%s@docusign.com"; + private static final String BULK_SIGNER_NAME_PLACEHOLDER = "Multi Bulk Recipients::%s"; + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = -5; + private static final int ANCHOR_OFFSET_X = 15; + + public static String bulkSendEnvelopes( + BulkEnvelopesApi bulkEnvelopesApi, + ApiClient apiClient, + String signerName, + String signerEmail, + String ccName, + String ccEmail, + String signerName2, + String signerEmail2, + String ccName2, + String ccEmail2, + String accountId + ) throws ApiException, IOException { + // Step 3. Submit a bulk list + BulkSendingList sendingList = BulkSendEnvelopesService.getSendingList( + signerName, + signerEmail, + ccName, + ccEmail, + signerName2, + signerEmail2, + ccName2, + ccEmail2 + ); + + String bulkListId = bulkEnvelopesApi.createBulkSendList(accountId, sendingList).getListId(); + // Step 3-1 end + + // Create an envelope + // Step 4-1 start + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + String envelopeId = envelopesApi.createEnvelope(accountId, makeEnvelope()).getEnvelopeId(); + // Step 4-1 end + + // Attach your bulk list ID to the envelope + // Step 5 start + CustomFields customFields = createCustomFields(bulkListId); + envelopesApi.createCustomFields(accountId, envelopeId, customFields); + // Step 5 end + + // Initiate bulk send + // Step 6 start + BulkSendRequest request = new BulkSendRequest(); + request.setEnvelopeOrTemplateId(envelopeId); + return bulkEnvelopesApi.createBulkSendRequest(accountId, bulkListId, request).getBatchId(); + // Step 6 end + } + + // Step 3-2 start + public static BulkSendingList getSendingList( + String signerName, + String signerEmail, + String ccName, + String ccEmail, + String signerName2, + String signerEmail2, + String ccName2, + String ccEmail2 + ) { + List copies = List.of( + createBulkSending(signerName, signerEmail, ccName, ccEmail), + createBulkSending(signerName2, signerEmail2, ccName2, ccEmail2) + ); + return new BulkSendingList() + .name("sample.csv") + .bulkCopies(copies); + } + // Step 3-2 end + + private static BulkSendingCopy createBulkSending( + String signerName, + String signerEmail, + String ccName, + String ccEmail + ) { + BulkSendingCopyRecipient recipient1 = new BulkSendingCopyRecipient() + .name(signerName) + .email(signerEmail) + .tabs(Collections.emptyList()) + .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + BulkSendingCopyRecipient recipient2 = new BulkSendingCopyRecipient() + .name(ccName) + .email(ccEmail) + .tabs(Collections.emptyList()) + .roleName(EnvelopeHelpers.CC_ROLE_NAME); + return new BulkSendingCopy() + .recipients(List.of(recipient1, recipient2)) + .customFields(Collections.emptyList()); + } + + // Step 4-2 start + public static EnvelopeDefinition makeEnvelope() throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + return new EnvelopeDefinition() + .documents(List.of(document)) + .envelopeIdStamping(DsModelUtils.TRUE) + .emailSubject("EG031 Please sign") + .status(EnvelopeHelpers.ENVELOPE_STATUS_CREATED) + .recipients(createRecipients()); + } + // Step 4-2 end + + private static CustomFields createCustomFields(String bulkListId) { + TextCustomField textCustomField = new TextCustomField() + .name("mailingListId") + .required(DsModelUtils.FALSE) + .show(DsModelUtils.FALSE) + .value(bulkListId); + + return new CustomFields() + .listCustomFields(Collections.emptyList()) + .textCustomFields(List.of(textCustomField)); + } + + private static Recipients createRecipients() { + Signer signer = createSignerPlaceholder(EnvelopeHelpers.SIGNER_ROLE_NAME, "1", "1"); + CarbonCopy cc = createCCPlaceholder(EnvelopeHelpers.CC_ROLE_NAME, "2", "2"); + return new Recipients() + .signers(List.of(signer)) + .carbonCopies(List.of(cc)); + } + + private static Signer createSignerPlaceholder(String roleName, String recipientId, String routingOrder) { + return new Signer() + .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) + .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) + .roleName(roleName) + .note("") + .routingOrder(routingOrder) + .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) + .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) + .recipientId(recipientId) + .recipientType(roleName) + .tabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + } + + private static CarbonCopy createCCPlaceholder(String roleName, String recipientId, String routingOrder) { + return new CarbonCopy() + .name(String.format(BULK_SIGNER_NAME_PLACEHOLDER, roleName)) + .email(String.format(BULK_SIGNER_EMAIL_PLACEHOLDER, roleName)) + .roleName(roleName) + .note("") + .routingOrder(routingOrder) + .status(EnvelopeHelpers.SIGNER_STATUS_CREATED) + .deliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL) + .recipientId(recipientId) + .recipientType(roleName); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java b/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java new file mode 100644 index 00000000..224bf507 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java @@ -0,0 +1,185 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public final class CollectPaymentService { + private static final String HTML_DOCUMENT_FILE_NAME = "templates/order-form.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order form"; + // Order form constants + private static final String TRUE = "true"; + private static final String FALSE = "false"; + private static final int L1_PRICE = 5; + private static final int L2_PRICE = 150; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + private static final String DEFAULT_FONT = "helvetica"; + private static final String DEFAULT_FONT_SIZE = "size11"; + private static final String ANCHOR_UNITS = "pixels"; + + public static EnvelopeSummary collectPayment( + EnvelopesApi envelopesApi, + EnvelopeDefinition envelope, + String accountId + ) throws ApiException { + // Step 2. call Envelopes::create API method + return envelopesApi.createEnvelope(accountId, envelope); + } + // document 1 (html) has multiple tags: + // /l1q/ and /l2q/ -- quantities: drop down + // /l1e/ and /l2e/ -- extended: payment lines + // /l3t/ -- total -- formula + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. + // After it is signed, a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String ccName, + String ccEmail, + String gatewayAccountId, + String gatewayName, + String gatewayDisplayName, + WorkArguments args + ) throws IOException { + byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + + // create a signer recipient to sign the document, identified by name and email + // routingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer() + .email(signerEmail) + .name(signerName) + .recipientId("1") + .routingOrder("1"); + signer.setTabs(createTabs(gatewayAccountId, gatewayName, gatewayDisplayName)); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy() + .email(ccEmail) + .name(ccName) + .routingOrder("2") + .recipientId("2"); + + // Create the envelope definition + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please complete your order"); + envelope.setDocuments(Collections.singletonList(EnvelopeHelpers.createDocument(htmlDoc, + HTML_DOCUMENT_NAME, DocumentType.HTML.getDefaultFileExtention(), "1"))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelope; + } + + // creates tabs per signer + private static Tabs createTabs(String gatewayAccountId, String gatewayName, String gatewayDisplayName) { + java.util.List listItems = java.util.List.of( + new ListItem().text("none").value("0"), + new ListItem().text("1").value("1"), + new ListItem().text("2").value("2"), + new ListItem().text("3").value("3"), + new ListItem().text("4").value("4"), + new ListItem().text("5").value("5"), + new ListItem().text("6").value("6"), + new ListItem().text("7").value("7"), + new ListItem().text("8").value("8"), + new ListItem().text("9").value("9"), + new ListItem().text("10").value("10")); + List listl1q = createList("/l1q/", "l1q", listItems); + List listl2q = createList("/l2q/", "l2q", listItems); + + // Create two formula tabs for the extended price on the line items and formula for the total + FormulaTab formulal1e = createFormulaTab("/l1e/", "l1e", L1_PRICE); + FormulaTab formulal2e = createFormulaTab("/l2e/", "l2e", L2_PRICE); + FormulaTab formulal3t = new FormulaTab() + .font(DEFAULT_FONT) + .bold(TRUE) + .fontSize("size12") + .anchorString("/l3t/") + .anchorYOffset("-8") + .anchorUnits(ANCHOR_UNITS) + .anchorXOffset("50") + .tabLabel("l3t") + .formula("[l1e] + [l2e]") + .roundDecimalPlaces("0") + .required(TRUE) + .locked(TRUE) + .disableAutoSize(FALSE); + PaymentLineItem paymentLineIteml1 = new PaymentLineItem() + .name("Harmonica") + .description(String.format("${%d} each", L1_PRICE)) + .amountReference("l1e"); + PaymentLineItem paymentLineIteml2 = new PaymentLineItem() + .name("Xylophone") + .description(String.format("${%d} each", L2_PRICE)) + .amountReference("l2e"); + PaymentDetails paymentDetails = new PaymentDetails() + .gatewayAccountId(gatewayAccountId) + .currencyCode("USD") + .gatewayName(gatewayName) + .gatewayDisplayName(gatewayDisplayName) + .lineItems(Arrays.asList(paymentLineIteml1, paymentLineIteml2)); + // Hidden formula for the payment itself + FormulaTab formulaPayment = new FormulaTab() + .tabLabel("payment") + .formula("([l1e] + [l2e]) * {100}") + .roundDecimalPlaces("0") + .paymentDetails(paymentDetails) + .hidden(TRUE) + .required(TRUE) + .locked(TRUE) + .documentId("1") + .pageNumber("1") + .xPosition("0") + .yPosition("0"); + + Tabs signerTabs = EnvelopeHelpers.createSingleSignerTab("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); + signerTabs.listTabs(Arrays.asList(listl1q, listl2q)); + signerTabs.formulaTabs(Arrays.asList(formulal1e, formulal2e, formulal3t, formulaPayment)); + return signerTabs; + } + + private static List createList(String anchor, String label, java.util.List items) { + return new List() + .font(DEFAULT_FONT) + .fontSize(DEFAULT_FONT_SIZE) + .anchorString(anchor) + .anchorYOffset("-10") + .anchorUnits(ANCHOR_UNITS) + .anchorXOffset("0") + .listItems(items) + .required(TRUE) + .tabLabel(label); + } + + private static FormulaTab createFormulaTab(String anchor, String label, int price) { + return new FormulaTab() + .font(DEFAULT_FONT) + .fontSize(DEFAULT_FONT_SIZE) + .anchorString(anchor) + .anchorYOffset("-8") + .anchorUnits(ANCHOR_UNITS) + .anchorXOffset("105") + .tabLabel(label) + .formula(String.format("[l1q] * {%d}", price)) + .roundDecimalPlaces("0") + .required(TRUE) + .locked(TRUE) + .disableAutoSize(FALSE); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/CreateBrandService.java b/src/main/java/com/docusign/controller/eSignature/services/CreateBrandService.java new file mode 100644 index 00000000..dfd73b2f --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/CreateBrandService.java @@ -0,0 +1,25 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Brand; +import com.docusign.esign.model.BrandsResponse; + +import java.util.List; + +public final class CreateBrandService { + public static BrandsResponse createBrand( + AccountsApi accountsApi, + String brandName, + String language, + String accountId + ) throws ApiException { + Brand brand = new Brand() + .brandName(brandName) + .defaultBrandLanguage(language) + .brandLanguages(List.of(language)); + + // Step 5: Call the eSignature REST API + return accountsApi.createBrand(accountId, brand); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/CreateTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/CreateTemplateService.java new file mode 100644 index 00000000..53203c23 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/CreateTemplateService.java @@ -0,0 +1,180 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.TemplatesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Locale; + +public final class CreateTemplateService { + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_fields.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCUMENT_ID = "1"; + private static final String PAGE_NUMBER = "1"; + private static final String FALSE = "false"; + + public static TemplateSummary createTemplate( + ApiClient apiClient, + String accountId, + EnvelopeTemplate envelopeTemplate + ) throws ApiException { + TemplatesApi templatesApi = new TemplatesApi(apiClient); + return templatesApi.createTemplate(accountId, envelopeTemplate); + } + + public static EnvelopeTemplateResults searchTemplatesByName( + ApiClient apiClient, + String accountId, + String templateName + ) throws ApiException { + TemplatesApi templatesApi = new TemplatesApi(apiClient); + TemplatesApi.ListTemplatesOptions options = templatesApi.new ListTemplatesOptions(); + options.setSearchText(templateName); + return templatesApi.listTemplates(accountId, options); + } + + // document 1 (pdf) has tag /sn1/ + // + // The template has two recipient roles. + // recipient 1 - signer + // recipient 2 - cc + // The template will be sent first to the signer. + // After it is signed, a copy is sent to the cc person. + public static EnvelopeTemplate makeTemplate(String templateName) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "1"); + + // Tabs are set per recipient / signer + Tabs signer1Tabs = new Tabs(); + signer1Tabs.setCheckboxTabs(Arrays.asList( + createCheckbox("ckAuthorization", "75", "417"), + createCheckbox("ckAuthentication", "75", "447"), + createCheckbox("ckAgreement", "75", "478"), + createCheckbox("ckAcknowledgement", "75", "508"))); + signer1Tabs.setListTabs(Collections.singletonList(createList())); + signer1Tabs.setRadioGroupTabs(Collections.singletonList(createRadioGroup())); + signer1Tabs.setSignHereTabs(Collections.singletonList(createSignHere())); + signer1Tabs.textTabs(Arrays.asList( + createText("text", "153", "230"), + createText("numbersOnly", "153", "260"))); + + // create a signer recipient to sign the document, identified by name and email + // routingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signer1Tabs); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc1 = new CarbonCopy(); + cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); + cc1.setRoutingOrder("2"); + cc1.setRecipientId("2"); + + // Create the overall template definition. The order in the docs array + // determines the order in the envelope. + EnvelopeTemplate template = new EnvelopeTemplate(); + template.setDocuments(Collections.singletonList(doc)); + template.setEmailSubject("Please sign this document"); + template.setName(templateName); + template.setDescription("Example template created via the API"); + template.setShared(FALSE); + template.setRecipients(EnvelopeHelpers.createRecipients(signer, cc1)); + template.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); + + return template; + } + + private static List createList() { + List list = new List(); + list.setDocumentId(DOCUMENT_ID); + list.setPageNumber(PAGE_NUMBER); + list.setXPosition("142"); + list.setYPosition("291"); + list.setFont("helvetica"); + list.setFontSize("size14"); + list.setTabLabel("list"); + list.setRequired(FALSE); + list.setListItems(Arrays.asList( + createListItem("Red"), + createListItem("Orange"), + createListItem("Yellow"), + createListItem("Green"), + createListItem("Blue"), + createListItem("Indigo"), + createListItem("Violet") + )); + return list; + } + + private static ListItem createListItem(String color) { + ListItem item = new ListItem(); + item.setText(color); + item.setValue(color.toLowerCase(Locale.ENGLISH)); + return item; + } + + private static RadioGroup createRadioGroup() { + RadioGroup radioGroup = new RadioGroup(); + radioGroup.setDocumentId(DOCUMENT_ID); + radioGroup.setGroupName("radio1"); + + radioGroup.setRadios(Arrays.asList( + createRadio("white", "142"), + createRadio("red", "74"), + createRadio("blue", "220") + )); + return radioGroup; + } + + private static Radio createRadio(String value, String xPosition) { + Radio radio = new Radio(); + radio.setPageNumber(PAGE_NUMBER); + radio.setValue(value); + radio.setXPosition(xPosition); + radio.setYPosition("384"); + radio.setRequired(FALSE); + return radio; + } + + private static Checkbox createCheckbox(String label, String xPosition, String yPosition) { + Checkbox check = new Checkbox(); + check.setDocumentId(DOCUMENT_ID); + check.setPageNumber(PAGE_NUMBER); + check.setXPosition(xPosition); + check.setYPosition(yPosition); + check.setTabLabel(label); + return check; + } + + private static Text createText(String label, String xPosition, String yPosition) { + Text text = new Text(); + text.setDocumentId(DOCUMENT_ID); + text.setPageNumber(PAGE_NUMBER); + text.setXPosition(xPosition); + text.setYPosition(yPosition); + text.setFont("helvetica"); + text.setFontSize("size14"); + text.setTabLabel(label); + text.setHeight("23"); + text.setWidth("84"); + text.setRequired(FALSE); + return text; + } + + private static SignHere createSignHere() { + SignHere signHere = new SignHere(); + signHere.setDocumentId(DOCUMENT_ID); + signHere.setPageNumber(PAGE_NUMBER); + signHere.setXPosition("191"); + signHere.setYPosition("148"); + return signHere; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java b/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java new file mode 100644 index 00000000..5362c744 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java @@ -0,0 +1,102 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; + +public class DelayedRoutingService { + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + private static final int ANCHOR_OFFSET_X_2 = 120; + // document 1 (docx) has tag /sn1/ + // document 2 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. After it is signed, + // a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope( + String signerName, + String signerEmail, + String signerName2, + String signerEmail2, + String delay, + String status) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. So the signHere2 tab will be used in + // both document 2 and 3 since they use the same anchor string for + // their "signer 1" tabs. + + // Step 2 start + + Tabs signer1Tabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + Tabs signer2Tabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X_2)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signer1Tabs); + + Signer signer2 = new Signer(); + signer2.setEmail(signerEmail2); + signer2.setName(signerName2); + signer2.setRecipientId("2"); + signer2.setRoutingOrder("2"); + signer2.setTabs(signer2Tabs); + + // The order in the docs array determines the order in the envelope + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); + envelope.setRecipients(EnvelopeHelpers.createTwoSigners(signer, signer2)); + + // Add the workflow to delay the second recipient + + String delayFormatted = delay + ":00:00"; + EnvelopeDelayRuleApiModel rule = new EnvelopeDelayRuleApiModel(); + rule.setDelay(delayFormatted); + + DelayedRoutingApiModel delayedRouting = new DelayedRoutingApiModel(); + delayedRouting.setRules(Arrays.asList(rule)); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction("pause_before"); + workflowStep.setTriggerOnItem("routing_order"); + workflowStep.setItemId("2"); + workflowStep.setStatus("pending"); + workflowStep.setDelayedRouting(delayedRouting); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Arrays.asList(workflowStep)); + envelope.setWorkflow(workflow); + + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(status); + + return envelope; + + // Step 2 end + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EmbeddedConsoleService.java b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedConsoleService.java new file mode 100644 index 00000000..bb4d881d --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedConsoleService.java @@ -0,0 +1,28 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.ConsoleViewRequest; +import com.docusign.esign.model.ViewUrl; + +public final class EmbeddedConsoleService { + public static ViewUrl createConsoleView( + EnvelopesApi envelopesApi, + String dsReturnUrl, + String envelopeId, + String startingView, + String accountId) throws ApiException { + // Step 1. Create the Console / Web UI view. + // Set the URL where you want the recipient to go once they are finished in + // the Web UI. There are cases where a user will never click "FINISH" within + // the Web UI, you cannot assume control will be passed back to your application. + ConsoleViewRequest viewRequest = new ConsoleViewRequest(); + viewRequest.setReturnUrl(dsReturnUrl); + if ("envelope".equalsIgnoreCase(startingView) && envelopeId != null) { + viewRequest.setEnvelopeId(envelopeId); + } + + // Step 2. Call the CreateSenderView API + return envelopesApi.createConsoleView(accountId, viewRequest); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSendingService.java b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSendingService.java new file mode 100644 index 00000000..de341e2c --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSendingService.java @@ -0,0 +1,49 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.ReturnUrlRequest; +import com.docusign.esign.model.ViewUrl; + +import java.io.IOException; + +public final class EmbeddedSendingService { + public static ViewUrl createSenderView( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + String dsReturnUrl + ) throws ApiException { + // Step 2. Create the sender view. + // Set the url where you want the recipient to go once they are done + // signing should typically be a callback route somewhere in your app. + ReturnUrlRequest viewRequest = new ReturnUrlRequest(); + viewRequest.setReturnUrl(dsReturnUrl); + return envelopesApi.createSenderView(accountId, envelopeId, viewRequest); + } + + public static EnvelopeSummary createEnvelopeWithDraftStatus( + EnvelopesApi envelopesApi, + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String status, + WorkArguments args, + String accountId + ) throws IOException, ApiException { + args.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_CREATED); + EnvelopeDefinition env = SigningViaEmailService.makeEnvelope( + signerEmail, + signerName, + ccEmail, + ccName, + status, + args); + return envelopesApi.createEnvelope(accountId, env); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSigningService.java new file mode 100644 index 00000000..e5277280 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EmbeddedSigningService.java @@ -0,0 +1,97 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.DSConfiguration; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; + +public final class EmbeddedSigningService { + public static ViewUrl embeddedSigning( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + DSConfiguration config, + String clientUserId + ) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + // The query parameter is included as an example of how + // to save/recover state information during the redirect to + // the DocuSign signing. It's usually better to use + // the session mechanism of your web framework. Query parameters + // can be changed/spoofed very easily. + String stateValue = "?state=123"; + viewRequest.setReturnUrl(config.getDsReturnUrl() + stateValue); + + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + String authenticationMethod = "none"; + viewRequest.setAuthenticationMethod(authenticationMethod); + + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(clientUserId); + + // DocuSign recommends that you redirect to DocuSign for the + // embedded signing. There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + String pingFrequency = "600"; + viewRequest.setPingFrequency(pingFrequency); // seconds + viewRequest.setPingUrl(config.getDsPingUrl()); + + return viewRequest; + } + + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String signerClientId, + Integer anchorOffsetY, + Integer anchorOffsetX, + String documentFileName, + String documentName + ) throws IOException { + // Create a signer recipient to sign the document, identified by name and email + // We set the clientUserId to enable embedded signing for the recipient + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.clientUserId(signerClientId); + signer.recipientId("1"); + signer.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", anchorOffsetY, anchorOffsetX)); + + // Add the recipient to the envelope object + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document"); + envelopeDefinition.setRecipients(recipients); + Document doc = EnvelopeHelpers.createDocumentFromFile(documentFileName, documentName, "3"); + envelopeDefinition.setDocuments(Collections.singletonList(doc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EnvelopeCustomFieldValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeCustomFieldValuesService.java new file mode 100644 index 00000000..0e7a02bb --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeCustomFieldValuesService.java @@ -0,0 +1,15 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.CustomFieldsEnvelope; + +public final class EnvelopeCustomFieldValuesService { + public static CustomFieldsEnvelope envelopeCustomFieldValues( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { + return envelopesApi.listCustomFields(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EnvelopeDocsService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeDocsService.java new file mode 100644 index 00000000..1a6c9657 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeDocsService.java @@ -0,0 +1,16 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDocumentsResult; + +public final class EnvelopeDocsService { + public static EnvelopeDocumentsResult envelopeDocs( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { + // Step 1. List the envelope's documents + return envelopesApi.listDocuments(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EnvelopeGetDocService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeGetDocService.java new file mode 100644 index 00000000..2930912a --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeGetDocService.java @@ -0,0 +1,24 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import org.apache.commons.io.FilenameUtils; + +public final class EnvelopeGetDocService { + + public static byte[] envelopeGetDoc( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + String documentId + ) throws ApiException { + return envelopesApi.getDocument(accountId, envelopeId, documentId); + } + + public static String addExtension(String fileName, String extension) { + if (FilenameUtils.isExtension(fileName, extension)) { + return fileName; + } + return String.join(".", fileName, extension); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EnvelopeInfoService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeInfoService.java new file mode 100644 index 00000000..cd184bef --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeInfoService.java @@ -0,0 +1,15 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Envelope; + +public final class EnvelopeInfoService { + public static Envelope envelopeInfo( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { + return envelopesApi.getEnvelope(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/EnvelopeRecipientsService.java b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeRecipientsService.java new file mode 100644 index 00000000..1d0e3139 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/EnvelopeRecipientsService.java @@ -0,0 +1,15 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Recipients; + +public final class EnvelopeRecipientsService { + public static Recipients envelopeRecipients( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { + return envelopesApi.listRecipients(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/GetTabValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/GetTabValuesService.java new file mode 100644 index 00000000..4a41e140 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/GetTabValuesService.java @@ -0,0 +1,15 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeFormData; + +public final class GetTabValuesService { + public static EnvelopeFormData getTabValues( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { + return envelopesApi.getFormData(accountId, envelopeId); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/IdvAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/IdvAuthenticationService.java new file mode 100644 index 00000000..7940752b --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/IdvAuthenticationService.java @@ -0,0 +1,102 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Base64; +import java.util.Collections; +import java.util.List; + +public final class IdvAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + + public static EnvelopeSummary idvAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static String retrieveWorkflowId(ApiClient apiClient, String accountId) throws ApiException { + // Step 3 start + AccountsApi workflowDetails = new AccountsApi(apiClient); + AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(accountId); + List identityVerification = workflowRes.getIdentityVerification(); + String workflowId = ""; + for (int i = 0; i < identityVerification.size(); i++) + { + if (identityVerification.get(i).getDefaultName().equals("DocuSign ID Verification")) + { + workflowId = identityVerification.get(i).getWorkflowId(); + } + } + return workflowId; + // Step 3 end + } + + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail, + String workflowId + ) { + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign"); + envelopeDefinition.setEmailBlurb("Sample text for email body"); + envelopeDefinition.setStatus("Sent"); + + + byte[] fileBytes = new byte[0]; + try { + fileBytes = EnvelopeHelpers.readFile(DOCUMENT_FILE_NAME); + } catch (IOException e) { + e.printStackTrace(); + } + Document doc1 = new Document(); + doc1.setDocumentBase64(Base64.getEncoder().encodeToString(fileBytes)); + doc1.setDocumentId("1"); + doc1.setFileExtension("pdf"); + doc1.setName("Lorem"); + + SignHere signHere1 = new SignHere(); + signHere1.setName("SignHereTab"); + signHere1.setXPosition("75"); + signHere1.setYPosition("572"); + signHere1.setTabLabel("SignHereTab"); + signHere1.setPageNumber("1"); + signHere1.setDocumentId("1"); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. + // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + signHere1.setRecipientId("1"); //represents your {RECIPIENT_ID} + + Tabs signer1Tabs = new Tabs(); + signer1Tabs.setSignHereTabs(Collections.singletonList(signHere1)); + RecipientIdentityVerification workflow = new RecipientIdentityVerification(); + workflow.setWorkflowId(workflowId); + + String status = "created"; + String deliveryMethod = "email"; + Signer signer1 = new Signer(); + signer1.setName(signerName); + signer1.setEmail(signerEmail); + signer1.setRoleName(""); + signer1.setNote(""); + signer1.setStatus(status); + signer1.setDeliveryMethod(deliveryMethod); + signer1.setRecipientId("1"); //represents your {RECIPIENT_ID} + signer1.setIdentityVerification(workflow); + signer1.setTabs(signer1Tabs); + + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer1)); + + envelopeDefinition.setRecipients(recipients); + envelopeDefinition.setDocuments(Collections.singletonList(doc1)); + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/KBAAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/KBAAuthenticationService.java new file mode 100644 index 00000000..370ce449 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/KBAAuthenticationService.java @@ -0,0 +1,72 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; + +public final class KBAAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary kbaAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static Signer setSignHereAndSignerForEnvelope( + String signerName, + String signerEmail) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + SignHere signHere = new SignHere(); + signHere.setName("SignHereTab"); + signHere.setXPosition("75"); + signHere.setYPosition("572"); + signHere.setTabLabel("SignHereTab"); + signHere.setPageNumber("1"); + signHere.setDocumentId(doc.getDocumentId()); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your own systems. + // This value is referenced in the Tabs element below to assign tabs on a per-recipient basis. + signHere.setRecipientId("1"); + + Signer signer = new Signer(); + signer.setName(signerName); + signer.setEmail(signerEmail); + signer.setRoutingOrder("1"); + signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); + signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); + signer.setRecipientId(signHere.getRecipientId()); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + + return signer; + } + + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail + ) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + Signer signer = setSignHereAndSignerForEnvelope(signerName, signerEmail); + signer.setIdCheckConfigurationName("ID Check"); + signer.setRequireIdLookup("true"); + + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please Sign"); + envelope.setEnvelopeIdStamping("true"); + envelope.setEmailBlurb("Sample text for email body"); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setDocuments(Collections.singletonList(doc)); + envelope.setRecipients(recipients); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/ListEnvelopesServices.java b/src/main/java/com/docusign/controller/eSignature/services/ListEnvelopesServices.java new file mode 100644 index 00000000..2178bd71 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/ListEnvelopesServices.java @@ -0,0 +1,20 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopesInformation; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +public final class ListEnvelopesServices { + private static final int FROM_DATE_OFFSET_DAYS = 30; + private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd"); + + public static EnvelopesInformation listEnvelopes(EnvelopesApi envelopesApi, String accountId) throws ApiException { + EnvelopesApi.ListStatusChangesOptions options = envelopesApi.new ListStatusChangesOptions(); + LocalDate date = LocalDate.now().minusDays(FROM_DATE_OFFSET_DAYS); + options.setFromDate(DATE_FORMATTER.format(date)); + return envelopesApi.listStatusChanges(accountId, options); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/PauseSignatureWorkflowService.java b/src/main/java/com/docusign/controller/eSignature/services/PauseSignatureWorkflowService.java new file mode 100644 index 00000000..69592214 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/PauseSignatureWorkflowService.java @@ -0,0 +1,83 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public final class PauseSignatureWorkflowService { + private static final String DOCUMENT_FILE_NAME = "Welcome.txt"; + private static final String DOCUMENT_ID = "1"; + private static final String DOCUMENT_NAME = "Welcome"; + + public static EnvelopeSummary pauseSignatureWorkflow( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope( + String signerName, + String signerEmail, + String signerName2, + String signerEmail2 + ) throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); + workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); + workflowStep.setItemId("2"); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); + + SignHere signHere1 = new SignHere(); + signHere1.setName("SignHereTabs"); + signHere1.setXPosition("200"); + signHere1.setYPosition("200"); + signHere1.setTabLabel("Sign Here"); + signHere1.setPageNumber("1"); + signHere1.setDocumentId(document.getDocumentId()); + + Signer signer1 = new Signer(); + signer1.setName(signerName); + signer1.setEmail(signerEmail); + signer1.setRoutingOrder("1"); + signer1.setRecipientId("1"); + signer1.setTabs(EnvelopeHelpers.createSignerTabs(signHere1)); + + SignHere signHere2 = new SignHere(); + signHere2.setName("SignHereTabs"); + signHere2.setXPosition("300"); + signHere2.setYPosition("200"); + signHere2.setTabLabel("Sign Here"); + signHere2.setPageNumber("1"); + signHere2.setDocumentId(document.getDocumentId()); + + Signer signer2 = new Signer(); + signer2.setName(signerName2); + signer2.setEmail(signerEmail2); + signer2.setRoutingOrder("2"); + signer2.setRecipientId("2"); + signer2.setTabs(EnvelopeHelpers.createSignerTabs(signHere2)); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer1, signer2)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("EnvelopeWorkflowTest"); + envelope.setDocuments(Collections.singletonList(document)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + envelope.setWorkflow(workflow); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java new file mode 100644 index 00000000..5934e43a --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionChangeSingleSettingService.java @@ -0,0 +1,63 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.DsModelUtils; +import com.docusign.core.model.AccountRoleSettingsPatch; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.AccountRoleSettings; +import com.docusign.esign.model.PermissionProfile; +import com.docusign.esign.model.PermissionProfileInformation; +import com.google.gson.Gson; + +import java.util.*; + +public final class PermissionChangeSingleSettingService { + public static PermissionProfile permissionChangeSingleSetting( + AccountsApi accountsApi, + String accountId, + String curProfileId + ) throws ApiException { + // Step 3. Construct your request body + PermissionProfileInformation permissionsInfo = accountsApi.listPermissions(accountId); + PermissionProfile profile = PermissionChangeSingleSettingService.findProfile( + permissionsInfo.getPermissionProfiles(), curProfileId) + .orElseThrow(NoSuchElementException::new); + + // Step 4. Call the eSignature REST API + AccountRoleSettings newSettings = Objects.requireNonNullElse(profile.getSettings(), + DsModelUtils.createDefaultRoleSettings()); + profile.setSettings(PermissionChangeSingleSettingService.changeRandomSettings(newSettings)); + return accountsApi.updatePermissionProfile(accountId, curProfileId, profile); + } + + public static Optional findProfile(List profiles, String profileId) { + return profiles.stream().filter(p -> p.getPermissionProfileId().equals(profileId)).findFirst(); + } + + // Changes random boolean properties; in a real application, changing properties + // will be read from the page or in a different way + private static AccountRoleSettings changeRandomSettings(AccountRoleSettings settings) { + Gson gson = new Gson(); + String signingUiVersion = "1"; + // Change this value back to: gson.fromJson(gson.toJson(settings), + // AccountRoleSettings.class); + // as soon as the signinguiversion is added back to the swagger spec. + // Also change the type back from AccountRoleSettingsPatch to AccountRoleSettings + AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); + newSettings.signingUiVersion(signingUiVersion); + Random random = new Random(System.currentTimeMillis()); + + return newSettings.canCreateWorkspaces(randomBool(random)).allowEnvelopeSending(randomBool(random)) + .allowSignerAttachments(randomBool(random)).allowESealRecipients(randomBool(random)) + .allowTaggingInSendAndCorrect(randomBool(random)).allowWetSigningOverride(randomBool(random)) + .enableApiRequestLogging(randomBool(random)).enableRecipientViewingNotifications(randomBool(random)) + .allowSupplementalDocuments(randomBool(random)).disableDocumentUpload(randomBool(random)); + } + + private static String randomBool(Random random) { + if (random.nextBoolean()) { + return DsModelUtils.TRUE; + } + return DsModelUtils.FALSE; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java new file mode 100644 index 00000000..904d7774 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionCreateService.java @@ -0,0 +1,31 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.DsModelUtils; +import com.docusign.core.model.AccountRoleSettingsPatch; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.AccountRoleSettings; +import com.docusign.esign.model.PermissionProfile; +import com.google.gson.Gson; + +public class PermissionCreateService { + public static PermissionProfile createNewProfile( + AccountsApi accountsApi, + String accountId, + String permissionProfileName + ) throws ApiException { + // Step 3. Construct your request body + // We're extending the AccountSettings class with AccountSettingsPatch to include the signingUIVersion which is missing in the swagger spec at this time. + Gson gson = new Gson(); + String signingUiVersion = "1"; + AccountRoleSettings settings = DsModelUtils.createDefaultRoleSettings(); + AccountRoleSettingsPatch newSettings = gson.fromJson(gson.toJson(settings), AccountRoleSettingsPatch.class); + newSettings.signingUiVersion(signingUiVersion); + PermissionProfile profile = new PermissionProfile() + .permissionProfileName(permissionProfileName) + .settings(newSettings); + + // Step 4. Call the eSignature REST API + return accountsApi.createPermissionProfile(accountId, profile); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/PermissionDeleteService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionDeleteService.java new file mode 100644 index 00000000..0436faaf --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionDeleteService.java @@ -0,0 +1,15 @@ +package com.docusign.controller.eSignature.services; + + +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiException; + +public final class PermissionDeleteService { + public static void permissionDelete( + AccountsApi accountsApi, + String accountId, + String curProfileId + ) throws ApiException { + accountsApi.deletePermissionProfile(accountId, curProfileId); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/PermissionSetUserGroupsService.java b/src/main/java/com/docusign/controller/eSignature/services/PermissionSetUserGroupsService.java new file mode 100644 index 00000000..1ab37589 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/PermissionSetUserGroupsService.java @@ -0,0 +1,28 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.esign.api.GroupsApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Group; +import com.docusign.esign.model.GroupInformation; + +import java.util.List; + +public final class PermissionSetUserGroupsService { + public static GroupInformation permissionSetUserGroups( + ApiClient apiClient, + String groupId, + String profileId, + String accountId + ) throws ApiException { + GroupsApi groupsApi = new GroupsApi(apiClient); + + // Step 3: Perform request + Group newGroup = new Group() + .groupId(groupId) + .permissionProfileId(profileId); + GroupInformation groupInformation = new GroupInformation() + .groups(List.of(newGroup)); + return groupsApi.updateGroups(accountId, groupInformation); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/PhoneAuthenticationService.java b/src/main/java/com/docusign/controller/eSignature/services/PhoneAuthenticationService.java new file mode 100644 index 00000000..04c5b0d4 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/PhoneAuthenticationService.java @@ -0,0 +1,81 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public final class PhoneAuthenticationService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem"; + + public static EnvelopeSummary phoneAuthentication( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + // Step 4.2 start + public static EnvelopeDefinition createEnvelope(String signerName, String signerEmail, String countryCode, + String phone, String workFlowId) throws IOException { + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "1"); + + SignHere signHere = new SignHere(); + signHere.setName("SignHereTab"); + signHere.setXPosition("200"); + signHere.setYPosition("160"); + signHere.setTabLabel("SignHereTab"); + signHere.setPageNumber("1"); + signHere.setDocumentId(doc.getDocumentId()); + // A 1- to 8-digit integer or 32-character GUID to match recipient IDs on your + // own systems. + // This value is referenced in the Tabs element below to assign tabs on a + // per-recipient basis. + signHere.setRecipientId("1"); + + RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber(); + phoneNumber.setCountryCode(countryCode); + phoneNumber.setNumber(phone); + + RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption(); + inputOption.setName("phone_number_list"); + inputOption.setValueType("PhoneNumberList"); + inputOption.setPhoneNumberList(Arrays.asList(phoneNumber)); + + RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification(); + + identityVerifcation.setWorkflowId(workFlowId); + identityVerifcation.setInputOptions(Arrays.asList(inputOption)); + + Signer signer = new Signer(); + signer.setName(signerName); + signer.setEmail(signerEmail); + signer.setRoutingOrder("1"); + signer.setStatus(EnvelopeHelpers.SIGNER_STATUS_CREATED); + signer.setDeliveryMethod(EnvelopeHelpers.DELIVERY_METHOD_EMAIL); + signer.setRecipientId(signHere.getRecipientId()); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + signer.setIdentityVerification(identityVerifcation); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(signer)); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please Sign"); + envelope.setDocuments(Arrays.asList(doc)); + envelope.setEnvelopeIdStamping("true"); + envelope.setEmailBlurb("Sample text for email body"); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + + return envelope; + } + // Step 4.2 end +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SMSDeliveryService.java b/src/main/java/com/docusign/controller/eSignature/services/SMSDeliveryService.java new file mode 100644 index 00000000..f123c53c --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/SMSDeliveryService.java @@ -0,0 +1,95 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public final class SMSDeliveryService { + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static EnvelopeSummary smsDelivery( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + // document 2 (docx) has tag /sn1/ + // document 3 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. After it is signed, + // a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope( + String countryCode, + String signersPhoneNumber, + String signerName, + String ccCountryCode, + String carbonCopyPhoneNumber, + String ccName, + String status) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. So the signHere2 tab will be used in + // both document 2 and 3 since they use the same anchor string for + // their "signer 1" tabs. + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // Create a signer recipient to sign the document, identified by name + // and phone number. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + + RecipientPhoneNumber phoneNumber = new RecipientPhoneNumber(); + phoneNumber.setCountryCode(countryCode); + phoneNumber.setNumber(signersPhoneNumber); + + Signer signer = new Signer(); + signer.setName(signerName); + signer.setPhoneNumber(phoneNumber); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + + // create a cc recipient to receive a copy of the documents, identified by name and phone number + RecipientPhoneNumber ccPhoneNumber = new RecipientPhoneNumber(); + ccPhoneNumber.setCountryCode(ccCountryCode); + ccPhoneNumber.setNumber(carbonCopyPhoneNumber); + + CarbonCopy cc = new CarbonCopy(); + cc.setName(ccName); + cc.setPhoneNumber(ccPhoneNumber); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + + // The order in the docs array determines the order in the envelope + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(status); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java b/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java new file mode 100644 index 00000000..f50c458d --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java @@ -0,0 +1,73 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.model.*; +import java.io.IOException; +import java.util.Arrays; + +public class ScheduledSendlingService { + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + // document 1 (PDF) has sign here anchor tag /sn1/ + // + // The envelope has one recipient. + // recipient 1 - signer + + // create the envelope definition + + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String resumeDate, + String status) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. + + // Step 2 start + + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + + // The order in the docs array determines the order in the envelope + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "1"))); + envelope.setRecipients(EnvelopeHelpers.createSingleRecipient(signer)); + + // Add the workflow to schedule the envelope with a delay + EnvelopeDelayRuleApiModel delayRule = new EnvelopeDelayRuleApiModel(); + + delayRule.setResumeDate(resumeDate+"T00:00:00Z"); + + ScheduledSendingApiModel scheduledSendingApiModel = new ScheduledSendingApiModel(); + scheduledSendingApiModel.setRules(Arrays.asList(delayRule)); + + Workflow workflow = new Workflow(); + workflow.setScheduledSending(scheduledSendingApiModel); + envelope.setWorkflow(workflow); + + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(status); + + return envelope; + + // Step 2 end + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java new file mode 100644 index 00000000..9c3da4d1 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java @@ -0,0 +1,198 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.controller.eSignature.examples.ExampleException; +import com.docusign.core.common.DocumentType; +import com.docusign.core.model.DoneExample; +import com.docusign.esign.model.CarbonCopy; +import com.docusign.esign.model.Signer; +import com.docusign.esign.model.Tabs; +import lombok.Value; +import org.json.JSONArray; +import org.json.JSONObject; +import org.springframework.http.HttpHeaders; +import org.springframework.util.StreamUtils; + +import javax.net.ssl.HttpsURLConnection; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.core.MediaType; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.List; + +public final class SendBinaryDocsService { + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + private static final String HYPHENS = "--"; + private static final String LINE_DELIMITER = "\r\n"; + private static final String BOUNDARY_DELIMITER = "multipartboundary_multipartboundary"; + + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + + public static String sendBinaryDocs( + WorkArguments args, + String signerName, + String signerEmail, + String ccName, + String ccEmail, + String basePath, + String accountId, + String accessToken + ) throws IOException { + // Step 1. Gather documents and their headers + List documents = List.of( + new DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, + EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)), + new DocumentInfo(DOCX_DOCUMENT_NAME, "2", DocumentType.DOCX, + EnvelopeHelpers.readFile(DOCX_DOCUMENT_FILE_NAME)), + new DocumentInfo(PDF_DOCUMENT_NAME, "3", DocumentType.PDF, + EnvelopeHelpers.readFile(PDF_DOCUMENT_FILE_NAME)) + ); + + // Step 2. Make the envelope JSON request body + JSONObject envelopeJSON = SendBinaryDocsService.makeEnvelopeJSON( + signerName, + signerEmail, + ccName, + ccEmail, + documents); + + // Step 3. Create the multipart body + URL uri = new URL(String.format("%s/v2.1/accounts/%s/envelopes", basePath, accountId)); + String contentType = String.join( + "", + MediaType.MULTIPART_FORM_DATA, + "; boundary=", BOUNDARY_DELIMITER); + HttpsURLConnection connection = (HttpsURLConnection) uri.openConnection(); + connection.setRequestMethod(HttpMethod.POST); + connection.setRequestProperty(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON); + connection.setRequestProperty(HttpHeaders.CONTENT_TYPE, contentType); + connection.setRequestProperty(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); + connection.setDoOutput(true); + + // See https://developers.docusign.com/esign-rest-api/guides/requests-and-responses + DataOutputStream buffer = new DataOutputStream(connection.getOutputStream()); + SendBinaryDocsService.writeBoundaryHeader(buffer, MediaType.APPLICATION_JSON, "form-data"); + buffer.writeBytes(envelopeJSON.toString(DoneExample.JSON_INDENT_FACTOR)); + + for (DocumentInfo docInfo : documents) { + String content = String.format("file; filename=\"%s\";documentid=%s", docInfo.getName(), docInfo.getId()); + buffer.writeBytes(LINE_DELIMITER); + SendBinaryDocsService.writeBoundaryHeader(buffer, docInfo.getDocType().getMime(), content); + buffer.write(docInfo.getData()); + } + + SendBinaryDocsService.writeClosingBoundary(buffer); + + int responseCode = connection.getResponseCode(); + if (responseCode < HttpURLConnection.HTTP_OK || responseCode >= HttpURLConnection.HTTP_MULT_CHOICE) { + String error = StreamUtils.copyToString(connection.getErrorStream(), StandardCharsets.UTF_8); + throw new ExampleException(error, null); + } + + return StreamUtils.copyToString(connection.getInputStream(), StandardCharsets.UTF_8); + } + + private static void writeBoundaryHeader( + DataOutputStream buffer, + String contentType, + String contentDisposition + ) throws IOException { + buffer.writeBytes(HYPHENS); + buffer.writeBytes(BOUNDARY_DELIMITER); + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_TYPE, contentType)); + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(String.join(": ", HttpHeaders.CONTENT_DISPOSITION, contentDisposition)); + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(LINE_DELIMITER); + } + + private static void writeClosingBoundary(DataOutputStream buffer) throws IOException { + buffer.writeBytes(LINE_DELIMITER); + buffer.writeBytes(HYPHENS); + buffer.writeBytes(BOUNDARY_DELIMITER); + buffer.writeBytes(HYPHENS); + buffer.writeBytes(LINE_DELIMITER); + buffer.flush(); + } + + // document 1 (html) has tag **signature_1** + // document 2 (docx) has tag /sn1/ + // document 3 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. + // After it is signed, a copy is sent to the cc person. + private static JSONObject makeEnvelopeJSON( + String signerName, + String signerEmail, + String ccName, + String ccEmail, + List documents + ) { + // The DocuSign platform searches throughout your envelope's documents for + // matching anchor strings. So the signHere2 tab will be used in both document + // 2 and 3 since they use the same anchor string for their "signer 1" tabs. + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // create a signer recipient to sign the document, identified by name and email + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(signerName); + signer.setName(signerEmail); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy(); + cc.setEmail(ccName); + cc.setName(ccEmail); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + + // The order in the documents array determines the order in the envelope + JSONArray jsonDocuments = new JSONArray(); + for (DocumentInfo docInfo : documents) { + JSONObject jsonDoc = new JSONObject(); + jsonDoc.put("name", docInfo.getName()); + jsonDoc.put("fileExtension", docInfo.getDocType().getDefaultFileExtention()); + jsonDoc.put("documentId", docInfo.getId()); + jsonDocuments.put(jsonDoc); + } + + // Create the envelope definition. Request that the envelope be sent by + // setting |status| to "sent". To request that the envelope be created + // as a draft, set to "created" + JSONObject envelopeJSON = new JSONObject(); + envelopeJSON.put("emailSubject", "Please sign this document set"); + envelopeJSON.put("documents", jsonDocuments); + envelopeJSON.put("recipients", new JSONObject(EnvelopeHelpers.createRecipients(signer, cc))); + envelopeJSON.put("status", EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeJSON; + } + @Value + public static class DocumentInfo { + String name; + String id; + DocumentType docType; + byte[] data; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SetTabValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/SetTabValuesService.java new file mode 100644 index 00000000..3e41d4f0 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/SetTabValuesService.java @@ -0,0 +1,170 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public final class SetTabValuesService { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_salary.docx"; + private static final String DOCUMENT_NAME = "Lorem Ipsum"; + private static final String SIGNER_CLIENT_ID = "1000"; + + public static ViewUrl createRecipientView( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + String dsReturnUrl, + String dsPingUrl + ) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + // The query parameter is included as an example of how + // to save/recover state information during the redirect to + // the DocuSign signing. It's usually better to use + // the session mechanism of your web framework. Query parameters + // can be changed/spoofed very easily. + String state = "?state=123"; + viewRequest.setReturnUrl(dsReturnUrl + state); + + return setEmailAndSignerNameForRecipientViewRequest( + viewRequest, + signerEmail, + signerName, + dsPingUrl); + } + + public static RecipientViewRequest setEmailAndSignerNameForRecipientViewRequest( + RecipientViewRequest viewRequest, + String signerEmail, + String signerName, + String dsPingUrl + ) { + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + String authenticationMethod = "none"; + viewRequest.setAuthenticationMethod(authenticationMethod); + + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(SIGNER_CLIENT_ID); + + // DocuSign recommends that you redirect to DocuSign for the + // Embedded signing . There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + String pingFrequency = "600"; + viewRequest.setPingFrequency(pingFrequency); // seconds + viewRequest.setPingUrl(dsPingUrl); + + return viewRequest; + } + + // Step 4. Construct your request body + public static EnvelopeDefinition makeEnvelope(String signerEmail, String signerName) throws IOException { + // Create a signer recipient to sign the document, identified by name and email + // We set the clientUserId to enable embedded signing for the recipient + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.clientUserId(SIGNER_CLIENT_ID); + signer.recipientId("1"); + + // Step 3. Create tabs and CustomFields + SignHere signHere = new SignHere(); + signHere.setAnchorString("/sn1"); + signHere.setAnchorUnits("pixels"); + signHere.setAnchorYOffset("10"); + signHere.setAnchorXOffset("20"); + + Text textLegal = new Text(); + textLegal.setAnchorString("/legal/"); + textLegal.setAnchorUnits("pixels"); + textLegal.setAnchorYOffset("-9"); + textLegal.setAnchorXOffset("5"); + textLegal.setFont("helvetica"); + textLegal.setFontSize("size11"); + textLegal.setBold("true"); + textLegal.setValue(signerName); + textLegal.setLocked("false"); + textLegal.setTabId("legal_name"); + textLegal.setTabLabel("Legal Name"); + + Text textFamiliar = new Text(); + textFamiliar.setAnchorString("/familar/"); + textFamiliar.setAnchorUnits("pixels"); + textFamiliar.setAnchorYOffset("-9"); + textFamiliar.setAnchorXOffset("5"); + textFamiliar.setFont("helvetica"); + textFamiliar.setFontSize("size11"); + textFamiliar.setBold("true"); + textFamiliar.setValue(signerName); + textFamiliar.setLocked("false"); + textFamiliar.setTabId("familiar_name"); + textFamiliar.setTabLabel("Familiar Name"); + + Integer salary = 123000; + + Text textSalary = new Text(); + textSalary.setAnchorString("/salary/"); + textSalary.setAnchorUnits("pixels"); + textSalary.setAnchorYOffset("-9"); + textSalary.setAnchorXOffset("5"); + textSalary.setFont("helvetica"); + textSalary.setFontSize("size11"); + textSalary.setBold("true"); + textSalary.setValue(String.format("$ %d", salary)); + textSalary.setLocked("true"); + textSalary.setTabId("salary"); + textSalary.setTabLabel("salary"); + + TextCustomField salaryCustomField = new TextCustomField(); + salaryCustomField.setName("salary"); + salaryCustomField.setRequired("false"); + salaryCustomField.setShow("true"); // Yes, included in the CoC + salaryCustomField.setValue(String.valueOf(salary)); + + CustomFields cf = new CustomFields(); + cf.setTextCustomFields(Collections.singletonList(salaryCustomField)); + + Tabs tabs = new Tabs(); + tabs.setSignHereTabs(Collections.singletonList(signHere)); + tabs.setTextTabs(Arrays.asList(textLegal, textFamiliar, textSalary)); + + signer.setTabs(tabs); + + // Add the recipient to the envelope object + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); + envelopeDefinition.setRecipients(recipients); + Document doc = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, "3"); + envelopeDefinition.setDocuments(Collections.singletonList(doc)); + envelopeDefinition.setCustomFields(cf); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SetTemplateTabValuesService.java b/src/main/java/com/docusign/controller/eSignature/services/SetTemplateTabValuesService.java new file mode 100644 index 00000000..3019776d --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/SetTemplateTabValuesService.java @@ -0,0 +1,158 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.util.Arrays; +import java.util.Collections; + +public final class SetTemplateTabValuesService { + public static ViewUrl setTemplateTabValues( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + String dsReturnUrl, + String clientUserId, + String dsPingUrl + ) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + // The query parameter is included as an example of how + // to save/recover state information during the redirect to + // the DocuSign signing. It's usually better to use + // the session mechanism of your web framework. Query parameters + // can be changed/spoofed very easily. + String state = "?state=123"; + viewRequest.setReturnUrl(dsReturnUrl + state); + + return SetTabValuesService.setEmailAndSignerNameForRecipientViewRequest( + viewRequest, + signerEmail, + signerName, + dsPingUrl); + } + + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String templateId, + String clientUserId + ){ + // Create a signer recipient to sign the document, identified by name and email + // We set the clientUserId to enable embedded signing for the recipient + + // Step 3. Create tabs and CustomFields + List list1 = new List(); + list1.setValue("green"); + list1.setDocumentId("1"); + list1.setPageNumber("1"); + list1.setTabLabel("list"); + + // Checkboxes + Checkbox ck1 = new Checkbox(); + ck1.setTabLabel("ckAuthorization"); + ck1.setSelected("true"); + + Checkbox ck2 = new Checkbox(); + ck2.setTabLabel("ckAgreement"); + ck2.setSelected("true"); + + Radio radio = new Radio(); + radio.setValue("white"); + radio.setSelected("true"); + + RadioGroup rg = new RadioGroup(); + rg.setGroupName("radio1"); + rg.setRadios(Collections.singletonList(radio)); + + + Text txt = new Text(); + txt.setTabLabel("text"); + txt.setValue("Jabberywocky!"); + + // We can also add a new tab (field) to the ones already in the template: + + Text txtExtra = new Text(); + txtExtra.setDocumentId("1"); + txtExtra.setPageNumber("1"); + txtExtra.setXPosition("280"); + txtExtra.setYPosition("172"); + txtExtra.setFont("helvetica"); + txtExtra.setFontSize("size14"); + txtExtra.setTabLabel("added text field"); + txtExtra.setHeight("23"); + txtExtra.setWidth("84"); + txtExtra.setRequired("false"); + txtExtra.setBold("true"); + txtExtra.setValue(signerName); + txtExtra.setLocked("false"); + txtExtra.setTabId("name"); + + + // Add the tabs model (including the SignHere tab) to the signer. + // The Tabs object wants arrays of the different field/tab types + // Tabs are set per recipient / signer + + Tabs tabs = new Tabs(); + + tabs.setTextTabs(Arrays.asList(txt, txtExtra)); + tabs.setRadioGroupTabs(Collections.singletonList(rg)); + tabs.setCheckboxTabs(Arrays.asList(ck1, ck2)); + tabs.setListTabs(Collections.singletonList(list1)); + + + // create a signer recipient to sign the document, identified by name and email + // We're setting the parameters via the object creation + TemplateRole signer = new TemplateRole(); + signer.setEmail(signerEmail); + signer.setName(signerName); + // Setting the client_user_id marks the signer as embedded + signer.setClientUserId(clientUserId); + signer.setRoleName("signer"); + signer.setTabs(tabs); + + TemplateRole cc = new TemplateRole(); + cc.setEmail(ccEmail); + cc.setName(ccName); + cc.setRoleName("cc"); + + // Create an envelope custom field to save our application"s + // Data about the envelope + TextCustomField customField = new TextCustomField(); + customField.setName("app metadata item"); + customField.setValue("1234567"); + customField.setRequired("false"); + customField.show("true"); //Yes, include in the CoC + + + CustomFields cf = new CustomFields(); + cf.setTextCustomFields(Collections.singletonList(customField)); + + + // Next, create the top level envelope definition and populate it. + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document from the Java SDK"); + // The Recipients object wants arrays for each recipient type + envelopeDefinition.setTemplateId(templateId); + envelopeDefinition.setTemplateRoles(Arrays.asList(signer, cc)); + envelopeDefinition.setCustomFields(cf); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java b/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java new file mode 100644 index 00000000..a844b140 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java @@ -0,0 +1,92 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.core.common.DocumentType; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; + +public final class SigningViaEmailService { + + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon.ftl"; + private static final String HTML_DOCUMENT_NAME = "Order acknowledgement"; + private static final String PDF_DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String PDF_DOCUMENT_NAME = "Lorem Ipsum"; + private static final String DOCX_DOCUMENT_FILE_NAME = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCX_DOCUMENT_NAME = "Battle Plan"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + public static EnvelopeSummary signingViaEmail( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + // document 1 (html) has tag **signature_1** + // document 2 (docx) has tag /sn1/ + // document 3 (pdf) has tag /sn1/ + // + // The envelope has two recipients. + // recipient 1 - signer + // recipient 2 - cc + // The envelope will be sent first to the signer. After it is signed, + // a copy is sent to the cc person. + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String ccEmail, + String ccName, + String status, + WorkArguments args + ) throws IOException { + // The DocuSign platform searches throughout your envelope's documents + // for matching anchor strings. So the signHere2 tab will be used in + // both document 2 and 3 since they use the same anchor string for + // their "signer 1" tabs. + Tabs signerTabs = EnvelopeHelpers.createSignerTabs( + EnvelopeHelpers.createSignHere("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X), + EnvelopeHelpers.createSignHere("/sn1/", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X)); + + // Create a signer recipient to sign the document, identified by name + // and email. We're setting the parameters via the object creation. + // RoutingOrder (lower means earlier) determines the order of deliveries + // to the recipients. Parallel routing order is supported by using the + // same integer as the order for two or more recipients. + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.setRecipientId("1"); + signer.setRoutingOrder("1"); + signer.setTabs(signerTabs); + + // create a cc recipient to receive a copy of the documents, identified by name and email + CarbonCopy cc = new CarbonCopy(); + cc.setEmail(ccEmail); + cc.setName(ccName); + cc.setRecipientId("2"); + cc.setRoutingOrder("2"); + + // The order in the docs array determines the order in the envelope + byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Please sign this document set"); + envelope.setDocuments(Arrays.asList( + EnvelopeHelpers.createDocument(htmlDocument, HTML_DOCUMENT_NAME, + DocumentType.HTML.getDefaultFileExtention(), "1"), + EnvelopeHelpers.createDocumentFromFile(DOCX_DOCUMENT_FILE_NAME, DOCX_DOCUMENT_NAME, "2"), + EnvelopeHelpers.createDocumentFromFile(PDF_DOCUMENT_FILE_NAME, PDF_DOCUMENT_NAME, "3"))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelope.setStatus(status); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/UnpauseSignatureWorkflowService.java b/src/main/java/com/docusign/controller/eSignature/services/UnpauseSignatureWorkflowService.java new file mode 100644 index 00000000..189ffabb --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/UnpauseSignatureWorkflowService.java @@ -0,0 +1,34 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.Envelope; +import com.docusign.esign.model.EnvelopeUpdateSummary; +import com.docusign.esign.model.Workflow; + +public class UnpauseSignatureWorkflowService { + public static EnvelopeUpdateSummary unpauseSignatureWorkflow( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId + ) throws ApiException { + // Step 3: Construct your envelope JSON body + Workflow workflow = new Workflow(); + workflow.setWorkflowStatus(EnvelopeHelpers.WORKFLOW_STATUS_IN_PROGRESS); + + Envelope envelope = new Envelope(); + envelope.setWorkflow(workflow); + + EnvelopesApi.UpdateOptions updateOptions = envelopesApi.new UpdateOptions(); + updateOptions.setResendEnvelope("true"); + + // Step 4: Call the eSignature REST API + return envelopesApi.update( + accountId, + envelopeId, + envelope, + updateOptions + ); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/UseConditionalRecipientsService.java b/src/main/java/com/docusign/controller/eSignature/services/UseConditionalRecipientsService.java new file mode 100644 index 00000000..31d37c41 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/UseConditionalRecipientsService.java @@ -0,0 +1,217 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class UseConditionalRecipientsService { + private static final String DOCUMENT_FILE_NAME = "Welcome1.txt"; + private static final String DOCUMENT_ID = "1"; + private static final String DOCUMENT_NAME = "Welcome"; + + public static EnvelopeSummary useConditionalRecipients( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition createEnvelope( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail, + String signerName, + String signerEmail + ) throws IOException { + Document document = EnvelopeHelpers.createDocumentFromFile(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ID); + + WorkflowStep workflowStep = new WorkflowStep(); + workflowStep.setAction(EnvelopeHelpers.WORKFLOW_STEP_ACTION_PAUSE); + workflowStep.setTriggerOnItem(EnvelopeHelpers.WORKFLOW_TRIGGER_ROUTING_ORDER); + workflowStep.setItemId("2"); + workflowStep.setStatus("pending"); + workflowStep.setRecipientRouting(createRecipientRouting( + signerNotCheckedName, + signerNotCheckedEmail, + signerCheckedName, + signerCheckedEmail + )); + + Workflow workflow = new Workflow(); + workflow.setWorkflowSteps(Collections.singletonList(workflowStep)); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList( + createApprovalSigner(document.getDocumentId()), + createPurchaserSigner(signerName, signerEmail, document.getDocumentId()) + )); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("ApproveIfChecked"); + envelope.setDocuments(Collections.singletonList(document)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + envelope.setRecipients(recipients); + envelope.setWorkflow(workflow); + + return envelope; + } + + private static Signer createPurchaserSigner( + String signerName, + String signerEmail, + String documentId + ) { + SignHere signHere = new SignHere(); + signHere.setName("SignHereTabs"); + signHere.setXPosition("200"); + signHere.setYPosition("200"); + signHere.setTabLabel("PurchaserSignature"); + signHere.setPageNumber("1"); + signHere.setDocumentId(documentId); + + Checkbox checkbox = new Checkbox(); + checkbox.setName("ClickToApprove"); + checkbox.setSelected("false"); + checkbox.setXPosition("50"); + checkbox.setYPosition("50"); + checkbox.setTabLabel("ApproveWhenChecked"); + checkbox.setPageNumber("1"); + checkbox.setDocumentId(documentId); + + Tabs tabs = EnvelopeHelpers.createSignerTabs(signHere); + tabs.setCheckboxTabs(Collections.singletonList(checkbox)); + + Signer signer = new Signer(); + signer.setName(signerName); + signer.setEmail(signerEmail); + signer.setRoutingOrder("1"); + signer.setRecipientId("1"); + signer.setRoleName("Purchaser"); + signer.setTabs(tabs); + + return signer; + } + + private static Signer createApprovalSigner(String documentId) { + SignHere signHere = new SignHere(); + signHere.setName("SignHere"); + signHere.setRecipientId("2"); + signHere.setXPosition("200"); + signHere.setYPosition("300"); + signHere.setTabLabel("ApproverSignature"); + signHere.setPageNumber("1"); + signHere.setDocumentId(documentId); + + Signer signer = new Signer(); + signer.setName("Approver"); + signer.setEmail("placeholder@example.com"); + signer.setRoutingOrder("2"); + signer.setRecipientId("2"); + signer.setRoleName("Approver"); + signer.setTabs(EnvelopeHelpers.createSignerTabs(signHere)); + return signer; + } + + private static List createConditionalRecipientRuleConditions() { + + ConditionalRecipientRuleFilter filter1 = new ConditionalRecipientRuleFilter(); + filter1.setRecipientId("1"); + filter1.setScope("tabs"); + filter1.setTabId("ApprovalTab"); + filter1.setOperator("equals"); + filter1.setValue("false"); + filter1.setTabType("checkbox"); + filter1.setTabLabel("ApproveWhenChecked"); + + ConditionalRecipientRuleFilter filter2 = new ConditionalRecipientRuleFilter(); + filter2.setRecipientId("1"); + filter2.setScope("tabs"); + filter2.setTabId("ApprovalTab"); + filter2.setOperator("equals"); + filter2.setValue("true"); + filter2.setTabType("checkbox"); + filter2.setTabLabel("ApproveWhenChecked"); + + ConditionalRecipientRuleCondition condition1 = new ConditionalRecipientRuleCondition(); + condition1.setRecipientLabel("signer2a"); + condition1.setOrder("1"); + condition1.setFilters(Collections.singletonList(filter1)); + + ConditionalRecipientRuleCondition condition2 = new ConditionalRecipientRuleCondition(); + condition2.setRecipientLabel("signer2b"); + condition2.setOrder("2"); + condition2.setFilters(Collections.singletonList(filter2)); + return Arrays.asList(condition1, condition2); + } + + private static RecipientGroup createRecipientGroup( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail + ) { + RecipientOption recipientOption1 = new RecipientOption(); + recipientOption1.setRecipientLabel("signer2a"); + recipientOption1.setName(signerNotCheckedName); + recipientOption1.setRoleName("Signer when not checked"); + recipientOption1.setEmail(signerNotCheckedEmail); + + RecipientOption recipientOption2 = new RecipientOption(); + recipientOption2.setRecipientLabel("signer2b"); + recipientOption2.setName(signerCheckedName); + recipientOption2.setRoleName("Signer when checked"); + recipientOption2.setEmail(signerCheckedEmail); + + RecipientGroup recipientGroup = new RecipientGroup(); + recipientGroup.setGroupName("Approver"); + recipientGroup.setGroupMessage("Members of this group approve a workflow"); + recipientGroup.setRecipients(Arrays.asList(recipientOption1, recipientOption2)); + return recipientGroup; + } + + private static ConditionalRecipientRule createConditionalRecipientRule( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail + ) { + ConditionalRecipientRule conditionalRecipientRule = new ConditionalRecipientRule(); + conditionalRecipientRule.setRecipientId("2"); + conditionalRecipientRule.setOrder("0"); + conditionalRecipientRule.setRecipientGroup(createRecipientGroup( + signerNotCheckedName, + signerNotCheckedEmail, + signerCheckedName, + signerCheckedEmail + )); + conditionalRecipientRule.setConditions(createConditionalRecipientRuleConditions()); + return conditionalRecipientRule; + } + + private static RecipientRouting createRecipientRouting( + String signerNotCheckedName, + String signerNotCheckedEmail, + String signerCheckedName, + String signerCheckedEmail + ) { + RecipientRules recipientRules = new RecipientRules(); + recipientRules.setConditionalRecipients(Collections.singletonList(createConditionalRecipientRule( + signerNotCheckedName, + signerNotCheckedEmail, + signerCheckedName, + signerCheckedEmail + ))); + + RecipientRouting recipientRouting = new RecipientRouting(); + recipientRouting.setRules(recipientRules); + return recipientRouting; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/UseTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/UseTemplateService.java new file mode 100644 index 00000000..d88e78a2 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/UseTemplateService.java @@ -0,0 +1,45 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.TemplateRole; + +import java.util.Arrays; + +public final class UseTemplateService { + public static EnvelopeSummary createEnvelopeTemplate( + EnvelopesApi envelopesApi, + String accountId, + EnvelopeDefinition envelope + ) throws ApiException { + return envelopesApi.createEnvelope(accountId, envelope); + } + + public static EnvelopeDefinition makeEnvelope( + String signerName, + String signerEmail, + String ccEmail, + String ccName, + String templateId + ) { + TemplateRole signer = new TemplateRole(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + + TemplateRole cc = new TemplateRole(); + cc.setEmail(ccEmail); + cc.setName(ccName); + cc.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setTemplateId(templateId); + envelope.setTemplateRoles(Arrays.asList(signer, cc)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelope; + } +} diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 12b35ab4..03873f7e 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -5,11 +5,8 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.monitor.api.DataSetApi; -import com.docusign.monitor.api.DataSetApi.GetStreamOptions; -import com.docusign.monitor.model.CursoredResult; +import com.docusign.controller.monitor.services.GetMonitoringDataService; import org.json.JSONArray; -import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -17,7 +14,6 @@ import javax.servlet.http.HttpServletResponse; - /** * Get monitoring data
* This example demonstrates how to get monitoring data from the Monitor API. @@ -45,58 +41,17 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse accessToken = ensureUsageOfJWTToken(accessToken, this.session); // step 1 end - JSONArray result = getMonitoringData(accessToken); + JSONArray monitoringData = GetMonitoringDataService.getMonitoringData(createDataSetApi(accessToken, this.session)); // Cleaning the data from wrong symbols - String resultCleaned = result.toString().replaceAll("'", ""); + String monitoringDataCleaned = monitoringData.toString().replaceAll("'", ""); // Process results DoneExample.createDefault(title) .withMessage("Results from DataSet:getStream method:") - .withJsonObject(resultCleaned) + .withJsonObject(monitoringDataCleaned) .addToModel(model); return DONE_EXAMPLE_PAGE; } - - protected JSONArray getMonitoringData(String accessToken) throws Exception { - // Declare variables - boolean complete = false; - String cursorValue = ""; -// Integer limit = 1; // Amount of records you want to read in one request - JSONArray result = new JSONArray(); - - DataSetApi datasetApi = this.createDataSetApi(accessToken, this.session); - GetStreamOptions options = datasetApi.new GetStreamOptions(); -// options.setLimit(limit); - - // First call the endpoint with no cursor to get the first records. - // After each call, save the cursor and use it to make the next - // call from the point where the previous one left off when iterating through - // the monitoring records - do - { - if(!cursorValue.isEmpty()) - options.setCursor(cursorValue); - - CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); - - String endCursor = cursoredResult.getEndCursor(); - - // If the endCursor from the response is the same as the one that you already have, - // it means that you have reached the end of the records - if (endCursor.equals(cursorValue)) - { - complete = true; - } - else - { - cursorValue = endCursor; - result.put(new JSONObject(cursoredResult)); - } - } - while (!complete); - - return result; - } } diff --git a/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java new file mode 100644 index 00000000..a5a29530 --- /dev/null +++ b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java @@ -0,0 +1,46 @@ +package com.docusign.controller.monitor.services; + +import com.docusign.monitor.api.DataSetApi; +import com.docusign.monitor.model.CursoredResult; +import org.json.JSONArray; +import org.json.JSONObject; + +public final class GetMonitoringDataService { + public static JSONArray getMonitoringData(DataSetApi datasetApi) throws Exception { + // Declare variables + boolean complete = false; + String cursorValue = ""; + JSONArray monitoringData = new JSONArray(); + + DataSetApi.GetStreamOptions options = datasetApi.new GetStreamOptions(); + + // First call the endpoint with no cursor to get the first records. + // After each call, save the cursor and use it to make the next + // call from the point where the previous one left off when iterating through + // the monitoring records + do + { + if(!cursorValue.isEmpty()) + options.setCursor(cursorValue); + + CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); + + String endCursor = cursoredResult.getEndCursor(); + + // If the endCursor from the response is the same as the one that you already have, + // it means that you have reached the end of the records + if (endCursor.equals(cursorValue)) + { + complete = true; + } + else + { + cursorValue = endCursor; + monitoringData.put(new JSONObject(cursoredResult)); + } + } + while (!complete); + + return monitoringData; + } +} diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index c9e6515f..74c8b4d1 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -88,7 +88,10 @@ protected static OfficesApi createOfficesApiClient(String basePath, String userA * @param userAccessToken user's access token * @return an instance of the {@link ExternalFormFillSessionsApi} */ - protected static ExternalFormFillSessionsApi createExternalFormFillSessionsApiClient(String basePath, String userAccessToken) { + protected static ExternalFormFillSessionsApi createExternalFormFillSessionsApiClient( + String basePath, + String userAccessToken) + { ApiClient apiClient = createApiClient(basePath, userAccessToken); return new ExternalFormFillSessionsApi(apiClient); } @@ -128,58 +131,4 @@ protected static FormGroupsApi createFormGroupsApi(String basePath, String userA ApiClient apiClient = createApiClient(basePath, userAccessToken); return new FormGroupsApi(apiClient); } - - protected static RoleSummary getAdminRole(String basePath, String userAccessToken, String accountId) throws ApiException { - RoleSummaryList roleSummaryList = createRolesApiClient(basePath, userAccessToken).getRoles(accountId); - return roleSummaryList.getRoles() - .stream() - .filter(RoleSummary::isIsDefaultForAdmin) - .findFirst() - .get(); - } - - protected static List getFormSummaryList(String basePath, String userAccessToken, String accountId) throws ApiException { - FormLibrariesApi formLibrariesApi = createFormLibrariesApi(basePath, userAccessToken); - FormLibrarySummaryList formLibrarySummaryList = formLibrariesApi.getFormLibraries(accountId); - - List forms = new ArrayList<>(); - - for (FormLibrarySummary formLibrarySummary : formLibrarySummaryList.getFormsLibrarySummaries()) { - FormSummaryList formSummaryList = formLibrariesApi.getFormLibraryForms(accountId, formLibrarySummary.getFormsLibraryId()); - forms.addAll(formSummaryList.getForms()); - } - return forms; - } - - protected List getDocumentsByRoomsId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { - RoomsApi roomsApiClient = createRoomsApiClient(basePath, accessToken); - - return roomsApiClient.getDocuments(accountId, roomId.getRoomId()).getDocuments(); - } - - protected RoomSummaryList getRoomSummaryList(String basePath, String accessToken, String accountId) throws ApiException { - RoomsApi roomsApi = createRoomsApiClient(basePath, accessToken); - - return roomsApi.getRooms(accountId); - } - - protected List getRoomSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { - RoomSummaryList summaryList = getRoomSummaryList(basePath, accessToken, accountId); - return summaryList.getRooms().stream() - .filter(var -> var.getRoomId().equals(roomId.getRoomId())) - .collect(Collectors.toList()); - } - - protected List getAvailableFormSummariesByRoomId(String basePath, String accessToken, String accountId, WorkArguments roomId) throws ApiException { - List formsByRoomsId = getDocumentsByRoomsId(basePath, accessToken, accountId, roomId); - List formSummaries = getFormSummaryList(basePath, accessToken, accountId); - - List formListByRoomId = formsByRoomsId.stream() - .map(var -> var.getName().replaceAll("\\.pdf", "")) - .collect(Collectors.toList()); - - return formSummaries.stream() - .filter(form -> !formListByRoomId.contains(form.getName())) - .collect(Collectors.toList()); - } } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index c12e8426..1bb05e9d 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -5,11 +5,12 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.OfficesApi; -import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; -import com.docusign.rooms.model.*; +import com.docusign.rooms.model.RoleSummary; +import com.docusign.rooms.model.Room; +import com.docusign.controller.rooms.services.CreateRoomService; +import com.docusign.controller.rooms.services.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -28,7 +29,6 @@ public class R001ControllerCreateRoom extends AbstractRoomsController { private final Session session; private final User user; - @Autowired public R001ControllerCreateRoom(DSConfiguration config, Session session, User user) { super(config, "r001", "Create a room"); @@ -40,17 +40,18 @@ public R001ControllerCreateRoom(DSConfiguration config, Session session, User us // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - RoleSummary adminRole = getAdminRole(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + RoleSummary adminRole = GetAdminRolesService.getAdminRole( + createRolesApiClient(this.session.getBasePath(), this.user.getAccessToken()), + this.session.getAccountId()); // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3: Construct the request body for your room - RoomForCreate roomForCreate = this.createRoom(adminRole.getRoleId(), args.getRoomName()); - String accountId = this.session.getAccountId(); - - // Step 4: Call the v2 Rooms API - Room createdRoom = roomsApi.createRoom(accountId, roomForCreate); + // Step 3: Call the v2 Rooms API + Room createdRoom = CreateRoomService.createRoomFromModel( + roomsApi, + this.session.getAccountId(), + CreateRoomService.createRoomModel(adminRole.getRoleId(), args.getRoomName())); DoneExample.createDefault(this.title) .withJsonObject(createdRoom) @@ -58,22 +59,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private RoomForCreate createRoom(Integer roleId, String roomName) { - return new RoomForCreate() - .name(roomName) - .roleId(roleId) - .transactionSideId("listbuy") - .fieldData( - new FieldDataForCreate() - .putDataItem("address1", "123 EZ Street") - .putDataItem("address2", "unit 10") - .putDataItem("city", "Galaxian") - .putDataItem("state", "US-HI") - .putDataItem("postalCode", "11112") - .putDataItem("companyRoomStatus", "5") - .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") - ); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 62fb83ff..2d5931cd 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -5,12 +5,14 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.OfficesApi; -import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.api.RoomTemplatesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; -import com.docusign.rooms.model.*; +import com.docusign.rooms.model.RoleSummary; +import com.docusign.rooms.model.Room; +import com.docusign.rooms.model.RoomTemplatesSummaryList; +import com.docusign.controller.rooms.services.CreateRoomWithTemplateService; +import com.docusign.controller.rooms.services.GetAdminRolesService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -27,12 +29,9 @@ public class R002ControllerCreateRoomWithTemplate extends AbstractRoomsController { private static final String MODEL_TEMPLATES_LIST = "templateList"; - - private final Session session; private final User user; - @Autowired public R002ControllerCreateRoomWithTemplate(DSConfiguration config, Session session, User user) { super(config, "r002", "Create a room with template"); @@ -46,7 +45,9 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception super.onInitModel(args, model); // Step 3: Retrieve a Rooms Template ID - RoomTemplatesApi templatesApi = createRoomTemplatesApiClient(this.session.getBasePath(), this.user.getAccessToken()); + RoomTemplatesApi templatesApi = createRoomTemplatesApiClient( + this.session.getBasePath(), + this.user.getAccessToken()); RoomTemplatesSummaryList templatesSummaryList = templatesApi.getRoomTemplates(this.session.getAccountId()); model.addAttribute(MODEL_TEMPLATES_LIST, templatesSummaryList.getRoomTemplates()); @@ -55,17 +56,21 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - RoleSummary adminRole = getAdminRole(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + RoleSummary adminRole = GetAdminRolesService.getAdminRole( + createRolesApiClient(this.session.getBasePath(), this.user.getAccessToken()), + this.session.getAccountId()); // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 4: Construct the request body for your room - RoomForCreate roomForCreate = this.createRoom(adminRole.getRoleId(), args.getRoomName(), args.getRoomTemplateId()); - - // Step 5: Call the v2 Rooms API - Room createdRoom = roomsApi.createRoom(this.session.getAccountId(), roomForCreate); - + // Step 4: Call the v2 Rooms API + Room createdRoom = CreateRoomWithTemplateService.createRoomFromModel( + roomsApi, + this.session.getAccountId(), + CreateRoomWithTemplateService.createRoom( + adminRole.getRoleId(), + args.getRoomName(), + args.getRoomTemplateId())); DoneExample.createDefault(this.title) .withJsonObject(createdRoom) @@ -73,22 +78,5 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); return DONE_EXAMPLE_PAGE; } - - private RoomForCreate createRoom(Integer roleId, String roomName, Integer templateId) { - return new RoomForCreate() - .name(roomName) - .roleId(roleId) - .templateId(templateId) - .fieldData( - new FieldDataForCreate() - .putDataItem("address1", "123 EZ Street") - .putDataItem("address2", "unit 10") - .putDataItem("city", "Galaxian") - .putDataItem("state", "US-HI") - .putDataItem("postalCode", "11112") - .putDataItem("companyRoomStatus", "5") - .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") - ); - } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index e194b4f7..30e35f7f 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -5,12 +5,11 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.RolesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FieldData; -import com.docusign.rooms.model.RoleSummaryList; import com.docusign.rooms.model.RoomSummaryList; +import com.docusign.controller.rooms.services.ExportingDataFromRoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -28,11 +27,9 @@ public class R003ControllerExportingDataFromRoom extends AbstractRoomsController { private static final String MODEL_ROOM_LIST = "roomList"; - private final Session session; private final User user; - @Autowired public R003ControllerExportingDataFromRoom(DSConfiguration config, Session session, User user) { super(config, "r003", "Exporting data from a room"); @@ -57,8 +54,10 @@ protected Object doWork(WorkArguments args, ModelMap model, RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 3: Call the v2 Rooms API - FieldData fieldData = roomsApi.getRoomFieldData(this.session.getAccountId(), args.getRoomId()); - + FieldData fieldData = ExportingDataFromRoomService.exportDataFromRoom( + roomsApi, + this.session.getAccountId(), + args.getRoomId()); DoneExample.createDefault(this.title) .withJsonObject(fieldData) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 32dd30fe..61e24951 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -5,11 +5,13 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.FormDetailsApi; -import com.docusign.rooms.api.FormLibrariesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; -import com.docusign.rooms.model.*; +import com.docusign.rooms.model.FormSummary; +import com.docusign.rooms.model.RoomDocument; +import com.docusign.rooms.model.RoomSummaryList; +import com.docusign.controller.rooms.services.AddingFormsToRoomService; +import com.docusign.controller.rooms.services.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -29,11 +31,9 @@ public class R004ControllerAddingFormsToRoom extends AbstractRoomsController { private static final String MODEL_FORM_LIST = "formList"; private static final String MODEL_ROOM_LIST = "roomList"; - private final Session session; private final User user; - @Autowired public R004ControllerAddingFormsToRoom(DSConfiguration config, Session session, User user) { super(config, "r004", "Adding forms to a room"); @@ -48,11 +48,12 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3. Obtain the desired form ID RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); - List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + List forms = GetFormSummaryListService.getFormSummaryList( + createFormLibrariesApi(session.getBasePath(), this.user.getAccessToken()), + this.session.getAccountId()); model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); model.addAttribute(MODEL_FORM_LIST, forms); - } @Override @@ -63,8 +64,11 @@ protected Object doWork(WorkArguments args, ModelMap model, RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); // Step 4. Call the v2 Rooms API - FormForAdd formForAdd = new FormForAdd().formId(args.getFormId()); - RoomDocument roomDocument = roomsApi.addFormToRoom(this.session.getAccountId(), args.getRoomId(), formForAdd); + RoomDocument roomDocument = AddingFormsToRoomService.addFormsToRoom( + roomsApi, + this.session.getAccountId(), + args.getFormId(), + args.getRoomId()); DoneExample.createDefault(this.title) .withJsonObject(roomDocument) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index 7a5b57fd..f81031ac 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -5,11 +5,10 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.rooms.api.RoomTemplatesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.RoomSummaryList; -import com.docusign.rooms.model.RoomTemplatesSummaryList; +import com.docusign.controller.rooms.services.GetRoomsWithFiltersService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -30,15 +29,12 @@ public class R005ControllerGetRoomsWithFilters extends AbstractRoomsController { private static final String MODEL_START_DATE = "startDate"; private static final String MODEL_END_DATE = "endDate"; - private static final int FROM_DATE_OFFSET_DAYS = 10; private static final int FROM_DATE_FORWARD_DAYS = 1; private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); - private final Session session; private final User user; - @Autowired public R005ControllerGetRoomsWithFilters(DSConfiguration config, Session session, User user) { super(config, "r005", "Get Rooms with filters"); @@ -65,13 +61,12 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); - // Step 3. Prepare your request parameters - RoomsApi.GetRoomsOptions options = roomsApi.new GetRoomsOptions(); - options.setFieldDataChangedStartDate(args.getStartDate()); - options.setFieldDataChangedEndDate(args.getEndDate()); - // Step 4. Call the v2 Rooms API - RoomSummaryList rooms = roomsApi.getRooms(this.session.getAccountId(), options); + RoomSummaryList rooms = GetRoomsWithFiltersService.getRoomsWithFilters( + roomsApi, + this.session.getAccountId(), + args.getStartDate(), + args.getEndDate()); DoneExample.createDefault(this.title) .withJsonObject(rooms) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index 27168d1b..a6d111b2 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -6,13 +6,13 @@ import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.rooms.api.ExternalFormFillSessionsApi; -import com.docusign.rooms.api.FormLibrariesApi; import com.docusign.rooms.api.RoomsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.ExternalFormFillSession; -import com.docusign.rooms.model.ExternalFormFillSessionForCreate; import com.docusign.rooms.model.FormSummary; import com.docusign.rooms.model.RoomSummaryList; +import com.docusign.controller.rooms.services.CreateExternalFormFillSessionService; +import com.docusign.controller.rooms.services.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -22,7 +22,6 @@ import java.io.IOException; import java.util.List; - /** * Creating an external form fill session. */ @@ -49,11 +48,12 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception RoomsApi roomsApi = createRoomsApiClient(this.session.getBasePath(), this.user.getAccessToken()); RoomSummaryList roomSummaryList = roomsApi.getRooms(this.session.getAccountId()); - List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + List forms = GetFormSummaryListService.getFormSummaryList( + createFormLibrariesApi(session.getBasePath(), this.user.getAccessToken()), + this.session.getAccountId()); model.addAttribute(MODEL_ROOM_LIST, roomSummaryList.getRooms()); model.addAttribute(MODEL_FORM_LIST, forms); - } @Override @@ -65,16 +65,14 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.getBasePath(), this.user.getAccessToken() ); - // Step 3. Construct your request body - ExternalFormFillSessionForCreate externalFormFillSessionForCreate = new ExternalFormFillSessionForCreate() - .formId(args.getFormId().toString()) - .roomId(args.getRoomId()); - - // Step 4. Call the v2 Rooms API - ExternalFormFillSession externalFormFillSession = externalFormFillSessionsApi.createExternalFormFillSession( - this.session.getAccountId(), externalFormFillSessionForCreate - ); - + // Step 3. Call the v2 Rooms API + ExternalFormFillSession externalFormFillSession = CreateExternalFormFillSessionService + .createExternalFormFillSession( + externalFormFillSessionsApi, + this.session.getAccountId(), + args.getFormId().toString(), + args.getRoomId() + ); DoneExample.createDefault(this.title) .withJsonObject(externalFormFillSession) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 76f4e27e..41ac71b0 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -8,7 +8,7 @@ import com.docusign.rooms.api.FormGroupsApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.FormGroup; -import com.docusign.rooms.model.FormGroupForCreate; +import com.docusign.controller.rooms.services.CreateFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -43,14 +43,10 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.getBasePath(), this.user.getAccessToken() ); - // Step 3 Start - FormGroupForCreate formGroupForCreate = new FormGroupForCreate() - .name(args.getFormGroupName()); - // Step 3 End - - // Step 4 Start - FormGroup formGroup = formGroupsApi.createFormGroup(this.session.getAccountId(), formGroupForCreate); - // Step 4 End + FormGroup formGroup = CreateFormGroupService.createFormGroup( + formGroupsApi, + this.session.getAccountId(), + args.getFormGroupName()); DoneExample.createDefault(this.title) .withJsonObject(formGroup) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index 03c82db4..0b9651d6 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -9,6 +9,7 @@ import com.docusign.rooms.api.OfficesApi; import com.docusign.rooms.client.ApiException; import com.docusign.rooms.model.*; +import com.docusign.controller.rooms.services.GrantOfficeAccessToFormGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -27,10 +28,8 @@ public class R008ControllerGrantOfficeAccessToFormGroup extends AbstractRoomsCon private static final String MODEL_OFFICE_LIST = "officeList"; private static final String MODEL_FORM_GROUP_LIST = "formGroupList"; private static final String OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP_ERROR_MESSAGE = "OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP"; - private final Session session; private final User user; - private FormGroupsApi formGroupsApi; @Autowired @@ -68,9 +67,13 @@ protected Object doWork(WorkArguments args, ModelMap model, try { // Step 5 Start - this.formGroupsApi.grantOfficeAccessToFormGroup(this.session.getAccountId(), args.getFormGroupId(), args.getOfficeId()); + GrantOfficeAccessToFormGroupService.grantOfficeAccessToFormGroup( + this.formGroupsApi, + this.session.getAccountId(), + args.getFormGroupId(), + args.getOfficeId()); // Step 5 End - + DoneExample.createDefault(this.title) .withMessage("Office has been granted access to a form group!") .addToModel(model); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 82cccaeb..8272d769 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -10,6 +10,8 @@ import com.docusign.rooms.model.FormGroupFormToAssign; import com.docusign.rooms.model.FormGroupSummaryList; import com.docusign.rooms.model.FormSummary; +import com.docusign.controller.rooms.services.AssignFormToFormGroupService; +import com.docusign.controller.rooms.services.GetFormSummaryListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -29,8 +31,6 @@ public class R009ControllerAssignFormToFormGroup extends AbstractRoomsController private static final String MODEL_FORM_LIST = "formList"; private static final String MODEL_FORM_GROUP_LIST = "formGroupList"; private static final String FORM_ALREADY_EXISTS_ERROR_MESSAGE = "Form in the form group already exists"; - - private final Session session; private final User user; private FormGroupsApi formGroupsApi; @@ -54,7 +54,9 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // Step 3 End // Step 4 Start - List forms = getFormSummaryList(this.session.getBasePath(), this.user.getAccessToken(), this.session.getAccountId()); + List forms = GetFormSummaryListService.getFormSummaryList( + createFormLibrariesApi(session.getBasePath(), this.user.getAccessToken()), + this.session.getAccountId()); // Step 4 End model.addAttribute(MODEL_FORM_GROUP_LIST, formGroupSummaryList.getFormGroups()); @@ -65,16 +67,13 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws IOException, ApiException { - - // Step 5 Start - FormGroupFormToAssign formGroupFormToAssignRequest = new FormGroupFormToAssign() - .formId(args.getFormId()); - // Step 5 End - try { // Step 6 Start - FormGroupFormToAssign formGroupFormToAssign = this.formGroupsApi.assignFormGroupForm( - this.session.getAccountId(), args.getFormGroupId(), formGroupFormToAssignRequest); + FormGroupFormToAssign formGroupFormToAssign = AssignFormToFormGroupService.assignFormToFormGroup( + this.formGroupsApi, + this.session.getAccountId(), + args.getFormId(), + args.getFormGroupId()); // Step 6 End DoneExample.createDefault(this.title) diff --git a/src/main/java/com/docusign/controller/rooms/services/AddingFormsToRoomService.java b/src/main/java/com/docusign/controller/rooms/services/AddingFormsToRoomService.java new file mode 100644 index 00000000..25fe945d --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/AddingFormsToRoomService.java @@ -0,0 +1,20 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormForAdd; +import com.docusign.rooms.model.RoomDocument; + +import java.util.UUID; + +public final class AddingFormsToRoomService { + public static RoomDocument addFormsToRoom( + RoomsApi roomsApi, + String accountId, + UUID formId, + Integer roomId + ) throws ApiException { + FormForAdd formForAdd = new FormForAdd().formId(formId); + return roomsApi.addFormToRoom(accountId, roomId, formForAdd); + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/AssignFormToFormGroupService.java b/src/main/java/com/docusign/controller/rooms/services/AssignFormToFormGroupService.java new file mode 100644 index 00000000..5cc0e8c1 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/AssignFormToFormGroupService.java @@ -0,0 +1,25 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormGroupFormToAssign; + +import java.util.UUID; + +public final class AssignFormToFormGroupService { + public static FormGroupFormToAssign assignFormToFormGroup( + FormGroupsApi formGroupsApi, + String accountId, + UUID formId, + UUID formGroupId + ) throws ApiException { + // Step 5 Start + FormGroupFormToAssign formGroupFormToAssignRequest = new FormGroupFormToAssign() + .formId(formId); + // Step 5 End + // Step 6 Start + return formGroupsApi.assignFormGroupForm( + accountId, formGroupId, formGroupFormToAssignRequest); + // Step 6 End + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/CreateExternalFormFillSessionService.java b/src/main/java/com/docusign/controller/rooms/services/CreateExternalFormFillSessionService.java new file mode 100644 index 00000000..f0e12e44 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/CreateExternalFormFillSessionService.java @@ -0,0 +1,25 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.ExternalFormFillSessionsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.ExternalFormFillSession; +import com.docusign.rooms.model.ExternalFormFillSessionForCreate; + +public final class CreateExternalFormFillSessionService { + public static ExternalFormFillSession createExternalFormFillSession( + ExternalFormFillSessionsApi externalFormFillSessionsApi, + String accountId, + String formId, + Integer roomId + ) throws ApiException { + // Step 3. Construct your request body + ExternalFormFillSessionForCreate externalFormFillSessionForCreate = new ExternalFormFillSessionForCreate() + .formId(formId) + .roomId(roomId); + + // Step 4. Call the v2 Rooms API + return externalFormFillSessionsApi.createExternalFormFillSession( + accountId, externalFormFillSessionForCreate + ); + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/CreateFormGroupService.java b/src/main/java/com/docusign/controller/rooms/services/CreateFormGroupService.java new file mode 100644 index 00000000..d1e25ab6 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/CreateFormGroupService.java @@ -0,0 +1,23 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormGroup; +import com.docusign.rooms.model.FormGroupForCreate; + +public final class CreateFormGroupService { + public static FormGroup createFormGroup( + FormGroupsApi formGroupsApi, + String accountId, + String formGroupName + ) throws ApiException { + // Step 3 Start + FormGroupForCreate formGroupForCreate = new FormGroupForCreate() + .name(formGroupName); + // Step 3 End + + // Step 4 Start + return formGroupsApi.createFormGroup(accountId, formGroupForCreate); + // Step 4 End + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/CreateRoomService.java b/src/main/java/com/docusign/controller/rooms/services/CreateRoomService.java new file mode 100644 index 00000000..a7ca337c --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/CreateRoomService.java @@ -0,0 +1,36 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FieldDataForCreate; +import com.docusign.rooms.model.Room; +import com.docusign.rooms.model.RoomForCreate; + +public final class CreateRoomService { + public static Room createRoomFromModel( + RoomsApi roomsApi, + String accountId, + RoomForCreate roomForCreate + ) throws ApiException { + return roomsApi.createRoom(accountId, roomForCreate); + } + + public static RoomForCreate createRoomModel(Integer roleId, String roomName) { + return new RoomForCreate() + .name(roomName) + .roleId(roleId) + .transactionSideId("listbuy") + .fieldData( + new FieldDataForCreate() + .putDataItem("address1", "123 EZ Street") + .putDataItem("address2", "unit 10") + .putDataItem("city", "Galaxian") + .putDataItem("state", "US-HI") + .putDataItem("postalCode", "11112") + .putDataItem("companyRoomStatus", "5") + .putDataItem( + "comments", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + ); + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java b/src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java new file mode 100644 index 00000000..cc9e09bb --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/CreateRoomWithTemplateService.java @@ -0,0 +1,34 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FieldDataForCreate; +import com.docusign.rooms.model.Room; +import com.docusign.rooms.model.RoomForCreate; + +public final class CreateRoomWithTemplateService { + public static Room createRoomFromModel( + RoomsApi roomsApi, + String accountId, + RoomForCreate roomForCreate + ) throws ApiException { + return roomsApi.createRoom(accountId, roomForCreate); + } + + public static RoomForCreate createRoom(Integer roleId, String roomName, Integer templateId) { + return new RoomForCreate() + .name(roomName) + .roleId(roleId) + .templateId(templateId) + .fieldData( + new FieldDataForCreate() + .putDataItem("address1", "123 EZ Street") + .putDataItem("address2", "unit 10") + .putDataItem("city", "Galaxian") + .putDataItem("state", "US-HI") + .putDataItem("postalCode", "11112") + .putDataItem("companyRoomStatus", "5") + .putDataItem("comments", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + ); + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/ExportingDataFromRoomService.java b/src/main/java/com/docusign/controller/rooms/services/ExportingDataFromRoomService.java new file mode 100644 index 00000000..2be2fde5 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/ExportingDataFromRoomService.java @@ -0,0 +1,15 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FieldData; + +public final class ExportingDataFromRoomService { + public static FieldData exportDataFromRoom( + RoomsApi roomsApi, + String accountId, + Integer roomId + ) throws ApiException { + return roomsApi.getRoomFieldData(accountId, roomId); + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/GetAdminRolesService.java b/src/main/java/com/docusign/controller/rooms/services/GetAdminRolesService.java new file mode 100644 index 00000000..ec6f22e9 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/GetAdminRolesService.java @@ -0,0 +1,19 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.RolesApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.RoleSummary; +import com.docusign.rooms.model.RoleSummaryList; + +public final class GetAdminRolesService { + public static RoleSummary getAdminRole(RolesApi rolesApi, String accountId) + throws ApiException + { + RoleSummaryList roleSummaryList = rolesApi.getRoles(accountId); + return roleSummaryList.getRoles() + .stream() + .filter(RoleSummary::isIsDefaultForAdmin) + .findFirst() + .get(); + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/GetFormSummaryListService.java b/src/main/java/com/docusign/controller/rooms/services/GetFormSummaryListService.java new file mode 100644 index 00000000..e33729a3 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/GetFormSummaryListService.java @@ -0,0 +1,30 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.FormLibrariesApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.FormLibrarySummary; +import com.docusign.rooms.model.FormLibrarySummaryList; +import com.docusign.rooms.model.FormSummary; +import com.docusign.rooms.model.FormSummaryList; + +import java.util.ArrayList; +import java.util.List; + +public final class GetFormSummaryListService { + public static List getFormSummaryList( + FormLibrariesApi formLibrariesApi, + String accountId + ) throws ApiException { + FormLibrarySummaryList formLibrarySummaryList = formLibrariesApi.getFormLibraries(accountId); + + List forms = new ArrayList<>(); + + for (FormLibrarySummary formLibrarySummary : formLibrarySummaryList.getFormsLibrarySummaries()) { + FormSummaryList formSummaryList = formLibrariesApi.getFormLibraryForms( + accountId, + formLibrarySummary.getFormsLibraryId()); + forms.addAll(formSummaryList.getForms()); + } + return forms; + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/GetRoomsWithFiltersService.java b/src/main/java/com/docusign/controller/rooms/services/GetRoomsWithFiltersService.java new file mode 100644 index 00000000..7e595ff2 --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/GetRoomsWithFiltersService.java @@ -0,0 +1,22 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.RoomsApi; +import com.docusign.rooms.client.ApiException; +import com.docusign.rooms.model.RoomSummaryList; + +public final class GetRoomsWithFiltersService { + public static RoomSummaryList getRoomsWithFilters( + RoomsApi roomsApi, + String accountId, + String startDate, + String endDate + ) throws ApiException { + // Step 3. Prepare your request parameters + RoomsApi.GetRoomsOptions options = roomsApi.new GetRoomsOptions(); + options.setFieldDataChangedStartDate(startDate); + options.setFieldDataChangedEndDate(endDate); + + // Step 4. Call the v2 Rooms API + return roomsApi.getRooms(accountId, options); + } +} diff --git a/src/main/java/com/docusign/controller/rooms/services/GrantOfficeAccessToFormGroupService.java b/src/main/java/com/docusign/controller/rooms/services/GrantOfficeAccessToFormGroupService.java new file mode 100644 index 00000000..61b48dbf --- /dev/null +++ b/src/main/java/com/docusign/controller/rooms/services/GrantOfficeAccessToFormGroupService.java @@ -0,0 +1,20 @@ +package com.docusign.controller.rooms.services; + +import com.docusign.rooms.api.FormGroupsApi; +import com.docusign.rooms.client.ApiException; + +import java.util.UUID; + +public final class GrantOfficeAccessToFormGroupService { + public static void grantOfficeAccessToFormGroup( + FormGroupsApi formGroupsApi, + String accountId, + UUID formGroupId, + Integer officeId + ) throws ApiException { + formGroupsApi.grantOfficeAccessToFormGroup( + accountId, + formGroupId, + officeId); + } +} diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index 0d8ce584..b552d496 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -2,15 +2,10 @@ import com.docusign.DSConfiguration; import com.docusign.common.ApiIndex; -import com.docusign.esign.client.auth.OAuth; -import com.docusign.core.model.AuthType; -import com.docusign.core.model.AuthTypeItem; -import com.docusign.core.model.Locals; -import com.docusign.core.model.Session; -import com.docusign.core.model.User; - +import com.docusign.core.model.*; import com.docusign.core.utils.AccountsConverter; -import java.util.stream.Collectors; +import com.docusign.esign.client.auth.OAuth; +import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -22,11 +17,9 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.context.WebApplicationContext; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Optional; + +import java.util.*; +import java.util.stream.Collectors; /** * This class provides common model attributes for all pages. If you want to @@ -48,12 +41,12 @@ public class GlobalControllerAdvice { private static final String ERROR_ACCOUNT_NOT_FOUND = "Could not find account information for the user"; - + private static final String SELECTED_API_NOT_SUPPORTED = "Currently selected api is not supported by launcher. Please, check appsettings.json file."; private final DSConfiguration config; private final Session session; private final User user; private Optional account; - private AuthType authTypeSelected = AuthType.AGC; + private final AuthType authTypeSelected = AuthType.AGC; @Autowired public GlobalControllerAdvice(DSConfiguration config, Session session, User user, Optional account) { @@ -87,7 +80,11 @@ public boolean populateShowDoc() { public Locals populateLocals() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - ApiIndex apiIndex = ApiIndex.valueOf(config.getApiName()); + String selectedApi = config.getApiName().getFirstSelectedApi(); + if (!EnumUtils.isValidEnum(ApiIndex.class, selectedApi)){ + throw new NoSuchElementException(SELECTED_API_NOT_SUPPORTED); + } + ApiIndex apiIndex = ApiIndex.valueOf(selectedApi); session.setApiIndexPath(apiIndex.toString()); if (!(authentication instanceof OAuth2Authentication)) { diff --git a/src/main/java/com/docusign/core/model/Locals.java b/src/main/java/com/docusign/core/model/Locals.java index 61b83539..0acd00e0 100644 --- a/src/main/java/com/docusign/core/model/Locals.java +++ b/src/main/java/com/docusign/core/model/Locals.java @@ -4,7 +4,6 @@ import lombok.Data; import com.docusign.DSConfiguration; - @Data @AllArgsConstructor public class Locals { diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 9eabda15..27e5d603 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -44,9 +44,7 @@ public ApiClient getApiClient() { } public List getScopeByApiName(){ - //Only signature scope is needed for eSIgnature api. Impersonation scope is implied. - return dsConfiguration.getApiName().equalsIgnoreCase("esignature") ? - Arrays.asList(OAuth.Scope_SIGNATURE) : - getScope(); + //Only signature scope is needed for eSignature api. Impersonation scope is implied. + return getScope(); } } diff --git a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java index 97aaa7b4..61acf12f 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java @@ -26,7 +26,7 @@ public class JWTOAuth2RestTemplate extends OAuth2RestTemplate { private final JWTAuthorizationCodeResourceDetails resource; private final OAuth2ClientContext context; - private ApiClient apiClient; + private final ApiClient apiClient; public JWTOAuth2RestTemplate(JWTAuthorizationCodeResourceDetails resource, OAuth2ClientContext context) { super(resource, context); @@ -66,7 +66,7 @@ private OAuth2AccessToken accessToken() throws LauncherException { throw new AccessTokenRequiredException(e.getMessage(), resource); } - apiClient.setOAuthBasePath((String) resource.getBaseUrl()); + apiClient.setOAuthBasePath(resource.getBaseUrl()); OAuthToken oAuthToken; try { oAuthToken = apiClient.requestJWTUserToken( diff --git a/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java b/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java index febb7ea5..d8fef83f 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTUserInfoTokenService.java @@ -25,7 +25,7 @@ public class JWTUserInfoTokenService implements ResourceServerTokenServices { private static final String AUTHORITIES = "ROLE_USER"; private final JWTAuthorizationCodeResourceDetails resource; - private ApiClient apiClient; + private final ApiClient apiClient; public JWTUserInfoTokenService(JWTAuthorizationCodeResourceDetails resource) { this.resource = resource; diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index 57f0d818..a1f322d0 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -4,7 +4,13 @@ "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", - "DS_API_NAME": "ESIGNATURE", + "DS_API_NAME": { + "ESIGNATURE": true, + "ROOMS": false, + "CLICK": false, + "MONITOR": false, + "ADMIN": false + }, "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", "DS_CLICK_BASE_PATH": "https://demo.docusign.net", From 3223f7f6916ee9218e70670a74f38759090eb5d4 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Mon, 21 Mar 2022 10:04:09 -0700 Subject: [PATCH 273/699] updatelibVersionsPR --- .factorypath | 14 +++++++------- pom.xml | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.factorypath b/.factorypath index 202e6135..fede0e09 100644 --- a/.factorypath +++ b/.factorypath @@ -28,13 +28,12 @@ - + - @@ -44,7 +43,7 @@ - + @@ -58,7 +57,7 @@ - + @@ -87,8 +86,9 @@ - - - + + + + diff --git a/pom.xml b/pom.xml index f7926a16..3eca333e 100644 --- a/pom.xml +++ b/pom.xml @@ -18,12 +18,12 @@ 11 - 2.5.2 + 2.5.6 2.11.0 3.17.1 1.1.0 - 1.0.0-BETA - 1.0.0-BETA + 1.0.0 + 1.0.0 1.0.0-BETA @@ -45,7 +45,7 @@ org.projectlombok lombok - 1.18.20 + 1.18.22 true From b006401ed1fa7957f4544729d000f22868a0a50f Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Mon, 21 Mar 2022 19:49:16 +0200 Subject: [PATCH 274/699] changed examples 13 and 30 to use template Id from example 8 (#50) Co-authored-by: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> --- .../AbstractEsignatureController.java | 1 + .../EG008ControllerCreateTemplate.java | 14 +- .../EG013ControllerAddDocToTemplate.java | 143 +++++++++++++++--- .../EG030ControllerApplyBrandToTemplate.java | 33 ++-- .../java/com/docusign/core/model/Session.java | 1 + .../views/pages/esignature/examples/eg013.jsp | 10 +- .../views/pages/esignature/examples/eg030.jsp | 20 +-- 7 files changed, 159 insertions(+), 63 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java index b64abe56..ba4e8e73 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java @@ -16,6 +16,7 @@ public abstract class AbstractEsignatureController extends AbstractController { protected static final String MODEL_ENVELOPE_OK = "envelopeOk"; + protected static final String MODEL_TEMPLATE_OK = "templateOk"; private static final String EXAMPLE_PAGES_PATH = "pages/esignature/examples/"; public AbstractEsignatureController(DSConfiguration config, String exampleName, String title) { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index 045ae00c..09977643 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -53,8 +53,11 @@ protected Object doWork(WorkArguments args, ModelMap model, TEMPLATE_NAME); // Step 2. Process results. If template do not exist, create one - if (Integer.parseInt(envelopeTemplateResults.getResultSetSize()) > 0) { - EnvelopeTemplate template = envelopeTemplateResults.getEnvelopeTemplates().get(0); + + if (Integer.parseInt(results.getResultSetSize()) > 0) { + EnvelopeTemplate template = results.getEnvelopeTemplates().get(0); + session.setTemplateId(template.getTemplateId()); + DoneExample.createDefault(title) .withMessage(String.format( "The template already exists in your account.
Template name: %s, ID %s.", @@ -62,10 +65,9 @@ protected Object doWork(WorkArguments args, ModelMap model, .addToModel(model); } else { session.setTemplateName(TEMPLATE_NAME); - TemplateSummary template = CreateTemplateService.createTemplate( - apiClient, - accountId, - CreateTemplateService.makeTemplate(session.getTemplateName())); + + TemplateSummary template = templatesApi.createTemplate(accountId, makeTemplate()); + session.setTemplateId(template.getTemplateId()); DoneExample.createDefault(title) .withMessage(String.format( "The template has been created!
Template name: %s, ID %s.", diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index 0e6b8f3b..5dde1b0e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -2,6 +2,9 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.core.common.DocumentType; +import com.docusign.core.model.EnvelopeDocumentInfo; +import com.docusign.core.model.OptionItem; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; @@ -10,13 +13,23 @@ import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeTemplateResults; import com.docusign.esign.model.ViewUrl; -import com.docusign.controller.eSignature.services.AddDocToTemplateService; + + +import org.apache.commons.lang3.StringUtils; + + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -31,7 +44,12 @@ @RequestMapping("/eg013") public class EG013ControllerAddDocToTemplate extends AbstractEsignatureController { - private static final String MODEL_LIST_TEMPLATE = "listTemplates"; + private static final String SIGNER_CLIENT_ID = "1000"; + private static final String HTML_DOCUMENT_FILE_NAME = "templates/candy-bonbon2.ftl"; + private static final String HTML_DOCUMENT_NAME = "Appendix 1--Sales order"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + private final Session session; private final User user; @@ -45,10 +63,7 @@ public EG013ControllerAddDocToTemplate(DSConfiguration config, Session session, @Override protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); - TemplatesApi templatesApi = new TemplatesApi(apiClient); - EnvelopeTemplateResults templates = templatesApi.listTemplates(session.getAccountId()); - model.addAttribute(MODEL_LIST_TEMPLATE, templates.getEnvelopeTemplates()); + model.addAttribute(MODEL_TEMPLATE_OK, StringUtils.isNotBlank(session.getTemplateId())); } @Override @@ -57,21 +72,109 @@ protected Object doWork(WorkArguments args, ModelMap model, String accountId = session.getAccountId(); EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); - ViewUrl viewUrl = AddDocToTemplateService.addDocumentToTemplate( - envelopesApi, - args.getSignerEmail(), - args.getSignerName(), - args.getSignerClientId(), - args.getCcEmail(), - args.getCcName(), - args.getTemplateId(), - accountId, - config.getDsReturnUrl(), - config.getDsPingUrl(), - args - ); - + // Step 2 start + args.setDsReturnUrl(config.getDsReturnUrl()); + args.setDsPingUrl(config.getDsPingUrl()); + args.setSignerClientId(SIGNER_CLIENT_ID); + EnvelopeDefinition envelope = makeEnvelope(args, session.getTemplateId()); + // Step 2 end + + // Step 3 start + EnvelopeSummary results = envelopesApi.createEnvelope(accountId, envelope); + // Step 3 end + + // Step 4 start + RecipientViewRequest viewRequest = makeRecipientViewRequest(args); + ViewUrl viewUrl = envelopesApi.createRecipientView(accountId, results.getEnvelopeId(), viewRequest); return new RedirectView(viewUrl.getUrl()); // Step 4 end } + + private static RecipientViewRequest makeRecipientViewRequest(WorkArguments args) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + viewRequest.setReturnUrl(args.getDsReturnUrl()); + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + viewRequest.setAuthenticationMethod("none"); + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(args.getSignerEmail()); + viewRequest.setUserName(args.getSignerName()); + viewRequest.setClientUserId(args.getSignerClientId()); + + // DocuSign recommends that you redirect to DocuSign for the + // embedded signing. There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + viewRequest.setPingFrequency("600"); + viewRequest.setPingUrl(args.getDsPingUrl()); + + return viewRequest; + } + + // The envelope request object uses Composite Template to include in the envelope: + // 1. A template stored on the DocuSign service + // 2. An additional document which is a custom HTML source document + private EnvelopeDefinition makeEnvelope(WorkArguments args, String templateId) throws IOException { + // Create a signer and cc recipients for the signer role of the server template + CarbonCopy cc1 = new CarbonCopy(); + cc1.setEmail(args.getCcEmail()); + cc1.setName(args.getCcName()); + cc1.setRoleName(EnvelopeHelpers.CC_ROLE_NAME); + cc1.setRecipientId("2"); + + // create a composite template for the Server Template + CompositeTemplate compTemplate1 = new CompositeTemplate(); + compTemplate1.setCompositeTemplateId("1"); + ServerTemplate serverTemplates = new ServerTemplate(); + serverTemplates.setSequence("1"); + serverTemplates.setTemplateId(templateId); + compTemplate1.setServerTemplates(Arrays.asList(serverTemplates)); + + // Add the roles via an inlineTemplate + InlineTemplate inlineTemplate = new InlineTemplate(); + inlineTemplate.setSequence("2"); + inlineTemplate.setRecipients(EnvelopeHelpers.createRecipients(createSigner(args), cc1)); + compTemplate1.setInlineTemplates(Arrays.asList(inlineTemplate)); + + // The signer recipient for the added document with a tab definition: + Tabs signer1Tabs = EnvelopeHelpers.createSingleSignerTab("**signature_1**", ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X); + Signer signer1AddedDoc = createSigner(args); + signer1AddedDoc.setTabs(signer1Tabs); + + // create the HTML document + byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + + // create a composite template for the added document and add the recipients via an inlineTemplate + CompositeTemplate compTemplate2 = new CompositeTemplate(); + compTemplate2.setCompositeTemplateId("2"); + InlineTemplate inlineTemplate2 = new InlineTemplate(); + inlineTemplate2.setSequence("1"); + inlineTemplate2.setRecipients(EnvelopeHelpers.createRecipients(signer1AddedDoc, cc1)); + compTemplate2.setInlineTemplates(Arrays.asList(inlineTemplate2)); + compTemplate2.setDocument(EnvelopeHelpers.createDocument(htmlDoc, HTML_DOCUMENT_NAME, + DocumentType.HTML.getDefaultFileExtention(), "1")); + + EnvelopeDefinition env = new EnvelopeDefinition(); + env.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + env.setCompositeTemplates(Arrays.asList(compTemplate1, compTemplate2)); + + return env; + } + + // Adding clientUserId transforms the template recipient into an embedded recipient + private static Signer createSigner(WorkArguments args) { + Signer signer = new Signer(); + signer.setEmail(args.getSignerEmail()); + signer.setName(args.getSignerName()); + signer.setRoleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + signer.setRecipientId("1"); + signer.setClientUserId(args.getSignerClientId()); + return signer; + } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index a8632ecd..51372d26 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -8,7 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; -import com.docusign.controller.eSignature.services.ApplyBrandToTemplateService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -62,9 +62,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception BrandsResponse brands = accountsApi.listBrands(accountId); model.addAttribute(MODEL_LIST_BRAND, brands.getBrands()); - TemplatesApi templatesApi = new TemplatesApi(apiClient); - EnvelopeTemplateResults templates = templatesApi.listTemplates(accountId); - model.addAttribute(MODEL_LIST_TEMPLATE, templates.getEnvelopeTemplates()); + model.addAttribute(MODEL_TEMPLATE_OK, StringUtils.isNotBlank(session.getTemplateId())); } @Override @@ -74,14 +72,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse EnvelopesApi envelopesApi = createEnvelopesApi(session.getBasePath(), user.getAccessToken()); // Step 3: Construct your envelope JSON body - EnvelopeDefinition envelope = ApplyBrandToTemplateService.makeEnvelope( - args.getSignerEmail(), - args.getSignerName(), - args.getCcEmail(), - args.getCcName(), - args.getTemplateId(), - args.getBrandId() - ); + EnvelopeDefinition envelope = makeEnvelope(args, session.getTemplateId()); // Step 5: Call the eSignature REST API EnvelopeSummary envelopeSummary = ApplyBrandToTemplateService.applyBrandToTemplate( @@ -97,4 +88,22 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return DONE_EXAMPLE_PAGE; } + + private static EnvelopeDefinition makeEnvelope(WorkArguments args, String templateId) { + TemplateRole signer = new TemplateRole() + .email(args.getSignerEmail()) + .name(args.getSignerName()) + .roleName(EnvelopeHelpers.SIGNER_ROLE_NAME); + + TemplateRole cc = new TemplateRole() + .email(args.getCcEmail()) + .name(args.getCcName()) + .roleName(EnvelopeHelpers.CC_ROLE_NAME); + + return new EnvelopeDefinition() + .templateId(templateId) + .templateRoles(Arrays.asList(signer, cc)) + .brandId(args.getBrandId()) + .status(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + } } diff --git a/src/main/java/com/docusign/core/model/Session.java b/src/main/java/com/docusign/core/model/Session.java index 6efe8c77..6cc22fcb 100644 --- a/src/main/java/com/docusign/core/model/Session.java +++ b/src/main/java/com/docusign/core/model/Session.java @@ -22,6 +22,7 @@ public class Session implements Serializable { private String basePath; private String roomsBasePath; private String envelopeId; + private String templateId; private String templateName; private List envelopeDocuments; private String permissionProfileId; diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index 219a829a..2837541e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -33,18 +33,10 @@ View source file ${sourceFile} on GitHub.

- +

The template you created via example 8 will be used.

-
- -
- +

The template you created via example 8 and brands created via example 24 will be used.

@@ -59,14 +59,6 @@ class="form-control" id="ccName" placeholder="Pat Johnson" name="ccName" required>
-
- -
- We'll never share your phone number with anyone else. + This phone number will receive a notification. We'll never share your phone number with anyone else.
@@ -48,7 +44,7 @@ - We'll never share your phone number with anyone else. + This phone number will receive a notification. We'll never share your phone number with anyone else.
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index c0d03885..82fe0f85 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -348,7 +348,7 @@

Premium features

37. Request a signature by SMS delivery

- Demonstrates how to send a signature request via an SMS message using the Create Envelope method. + Sends a signature requet via an SMS message.

API method used: From 8c7d6438952485453d2ed675c5f77f22cb233121 Mon Sep 17 00:00:00 2001 From: Connor Lunsford Date: Tue, 29 Mar 2022 16:19:17 -0700 Subject: [PATCH 278/699] Added clickwrap choice to click2,3 and 5 --- .../com/docusign/common/WorkArguments.java | 2 ++ .../C002ControllerActivateClickwrap.java | 16 +++++++--- ...03ControllerCreateNewVersionClickwrap.java | 12 ++++--- .../C005ControllerGetClickwrapResponses.java | 13 +++++++- .../services/ActivateClickwrapService.java | 11 +++++++ .../CreateNewVersionClickwrapService.java | 7 +++-- .../views/pages/click/examples/c002.jsp | 17 +++++++--- .../views/pages/click/examples/c003.jsp | 20 +++++++++--- .../views/pages/click/examples/c005.jsp | 31 ++++++++++++++----- 9 files changed, 101 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index 0a625591..572fe15c 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -66,4 +66,6 @@ public class WorkArguments { private UUID dsGroupId; private String resumeDate; private String delay; + private String clickwrap; + private String clickwrapId; } diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index bd7b3383..ada4168c 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -4,6 +4,7 @@ import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.click.model.ClickwrapVersionsResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; @@ -24,7 +25,7 @@ @RequestMapping("/c002") public class C002ControllerActivateClickwrap extends AbstractClickController { - private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + private static final String MODEL_CLICKWRAPS = "clickwraps"; private final Session session; private final User user; @@ -38,7 +39,9 @@ public C002ControllerActivateClickwrap(DSConfiguration config, Session session, @Override protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - model.addAttribute(MODEL_CLICKWRAP_OK, StringUtils.isNotBlank(this.session.getClickwrapId())); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + ClickwrapVersionsResponse clickwraps = ActivateClickwrapService.getInactiveClickwraps(accountsApi, this.session.getAccountId()); + model.addAttribute(MODEL_CLICKWRAPS, clickwraps); } @Override @@ -48,11 +51,16 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2: Construct your API headers AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + String clickwrap = args.getClickwrap(); + String [] clickwrapData = clickwrap.split(":"); + String clickwrapId = clickwrapData[0]; + String versionNumber = clickwrapData[1]; + ClickwrapVersionSummaryResponse updatedClickwrap = ActivateClickwrapService.activateClickwrap( accountsApi, this.session.getAccountId(), - this.session.getClickwrapId(), - this.session.getClickwrapVersionNumber()); + clickwrapId, + versionNumber); DoneExample.createDefault(this.title) .withJsonObject(updatedClickwrap) diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index fd0a2de3..19facad3 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -4,11 +4,13 @@ import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.click.model.ClickwrapVersionsResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.controller.click.services.CreateNewVersionClickwrapService; +import com.docusign.controller.click.services.GetListClickwrapsService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -25,7 +27,7 @@ @RequestMapping("/c003") public class C003ControllerCreateNewVersionClickwrap extends AbstractClickController { - private static final String MODEL_CLICKWRAP_OK = "clickwrapOk"; + private static final String MODEL_CLICKWRAPS = "clickwraps"; private static final String DOCUMENT_FILE_NAME = "TermsOfService.pdf"; private static final Integer DOCUMENT_ORDER = 0; private static final String DOCUMENT_NAME = "Terms of Service"; @@ -42,7 +44,9 @@ public C003ControllerCreateNewVersionClickwrap(DSConfiguration config, Session s @Override protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { super.onInitModel(args, model); - model.addAttribute(MODEL_CLICKWRAP_OK, StringUtils.isNotBlank(this.session.getClickwrapId())); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + ClickwrapVersionsResponse clickwraps = GetListClickwrapsService.getListClickwrap(accountsApi, this.session.getAccountId()); + model.addAttribute(MODEL_CLICKWRAPS, clickwraps); } @Override @@ -54,9 +58,9 @@ protected Object doWork(WorkArguments args, ModelMap model, ClickwrapVersionSummaryResponse createdClickwrap = CreateNewVersionClickwrapService.createNewVersionClickwrap( accountsApi, - CreateNewVersionClickwrapService.createClickwrapRequest(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER), + CreateNewVersionClickwrapService.createClickwrapRequest(DOCUMENT_FILE_NAME, DOCUMENT_NAME, DOCUMENT_ORDER, args.getClickwrapName()), this.session.getAccountId(), - this.session.getClickwrapId() + args.getClickwrapId() ); diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index 88b2a643..268366a2 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -4,11 +4,13 @@ import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; import com.docusign.click.model.ClickwrapAgreementsResponse; +import com.docusign.click.model.ClickwrapVersionsResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.controller.click.services.GetClickwrapResponsesService; +import com.docusign.controller.click.services.GetListClickwrapsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -23,6 +25,7 @@ @RequestMapping("/c005") public class C005ControllerGetClickwrapResponses extends AbstractClickController { + private static final String MODEL_CLICKWRAPS = "clickwraps"; private final Session session; private final User user; @@ -33,6 +36,14 @@ public C005ControllerGetClickwrapResponses(DSConfiguration config, Session sessi this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + ClickwrapVersionsResponse clickwraps = GetListClickwrapsService.getListClickwrap(accountsApi, this.session.getAccountId()); + model.addAttribute(MODEL_CLICKWRAPS, clickwraps); + } + @Override // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, @@ -44,7 +55,7 @@ protected Object doWork(WorkArguments args, ModelMap model, ClickwrapAgreementsResponse clickwrapAgreementsResponse = GetClickwrapResponsesService.getClickwrapResponses( accountsApi, this.session.getAccountId(), - this.session.getClickwrapId()); + args.getClickwrapId()); DoneExample.createDefault(this.title) .withJsonObject(clickwrapAgreementsResponse) diff --git a/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java b/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java index 71335a20..6dd51b41 100644 --- a/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java +++ b/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java @@ -5,6 +5,8 @@ import com.docusign.click.model.ClickwrapRequest; import com.docusign.click.model.ClickwrapVersionSummaryResponse; import com.docusign.controller.click.examples.ClickwrapHelper; +import com.docusign.click.model.ClickwrapVersionsResponse; +import com.docusign.click.api.AccountsApi.GetClickwrapsOptions; public final class ActivateClickwrapService { public static ClickwrapVersionSummaryResponse activateClickwrap( @@ -22,4 +24,13 @@ public static ClickwrapVersionSummaryResponse activateClickwrap( clickwrapVersionNumber, clickwrapRequest); } + + public static ClickwrapVersionsResponse getInactiveClickwraps( + AccountsApi accountsApi, + String accountId + ) throws ApiException{ + AccountsApi.GetClickwrapsOptions options = accountsApi.new GetClickwrapsOptions(); + options.setStatus("inactive"); + return accountsApi.getClickwraps(accountId, options); + } } diff --git a/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java b/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java index 8655c8c1..0d0ad397 100644 --- a/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java +++ b/src/main/java/com/docusign/controller/click/services/CreateNewVersionClickwrapService.java @@ -27,11 +27,12 @@ public static ClickwrapVersionSummaryResponse createNewVersionClickwrap( public static ClickwrapRequest createClickwrapRequest( String fileName, String documentName, - Integer documentOrder + Integer documentOrder, + String clickwrapName ) throws IOException { Document document = ClickwrapHelper.createDocumentFromFile(fileName, documentName, documentOrder); DisplaySettings displaySettings = new DisplaySettings() - .displayName("Terms of Service v2") + .displayName(clickwrapName) .consentButtonText("I Agree") .downloadable(true) .format("modal") @@ -41,7 +42,7 @@ public static ClickwrapRequest createClickwrapRequest( return new ClickwrapRequest() .addDocumentsItem(document) - .clickwrapName("Terms of Service") + .clickwrapName(clickwrapName) .requireReacceptance(true) .status(ClickwrapHelper.STATUS_ACTIVE) .displaySettings(displaySettings); diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index 59feab3c..52b76963 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -15,16 +15,25 @@

- -

The clickwrap you created via example 1 will be queried.

+ +

Please choose a clickwrap to activate

+
+ + +
-

Cannot find any clickwrap. Please first create a clickwrap using - example 1. +

+ Problem: You do not have clickwraps to activate. Go to example#1 and create one: + create clickwrap.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 78c9d4c4..00d04f36 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -18,16 +18,28 @@

- -

The clickwrap you created via example 1 will be queried.

+
+
+ + +
+
+ + +
-

Cannot find any clickwrap. Please first create a clickwrap using - example 1. +

+ Problem: You do not have clickwraps to activate. Go to example#1 and create one: + create clickwrap.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index 7b040a69..edefb9fa 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -12,15 +12,30 @@

View source file ${sourceFile} on GitHub.

-

- The clickwrap you created via example 1 will be queried. -

- -
- - -
+ + +

Please choose a clickwrap

+
+
+ + +
+ + +
+
+ +

+ Problem: You do not have clickwraps. Go to example#1 and create one: + create clickwrap.
+

+
+
\ No newline at end of file From 17547a97dd71b546641a5c797e0f29a1b2dba527 Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Thu, 31 Mar 2022 05:36:54 +0300 Subject: [PATCH 279/699] Added select api logic (#44) * added select api logic * Move scopes to only one class, make sure that only ACG has access to all scopes (based on issues with configuration of java HttpSecurity) * Moved scopes to ApiType enum, fixed formatting issues * Fixed getScopes method in JWTAuthorizationCodeResourceDetails * Removed checking by null in IndexController routes * Removed hardcoded string in IndexController to enum value * Fixing rooms scopes and issues with userflow * Changed logout before access select Api page * fixed userflow issues and issues with scopes for ACG * changes after code review * adding first example data in ApiIndex * changed data format in examplesApi.json file * Added check for ApiType while reading from file * Fixed naming of the variables * different way of getting a file path * changed the getScopeByApiName function name and added logging to App class * Updating message to include "mvn package" command which is needed * Updating gitignore to not check the examplesApi.json * changed to redirect to 1st example only for ESignature Co-authored-by: Inbar Gazit Co-authored-by: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Co-authored-by: Aaron JacksonWilde --- .gitignore | 3 +- code-examples-java.iml | 157 +++++++++--------- src/main/java/com/docusign/App.java | 25 ++- .../java/com/docusign/DSConfiguration.java | 48 +++++- .../java/com/docusign/WebSecurityConfig.java | 47 ++---- .../java/com/docusign/common/ApiIndex.java | 18 +- .../EG030ControllerApplyBrandToTemplate.java | 1 + .../examples/AbstractMonitorController.java | 2 +- .../core/controller/AbstractController.java | 6 +- .../controller/GlobalControllerAdvice.java | 35 +++- .../core/controller/IndexController.java | 85 +++++++++- .../java/com/docusign/core/model/ApiType.java | 25 +++ .../com/docusign/core/model/ApiTypeItem.java | 46 +++++ .../JWTAuthorizationCodeResourceDetails.java | 13 +- .../security/jwt/JWTOAuth2RestTemplate.java | 6 +- src/main/resources/application.example.json | 7 - src/main/resources/examplesApi.json | 1 + .../templates/views/pages/ds_restart.jsp | 14 ++ .../templates/views/pages/ds_select_api.jsp | 21 +++ .../views/pages/esignature/index.jsp | 13 -- .../templates/views/pages/monitor/index.jsp | 1 - .../WEB-INF/templates/views/partials/head.jsp | 4 + 22 files changed, 411 insertions(+), 167 deletions(-) create mode 100644 src/main/java/com/docusign/core/model/ApiType.java create mode 100644 src/main/java/com/docusign/core/model/ApiTypeItem.java create mode 100644 src/main/resources/examplesApi.json create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/ds_restart.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp diff --git a/.gitignore b/.gitignore index 890ff2ec..c10e79b4 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,5 @@ src/main/java/com/docusign/admin/ # according to gitignore.io this shouldnt be shared .factorypath src/main/resources/ExportedUserData.csv -app.config \ No newline at end of file +examplesApi.json +app.config diff --git a/code-examples-java.iml b/code-examples-java.iml index 97a72455..f7b11414 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -1,5 +1,10 @@ + + + @@ -22,101 +27,97 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + - - + + - + - + - - - - - - - - - + + + + + + + - - - + + + - + - - + + - - - + + + + + \ No newline at end of file diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index dcbf8424..975393f5 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -1,17 +1,24 @@ package com.docusign; import java.io.IOException; +import java.net.URI; +import java.nio.file.FileSystemAlreadyExistsException; +import java.nio.file.FileSystems; +import java.util.Collections; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; +@Slf4j @SpringBootApplication(exclude={JmxAutoConfiguration.class}) public class App { public static void main(String[] args) throws IOException { SpringApplication.run(App.class, args); openHomePage(); + initFileSystem(); } private static void openHomePage() throws IOException { @@ -23,7 +30,7 @@ private static void openHomePage() throws IOException { rt.exec(arguments); } else if (OSDetector.isWindows()){ - rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); + rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); } else if (OSDetector.isLinux()){ String [] browsers = {"firefox", "safari", "chrome", "mozilla"}; @@ -34,4 +41,18 @@ else if (OSDetector.isLinux()){ } } -} + + private static void initFileSystem() { + try { + FileSystems.newFileSystem(new URI(""), Collections.emptyMap()); + log.info("FileSystem initialized successfully"); + } catch (Exception e) { + if (e instanceof FileSystemAlreadyExistsException) { + log.info("FileSystem is already initialized"); + } else { + log.info("Retrieving the default initialize context"); + FileSystems.getDefault(); + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index 8f885599..b00dd3d1 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -1,14 +1,26 @@ package com.docusign; + +import com.docusign.common.ApiIndex; import com.docusign.common.SelectedApiTypes; +import com.docusign.core.model.ApiType; import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.EnumUtils; +import org.json.JSONException; +import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Component; - +import org.springframework.util.StreamUtils; +import java.io.IOException; +import java.nio.charset.StandardCharsets; @Component @Getter +@Setter public class DSConfiguration { @Value("${com.docusign.github.example-uri}") @@ -17,12 +29,15 @@ public class DSConfiguration { @Value("${com.docusign.documentation-path}") private String documentationPath; + private String selectedApiType; + @Value("${DS_TARGET_ACCOUNT_ID}") private String targetAccountId; @Value("${DS_APP_URL}") private String appUrl; + @Autowired private SelectedApiTypes apiName; @@ -59,6 +74,10 @@ public class DSConfiguration { @Value("${DS_ADMIN_BASE_PATH}") private String adminBasePath; + public String examplesApiPath = "examplesApi.json"; + + public String apiTypeHeader = "ApiType"; + public String getDsReturnUrl() { return appUrl + "/ds-return"; } @@ -66,4 +85,31 @@ public String getDsReturnUrl() { public String getDsPingUrl() { return appUrl + "/"; } + + public ApiType getSelectedApiType() throws IOException { + return ApiType.valueOf(getSelectedApi()); + } + + public ApiIndex getSelectedApiIndex() throws IOException { + return ApiIndex.valueOf(getSelectedApi()); + } + + private String getSelectedApi() throws IOException { + if (selectedApiType != null){ + return selectedApiType; + } + + ClassPathResource resource = new ClassPathResource(examplesApiPath); + String source = StreamUtils.copyToString(resource.getInputStream(), StandardCharsets.UTF_8); + try { + Object apiTypeValues = new JSONObject(source).get(apiTypeHeader); + if (apiTypeValues == null || !EnumUtils.isValidEnum(ApiIndex.class, apiTypeValues.toString())) { + throw new JSONException(String.format("The wrong format of the %s file.", examplesApiPath)); + } + selectedApiType = apiTypeValues.toString(); + } catch (JSONException e){ + e.printStackTrace(); + } + return selectedApiType; + } } diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 7d77faf8..02b5741e 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -1,4 +1,5 @@ package com.docusign; +import com.docusign.core.model.ApiType; import com.docusign.core.security.OAuthProperties; import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; @@ -28,23 +29,14 @@ import org.springframework.web.filter.CompositeFilter; import javax.servlet.Filter; -import java.util.Arrays; -import java.util.List; +import java.io.IOException; +import java.util.*; @EnableOAuth2Client @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { - public String roomScopes[] = new String[] {"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}; - public String clickScopes[] = new String[] {"click.manage", "click.send"}; - public String monitorScopes[] = new String[] {"signature", "impersonation"}; - public String adminScopes[] = new String[] {"user_write", "signature", "impersonation", "group_read", "organization_read", "permission_read", "user_read", "account_read", "domain_read", "identity_provider_read"}; - @Autowired - private DSConfiguration dsConfiguration; - - - @Autowired private OAuth2ClientContext oAuth2ClientContext; @Bean @@ -53,6 +45,9 @@ public OAuthProperties authCodeGrantSso() { return new OAuthProperties(); } + @Autowired + public DSConfiguration dsConfiguration; + @Bean @ConfigurationProperties("jwt.grant.sso") public OAuthProperties jwtGrantSso() { @@ -86,27 +81,13 @@ public FilterRegistrationBean oAuth2ClientFilterRegis return registration; } - private List getScopes() { - List scopes = null; - if (this.dsConfiguration.getApiName().getESIGNATURE()) { - scopes = Arrays.asList(OAuth.Scope_SIGNATURE); - } - if (this.dsConfiguration.getApiName().getROOMS()) { - scopes = Arrays.asList(this.roomScopes); - } - if (this.dsConfiguration.getApiName().getCLICK()) { - scopes = Arrays.asList(this.clickScopes); - } - if (this.dsConfiguration.getApiName().getMONITOR()) { - scopes = Arrays.asList(this.monitorScopes); - } else if (this.dsConfiguration.getApiName().getADMIN()) { - scopes = Arrays.asList(this.adminScopes); - } - return scopes; + private List getScopes() throws IOException { + return Arrays.asList(dsConfiguration.getSelectedApiType().getScopes()); + } - private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { + private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() throws IOException { OAuth2SsoProperties authCodeGrantSso = authCodeGrantSso(); AuthorizationCodeResourceDetails authCodeGrantClient = authCodeGrantClient(); @@ -126,7 +107,7 @@ private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() { return filter; } - private OAuth2ClientAuthenticationProcessingFilter jwtGrantFilter() { + private OAuth2ClientAuthenticationProcessingFilter jwtGrantFilter() throws IOException { OAuth2SsoProperties authCodeGrantSso = jwtGrantSso(); JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = jwtCodeGrantClient(); @@ -146,12 +127,11 @@ private OAuth2ClientAuthenticationProcessingFilter jwtGrantFilter() { @Override protected void configure(HttpSecurity http) throws Exception { - http .antMatcher("/**") .authorizeRequests() .antMatchers( "/", "/login**", "/error**", "/assets/**","/ds/mustAuthenticate**", - "/ds/authenticate**") + "/ds/authenticate**", "/ds/selectApi**") .permitAll() .anyRequest() .authenticated() @@ -162,8 +142,7 @@ protected void configure(HttpSecurity http) throws Exception { .logout().logoutSuccessUrl("/").permitAll() .and() .csrf().disable(); - http.apply(new CombinedAuthenticationConfigurer(Arrays.asList(authCodeGrantFilter(), - jwtGrantFilter()))); + http.apply(new CombinedAuthenticationConfigurer(Arrays.asList(authCodeGrantFilter(), jwtGrantFilter()))); } private static class CombinedAuthenticationConfigurer diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index ff62fec6..6ea59e49 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -1,24 +1,30 @@ package com.docusign.common; public enum ApiIndex { - ESIGNATURE("/pages/esignature/index", "/restapi"), - ROOMS("/pages/rooms/index", "/restapi"), - CLICK("/pages/click/index", "/clickapi"), - MONITOR("/pages/monitor/index", ""), - ADMIN("/pages/admin/index", "/management"); + ESIGNATURE("/pages/esignature/index", "/restapi", "/eg001"), + ROOMS("/pages/rooms/index", "/restapi", "/r001"), + CLICK("/pages/click/index", "/clickapi", "/c001"), + MONITOR("/pages/monitor/index", "", "/m001"), + ADMIN("/pages/admin/index", "/management", "/a001"); private final String indexPath; private final String baseUrlSuffix; + private final String firstExamplePath; - ApiIndex(final String indexPath, final String baseUrlSuffix) { + ApiIndex(final String indexPath, final String baseUrlSuffix, final String firstExamplePath) { this.indexPath = indexPath; this.baseUrlSuffix = baseUrlSuffix; + this.firstExamplePath = firstExamplePath; } public String getBaseUrlSuffix() { return baseUrlSuffix; } + public String getPathOfFirstExample() { + return firstExamplePath; + } + @Override public String toString() { return this.indexPath; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index 36b23fae..63e91cfd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -10,6 +10,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.esign.model.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index b544d497..86807945 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -27,7 +27,7 @@ protected String getExamplePagesPath() { protected String ensureUsageOfJWTToken(String accessToken, Session session) { if (session.getAuthTypeSelected() != AuthType.JWT || accessToken.isEmpty()){ - return REDIRECT_AUTHENTICATION_PAGE; + return REDIRECT_SELECT_API_PAGE; } else { return accessToken; } diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index 9d9d1363..cf59e5fc 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -35,7 +35,7 @@ public abstract class AbstractController { private static final String REDIRECT_PREFIX = "redirect:"; - protected static final String REDIRECT_AUTHENTICATION_PAGE = REDIRECT_PREFIX + "/ds/mustAuthenticate"; + protected static final String REDIRECT_SELECT_API_PAGE = REDIRECT_PREFIX + "/ds/selectApi"; protected static final String BEARER_AUTHENTICATION = "Bearer "; protected static final String DONE_EXAMPLE_PAGE = "pages/example_done"; protected static final String DONE_EXAMPLE_PAGE_COMPARE = "pages/example_done_compare"; @@ -65,7 +65,7 @@ public AbstractController(DSConfiguration config, String exampleName, String tit @GetMapping public String get(WorkArguments args, ModelMap model) { if (isTokenExpired()) { - return REDIRECT_AUTHENTICATION_PAGE; + return REDIRECT_SELECT_API_PAGE; } try { @@ -79,7 +79,7 @@ public String get(WorkArguments args, ModelMap model) { @PostMapping public Object create(WorkArguments args, ModelMap model, HttpServletResponse response) { if (isTokenExpired()) { - return REDIRECT_AUTHENTICATION_PAGE; + return REDIRECT_SELECT_API_PAGE; } try { diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index b552d496..be018bc0 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -3,9 +3,13 @@ import com.docusign.DSConfiguration; import com.docusign.common.ApiIndex; import com.docusign.core.model.*; -import com.docusign.core.utils.AccountsConverter; + import com.docusign.esign.client.auth.OAuth; -import org.apache.commons.lang3.EnumUtils; + +import com.docusign.core.utils.AccountsConverter; + +import java.io.IOException; +import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -46,7 +50,10 @@ public class GlobalControllerAdvice { private final Session session; private final User user; private Optional account; - private final AuthType authTypeSelected = AuthType.AGC; + + private AuthType authTypeSelected = AuthType.AGC; + private ApiType apiTypeSelected = ApiType.ESIGNATURE; + @Autowired public GlobalControllerAdvice(DSConfiguration config, Session session, User user, Optional account) { @@ -66,6 +73,16 @@ public AuthTypeItem authTypeSelected() { return AuthTypeItem.convert(authTypeSelected); } + @ModelAttribute("apiTypes") + public List apiTypes() { + return ApiTypeItem.list(); + } + + @ModelAttribute("apiTypeSelected") + public ApiTypeItem apiTypeSelected() { + return ApiTypeItem.convert(apiTypeSelected); + } + @ModelAttribute("documentOptions") public List populateDocumentOptions() { return new ArrayList<>(); @@ -77,14 +94,16 @@ public boolean populateShowDoc() { } @ModelAttribute("locals") - public Locals populateLocals() { + public Locals populateLocals() throws IOException { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - String selectedApi = config.getApiName().getFirstSelectedApi(); - if (!EnumUtils.isValidEnum(ApiIndex.class, selectedApi)){ - throw new NoSuchElementException(SELECTED_API_NOT_SUPPORTED); + + ApiIndex apiIndex = ApiIndex.ESIGNATURE; + + if (config.getSelectedApiIndex() != null){ + apiIndex = config.getSelectedApiIndex(); } - ApiIndex apiIndex = ApiIndex.valueOf(selectedApi); + session.setApiIndexPath(apiIndex.toString()); if (!(authentication instanceof OAuth2Authentication)) { diff --git a/src/main/java/com/docusign/core/controller/IndexController.java b/src/main/java/com/docusign/core/controller/IndexController.java index 45557b99..453d46fc 100644 --- a/src/main/java/com/docusign/core/controller/IndexController.java +++ b/src/main/java/com/docusign/core/controller/IndexController.java @@ -1,11 +1,30 @@ package com.docusign.core.controller; import com.docusign.DSConfiguration; +import com.docusign.common.ApiIndex; +import com.docusign.core.model.ApiType; import com.docusign.core.model.AuthType; import com.docusign.core.model.Session; import com.docusign.core.security.OAuthProperties; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.List; +import java.util.Objects; + +import org.apache.commons.lang3.EnumUtils; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.util.MultiValueMap; @@ -17,6 +36,8 @@ import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.RedirectView; +import javax.servlet.http.HttpServletResponse; + @Controller public class IndexController { private static final String ATTR_ENVELOPE_ID = "qpEnvelopeId"; @@ -37,18 +58,33 @@ public class IndexController { private DSConfiguration config; @GetMapping(path = "/") - public String index(ModelMap model) { + public String index(ModelMap model, HttpServletResponse response) throws IOException { model.addAttribute(ATTR_TITLE,"Home"); + + if (config.getQuickstart().equals("true") && config.getSelectedApiIndex().equals(ApiIndex.ESIGNATURE) && + !(SecurityContextHolder.getContext().getAuthentication() instanceof OAuth2Authentication)){ + String site = config.getSelectedApiIndex().getPathOfFirstExample(); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + return null; + } + return session.getApiIndexPath(); } @GetMapping(path = "/ds/mustAuthenticate") - public ModelAndView mustAuthenticateController(ModelMap model) { + public ModelAndView mustAuthenticateController(ModelMap model) throws IOException { model.addAttribute(ATTR_TITLE, "Authenticate with DocuSign"); if (session.isRefreshToken() || config.getQuickstart().equals("true")) { + config.setQuickstart("false"); + + if (config.getSelectedApiType().equals(ApiType.MONITOR)) { + return new ModelAndView(getRedirectView(AuthType.JWT)); + } + return new ModelAndView(getRedirectView(session.getAuthTypeSelected())); } - else if (config.getApiName().equals("MONITOR")) { + else if (config.getSelectedApiType().equals(ApiType.MONITOR)) { return new ModelAndView(getRedirectView(AuthType.JWT)); } else { @@ -56,10 +92,51 @@ else if (config.getApiName().equals("MONITOR")) { } } + @GetMapping(path = "/ds/selectApi") + public Object choseApiType() { + return new ModelAndView("pages/ds_select_api"); + } + + @RequestMapping(path = "/ds/selectApi", method = RequestMethod.POST) + public Object getApiType(ModelMap model, @RequestBody MultiValueMap formParams) throws IOException, URISyntaxException { + if (!formParams.containsKey("selectApiType")) { + model.addAttribute("message", "Select option with selectApiType name must be provided."); + return new RedirectView("pages/error"); + } + List selectApiTypeObject = formParams.get("selectApiType"); + ApiType apiTypeSelected = ApiType.valueOf(selectApiTypeObject.get(0)); + writeApiTypeIntoFile(apiTypeSelected); + + return new ModelAndView("pages/ds_restart"); + } + + private void writeApiTypeIntoFile(ApiType apiTypeSelected) throws URISyntaxException, IOException { + JSONObject currentApiType = new JSONObject(); + currentApiType.put(config.getApiTypeHeader(), apiTypeSelected.name()); + + Path exampleApiSourcePath = Paths.get("").resolve("src").resolve("main") + .resolve("resources").resolve(config.getExamplesApiPath()); + if (Files.exists(exampleApiSourcePath)) { + try (BufferedWriter bufferedWriter = new BufferedWriter( + new FileWriter(exampleApiSourcePath.toAbsolutePath().toString())) + ) { + bufferedWriter.write(currentApiType.toString()); + } + } else { + // Works in case we create war and run it on 'tomcat' server + URL exampleApiURL = getClass().getClassLoader().getResource(config.getExamplesApiPath()); + try (BufferedWriter bufferedWriter = new BufferedWriter( + new FileWriter(new File(Objects.requireNonNull(exampleApiURL).toURI()))) + ) { + bufferedWriter.write(currentApiType.toString()); + } + } + } + @RequestMapping(path = "/ds/authenticate", method = RequestMethod.POST) public RedirectView authenticate(ModelMap model, @RequestBody MultiValueMap formParams) { if (!formParams.containsKey("selectAuthType")) { - model.addAttribute("message", "select option with selectAuthType name must be provided"); + model.addAttribute("message", "Select option with selectAuthType name must be provided."); return new RedirectView("pages/error"); } List selectAuthTypeObject = formParams.get("selectAuthType"); diff --git a/src/main/java/com/docusign/core/model/ApiType.java b/src/main/java/com/docusign/core/model/ApiType.java new file mode 100644 index 00000000..a4319a62 --- /dev/null +++ b/src/main/java/com/docusign/core/model/ApiType.java @@ -0,0 +1,25 @@ +package com.docusign.core.model; + +public enum ApiType { + ESIGNATURE("eSignature API", new String[]{"signature"}), + ROOMS("Rooms API", new String[]{"signature", "dtr.rooms.read", "dtr.rooms.write", "dtr.documents.read", "dtr.documents.write", "dtr.profile.read", "dtr.profile.write", "dtr.company.read", "dtr.company.write", "room_forms"}), + CLICK("Click API", new String[] {"click.manage", "click.send"}), + MONITOR("Monitor API", new String[] {"signature", "impersonation"}), + ADMIN("Admin API", new String[] {"user_write", "signature", "impersonation", "group_read", "organization_read", "permission_read", "user_read", "account_read", "domain_read", "identity_provider_read"}); + + final String value; + final String[] scopes; + + ApiType(String value, String[] scopes) { + this.value = value; + this.scopes = scopes; + } + + public String getValue() { + return value; + } + + public String[] getScopes() { + return scopes; + } +} \ No newline at end of file diff --git a/src/main/java/com/docusign/core/model/ApiTypeItem.java b/src/main/java/com/docusign/core/model/ApiTypeItem.java new file mode 100644 index 00000000..65ace8db --- /dev/null +++ b/src/main/java/com/docusign/core/model/ApiTypeItem.java @@ -0,0 +1,46 @@ +package com.docusign.core.model; + +import java.util.EnumSet; +import java.util.List; +import java.util.stream.Collectors; + +public class ApiTypeItem { + + private String key; + private String value; + + public ApiTypeItem(String key, String value) { + this.key = key; + this.value = value; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public static ApiTypeItem convert(ApiType apiType) { + return new ApiTypeItem(apiType.name(), apiType.value); + } + + public static ApiType convert(ApiTypeItem apiType) { + return ApiType.valueOf(apiType.key); + } + + public static List list() { + return EnumSet.allOf(ApiType.class).stream() + .map(ApiTypeItem::convert) + .collect(Collectors.toList()); + } +} diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 27e5d603..46e6106b 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -2,15 +2,14 @@ import com.docusign.DSConfiguration; import com.docusign.core.exception.LauncherException; +import com.docusign.core.model.ApiType; import com.docusign.esign.client.ApiClient; -import com.docusign.esign.client.auth.OAuth; import lombok.Getter; import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.FileSystemResource; import org.springframework.security.oauth2.client.token.grant.redirect.AbstractRedirectResourceDetails; import org.springframework.util.FileCopyUtils; - import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -22,6 +21,7 @@ public class JWTAuthorizationCodeResourceDetails extends AbstractRedirectResourc private String privateKeyPath; private String impersonatedUserGuid; private String baseUrl; + @Autowired private DSConfiguration dsConfiguration; @@ -43,8 +43,11 @@ public ApiClient getApiClient() { return apiClient; } - public List getScopeByApiName(){ - //Only signature scope is needed for eSignature api. Impersonation scope is implied. - return getScope(); + + public List getScopes() throws IOException { + ApiType apiType = dsConfiguration.getSelectedApiType(); + + return Arrays.asList(apiType.getScopes()); + } } diff --git a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java index 61acf12f..1eac3cc9 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTOAuth2RestTemplate.java @@ -47,7 +47,7 @@ public OAuth2AccessToken getAccessToken() throws UserRedirectRequiredException { context.setAccessToken(null); try { throw e; - } catch (LauncherException ex) { + } catch (IOException ex) { ex.printStackTrace(); } } @@ -55,10 +55,10 @@ public OAuth2AccessToken getAccessToken() throws UserRedirectRequiredException { return accessToken; } - private OAuth2AccessToken accessToken() throws LauncherException { + private OAuth2AccessToken accessToken() throws IOException { logger.info("Fetching an access token via JWT grant..."); // Only signature scope is needed. Impersonation scope is implied. - List scopes = resource.getScopeByApiName(); + List scopes = resource.getScopes(); byte[] privateKeyBytes; try { privateKeyBytes = resource.getRsaBytes(); diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index a1f322d0..2fbc095e 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -4,13 +4,6 @@ "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", - "DS_API_NAME": { - "ESIGNATURE": true, - "ROOMS": false, - "CLICK": false, - "MONITOR": false, - "ADMIN": false - }, "DS_BASE_PATH": "https://demo.docusign.net", "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", "DS_CLICK_BASE_PATH": "https://demo.docusign.net", diff --git a/src/main/resources/examplesApi.json b/src/main/resources/examplesApi.json new file mode 100644 index 00000000..1cb9c700 --- /dev/null +++ b/src/main/resources/examplesApi.json @@ -0,0 +1 @@ +{"ApiType":"ESIGNATURE"} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_restart.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_restart.jsp new file mode 100644 index 00000000..5adae759 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_restart.jsp @@ -0,0 +1,14 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +
+
+

Please restart the app to finish switching to a new API.

+

+ Quit the current app with Control + C, then run + mvn package followed by + java -Dspring.profiles.active=dev -jar target/code-examples-java-1.0-SNAPSHOT.war + again or rerun it using the Run button in IntelliJ Ultimate or Eclipse. +

+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp new file mode 100644 index 00000000..308ab905 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp @@ -0,0 +1,21 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +
+

Please choose an API

+

Please choose your API type

+
+
+ +
+

+ +

+ +
+
+
diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 82fe0f85..a516d1d7 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -21,19 +21,6 @@ - - - - <% - // New location to be redirected - String site = new String("/eg001"); - response.setStatus(response.SC_MOVED_TEMPORARILY); - response.setHeader("Location", site); - %> - - - -

Documentation on using OAuth Authorization Code Grant from a Java application.

diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 1d9b9295..00dd3e87 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -1,7 +1,6 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -
diff --git a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp index 1500afd7..97ed149f 100644 --- a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp +++ b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp @@ -45,6 +45,10 @@ +
  • + Choose API(current) +
  • From 93af7f9812f96291d0069b31e594e6728a622668 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Thu, 31 Mar 2022 15:41:26 -0700 Subject: [PATCH 280/699] bump springboot versions --- .factorypath | 90 ++++++++++++++++++++++++++-------------------------- pom.xml | 2 +- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.factorypath b/.factorypath index fede0e09..c6680dc0 100644 --- a/.factorypath +++ b/.factorypath @@ -1,60 +1,60 @@ - - - - - - - - + + + + + + + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - + - + - + - - - + + + - - - - + + + + @@ -65,10 +65,10 @@ - + - + @@ -76,15 +76,15 @@ - - + + - + - + diff --git a/pom.xml b/pom.xml index 3eca333e..df4c9e1b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.5.3 + 2.5.12 From a178e135903506a6f5edd74e831528b43577c2d2 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 14 Apr 2022 13:24:48 -0700 Subject: [PATCH 281/699] removed some old selectAPI code (#56) --- code-examples-java.iml | 90 +++++++++---------- .../java/com/docusign/DSConfiguration.java | 7 -- .../com/docusign/common/SelectedApiTypes.java | 29 ------ 3 files changed, 45 insertions(+), 81 deletions(-) delete mode 100644 src/main/java/com/docusign/common/SelectedApiTypes.java diff --git a/code-examples-java.iml b/code-examples-java.iml index f7b11414..5aa6a87b 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -27,62 +27,62 @@ - - - - - - - - + + + + + + + + - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - + - + - + - - - + + + - - - - + + + + @@ -93,10 +93,10 @@ - + - + @@ -104,15 +104,15 @@ - - + + - + - + diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index b00dd3d1..326c1efa 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -2,15 +2,12 @@ import com.docusign.common.ApiIndex; -import com.docusign.common.SelectedApiTypes; import com.docusign.core.model.ApiType; import lombok.Getter; import lombok.Setter; import org.apache.commons.lang3.EnumUtils; import org.json.JSONException; import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; - import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Component; @@ -37,10 +34,6 @@ public class DSConfiguration { @Value("${DS_APP_URL}") private String appUrl; - - @Autowired - private SelectedApiTypes apiName; - @Value("${DS_BASE_PATH}") private String basePath; diff --git a/src/main/java/com/docusign/common/SelectedApiTypes.java b/src/main/java/com/docusign/common/SelectedApiTypes.java deleted file mode 100644 index 267a2d1c..00000000 --- a/src/main/java/com/docusign/common/SelectedApiTypes.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.docusign.common; - -import lombok.Getter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -@Component -@Getter -public class SelectedApiTypes { - @Value("${DS_API_NAME.ESIGNATURE}") - private Boolean ESIGNATURE; - @Value("${DS_API_NAME.ROOMS}") - private Boolean ROOMS; - @Value("${DS_API_NAME.CLICK}") - private Boolean CLICK; - @Value("${DS_API_NAME.MONITOR}") - private Boolean MONITOR; - @Value("${DS_API_NAME.ADMIN}") - private Boolean ADMIN; - - public String getFirstSelectedApi() { - return (ESIGNATURE)? ApiIndex.ESIGNATURE.name() - : (ROOMS)? ApiIndex.ROOMS.name() - : (CLICK)? ApiIndex.CLICK.name() - : (MONITOR)? ApiIndex.MONITOR.name() - : (ADMIN)? ApiIndex.ADMIN.name() - : null; - } -} From 460fce6b0d491dbf213c4d6b03c900a8f05b2b50 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Sun, 17 Apr 2022 19:43:24 -0700 Subject: [PATCH 282/699] Devdocs-7317 Updates readme to link back to the JWT grant directions --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f7dcb6ba..96951436 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,8 @@ IntelliJ IDEA can be used with the launcher. The [IntelliJ IDEA Ultimate edition When prompted, log in to your DocuSign developer account. If this is your first time using the app, select **ACCEPT** at the consent window. 1. [Optional] Download [lombok.jar](https://projectlombok.org/downloads/lombok.jar) to your local machine, then run the following command to install Lombok: `java -jar lombok.jar` +## JWT grant remote signing project +See [DocuSign Quickstart overview](https://developers.docusign.com/docs/esign-rest-api/quickstart/overview/) on the DocuSign Developer Center for more information on how to run the JWT grant remote signing project. ## Payments code example From ddd8be70eee7b7ea710c5c2cf652fdf91019fb2c Mon Sep 17 00:00:00 2001 From: Majid Mallis Date: Mon, 18 Apr 2022 00:17:02 -0700 Subject: [PATCH 283/699] Open default browser using AWT Desktop browse More docs here https://docs.oracle.com/javase/9/docs/api/java/awt/Desktop.html#browse-java.net.URI- --- src/main/java/com/docusign/App.java | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index 975393f5..6ef121e1 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -2,10 +2,13 @@ import java.io.IOException; import java.net.URI; +import java.net.URISyntaxException; import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystems; import java.util.Collections; +import java.awt.Desktop; + import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -22,24 +25,12 @@ public static void main(String[] args) throws IOException { } private static void openHomePage() throws IOException { - // Each operating system opens web browsers differently so we need to determine the user's - // OS and open a browser to the example homepage accordingly. - Runtime rt = Runtime.getRuntime(); - if (OSDetector.isMac()){ - String[] arguments = { "osascript", "-e", "open location \"" + "http://localhost:8080" + "\"" }; - rt.exec(arguments); - } - else if (OSDetector.isWindows()){ - rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); - } - else if (OSDetector.isLinux()){ - String [] browsers = {"firefox", "safari", "chrome", "mozilla"}; - StringBuffer cmd = new StringBuffer(); - for (int i=0; i Date: Mon, 18 Apr 2022 13:15:17 -0700 Subject: [PATCH 284/699] Updating package to latest eSign SDK and fixing issues related to SS/DR --- .factorypath | 6 +++--- pom.xml | 4 ++-- .../examples/EG035ControllerScheduledSending.java | 4 ++-- .../examples/EG036ControllerDelayedRouting.java | 4 ++-- .../eSignature/services/DelayedRoutingService.java | 5 ++--- .../eSignature/services/ScheduledSendlingService.java | 8 ++++---- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.factorypath b/.factorypath index c6680dc0..e4dde82b 100644 --- a/.factorypath +++ b/.factorypath @@ -43,7 +43,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -88,7 +88,7 @@ - + diff --git a/pom.xml b/pom.xml index df4c9e1b..f02ae3f2 100644 --- a/pom.xml +++ b/pom.xml @@ -20,10 +20,10 @@ 11 2.5.6 2.11.0 - 3.17.1 + 3.18.0 1.1.0 1.0.0 - 1.0.0 + 1.1.0 1.0.0-BETA diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java index 37888f60..fed6ea91 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java @@ -14,9 +14,9 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeDelayRuleApiModel; +import com.docusign.esign.model.EnvelopeDelayRule; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.ScheduledSendingApiModel; +import com.docusign.esign.model.ScheduledSending; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; import com.docusign.esign.model.Workflow; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java index 415a6c1c..2cc4be3d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java @@ -8,9 +8,9 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.DelayedRoutingApiModel; +import com.docusign.esign.model.DelayedRouting; import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeDelayRuleApiModel; +import com.docusign.esign.model.EnvelopeDelayRule; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; diff --git a/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java b/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java index 5362c744..51766c6d 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java @@ -1,6 +1,5 @@ package com.docusign.controller.eSignature.services; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.model.*; @@ -74,10 +73,10 @@ public static EnvelopeDefinition makeEnvelope( // Add the workflow to delay the second recipient String delayFormatted = delay + ":00:00"; - EnvelopeDelayRuleApiModel rule = new EnvelopeDelayRuleApiModel(); + EnvelopeDelayRule rule = new EnvelopeDelayRule(); rule.setDelay(delayFormatted); - DelayedRoutingApiModel delayedRouting = new DelayedRoutingApiModel(); + DelayedRouting delayedRouting = new DelayedRouting(); delayedRouting.setRules(Arrays.asList(rule)); WorkflowStep workflowStep = new WorkflowStep(); diff --git a/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java b/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java index f50c458d..f9977004 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java @@ -51,15 +51,15 @@ public static EnvelopeDefinition makeEnvelope( envelope.setRecipients(EnvelopeHelpers.createSingleRecipient(signer)); // Add the workflow to schedule the envelope with a delay - EnvelopeDelayRuleApiModel delayRule = new EnvelopeDelayRuleApiModel(); + EnvelopeDelayRule delayRule = new EnvelopeDelayRule(); delayRule.setResumeDate(resumeDate+"T00:00:00Z"); - ScheduledSendingApiModel scheduledSendingApiModel = new ScheduledSendingApiModel(); - scheduledSendingApiModel.setRules(Arrays.asList(delayRule)); + ScheduledSending scheduledSending = new ScheduledSending(); + scheduledSending.setRules(Arrays.asList(delayRule)); Workflow workflow = new Workflow(); - workflow.setScheduledSending(scheduledSendingApiModel); + workflow.setScheduledSending(scheduledSending); envelope.setWorkflow(workflow); // Request that the envelope be sent by setting |status| to "sent". From 8892be3731d1496efa4781e086719f7efa8d7658 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 18 Apr 2022 14:37:33 -0700 Subject: [PATCH 285/699] Updating SDK versions --- pom.xml | 4 ++-- .../examples/EG035ControllerScheduledSending.java | 4 ++-- .../examples/EG036ControllerDelayedRouting.java | 4 ++-- .../eSignature/services/DelayedRoutingService.java | 5 ++--- .../eSignature/services/ScheduledSendlingService.java | 8 ++++---- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index df4c9e1b..f02ae3f2 100644 --- a/pom.xml +++ b/pom.xml @@ -20,10 +20,10 @@ 11 2.5.6 2.11.0 - 3.17.1 + 3.18.0 1.1.0 1.0.0 - 1.0.0 + 1.1.0 1.0.0-BETA diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java index 37888f60..fed6ea91 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java @@ -14,9 +14,9 @@ import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeDelayRuleApiModel; +import com.docusign.esign.model.EnvelopeDelayRule; import com.docusign.esign.model.EnvelopeSummary; -import com.docusign.esign.model.ScheduledSendingApiModel; +import com.docusign.esign.model.ScheduledSending; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; import com.docusign.esign.model.Workflow; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java index 415a6c1c..2cc4be3d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java @@ -8,9 +8,9 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiException; -import com.docusign.esign.model.DelayedRoutingApiModel; +import com.docusign.esign.model.DelayedRouting; import com.docusign.esign.model.EnvelopeDefinition; -import com.docusign.esign.model.EnvelopeDelayRuleApiModel; +import com.docusign.esign.model.EnvelopeDelayRule; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.Signer; import com.docusign.esign.model.Tabs; diff --git a/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java b/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java index 5362c744..51766c6d 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/DelayedRoutingService.java @@ -1,6 +1,5 @@ package com.docusign.controller.eSignature.services; -import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.EnvelopeHelpers; import com.docusign.esign.model.*; @@ -74,10 +73,10 @@ public static EnvelopeDefinition makeEnvelope( // Add the workflow to delay the second recipient String delayFormatted = delay + ":00:00"; - EnvelopeDelayRuleApiModel rule = new EnvelopeDelayRuleApiModel(); + EnvelopeDelayRule rule = new EnvelopeDelayRule(); rule.setDelay(delayFormatted); - DelayedRoutingApiModel delayedRouting = new DelayedRoutingApiModel(); + DelayedRouting delayedRouting = new DelayedRouting(); delayedRouting.setRules(Arrays.asList(rule)); WorkflowStep workflowStep = new WorkflowStep(); diff --git a/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java b/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java index f50c458d..f9977004 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/ScheduledSendlingService.java @@ -51,15 +51,15 @@ public static EnvelopeDefinition makeEnvelope( envelope.setRecipients(EnvelopeHelpers.createSingleRecipient(signer)); // Add the workflow to schedule the envelope with a delay - EnvelopeDelayRuleApiModel delayRule = new EnvelopeDelayRuleApiModel(); + EnvelopeDelayRule delayRule = new EnvelopeDelayRule(); delayRule.setResumeDate(resumeDate+"T00:00:00Z"); - ScheduledSendingApiModel scheduledSendingApiModel = new ScheduledSendingApiModel(); - scheduledSendingApiModel.setRules(Arrays.asList(delayRule)); + ScheduledSending scheduledSending = new ScheduledSending(); + scheduledSending.setRules(Arrays.asList(delayRule)); Workflow workflow = new Workflow(); - workflow.setScheduledSending(scheduledSendingApiModel); + workflow.setScheduledSending(scheduledSending); envelope.setWorkflow(workflow); // Request that the envelope be sent by setting |status| to "sent". From defd8bd52a083b5eeb9243d484aa0dd7e94f97cb Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Wed, 20 Apr 2022 22:28:12 +0300 Subject: [PATCH 286/699] Add responsive signing example (#54) * added a responsive signing code example * Added a link to eSignature homepage * Added a different way to add sign here tab * moved the return statement outside of the try/catch block --- .../EG038ControllerResponsiveSigning.java | 87 ++++++++++++++++++ .../eSignature/examples/EnvelopeHelpers.java | 22 ++++- .../services/AddDocToTemplateService.java | 4 +- .../services/CollectPaymentService.java | 4 +- .../services/ResponsiveSigningService.java | 88 +++++++++++++++++++ .../services/SendBinaryDocsService.java | 3 +- .../services/SigningViaEmailService.java | 4 +- .../views/pages/esignature/examples/eg038.jsp | 48 ++++++++++ .../views/pages/esignature/index.jsp | 10 +++ 9 files changed, 263 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java new file mode 100644 index 00000000..16172bac --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java @@ -0,0 +1,87 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.ResponsiveSigningService; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.RecipientViewRequest; +import com.docusign.esign.model.ViewUrl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.view.RedirectView; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Controller +@RequestMapping("/eg038") +public class EG038ControllerResponsiveSigning extends AbstractEsignatureController { + private final Session session; + private final User user; + private static final String SIGNER_CLIENT_ID = "1000"; + private static final String FEATURE_WAS_DISABLED = "Please enable this feature in the developer account and try again."; + + @Autowired + public EG038ControllerResponsiveSigning(DSConfiguration config, Session session, User user) { + super(config, "eg038", "Use responsive signing"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + String signerName = args.getSignerName(); + String signerEmail = args.getSignerEmail(); + String ccName = args.getCcName(); + String ccEmail = args.getCcEmail(); + String accountId = session.getAccountId(); + ViewUrl viewUrl = null; + + EnvelopeDefinition envelope = ResponsiveSigningService.makeEnvelope( + signerEmail, + signerName, + SIGNER_CLIENT_ID, + ccEmail, + ccName, + args); + + ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + + try { + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + + String envelopeId = envelopeSummary.getEnvelopeId(); + + RecipientViewRequest viewRequest = ResponsiveSigningService.makeRecipientViewRequest( + signerEmail, + signerName, + config, + SIGNER_CLIENT_ID); + + viewUrl = ResponsiveSigningService.responsiveSigning( + envelopesApi, + accountId, + envelopeId, + viewRequest); + + + } catch (ApiException apiException) { + DoneExample.createDefault(this.title) + .withMessage(FEATURE_WAS_DISABLED) + .addToModel(model); + } + + return new RedirectView(viewUrl.getUrl()); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java index f0b6492b..65523d32 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EnvelopeHelpers.java @@ -81,13 +81,13 @@ static Template loadHtmlTemplate(String path) throws IOException { * @return array of bytes representing created html document * @throws IOException in case of template parsing error */ - static byte[] createHtmlFromTemplate(Template template, String objectName, Object value) throws IOException { + static String createHtmlFromTemplate(Template template, String objectName, Object value) throws IOException { Map input = new HashMap<>(); input.put(objectName, value); StringWriter stringWriter = new StringWriter(); try { template.process(input, stringWriter); - return stringWriter.toString().getBytes(StandardCharsets.UTF_8); + return stringWriter.toString(); } catch (TemplateException exception) { throw new ExampleException("Can't process html template " + template.getName(), exception); } @@ -104,7 +104,23 @@ static byte[] createHtmlFromTemplate(Template template, String objectName, Objec * @return array of bytes representing created html document * @throws IOException in case of I/O errors or template parsing error */ - public static byte[] createHtmlFromTemplateFile(String path, String objectName, Object value) throws IOException { + public static byte[] createHtmlFromTemplateFileInByte(String path, String objectName, Object value) throws IOException { + Template template = loadHtmlTemplate(path); + return createHtmlFromTemplate(template, objectName, value).getBytes(StandardCharsets.UTF_8); + } + + /** + * Generates a html document from the template file. Placeholder looks like + * ${objectName.fieldName}. It is a convenient method which loads template + * from a file using {@link #loadHtmlTemplate(String)} and creates a html + * page from the loaded template using {@link #createHtmlFromTemplate(Template, String, Object)} + * @param path the path to template file + * @param objectName name of object to find placeholder related to a value + * @param value object which fields are used as a values in the template + * @return array of bytes representing created html document + * @throws IOException in case of I/O errors or template parsing error + */ + public static String createHtmlFromTemplateFile(String path, String objectName, Object value) throws IOException { Template template = loadHtmlTemplate(path); return createHtmlFromTemplate(template, objectName, value); } diff --git a/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java index 29ab8fcd..13fd4a76 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/AddDocToTemplateService.java @@ -8,6 +8,7 @@ import com.docusign.esign.model.*; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; @@ -125,7 +126,8 @@ private static EnvelopeDefinition makeEnvelope( signer1AddedDoc.setTabs(signer1Tabs); // create the HTML document - byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args) + .getBytes(StandardCharsets.UTF_8); // create a composite template for the added document and add the recipients via an inlineTemplate CompositeTemplate compTemplate2 = new CompositeTemplate(); diff --git a/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java b/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java index 224bf507..6d912b8e 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/CollectPaymentService.java @@ -8,6 +8,7 @@ import com.docusign.esign.model.*; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.Collections; @@ -53,7 +54,8 @@ public static EnvelopeDefinition makeEnvelope( String gatewayDisplayName, WorkArguments args ) throws IOException { - byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + byte[] htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args) + .getBytes(StandardCharsets.UTF_8); // create a signer recipient to sign the document, identified by name and email // routingOrder (lower means earlier) determines the order of deliveries diff --git a/src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java new file mode 100644 index 00000000..b94f6282 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java @@ -0,0 +1,88 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; + +public final class ResponsiveSigningService { + private static final String HTML_DOCUMENT_FILE_NAME = "templates/order-form.ftl"; + + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String signerClientId, + String ccEmail, + String ccName, + WorkArguments args + ) throws IOException { + String htmlDoc = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + htmlDoc = htmlDoc.replace("/sn1/", "") + .replace("/l1q/", " ") + .replace("/l2q/", " ");; + + Signer signer = new Signer() + .email(signerEmail) + .name(signerName) + .clientUserId(signerClientId) + .recipientId("1") + .routingOrder("1") + .roleName("Signer"); + + CarbonCopy cc = new CarbonCopy() + .email(ccEmail) + .name(ccName) + .recipientId("2") + .routingOrder("1"); + + EnvelopeDefinition envelope = new EnvelopeDefinition(); + envelope.setEmailSubject("Example Signing Document"); + envelope.setDocuments(Collections.singletonList( + new Document() + .name("Lorem Ipsum") + .documentId("1") + .htmlDefinition(new DocumentHtmlDefinition().source(htmlDoc)))); + envelope.setRecipients(EnvelopeHelpers.createRecipients(signer, cc)); + envelope.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelope; + } + + public static ViewUrl responsiveSigning( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + DSConfiguration config, + String clientUserId + ) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + String stateValue = "?state=123"; + viewRequest.setReturnUrl(config.getDsReturnUrl() + stateValue); + + String authenticationMethod = "none"; + viewRequest.setAuthenticationMethod(authenticationMethod); + + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(clientUserId); + + String pingFrequency = "600"; + viewRequest.setPingFrequency(pingFrequency); + viewRequest.setPingUrl(config.getDsPingUrl()); + + return viewRequest; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java index 9c3da4d1..1ea9bb41 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java @@ -51,7 +51,8 @@ public static String sendBinaryDocs( // Step 1. Gather documents and their headers List documents = List.of( new DocumentInfo(HTML_DOCUMENT_NAME, "1", DocumentType.HTML, - EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args)), + EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args) + .getBytes(StandardCharsets.UTF_8)), new DocumentInfo(DOCX_DOCUMENT_NAME, "2", DocumentType.DOCX, EnvelopeHelpers.readFile(DOCX_DOCUMENT_FILE_NAME)), new DocumentInfo(PDF_DOCUMENT_NAME, "3", DocumentType.PDF, diff --git a/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java b/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java index a844b140..be3cf171 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SigningViaEmailService.java @@ -8,6 +8,7 @@ import com.docusign.esign.model.*; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; public final class SigningViaEmailService { @@ -74,7 +75,8 @@ public static EnvelopeDefinition makeEnvelope( cc.setRoutingOrder("2"); // The order in the docs array determines the order in the envelope - byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args); + byte[] htmlDocument = EnvelopeHelpers.createHtmlFromTemplateFile(HTML_DOCUMENT_FILE_NAME, "args", args) + .getBytes(StandardCharsets.UTF_8); EnvelopeDefinition envelope = new EnvelopeDefinition(); envelope.setEmailSubject("Please sign this document set"); envelope.setDocuments(Arrays.asList( diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp new file mode 100644 index 00000000..a01f59af --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp @@ -0,0 +1,48 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

    38. Signable HTML document

    +

    This example demonstrates how to create an HTML document for responsive signing.

    + + +

    Documentation about this example.

    +
    + +

    API method used: + Envelopes::create and + EnvelopeViews::createRecipient. +

    + +

    + View source file ${sourceFile} on GitHub. +

    + +
    +
    + + + We'll never share your email with anyone else. +
    +
    + + +
    +
    + + + The email for the cc recipient must be different from the signer's email. +
    +
    + + +
    + + + + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index a516d1d7..903f21f1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -343,7 +343,17 @@ href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create.

    +

    Responsive signing

    +

    38. Signable HTML document

    +

    + Demonstrates how to create an HTML document for responsive signing. +

    + API methods used: + Envelopes::create, + EnvelopeViews::createRecipient. +

    From 00c27cdbb7ffc5ac42cfac571fa84df1529a28ff Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 21 Apr 2022 17:56:30 -0700 Subject: [PATCH 287/699] update eSign38 title --- .../webapp/WEB-INF/templates/views/pages/esignature/index.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 903f21f1..bd3804ac 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -345,7 +345,7 @@

    Responsive signing

    -

    38. Signable HTML document

    +

    38. Create a signable HTML document

    Demonstrates how to create an HTML document for responsive signing.

    From c167a775b9d3c54878e069c1ef6f8d1a02b1cf95 Mon Sep 17 00:00:00 2001 From: meihDS <70775251+meihDS@users.noreply.github.com> Date: Thu, 21 Apr 2022 17:59:56 -0700 Subject: [PATCH 288/699] eSign38 page text changes --- .../templates/views/pages/esignature/examples/eg038.jsp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp index a01f59af..eaf87f22 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp @@ -1,14 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    38. Signable HTML document

    -

    This example demonstrates how to create an HTML document for responsive signing.

    +

    38. Create a signable HTML document

    +

    Demonstrates how to create an HTML document for responsive signing.

    Documentation about this example.

    -

    API method used: +

    API methods used: Envelopes::create and EnvelopeViews::createRecipient.

    From 789e31e0fa8e2083bf4831117242cf67b25c25de Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 26 Apr 2022 11:32:52 -0700 Subject: [PATCH 289/699] Fixed wrong id --- .../webapp/WEB-INF/templates/views/pages/esignature/index.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index bd3804ac..b318c378 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -312,7 +312,7 @@ Envelopes::create.

    -

    35. Schedule an envelope

    +

    35. Schedule an envelope

    Demonstrates how to schedule an envelope using the scheduled sending feature.

    From 0056d10fd3321cb8353003be38ee5ff41c744f7f Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 26 Apr 2022 11:33:53 -0700 Subject: [PATCH 290/699] Fixing wrong id element --- .../webapp/WEB-INF/templates/views/pages/esignature/index.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index bd3804ac..b318c378 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -312,7 +312,7 @@ Envelopes::create.

    -

    35. Schedule an envelope

    +

    35. Schedule an envelope

    Demonstrates how to schedule an envelope using the scheduled sending feature.

    From b5a8c4d043d0299f323d8d2e9ccf38a0ac1f1404 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Thu, 28 Apr 2022 20:23:44 -0700 Subject: [PATCH 291/699] added comment markers --- .../eSignature/examples/EG038ControllerResponsiveSigning.java | 2 ++ .../eSignature/services/ResponsiveSigningService.java | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java index 16172bac..48f8df91 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java @@ -38,6 +38,7 @@ public EG038ControllerResponsiveSigning(DSConfiguration config, Session session, } @Override + // Step 3 start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { String signerName = args.getSignerName(); @@ -84,4 +85,5 @@ protected Object doWork(WorkArguments args, ModelMap model, return new RedirectView(viewUrl.getUrl()); } + // Step 3 end } diff --git a/src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java index b94f6282..a4ce9af6 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/ResponsiveSigningService.java @@ -11,8 +11,8 @@ import java.util.Collections; public final class ResponsiveSigningService { + // Step 2 start private static final String HTML_DOCUMENT_FILE_NAME = "templates/order-form.ftl"; - public static EnvelopeDefinition makeEnvelope( String signerEmail, String signerName, @@ -85,4 +85,5 @@ public static RecipientViewRequest makeRecipientViewRequest( return viewRequest; } + // Step 2 end } From 9379a0d91bcaa20d907b1304f34cf1a878a1f0c6 Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Fri, 20 May 2022 11:12:38 +0300 Subject: [PATCH 292/699] Added post web query code example (#60) * Added a post web query code example * Text updates * fixed formatting * removed unused imports --- .../examples/M002WebQueryEndpoint.java | 81 +++++++++++++++++++ .../services/WebQueryEndpointService.java | 54 +++++++++++++ .../views/pages/monitor/examples/m002.jsp | 34 ++++++++ .../templates/views/pages/monitor/index.jsp | 10 ++- 4 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java create mode 100644 src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp diff --git a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java new file mode 100644 index 00000000..787a4f8a --- /dev/null +++ b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java @@ -0,0 +1,81 @@ +package com.docusign.controller.monitor.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.controller.monitor.services.WebQueryEndpointService; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +/** + * Get monitoring data
    + * This example demonstrates how to get monitoring data from the Monitor API. + */ +@Controller +@RequestMapping("/m002") +public class M002WebQueryEndpoint extends AbstractMonitorController { + + private static final String MODEL_START_DATE = "startDate"; + private static final String MODEL_END_DATE = "endDate"; + private static final int FROM_DATE_OFFSET_DAYS = 10; + private static final int FROM_DATE_FORWARD_DAYS = 1; + private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + private final Session session; + private final User user; + + @Autowired + public M002WebQueryEndpoint(DSConfiguration config, Session session, User user) { + super(config, "m002", "Query monitoring data with filters"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + + LocalDate endDate = LocalDate.now().plusDays(FROM_DATE_FORWARD_DAYS); + LocalDate startDate = LocalDate.now().minusDays(FROM_DATE_OFFSET_DAYS); + + model.addAttribute(MODEL_START_DATE, DATE_FORMATTER.format(startDate)); + model.addAttribute(MODEL_END_DATE, DATE_FORMATTER.format(endDate)); + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + String accessToken = this.user.getAccessToken(); + + // Check, if you are using the JWT authentication + // step 1 start + accessToken = ensureUsageOfJWTToken(accessToken, this.session); + String accountId = session.getAccountId(); + // step 1 end + + JSONObject queryResult = WebQueryEndpointService.postWebQueryMethod( + createDataSetApi(accessToken, this.session), + accountId, + args.getStartDate(), + args.getEndDate() + ); + + // Cleaning the data from unsupported symbols + String queryResultCleaned = queryResult.toString().replaceAll("'", ""); + + // Process results + DoneExample.createDefault(title) + .withMessage("Results from DataSet:postWebQuery method:") + .withJsonObject(queryResultCleaned) + .addToModel(model); + + return DONE_EXAMPLE_PAGE; + } +} diff --git a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java new file mode 100644 index 00000000..53a5628a --- /dev/null +++ b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java @@ -0,0 +1,54 @@ +package com.docusign.controller.monitor.services; + +import com.docusign.monitor.api.DataSetApi; +import com.docusign.monitor.model.AggregateResult; +import com.docusign.monitor.model.AggregateResultResult; +import com.docusign.monitor.model.WebQuery; +import com.docusign.monitor.client.ApiException; +import org.json.JSONObject; + +import java.util.List; + +public final class WebQueryEndpointService { + private static final String API_VERSION = "2.0"; + private static final String NAME_OF_DATASET = "monitor"; + public static JSONObject postWebQueryMethod( + DataSetApi datasetApi, + String accountId, + String filterStartDate, + String filterEndDate) throws ApiException { + AggregateResult aggregateResult = datasetApi.postWebQuery( + API_VERSION, + NAME_OF_DATASET, + prepareWebQueryOptions(accountId, filterStartDate, filterEndDate)); + + AggregateResultResult methodResult = null; + List aggregateResultList = aggregateResult.getResult(); + + if (aggregateResultList != null && !aggregateResultList.isEmpty()) { + methodResult = aggregateResultList.get(0); + } + + return new JSONObject(methodResult); + } + + private static WebQuery prepareWebQueryOptions(String accountId, String filterStartDate, String filterEndDate) { + WebQuery webQuery = new WebQuery(); + webQuery.addFiltersItem(new Object(){ + public String FilterName = "Time"; + public String BeginTime = filterStartDate; + public String EndTime = filterEndDate; + }); + webQuery.addFiltersItem(new Object(){ + public String FilterName = "Has"; + public String ColumnName = "AccountId"; + public String Value = accountId; + }); + webQuery.addAggregationsItem(new Object(){ + public String aggregationName = "Raw"; + public String limit = "1"; + public String[] orderby = new String[] { "Timestamp, desc" }; + }); + return webQuery; + } +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp new file mode 100644 index 00000000..2a1448f3 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp @@ -0,0 +1,34 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

    2. Query monitoring data with filters

    +

    Demonstrates how to query an organization's data based on specified filters and aggregations.

    +

    + API method used: + DataSet:postWebQuery. +

    +

    + View source file ${sourceFile} on GitHub. +

    + +

    + Please select start and end dates. +

    + +
    + +
    + + +
    +
    + + +
    + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 00dd3e87..43fe8181 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -26,9 +26,17 @@

    1. Get monitoring data

    Demonstrates how to get and display all of your organization's monitoring data.

    -

    API method used: +

    + API method used: DataSet:getStream

    + +

    2. Query monitoring data with filters

    +

    Demonstrates how to query an organization's data based on specified filters and aggregations.

    +

    + API method used: + DataSet:postWebQuery. +

    From a09c676671e2457579520e4630c6d77f4884e270 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Fri, 20 May 2022 01:30:38 -0700 Subject: [PATCH 293/699] gist markers --- .../monitor/examples/AbstractMonitorController.java | 4 +++- .../monitor/services/WebQueryEndpointService.java | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index 86807945..f4ecd579 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -40,9 +40,11 @@ protected String ensureUsageOfJWTToken(String accessToken, Session session) { * @return an instance of the {@link com.docusign.monitor.client.ApiClient} */ protected static ApiClient createApiClient(String accessToken, Session session) { + + // Step 2 start ApiClient apiClient = new ApiClient(session.getBasePath()); apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + accessToken); - + // Step 2 end return apiClient; } diff --git a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java index 53a5628a..3ea0f529 100644 --- a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java +++ b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java @@ -9,7 +9,9 @@ import java.util.List; + public final class WebQueryEndpointService { + // Step 4 start private static final String API_VERSION = "2.0"; private static final String NAME_OF_DATASET = "monitor"; public static JSONObject postWebQueryMethod( @@ -21,10 +23,10 @@ public static JSONObject postWebQueryMethod( API_VERSION, NAME_OF_DATASET, prepareWebQueryOptions(accountId, filterStartDate, filterEndDate)); - + AggregateResultResult methodResult = null; List aggregateResultList = aggregateResult.getResult(); - + // Step 4 end if (aggregateResultList != null && !aggregateResultList.isEmpty()) { methodResult = aggregateResultList.get(0); } @@ -32,6 +34,7 @@ public static JSONObject postWebQueryMethod( return new JSONObject(methodResult); } + // Step 3 start private static WebQuery prepareWebQueryOptions(String accountId, String filterStartDate, String filterEndDate) { WebQuery webQuery = new WebQuery(); webQuery.addFiltersItem(new Object(){ @@ -51,4 +54,6 @@ private static WebQuery prepareWebQueryOptions(String accountId, String filterSt }); return webQuery; } + // Step 3 end } + From 97a7aa038e2ae42b66f9245b6cf238c03b106ea1 Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Wed, 25 May 2022 04:56:22 +0300 Subject: [PATCH 294/699] Quick Authorization Code Grant project (#58) * added a ACG quickstart project * Removed the SelectedApiTypes.java class and references * Removed loading of the SelectedApiTypes.java class from the pom.xml * Fixed styling of the files * removed extra empty row * Moved file system provider url into separate variable * shrinked the quick_acg project * added imports * Fixed formatting for WebSecurityConfig file * fixed issue with redirecting for new user --- Quick_ACG/pom.xml | 236 ++++++++++++++++++ Quick_ACG/src/main/java/com/docusign/App.java | 59 +++++ .../java/com/docusign/DSConfiguration.java | 83 ++++++ .../java/com/docusign/WebSecurityConfig.java | 125 ++++++++++ .../AbstractEsignatureController.java | 118 +++++++++ .../core/controller/IndexController.java | 182 ++++++++++++++ .../java/com/docusign/core/model/Session.java | 37 +++ .../java/com/docusign/DSConfiguration.java | 11 +- .../EG001ControllerEmbeddedSigning.java | 2 +- src/main/resources/application.example.json | 1 + .../examples/quickEmbeddedSigning.jsp | 77 ++++++ 11 files changed, 928 insertions(+), 3 deletions(-) create mode 100644 Quick_ACG/pom.xml create mode 100644 Quick_ACG/src/main/java/com/docusign/App.java create mode 100644 Quick_ACG/src/main/java/com/docusign/DSConfiguration.java create mode 100644 Quick_ACG/src/main/java/com/docusign/WebSecurityConfig.java create mode 100644 Quick_ACG/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java create mode 100644 Quick_ACG/src/main/java/com/docusign/core/controller/IndexController.java create mode 100644 Quick_ACG/src/main/java/com/docusign/core/model/Session.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp diff --git a/Quick_ACG/pom.xml b/Quick_ACG/pom.xml new file mode 100644 index 00000000..b32d57c2 --- /dev/null +++ b/Quick_ACG/pom.xml @@ -0,0 +1,236 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.5.12 + + + + com.quickACG + code-examples-java-acg + 1.0-SNAPSHOT + + Docusign Java Tutorial + + + 11 + 2.5.6 + 2.11.0 + 3.17.1 + 1.1.0 + 1.0.0 + 1.0.0 + 1.0.0-BETA + + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + ${oauth2.version} + + + org.apache.commons + commons-lang3 + + + org.freemarker + freemarker + + + com.google.code.gson + gson + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + + + + + javax.servlet + jstl + + + + org.apache.tomcat.embed + tomcat-embed-jasper + provided + + + + commons-io + commons-io + ${commonsio.version} + + + com.docusign + docusign-esign-java + ${docusign.version} + + + + com.docusign + docusign-rooms-java + ${rooms.version} + + + + com.docusign + docusign-click-java + ${click.version} + + + + com.docusign + docusign-monitor-java + ${monitor.version} + + + + com.docusign + docusign-admin-java + ${admin.version} + + + + org.projectlombok + lombok + RELEASE + compile + + + org.springframework.boot + spring-boot-autoconfigure + 2.4.4 + + + + + + + maven-resources-plugin + 3.2.0 + + + copy-resource-one + generate-sources + + copy-resources + + + ${basedir} + + + ${basedir}/src/main/resources + ../src/main/resources + + application.json + World_Wide_Corp_lorem.pdf + + + + ${basedir}/src/main/resources/META-INF + ../src/main/resources/META-INF + + spring.factories + + + + ${basedir}/src/main/resources/public/assets + ../src/main/resources/public/assets + + favicon.ico + css.css + + + + ${basedir}/src/main/java/com/docusign + ../src/main/java/com/docusign + + JsonPropertySourceLoader.java + OSDetector.java + EG001ControllerEmbeddedSigning.java + + + + ${basedir}/src/main/java/com/docusign/common + ../src/main/java/com/docusign/common + + WorkArguments.java + + + + ${basedir}/src/main/java/com/docusign/controller/eSignature/examples + ../src/main/java/com/docusign/controller/eSignature/examples + + EnvelopeHelpers.java + ExampleException.java + + + + ${basedir}/src/main/java/com/docusign/controller/eSignature/services + ../src/main/java/com/docusign/controller/eSignature/services + + EmbeddedSigningService.java + + + + ${basedir}/src/main/java/com/docusign/core/model + ../src/main/java/com/docusign/core/model + + Locals.java + User.java + + + + ${basedir}/src/main/java/com/docusign/core/security + ../src/main/java/com/docusign/core/security + + OAuthProperties.java + + + + ${basedir}/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples + ../src/main/webapp/WEB-INF/templates/views/pages/esignature/examples + + quickEmbeddedSigning.jsp + + + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + + + + + org.bouncycastle + bcprov-jdk15on + 1.69 + + + + \ No newline at end of file diff --git a/Quick_ACG/src/main/java/com/docusign/App.java b/Quick_ACG/src/main/java/com/docusign/App.java new file mode 100644 index 00000000..ab51eaf1 --- /dev/null +++ b/Quick_ACG/src/main/java/com/docusign/App.java @@ -0,0 +1,59 @@ +package com.docusign; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.FileSystemAlreadyExistsException; +import java.nio.file.FileSystems; +import java.util.Collections; +import java.util.Properties; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; + +@Slf4j +@SpringBootApplication(exclude={JmxAutoConfiguration.class}) +public class App { + + public static void main(String[] args) throws IOException { + SpringApplication.run(App.class, args); + openHomePage(); + initFileSystem(); + } + + private static void openHomePage() throws IOException { + // Each operating system opens web browsers differently so we need to determine the user's + // OS and open a browser to the example homepage accordingly. + Runtime rt = Runtime.getRuntime(); + if (OSDetector.isMac()){ + String[] arguments = { "osascript", "-e", "open location \"" + "http://localhost:8080" + "\"" }; + rt.exec(arguments); + } + else if (OSDetector.isWindows()){ + rt.exec("rundll32 url.dll,FileProtocolHandler " + "http://localhost:8080"); + } + else if (OSDetector.isLinux()){ + String [] browsers = {"firefox", "safari", "chrome", "mozilla"}; + StringBuffer cmd = new StringBuffer(); + for (int i=0; i oAuth2ClientFilterRegistration(OAuth2ClientContextFilter oAuth2ClientContextFilter) { + FilterRegistrationBean registration = new FilterRegistrationBean<>(); + registration.setFilter(oAuth2ClientContextFilter); + registration.setOrder(-100); + return registration; + } + + private List getScopes() { + return Arrays.asList(new String[]{"signature"}); + } + + private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() throws IOException { + OAuth2SsoProperties authCodeGrantSso = authCodeGrantSso(); + AuthorizationCodeResourceDetails authCodeGrantClient = authCodeGrantClient(); + + List scopes = this.getScopes(); + if (scopes != null) { + authCodeGrantClient.setScope(scopes); + } + + ResourceServerProperties userInfoResource = userInfoResource(); + OAuth2ClientAuthenticationProcessingFilter filter = + new OAuth2ClientAuthenticationProcessingFilter(authCodeGrantSso.getLoginPath()); + OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(authCodeGrantClient, oAuth2ClientContext); + filter.setRestTemplate(restTemplate); + ResourceServerTokenServices tokenServices = new UserInfoTokenServices(userInfoResource.getUserInfoUri(), + authCodeGrantClient.getClientId()); + filter.setTokenServices(tokenServices); + return filter; + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .antMatcher("/**") + .authorizeRequests() + .antMatchers( "/", "/login**", "/error**", "/assets/**","/ds/mustAuthenticate**", + "/ds/authenticate**") + .permitAll() + .anyRequest() + .authenticated() + .and() + .exceptionHandling() + .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/ds/mustAuthenticate")) + .and() + .logout().logoutSuccessUrl("/").permitAll() + .and() + .csrf().disable(); + http.apply(new CombinedAuthenticationConfigurer(Arrays.asList(authCodeGrantFilter()))); + } + + private static class CombinedAuthenticationConfigurer + extends SecurityConfigurerAdapter { + + CompositeFilter filter = new CompositeFilter(); + + CombinedAuthenticationConfigurer(List filters) { + filter.setFilters(filters); + } + + @Override + public void configure(HttpSecurity builder) { + builder.addFilterAfter(this.filter, + AbstractPreAuthenticatedProcessingFilter.class); + } + } +} diff --git a/Quick_ACG/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java b/Quick_ACG/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java new file mode 100644 index 00000000..86a5d30e --- /dev/null +++ b/Quick_ACG/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java @@ -0,0 +1,118 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.Session; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.security.oauth2.client.OAuth2ClientContext; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; + +import javax.servlet.http.HttpServletResponse; +import java.util.Objects; + +/** + * Abstract base class for all eSignature controllers. + */ +@Controller +public abstract class AbstractEsignatureController { + + protected static final String BEARER_AUTHENTICATION = "Bearer "; + + @Autowired + private OAuth2ClientContext oAuth2ClientContext; + + @Autowired + protected Session session; + + protected final String exampleName; + protected final String title; + private final String pagePath; + protected final DSConfiguration config; + private static final String EXAMPLE_PAGES_PATH = "pages/esignature/examples/"; + + public AbstractEsignatureController(DSConfiguration config, String exampleName, String title) { + this.config = config; + this.exampleName = exampleName; + this.pagePath = this.getExamplePagesPath() + exampleName; + this.title = title; + } + + protected String getExamplePagesPath() { + return AbstractEsignatureController.EXAMPLE_PAGES_PATH; + } + + /** + * Creates new instance of the eSignature API client. + * @param basePath URL to eSignature REST API + * @param userAccessToken user's access token + * @return an instance of the {@link ApiClient} + */ + protected static ApiClient createApiClient(String basePath, String userAccessToken) { + ApiClient apiClient = new ApiClient(basePath); + apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken); + return apiClient; + } + + @GetMapping + public String get(WorkArguments args, ModelMap model) { + try { + onInitModel(args, model); + return pagePath; + } catch (Exception exception) { + return handleException(exception, model); + } + } + + @PostMapping + public Object create(WorkArguments args, ModelMap model, HttpServletResponse response) { + try { + return doWork(args, model, response); + } catch (Exception exception) { + return handleException(exception, model); + } + } + + /** + * This method is called from the GET request and it should initialize a + * model. Override this method if it is necessary to add example specific + * attributes into the model. + * @param args + * @param model the model data + */ + protected void onInitModel(WorkArguments args, ModelMap model) { + Class clazz = Objects.requireNonNullElse(getClass().getEnclosingClass(), getClass()); + String srcPath = String.join("", config.getExampleUrl(), clazz.getName().replace('.', '/'), ".java"); + model.addAttribute("csrfToken", ""); + model.addAttribute("title", title); + model.addAttribute("sourceFile", clazz.getSimpleName() + ".java"); + model.addAttribute("sourceUrl", srcPath); + model.addAttribute("documentation", config.getDocumentationPath() + exampleName); + } + + /** + * This method is called from the POST request. Example pages must override + * it. Overridden method should return an Object means URL to redirect. + * @param args the work arguments got from the current page + * @param model page model holder + * @param response for HTTP-specific functionality in sending a response + * @return {@link Object}. Possible types and values: null, + * {@link String} representation of the URL or Spring RedirectView object, + * (see {@link org.springframework.web.servlet.view.RedirectView RedirectView}) + * @throws Exception if calling API has failed or if I/O operation has failed + */ + protected abstract Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws Exception; + + private String handleException(Exception exception, ModelMap model) { + return ExceptionUtils.getStackTrace(exception); + } +} diff --git a/Quick_ACG/src/main/java/com/docusign/core/controller/IndexController.java b/Quick_ACG/src/main/java/com/docusign/core/controller/IndexController.java new file mode 100644 index 00000000..1f6a737a --- /dev/null +++ b/Quick_ACG/src/main/java/com/docusign/core/controller/IndexController.java @@ -0,0 +1,182 @@ +package com.docusign.core.controller; + +import com.docusign.DSConfiguration; +import com.docusign.core.model.Locals; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import java.io.IOException; +import java.util.*; + +import com.docusign.core.security.OAuthProperties; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.provider.OAuth2Authentication; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.view.RedirectView; +import com.docusign.esign.client.auth.OAuth; +import java.util.stream.Collectors; +import org.springframework.security.core.Authentication; +import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ModelAttribute; +import javax.servlet.http.HttpServletResponse; + +@Controller +@ControllerAdvice +@Scope(WebApplicationContext.SCOPE_SESSION) +public class IndexController { + private static final String ATTR_ENVELOPE_ID = "qpEnvelopeId"; + private static final String ATTR_STATE = "state"; + private static final String ATTR_EVENT = "event"; + private static final String ATTR_TITLE = "title"; + + private static final String ERROR_ACCOUNT_NOT_FOUND = "Could not find account information for the user"; + private static final String SELECTED_API_NOT_SUPPORTED = "Currently selected api is not supported by launcher. Please, check appsettings.json file."; + private final DSConfiguration config; + private final Session session; + private final User user; + private Optional account; + + @Autowired + private OAuthProperties authCodeGrantSso; + + @Autowired + public IndexController(DSConfiguration config, Session session, User user, Optional account) { + this.config = config; + this.session = session; + this.user = user; + this.account = account; + } + + @GetMapping(path = "/") + public String index(ModelMap model, HttpServletResponse response) throws IOException { + String site = "/eg001"; + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + return null; + } + + @GetMapping(path = "/ds/mustAuthenticate") + public ModelAndView mustAuthenticateController(ModelMap model) throws IOException { + return new ModelAndView(getRedirectView()); + } + + @GetMapping(path = "/ds-return") + public String returnController(@RequestParam(value = ATTR_STATE, required = false) String state, + @RequestParam(value = ATTR_EVENT, required = false) String event, + @RequestParam(value = "envelopeId", required = false) String envelopeId, ModelMap model, HttpServletResponse response) throws IOException { + String site = "/eg001"; + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + return null; + } + + private RedirectView getRedirectView() { + RedirectView redirect = new RedirectView(getLoginPath()); + redirect.setExposeModelAttributes(false); + return redirect; + } + + private String getLoginPath() { + return authCodeGrantSso.getLoginPath(); + } + + @ModelAttribute("documentOptions") + public List populateDocumentOptions() { + return new ArrayList<>(); + } + + @ModelAttribute("showDoc") + public boolean populateShowDoc() { + return StringUtils.isNotBlank(config.getDocumentationPath()); + } + + @ModelAttribute("locals") + public Object populateLocals() throws IOException { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + if (!(authentication instanceof OAuth2Authentication)) { + return new RedirectView("/"); + } + + OAuth2Authentication oauth = (OAuth2Authentication) authentication; + OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) oauth.getDetails(); + Authentication oauthUser = oauth.getUserAuthentication(); + + if (oauthUser != null && oauthUser.isAuthenticated()) { + user.setName(oauthUser.getName()); + user.setAccessToken(details.getTokenValue()); + + if (account.isEmpty()) { + account = Optional.ofNullable(getDefaultAccountInfo(getOAuthAccounts(oauth))); + } + + OAuth.Account oauthAccount = account.orElseThrow(() -> new NoSuchElementException(ERROR_ACCOUNT_NOT_FOUND)); + session.setAccountId(oauthAccount.getAccountId()); + session.setAccountName(oauthAccount.getAccountName()); + //TODO set this more efficiently with more APIs as they're added in + String basePath = this.getBaseUrl(oauthAccount) + "/restapi"; + session.setBasePath(basePath); + } + + return new Locals(config, session, user, ""); + } + + private String getBaseUrl(OAuth.Account oauthAccount) { + return oauthAccount.getBaseUri(); + } + + @SuppressWarnings("unchecked") + private static List getOAuthAccounts(OAuth2Authentication oauth) { + Map userAuthenticationDetails = (Map) oauth.getUserAuthentication().getDetails(); + List> oauthAccounts = (ArrayList>) userAuthenticationDetails.get("accounts"); + return oauthAccounts.stream() + .map(IndexController::convert) + .collect(Collectors.toList()); + } + + private OAuth.Account getDefaultAccountInfo(List accounts) { + String targetAccountId = config.getTargetAccountId(); + if (StringUtils.isNotBlank(targetAccountId)) { + OAuth.Account account = getAccountById(accounts, targetAccountId); + if(account != null) { + return account; + } + } + return getDefaultAccount(accounts); + } + + private static OAuth.Account getDefaultAccount(List accounts) { + for (OAuth.Account oauthAccount : accounts) { + if ("true".equals(oauthAccount.getIsDefault())) { + return oauthAccount; + } + } + return null; + } + + private static OAuth.Account getAccountById(List accounts, String accountId) { + for (OAuth.Account oauthAccount : accounts) { + if (StringUtils.equals(oauthAccount.getAccountId(), accountId)) { + return oauthAccount; + } + } + return null; + } + + public static OAuth.Account convert(Map account) { + OAuth.Account res = new OAuth.Account(); + res.setAccountId((String) account.get("account_id")); + res.setIsDefault(String.valueOf(account.get("is_default"))); + res.setAccountName((String) account.get("account_name")); + res.setBaseUri((String) account.get("base_uri")); + return res; + } +} diff --git a/Quick_ACG/src/main/java/com/docusign/core/model/Session.java b/Quick_ACG/src/main/java/com/docusign/core/model/Session.java new file mode 100644 index 00000000..77c4061e --- /dev/null +++ b/Quick_ACG/src/main/java/com/docusign/core/model/Session.java @@ -0,0 +1,37 @@ +package com.docusign.core.model; + +import lombok.Data; +import org.springframework.context.annotation.Scope; +import org.springframework.context.annotation.ScopedProxyMode; +import org.springframework.stereotype.Component; +import org.springframework.web.context.WebApplicationContext; + +import java.io.Serializable; +import java.util.List; +import java.util.UUID; + +@Component +@Scope(value = WebApplicationContext.SCOPE_SESSION, + proxyMode = ScopedProxyMode.TARGET_CLASS) +@Data +public class Session implements Serializable { + private static final long serialVersionUID = 2695379118371574037L; + + private String accountId; + private String accountName; + private String basePath; + private String roomsBasePath; + private String envelopeId; + private String templateId; + private String templateName; + private String permissionProfileId; + private String permissionProfileName; + private String apiIndexPath; + private boolean refreshToken = false; + private String clickwrapId; + private String clickwrapVersionNumber; + private String exportId; + private String importId; + private UUID orgId; + public UUID bulkListId; +} diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index 326c1efa..ab5d6e47 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -36,7 +36,7 @@ public class DSConfiguration { @Value("${DS_BASE_PATH}") private String basePath; - + @Value("${DS_ROOMS_BASE_PATH}") private String roomsBasePath; @@ -61,6 +61,9 @@ public class DSConfiguration { @Value("${quickstart:{quickstart}}") private String quickstart; + @Value("${quickACG:{quickACG}}") + private String quickACG; + @Value("${DS_MONITOR_BASE_PATH}") private String monitorBasePath; @@ -92,6 +95,10 @@ private String getSelectedApi() throws IOException { return selectedApiType; } + if(Boolean.valueOf(quickACG)){ + return ApiIndex.ESIGNATURE.name(); + } + ClassPathResource resource = new ClassPathResource(examplesApiPath); String source = StreamUtils.copyToString(resource.getInputStream(), StandardCharsets.UTF_8); try { @@ -105,4 +112,4 @@ private String getSelectedApi() throws IOException { } return selectedApiType; } -} +} \ No newline at end of file diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 949d7630..07f832db 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -46,7 +46,7 @@ public class EG001ControllerEmbeddedSigning extends AbstractEsignatureController @Autowired public EG001ControllerEmbeddedSigning(DSConfiguration config, Session session, User user) { - super(config, "eg001", "Use embedded signing"); + super(config, Boolean.valueOf(config.getQuickACG()) ? "quickEmbeddedSigning" : "eg001", "Use embedded signing"); this.session = session; this.user = user; } diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index 2fbc095e..5fb456d8 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -1,5 +1,6 @@ { "quickstart" :"{QUICKSTART_VALUE}", + "quickACG": "{QUICK_ACG_VALUE}", "DS_SIGNER_NAME": "{SIGNER_NAME}", "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", "DS_APP_URL": "http://localhost:8080", diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp new file mode 100644 index 00000000..fa056187 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp @@ -0,0 +1,77 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + + + + + + ${title} + + + + + + + + + + + + +
    + +

    Use embedded signing

    +

    This example sends an envelope, and then uses embedded signing for the first signer.

    +

    Embedded signing provides a smoother user experience for the signer: the DocuSign signing is initiated from your website.

    + + +

    Documentation about this example.

    +
    + +

    API methods used: + Envelopes::create + and + EnvelopeViews::createRecipient. +

    +

    + View source file ${sourceFile} on GitHub. +

    + +
    +
    + + + We'll never share your email with anyone else. +
    +
    + + +
    + + + +
    + + From 37215abfb3f0c599fc13722965297293c0a4b9b8 Mon Sep 17 00:00:00 2001 From: Aaron JacksonWilde Date: Wed, 1 Jun 2022 14:48:36 -0700 Subject: [PATCH 295/699] included sample config file for ACG --- .../main/resources/application.example.json | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Quick_ACG/src/main/resources/application.example.json diff --git a/Quick_ACG/src/main/resources/application.example.json b/Quick_ACG/src/main/resources/application.example.json new file mode 100644 index 00000000..85ebc850 --- /dev/null +++ b/Quick_ACG/src/main/resources/application.example.json @@ -0,0 +1,31 @@ +{ + "quickstart" :"{QUICKSTART_VALUE}", + "quickACG": "{QUICK_ACG_VALUE}", + "DS_SIGNER_NAME": "{SIGNER_NAME}", + "DS_SIGNER_EMAIL": "{SIGNER_EMAIL}", + "DS_APP_URL": "http://localhost:8080", + "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", + "DS_BASE_PATH": "https://demo.docusign.net", + + "authorization.code.grant.client.scope": "signature", + "authorization.code.grant.sso.redirect-url": "&type=acg", + "authorization.code.grant.client.client-id": "{INTEGRATION_KEY_AUTH_CODE}", + "authorization.code.grant.client.client-secret": "{SECRET_KEY}", + "authorization.code.grant.client.access-token-uri": "https://account-d.docusign.com/oauth/token", + "authorization.code.grant.client.user-authorization-uri": "https://account-d.docusign.com/oauth/auth?prompt=login", + + "common.client.resource.user-info-uri": "https://account-d.docusign.com/oauth/userinfo", + "com.docusign.github.example-uri": "https://github.com/docusign/code-examples-java/blob/master/src/main/java/", + "com.docusign.documentation-path": "", + + "server.tomcat.additional-tld-skip-patterns": "*jaxb*.jar", + "server.servlet.session.tracking-modes": "cookie", + "server.servlet.session.persistent": false, + "server.error.include-stacktrace": "always", + "server.error.whitelabel.enabled": false, + + "spring.session.store-type": "none", + "spring.mvc.view.prefix": "/WEB-INF/templates/views/", + "spring.mvc.view.suffix": ".jsp", + "spring.jmx.enabled": false +} From 0d7ef489290e4a6967359defbca63e49429c175f Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Wed, 1 Jun 2022 15:03:15 -0700 Subject: [PATCH 296/699] Update application.example.json --- Quick_ACG/src/main/resources/application.example.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Quick_ACG/src/main/resources/application.example.json b/Quick_ACG/src/main/resources/application.example.json index 85ebc850..a66e0672 100644 --- a/Quick_ACG/src/main/resources/application.example.json +++ b/Quick_ACG/src/main/resources/application.example.json @@ -6,6 +6,14 @@ "DS_APP_URL": "http://localhost:8080", "DS_TARGET_ACCOUNT_ID": "{IMPERSONATED_USER_ID}", "DS_BASE_PATH": "https://demo.docusign.net", + "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", + "DS_CLICK_BASE_PATH": "https://demo.docusign.net", + "DS_MONITOR_BASE_PATH": "https://lens-d.docusign.net", + "DS_ADMIN_BASE_PATH": "https://api-d.docusign.net", + + "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", + "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", + "Gateway_Display_Name": "{DS_PAYMENT_GATEWAY_DISPLAY_NAME}", "authorization.code.grant.client.scope": "signature", "authorization.code.grant.sso.redirect-url": "&type=acg", From b3efed62ab06873992531ee9573b9216ac546b80 Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Thu, 16 Jun 2022 09:38:20 +0300 Subject: [PATCH 297/699] Implemented new code examples for Admin SDK (#61) --- code-examples-java.iml | 10 ++-- pom.xml | 6 ++- .../com/docusign/common/WorkArguments.java | 1 + ...RetrieveDocuSignProfileByEmailAddress.java | 47 ++++++++++++++++++ .../A007RetrieveDocuSignProfileByUserID.java | 49 +++++++++++++++++++ ...RetrieveDocuSignProfileByEmailAddress.java | 18 +++++++ .../RetrieveDocuSignProfileByUserId.java | 16 ++++++ .../com/docusign/core/model/DoneExample.java | 8 +-- .../views/pages/admin/examples/a006.jsp | 31 ++++++++++++ .../views/pages/admin/examples/a007.jsp | 34 +++++++++++++ .../templates/views/pages/admin/index.jsp | 20 +++++++- 11 files changed, 227 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java create mode 100644 src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByEmailAddress.java create mode 100644 src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByUserId.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp diff --git a/code-examples-java.iml b/code-examples-java.iml index 5aa6a87b..70016873 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -50,7 +50,6 @@ - @@ -71,13 +70,14 @@ - + + @@ -85,7 +85,7 @@ - + @@ -116,8 +116,8 @@ - - + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index f02ae3f2..e4c211d6 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 1.1.0 1.0.0 1.1.0 - 1.0.0-BETA + 1.1.0 @@ -65,6 +65,10 @@ com.fasterxml.jackson.datatype jackson-datatype-joda + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index 572fe15c..11ec9000 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -64,6 +64,7 @@ public class WorkArguments { private String eSignProfileId; private UUID eSignProductId; private UUID dsGroupId; + private UUID userId; private String resumeDate; private String delay; private String clickwrap; diff --git a/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java b/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java new file mode 100644 index 00000000..0eb647b4 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java @@ -0,0 +1,47 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.UsersDrilldownResponse; +import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.RetrieveDocuSignProfileByEmailAddress; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.util.UUID; + +/** + * Get a DocuSign user by the email address using the methods from Admin API. + */ +@Controller +@RequestMapping("/a006") +public class A006RetrieveDocuSignProfileByEmailAddress extends AbstractAdminController { + + private final User user; + + @Autowired + public A006RetrieveDocuSignProfileByEmailAddress(DSConfiguration config, User user) { + super(config, "a006", "Retrieve the user's DocuSign profile using an email address"); + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + // Step 3 start + UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + UsersDrilldownResponse usersResponse = RetrieveDocuSignProfileByEmailAddress + .getDocuSignProfileByEmailAddress(usersApi, organizationId, args.getEmail()); + // Step 3 end + DoneExample.createDefault(title) + .withMessage("Results from getDSUserProfile_Email method:") + .withJsonObject(usersResponse.getUsers()).addToModel(model); + + return DONE_EXAMPLE_PAGE; + } +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java b/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java new file mode 100644 index 00000000..d88d2b20 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java @@ -0,0 +1,49 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.UsersDrilldownResponse; +import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.RetrieveDocuSignProfileByUserId; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.util.UUID; + +/** + * Get a DocuSign user by the user ID using the methods from Admin API. + */ +@Controller +@RequestMapping("/a007") +public class A007RetrieveDocuSignProfileByUserID extends AbstractAdminController { + + private final User user; + + @Autowired + public A007RetrieveDocuSignProfileByUserID(DSConfiguration config, User user) { + super(config, "a007", "Retrieve the user's DocuSign profile using a User ID"); + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + // Step 3 start + UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + + UsersDrilldownResponse usersResponse = RetrieveDocuSignProfileByUserId. + getDocuSignProfileByUserId(usersApi, organizationId, args.getUserId()); + // Step 3 end + DoneExample.createDefault(title) + .withMessage("Results from getDSUserProfile method:") + .withJsonObject(usersResponse.getUsers()).addToModel(model); + + return DONE_EXAMPLE_PAGE; + } + +} diff --git a/src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByEmailAddress.java b/src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByEmailAddress.java new file mode 100644 index 00000000..b9251230 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByEmailAddress.java @@ -0,0 +1,18 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.UsersDrilldownResponse; + +import java.util.UUID; + +public class RetrieveDocuSignProfileByEmailAddress { + public static UsersDrilldownResponse getDocuSignProfileByEmailAddress( + UsersApi usersApi, + UUID organizationId, + String emailAddress + ) throws Exception { + var userOptions = usersApi.new GetUserDSProfilesByEmailOptions(); + userOptions.setEmail(emailAddress); + return usersApi.getUserDSProfilesByEmail(organizationId, userOptions); + } +} diff --git a/src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByUserId.java b/src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByUserId.java new file mode 100644 index 00000000..a54e8256 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/RetrieveDocuSignProfileByUserId.java @@ -0,0 +1,16 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.UsersDrilldownResponse; + +import java.util.UUID; + +public class RetrieveDocuSignProfileByUserId { + public static UsersDrilldownResponse getDocuSignProfileByUserId( + UsersApi usersApi, + UUID organizationId, + UUID userId + ) throws Exception { + return usersApi.getUserDSProfile(organizationId, userId); + } +} diff --git a/src/main/java/com/docusign/core/model/DoneExample.java b/src/main/java/com/docusign/core/model/DoneExample.java index dde6abce..d25a0936 100644 --- a/src/main/java/com/docusign/core/model/DoneExample.java +++ b/src/main/java/com/docusign/core/model/DoneExample.java @@ -4,11 +4,7 @@ import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.json.JsonMapper; -import com.fasterxml.jackson.datatype.joda.JodaModule; -import com.google.gson.Gson; -import com.fasterxml.jackson.databind.SerializationConfig; -import org.json.JSONObject; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.springframework.ui.ModelMap; import com.docusign.core.common.DiffField; @@ -109,7 +105,7 @@ public DoneExample withStackTracePrinted(String stackTracePrinted) { public DoneExample withJsonObject(Object object) { if (object != null) { ObjectWriter writer = new ObjectMapper() - .registerModule(new JodaModule()) + .registerModule(new JavaTimeModule()) .setDateFormat(new SimpleDateFormat(DATETIME_PATTERN)) .setDefaultPrettyPrinter(new DefaultPrettyPrinter()) .writerWithDefaultPrettyPrinter(); diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp new file mode 100644 index 00000000..133df78d --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp @@ -0,0 +1,31 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

    6. Retrieve the user's DocuSign profile using an email address

    +

    Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's email address.

    + + +

    Documentation about this example.

    +
    + +

    + API method used: + MultiProductUserManagement:getUserDSProfilesByEmail +

    + +

    + View source file ${sourceFile} on GitHub. +

    + +
    +
    + + + This email address must use the same domain that has been claimed by your organization. + +
    + + +
    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp new file mode 100644 index 00000000..8945fdc3 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp @@ -0,0 +1,34 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + +

    7. Retrieve the user's DocuSign profile using a User ID

    +

    + Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's User ID. +

    + + +

    Documentation about this example.

    +
    + +

    + API method used: + MultiProductUserManagement:getUserDSProfile +

    + +

    + View source file ${sourceFile} on GitHub. +

    + +
    +
    + + + +
    + + +
    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp index a63f7f36..cb330ca6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp @@ -115,7 +115,25 @@ href="https://developers.docusign.com/docs/admin-api/reference/usermanagement/users/getusers/">Users:getUsers, eSignUserManagement:getUserProfiles -

    +

    + +

    6. Retrieve the user's DocuSign profile using an email address

    +

    + Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's email address. +

    +

    + API method used: + MultiProductUserManagement:getUserDSProfilesByEmail +

    + +

    7. Retrieve the user's DocuSign profile using a User ID

    +

    Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's User ID.

    +

    + API method used: + MultiProductUserManagement:getUserDSProfile +

    From 0159714af2fa167286405896e5e416f28cbcd9cd Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Thu, 16 Jun 2022 14:11:02 -0700 Subject: [PATCH 298/699] increased aggregation limit to 100 (#63) --- .../controller/monitor/services/WebQueryEndpointService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java index 3ea0f529..9656177f 100644 --- a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java +++ b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java @@ -49,7 +49,7 @@ private static WebQuery prepareWebQueryOptions(String accountId, String filterSt }); webQuery.addAggregationsItem(new Object(){ public String aggregationName = "Raw"; - public String limit = "1"; + public String limit = "100"; public String[] orderby = new String[] { "Timestamp, desc" }; }); return webQuery; From 942524419ff74130652153c87693534654c99536 Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Fri, 8 Jul 2022 22:24:11 +0300 Subject: [PATCH 299/699] Implemented new code examples for Admin SDK (#62) * added new admin code examples * upgraded the admin library dependencies * changed return type in getPermissionProfiles method * removed redundant Session property * added a check if account has been deleted --- .factorypath | 4 +- .../com/docusign/common/WorkArguments.java | 2 + .../A002CreateActiveCLMESignUser.java | 2 + ...008UpdateUserProductPermissionProfile.java | 136 ++++++++++++++++++ ...009DeleteUserProductPermissionProfile.java | 133 +++++++++++++++++ ...eleteUserProductPermissionProfileById.java | 27 ++++ ...teUserProductPermissionProfileByEmail.java | 32 +++++ .../java/com/docusign/core/model/Session.java | 1 + src/main/resources/public/assets/site.js | 23 +++ .../views/pages/admin/examples/a006.jsp | 4 +- .../views/pages/admin/examples/a007.jsp | 2 +- .../views/pages/admin/examples/a008.jsp | 60 ++++++++ .../views/pages/admin/examples/a009.jsp | 53 +++++++ .../templates/views/pages/admin/index.jsp | 34 ++++- .../WEB-INF/templates/views/partials/foot.jsp | 1 + 15 files changed, 502 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java create mode 100644 src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java create mode 100644 src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java create mode 100644 src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java create mode 100644 src/main/resources/public/assets/site.js create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp diff --git a/.factorypath b/.factorypath index e4dde82b..5ac4c88a 100644 --- a/.factorypath +++ b/.factorypath @@ -22,7 +22,6 @@ - @@ -50,6 +49,7 @@ + @@ -89,6 +89,6 @@ - + diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index 11ec9000..daa02bf3 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -63,6 +63,8 @@ public class WorkArguments { private UUID clmProductId; private String eSignProfileId; private UUID eSignProductId; + private String PermissionProfileId; + private UUID ProductId; private UUID dsGroupId; private UUID userId; private String resumeDate; diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 7c102afd..3efb7394 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -115,6 +115,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse organizationId, accountId); + this.session.setEmailAddress(result.getEmail()); + // Process results DoneExample.createDefault(title) .withMessage("Results from MultiProductUserManagement:addOrUpdateUser method:") diff --git a/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java b/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java new file mode 100644 index 00000000..e9fe1e29 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java @@ -0,0 +1,136 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.ProductPermissionProfilesApi; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.*; +import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.RetrieveDocuSignProfileByEmailAddress; +import com.docusign.controller.admin.services.UpdateUserProductPermissionProfileByEmail; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.datatype.joda.JodaModule; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletResponse; +import java.util.Hashtable; +import java.util.List; +import java.util.UUID; + +/** + * This example demonstrates how to update user product permission profiles using an email address. + */ +@Controller +@RequestMapping("/a008") +public class A008UpdateUserProductPermissionProfile extends AbstractAdminController { + + private final User user; + private final Hashtable products = new Hashtable<>(); + private ProductPermissionProfilesResponse productPermissionProfiles; + + @Autowired + public A008UpdateUserProductPermissionProfile(DSConfiguration config, Session session, User user) { + super(config, "a008", "Update user product permission profiles using an email address"); + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID existingAccountId = this.getExistingAccountId(user.getAccessToken(), session.getBasePath(), organizationId); + String emailAddress = this.session.getEmailAddress(); + ProductPermissionProfileResponse permissionProfiles = null; + UUID clmProductId = null; + UUID eSignProductId = null; + + if (emailAddress != null) { + try { + UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + RetrieveDocuSignProfileByEmailAddress.getDocuSignProfileByEmailAddress(usersApi, organizationId, emailAddress); + + ProductPermissionProfilesApi productPermissionProfilesApi = this.createProductPermissionProfilesApi( + user.getAccessToken(), + session.getBasePath() + ); + productPermissionProfiles = productPermissionProfilesApi.getProductPermissionProfiles(organizationId, existingAccountId); + + for (ProductPermissionProfileResponse profileResponse : productPermissionProfiles.getProductPermissionProfiles()) { + if (profileResponse.getProductName().equals("CLM")) { + clmProductId = profileResponse.getProductId(); + } else { + permissionProfiles = profileResponse; + eSignProductId = profileResponse.getProductId(); + } + } + + products.put(eSignProductId, "eSignature"); + products.put(clmProductId, "CLM"); + + model.addAttribute("listPermissionProfiles", permissionProfiles); + model.addAttribute("listProducts", products); + model.addAttribute("emailAddress", emailAddress); + } catch(Exception e) { + model.addAttribute("emailAddress", null); + } + } else { + model.addAttribute("emailAddress", null); + } + } + + @RequestMapping(value = "/getPermissionProfiles", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + public @ResponseBody + List getPermissionProfiles(@RequestParam(value = "productId") UUID productId) { + List permissionProfiles = null; + for (ProductPermissionProfileResponse profileResponse : productPermissionProfiles.getProductPermissionProfiles()) { + if (profileResponse.getProductId().equals(productId)) { + permissionProfiles = profileResponse.getPermissionProfiles(); + } + } + + return permissionProfiles; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID existingAccountId = this.getExistingAccountId( + this.user.getAccessToken(), + this.session.getBasePath(), + organizationId + ); + + ProductPermissionProfilesApi productPermissionProfilesApi = createProductPermissionProfilesApi( + this.user.getAccessToken(), + this.session.getBasePath()); + + UserProductPermissionProfilesResponse productPermissionProfile = UpdateUserProductPermissionProfileByEmail + .updateUserProductPermissionProfile( + productPermissionProfilesApi, + args.getPermissionProfileId(), + args.getProductId(), + this.session.getEmailAddress(), + organizationId, + existingAccountId + ); + + DoneExample.createDefault(title) + .withMessage("Results from MultiProductUserManagement:addUserProductPermissionProfilesByEmail method:") + .withJsonObject(productPermissionProfile) + .addToModel(model); + + return DONE_EXAMPLE_PAGE; + } + +} diff --git a/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java new file mode 100644 index 00000000..823163a4 --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java @@ -0,0 +1,133 @@ +package com.docusign.controller.admin.examples; + +import com.docusign.DSConfiguration; +import com.docusign.admin.api.ProductPermissionProfilesApi; +import com.docusign.admin.api.UsersApi; +import com.docusign.admin.model.PermissionProfileResponse21; +import com.docusign.admin.model.ProductPermissionProfileResponse; +import com.docusign.admin.model.RemoveUserProductsResponse; +import com.docusign.admin.model.UserProductPermissionProfilesResponse; +import com.docusign.common.WorkArguments; +import com.docusign.controller.admin.services.DeleteUserProductPermissionProfileById; +import com.docusign.controller.admin.services.RetrieveDocuSignProfileByEmailAddress; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.util.Hashtable; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * This example demonstrates how to delete user product permission profiles using an email address. + */ +@Controller +@RequestMapping("/a009") +public class A009DeleteUserProductPermissionProfile extends AbstractAdminController { + + private final User user; + private final Hashtable products = new Hashtable<>(); + public static UUID clmProductId = UUID.fromString("37f013eb-7012-4588-8028-357b39fdbd00"); + public static UUID eSignatureProductId = UUID.fromString("f6406c68-225c-4e9b-9894-64152a26fa83"); + private final String CLM_PROFILES_NOT_FOUND = "No CLM permission profiles are connected to this user"; + private final String ESIGN_PROFILES_NOT_FOUND = "No eSignature permission profiles are connected to this user"; + + @Autowired + public A009DeleteUserProductPermissionProfile(DSConfiguration config, Session session, User user) { + super(config, "a009", "Delete user product permission profiles using an email address"); + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID existingAccountId = this.getExistingAccountId(user.getAccessToken(), session.getBasePath(), organizationId); + String emailAddress = this.session.getEmailAddress(); + List clmProfiles = null; + List eSignProfiles = null; + + if (emailAddress != null) { + try { + UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); + RetrieveDocuSignProfileByEmailAddress.getDocuSignProfileByEmailAddress(usersApi, organizationId, emailAddress); + + ProductPermissionProfilesApi productPermissionProfilesApi = this.createProductPermissionProfilesApi( + user.getAccessToken(), + session.getBasePath() + ); + ProductPermissionProfilesApi.GetUserProductPermissionProfilesByEmailOptions userProductPermissionProfilesByEmailOptions = + productPermissionProfilesApi.new GetUserProductPermissionProfilesByEmailOptions(); + userProductPermissionProfilesByEmailOptions.setEmail(emailAddress); + UserProductPermissionProfilesResponse userProductPermissionProfilesByEmail = productPermissionProfilesApi + .getUserProductPermissionProfilesByEmail(organizationId, existingAccountId, userProductPermissionProfilesByEmailOptions); + + for (ProductPermissionProfileResponse profileResponse : userProductPermissionProfilesByEmail.getProductPermissionProfiles()) { + if (profileResponse.getProductName().equals("CLM")) { + clmProfiles = profileResponse + .getPermissionProfiles() + .stream() + .map(PermissionProfileResponse21::getPermissionProfileName) + .collect(Collectors.toList()); + } else { + eSignProfiles = profileResponse + .getPermissionProfiles() + .stream() + .map(PermissionProfileResponse21::getPermissionProfileName) + .collect(Collectors.toList()); + } + } + + String clmProfilesFormatted = clmProfiles != null + ? String.join(",", clmProfiles) + : CLM_PROFILES_NOT_FOUND; + + String eSignProfilesFormatted = eSignProfiles != null + ? String.join(",", eSignProfiles) + : ESIGN_PROFILES_NOT_FOUND; + + products.put(eSignatureProductId, String.format("eSignature - %s", eSignProfilesFormatted)); + products.put(clmProductId, String.format("CLM - %s", clmProfilesFormatted)); + + model.addAttribute("listProducts", products); + + model.addAttribute("emailAddress", emailAddress); + } catch(Exception e) { + model.addAttribute("emailAddress", null); + } + } else { + model.addAttribute("emailAddress", null); + } + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { + UUID organizationId = this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath()); + UUID existingAccountId = this.getExistingAccountId(this.user.getAccessToken(), this.session.getBasePath(), organizationId); + + ProductPermissionProfilesApi productPermissionProfilesApi = createProductPermissionProfilesApi( + this.user.getAccessToken(), + this.session.getBasePath()); + + RemoveUserProductsResponse removeUserProductsRepsonse = DeleteUserProductPermissionProfileById.deleteUserProductPermissionProfile( + productPermissionProfilesApi, + args.getProductId(), + this.session.getEmailAddress(), + organizationId, + existingAccountId); + + DoneExample.createDefault(title) + .withMessage("Results from MultiProductUserManagement:removeUserProductPermission method:") + .withJsonObject(removeUserProductsRepsonse) + .addToModel(model); + + return DONE_EXAMPLE_PAGE; + } + +} diff --git a/src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java b/src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java new file mode 100644 index 00000000..3b47ab3b --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java @@ -0,0 +1,27 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.ProductPermissionProfilesApi; +import com.docusign.admin.model.RemoveUserProductsResponse; +import com.docusign.admin.model.UserProductProfileDeleteRequest; + +import java.util.Collections; +import java.util.UUID; + +public class DeleteUserProductPermissionProfileById { + public static RemoveUserProductsResponse deleteUserProductPermissionProfile( + ProductPermissionProfilesApi productPermissionProfilesApi, + UUID productId, + String emailAddress, + UUID organizationId, + UUID accountId + ) throws Exception { + var userProductProfileDeleteRequest = new UserProductProfileDeleteRequest(); + userProductProfileDeleteRequest.setProductIds(Collections.singletonList(productId)); + userProductProfileDeleteRequest.setUserEmail(emailAddress); + + return productPermissionProfilesApi.removeUserProductPermission( + organizationId, + accountId, + userProductProfileDeleteRequest); + } +} \ No newline at end of file diff --git a/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java b/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java new file mode 100644 index 00000000..e93b546c --- /dev/null +++ b/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java @@ -0,0 +1,32 @@ +package com.docusign.controller.admin.services; + +import com.docusign.admin.api.ProductPermissionProfilesApi; +import com.docusign.admin.model.ProductPermissionProfileRequest; +import com.docusign.admin.model.UserProductPermissionProfilesRequest; +import com.docusign.admin.model.UserProductPermissionProfilesResponse; + +import java.util.UUID; + +public class UpdateUserProductPermissionProfileByEmail { + public static UserProductPermissionProfilesResponse updateUserProductPermissionProfile( + ProductPermissionProfilesApi productPermissionProfilesApi, + String permissionProfileId, + UUID productId, + String emailAddress, + UUID organizationId, + UUID accountId + ) throws Exception { + var productPermissionProfileRequest = new ProductPermissionProfileRequest(); + productPermissionProfileRequest.setPermissionProfileId(permissionProfileId); + productPermissionProfileRequest.setProductId(productId); + + var userProductPermissionProfilesRequest = new UserProductPermissionProfilesRequest(); + userProductPermissionProfilesRequest.email(emailAddress); + userProductPermissionProfilesRequest.addProductPermissionProfilesItem(productPermissionProfileRequest); + + return productPermissionProfilesApi.addUserProductPermissionProfilesByEmail( + organizationId, + accountId, + userProductPermissionProfilesRequest); + } +} diff --git a/src/main/java/com/docusign/core/model/Session.java b/src/main/java/com/docusign/core/model/Session.java index 6cc22fcb..fa5ee37a 100644 --- a/src/main/java/com/docusign/core/model/Session.java +++ b/src/main/java/com/docusign/core/model/Session.java @@ -34,6 +34,7 @@ public class Session implements Serializable { private String clickwrapVersionNumber; private String exportId; private String importId; + private String emailAddress; private UUID orgId; public UUID bulkListId; } diff --git a/src/main/resources/public/assets/site.js b/src/main/resources/public/assets/site.js new file mode 100644 index 00000000..0db7555b --- /dev/null +++ b/src/main/resources/public/assets/site.js @@ -0,0 +1,23 @@ +$(document).ready(function () { + $("#Products").on("change", function () { + $list = $("#PermissionProfilesFiltered"); + $.ajax({ + url: "/a008/getPermissionProfiles", + type: "GET", + data: { productId: $("#Products").val() }, + traditional: true, + dataType: "json", + success: function (result) { + console.log(result) + $list.empty(); + $.each(result, function (i, item) { + console.log(item) + $list.append(''); + }); + }, + error: function () { + console.warn("Issues with calling the getPermissionProfiles endpoint. Please, check the solution."); + } + }); + }); +}); \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp index 133df78d..b230b058 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp @@ -11,7 +11,7 @@

    API method used: MultiProductUserManagement:getUserDSProfilesByEmail + href="https://developers.docusign.com/docs/admin-api/reference/usermanagement/multiproductusermanagement/getuserdsprofilesbyemail/">MultiProductUserManagement:getUserDSProfilesByEmail.

    @@ -22,7 +22,7 @@

    - This email address must use the same domain that has been claimed by your organization. + We will never share your email with anyone else.
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp index 8945fdc3..145f4187 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp @@ -13,7 +13,7 @@

    API method used: MultiProductUserManagement:getUserDSProfile + href="https://developers.docusign.com/docs/admin-api/reference/usermanagement/multiproductusermanagement/getuserdsprofile/">MultiProductUserManagement:getUserDSProfile.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp new file mode 100644 index 00000000..45217ebc --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp @@ -0,0 +1,60 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + + +

    8. Update user product permission profiles using an email address

    +

    Demonstrates how to update user product permission profiles. There may only be one permission profile assigned to a user per product.

    + + + +

    Documentation about this example.

    +
    + +

    + API methods used: + MultiProductUserManagement:getProductPermissionProfiles, + MultiProductUserManagement:addUserProductPermissionProfilesByEmail. +

    + +

    + View source file ${sourceFile} on GitHub. +

    + + + +

    Update user product permission profile for the following email: ${emailAddress}

    + +
    +
    + + +
    + +
    + + +
    + + + + +
    + +

    + Problem: You do not have the user to change permissions for. Go to example#2 and create one: + create active CLM/eSign User.
    +

    +
    +
    + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp new file mode 100644 index 00000000..d43f17c8 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp @@ -0,0 +1,53 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> + + + +

    9. Delete user product permission profiles using an email address

    +

    + Demonstrates how to list and delete DocuSign Admin user product permission profiles. +

    + + + +

    Documentation about this example.

    +
    + +

    + API methods used: + MultiProductUserManagement:getUserProductPermissionProfilesByEmail, + MultiProductUserManagement:removeUserProductPermission. +

    + +

    + View source file ${sourceFile} on GitHub. +

    + + + +

    Delete user product permission profile for the following email: ${emailAddress}

    + +
    +
    + + +
    + + + + +
    + +

    + Problem: You do not have the user to change permissions for. Go to example#2 and create one: + create active CLM/eSign User.
    +

    +
    +
    + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp index cb330ca6..3141850a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp @@ -112,27 +112,47 @@

    API methods used: Users:getUsers, - eSignUserManagement:getUserProfiles + href="https://developers.docusign.com/docs/admin-api/reference/usermanagement/users/getusers/">Users:getUsers, + eSignUserManagement:getUserProfiles

    -

    6. Retrieve the user's DocuSign profile using an email address

    +

    6. Retrieve the user's DocuSign profile using an email address

    Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's email address.

    API method used: MultiProductUserManagement:getUserDSProfilesByEmail + href="https://developers.docusign.com/docs/admin-api/reference/usermanagement/multiproductusermanagement/getuserdsprofilesbyemail/">MultiProductUserManagement:getUserDSProfilesByEmail

    -

    7. Retrieve the user's DocuSign profile using a User ID

    +

    7. Retrieve the user's DocuSign profile using a User ID

    Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's User ID.

    API method used: MultiProductUserManagement:getUserDSProfile + href="https://developers.docusign.com/docs/admin-api/reference/usermanagement/multiproductusermanagement/getuserdsprofile/">MultiProductUserManagement:getUserDSProfile +

    + +

    8. Update user product permission profiles using an email address

    +

    Demonstrates how to update user product permission profiles. There may only be one permission profile assigned to a user per product.

    +

    + API methods used: + MultiProductUserManagement:getProductPermissionProfiles, + MultiProductUserManagement:addUserProductPermissionProfilesByEmail +

    + +

    9. Delete user product permission profiles using an email address

    +

    Demonstrates how to list and delete DocuSign Admin user product permission profiles.

    +

    + API methods used: + MultiProductUserManagement:getUserProductPermissionProfilesByEmail, + MultiProductUserManagement:removeUserProductPermission

    diff --git a/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp b/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp index bbe98422..0c4b0d1c 100644 --- a/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp +++ b/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp @@ -22,6 +22,7 @@ + From 171dcec7e157131dd58eb714d76b0288227e39d4 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Fri, 8 Jul 2022 12:31:34 -0700 Subject: [PATCH 300/699] Feature/admin code examples (#64) * added new admin code examples * upgraded the admin library dependencies * changed return type in getPermissionProfiles method * removed redundant Session property * renaming the variables * minor changes to text * changed ordering of examples on the index page * QA requested changes applied * update links * homepage links * updated text under Admin 6 field * fixed text in the 6th code example page * added a check if account has been deleted * snippet markers * snippet markers (more of them) Co-authored-by: annahileta Co-authored-by: meihDS <70775251+meihDS@users.noreply.github.com> --- .../examples/A009DeleteUserProductPermissionProfile.java | 9 +++++---- .../services/DeleteUserProductPermissionProfileById.java | 4 +++- .../UpdateUserProductPermissionProfileByEmail.java | 5 ++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java index 823163a4..aa81890d 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java +++ b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java @@ -55,9 +55,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception if (emailAddress != null) { try { + UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath()); RetrieveDocuSignProfileByEmailAddress.getDocuSignProfileByEmailAddress(usersApi, organizationId, emailAddress); - + //Step 3 start ProductPermissionProfilesApi productPermissionProfilesApi = this.createProductPermissionProfilesApi( user.getAccessToken(), session.getBasePath() @@ -67,7 +68,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception userProductPermissionProfilesByEmailOptions.setEmail(emailAddress); UserProductPermissionProfilesResponse userProductPermissionProfilesByEmail = productPermissionProfilesApi .getUserProductPermissionProfilesByEmail(organizationId, existingAccountId, userProductPermissionProfilesByEmailOptions); - + //Step 3 end for (ProductPermissionProfileResponse profileResponse : userProductPermissionProfilesByEmail.getProductPermissionProfiles()) { if (profileResponse.getProductName().equals("CLM")) { clmProfiles = profileResponse @@ -114,14 +115,14 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse ProductPermissionProfilesApi productPermissionProfilesApi = createProductPermissionProfilesApi( this.user.getAccessToken(), this.session.getBasePath()); - + //Step 5 start RemoveUserProductsResponse removeUserProductsRepsonse = DeleteUserProductPermissionProfileById.deleteUserProductPermissionProfile( productPermissionProfilesApi, args.getProductId(), this.session.getEmailAddress(), organizationId, existingAccountId); - + //Step 5 end DoneExample.createDefault(title) .withMessage("Results from MultiProductUserManagement:removeUserProductPermission method:") .withJsonObject(removeUserProductsRepsonse) diff --git a/src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java b/src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java index 3b47ab3b..011f92c1 100644 --- a/src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java +++ b/src/main/java/com/docusign/controller/admin/services/DeleteUserProductPermissionProfileById.java @@ -15,10 +15,12 @@ public static RemoveUserProductsResponse deleteUserProductPermissionProfile( UUID organizationId, UUID accountId ) throws Exception { + + // Step 4 start var userProductProfileDeleteRequest = new UserProductProfileDeleteRequest(); userProductProfileDeleteRequest.setProductIds(Collections.singletonList(productId)); userProductProfileDeleteRequest.setUserEmail(emailAddress); - + // Step 4 end return productPermissionProfilesApi.removeUserProductPermission( organizationId, accountId, diff --git a/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java b/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java index e93b546c..434bc92c 100644 --- a/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java +++ b/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java @@ -16,6 +16,7 @@ public static UserProductPermissionProfilesResponse updateUserProductPermissionP UUID organizationId, UUID accountId ) throws Exception { + // Step 3 start var productPermissionProfileRequest = new ProductPermissionProfileRequest(); productPermissionProfileRequest.setPermissionProfileId(permissionProfileId); productPermissionProfileRequest.setProductId(productId); @@ -23,10 +24,12 @@ public static UserProductPermissionProfilesResponse updateUserProductPermissionP var userProductPermissionProfilesRequest = new UserProductPermissionProfilesRequest(); userProductPermissionProfilesRequest.email(emailAddress); userProductPermissionProfilesRequest.addProductPermissionProfilesItem(productPermissionProfileRequest); - + // Step 3 end + // Step 4 start return productPermissionProfilesApi.addUserProductPermissionProfilesByEmail( organizationId, accountId, userProductPermissionProfilesRequest); + // Step 4 end } } From 20cd7567d8347908b8edd33616ebcf671928b1e8 Mon Sep 17 00:00:00 2001 From: annahileta Date: Mon, 18 Jul 2022 18:59:56 +0300 Subject: [PATCH 301/699] added an in-person signing code example --- .../com/docusign/common/WorkArguments.java | 2 + .../EG039ControllerInPersonSigning.java | 67 +++++++++++++++++ .../services/InPersonSigningService.java | 74 +++++++++++++++++++ .../views/pages/esignature/examples/eg039.jsp | 40 ++++++++++ .../views/pages/esignature/index.jsp | 6 ++ 5 files changed, 189 insertions(+) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index daa02bf3..2b5a762a 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -71,4 +71,6 @@ public class WorkArguments { private String delay; private String clickwrap; private String clickwrapId; + private String hostEmail; + private String hostName; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java new file mode 100644 index 00000000..32c029f7 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -0,0 +1,67 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.InPersonSigningService; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.RecipientViewRequest; +import com.docusign.esign.model.ViewUrl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.view.RedirectView; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Controller +@RequestMapping("/eg039") +public class EG039ControllerInPersonSigning extends AbstractEsignatureController { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + + private final Session session; + private final User user; + + @Autowired + public EG039ControllerInPersonSigning(DSConfiguration config, Session session, User user) { + super(config, "eg039", "In-person signing"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + String hostName = args.getHostName(); + String hostEmail = args.getHostEmail(); + String signerName = args.getSignerName(); + String accountId = session.getAccountId(); + + EnvelopeDefinition envelope = InPersonSigningService.makeEnvelope(hostEmail, hostName, signerName, + ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X, DOCUMENT_FILE_NAME, DOCUMENT_NAME); + + ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + RecipientViewRequest viewRequest = InPersonSigningService.makeRecipientViewRequest(hostEmail, hostName, config); + + ViewUrl viewUrl = InPersonSigningService.inPersonSigning( + envelopesApi, + accountId, + envelopeSummary.getEnvelopeId(), + viewRequest); + + return new RedirectView(viewUrl.getUrl()); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java new file mode 100644 index 00000000..2c219e7a --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java @@ -0,0 +1,74 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.DSConfiguration; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; + +public final class InPersonSigningService { + public static ViewUrl inPersonSigning( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String hostEmail, + String hostName, + DSConfiguration config) + { + String stateValue = "?state=123"; + String authenticationMethod = "none"; + String pingFrequency = "600"; + + RecipientViewRequest viewRequest = new RecipientViewRequest(); + + viewRequest.setReturnUrl(config.getDsReturnUrl() + stateValue); + viewRequest.setAuthenticationMethod(authenticationMethod); + viewRequest.setEmail(hostEmail); + viewRequest.setUserName(hostName); + viewRequest.setPingFrequency(pingFrequency); + viewRequest.setPingUrl(config.getDsPingUrl()); + + return viewRequest; + } + + public static EnvelopeDefinition makeEnvelope( + String hostEmail, + String hostName, + String signerName, + Integer anchorOffsetY, + Integer anchorOffsetX, + String documentFileName, + String documentName + ) throws IOException { + InPersonSigner inPersonSigner = new InPersonSigner(); + + inPersonSigner.setHostEmail(hostEmail); + inPersonSigner.setHostName(hostName); + inPersonSigner.setSignerName(signerName); + inPersonSigner.setRecipientId("1"); + inPersonSigner.setRoutingOrder("1"); + inPersonSigner.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", anchorOffsetY, anchorOffsetX)); + + Recipients recipients = new Recipients(); + recipients.setInPersonSigners(Collections.singletonList(inPersonSigner)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please host this in-person signing session"); + envelopeDefinition.setRecipients(recipients); + + Document document = EnvelopeHelpers.createDocumentFromFile(documentFileName, documentName, "1"); + envelopeDefinition.setDocuments(Collections.singletonList(document)); + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp new file mode 100644 index 00000000..b5290e45 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -0,0 +1,40 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

    39. Send an envelope to an In Person Signer

    + + +

    Documentation about this example.

    +
    + +

    API method used: + Envelopes::create. +

    + +

    + View source file ${sourceFile} on GitHub. +

    + +
    +
    + + + Enter the email address associated with the host's DocuSign account. We'll never share your email with anyone else. +
    +
    + + +
    +
    + + +
    + + + + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index b318c378..c0f80edd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -354,6 +354,12 @@ EnvelopeViews::createRecipient.

    + +

    39. Send an envelope to an In Person Signer

    +

    + API method used: + Envelopes::create. +

    From 5b2c0d03a3b072ca65d795d4ee00a48af5258922 Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 19 Jul 2022 16:38:38 +0300 Subject: [PATCH 302/699] removed extra session property --- .../eSignature/examples/EG039ControllerInPersonSigning.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java index 32c029f7..68a9aac9 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -28,8 +28,6 @@ public class EG039ControllerInPersonSigning extends AbstractEsignatureController private static final String DOCUMENT_NAME = "Lorem Ipsum"; private static final int ANCHOR_OFFSET_Y = 10; private static final int ANCHOR_OFFSET_X = 20; - - private final Session session; private final User user; @Autowired From 647ab9ef6ee493c60ddbe12eeb87dd771826e583 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 20 Jul 2022 12:46:33 +0300 Subject: [PATCH 303/699] removed the input for host email and added a method to retrieve an email of the authenticated user --- .../examples/AbstractEsignatureController.java | 15 +++++++++++++++ .../examples/EG039ControllerInPersonSigning.java | 7 +++++-- .../views/pages/esignature/examples/eg039.jsp | 7 ------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java index ba4e8e73..03f0b5c6 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java @@ -5,6 +5,8 @@ import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.client.auth.OAuth; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; @@ -62,4 +64,17 @@ protected static AccountsApi createAccountsApi(String basePath, String userAcces ApiClient apiClient = createApiClient(basePath, userAccessToken); return new AccountsApi(apiClient); } + + /** + * Get the email address of the authenticated user + * @param basePath URL to eSignature REST API + * @param userAccessToken user's access token + * @return users email address + */ + protected static String getAuthenticatedUserEmail(String basePath, String userAccessToken) throws ApiException { + ApiClient apiClient = createApiClient(basePath, userAccessToken); + OAuth.UserInfo userInfo = apiClient.getUserInfo(userAccessToken); + + return userInfo.getEmail(); + } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java index 68a9aac9..d313a815 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -40,15 +40,18 @@ public EG039ControllerInPersonSigning(DSConfiguration config, Session session, U @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { + String basePath = session.getBasePath(); + String accessToken = user.getAccessToken(); + String hostName = args.getHostName(); - String hostEmail = args.getHostEmail(); + String hostEmail = getAuthenticatedUserEmail(basePath, accessToken); String signerName = args.getSignerName(); String accountId = session.getAccountId(); EnvelopeDefinition envelope = InPersonSigningService.makeEnvelope(hostEmail, hostName, signerName, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X, DOCUMENT_FILE_NAME, DOCUMENT_NAME); - ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + ApiClient apiClient = createApiClient(basePath, accessToken); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index b5290e45..a9c87a62 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -16,13 +16,6 @@

    -
    - - - Enter the email address associated with the host's DocuSign account. We'll never share your email with anyone else. -
    Date: Thu, 21 Jul 2022 13:44:28 -0700 Subject: [PATCH 304/699] HTML updates, removing numbers, updating in person signer text --- .../views/pages/esignature/examples/eg001.jsp | 2 +- .../views/pages/esignature/examples/eg002.jsp | 2 +- .../views/pages/esignature/examples/eg003.jsp | 2 +- .../views/pages/esignature/examples/eg004.jsp | 2 +- .../views/pages/esignature/examples/eg005.jsp | 2 +- .../views/pages/esignature/examples/eg006.jsp | 2 +- .../views/pages/esignature/examples/eg007.jsp | 2 +- .../views/pages/esignature/examples/eg008.jsp | 2 +- .../views/pages/esignature/examples/eg009.jsp | 2 +- .../views/pages/esignature/examples/eg010.jsp | 2 +- .../views/pages/esignature/examples/eg011.jsp | 2 +- .../views/pages/esignature/examples/eg012.jsp | 2 +- .../views/pages/esignature/examples/eg013.jsp | 2 +- .../views/pages/esignature/examples/eg014.jsp | 2 +- .../views/pages/esignature/examples/eg015.jsp | 2 +- .../views/pages/esignature/examples/eg016.jsp | 2 +- .../views/pages/esignature/examples/eg017.jsp | 2 +- .../views/pages/esignature/examples/eg018.jsp | 2 +- .../views/pages/esignature/examples/eg019.jsp | 2 +- .../views/pages/esignature/examples/eg020.jsp | 2 +- .../views/pages/esignature/examples/eg022.jsp | 2 +- .../views/pages/esignature/examples/eg023.jsp | 2 +- .../views/pages/esignature/examples/eg024.jsp | 2 +- .../views/pages/esignature/examples/eg025.jsp | 2 +- .../views/pages/esignature/examples/eg026.jsp | 2 +- .../views/pages/esignature/examples/eg027.jsp | 2 +- .../views/pages/esignature/examples/eg028.jsp | 2 +- .../views/pages/esignature/examples/eg029.jsp | 2 +- .../views/pages/esignature/examples/eg030.jsp | 2 +- .../views/pages/esignature/examples/eg031.jsp | 2 +- .../views/pages/esignature/examples/eg032.jsp | 2 +- .../views/pages/esignature/examples/eg033.jsp | 2 +- .../views/pages/esignature/examples/eg034.jsp | 2 +- .../views/pages/esignature/examples/eg035.jsp | 2 +- .../views/pages/esignature/examples/eg036.jsp | 2 +- .../views/pages/esignature/examples/eg037.jsp | 2 +- .../views/pages/esignature/examples/eg038.jsp | 2 +- .../views/pages/esignature/examples/eg039.jsp | 6 +- .../views/pages/esignature/index.jsp | 89 ++++++++++--------- 39 files changed, 86 insertions(+), 83 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp index fa3f06a7..c92d6906 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    1. Embedded Signing

    +

    Embedded Signing

    This example sends an envelope, and then uses Embedded signing for the first signer.

    Embedded signing provides a smoother user experience for the signer: DocuSign signing is initiated from your website.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp index 0ae1d857..52372d19 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Send an envelope with a remote (email) signer and cc recipient

    +

    Send an envelope with a remote (email) signer and cc recipient

    The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp index 869b11ec..1b86f5ee 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    3. List envelopes in the user's account

    +

    List envelopes in the user's account

    List the envelopes created in the last 30 days.

    This example demonstrates how to query DocuSign about envelopes sent by the current user.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index 1ed6abc0..27febcc2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    4. Get an envelope's basic information and status

    +

    Get an envelope's basic information and status

    List the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the envelope, its documents, recipients, etc.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index a2efe59b..dfefbabc 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    5. List an envelope's recipients and their status

    +

    List an envelope's recipients and their status

    List the envelope's recipients, including their current status.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index f9ab7f2c..35dce7a4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    6. List an envelope's documents

    +

    List an envelope's documents

    List the envelope's documents. A Certificate of Completion document is also associated with every envelope.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index a266dfa9..14e0d54d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    7. Download a document from an envelope

    +

    Download a document from an envelope

    An envelope's documents can be downloaded one by one or as a complete set.

    Document download options:

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp index c66d459a..cd378762 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      8. Create a template

      +

      Create a template

      Create a template with two roles, signer and cc. The template includes three documents.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index f618d788..7a87b97a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      9. Send an envelope using a template

      +

      Send an envelope using a template

      The envelope is defined by the template. The signer and cc recipient name and email are used to fill in the template's roles.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp index 8fa3f89d..231a1e89 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      10. Send an envelope using binary document transfer

      +

      Send an envelope using binary document transfer

      The envelope includes a pdf, Word, and HTML document.

      Multipart data transfer is used to send the documents in binary format to DocuSign. Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 242639c1..0838a729 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      11. Use embedded sending

      +

      Use embedded sending

      An envelope will be created in draft mode. Your browser will then be redirected to the DocuSign web tool where the envelope can be (optionally) updated and then sent.

      The envelope includes a pdf, Word, and HTML document. Anchor text diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index 7a4460d9..d18d232d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      12. Embedded DocuSign web tool

      +

      Embedded DocuSign web tool

      Redirect the user to the DocuSign web tool.

      Use this API call to open the DocuSign web tool, the NDSE (New DocuSign Signing Experience), with the user already logged in.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index 2837541e..d4c31fe8 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      13. Use embedded signing from a template with an added document

      +

      Use embedded signing from a template with an added document

      This example sends an envelope based on a template.

      In addition to the template's document(s), the example adds an diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp index 2b8af6fb..03483d7f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      14. Send an envelope with an order form, including a payment field.

      +

      Send an envelope with an order form, including a payment field.

      Note: This example will only work if the sender's DocuSign account is set up with a DocuSign payment gateway. Since the Payment Gateway ID diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp index 49ad329b..2f10b8b6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      15. Get the tab data from an envelope.

      +

      Get the tab data from an envelope.

      Get the tab (field) values from an envelope for all of the envelope's recipients.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp index 83ecfe0d..340667ed 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      16. Set tab values for an envelope.

      +

      Set tab values for an envelope.

      This example creates an example with both read-only tabs (fields) and tabs that can diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index a93dd2c5..86e31a87 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -2,7 +2,7 @@ -

      17. Set template tab values

      +

      Set template tab values

      This example sets the value of a template's tabs. It includes setting radio button and checkbox tabs. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index 51296439..d89ffcbe 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      18. Get the custom field data for an envelope

      +

      Get the custom field data for an envelope

      Get the data values associated with the envelope itself. The custom data fields enable you to add additional meta-data to the envelope. The custom data fields can be set by the Sender diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp index 31f989b5..851d5553 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      19. Send an envelope with a recipient using Access Code Authentication.

      +

      Send an envelope with a recipient using Access Code Authentication.

      The envelope includes a pdf document. Anchor text diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp index b026c486..36b24f9c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      20. Require Phone Authentication for a Recipient

      +

      Require Phone Authentication for a Recipient

      Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

      The envelope includes a PDF file. Anchor text (AutoPlace) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp index 71f8061f..320aa574 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      22. Send an envelope with a recipient using Knowledge-Based Authentication.

      +

      Send an envelope with a recipient using Knowledge-Based Authentication.

      Documentation about this example.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp index 668099e5..468ca7ed 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      23. Requiring Id Verification for a Recipient

      +

      Requiring Id Verification for a Recipient

      The envelope includes a pdf document. Anchor text diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp index 5ce6a98f..c2a387af 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      24. ${title}.

      +

      ${title}.

      Permission profiles are collections of account settings that determine the behavior and actions diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp index 585e8d6b..cc8c0b73 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      25. ${title}.

      +

      ${title}.

      Permission profiles are collections of account settings that determine the behavior and actions diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp index 72872b9d..6e8e0b18 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      26. ${title}.

      +

      ${title}.

      This code example demonstrates how to edit individual permission settings on a permissions profile diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp index 5b91aaf4..5dd3c4db 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      27. ${title}.

      +

      ${title}.

      Permission profiles are collections of account settings that determine the behavior and actions diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp index bdf72183..bd32c635 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      28. Creating a brand.

      +

      Creating a brand.

      The brand includes a Brand Name Configure Brands. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index d9882236..fb007f7d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -

      29. Applying a brand to an envelope

      +

      Applying a brand to an envelope

      The envelope includes a pdf document. Anchor text (AutoPlace) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp index 4711405b..2fc9dbc1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -

      30. Applying a brand to a template

      +

      Applying a brand to a template

      This code example demonstrates how to apply a brand to an template.

      The envelope is defined by the template. The signer and cc recipient diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index 4a0d5e9f..c0b2171c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      31. ${title}

      +

      ${title}.

      Demonstrates how to send envelopes in bulk to multiple recipients. First, this example diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp index ce7c089a..e4969bf8 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      32. ${title}.

      +

      ${title}.

      This topic demonstrates how to create an envelope where the workflow is paused before the diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp index c8f26460..a2b1538d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      33. ${title}.

      +

      ${title}.

      This topic demonstrates how to resume an envelope workflow that has been paused. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp index 4b2b8dae..790ae380 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      34. ${title}.

      +

      ${title}.

      This topic demonstrates how to create an envelope where the workflow is routed to diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp index 7f5f06d1..3c8442e0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      35. Schedule an envelope

      +

      Schedule an envelope

      Demonstrates how to schedule an envelope using the scheduled sending feature.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp index c55c1b5c..26483adc 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      36. Send an envelope with delayed routing

      +

      Send an envelope with delayed routing

      Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp index bcb341b9..0c49c4ed 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      37. Request a signature by SMS delivery

      +

      Request a signature by SMS delivery

      Sends a signature request via an SMS message.

      Documentation about this example.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp index eaf87f22..bead6ccd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      38. Create a signable HTML document

      +

      Create a signable HTML document

      Demonstrates how to create an HTML document for responsive signing.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index a9c87a62..62732a02 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -1,8 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      39. Send an envelope to an In Person Signer

      - +

      Send an envelope to an In Person Signer

      +

      + Demonstrates how to host an In Person Signing session with embedded signing. +

      Documentation about this example.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index c0f80edd..b3ad5bcd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -28,7 +28,7 @@

      Basic examples

      -

      1. Use embedded signing

      +

      Use embedded signing

      This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, the DocuSign signing is initiated from your website.

      @@ -37,7 +37,7 @@ EnvelopeViews::createRecipient.

      -

      2. Send an envelope with a remote (email) signer and cc recipient

      +

      Send an envelope with a remote (email) signer and cc recipient

      The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents. @@ -46,14 +46,14 @@ Envelopes::create.

      -

      3. List envelopes in the user's account

      +

      List envelopes in the user's account

      List the envelopes created in the last 30 days.

      API method used: Envelopes::listStatusChanges.

      -

      4. Get an envelope's basic information and status

      +

      Get an envelope's basic information and status

      List the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the envelope, its documents, recipients, etc. @@ -62,14 +62,14 @@ Envelopes::get.

      -

      5. List an envelope's recipients and their status

      +

      List an envelope's recipients and their status

      List the envelope's recipients, including their current status.

      API method used: EnvelopeRecipients::list.

      -

      6. List an envelope's documents

      +

      List an envelope's documents

      List the envelope's documents. A Certificate of Completion document is also associated with every envelope.

      @@ -77,28 +77,28 @@ EnvelopeDocuments::list.

      -

      7. Download a document from an envelope

      +

      Download a document from an envelope

      An envelope's documents can be downloaded one by one or as a complete set.

      API method used: EnvelopeDocuments::get.

      -

      8. Create a template

      +

      Create a template

      Create a template with two roles, signer and cc.

      API methods used: Templates::list, Templates::create.

      -

      9. Send an envelope using a template

      +

      Send an envelope using a template

      The envelope is defined by the template. The signer and cc recipient name and email are used to fill in the template's roles.

      API method used: Envelopes::create.

      -

      10. Send an envelope using binary document transfer

      +

      Send an envelope using binary document transfer

      The envelope includes a pdf, Word, and HTML document.

      Multipart data transfer is used to send the documents in binary format to DocuSign. Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. @@ -108,7 +108,7 @@ Envelopes::create.

      -

      11. Use embedded sending

      +

      Use embedded sending

      An envelope will be created in draft mode. The DocuSign web tool (NDSE) will then be shown, enabling further updates to the envelope before it is sent. @@ -117,13 +117,13 @@ Envelopes::create, EnvelopeViews::createSender. -

      12. Embedded DocuSign web tool

      +

      Embedded DocuSign web tool

      Redirect the user to the DocuSign web tool.

      API method used: EnvelopeViews::createConsole.

      -

      13. Use embedded signing from a template with an added document

      +

      Use embedded signing from a template with an added document

      This example sends an envelope based on a template.

      In addition to the template's document(s), the example adds an additional document to the envelope by using the @@ -133,10 +133,18 @@ Envelopes::create and EnvelopeViews::createRecipient.

      +

      Send an envelope to an In Person Signer

      +

      + Demonstrates how to host an In Person Signing session with embedded signing. +

      +

      + API method used: + Envelopes::create. +

      Payments

      -

      14. Send an envelope with an order form and payment field

      +

      Send an envelope with an order form and payment field

      Anchor text (AutoPlace) is used to position the fields in the documents. @@ -147,14 +155,14 @@

      Tabs

      -

      15. Get the tab data from an envelope

      +

      Get the tab data from an envelope

      This example retrieves the tab (field) values from an envelope.

      API method used: EnvelopeFormData::get.

      -

      16. Set tab values for an envelope

      +

      Set tab values for an envelope

      This example sets the tab (field) values for an envelope including tabs that can and cannot be changed by the signer.

      API method used: @@ -162,7 +170,7 @@ EnvelopeViews::createRecipient.

      -

      17. Set template tab values

      +

      Set template tab values

      This example sets the tab (field) values for a template being used by an envelope.

      API method used: @@ -170,7 +178,7 @@ EnvelopeViews::createRecipient.

      -

      18. List envelope custom metadata field values

      +

      List envelope custom metadata field values

      This example lists the envelope's custom metadata field values.

      API method used: @@ -179,25 +187,25 @@

      Recipient authentication

      -

      19. Require access code authentication for a recipient

      +

      Require access code authentication for a recipient

      Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

      API method used: Envelopes::create.

      -

      20. Require phone authentication for a recipient

      +

      Require phone authentication for a recipient

      Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

      API method used: Envelopes::create.

      -

      22. Require knowledge-based authentication (KBA) for a recipient

      +

      Require knowledge-based authentication (KBA) for a recipient

      Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

      API method used: Envelopes::create.

      -

      23. Require ID verification (IDV) for a recipient

      +

      Require ID verification (IDV) for a recipient

      Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

      API method used: @@ -206,19 +214,19 @@

      Permissions

      -

      24. Create a new permission profile

      +

      Create a new permission profile

      API method used: AccountPermissionProfiles::create.

      -

      25. Setting a permission profile

      +

      Setting a permission profile

      This example allows you to set a permission profile on an existing user group.

      API method used: Groups::update.

      -

      26. Updating individual permission profile settings

      +

      Updating individual permission profile settings

      This example will update individual permission settings for a given account.

      @@ -227,7 +235,7 @@ AccountPermissionProfiles::update.

      -

      27. Deleting a permission profile

      +

      Deleting a permission profile

      This example lists all available permissions profiles and allows you to delete any without associated users. Please note that you cannot remove "Everyone" nor "Administrator" permission profiles.

      API method used: AccountPermissionProfiles::create. @@ -235,19 +243,19 @@

      Brands

      -

      28. Create a brand

      +

      Create a brand

      This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

      API method used: AccountBrands::create.

      -

      29. Applying a brand to an envelope

      +

      Applying a brand to an envelope

      This example will show you how to create an envelope using any of the created brands on your account.

      API method used: Envelopes::create.

      -

      30. Applying a brand to a template

      +

      Applying a brand to a template

      This example will show you how to create an envelope using a brand

      API method used: Envelopes::create. @@ -255,7 +263,7 @@

      Bulk operations

      -

      31. Bulk send envelopes

      +

      Bulk send envelopes

      Demonstrates how to send envelopes in bulk to multiple recipients. First, this example @@ -273,7 +281,7 @@

      Advanced recipient routing

      -

      32. Pause a signature workflow

      +

      Pause a signature workflow

      This topic demonstrates how to create an envelope where the workflow is paused before the @@ -287,7 +295,7 @@ Envelopes::create.

      -

      33. Unpause a signature workflow

      +

      Unpause a signature workflow

      This topic demonstrates how to resume an envelope workflow that has been paused. @@ -301,7 +309,7 @@ Envelopes::update.

      -

      34. Use conditional recipients

      +

      Use conditional recipients

      This topic demonstrates how to create an envelope where the workflow is routed to @@ -312,7 +320,7 @@ Envelopes::create.

      -

      35. Schedule an envelope

      +

      Schedule an envelope

      Demonstrates how to schedule an envelope using the scheduled sending feature.

      @@ -322,7 +330,7 @@ href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create.

      -

      36. Send an envelope with delayed routing

      +

      Send an envelope with delayed routing

      Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature.

      @@ -333,7 +341,7 @@

      Premium features

      -

      37. Request a signature by SMS delivery

      +

      Request a signature by SMS delivery

      Sends a signature requet via an SMS message.

      @@ -343,9 +351,7 @@ href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create.

      -

      Responsive signing

      - -

      38. Create a signable HTML document

      +

      Create a signable HTML document

      Demonstrates how to create an HTML document for responsive signing.

      @@ -355,11 +361,6 @@ href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient/">EnvelopeViews::createRecipient.

      -

      39. Send an envelope to an In Person Signer

      -

      - API method used: - Envelopes::create. -

    From 3b63f4627e440316421ce7dad2757b54ce0145dc Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Fri, 22 Jul 2022 10:01:30 -0700 Subject: [PATCH 305/699] Removing the hostName from UI and getting it from account instead --- .../examples/AbstractEsignatureController.java | 13 +++++++++++++ .../examples/EG039ControllerInPersonSigning.java | 2 +- .../views/pages/esignature/examples/eg039.jsp | 5 ----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java index 03f0b5c6..e7b0616f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java @@ -77,4 +77,17 @@ protected static String getAuthenticatedUserEmail(String basePath, String userAc return userInfo.getEmail(); } + + /** + * Get the name of the authenticated user + * @param basePath URL to eSignature REST API + * @param userAccessToken user's access token + * @return users email address + */ + protected static String getAuthenticatedUserName(String basePath, String userAccessToken) throws ApiException { + ApiClient apiClient = createApiClient(basePath, userAccessToken); + OAuth.UserInfo userInfo = apiClient.getUserInfo(userAccessToken); + + return userInfo.getName(); + } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java index d313a815..b6f763eb 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -43,7 +43,7 @@ protected Object doWork(WorkArguments args, ModelMap model, String basePath = session.getBasePath(); String accessToken = user.getAccessToken(); - String hostName = args.getHostName(); + String hostName = getAuthenticatedUserName(basePath, accessToken); String hostEmail = getAuthenticatedUserEmail(basePath, accessToken); String signerName = args.getSignerName(); String accountId = session.getAccountId(); diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index 62732a02..80817d75 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -18,11 +18,6 @@

    -
    - - -
    Date: Mon, 25 Jul 2022 09:36:11 -0700 Subject: [PATCH 306/699] Adding Step comments --- .../eSignature/examples/EG039ControllerInPersonSigning.java | 4 ++++ .../eSignature/services/InPersonSigningService.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java index b6f763eb..28794095 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -51,11 +51,15 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopeDefinition envelope = InPersonSigningService.makeEnvelope(hostEmail, hostName, signerName, ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X, DOCUMENT_FILE_NAME, DOCUMENT_NAME); + // Step 3 start ApiClient apiClient = createApiClient(basePath, accessToken); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + // Step 3 end + // Step 5 start RecipientViewRequest viewRequest = InPersonSigningService.makeRecipientViewRequest(hostEmail, hostName, config); + // Step 5 end ViewUrl viewUrl = InPersonSigningService.inPersonSigning( envelopesApi, diff --git a/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java index 2c219e7a..a2cfbefa 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java @@ -19,6 +19,7 @@ public static ViewUrl inPersonSigning( return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); } + // Step 4 start public static RecipientViewRequest makeRecipientViewRequest( String hostEmail, String hostName, @@ -39,7 +40,9 @@ public static RecipientViewRequest makeRecipientViewRequest( return viewRequest; } + // Step 4 end + // Step 2 start public static EnvelopeDefinition makeEnvelope( String hostEmail, String hostName, @@ -71,4 +74,5 @@ public static EnvelopeDefinition makeEnvelope( return envelopeDefinition; } + // Step 2 end } From a5e20ee84618f32da71d5a084b4cada9f81aa114 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 25 Jul 2022 09:37:48 -0700 Subject: [PATCH 307/699] Adding new In Person Signer code example --- .../com/docusign/common/WorkArguments.java | 2 + .../AbstractEsignatureController.java | 28 ++++++ .../EG039ControllerInPersonSigning.java | 72 ++++++++++++++++ .../services/InPersonSigningService.java | 78 +++++++++++++++++ .../views/pages/esignature/examples/eg001.jsp | 2 +- .../views/pages/esignature/examples/eg002.jsp | 2 +- .../views/pages/esignature/examples/eg003.jsp | 2 +- .../views/pages/esignature/examples/eg004.jsp | 2 +- .../views/pages/esignature/examples/eg005.jsp | 2 +- .../views/pages/esignature/examples/eg006.jsp | 2 +- .../views/pages/esignature/examples/eg007.jsp | 2 +- .../views/pages/esignature/examples/eg008.jsp | 2 +- .../views/pages/esignature/examples/eg009.jsp | 2 +- .../views/pages/esignature/examples/eg010.jsp | 2 +- .../views/pages/esignature/examples/eg011.jsp | 2 +- .../views/pages/esignature/examples/eg012.jsp | 2 +- .../views/pages/esignature/examples/eg013.jsp | 2 +- .../views/pages/esignature/examples/eg014.jsp | 2 +- .../views/pages/esignature/examples/eg015.jsp | 2 +- .../views/pages/esignature/examples/eg016.jsp | 2 +- .../views/pages/esignature/examples/eg017.jsp | 2 +- .../views/pages/esignature/examples/eg018.jsp | 2 +- .../views/pages/esignature/examples/eg019.jsp | 2 +- .../views/pages/esignature/examples/eg020.jsp | 2 +- .../views/pages/esignature/examples/eg022.jsp | 2 +- .../views/pages/esignature/examples/eg023.jsp | 2 +- .../views/pages/esignature/examples/eg024.jsp | 2 +- .../views/pages/esignature/examples/eg025.jsp | 2 +- .../views/pages/esignature/examples/eg026.jsp | 2 +- .../views/pages/esignature/examples/eg027.jsp | 2 +- .../views/pages/esignature/examples/eg028.jsp | 2 +- .../views/pages/esignature/examples/eg029.jsp | 2 +- .../views/pages/esignature/examples/eg030.jsp | 2 +- .../views/pages/esignature/examples/eg031.jsp | 2 +- .../views/pages/esignature/examples/eg032.jsp | 2 +- .../views/pages/esignature/examples/eg033.jsp | 2 +- .../views/pages/esignature/examples/eg034.jsp | 2 +- .../views/pages/esignature/examples/eg035.jsp | 2 +- .../views/pages/esignature/examples/eg036.jsp | 2 +- .../views/pages/esignature/examples/eg037.jsp | 2 +- .../views/pages/esignature/examples/eg038.jsp | 2 +- .../views/pages/esignature/examples/eg039.jsp | 30 +++++++ .../views/pages/esignature/index.jsp | 85 ++++++++++--------- 43 files changed, 293 insertions(+), 76 deletions(-) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index daa02bf3..2b5a762a 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -71,4 +71,6 @@ public class WorkArguments { private String delay; private String clickwrap; private String clickwrapId; + private String hostEmail; + private String hostName; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java index ba4e8e73..e7b0616f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java @@ -5,6 +5,8 @@ import com.docusign.esign.api.AccountsApi; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.client.auth.OAuth; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; @@ -62,4 +64,30 @@ protected static AccountsApi createAccountsApi(String basePath, String userAcces ApiClient apiClient = createApiClient(basePath, userAccessToken); return new AccountsApi(apiClient); } + + /** + * Get the email address of the authenticated user + * @param basePath URL to eSignature REST API + * @param userAccessToken user's access token + * @return users email address + */ + protected static String getAuthenticatedUserEmail(String basePath, String userAccessToken) throws ApiException { + ApiClient apiClient = createApiClient(basePath, userAccessToken); + OAuth.UserInfo userInfo = apiClient.getUserInfo(userAccessToken); + + return userInfo.getEmail(); + } + + /** + * Get the name of the authenticated user + * @param basePath URL to eSignature REST API + * @param userAccessToken user's access token + * @return users email address + */ + protected static String getAuthenticatedUserName(String basePath, String userAccessToken) throws ApiException { + ApiClient apiClient = createApiClient(basePath, userAccessToken); + OAuth.UserInfo userInfo = apiClient.getUserInfo(userAccessToken); + + return userInfo.getName(); + } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java new file mode 100644 index 00000000..28794095 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -0,0 +1,72 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.InPersonSigningService; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.RecipientViewRequest; +import com.docusign.esign.model.ViewUrl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.view.RedirectView; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Controller +@RequestMapping("/eg039") +public class EG039ControllerInPersonSigning extends AbstractEsignatureController { + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = 10; + private static final int ANCHOR_OFFSET_X = 20; + private final User user; + + @Autowired + public EG039ControllerInPersonSigning(DSConfiguration config, Session session, User user) { + super(config, "eg039", "In-person signing"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + String basePath = session.getBasePath(); + String accessToken = user.getAccessToken(); + + String hostName = getAuthenticatedUserName(basePath, accessToken); + String hostEmail = getAuthenticatedUserEmail(basePath, accessToken); + String signerName = args.getSignerName(); + String accountId = session.getAccountId(); + + EnvelopeDefinition envelope = InPersonSigningService.makeEnvelope(hostEmail, hostName, signerName, + ANCHOR_OFFSET_Y, ANCHOR_OFFSET_X, DOCUMENT_FILE_NAME, DOCUMENT_NAME); + + // Step 3 start + ApiClient apiClient = createApiClient(basePath, accessToken); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + // Step 3 end + // Step 5 start + RecipientViewRequest viewRequest = InPersonSigningService.makeRecipientViewRequest(hostEmail, hostName, config); + // Step 5 end + + ViewUrl viewUrl = InPersonSigningService.inPersonSigning( + envelopesApi, + accountId, + envelopeSummary.getEnvelopeId(), + viewRequest); + + return new RedirectView(viewUrl.getUrl()); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java new file mode 100644 index 00000000..a2cfbefa --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/InPersonSigningService.java @@ -0,0 +1,78 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.DSConfiguration; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Collections; + +public final class InPersonSigningService { + public static ViewUrl inPersonSigning( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + // Step 4 start + public static RecipientViewRequest makeRecipientViewRequest( + String hostEmail, + String hostName, + DSConfiguration config) + { + String stateValue = "?state=123"; + String authenticationMethod = "none"; + String pingFrequency = "600"; + + RecipientViewRequest viewRequest = new RecipientViewRequest(); + + viewRequest.setReturnUrl(config.getDsReturnUrl() + stateValue); + viewRequest.setAuthenticationMethod(authenticationMethod); + viewRequest.setEmail(hostEmail); + viewRequest.setUserName(hostName); + viewRequest.setPingFrequency(pingFrequency); + viewRequest.setPingUrl(config.getDsPingUrl()); + + return viewRequest; + } + // Step 4 end + + // Step 2 start + public static EnvelopeDefinition makeEnvelope( + String hostEmail, + String hostName, + String signerName, + Integer anchorOffsetY, + Integer anchorOffsetX, + String documentFileName, + String documentName + ) throws IOException { + InPersonSigner inPersonSigner = new InPersonSigner(); + + inPersonSigner.setHostEmail(hostEmail); + inPersonSigner.setHostName(hostName); + inPersonSigner.setSignerName(signerName); + inPersonSigner.setRecipientId("1"); + inPersonSigner.setRoutingOrder("1"); + inPersonSigner.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", anchorOffsetY, anchorOffsetX)); + + Recipients recipients = new Recipients(); + recipients.setInPersonSigners(Collections.singletonList(inPersonSigner)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please host this in-person signing session"); + envelopeDefinition.setRecipients(recipients); + + Document document = EnvelopeHelpers.createDocumentFromFile(documentFileName, documentName, "1"); + envelopeDefinition.setDocuments(Collections.singletonList(document)); + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } + // Step 2 end +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp index fa3f06a7..c92d6906 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    1. Embedded Signing

    +

    Embedded Signing

    This example sends an envelope, and then uses Embedded signing for the first signer.

    Embedded signing provides a smoother user experience for the signer: DocuSign signing is initiated from your website.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp index 0ae1d857..52372d19 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Send an envelope with a remote (email) signer and cc recipient

    +

    Send an envelope with a remote (email) signer and cc recipient

    The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp index 869b11ec..1b86f5ee 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    3. List envelopes in the user's account

    +

    List envelopes in the user's account

    List the envelopes created in the last 30 days.

    This example demonstrates how to query DocuSign about envelopes sent by the current user.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index 1ed6abc0..27febcc2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    4. Get an envelope's basic information and status

    +

    Get an envelope's basic information and status

    List the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the envelope, its documents, recipients, etc.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index a2efe59b..dfefbabc 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    5. List an envelope's recipients and their status

    +

    List an envelope's recipients and their status

    List the envelope's recipients, including their current status.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index f9ab7f2c..35dce7a4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    6. List an envelope's documents

    +

    List an envelope's documents

    List the envelope's documents. A Certificate of Completion document is also associated with every envelope.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index a266dfa9..14e0d54d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    7. Download a document from an envelope

    +

    Download a document from an envelope

    An envelope's documents can be downloaded one by one or as a complete set.

    Document download options:

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp index c66d459a..cd378762 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      8. Create a template

      +

      Create a template

      Create a template with two roles, signer and cc. The template includes three documents.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index f618d788..7a87b97a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      9. Send an envelope using a template

      +

      Send an envelope using a template

      The envelope is defined by the template. The signer and cc recipient name and email are used to fill in the template's roles.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp index 8fa3f89d..231a1e89 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      10. Send an envelope using binary document transfer

      +

      Send an envelope using binary document transfer

      The envelope includes a pdf, Word, and HTML document.

      Multipart data transfer is used to send the documents in binary format to DocuSign. Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 242639c1..0838a729 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      11. Use embedded sending

      +

      Use embedded sending

      An envelope will be created in draft mode. Your browser will then be redirected to the DocuSign web tool where the envelope can be (optionally) updated and then sent.

      The envelope includes a pdf, Word, and HTML document. Anchor text diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index 7a4460d9..d18d232d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      12. Embedded DocuSign web tool

      +

      Embedded DocuSign web tool

      Redirect the user to the DocuSign web tool.

      Use this API call to open the DocuSign web tool, the NDSE (New DocuSign Signing Experience), with the user already logged in.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index 2837541e..d4c31fe8 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      13. Use embedded signing from a template with an added document

      +

      Use embedded signing from a template with an added document

      This example sends an envelope based on a template.

      In addition to the template's document(s), the example adds an diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp index 2b8af6fb..03483d7f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      14. Send an envelope with an order form, including a payment field.

      +

      Send an envelope with an order form, including a payment field.

      Note: This example will only work if the sender's DocuSign account is set up with a DocuSign payment gateway. Since the Payment Gateway ID diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp index 49ad329b..2f10b8b6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      15. Get the tab data from an envelope.

      +

      Get the tab data from an envelope.

      Get the tab (field) values from an envelope for all of the envelope's recipients.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp index 83ecfe0d..340667ed 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      16. Set tab values for an envelope.

      +

      Set tab values for an envelope.

      This example creates an example with both read-only tabs (fields) and tabs that can diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index a93dd2c5..86e31a87 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -2,7 +2,7 @@ -

      17. Set template tab values

      +

      Set template tab values

      This example sets the value of a template's tabs. It includes setting radio button and checkbox tabs. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index 51296439..d89ffcbe 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      18. Get the custom field data for an envelope

      +

      Get the custom field data for an envelope

      Get the data values associated with the envelope itself. The custom data fields enable you to add additional meta-data to the envelope. The custom data fields can be set by the Sender diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp index 31f989b5..851d5553 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      19. Send an envelope with a recipient using Access Code Authentication.

      +

      Send an envelope with a recipient using Access Code Authentication.

      The envelope includes a pdf document. Anchor text diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp index b026c486..36b24f9c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      20. Require Phone Authentication for a Recipient

      +

      Require Phone Authentication for a Recipient

      Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

      The envelope includes a PDF file. Anchor text (AutoPlace) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp index 71f8061f..320aa574 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      22. Send an envelope with a recipient using Knowledge-Based Authentication.

      +

      Send an envelope with a recipient using Knowledge-Based Authentication.

      Documentation about this example.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp index 668099e5..468ca7ed 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      23. Requiring Id Verification for a Recipient

      +

      Requiring Id Verification for a Recipient

      The envelope includes a pdf document. Anchor text diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp index 5ce6a98f..c2a387af 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      24. ${title}.

      +

      ${title}.

      Permission profiles are collections of account settings that determine the behavior and actions diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp index 585e8d6b..cc8c0b73 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      25. ${title}.

      +

      ${title}.

      Permission profiles are collections of account settings that determine the behavior and actions diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp index 72872b9d..6e8e0b18 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      26. ${title}.

      +

      ${title}.

      This code example demonstrates how to edit individual permission settings on a permissions profile diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp index 5b91aaf4..5dd3c4db 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      27. ${title}.

      +

      ${title}.

      Permission profiles are collections of account settings that determine the behavior and actions diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp index bdf72183..bd32c635 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      28. Creating a brand.

      +

      Creating a brand.

      The brand includes a Brand Name Configure Brands. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index d9882236..fb007f7d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -

      29. Applying a brand to an envelope

      +

      Applying a brand to an envelope

      The envelope includes a pdf document. Anchor text (AutoPlace) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp index 4711405b..2fc9dbc1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -

      30. Applying a brand to a template

      +

      Applying a brand to a template

      This code example demonstrates how to apply a brand to an template.

      The envelope is defined by the template. The signer and cc recipient diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index 4a0d5e9f..c0b2171c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      31. ${title}

      +

      ${title}.

      Demonstrates how to send envelopes in bulk to multiple recipients. First, this example diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp index ce7c089a..e4969bf8 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      32. ${title}.

      +

      ${title}.

      This topic demonstrates how to create an envelope where the workflow is paused before the diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp index c8f26460..a2b1538d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      33. ${title}.

      +

      ${title}.

      This topic demonstrates how to resume an envelope workflow that has been paused. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp index 4b2b8dae..790ae380 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      34. ${title}.

      +

      ${title}.

      This topic demonstrates how to create an envelope where the workflow is routed to diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp index 7f5f06d1..3c8442e0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      35. Schedule an envelope

      +

      Schedule an envelope

      Demonstrates how to schedule an envelope using the scheduled sending feature.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp index c55c1b5c..26483adc 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      36. Send an envelope with delayed routing

      +

      Send an envelope with delayed routing

      Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp index bcb341b9..0c49c4ed 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      37. Request a signature by SMS delivery

      +

      Request a signature by SMS delivery

      Sends a signature request via an SMS message.

      Documentation about this example.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp index eaf87f22..bead6ccd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

      38. Create a signable HTML document

      +

      Create a signable HTML document

      Demonstrates how to create an HTML document for responsive signing.

      diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp new file mode 100644 index 00000000..80817d75 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -0,0 +1,30 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

      Send an envelope to an In Person Signer

      +

      + Demonstrates how to host an In Person Signing session with embedded signing. +

      + +

      Documentation about this example.

      +
      + +

      API method used: + Envelopes::create. +

      + +

      + View source file ${sourceFile} on GitHub. +

      + + +
      + + +
      + + + + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index b318c378..b3ad5bcd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -28,7 +28,7 @@

      Basic examples

      -

      1. Use embedded signing

      +

      Use embedded signing

      This example sends an envelope, and then uses embedded signing for the first signer. With embedded signing, the DocuSign signing is initiated from your website.

      @@ -37,7 +37,7 @@ EnvelopeViews::createRecipient.

      -

      2. Send an envelope with a remote (email) signer and cc recipient

      +

      Send an envelope with a remote (email) signer and cc recipient

      The envelope includes a pdf, Word, and HTML document. Anchor text (AutoPlace) is used to position the signing fields in the documents. @@ -46,14 +46,14 @@ Envelopes::create.

      -

      3. List envelopes in the user's account

      +

      List envelopes in the user's account

      List the envelopes created in the last 30 days.

      API method used: Envelopes::listStatusChanges.

      -

      4. Get an envelope's basic information and status

      +

      Get an envelope's basic information and status

      List the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the envelope, its documents, recipients, etc. @@ -62,14 +62,14 @@ Envelopes::get.

      -

      5. List an envelope's recipients and their status

      +

      List an envelope's recipients and their status

      List the envelope's recipients, including their current status.

      API method used: EnvelopeRecipients::list.

      -

      6. List an envelope's documents

      +

      List an envelope's documents

      List the envelope's documents. A Certificate of Completion document is also associated with every envelope.

      @@ -77,28 +77,28 @@ EnvelopeDocuments::list.

      -

      7. Download a document from an envelope

      +

      Download a document from an envelope

      An envelope's documents can be downloaded one by one or as a complete set.

      API method used: EnvelopeDocuments::get.

      -

      8. Create a template

      +

      Create a template

      Create a template with two roles, signer and cc.

      API methods used: Templates::list, Templates::create.

      -

      9. Send an envelope using a template

      +

      Send an envelope using a template

      The envelope is defined by the template. The signer and cc recipient name and email are used to fill in the template's roles.

      API method used: Envelopes::create.

      -

      10. Send an envelope using binary document transfer

      +

      Send an envelope using binary document transfer

      The envelope includes a pdf, Word, and HTML document.

      Multipart data transfer is used to send the documents in binary format to DocuSign. Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. @@ -108,7 +108,7 @@ Envelopes::create.

      -

      11. Use embedded sending

      +

      Use embedded sending

      An envelope will be created in draft mode. The DocuSign web tool (NDSE) will then be shown, enabling further updates to the envelope before it is sent. @@ -117,13 +117,13 @@ Envelopes::create, EnvelopeViews::createSender. -

      12. Embedded DocuSign web tool

      +

      Embedded DocuSign web tool

      Redirect the user to the DocuSign web tool.

      API method used: EnvelopeViews::createConsole.

      -

      13. Use embedded signing from a template with an added document

      +

      Use embedded signing from a template with an added document

      This example sends an envelope based on a template.

      In addition to the template's document(s), the example adds an additional document to the envelope by using the @@ -133,10 +133,18 @@ Envelopes::create and EnvelopeViews::createRecipient.

      +

      Send an envelope to an In Person Signer

      +

      + Demonstrates how to host an In Person Signing session with embedded signing. +

      +

      + API method used: + Envelopes::create. +

      Payments

      -

      14. Send an envelope with an order form and payment field

      +

      Send an envelope with an order form and payment field

      Anchor text (AutoPlace) is used to position the fields in the documents. @@ -147,14 +155,14 @@

      Tabs

      -

      15. Get the tab data from an envelope

      +

      Get the tab data from an envelope

      This example retrieves the tab (field) values from an envelope.

      API method used: EnvelopeFormData::get.

      -

      16. Set tab values for an envelope

      +

      Set tab values for an envelope

      This example sets the tab (field) values for an envelope including tabs that can and cannot be changed by the signer.

      API method used: @@ -162,7 +170,7 @@ EnvelopeViews::createRecipient.

      -

      17. Set template tab values

      +

      Set template tab values

      This example sets the tab (field) values for a template being used by an envelope.

      API method used: @@ -170,7 +178,7 @@ EnvelopeViews::createRecipient.

      -

      18. List envelope custom metadata field values

      +

      List envelope custom metadata field values

      This example lists the envelope's custom metadata field values.

      API method used: @@ -179,25 +187,25 @@

      Recipient authentication

      -

      19. Require access code authentication for a recipient

      +

      Require access code authentication for a recipient

      Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

      API method used: Envelopes::create.

      -

      20. Require phone authentication for a recipient

      +

      Require phone authentication for a recipient

      Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

      API method used: Envelopes::create.

      -

      22. Require knowledge-based authentication (KBA) for a recipient

      +

      Require knowledge-based authentication (KBA) for a recipient

      Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

      API method used: Envelopes::create.

      -

      23. Require ID verification (IDV) for a recipient

      +

      Require ID verification (IDV) for a recipient

      Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

      API method used: @@ -206,19 +214,19 @@

      Permissions

      -

      24. Create a new permission profile

      +

      Create a new permission profile

      API method used: AccountPermissionProfiles::create.

      -

      25. Setting a permission profile

      +

      Setting a permission profile

      This example allows you to set a permission profile on an existing user group.

      API method used: Groups::update.

      -

      26. Updating individual permission profile settings

      +

      Updating individual permission profile settings

      This example will update individual permission settings for a given account.

      @@ -227,7 +235,7 @@ AccountPermissionProfiles::update.

      -

      27. Deleting a permission profile

      +

      Deleting a permission profile

      This example lists all available permissions profiles and allows you to delete any without associated users. Please note that you cannot remove "Everyone" nor "Administrator" permission profiles.

      API method used: AccountPermissionProfiles::create. @@ -235,19 +243,19 @@

      Brands

      -

      28. Create a brand

      +

      Create a brand

      This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

      API method used: AccountBrands::create.

      -

      29. Applying a brand to an envelope

      +

      Applying a brand to an envelope

      This example will show you how to create an envelope using any of the created brands on your account.

      API method used: Envelopes::create.

      -

      30. Applying a brand to a template

      +

      Applying a brand to a template

      This example will show you how to create an envelope using a brand

      API method used: Envelopes::create. @@ -255,7 +263,7 @@

      Bulk operations

      -

      31. Bulk send envelopes

      +

      Bulk send envelopes

      Demonstrates how to send envelopes in bulk to multiple recipients. First, this example @@ -273,7 +281,7 @@

      Advanced recipient routing

      -

      32. Pause a signature workflow

      +

      Pause a signature workflow

      This topic demonstrates how to create an envelope where the workflow is paused before the @@ -287,7 +295,7 @@ Envelopes::create.

      -

      33. Unpause a signature workflow

      +

      Unpause a signature workflow

      This topic demonstrates how to resume an envelope workflow that has been paused. @@ -301,7 +309,7 @@ Envelopes::update.

      -

      34. Use conditional recipients

      +

      Use conditional recipients

      This topic demonstrates how to create an envelope where the workflow is routed to @@ -312,7 +320,7 @@ Envelopes::create.

      -

      35. Schedule an envelope

      +

      Schedule an envelope

      Demonstrates how to schedule an envelope using the scheduled sending feature.

      @@ -322,7 +330,7 @@ href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create.

      -

      36. Send an envelope with delayed routing

      +

      Send an envelope with delayed routing

      Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature.

      @@ -333,7 +341,7 @@

      Premium features

      -

      37. Request a signature by SMS delivery

      +

      Request a signature by SMS delivery

      Sends a signature requet via an SMS message.

      @@ -343,9 +351,7 @@ href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/create/">Envelopes::create.

      -

      Responsive signing

      - -

      38. Create a signable HTML document

      +

      Create a signable HTML document

      Demonstrates how to create an HTML document for responsive signing.

      @@ -354,6 +360,7 @@ EnvelopeViews::createRecipient.

      +
    From 90ab3bca34297e32321aaee6661a67ee265bebe1 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 25 Jul 2022 10:45:40 -0700 Subject: [PATCH 308/699] Minor text updates --- .../views/pages/esignature/examples/eg039.jsp | 7 ++++--- .../WEB-INF/templates/views/pages/esignature/index.jsp | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index 80817d75..e6898f85 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -9,9 +9,10 @@

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    API methods used: + Envelopes::create , + EnvelopeViews::createRecipient. +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index b3ad5bcd..58fd1b63 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -137,11 +137,11 @@

    Demonstrates how to host an In Person Signing session with embedded signing.

    -

    - API method used: - Envelopes::create. -

    - +

    API methods used: + Envelopes::create and + EnvelopeViews::createRecipient. +

    +

    Payments

    Send an envelope with an order form and payment field

    From 3fa4cdd5b1bfc294d430960456dc872e2c37d678 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 25 Jul 2022 10:46:26 -0700 Subject: [PATCH 309/699] Small text updates --- .../views/pages/esignature/examples/eg039.jsp | 7 ++++--- .../WEB-INF/templates/views/pages/esignature/index.jsp | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index 80817d75..e6898f85 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -9,9 +9,10 @@

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    API methods used: + Envelopes::create , + EnvelopeViews::createRecipient. +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index b3ad5bcd..58fd1b63 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -137,11 +137,11 @@

    Demonstrates how to host an In Person Signing session with embedded signing.

    -

    - API method used: - Envelopes::create. -

    - +

    API methods used: + Envelopes::create and + EnvelopeViews::createRecipient. +

    +

    Payments

    Send an envelope with an order form and payment field

    From b6571f0059dd1144a417c750f7e6d78e6f5c819b Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 27 Jul 2022 17:44:58 +0300 Subject: [PATCH 310/699] added the set document visibility code example --- .../EG040ControllerSetDocumentVisibility.java | 73 ++++++++++++++ .../SetDocumentVisibilityService.java | 95 +++++++++++++++++++ .../core/controller/AbstractController.java | 7 +- .../com/docusign/core/model/DoneExample.java | 7 +- src/main/resources/doc_1.html | 20 ++++ .../webapp/WEB-INF/templates/views/error.jsp | 17 +++- .../views/pages/esignature/examples/eg040.jsp | 58 +++++++++++ .../views/pages/esignature/index.jsp | 18 ++++ 8 files changed, 288 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java create mode 100644 src/main/resources/doc_1.html create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java new file mode 100644 index 00000000..b4244314 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -0,0 +1,73 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.SetDocumentVisibilityService; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Controller +@RequestMapping("/eg040") +public class EG040ControllerSetDocumentVisibility extends AbstractEsignatureController { + private static final String DOCUMENT_FILE_NAME_PDF = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_FILE_NAME_DOCX = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCUMENT_FILE_NAME_HTML = "doc_1.html"; + private static final String CASE_FOR_INSTRUCTIONS = "ACCOUNT_LACKS_PERMISSIONS"; + private static final String FIXING_INSTRUCTIONS_FOR_PERMISSIONS = "See " + + "" + + "How to set document visibility for envelope recipients in the DocuSign Developer Center " + + "for instructions on how to enable document visibility in your developer account."; + private final User user; + + @Autowired + public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session session, User user) { + super(config, "eg040", "Set document visibility"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); + model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); + + String basePath = session.getBasePath(); + String accessToken = user.getAccessToken(); + + String signerName = args.getSignerName(); + String signerEmail = args.getSignerEmail(); + String signer2Name = args.getSignerName2(); + String signer2Email = args.getSignerEmail2(); + String ccName = args.getCcName(); + String ccEmail = args.getCcEmail(); + String accountId = session.getAccountId(); + + EnvelopeDefinition envelope = SetDocumentVisibilityService.makeEnvelope(signerEmail, signerName, signer2Email, + signer2Name, ccEmail, ccName, DOCUMENT_FILE_NAME_PDF, DOCUMENT_FILE_NAME_DOCX, DOCUMENT_FILE_NAME_HTML); + + ApiClient apiClient = createApiClient(basePath, accessToken); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + + DoneExample.createDefault(title) + .withMessage("The envelope has been created and sent!
    Envelope ID " + + envelopeSummary.getEnvelopeId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java b/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java new file mode 100644 index 00000000..e47daea3 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java @@ -0,0 +1,95 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.*; + +public final class SetDocumentVisibilityService { + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String signerEmail2, + String signerName2, + String ccEmail, + String ccName, + String documentFileNamePDF, + String documentFileNameDOCX, + String documentFileNameHTML + ) throws IOException { + CarbonCopy carbonCopy = new CarbonCopy(); + + carbonCopy.setEmail(ccEmail); + carbonCopy.setName(ccName); + carbonCopy.setRecipientId("3"); + carbonCopy.setRoutingOrder("2"); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(prepareSigners(signerEmail, signerName, signerEmail2, signerName2))); + recipients.setCarbonCopies(Collections.singletonList(carbonCopy)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document set"); + envelopeDefinition.setRecipients(recipients); + + envelopeDefinition.setDocuments(Arrays.asList(prepareDocumentsForSending( + documentFileNamePDF, + documentFileNameDOCX, + documentFileNameHTML))); + + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } + + private static Signer[] prepareSigners( + String signerEmail, + String signerName, + String signerEmail2, + String signerName2) + { + Signer signer1 = new Signer(); + + signer1.setEmail(signerEmail); + signer1.setName(signerName); + signer1.setRecipientId("1"); + signer1.setRoutingOrder("1"); + signer1.setExcludedDocuments(Arrays.asList(new String[]{"2", "3"})); + signer1.setTabs(EnvelopeHelpers.createSingleSignerTab("**signature_1**", 10, 20)); + + Signer signer2 = new Signer(); + + signer2.setEmail(signerEmail2); + signer2.setName(signerName2); + signer2.setRecipientId("2"); + signer2.setRoutingOrder("1"); + signer2.setExcludedDocuments(Arrays.asList(new String[]{"1"})); + signer2.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", 10, 20)); + + return new Signer[] {signer1, signer2}; + } + + private static Document[] prepareDocumentsForSending( + String documentFileNamePDF, + String documentFileNameDOCX, + String documentFileNameHTML) throws IOException + { + Document documentHTML = EnvelopeHelpers.createDocumentFromFile( + documentFileNameHTML, + "Order acknowledgement", + "1"); + + Document documentDOCX = EnvelopeHelpers.createDocumentFromFile( + documentFileNameDOCX, + "Battle Plan", + "2"); + + Document documentPDF = EnvelopeHelpers.createDocumentFromFile( + documentFileNamePDF, + "Lorem Ipsum", + "3"); + + return new Document[]{documentHTML, documentDOCX, documentPDF}; + } +} diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index cf59e5fc..ff8a6bc6 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -123,10 +123,15 @@ protected abstract Object doWork(WorkArguments args, ModelMap model, private String handleException(Exception exception, ModelMap model) { String stackTrace = ExceptionUtils.getStackTrace(exception); + String exceptionMessage = exception.getMessage(); + String fixingInstructions = exceptionMessage.contains((CharSequence) model.getAttribute("caseForInstructions")) ? + (String) model.getAttribute("fixingInstructions") : null; + new DoneExample() .withTitle(exampleName) .withName(title) - .withMessage(exception.getMessage()) + .withMessage(exceptionMessage) + .withFixingInstructions(fixingInstructions) .withStackTracePrinted(stackTrace) .addToModel(model); return ERROR_PAGE; diff --git a/src/main/java/com/docusign/core/model/DoneExample.java b/src/main/java/com/docusign/core/model/DoneExample.java index d25a0936..8668b69b 100644 --- a/src/main/java/com/docusign/core/model/DoneExample.java +++ b/src/main/java/com/docusign/core/model/DoneExample.java @@ -35,10 +35,10 @@ public class DoneExample { private String json; private StackTraceElement[] stackTrace; private String stackTracePrinted; + private String fixingInstructions; private Iterable diff; - /** * Creates DoneExample object with title. This method initializes title. * @param String title @@ -82,6 +82,11 @@ public DoneExample withMessage(String message) { return this; } + public DoneExample withFixingInstructions(String fixingInstructions) { + this.fixingInstructions = fixingInstructions; + return this; + } + /** * Creates DoneExample object with stackTrace. This method initializes error stack trace. * @param StackTraceElement[] stackTrace diff --git a/src/main/resources/doc_1.html b/src/main/resources/doc_1.html new file mode 100644 index 00000000..be6ec517 --- /dev/null +++ b/src/main/resources/doc_1.html @@ -0,0 +1,20 @@ + + + + + + +

    World Wide Corp

    +

    Order Processing Division

    +

    Ordered by {USER_FULLNAME}

    +

    Email: {USER_EMAIL}

    +

    +Candy bonbon pastry jujubes lollipop wafer biscuit biscuit. Topping brownie sesame snaps sweet roll pie. Croissant danish biscuit soufflé caramels jujubes jelly. Dragée danish caramels lemon drops dragée. Gummi bears cupcake biscuit tiramisu sugar plum pastry. Dragée gummies applicake pudding liquorice. Donut jujubes oat cake jelly-o. Dessert bear claw chocolate cake gummies lollipop sugar plum ice cream gummies cheesecake. +

    + +

    Agreed: **signature_1**/

    + + diff --git a/src/main/webapp/WEB-INF/templates/views/error.jsp b/src/main/webapp/WEB-INF/templates/views/error.jsp index 47d0fa45..9f83963d 100644 --- a/src/main/webapp/WEB-INF/templates/views/error.jsp +++ b/src/main/webapp/WEB-INF/templates/views/error.jsp @@ -11,13 +11,20 @@ -

    Oops, we have encountered a problem.

    -

    Message: ${done.message}

    -

    Dump: ${done.stackTracePrinted}

    + +

    Problem: an error occurred

    +

    Error information:

    +

    Message: ${done.message}

    +

    ${done.fixingInstructions}

    +
    + +

    Oops, we have encountered a problem.

    +

    Message: ${done.message}

    +

    Dump: ${done.stackTracePrinted}

    -

    Please check your account configuration. If you are unable to resolve the problem, open a new issue on GitHub.

    - +

    Please check your account configuration. If you are unable to resolve the problem, open a new issue on GitHub.

    +

    Continue

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp new file mode 100644 index 00000000..76715439 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp @@ -0,0 +1,58 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

    Set document visibility for envelope recipients

    +

    + Demonstrates how to set document visibility for envelope recipients. +

    + +

    Documentation about this example.

    + + +

    API method used: + Envelopes::create. +

    + +

    + View source file ${sourceFile} on GitHub. +

    + +
    +
    + + + We'll never share your email with anyone else. +
    +
    + + +
    +
    + + + We'll never share your email with anyone else. +
    +
    + + +
    +
    + + + The email for the cc recipient must be different from the signer. +
    +
    + + +
    + + + + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index b3ad5bcd..a27e1e12 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -361,6 +361,24 @@ href="https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopeviews/createrecipient/">EnvelopeViews::createRecipient.

    +

    Send an envelope to an In Person Signer

    +

    + Demonstrates how to host an In Person Signing session with embedded signing. +

    +

    + API method used: + Envelopes::create. +

    + +

    Set document visibility for envelope recipients

    +

    + Demonstrates how to set document visibility for envelope recipients. +

    +

    + API method used: + Envelopes::create. +

    + From a718eb53ebbaa0466d28979466cc0f1f53cc4522 Mon Sep 17 00:00:00 2001 From: annahileta Date: Fri, 29 Jul 2022 14:58:25 +0300 Subject: [PATCH 311/699] changed the tabs --- .../examples/EG040ControllerSetDocumentVisibility.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java index b4244314..15e97de2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -45,8 +45,8 @@ protected Object doWork(WorkArguments args, ModelMap model, model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); - String basePath = session.getBasePath(); - String accessToken = user.getAccessToken(); + String basePath = session.getBasePath(); + String accessToken = user.getAccessToken(); String signerName = args.getSignerName(); String signerEmail = args.getSignerEmail(); From d52d77e23ef09af841f69f62597b312b5ad95804 Mon Sep 17 00:00:00 2001 From: annahileta Date: Fri, 29 Jul 2022 15:00:15 +0300 Subject: [PATCH 312/699] tabs editing --- .../EG040ControllerSetDocumentVisibility.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java index 15e97de2..4be030b7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -42,32 +42,32 @@ public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session sess @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { - model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); - model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); + model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); + model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); - String basePath = session.getBasePath(); - String accessToken = user.getAccessToken(); + String basePath = session.getBasePath(); + String accessToken = user.getAccessToken(); - String signerName = args.getSignerName(); - String signerEmail = args.getSignerEmail(); - String signer2Name = args.getSignerName2(); - String signer2Email = args.getSignerEmail2(); - String ccName = args.getCcName(); - String ccEmail = args.getCcEmail(); - String accountId = session.getAccountId(); + String signerName = args.getSignerName(); + String signerEmail = args.getSignerEmail(); + String signer2Name = args.getSignerName2(); + String signer2Email = args.getSignerEmail2(); + String ccName = args.getCcName(); + String ccEmail = args.getCcEmail(); + String accountId = session.getAccountId(); - EnvelopeDefinition envelope = SetDocumentVisibilityService.makeEnvelope(signerEmail, signerName, signer2Email, - signer2Name, ccEmail, ccName, DOCUMENT_FILE_NAME_PDF, DOCUMENT_FILE_NAME_DOCX, DOCUMENT_FILE_NAME_HTML); + EnvelopeDefinition envelope = SetDocumentVisibilityService.makeEnvelope(signerEmail, signerName, signer2Email, + signer2Name, ccEmail, ccName, DOCUMENT_FILE_NAME_PDF, DOCUMENT_FILE_NAME_DOCX, DOCUMENT_FILE_NAME_HTML); - ApiClient apiClient = createApiClient(basePath, accessToken); - EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + ApiClient apiClient = createApiClient(basePath, accessToken); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); - DoneExample.createDefault(title) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") - .addToModel(model); - return DONE_EXAMPLE_PAGE; + DoneExample.createDefault(title) + .withMessage("The envelope has been created and sent!
    Envelope ID " + + envelopeSummary.getEnvelopeId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; } } From 075c645fddee8e2f7aa32118b59760b86d14c18e Mon Sep 17 00:00:00 2001 From: annahileta Date: Fri, 29 Jul 2022 15:02:28 +0300 Subject: [PATCH 313/699] changing tabs for the whole page --- .../EG040ControllerSetDocumentVisibility.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java index 4be030b7..5ac49fca 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -22,26 +22,26 @@ @Controller @RequestMapping("/eg040") public class EG040ControllerSetDocumentVisibility extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME_PDF = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_FILE_NAME_DOCX = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCUMENT_FILE_NAME_HTML = "doc_1.html"; - private static final String CASE_FOR_INSTRUCTIONS = "ACCOUNT_LACKS_PERMISSIONS"; - private static final String FIXING_INSTRUCTIONS_FOR_PERMISSIONS = "See " + - "" + - "How to set document visibility for envelope recipients in the DocuSign Developer Center " + - "for instructions on how to enable document visibility in your developer account."; - private final User user; + private static final String DOCUMENT_FILE_NAME_PDF = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_FILE_NAME_DOCX = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCUMENT_FILE_NAME_HTML = "doc_1.html"; + private static final String CASE_FOR_INSTRUCTIONS = "ACCOUNT_LACKS_PERMISSIONS"; + private static final String FIXING_INSTRUCTIONS_FOR_PERMISSIONS = "See " + + "" + + "How to set document visibility for envelope recipients in the DocuSign Developer Center " + + "for instructions on how to enable document visibility in your developer account."; + private final User user; - @Autowired - public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session session, User user) { - super(config, "eg040", "Set document visibility"); - this.session = session; - this.user = user; - } + @Autowired + public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session session, User user) { + super(config, "eg040", "Set document visibility"); + this.session = session; + this.user = user; + } - @Override - protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) throws ApiException, IOException { + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); @@ -69,5 +69,5 @@ protected Object doWork(WorkArguments args, ModelMap model, + envelopeSummary.getEnvelopeId() + ".") .addToModel(model); return DONE_EXAMPLE_PAGE; - } + } } From f6385ddb60c50e8e1b0340f476f352d07437f14c Mon Sep 17 00:00:00 2001 From: annahileta Date: Fri, 29 Jul 2022 15:08:37 +0300 Subject: [PATCH 314/699] changed the identation - tabs to spaces --- .../EG040ControllerSetDocumentVisibility.java | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java index 5ac49fca..5de0a11b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -22,52 +22,52 @@ @Controller @RequestMapping("/eg040") public class EG040ControllerSetDocumentVisibility extends AbstractEsignatureController { - private static final String DOCUMENT_FILE_NAME_PDF = "World_Wide_Corp_lorem.pdf"; - private static final String DOCUMENT_FILE_NAME_DOCX = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; - private static final String DOCUMENT_FILE_NAME_HTML = "doc_1.html"; - private static final String CASE_FOR_INSTRUCTIONS = "ACCOUNT_LACKS_PERMISSIONS"; - private static final String FIXING_INSTRUCTIONS_FOR_PERMISSIONS = "See " + - "" + - "How to set document visibility for envelope recipients in the DocuSign Developer Center " + - "for instructions on how to enable document visibility in your developer account."; - private final User user; + private static final String DOCUMENT_FILE_NAME_PDF = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_FILE_NAME_DOCX = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCUMENT_FILE_NAME_HTML = "doc_1.html"; + private static final String CASE_FOR_INSTRUCTIONS = "ACCOUNT_LACKS_PERMISSIONS"; + private static final String FIXING_INSTRUCTIONS_FOR_PERMISSIONS = "See " + + "" + + "How to set document visibility for envelope recipients in the DocuSign Developer Center " + + "for instructions on how to enable document visibility in your developer account."; + private final User user; - @Autowired - public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session session, User user) { - super(config, "eg040", "Set document visibility"); - this.session = session; - this.user = user; - } + @Autowired + public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session session, User user) { + super(config, "eg040", "Set document visibility"); + this.session = session; + this.user = user; + } - @Override - protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) throws ApiException, IOException { - model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); - model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); + model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); - String basePath = session.getBasePath(); - String accessToken = user.getAccessToken(); + String basePath = session.getBasePath(); + String accessToken = user.getAccessToken(); - String signerName = args.getSignerName(); - String signerEmail = args.getSignerEmail(); - String signer2Name = args.getSignerName2(); - String signer2Email = args.getSignerEmail2(); - String ccName = args.getCcName(); - String ccEmail = args.getCcEmail(); - String accountId = session.getAccountId(); + String signerName = args.getSignerName(); + String signerEmail = args.getSignerEmail(); + String signer2Name = args.getSignerName2(); + String signer2Email = args.getSignerEmail2(); + String ccName = args.getCcName(); + String ccEmail = args.getCcEmail(); + String accountId = session.getAccountId(); - EnvelopeDefinition envelope = SetDocumentVisibilityService.makeEnvelope(signerEmail, signerName, signer2Email, - signer2Name, ccEmail, ccName, DOCUMENT_FILE_NAME_PDF, DOCUMENT_FILE_NAME_DOCX, DOCUMENT_FILE_NAME_HTML); + EnvelopeDefinition envelope = SetDocumentVisibilityService.makeEnvelope(signerEmail, signerName, signer2Email, + signer2Name, ccEmail, ccName, DOCUMENT_FILE_NAME_PDF, DOCUMENT_FILE_NAME_DOCX, DOCUMENT_FILE_NAME_HTML); - ApiClient apiClient = createApiClient(basePath, accessToken); - EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + ApiClient apiClient = createApiClient(basePath, accessToken); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); - EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); - DoneExample.createDefault(title) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") - .addToModel(model); - return DONE_EXAMPLE_PAGE; - } + DoneExample.createDefault(title) + .withMessage("The envelope has been created and sent!
    Envelope ID " + + envelopeSummary.getEnvelopeId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } } From 3afba3554cd1c28aaf8ef355f468ebd4c7ee1961 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 2 Aug 2022 11:15:07 -0700 Subject: [PATCH 315/699] UI updates --- .../views/pages/esignature/index.jsp | 406 +++++++++--------- 1 file changed, 200 insertions(+), 206 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index a27e1e12..a3cce834 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -26,7 +26,16 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Basic examples

    +

    Requesting a signature

    + +

    Send an envelope with a remote (email) signer and cc recipient

    +

    The envelope includes a pdf, Word, and HTML document. Anchor text + (AutoPlace) + is used to position the signing fields in the documents. +

    +

    API method used: + Envelopes::create. +

    Use embedded signing

    This example sends an envelope, and then uses embedded signing for the first signer. @@ -37,22 +46,54 @@ EnvelopeViews::createRecipient.

    -

    Send an envelope with a remote (email) signer and cc recipient

    -

    The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    +

    Send an envelope using a template

    +

    The envelope is defined by the template. + The signer and cc recipient name and email are used to fill in the template's roles.

    API method used: Envelopes::create.

    -

    List envelopes in the user's account

    -

    List the envelopes created in the last 30 days. +

    Use embedded signing from a template with an added document

    +

    This example sends an envelope based on a template.

    +

    In addition to the template's document(s), the example adds an + additional document to the envelope by using the + Composite Templates + feature.

    +

    API methods used: + Envelopes::create and + EnvelopeViews::createRecipient. +

    + +

    Request a signature by SMS delivery

    +

    + Sends a signature requet via an SMS message. +

    +

    + API method used: + Envelopes::create. +

    + +

    Send an envelope with an order form and payment field

    +

    Anchor text + (AutoPlace) + is used to position the fields in the documents.

    API method used: - Envelopes::listStatusChanges. + Envelopes::create.

    +

    Send an envelope to an In Person Signer

    +

    + Demonstrates how to host an In Person Signing session with embedded signing. +

    +

    + API method used: + Envelopes::create. +

    + +

    Working with envelopes and templates

    +

    Get an envelope's basic information and status

    List the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the @@ -69,6 +110,109 @@ EnvelopeRecipients::list.

    +

    List envelopes in the user's account

    +

    List the envelopes created in the last 30 days. +

    +

    API method used: + Envelopes::listStatusChanges. +

    + +

    Create a template

    +

    Create a template with two roles, signer and cc.

    +

    API methods used: + Templates::list, + Templates::create. +

    + +

    Use embedded sending

    +

    An envelope will be created in draft mode. The DocuSign + web tool (NDSE) will then be shown, enabling further updates + to the envelope before it is sent. +

    +

    API methods used: + Envelopes::create, + EnvelopeViews::createSender. + +

    Bulk send envelopes

    + +

    + Demonstrates how to send envelopes in bulk to multiple recipients. First, this example + creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk + envelope sending. +

    +

    + API methods used: + BulkSend::createBulkSendList, + Envelopes::create, + EnvelopeCustomFields::create, + BulkSend::createBulkSendRequest, + BulkSend::getBulkSendBatchStatus. +

    + +

    Working with advanced recipient routing

    + +

    Pause a signature workflow

    + +

    + This topic demonstrates how to create an envelope where the workflow is paused before the + envelope is sent to a second recipient. For information on resuming a workflow see + + How to unpause a signature workflow + . +

    +

    + API methods used: + Envelopes::create. +

    + +

    Unpause a signature workflow

    + +

    + This topic demonstrates how to resume an envelope workflow that has been paused. + For information on creating an envelope with a paused workflow, see + + How to pause a signature workflow + . +

    +

    + API methods used: + Envelopes::update. +

    + +

    Use conditional recipients

    + +

    + This topic demonstrates how to create an envelope where the workflow is routed to + different recipients based on the value of a transaction. +

    +

    + API methods used: + Envelopes::create. +

    + +

    Schedule an envelope

    +

    + Demonstrates how to schedule an envelope using the scheduled sending feature. +

    +

    + API method used: + Envelopes::create. +

    + +

    Send an envelope with delayed routing

    +

    + Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature. +

    +

    + API method used: + Envelopes::create. +

    + +

    Working with documents

    + +

    List an envelope's documents

    List the envelope's documents. A Certificate of Completion document is also associated with every envelope. @@ -84,76 +228,36 @@ EnvelopeDocuments::get.

    -

    Create a template

    -

    Create a template with two roles, signer and cc.

    -

    API methods used: - Templates::list, - Templates::create. -

    - -

    Send an envelope using a template

    -

    The envelope is defined by the template. - The signer and cc recipient name and email are used to fill in the template's roles.

    -

    API method used: - Envelopes::create. -

    -

    Send an envelope using binary document transfer

    The envelope includes a pdf, Word, and HTML document.

    Multipart data transfer is used to send the documents in binary format to DocuSign. Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. Binary transfer is not yet supported by the SDK.

    +

    API method used: Envelopes::create.

    - -

    Use embedded sending

    -

    An envelope will be created in draft mode. The DocuSign - web tool (NDSE) will then be shown, enabling further updates - to the envelope before it is sent. -

    -

    API methods used: - Envelopes::create, - EnvelopeViews::createSender. - -

    Embedded DocuSign web tool

    -

    Redirect the user to the DocuSign web tool.

    -

    API method used: - EnvelopeViews::createConsole. +

    Create a signable HTML document

    +

    + Demonstrates how to create an HTML document for responsive signing. +

    + API methods used: + Envelopes::create, + EnvelopeViews::createRecipient.

    -

    Use embedded signing from a template with an added document

    -

    This example sends an envelope based on a template.

    -

    In addition to the template's document(s), the example adds an - additional document to the envelope by using the - Composite Templates - feature.

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    -

    Send an envelope to an In Person Signer

    +

    Set document visibility for envelope recipients

    - Demonstrates how to host an In Person Signing session with embedded signing. + Demonstrates how to set document visibility for envelope recipients.

    API method used: Envelopes::create.

    -

    Payments

    - -

    Send an envelope with an order form and payment field

    -

    Anchor text - (AutoPlace) - is used to position the fields in the documents. -

    -

    API method used: - Envelopes::create. -

    - -

    Tabs

    +

    Working with tabs

    Get the tab data from an envelope

    This example retrieves the tab (field) values from an envelope.

    @@ -184,35 +288,28 @@ API method used: EnvelopeCustomFields::list.

    - -

    Recipient authentication

    -

    Require access code authentication for a recipient

    -

    Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

    +

    Working with brands

    + +

    Create a brand

    +

    This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

    API method used: - Envelopes::create. + AccountBrands::create.

    - -

    Require phone authentication for a recipient

    -

    Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

    + +

    Applying a brand to an envelope

    +

    This example will show you how to create an envelope using any of the created brands on your account.

    API method used: - Envelopes::create. + Envelopes::create.

    -

    Require knowledge-based authentication (KBA) for a recipient

    -

    Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

    +

    Applying a brand to a template

    +

    This example will show you how to create an envelope using a brand

    API method used: - Envelopes::create. -

    - -

    Require ID verification (IDV) for a recipient

    -

    Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

    -

    - API method used: - Envelopes::create. + Envelopes::create.

    -

    Permissions

    +

    Working with permissions

    Create a new permission profile

    @@ -240,143 +337,40 @@

    API method used: AccountPermissionProfiles::create.

    - -

    Brands

    - -

    Create a brand

    -

    This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

    -

    API method used: - AccountBrands::create. -

    - -

    Applying a brand to an envelope

    -

    This example will show you how to create an envelope using any of the created brands on your account.

    -

    API method used: - Envelopes::create. -

    - -

    Applying a brand to a template

    -

    This example will show you how to create an envelope using a brand

    -

    API method used: - Envelopes::create. -

    - -

    Bulk operations

    -

    Bulk send envelopes

    +

    Implementing multi-factor recipient (signer) authentication

    +

    Require ID verification (IDV) for a recipient

    +

    Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

    - Demonstrates how to send envelopes in bulk to multiple recipients. First, this example - creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk - envelope sending. -

    -

    - API methods used: - BulkSend::createBulkSendList, - Envelopes::create, - EnvelopeCustomFields::create, - BulkSend::createBulkSendRequest, - BulkSend::getBulkSendBatchStatus. -

    - -

    Advanced recipient routing

    - -

    Pause a signature workflow

    - -

    - This topic demonstrates how to create an envelope where the workflow is paused before the - envelope is sent to a second recipient. For information on resuming a workflow see - - How to unpause a signature workflow - . -

    -

    - API methods used: - Envelopes::create. -

    - -

    Unpause a signature workflow

    - -

    - This topic demonstrates how to resume an envelope workflow that has been paused. - For information on creating an envelope with a paused workflow, see - - How to pause a signature workflow - . -

    -

    - API methods used: - Envelopes::update. -

    - -

    Use conditional recipients

    - -

    - This topic demonstrates how to create an envelope where the workflow is routed to - different recipients based on the value of a transaction. -

    -

    - API methods used: - Envelopes::create. -

    - -

    Schedule an envelope

    -

    - Demonstrates how to schedule an envelope using the scheduled sending feature. -

    -

    - API method used: - Envelopes::create. + API method used: + Envelopes::create.

    -

    Send an envelope with delayed routing

    -

    - Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature. -

    -

    - API method used: - Envelopes::create. +

    Require knowledge-based authentication (KBA) for a recipient

    +

    Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

    +

    API method used: + Envelopes::create.

    -

    Premium features

    -

    Request a signature by SMS delivery

    -

    - Sends a signature requet via an SMS message. -

    -

    - API method used: - Envelopes::create. +

    Require phone authentication for a recipient

    +

    Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

    +

    API method used: + Envelopes::create.

    -

    Create a signable HTML document

    -

    - Demonstrates how to create an HTML document for responsive signing. -

    - API methods used: - Envelopes::create, - EnvelopeViews::createRecipient. +

    Require access code authentication for a recipient

    +

    Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

    +

    API method used: + Envelopes::create.

    -

    Send an envelope to an In Person Signer

    -

    - Demonstrates how to host an In Person Signing session with embedded signing. -

    -

    - API method used: - Envelopes::create. -

    +



    -

    Set document visibility for envelope recipients

    -

    - Demonstrates how to set document visibility for envelope recipients. -

    -

    - API method used: - Envelopes::create. +

    Embedded DocuSign web tool

    +

    Redirect the user to the DocuSign web tool.

    +

    API method used: + EnvelopeViews::createConsole.

    From 2322f0dcdfa941c9fa579dd437712c7b3ba7b78d Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 3 Aug 2022 18:22:55 +0300 Subject: [PATCH 316/699] added opening of the html and showcasing the error in case if application file is missing --- src/main/java/com/docusign/App.java | 19 ++++- src/main/resources/application_1.json | 46 ++++++++++++ .../views/applicationJsonMissingError.html | 74 +++++++++++++++++++ 3 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/application_1.json create mode 100644 src/main/webapp/WEB-INF/templates/views/applicationJsonMissingError.html diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index 6ef121e1..900831c3 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -1,5 +1,6 @@ package com.docusign; +import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -19,9 +20,23 @@ public class App { public static void main(String[] args) throws IOException { - SpringApplication.run(App.class, args); - openHomePage(); initFileSystem(); + + String fileName = "src\\main\\resources\\application.json"; + File file = new File(fileName); + + if (file.isFile() && file.canRead()) { + SpringApplication.run(App.class, args); + openHomePage(); + } else { + String htmlFilePath = "src\\main\\webapp\\WEB-INF\\templates\\views\\applicationJsonMissingError.html"; + File htmlFile = new File(htmlFilePath); + Desktop.getDesktop().browse(htmlFile.toURI()); + + System.out.println(""); + System.out.println("Please, add the application.json file to the resources folder."); + System.out.println(""); + } } private static void openHomePage() throws IOException { diff --git a/src/main/resources/application_1.json b/src/main/resources/application_1.json new file mode 100644 index 00000000..0f82338c --- /dev/null +++ b/src/main/resources/application_1.json @@ -0,0 +1,46 @@ +{ + "quickstart" :"true", + "quickACG": "false", + "DS_SIGNER_NAME": "Anna Hileta", + "DS_SIGNER_EMAIL": "anna.hileta@sigma.software", + "DS_APP_URL": "http://localhost:8080", + "DS_TARGET_ACCOUNT_ID": "91118afb-1a7a-4b9f-826a-3c0b81fff5c4", + "DS_BASE_PATH": "https://demo.docusign.net", + "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", + "DS_CLICK_BASE_PATH": "https://demo.docusign.net", + "DS_MONITOR_BASE_PATH": "https://lens-d.docusign.net", + "DS_ADMIN_BASE_PATH": "https://api-d.docusign.net", + + "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", + "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", + "Gateway_Display_Name": "{DS_PAYMENT_GATEWAY_DISPLAY_NAME}", + + "authorization.code.grant.client.scope": "signature", + "authorization.code.grant.sso.redirect-url": "&type=acg", + "authorization.code.grant.client.client-id": "789c5ac5-f32f-494a-acae-7951bec5ae73", + "authorization.code.grant.client.client-secret": "ddfee9c3-e190-411e-b463-d6c969ba3113", + "authorization.code.grant.client.access-token-uri": "https://account-d.docusign.com/oauth/token", + "authorization.code.grant.client.user-authorization-uri": "https://account-d.docusign.com/oauth/auth?prompt=login", + + "jwt.grant.sso.redirect-url": "&type=jwt", + "jwt.grant.client.scope": "signature impersonation", + "jwt.grant.client.base-url": "account-d.docusign.com", + "jwt.grant.client.client-id": "789c5ac5-f32f-494a-acae-7951bec5ae73", + "jwt.grant.client.private-key-path": "src/main/resources/private.key", + "jwt.grant.client.impersonated-user-guid": "91118afb-1a7a-4b9f-826a-3c0b81fff5c4", + + "common.client.resource.user-info-uri": "https://account-d.docusign.com/oauth/userinfo", + "com.docusign.github.example-uri": "https://github.com/docusign/code-examples-java/blob/master/src/main/java/", + "com.docusign.documentation-path": "", + + "server.tomcat.additional-tld-skip-patterns": "*jaxb*.jar", + "server.servlet.session.tracking-modes": "cookie", + "server.servlet.session.persistent": false, + "server.error.include-stacktrace": "always", + "server.error.whitelabel.enabled": false, + + "spring.session.store-type": "none", + "spring.mvc.view.prefix": "/WEB-INF/templates/views/", + "spring.mvc.view.suffix": ".jsp", + "spring.jmx.enabled": false +} diff --git a/src/main/webapp/WEB-INF/templates/views/applicationJsonMissingError.html b/src/main/webapp/WEB-INF/templates/views/applicationJsonMissingError.html new file mode 100644 index 00000000..b8e050ec --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/applicationJsonMissingError.html @@ -0,0 +1,74 @@ + + + + + + + + + + Error finding the application.json file + + + + + + + + + + + + + + +
    +
    +

    Problem: an error occurred

    + +

    Error information:

    +

    Message: While trying to launch the code examples, the application.json file could not been found.

    +

    Please, create the file and fill it in using the + template, then restart a launcher.

    +
    +
    + + + + + + + + + + + + + + + + + \ No newline at end of file From 19dde1209834e2acd00bf0270e7a0551b09b5f03 Mon Sep 17 00:00:00 2001 From: annahileta Date: Thu, 4 Aug 2022 14:36:16 +0300 Subject: [PATCH 317/699] changed file path to ClassPathResource --- src/main/java/com/docusign/App.java | 10 ++++------ .../applicationJsonMissingError.html | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) rename src/main/{webapp/WEB-INF/templates/views => resources}/applicationJsonMissingError.html (93%) diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index 900831c3..253a175b 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -14,6 +14,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; +import org.springframework.core.io.ClassPathResource; @Slf4j @SpringBootApplication(exclude={JmxAutoConfiguration.class}) @@ -22,15 +23,12 @@ public class App { public static void main(String[] args) throws IOException { initFileSystem(); - String fileName = "src\\main\\resources\\application.json"; - File file = new File(fileName); - - if (file.isFile() && file.canRead()) { + var resource = new ClassPathResource("application.json"); + if (resource.exists()){ SpringApplication.run(App.class, args); openHomePage(); } else { - String htmlFilePath = "src\\main\\webapp\\WEB-INF\\templates\\views\\applicationJsonMissingError.html"; - File htmlFile = new File(htmlFilePath); + File htmlFile = new ClassPathResource("applicationJsonMissingError.html").getFile(); Desktop.getDesktop().browse(htmlFile.toURI()); System.out.println(""); diff --git a/src/main/webapp/WEB-INF/templates/views/applicationJsonMissingError.html b/src/main/resources/applicationJsonMissingError.html similarity index 93% rename from src/main/webapp/WEB-INF/templates/views/applicationJsonMissingError.html rename to src/main/resources/applicationJsonMissingError.html index b8e050ec..827ed0ef 100644 --- a/src/main/webapp/WEB-INF/templates/views/applicationJsonMissingError.html +++ b/src/main/resources/applicationJsonMissingError.html @@ -5,7 +5,7 @@ - + Error finding the application.json file @@ -13,7 +13,7 @@ - + @@ -67,8 +67,8 @@

    Problem: an error occurred

    crossorigin="anonymous"> - + - + \ No newline at end of file From 97f607d808eb00f6768dcdb230b73004b0afb93f Mon Sep 17 00:00:00 2001 From: Anna Hileta <80112359+annahileta@users.noreply.github.com> Date: Fri, 5 Aug 2022 13:34:50 +0300 Subject: [PATCH 318/699] Deleted accidentally pushed application.json file --- src/main/resources/application_1.json | 46 --------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/main/resources/application_1.json diff --git a/src/main/resources/application_1.json b/src/main/resources/application_1.json deleted file mode 100644 index 0f82338c..00000000 --- a/src/main/resources/application_1.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "quickstart" :"true", - "quickACG": "false", - "DS_SIGNER_NAME": "Anna Hileta", - "DS_SIGNER_EMAIL": "anna.hileta@sigma.software", - "DS_APP_URL": "http://localhost:8080", - "DS_TARGET_ACCOUNT_ID": "91118afb-1a7a-4b9f-826a-3c0b81fff5c4", - "DS_BASE_PATH": "https://demo.docusign.net", - "DS_ROOMS_BASE_PATH": "https://demo.rooms.docusign.com", - "DS_CLICK_BASE_PATH": "https://demo.docusign.net", - "DS_MONITOR_BASE_PATH": "https://lens-d.docusign.net", - "DS_ADMIN_BASE_PATH": "https://api-d.docusign.net", - - "Gateway_Name": "{DS_PAYMENT_GATEWAY_NAME}", - "Gateway_Account_Id": "{GATEWAY_ACCOUNT_ID}", - "Gateway_Display_Name": "{DS_PAYMENT_GATEWAY_DISPLAY_NAME}", - - "authorization.code.grant.client.scope": "signature", - "authorization.code.grant.sso.redirect-url": "&type=acg", - "authorization.code.grant.client.client-id": "789c5ac5-f32f-494a-acae-7951bec5ae73", - "authorization.code.grant.client.client-secret": "ddfee9c3-e190-411e-b463-d6c969ba3113", - "authorization.code.grant.client.access-token-uri": "https://account-d.docusign.com/oauth/token", - "authorization.code.grant.client.user-authorization-uri": "https://account-d.docusign.com/oauth/auth?prompt=login", - - "jwt.grant.sso.redirect-url": "&type=jwt", - "jwt.grant.client.scope": "signature impersonation", - "jwt.grant.client.base-url": "account-d.docusign.com", - "jwt.grant.client.client-id": "789c5ac5-f32f-494a-acae-7951bec5ae73", - "jwt.grant.client.private-key-path": "src/main/resources/private.key", - "jwt.grant.client.impersonated-user-guid": "91118afb-1a7a-4b9f-826a-3c0b81fff5c4", - - "common.client.resource.user-info-uri": "https://account-d.docusign.com/oauth/userinfo", - "com.docusign.github.example-uri": "https://github.com/docusign/code-examples-java/blob/master/src/main/java/", - "com.docusign.documentation-path": "", - - "server.tomcat.additional-tld-skip-patterns": "*jaxb*.jar", - "server.servlet.session.tracking-modes": "cookie", - "server.servlet.session.persistent": false, - "server.error.include-stacktrace": "always", - "server.error.whitelabel.enabled": false, - - "spring.session.store-type": "none", - "spring.mvc.view.prefix": "/WEB-INF/templates/views/", - "spring.mvc.view.suffix": ".jsp", - "spring.jmx.enabled": false -} From 4bd42faf5ff116444ebb515bae3745c48c26ada4 Mon Sep 17 00:00:00 2001 From: annahileta Date: Mon, 8 Aug 2022 12:24:08 +0300 Subject: [PATCH 319/699] changed the classpath to inputstream for solution to work while running from war file --- src/main/java/com/docusign/App.java | 33 ++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index 253a175b..3fc2de20 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -1,11 +1,13 @@ package com.docusign; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.net.URI; import java.net.URISyntaxException; +import java.net.URL; import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Collections; import java.awt.Desktop; @@ -14,22 +16,37 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration; -import org.springframework.core.io.ClassPathResource; @Slf4j @SpringBootApplication(exclude={JmxAutoConfiguration.class}) public class App { - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws IOException, URISyntaxException { initFileSystem(); - var resource = new ClassPathResource("application.json"); - if (resource.exists()){ + ClassLoader classLoader = App.class.getClassLoader(); + URL applicationJsonURL = classLoader.getResource("application.json"); + + if (applicationJsonURL != null){ SpringApplication.run(App.class, args); openHomePage(); } else { - File htmlFile = new ClassPathResource("applicationJsonMissingError.html").getFile(); - Desktop.getDesktop().browse(htmlFile.toURI()); + InputStream inputStream = classLoader.getResourceAsStream("applicationJsonMissingError.html"); + + if (inputStream.available() > 0) { + Path path = Files.createTempFile("applicationJsonMissingError", ".html"); + try (FileOutputStream out = new FileOutputStream(path.toFile())) { + byte[] buffer = new byte[1024]; + int len; + while ((len = inputStream.read(buffer)) != -1) { + out.write(buffer, 0, len); + } + } catch (Exception e) { + System.out.println("File applicationJsonMissingError.html could not be accessed."); + } + + Desktop.getDesktop().browse(path.toUri()); + } System.out.println(""); System.out.println("Please, add the application.json file to the resources folder."); From 0287177a7f99abaee063f52c499723a523923ca2 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 9 Aug 2022 14:38:24 -0700 Subject: [PATCH 320/699] Adding better error handling --- src/main/java/com/docusign/App.java | 38 +++++++++- .../applicationJsonMissingError.html | 74 +++++++++++++++++++ 2 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/applicationJsonMissingError.html diff --git a/src/main/java/com/docusign/App.java b/src/main/java/com/docusign/App.java index 6ef121e1..3fc2de20 100644 --- a/src/main/java/com/docusign/App.java +++ b/src/main/java/com/docusign/App.java @@ -1,10 +1,13 @@ package com.docusign; -import java.io.IOException; +import java.io.*; import java.net.URI; import java.net.URISyntaxException; +import java.net.URL; import java.nio.file.FileSystemAlreadyExistsException; import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Collections; import java.awt.Desktop; @@ -18,10 +21,37 @@ @SpringBootApplication(exclude={JmxAutoConfiguration.class}) public class App { - public static void main(String[] args) throws IOException { - SpringApplication.run(App.class, args); - openHomePage(); + public static void main(String[] args) throws IOException, URISyntaxException { initFileSystem(); + + ClassLoader classLoader = App.class.getClassLoader(); + URL applicationJsonURL = classLoader.getResource("application.json"); + + if (applicationJsonURL != null){ + SpringApplication.run(App.class, args); + openHomePage(); + } else { + InputStream inputStream = classLoader.getResourceAsStream("applicationJsonMissingError.html"); + + if (inputStream.available() > 0) { + Path path = Files.createTempFile("applicationJsonMissingError", ".html"); + try (FileOutputStream out = new FileOutputStream(path.toFile())) { + byte[] buffer = new byte[1024]; + int len; + while ((len = inputStream.read(buffer)) != -1) { + out.write(buffer, 0, len); + } + } catch (Exception e) { + System.out.println("File applicationJsonMissingError.html could not be accessed."); + } + + Desktop.getDesktop().browse(path.toUri()); + } + + System.out.println(""); + System.out.println("Please, add the application.json file to the resources folder."); + System.out.println(""); + } } private static void openHomePage() throws IOException { diff --git a/src/main/resources/applicationJsonMissingError.html b/src/main/resources/applicationJsonMissingError.html new file mode 100644 index 00000000..827ed0ef --- /dev/null +++ b/src/main/resources/applicationJsonMissingError.html @@ -0,0 +1,74 @@ + + + + + + + + + + Error finding the application.json file + + + + + + + + + + + + + + +
    +
    +

    Problem: an error occurred

    + +

    Error information:

    +

    Message: While trying to launch the code examples, the application.json file could not been found.

    +

    Please, create the file and fill it in using the + template, then restart a launcher.

    +
    +
    + + + + + + + + + + + + + + + + + \ No newline at end of file From 5aaf86778c7fef55b788d87b4dd287ef7b65193e Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Thu, 11 Aug 2022 10:28:58 -0700 Subject: [PATCH 321/699] DEVDOCS-8377, changing so that we don't use numbers to identify code examples (eSign only for now) --- docs/Adding_examples.md | 6 +++--- .../templates/views/pages/admin/examples/a003a.jsp | 2 +- .../views/pages/esignature/examples/eg004.jsp | 4 ++-- .../views/pages/esignature/examples/eg005.jsp | 4 ++-- .../views/pages/esignature/examples/eg006.jsp | 4 ++-- .../views/pages/esignature/examples/eg007.jsp | 2 +- .../views/pages/esignature/examples/eg009.jsp | 4 ++-- .../views/pages/esignature/examples/eg011.jsp | 2 +- .../views/pages/esignature/examples/eg012.jsp | 2 +- .../views/pages/esignature/examples/eg013.jsp | 4 ++-- .../views/pages/esignature/examples/eg017.jsp | 4 ++-- .../views/pages/esignature/examples/eg018.jsp | 4 ++-- .../views/pages/esignature/examples/eg029.jsp | 6 +++--- .../views/pages/esignature/examples/eg030.jsp | 10 +++++----- 14 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/Adding_examples.md b/docs/Adding_examples.md index 757641a8..dd9b40aa 100644 --- a/docs/Adding_examples.md +++ b/docs/Adding_examples.md @@ -25,11 +25,11 @@ Examples should be self-contained within the scope of the launcher. For example, if your example operates on a template, -then either use the template created by example number 8, -or modify the template created by example 8 (eg add a field), +then either use the template created by Create a template, +or modify the template created by Create a template (eg add a field), or programmatically create a new template. -If you plan to change example 8, first discuss with the +If you plan to change Create a template, first discuss with the Examples Manager via apihelp@docusign.com. Do not require a user to create or modify a template by diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp index 74178f56..83600aac 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp @@ -26,7 +26,7 @@

    - Problem: please first bulk export user data using example 2.
    + Problem: please first bulk export user data using Send an envelope with a remote (email) signer and cc recipient..
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index 27febcc2..3eda6a33 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -27,7 +27,7 @@ -

    The envelope you created via example 2 will be queried.

    +

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient will be queried.

    @@ -35,7 +35,7 @@
    -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index dfefbabc..44c8aaf0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -19,7 +19,7 @@ -

    The envelope you created via example 2 will be queried.

    +

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient. will be queried.

    @@ -27,7 +27,7 @@
    -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient..
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index 35dce7a4..308b9506 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -23,7 +23,7 @@ -

    The envelope you created via example 2 will be queried.

    +

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient will be queried.

    @@ -31,7 +31,7 @@
    -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index 14e0d54d..39914969 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -29,7 +29,7 @@ -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient..
    You will then need to use example 6 to create the list of documents.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index 7a87b97a..311d2fbf 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -25,7 +25,7 @@ -

    The template you created via example 8 will be used.

    +

    The template you created via Create a template will be used.

    @@ -67,7 +67,7 @@ -

    Problem: please first create the template using example 8.
    +

    Problem: please first create the template using Create a template.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 0838a729..8bb8b348 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -12,7 +12,7 @@

    For example, if the sender view is used to optionally add additional documents to the envelope, enhance your app to provide the - needed feature (see example 13 for adding additional documents programmatically). + needed feature (see Use embedded signing from a template with an added document for adding additional documents programmatically).

    Documentation about this example.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index d18d232d..eefb33e3 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -26,7 +26,7 @@

    Optional: to use the Envelope's document view please first create an envelope using - example 2.

    + Send an envelope with a remote (email) signer and cc recipient.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index d4c31fe8..c123983e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -34,7 +34,7 @@

    -

    The template you created via example 8 will be used.

    +

    The template you created via Create a template will be used.

    @@ -95,7 +95,7 @@ -

    Problem: please first create the template using example 8.
    +

    Problem: please first create the template using Create a template.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index 86e31a87..55bbbd21 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -22,7 +22,7 @@ -

    The template you created via example 8 will be used.

    +

    The template you created via Create a template will be used.

    @@ -65,7 +65,7 @@ -

    Problem: please first create the template using example 8.
    +

    Problem: please first create the template using Create a template.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index d89ffcbe..a408375b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -31,7 +31,7 @@

    The last envelope you created with this example launcher will be queried. - Recommendation: Create an envelope using example 16 then use this example in order to see an example of custom tab values. + Recommendation: Create an envelope using Set tab values for an envelope then use this example in order to see an example of custom tab values.

    @@ -39,7 +39,7 @@
    -

    Problem: Please first create an envelope using example 16.

    +

    Problem: Please first create an envelope using Set tab values for an envelope.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index fb007f7d..6c5d7f42 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -55,7 +55,7 @@ There are no brands - created in your account. Create ones at the 'Create brand' page. + created in your account. Create ones at the 'Create brand' page.
    @@ -64,8 +64,8 @@
    -

    Problem: please first create the brand(s) using example 27.
    Thank you.

    -
    +

    Problem: please first create the brand(s) using Create a brand
    Thank you.

    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp index 2fc9dbc1..320ab5b9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp @@ -31,8 +31,8 @@ -

    The template you created via example 8 and brands created via - example 24 will be used.

    +

    The template you created via Create a template and brands created via + Create a brand will be used.

    -

    Problem: please create the template using example 8.

    +

    Problem: please create the template using Create a template.

    -

    Problem: please create the brand using example 24.

    -
    +

    Problem: please create the brand using Create a brand.

    +
    From dda1bc18fc180bd87585d9c44a290a59913bb028 Mon Sep 17 00:00:00 2001 From: annahileta Date: Fri, 12 Aug 2022 11:53:29 +0300 Subject: [PATCH 322/699] added models to map json file content --- .../java/com/docusign/DSConfiguration.java | 65 +++++++++++++++++++ .../model/manifestModels/AdditionalPage.java | 12 ++++ .../model/manifestModels/CodeExampleText.java | 29 +++++++++ .../manifestModels/LinkToAPIMethods.java | 10 +++ .../model/manifestModels/ManifestGroup.java | 13 ++++ .../manifestModels/ManifestStructure.java | 11 ++++ src/main/resources/application.example.json | 6 ++ 7 files changed, 146 insertions(+) create mode 100644 src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java create mode 100644 src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java create mode 100644 src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java create mode 100644 src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java create mode 100644 src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index ab5d6e47..506590e8 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -3,6 +3,8 @@ import com.docusign.common.ApiIndex; import com.docusign.core.model.ApiType; +import com.docusign.core.model.manifestModels.ManifestStructure; +import com.fasterxml.jackson.databind.ObjectMapper; import lombok.Getter; import lombok.Setter; import org.apache.commons.lang3.EnumUtils; @@ -10,9 +12,17 @@ import org.json.JSONObject; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; +import org.springframework.http.MediaType; import org.springframework.stereotype.Component; import org.springframework.util.StreamUtils; + +import javax.ws.rs.HttpMethod; +import javax.ws.rs.core.HttpHeaders; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; import java.nio.charset.StandardCharsets; @Component @@ -28,6 +38,8 @@ public class DSConfiguration { private String selectedApiType; + //private ManifestStructure codeExamplesText; + @Value("${DS_TARGET_ACCOUNT_ID}") private String targetAccountId; @@ -70,6 +82,21 @@ public class DSConfiguration { @Value("${DS_ADMIN_BASE_PATH}") private String adminBasePath; + @Value("${AdminManifest}") + private String adminManifest; + + @Value("${ESignatureManifest}") + private String eSignatureManifest; + + @Value("${ClickManifest}") + private String clickManifest; + + @Value("${RoomsManifest}") + private String roomsManifest; + + @Value("${MonitorManifest}") + private String monitorManifest; + public String examplesApiPath = "examplesApi.json"; public String apiTypeHeader = "ApiType"; @@ -112,4 +139,42 @@ private String getSelectedApi() throws IOException { } return selectedApiType; } + + public ManifestStructure getCodeExamplesText() throws Exception { + if (codeExamplesText != null){ + return codeExamplesText; + } + + try { + var json = loadFileData(eSignatureManifest); + codeExamplesText = new ObjectMapper().readValue(json, ManifestStructure.class); + } catch (JSONException e){ + e.printStackTrace(); + } + return codeExamplesText; + } + + private String loadFileData(String filePath) throws Exception { + URL fullRequestPath = new URL(filePath); + HttpURLConnection httpConnection = (HttpURLConnection) fullRequestPath.openConnection(); + httpConnection.setRequestMethod(HttpMethod.GET); + + httpConnection.setRequestProperty( + HttpHeaders.CONTENT_TYPE, + String.valueOf(MediaType.APPLICATION_JSON)); + + int responseCode = httpConnection.getResponseCode(); + + if (responseCode < HttpURLConnection.HTTP_OK || responseCode >= HttpURLConnection.HTTP_BAD_REQUEST) { + throw new Exception(httpConnection.getResponseMessage()); + } + + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); + StringBuilder stringBuilder = new StringBuilder(); + + bufferedReader.close(); + httpConnection.disconnect(); + + return stringBuilder.toString(); + } } \ No newline at end of file diff --git a/src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java b/src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java new file mode 100644 index 00000000..ebc44f12 --- /dev/null +++ b/src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java @@ -0,0 +1,12 @@ +package com.docusign.core.model.manifestModels; + +import lombok.Getter; +import lombok.Setter; + +public class AdditionalPage { + public String Name; + + public String ResultsPageHeader; + + public String ResultsPageText; +} diff --git a/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java b/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java new file mode 100644 index 00000000..72963f07 --- /dev/null +++ b/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java @@ -0,0 +1,29 @@ +package com.docusign.core.model.manifestModels; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; + +public class CodeExampleText { + public int ExampleNumber; + + public String ExampleName; + + public String ExampleDescription; + + public String ExampleDescriptionExtended; + + public String PageTitle; + + public String ResultsPageHeader; + + public String ResultsPageText; + + public String SkipForLanguages; + + public List LinksToAPIMethod = new ArrayList<>(); + + public List AdditionalPages = new ArrayList<>(); +} diff --git a/src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java b/src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java new file mode 100644 index 00000000..1e7311a1 --- /dev/null +++ b/src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java @@ -0,0 +1,10 @@ +package com.docusign.core.model.manifestModels; + +import lombok.Getter; +import lombok.Setter; + +public class LinkToAPIMethods { + public String Path; + + public String PathName; +} diff --git a/src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java b/src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java new file mode 100644 index 00000000..7e5392d4 --- /dev/null +++ b/src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java @@ -0,0 +1,13 @@ +package com.docusign.core.model.manifestModels; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; + +public class ManifestGroup { + public List Examples = new ArrayList<>(); + + public String Name; +} diff --git a/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java b/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java new file mode 100644 index 00000000..6e3403bc --- /dev/null +++ b/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java @@ -0,0 +1,11 @@ +package com.docusign.core.model.manifestModels; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; + +public class ManifestStructure { + public List Groups = new ArrayList(); +} diff --git a/src/main/resources/application.example.json b/src/main/resources/application.example.json index 5fb456d8..33a76c20 100644 --- a/src/main/resources/application.example.json +++ b/src/main/resources/application.example.json @@ -33,6 +33,12 @@ "com.docusign.github.example-uri": "https://github.com/docusign/code-examples-java/blob/master/src/main/java/", "com.docusign.documentation-path": "", + "ESignatureManifest": "https://raw.githubusercontent.com/annahileta/ManifestsForCodeExamples/main/eSignatureManifest.json", + "ClickManifest": "https://raw.githubusercontent.com/annahileta/ManifestsForCodeExamples/main/ClickManifest.json", + "RoomsManifest": "https://raw.githubusercontent.com/annahileta/ManifestsForCodeExamples/main/RoomsManifest.json", + "MonitorManifest": "https://raw.githubusercontent.com/annahileta/ManifestsForCodeExamples/main/MonitorManifest.json", + "AdminManifest": "https://raw.githubusercontent.com/annahileta/ManifestsForCodeExamples/main/AdminManifest.json", + "server.tomcat.additional-tld-skip-patterns": "*jaxb*.jar", "server.servlet.session.tracking-modes": "cookie", "server.servlet.session.persistent": false, From ffb6a453af54d660fa24bbe9fd238210b2dc8b30 Mon Sep 17 00:00:00 2001 From: Aaron Wilde <52012222+AaronWDS@users.noreply.github.com> Date: Mon, 15 Aug 2022 13:45:05 -0700 Subject: [PATCH 323/699] Devdocs 7783 (#67) * Adding new In Person Signer code example * Small text updates * fixes applied Co-authored-by: Inbar Gazit --- .../examples/EG013ControllerAddDocToTemplate.java | 11 +++++++---- .../eSignature/services/SendBinaryDocsService.java | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index aa555af1..30166f84 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -14,6 +14,8 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; + +import java.io.Console; import java.io.IOException; import javax.servlet.http.HttpServletResponse; @@ -31,6 +33,7 @@ public class EG013ControllerAddDocToTemplate extends AbstractEsignatureControlle private final Session session; private final User user; + private final String SIGNER_CLIENT_ID = "1000"; @Autowired public EG013ControllerAddDocToTemplate(DSConfiguration config, Session session, User user) { @@ -61,13 +64,13 @@ protected Object doWork(WorkArguments args, ModelMap model, envelopesApi, args.getSignerEmail(), args.getSignerName(), - args.getSignerClientId(), + SIGNER_CLIENT_ID, args.getCcEmail(), args.getCcName(), - args.getTemplateId(), + session.getTemplateId(), accountId, - args.getDsReturnUrl(), - args.getDsPingUrl(), + config.getDsReturnUrl(), + config.getDsPingUrl(), args ); return new RedirectView(embeddedEnvelope.getUrl()); diff --git a/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java index 1ea9bb41..79f83b5a 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SendBinaryDocsService.java @@ -155,16 +155,16 @@ private static JSONObject makeEnvelopeJSON( // to the recipients. Parallel routing order is supported by using the // same integer as the order for two or more recipients. Signer signer = new Signer(); - signer.setEmail(signerName); - signer.setName(signerEmail); + signer.setEmail(signerEmail); + signer.setName(signerName); signer.setRecipientId("1"); signer.setRoutingOrder("1"); signer.setTabs(signerTabs); // create a cc recipient to receive a copy of the documents, identified by name and email CarbonCopy cc = new CarbonCopy(); - cc.setEmail(ccName); - cc.setName(ccEmail); + cc.setEmail(ccEmail); + cc.setName(ccName); cc.setRecipientId("2"); cc.setRoutingOrder("2"); From 3ecf0daf8262b5851839aeef844ca6f6eae07ace Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 15 Aug 2022 14:57:55 -0700 Subject: [PATCH 324/699] Small text changes + step comments --- .../examples/EG040ControllerSetDocumentVisibility.java | 4 ++++ .../eSignature/services/SetDocumentVisibilityService.java | 2 ++ .../templates/views/pages/esignature/examples/eg039.jsp | 2 +- .../templates/views/pages/esignature/examples/eg040.jsp | 2 +- .../webapp/WEB-INF/templates/views/pages/esignature/index.jsp | 3 ++- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java index 5de0a11b..ef184ea0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -59,10 +59,14 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopeDefinition envelope = SetDocumentVisibilityService.makeEnvelope(signerEmail, signerName, signer2Email, signer2Name, ccEmail, ccName, DOCUMENT_FILE_NAME_PDF, DOCUMENT_FILE_NAME_DOCX, DOCUMENT_FILE_NAME_HTML); + // Step 2 start ApiClient apiClient = createApiClient(basePath, accessToken); EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + // Step 2 end + // Step 4 start EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + // Step 4 end DoneExample.createDefault(title) .withMessage("The envelope has been created and sent!
    Envelope ID " diff --git a/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java b/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java index e47daea3..49faf2dd 100644 --- a/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java +++ b/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java @@ -7,6 +7,7 @@ import java.util.*; public final class SetDocumentVisibilityService { + // Step 3 start public static EnvelopeDefinition makeEnvelope( String signerEmail, String signerName, @@ -92,4 +93,5 @@ private static Document[] prepareDocumentsForSending( return new Document[]{documentHTML, documentDOCX, documentPDF}; } + // Step 3 end } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index e6898f85..b5daf855 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -10,7 +10,7 @@

    API methods used: - Envelopes::create , + Envelopes::create, EnvelopeViews::createRecipient.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp index 76715439..94f09da8 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp @@ -44,7 +44,7 @@ - The email for the cc recipient must be different from the signer. + The email for the cc recipient must be different from the signer emails.
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index a3cce834..93c250f2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -89,7 +89,8 @@

    API method used: - Envelopes::create. + Envelopes::create, + EnvelopeViews::createRecipient.

    Working with envelopes and templates

    From 2e3f05db3cc7f7f3de770fae0765496c577b0cb0 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 15 Aug 2022 15:00:39 -0700 Subject: [PATCH 325/699] Adding new code examples --- docs/Adding_examples.md | 6 +- .../EG040ControllerSetDocumentVisibility.java | 77 ++++ .../SetDocumentVisibilityService.java | 97 +++++ .../core/controller/AbstractController.java | 7 +- .../com/docusign/core/model/DoneExample.java | 7 +- src/main/resources/doc_1.html | 20 + .../webapp/WEB-INF/templates/views/error.jsp | 17 +- .../views/pages/admin/examples/a003a.jsp | 2 +- .../views/pages/esignature/examples/eg004.jsp | 4 +- .../views/pages/esignature/examples/eg005.jsp | 4 +- .../views/pages/esignature/examples/eg006.jsp | 4 +- .../views/pages/esignature/examples/eg007.jsp | 2 +- .../views/pages/esignature/examples/eg009.jsp | 4 +- .../views/pages/esignature/examples/eg011.jsp | 2 +- .../views/pages/esignature/examples/eg012.jsp | 2 +- .../views/pages/esignature/examples/eg013.jsp | 4 +- .../views/pages/esignature/examples/eg017.jsp | 4 +- .../views/pages/esignature/examples/eg018.jsp | 4 +- .../views/pages/esignature/examples/eg029.jsp | 6 +- .../views/pages/esignature/examples/eg030.jsp | 10 +- .../views/pages/esignature/examples/eg039.jsp | 2 +- .../views/pages/esignature/examples/eg040.jsp | 58 +++ .../views/pages/esignature/index.jsp | 395 +++++++++--------- 23 files changed, 510 insertions(+), 228 deletions(-) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java create mode 100644 src/main/resources/doc_1.html create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp diff --git a/docs/Adding_examples.md b/docs/Adding_examples.md index 757641a8..dd9b40aa 100644 --- a/docs/Adding_examples.md +++ b/docs/Adding_examples.md @@ -25,11 +25,11 @@ Examples should be self-contained within the scope of the launcher. For example, if your example operates on a template, -then either use the template created by example number 8, -or modify the template created by example 8 (eg add a field), +then either use the template created by Create a template, +or modify the template created by Create a template (eg add a field), or programmatically create a new template. -If you plan to change example 8, first discuss with the +If you plan to change Create a template, first discuss with the Examples Manager via apihelp@docusign.com. Do not require a user to create or modify a template by diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java new file mode 100644 index 00000000..ef184ea0 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -0,0 +1,77 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.controller.eSignature.services.SetDocumentVisibilityService; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +@Controller +@RequestMapping("/eg040") +public class EG040ControllerSetDocumentVisibility extends AbstractEsignatureController { + private static final String DOCUMENT_FILE_NAME_PDF = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_FILE_NAME_DOCX = "World_Wide_Corp_Battle_Plan_Trafalgar.docx"; + private static final String DOCUMENT_FILE_NAME_HTML = "doc_1.html"; + private static final String CASE_FOR_INSTRUCTIONS = "ACCOUNT_LACKS_PERMISSIONS"; + private static final String FIXING_INSTRUCTIONS_FOR_PERMISSIONS = "See " + + "" + + "How to set document visibility for envelope recipients in the DocuSign Developer Center " + + "for instructions on how to enable document visibility in your developer account."; + private final User user; + + @Autowired + public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session session, User user) { + super(config, "eg040", "Set document visibility"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException, IOException { + model.addAttribute("fixingInstructions", FIXING_INSTRUCTIONS_FOR_PERMISSIONS); + model.addAttribute("caseForInstructions", CASE_FOR_INSTRUCTIONS); + + String basePath = session.getBasePath(); + String accessToken = user.getAccessToken(); + + String signerName = args.getSignerName(); + String signerEmail = args.getSignerEmail(); + String signer2Name = args.getSignerName2(); + String signer2Email = args.getSignerEmail2(); + String ccName = args.getCcName(); + String ccEmail = args.getCcEmail(); + String accountId = session.getAccountId(); + + EnvelopeDefinition envelope = SetDocumentVisibilityService.makeEnvelope(signerEmail, signerName, signer2Email, + signer2Name, ccEmail, ccName, DOCUMENT_FILE_NAME_PDF, DOCUMENT_FILE_NAME_DOCX, DOCUMENT_FILE_NAME_HTML); + + // Step 2 start + ApiClient apiClient = createApiClient(basePath, accessToken); + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + // Step 2 end + + // Step 4 start + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + // Step 4 end + + DoneExample.createDefault(title) + .withMessage("The envelope has been created and sent!
    Envelope ID " + + envelopeSummary.getEnvelopeId() + ".") + .addToModel(model); + return DONE_EXAMPLE_PAGE; + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java b/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java new file mode 100644 index 00000000..49faf2dd --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/SetDocumentVisibilityService.java @@ -0,0 +1,97 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.*; + +public final class SetDocumentVisibilityService { + // Step 3 start + public static EnvelopeDefinition makeEnvelope( + String signerEmail, + String signerName, + String signerEmail2, + String signerName2, + String ccEmail, + String ccName, + String documentFileNamePDF, + String documentFileNameDOCX, + String documentFileNameHTML + ) throws IOException { + CarbonCopy carbonCopy = new CarbonCopy(); + + carbonCopy.setEmail(ccEmail); + carbonCopy.setName(ccName); + carbonCopy.setRecipientId("3"); + carbonCopy.setRoutingOrder("2"); + + Recipients recipients = new Recipients(); + recipients.setSigners(Arrays.asList(prepareSigners(signerEmail, signerName, signerEmail2, signerName2))); + recipients.setCarbonCopies(Collections.singletonList(carbonCopy)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document set"); + envelopeDefinition.setRecipients(recipients); + + envelopeDefinition.setDocuments(Arrays.asList(prepareDocumentsForSending( + documentFileNamePDF, + documentFileNameDOCX, + documentFileNameHTML))); + + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } + + private static Signer[] prepareSigners( + String signerEmail, + String signerName, + String signerEmail2, + String signerName2) + { + Signer signer1 = new Signer(); + + signer1.setEmail(signerEmail); + signer1.setName(signerName); + signer1.setRecipientId("1"); + signer1.setRoutingOrder("1"); + signer1.setExcludedDocuments(Arrays.asList(new String[]{"2", "3"})); + signer1.setTabs(EnvelopeHelpers.createSingleSignerTab("**signature_1**", 10, 20)); + + Signer signer2 = new Signer(); + + signer2.setEmail(signerEmail2); + signer2.setName(signerName2); + signer2.setRecipientId("2"); + signer2.setRoutingOrder("1"); + signer2.setExcludedDocuments(Arrays.asList(new String[]{"1"})); + signer2.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", 10, 20)); + + return new Signer[] {signer1, signer2}; + } + + private static Document[] prepareDocumentsForSending( + String documentFileNamePDF, + String documentFileNameDOCX, + String documentFileNameHTML) throws IOException + { + Document documentHTML = EnvelopeHelpers.createDocumentFromFile( + documentFileNameHTML, + "Order acknowledgement", + "1"); + + Document documentDOCX = EnvelopeHelpers.createDocumentFromFile( + documentFileNameDOCX, + "Battle Plan", + "2"); + + Document documentPDF = EnvelopeHelpers.createDocumentFromFile( + documentFileNamePDF, + "Lorem Ipsum", + "3"); + + return new Document[]{documentHTML, documentDOCX, documentPDF}; + } + // Step 3 end +} diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index cf59e5fc..ff8a6bc6 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -123,10 +123,15 @@ protected abstract Object doWork(WorkArguments args, ModelMap model, private String handleException(Exception exception, ModelMap model) { String stackTrace = ExceptionUtils.getStackTrace(exception); + String exceptionMessage = exception.getMessage(); + String fixingInstructions = exceptionMessage.contains((CharSequence) model.getAttribute("caseForInstructions")) ? + (String) model.getAttribute("fixingInstructions") : null; + new DoneExample() .withTitle(exampleName) .withName(title) - .withMessage(exception.getMessage()) + .withMessage(exceptionMessage) + .withFixingInstructions(fixingInstructions) .withStackTracePrinted(stackTrace) .addToModel(model); return ERROR_PAGE; diff --git a/src/main/java/com/docusign/core/model/DoneExample.java b/src/main/java/com/docusign/core/model/DoneExample.java index d25a0936..8668b69b 100644 --- a/src/main/java/com/docusign/core/model/DoneExample.java +++ b/src/main/java/com/docusign/core/model/DoneExample.java @@ -35,10 +35,10 @@ public class DoneExample { private String json; private StackTraceElement[] stackTrace; private String stackTracePrinted; + private String fixingInstructions; private Iterable diff; - /** * Creates DoneExample object with title. This method initializes title. * @param String title @@ -82,6 +82,11 @@ public DoneExample withMessage(String message) { return this; } + public DoneExample withFixingInstructions(String fixingInstructions) { + this.fixingInstructions = fixingInstructions; + return this; + } + /** * Creates DoneExample object with stackTrace. This method initializes error stack trace. * @param StackTraceElement[] stackTrace diff --git a/src/main/resources/doc_1.html b/src/main/resources/doc_1.html new file mode 100644 index 00000000..be6ec517 --- /dev/null +++ b/src/main/resources/doc_1.html @@ -0,0 +1,20 @@ + + + + + + +

    World Wide Corp

    +

    Order Processing Division

    +

    Ordered by {USER_FULLNAME}

    +

    Email: {USER_EMAIL}

    +

    +Candy bonbon pastry jujubes lollipop wafer biscuit biscuit. Topping brownie sesame snaps sweet roll pie. Croissant danish biscuit soufflé caramels jujubes jelly. Dragée danish caramels lemon drops dragée. Gummi bears cupcake biscuit tiramisu sugar plum pastry. Dragée gummies applicake pudding liquorice. Donut jujubes oat cake jelly-o. Dessert bear claw chocolate cake gummies lollipop sugar plum ice cream gummies cheesecake. +

    + +

    Agreed: **signature_1**/

    + + diff --git a/src/main/webapp/WEB-INF/templates/views/error.jsp b/src/main/webapp/WEB-INF/templates/views/error.jsp index 47d0fa45..9f83963d 100644 --- a/src/main/webapp/WEB-INF/templates/views/error.jsp +++ b/src/main/webapp/WEB-INF/templates/views/error.jsp @@ -11,13 +11,20 @@ -

    Oops, we have encountered a problem.

    -

    Message: ${done.message}

    -

    Dump: ${done.stackTracePrinted}

    + +

    Problem: an error occurred

    +

    Error information:

    +

    Message: ${done.message}

    +

    ${done.fixingInstructions}

    +
    + +

    Oops, we have encountered a problem.

    +

    Message: ${done.message}

    +

    Dump: ${done.stackTracePrinted}

    -

    Please check your account configuration. If you are unable to resolve the problem, open a new issue on GitHub.

    - +

    Please check your account configuration. If you are unable to resolve the problem, open a new issue on GitHub.

    +

    Continue

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp index 74178f56..83600aac 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp @@ -26,7 +26,7 @@

    - Problem: please first bulk export user data using example 2.
    + Problem: please first bulk export user data using Send an envelope with a remote (email) signer and cc recipient..
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index 27febcc2..3eda6a33 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -27,7 +27,7 @@ -

    The envelope you created via example 2 will be queried.

    +

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient will be queried.

    @@ -35,7 +35,7 @@
    -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index dfefbabc..44c8aaf0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -19,7 +19,7 @@ -

    The envelope you created via example 2 will be queried.

    +

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient. will be queried.

    @@ -27,7 +27,7 @@
    -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient..
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index 35dce7a4..308b9506 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -23,7 +23,7 @@ -

    The envelope you created via example 2 will be queried.

    +

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient will be queried.

    @@ -31,7 +31,7 @@
    -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index 14e0d54d..39914969 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -29,7 +29,7 @@ -

    Problem: please first create an envelope using example 2.
    +

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient..
    You will then need to use example 6 to create the list of documents.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index 7a87b97a..311d2fbf 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -25,7 +25,7 @@ -

    The template you created via example 8 will be used.

    +

    The template you created via Create a template will be used.

    @@ -67,7 +67,7 @@ -

    Problem: please first create the template using example 8.
    +

    Problem: please first create the template using Create a template.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 0838a729..8bb8b348 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -12,7 +12,7 @@

    For example, if the sender view is used to optionally add additional documents to the envelope, enhance your app to provide the - needed feature (see example 13 for adding additional documents programmatically). + needed feature (see Use embedded signing from a template with an added document for adding additional documents programmatically).

    Documentation about this example.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index d18d232d..eefb33e3 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -26,7 +26,7 @@

    Optional: to use the Envelope's document view please first create an envelope using - example 2.

    + Send an envelope with a remote (email) signer and cc recipient.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index d4c31fe8..c123983e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -34,7 +34,7 @@

    -

    The template you created via example 8 will be used.

    +

    The template you created via Create a template will be used.

    @@ -95,7 +95,7 @@ -

    Problem: please first create the template using example 8.
    +

    Problem: please first create the template using Create a template.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index 86e31a87..55bbbd21 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -22,7 +22,7 @@ -

    The template you created via example 8 will be used.

    +

    The template you created via Create a template will be used.

    @@ -65,7 +65,7 @@ -

    Problem: please first create the template using example 8.
    +

    Problem: please first create the template using Create a template.
    Thank you.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index d89ffcbe..a408375b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -31,7 +31,7 @@

    The last envelope you created with this example launcher will be queried. - Recommendation: Create an envelope using example 16 then use this example in order to see an example of custom tab values. + Recommendation: Create an envelope using Set tab values for an envelope then use this example in order to see an example of custom tab values.

    @@ -39,7 +39,7 @@
    -

    Problem: Please first create an envelope using example 16.

    +

    Problem: Please first create an envelope using Set tab values for an envelope.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index fb007f7d..6c5d7f42 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -55,7 +55,7 @@ There are no brands - created in your account. Create ones at the 'Create brand' page. + created in your account. Create ones at the 'Create brand' page.
    @@ -64,8 +64,8 @@
    -

    Problem: please first create the brand(s) using example 27.
    Thank you.

    -
    +

    Problem: please first create the brand(s) using Create a brand
    Thank you.

    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp index 2fc9dbc1..320ab5b9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp @@ -31,8 +31,8 @@ -

    The template you created via example 8 and brands created via - example 24 will be used.

    +

    The template you created via Create a template and brands created via + Create a brand will be used.

    -

    Problem: please create the template using example 8.

    +

    Problem: please create the template using Create a template.

    -

    Problem: please create the brand using example 24.

    -
    +

    Problem: please create the brand using Create a brand.

    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index e6898f85..b5daf855 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -10,7 +10,7 @@

    API methods used: - Envelopes::create , + Envelopes::create, EnvelopeViews::createRecipient.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp new file mode 100644 index 00000000..94f09da8 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg040.jsp @@ -0,0 +1,58 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +

    Set document visibility for envelope recipients

    +

    + Demonstrates how to set document visibility for envelope recipients. +

    + +

    Documentation about this example.

    + + +

    API method used: + Envelopes::create. +

    + +

    + View source file ${sourceFile} on GitHub. +

    + +
    +
    + + + We'll never share your email with anyone else. +
    +
    + + +
    +
    + + + We'll never share your email with anyone else. +
    +
    + + +
    +
    + + + The email for the cc recipient must be different from the signer emails. +
    +
    + + +
    + + + + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 58fd1b63..93c250f2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -26,7 +26,16 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Basic examples

    +

    Requesting a signature

    + +

    Send an envelope with a remote (email) signer and cc recipient

    +

    The envelope includes a pdf, Word, and HTML document. Anchor text + (AutoPlace) + is used to position the signing fields in the documents. +

    +

    API method used: + Envelopes::create. +

    Use embedded signing

    This example sends an envelope, and then uses embedded signing for the first signer. @@ -37,22 +46,55 @@ EnvelopeViews::createRecipient.

    -

    Send an envelope with a remote (email) signer and cc recipient

    -

    The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    +

    Send an envelope using a template

    +

    The envelope is defined by the template. + The signer and cc recipient name and email are used to fill in the template's roles.

    API method used: Envelopes::create.

    -

    List envelopes in the user's account

    -

    List the envelopes created in the last 30 days. +

    Use embedded signing from a template with an added document

    +

    This example sends an envelope based on a template.

    +

    In addition to the template's document(s), the example adds an + additional document to the envelope by using the + Composite Templates + feature.

    +

    API methods used: + Envelopes::create and + EnvelopeViews::createRecipient. +

    + +

    Request a signature by SMS delivery

    +

    + Sends a signature requet via an SMS message. +

    +

    + API method used: + Envelopes::create. +

    + +

    Send an envelope with an order form and payment field

    +

    Anchor text + (AutoPlace) + is used to position the fields in the documents.

    API method used: - Envelopes::listStatusChanges. + Envelopes::create. +

    + +

    Send an envelope to an In Person Signer

    +

    + Demonstrates how to host an In Person Signing session with embedded signing. +

    +

    + API method used: + Envelopes::create, + EnvelopeViews::createRecipient.

    +

    Working with envelopes and templates

    +

    Get an envelope's basic information and status

    List the basic information about an envelope, including its overall status. Additional API/SDK methods may be used to get additional information about the @@ -69,19 +111,11 @@ EnvelopeRecipients::list.

    -

    List an envelope's documents

    -

    List the envelope's documents. A Certificate of Completion document - is also associated with every envelope. -

    -

    API method used: - EnvelopeDocuments::list. -

    - -

    Download a document from an envelope

    -

    An envelope's documents can be downloaded one by one or as a complete set. +

    List envelopes in the user's account

    +

    List the envelopes created in the last 30 days.

    API method used: - EnvelopeDocuments::get. + Envelopes::listStatusChanges.

    Create a template

    @@ -91,23 +125,6 @@ Templates::create.

    -

    Send an envelope using a template

    -

    The envelope is defined by the template. - The signer and cc recipient name and email are used to fill in the template's roles.

    -

    API method used: - Envelopes::create. -

    - -

    Send an envelope using binary document transfer

    -

    The envelope includes a pdf, Word, and HTML document.

    -

    Multipart data transfer is used to send the documents in binary format to DocuSign. - Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. - Binary transfer is not yet supported by the SDK. -

    -

    API method used: - Envelopes::create. -

    -

    Use embedded sending

    An envelope will be created in draft mode. The DocuSign web tool (NDSE) will then be shown, enabling further updates @@ -117,43 +134,131 @@ Envelopes::create, EnvelopeViews::createSender. -

    Embedded DocuSign web tool

    -

    Redirect the user to the DocuSign web tool.

    +

    Bulk send envelopes

    + +

    + Demonstrates how to send envelopes in bulk to multiple recipients. First, this example + creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk + envelope sending. +

    +

    + API methods used: + BulkSend::createBulkSendList, + Envelopes::create, + EnvelopeCustomFields::create, + BulkSend::createBulkSendRequest, + BulkSend::getBulkSendBatchStatus. +

    + +

    Working with advanced recipient routing

    + +

    Pause a signature workflow

    + +

    + This topic demonstrates how to create an envelope where the workflow is paused before the + envelope is sent to a second recipient. For information on resuming a workflow see + + How to unpause a signature workflow + . +

    +

    + API methods used: + Envelopes::create. +

    + +

    Unpause a signature workflow

    + +

    + This topic demonstrates how to resume an envelope workflow that has been paused. + For information on creating an envelope with a paused workflow, see + + How to pause a signature workflow + . +

    +

    + API methods used: + Envelopes::update. +

    + +

    Use conditional recipients

    + +

    + This topic demonstrates how to create an envelope where the workflow is routed to + different recipients based on the value of a transaction. +

    +

    + API methods used: + Envelopes::create. +

    + +

    Schedule an envelope

    +

    + Demonstrates how to schedule an envelope using the scheduled sending feature. +

    +

    + API method used: + Envelopes::create. +

    + +

    Send an envelope with delayed routing

    +

    + Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature. +

    +

    + API method used: + Envelopes::create. +

    + +

    Working with documents

    + + +

    List an envelope's documents

    +

    List the envelope's documents. A Certificate of Completion document + is also associated with every envelope. +

    API method used: - EnvelopeViews::createConsole. + EnvelopeDocuments::list.

    -

    Use embedded signing from a template with an added document

    -

    This example sends an envelope based on a template.

    -

    In addition to the template's document(s), the example adds an - additional document to the envelope by using the - Composite Templates - feature.

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. +

    Download a document from an envelope

    +

    An envelope's documents can be downloaded one by one or as a complete set. +

    +

    API method used: + EnvelopeDocuments::get.

    -

    Send an envelope to an In Person Signer

    -

    - Demonstrates how to host an In Person Signing session with embedded signing. -

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    - -

    Payments

    -

    Send an envelope with an order form and payment field

    -

    Anchor text - (AutoPlace) - is used to position the fields in the documents. +

    Send an envelope using binary document transfer

    +

    The envelope includes a pdf, Word, and HTML document.

    +

    Multipart data transfer is used to send the documents in binary format to DocuSign. + Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. + Binary transfer is not yet supported by the SDK.

    +

    API method used: Envelopes::create.

    +

    Create a signable HTML document

    +

    + Demonstrates how to create an HTML document for responsive signing. +

    + API methods used: + Envelopes::create, + EnvelopeViews::createRecipient. +

    -

    Tabs

    +

    Set document visibility for envelope recipients

    +

    + Demonstrates how to set document visibility for envelope recipients. +

    +

    + API method used: + Envelopes::create. +

    + +

    Working with tabs

    Get the tab data from an envelope

    This example retrieves the tab (field) values from an envelope.

    @@ -184,35 +289,28 @@ API method used: EnvelopeCustomFields::list.

    - -

    Recipient authentication

    -

    Require access code authentication for a recipient

    -

    Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

    +

    Working with brands

    + +

    Create a brand

    +

    This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

    API method used: - Envelopes::create. + AccountBrands::create.

    - -

    Require phone authentication for a recipient

    -

    Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

    + +

    Applying a brand to an envelope

    +

    This example will show you how to create an envelope using any of the created brands on your account.

    API method used: - Envelopes::create. + Envelopes::create.

    -

    Require knowledge-based authentication (KBA) for a recipient

    -

    Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

    +

    Applying a brand to a template

    +

    This example will show you how to create an envelope using a brand

    API method used: - Envelopes::create. -

    - -

    Require ID verification (IDV) for a recipient

    -

    Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

    -

    - API method used: - Envelopes::create. + Envelopes::create.

    -

    Permissions

    +

    Working with permissions

    Create a new permission profile

    @@ -240,125 +338,40 @@

    API method used: AccountPermissionProfiles::create.

    - -

    Brands

    - -

    Create a brand

    -

    This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

    -

    API method used: - AccountBrands::create. -

    - -

    Applying a brand to an envelope

    -

    This example will show you how to create an envelope using any of the created brands on your account.

    -

    API method used: - Envelopes::create. -

    - -

    Applying a brand to a template

    -

    This example will show you how to create an envelope using a brand

    -

    API method used: - Envelopes::create. -

    - -

    Bulk operations

    - -

    Bulk send envelopes

    - -

    - Demonstrates how to send envelopes in bulk to multiple recipients. First, this example - creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk - envelope sending. -

    -

    - API methods used: - BulkSend::createBulkSendList, - Envelopes::create, - EnvelopeCustomFields::create, - BulkSend::createBulkSendRequest, - BulkSend::getBulkSendBatchStatus. -

    - -

    Advanced recipient routing

    -

    Pause a signature workflow

    - -

    - This topic demonstrates how to create an envelope where the workflow is paused before the - envelope is sent to a second recipient. For information on resuming a workflow see - - How to unpause a signature workflow - . -

    -

    - API methods used: - Envelopes::create. -

    +

    Implementing multi-factor recipient (signer) authentication

    -

    Unpause a signature workflow

    - -

    - This topic demonstrates how to resume an envelope workflow that has been paused. - For information on creating an envelope with a paused workflow, see - - How to pause a signature workflow - . -

    +

    Require ID verification (IDV) for a recipient

    +

    Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

    - API methods used: - Envelopes::update. + API method used: + Envelopes::create.

    -

    Use conditional recipients

    - -

    - This topic demonstrates how to create an envelope where the workflow is routed to - different recipients based on the value of a transaction. -

    -

    - API methods used: - Envelopes::create. +

    Require knowledge-based authentication (KBA) for a recipient

    +

    Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

    +

    API method used: + Envelopes::create.

    -

    Schedule an envelope

    -

    - Demonstrates how to schedule an envelope using the scheduled sending feature. -

    -

    - API method used: - Envelopes::create. +

    Require phone authentication for a recipient

    +

    Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

    +

    API method used: + Envelopes::create.

    -

    Send an envelope with delayed routing

    -

    - Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature. -

    -

    - API method used: - Envelopes::create. +

    Require access code authentication for a recipient

    +

    Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

    +

    API method used: + Envelopes::create.

    -

    Premium features

    -

    Request a signature by SMS delivery

    -

    - Sends a signature requet via an SMS message. -

    -

    - API method used: - Envelopes::create. -

    +



    -

    Create a signable HTML document

    -

    - Demonstrates how to create an HTML document for responsive signing. -

    - API methods used: - Envelopes::create, - EnvelopeViews::createRecipient. +

    Embedded DocuSign web tool

    +

    Redirect the user to the DocuSign web tool.

    +

    API method used: + EnvelopeViews::createConsole.

    From 04602eb8b31a6637f3c4cb59800dd12de0cbe2f5 Mon Sep 17 00:00:00 2001 From: annahileta Date: Tue, 16 Aug 2022 16:43:53 +0300 Subject: [PATCH 326/699] getting the data for the pages from the manifest file --- .../java/com/docusign/DSConfiguration.java | 48 ++- .../EG001ControllerEmbeddedSigning.java | 12 +- .../admin/examples/A001AddActiveUser.java | 7 +- .../A002CreateActiveCLMESignUser.java | 12 +- .../examples/A003BulkExportUserData.java | 7 +- .../examples/A003aCheckRequestStatus.java | 7 +- .../examples/A004BulkImportUserData.java | 7 +- .../A004CheckImportRequestStatus.java | 7 +- .../admin/examples/A005AuditUsers.java | 6 +- ...RetrieveDocuSignProfileByEmailAddress.java | 7 +- .../A007RetrieveDocuSignProfileByUserID.java | 7 +- ...008UpdateUserProductPermissionProfile.java | 6 +- ...009DeleteUserProductPermissionProfile.java | 6 +- .../examples/AbstractAdminController.java | 8 +- .../examples/AbstractClickController.java | 4 +- .../C001ControllerCreateClickwrap.java | 4 +- .../C002ControllerActivateClickwrap.java | 4 +- ...03ControllerCreateNewVersionClickwrap.java | 7 +- .../C004ControllerGetListClickwraps.java | 4 +- .../C005ControllerGetClickwrapResponses.java | 4 +- .../AbstractEsignatureController.java | 4 +- .../EG002ControllerSigningViaEmail.java | 9 +- .../EG003ControllerListEnvelopes.java | 6 +- .../examples/EG004ControllerEnvelopeInfo.java | 6 +- .../EG005ControllerEnvelopeRecipients.java | 6 +- .../examples/EG006ControllerEnvelopeDocs.java | 6 +- .../EG007ControllerEnvelopeGetDoc.java | 2 +- .../EG008ControllerCreateTemplate.java | 18 +- .../examples/EG009ControllerUseTemplate.java | 9 +- .../EG010ControllerSendBinaryDocs.java | 8 +- .../EG011ControllerEmbeddedSending.java | 2 +- .../EG012ControllerEmbeddedConsole.java | 2 +- .../EG013ControllerAddDocToTemplate.java | 6 +- .../EG014ControllerCollectPayment.java | 9 +- .../examples/EG015ControllerGetTabValues.java | 6 +- .../examples/EG016ControllerSetTabValues.java | 2 +- .../EG017ControllerSetTemplateTabValues.java | 2 +- ...18ControllerEnvelopeCustomFieldValues.java | 6 +- ...019ControllerAccessCodeAuthentication.java | 9 +- .../EG020ControllerPhoneAuthentication.java | 10 +- .../EG022ControllerKBAAuthentication.java | 9 +- .../EG023ControllerIdvAuthentication.java | 9 +- .../EG024ControllerPermissionCreate.java | 9 +- ...G025ControllerPermissionSetUserGroups.java | 6 +- ...ntrollerPermissionChangeSingleSetting.java | 9 +- .../EG027ControllerPermissionDelete.java | 8 +- .../examples/EG028ControllerCreateBrand.java | 9 +- .../EG029ControllerApplyBrandToEnvelope.java | 9 +- .../EG030ControllerApplyBrandToTemplate.java | 9 +- .../EG031ControllerBulkSendEnvelopes.java | 6 +- ...EG032ControllerPauseSignatureWorkflow.java | 8 +- ...033ControllerUnpauseSignatureWorkflow.java | 4 +- ...034ControllerUseConditionalRecipients.java | 8 +- .../EG035ControllerScheduledSending.java | 9 +- .../EG036ControllerDelayedRouting.java | 9 +- .../examples/EG037ControllerSMSDelivery.java | 9 +- .../EG038ControllerResponsiveSigning.java | 2 +- .../EG039ControllerInPersonSigning.java | 2 +- .../examples/AbstractMonitorController.java | 4 +- .../examples/M001GetMonitoringData.java | 6 +- .../examples/M002WebQueryEndpoint.java | 6 +- .../examples/AbstractRoomsController.java | 4 +- .../examples/R001ControllerCreateRoom.java | 6 +- .../R002ControllerCreateRoomWithTemplate.java | 6 +- .../R003ControllerExportingDataFromRoom.java | 4 +- .../R004ControllerAddingFormsToRoom.java | 4 +- .../R005ControllerGetRoomsWithFilters.java | 4 +- ...ntrollerCreateExternalFormFillSession.java | 4 +- .../R007ControllerCreateFormGroup.java | 4 +- ...ontrollerGrantOfficeAccessToFormGroup.java | 4 +- .../R009ControllerAssignFormToFormGroup.java | 4 +- .../core/controller/AbstractController.java | 34 +- .../core/controller/IndexController.java | 2 + .../model/manifestModels/AdditionalPage.java | 2 + .../model/manifestModels/CodeExampleText.java | 2 + .../manifestModels/LinkToAPIMethods.java | 2 + .../model/manifestModels/ManifestGroup.java | 2 + .../manifestModels/ManifestStructure.java | 2 + .../views/pages/admin/examples/a001.jsp | 14 +- .../views/pages/admin/examples/a002.jsp | 14 +- .../views/pages/admin/examples/a003.jsp | 11 +- .../views/pages/admin/examples/a003a.jsp | 9 +- .../views/pages/admin/examples/a004.jsp | 11 +- .../views/pages/admin/examples/a004a.jsp | 9 +- .../views/pages/admin/examples/a005.jsp | 11 +- .../views/pages/admin/examples/a006.jsp | 11 +- .../views/pages/admin/examples/a007.jsp | 12 +- .../views/pages/admin/examples/a008.jsp | 13 +- .../views/pages/admin/examples/a009.jsp | 15 +- .../templates/views/pages/admin/index.jsp | 172 ++------ .../views/pages/click/examples/c001.jsp | 11 +- .../views/pages/click/examples/c002.jsp | 11 +- .../views/pages/click/examples/c003.jsp | 15 +- .../views/pages/click/examples/c004.jsp | 10 +- .../views/pages/click/examples/c005.jsp | 10 +- .../templates/views/pages/click/index.jsp | 69 ++-- .../views/pages/esignature/examples/eg001.jsp | 13 +- .../views/pages/esignature/examples/eg002.jsp | 13 +- .../views/pages/esignature/examples/eg003.jsp | 10 +- .../views/pages/esignature/examples/eg004.jsp | 16 +- .../views/pages/esignature/examples/eg005.jsp | 9 +- .../views/pages/esignature/examples/eg006.jsp | 13 +- .../views/pages/esignature/examples/eg007.jsp | 19 +- .../views/pages/esignature/examples/eg008.jsp | 18 +- .../views/pages/esignature/examples/eg009.jsp | 15 +- .../views/pages/esignature/examples/eg010.jsp | 14 +- .../views/pages/esignature/examples/eg011.jsp | 20 +- .../views/pages/esignature/examples/eg012.jsp | 16 +- .../views/pages/esignature/examples/eg013.jsp | 24 +- .../views/pages/esignature/examples/eg014.jsp | 18 +- .../views/pages/esignature/examples/eg015.jsp | 16 +- .../views/pages/esignature/examples/eg016.jsp | 14 +- .../views/pages/esignature/examples/eg017.jsp | 12 +- .../views/pages/esignature/examples/eg018.jsp | 19 +- .../views/pages/esignature/examples/eg019.jsp | 16 +- .../views/pages/esignature/examples/eg020.jsp | 11 +- .../views/pages/esignature/examples/eg022.jsp | 7 +- .../views/pages/esignature/examples/eg023.jsp | 17 +- .../views/pages/esignature/examples/eg024.jsp | 13 +- .../views/pages/esignature/examples/eg025.jsp | 13 +- .../views/pages/esignature/examples/eg026.jsp | 12 +- .../views/pages/esignature/examples/eg027.jsp | 13 +- .../views/pages/esignature/examples/eg028.jsp | 17 +- .../views/pages/esignature/examples/eg029.jsp | 19 +- .../views/pages/esignature/examples/eg030.jsp | 20 +- .../views/pages/esignature/examples/eg031.jsp | 17 +- .../views/pages/esignature/examples/eg032.jsp | 15 +- .../views/pages/esignature/examples/eg033.jsp | 15 +- .../views/pages/esignature/examples/eg034.jsp | 13 +- .../views/pages/esignature/examples/eg035.jsp | 8 +- .../views/pages/esignature/examples/eg036.jsp | 8 +- .../views/pages/esignature/examples/eg037.jsp | 8 +- .../views/pages/esignature/examples/eg038.jsp | 9 +- .../views/pages/esignature/examples/eg039.jsp | 11 +- .../examples/quickEmbeddedSigning.jsp | 13 +- .../views/pages/esignature/index.jsp | 377 ++---------------- .../views/pages/links_to_api_methods.jsp | 30 ++ .../views/pages/monitor/examples/m001.jsp | 9 +- .../views/pages/monitor/examples/m002.jsp | 9 +- .../templates/views/pages/monitor/index.jsp | 57 ++- .../views/pages/rooms/examples/r001.jsp | 10 +- .../views/pages/rooms/examples/r002.jsp | 15 +- .../views/pages/rooms/examples/r003.jsp | 11 +- .../views/pages/rooms/examples/r004.jsp | 12 +- .../views/pages/rooms/examples/r005.jsp | 13 +- .../views/pages/rooms/examples/r006.jsp | 17 +- .../views/pages/rooms/examples/r007.jsp | 9 +- .../views/pages/rooms/examples/r008.jsp | 15 +- .../views/pages/rooms/examples/r009.jsp | 17 +- .../templates/views/pages/rooms/index.jsp | 128 ++---- 150 files changed, 752 insertions(+), 1501 deletions(-) create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index 506590e8..51c660c4 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -38,7 +38,7 @@ public class DSConfiguration { private String selectedApiType; - //private ManifestStructure codeExamplesText; + private ManifestStructure codeExamplesText; @Value("${DS_TARGET_ACCOUNT_ID}") private String targetAccountId; @@ -140,20 +140,51 @@ private String getSelectedApi() throws IOException { return selectedApiType; } - public ManifestStructure getCodeExamplesText() throws Exception { + public ManifestStructure getCodeExamplesText() { if (codeExamplesText != null){ return codeExamplesText; } try { - var json = loadFileData(eSignatureManifest); + String json = loadFileData(getTextManifestDependingOnCurrentAPI()); codeExamplesText = new ObjectMapper().readValue(json, ManifestStructure.class); - } catch (JSONException e){ + } catch (JSONException | IOException e){ + e.printStackTrace(); + } catch (Exception e) { e.printStackTrace(); } + return codeExamplesText; } + private String getTextManifestDependingOnCurrentAPI() throws IOException { + String linkToManifest = ""; + + ApiIndex selectedApiIndex = getSelectedApiIndex(); + if (selectedApiIndex == ApiIndex.ESIGNATURE) + { + linkToManifest = eSignatureManifest; + } + else if (selectedApiIndex == ApiIndex.CLICK) + { + linkToManifest = clickManifest; + } + else if (selectedApiIndex == ApiIndex.ROOMS) + { + linkToManifest =roomsManifest; + } + else if (selectedApiIndex == ApiIndex.MONITOR) + { + linkToManifest = monitorManifest; + } + else if (selectedApiIndex == ApiIndex.ADMIN) + { + linkToManifest = adminManifest; + } + + return linkToManifest; + } + private String loadFileData(String filePath) throws Exception { URL fullRequestPath = new URL(filePath); HttpURLConnection httpConnection = (HttpURLConnection) fullRequestPath.openConnection(); @@ -171,10 +202,15 @@ private String loadFileData(String filePath) throws Exception { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpConnection.getInputStream())); StringBuilder stringBuilder = new StringBuilder(); - + String temp; + while ((temp = bufferedReader.readLine()) != null) { + stringBuilder.append(temp); + } bufferedReader.close(); httpConnection.disconnect(); - return stringBuilder.toString(); + // Removing invalid symbols from the data + String a = stringBuilder.toString(); + return a; } } \ No newline at end of file diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 07f832db..0ff97a2c 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -6,7 +6,6 @@ import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; import com.docusign.esign.client.ApiClient; -import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; import com.docusign.esign.model.RecipientViewRequest; @@ -19,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.view.RedirectView; -import java.io.IOException; - import javax.servlet.http.HttpServletResponse; @@ -39,21 +36,20 @@ public class EG001ControllerEmbeddedSigning extends AbstractEsignatureController private static final int ANCHOR_OFFSET_Y = 20; private static final int ANCHOR_OFFSET_X = 10; private static final String SIGNER_CLIENT_ID = "1000"; - private final Session session; private final User user; - @Autowired - public EG001ControllerEmbeddedSigning(DSConfiguration config, Session session, User user) { - super(config, Boolean.valueOf(config.getQuickACG()) ? "quickEmbeddedSigning" : "eg001", "Use embedded signing"); + public EG001ControllerEmbeddedSigning(DSConfiguration config, Session session, User user){ + super(config, Boolean.valueOf(config.getQuickACG()) ? "quickEmbeddedSigning" : "eg001"); this.session = session; this.user = user; } @Override protected Object doWork(WorkArguments args, ModelMap model, - HttpServletResponse response) throws ApiException, IOException { + HttpServletResponse response) throws Exception { + var a = config.getCodeExamplesText(); String signerName = args.getSignerName(); String signerEmail = args.getSignerEmail(); String accountId = session.getAccountId(); diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index a1c6b4cd..755ba3ef 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -38,7 +38,7 @@ public class A001AddActiveUser extends AbstractAdminController { @Autowired public A001AddActiveUser(DSConfiguration config, Session session, User user) { - super(config, "a001", "Create a new active eSignature user"); + super(config, "a001"); this.user = user; this.session = session; } @@ -90,8 +90,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse accountId); // Process results - DoneExample.createDefault(title) - .withMessage("Results from eSignUserManagement:createUser method:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(result) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 3efb7394..5073088c 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -34,14 +34,13 @@ @RequestMapping("/a002") public class A002CreateActiveCLMESignUser extends AbstractAdminController { - private final User user; private final Session session; @Autowired public A002CreateActiveCLMESignUser(DSConfiguration config, Session session, User user) { - super(config, "a002", "Create new active user for CLM and eSignature"); + super(config, "a002"); this.user = user; this.session = session; } @@ -118,10 +117,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.session.setEmailAddress(result.getEmail()); // Process results - DoneExample.createDefault(title) - .withMessage("Results from MultiProductUserManagement:addOrUpdateUser method:") - .withJsonObject(result) - .addToModel(model); + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) + .withJsonObject(result) + .addToModel(model); return DONE_EXAMPLE_PAGE; } } diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 8b763ec5..4abad7ba 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -44,7 +44,7 @@ public class A003BulkExportUserData extends AbstractAdminController { @Autowired public A003BulkExportUserData(DSConfiguration config, Session session, User user) { - super(config, "a003", "Bulk export user data"); + super(config, "a003"); this.session = session; this.user = user; } @@ -80,8 +80,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse OrganizationExportsResponse results = BulkExportUserDataService .bulkExportsUserData(bulkExportsApi, this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath())); // Process results - DoneExample.createDefault(title) - .withMessage("User data exported to " + saveFilePath + "
    from UserExport:getUserListExport method:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText.replaceFirst("\\{0}", saveFilePath)) .withJsonObject(results).addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index 96e79efd..86a70f9b 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -31,7 +31,7 @@ public class A003aCheckRequestStatus extends AbstractAdminController { @Autowired public A003aCheckRequestStatus(DSConfiguration config, Session session, User user) { - super(config, "a003a", "Check request status"); + super(config, "a003a"); this.session = session; this.user = user; } @@ -53,8 +53,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse UUID.fromString(this.session.getExportId())); // Process results - DoneExample.createDefault(title) - .withMessage("Admin API data response output:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(result) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index 7bbf26a9..418eaf51 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -31,7 +31,7 @@ public class A004BulkImportUserData extends AbstractAdminController { @Autowired public A004BulkImportUserData(DSConfiguration config, Session session, User user) { - super(config, "a004", "Add users via bulk import"); + super(config, "a004"); this.session = session; this.user = user; } @@ -45,8 +45,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.session.setImportId(result.getId().toString()); // Process results - DoneExample.createDefault(title) - .withMessage("Results from UserImport:addBulkUserImport method:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(result) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index ccd5cfa4..2b1f27aa 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -35,7 +35,7 @@ public class A004CheckImportRequestStatus extends AbstractAdminController { @Autowired public A004CheckImportRequestStatus(DSConfiguration config, Session session, User user) { - super(config, "a004a", "Check request status"); + super(config, "a004a"); this.session = session; this.user = user; } @@ -69,8 +69,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.session.setImportId(null); // Process results - DoneExample.createDefault(title) - .withMessage("Admin API data response output:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(result) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 0c37205f..22a7ac76 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -41,7 +41,7 @@ public class A005AuditUsers extends AbstractAdminController { @Autowired public A005AuditUsers(DSConfiguration config, Session session, User user) { - super(config, "a005", "Audit Users"); + super(config, "a005"); this.user = user; this.session = session; } @@ -57,7 +57,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse ArrayList resultsArr = AuditUsersService.auditUsers(usersApi, organizationId, accountId); // Process results - DoneExample.createDefault(title).withMessage("Results from eSignUserManagement:getUserProfiles method:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(resultsArr).addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java b/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java index 0eb647b4..07b0070c 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java +++ b/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java @@ -26,7 +26,7 @@ public class A006RetrieveDocuSignProfileByEmailAddress extends AbstractAdminCont @Autowired public A006RetrieveDocuSignProfileByEmailAddress(DSConfiguration config, User user) { - super(config, "a006", "Retrieve the user's DocuSign profile using an email address"); + super(config, "a006"); this.user = user; } @@ -38,8 +38,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse UsersDrilldownResponse usersResponse = RetrieveDocuSignProfileByEmailAddress .getDocuSignProfileByEmailAddress(usersApi, organizationId, args.getEmail()); // Step 3 end - DoneExample.createDefault(title) - .withMessage("Results from getDSUserProfile_Email method:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(usersResponse.getUsers()).addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java b/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java index d88d2b20..40adc3cc 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java +++ b/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java @@ -26,7 +26,7 @@ public class A007RetrieveDocuSignProfileByUserID extends AbstractAdminController @Autowired public A007RetrieveDocuSignProfileByUserID(DSConfiguration config, User user) { - super(config, "a007", "Retrieve the user's DocuSign profile using a User ID"); + super(config, "a007"); this.user = user; } @@ -39,8 +39,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse UsersDrilldownResponse usersResponse = RetrieveDocuSignProfileByUserId. getDocuSignProfileByUserId(usersApi, organizationId, args.getUserId()); // Step 3 end - DoneExample.createDefault(title) - .withMessage("Results from getDSUserProfile method:") + DoneExample + .createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(usersResponse.getUsers()).addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java b/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java index e9fe1e29..0bcc4049 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java +++ b/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java @@ -41,7 +41,7 @@ public class A008UpdateUserProductPermissionProfile extends AbstractAdminControl @Autowired public A008UpdateUserProductPermissionProfile(DSConfiguration config, Session session, User user) { - super(config, "a008", "Update user product permission profiles using an email address"); + super(config, "a008"); this.user = user; } @@ -125,8 +125,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse existingAccountId ); - DoneExample.createDefault(title) - .withMessage("Results from MultiProductUserManagement:addUserProductPermissionProfilesByEmail method:") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(productPermissionProfile) .addToModel(model); diff --git a/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java index aa81890d..c5a3e73a 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java +++ b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java @@ -40,7 +40,7 @@ public class A009DeleteUserProductPermissionProfile extends AbstractAdminControl @Autowired public A009DeleteUserProductPermissionProfile(DSConfiguration config, Session session, User user) { - super(config, "a009", "Delete user product permission profiles using an email address"); + super(config, "a009"); this.user = user; } @@ -123,8 +123,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse organizationId, existingAccountId); //Step 5 end - DoneExample.createDefault(title) - .withMessage("Results from MultiProductUserManagement:removeUserProductPermission method:") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(removeUserProductsRepsonse) .addToModel(model); diff --git a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java index 353861da..4438f08b 100644 --- a/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java +++ b/src/main/java/com/docusign/controller/admin/examples/AbstractAdminController.java @@ -35,12 +35,8 @@ public abstract class AbstractAdminController extends AbstractController { private final DSConfiguration configuration; private static final String EXAMPLE_PAGES_PATH = "pages/admin/examples/"; - public AbstractAdminController( - DSConfiguration config, - String exampleName, - String title - ) { - super(config, exampleName, title); + public AbstractAdminController(DSConfiguration config, String exampleName) { + super(config, exampleName); this.configuration = config; } diff --git a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java index 0ef1f773..468e2cfe 100644 --- a/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java +++ b/src/main/java/com/docusign/controller/click/examples/AbstractClickController.java @@ -19,8 +19,8 @@ public abstract class AbstractClickController extends AbstractController { private static final String EXAMPLE_PAGES_PATH = "pages/click/examples/"; - public AbstractClickController(DSConfiguration config, String exampleName, String title) { - super(config, exampleName, title); + public AbstractClickController(DSConfiguration config, String exampleName) { + super(config, exampleName); } protected String getExamplePagesPath() { diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 0269b17c..53dac5db 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -33,7 +33,7 @@ public class C001ControllerCreateClickwrap extends AbstractClickController { @Autowired public C001ControllerCreateClickwrap(DSConfiguration config, Session session, User user) { - super(config, "c001", "Create a clickwrap"); + super(config, "c001"); this.session = session; this.user = user; } @@ -61,7 +61,7 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) - .withMessage("The clickwrap " + createdClickwrap.getClickwrapName() + " has been created.") + .withMessage(this.codeExampleText.ResultsPageText.replaceFirst("\\{0}", createdClickwrap.getClickwrapName())) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index ada4168c..a6dbbd90 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -31,7 +31,7 @@ public class C002ControllerActivateClickwrap extends AbstractClickController { @Autowired public C002ControllerActivateClickwrap(DSConfiguration config, Session session, User user) { - super(config, "c002", "Activate a clickwrap"); + super(config, "c002"); this.session = session; this.user = user; } @@ -64,7 +64,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(updatedClickwrap) - .withMessage("The clickwrap " + updatedClickwrap.getClickwrapName() + " has been activated.") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index 19facad3..affc5fb2 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -36,7 +36,7 @@ public class C003ControllerCreateNewVersionClickwrap extends AbstractClickContro @Autowired public C003ControllerCreateNewVersionClickwrap(DSConfiguration config, Session session, User user) { - super(config, "c003", "Create a new clickwrap version"); + super(config, "c003"); this.session = session; this.user = user; } @@ -69,8 +69,9 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) - .withMessage("Version " + createdClickwrap.getVersionNumber() + " of clickwrap " + - createdClickwrap.getClickwrapName() + " has been created.") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", createdClickwrap.getVersionNumber()) + .replaceFirst("\\{1}", createdClickwrap.getClickwrapName())) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index 5d597e1c..0c4f3998 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -28,7 +28,7 @@ public class C004ControllerGetListClickwraps extends AbstractClickController { @Autowired public C004ControllerGetListClickwraps(DSConfiguration config, Session session, User user) { - super(config, "c004", "Get a list of clickwraps"); + super(config, "c004"); this.session = session; this.user = user; } @@ -46,7 +46,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(clickwrapsResponse) - .withMessage("Results from the Click::getClickwraps method:") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index 268366a2..2ea70421 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -31,7 +31,7 @@ public class C005ControllerGetClickwrapResponses extends AbstractClickController @Autowired public C005ControllerGetClickwrapResponses(DSConfiguration config, Session session, User user) { - super(config, "c005", "Get clickwrap responses"); + super(config, "c005"); this.session = session; this.user = user; } @@ -59,7 +59,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(clickwrapAgreementsResponse) - .withMessage("Results from the ClickWraps::getClickwrapAgreements method:") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java index e7b0616f..1f9602be 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/AbstractEsignatureController.java @@ -21,8 +21,8 @@ public abstract class AbstractEsignatureController extends AbstractController { protected static final String MODEL_TEMPLATE_OK = "templateOk"; private static final String EXAMPLE_PAGES_PATH = "pages/esignature/examples/"; - public AbstractEsignatureController(DSConfiguration config, String exampleName, String title) { - super(config, exampleName, title); + public AbstractEsignatureController(DSConfiguration config, String exampleName) { + super(config, exampleName); } protected String getExamplePagesPath() { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index 80c6687b..f68018cc 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -33,7 +33,7 @@ public class EG002ControllerSigningViaEmail extends AbstractEsignatureController @Autowired public EG002ControllerSigningViaEmail(DSConfiguration config, Session session, User user) { - super(config, "eg002", "Signing request by email"); + super(config, "eg002"); this.session = session; this.user = user; } @@ -63,9 +63,10 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(title) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) + ) .withJsonObject(envelopeSummary) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 6ef6ba3e..970c2084 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -31,7 +31,7 @@ public class EG003ControllerListEnvelopes extends AbstractEsignatureController { @Autowired public EG003ControllerListEnvelopes(DSConfiguration config, Session session, User user) { - super(config, "eg003", "List envelopes"); + super(config, "eg003"); this.session = session; this.user = user; } @@ -44,8 +44,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId()); - DoneExample.createDefault(title) - .withMessage("Results from the Envelopes::listStatusChanges method:") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(envelopesInformation) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index 87a84d4c..7a803951 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -35,7 +35,7 @@ public class EG004ControllerEnvelopeInfo extends AbstractEsignatureController { @Autowired public EG004ControllerEnvelopeInfo(DSConfiguration config, Session session, User user) { - super(config, "eg004", "Get envelope information"); + super(config, "eg004"); this.session = session; this.user = user; } @@ -55,9 +55,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId(), session.getEnvelopeId()); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelope) - .withMessage("Results from the Envelopes::get method:") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index 2fca5c28..ea3d5053 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -31,7 +31,7 @@ public class EG005ControllerEnvelopeRecipients extends AbstractEsignatureControl @Autowired public EG005ControllerEnvelopeRecipients(DSConfiguration config, Session session, User user) { - super(config, "eg005", "List envelope recipients"); + super(config, "eg005"); this.session = session; this.user = user; } @@ -51,9 +51,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId(), session.getEnvelopeId()); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(recipients) - .withMessage("Results from the EnvelopeRecipients::list method:") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java index 8e06f624..02c6c9c3 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java @@ -39,7 +39,7 @@ public class EG006ControllerEnvelopeDocs extends AbstractEsignatureController { @Autowired public EG006ControllerEnvelopeDocs(DSConfiguration config, Session session, User user) { - super(config, "eg006", "List envelope documents"); + super(config, "eg006"); this.session = session; this.user = user; } @@ -77,9 +77,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopeDocItems.add(new EnvelopeDocumentInfo(documentName, doc.getType(), doc.getDocumentId())); } - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelopeDocumentsResult) - .withMessage("Results from the EnvelopeDocuments::list method:") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index 9a3a4277..8c98398e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -41,7 +41,7 @@ public class EG007ControllerEnvelopeGetDoc extends AbstractEsignatureController @Autowired public EG007ControllerEnvelopeGetDoc(DSConfiguration config, Session session, User user) { - super(config, "eg007", "Download a document"); + super(config, "eg007"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index 69d5f3d0..844c6b83 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -36,7 +36,7 @@ public class EG008ControllerCreateTemplate extends AbstractEsignatureController @Autowired public EG008ControllerCreateTemplate(DSConfiguration config, Session session, User user) { - super(config, "eg008", "Create a template"); + super(config, "eg008"); this.session = session; this.user = user; } @@ -59,20 +59,20 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopeTemplate template = envelopeTemplateResults.getEnvelopeTemplates().get(0); session.setTemplateId(template.getTemplateId()); - DoneExample.createDefault(title) - .withMessage(String.format( - "The template already exists in your account.
    Template name: %s, ID %s.", - template.getName(), template.getTemplateId())) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage( + "The template already exists in your account." + this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", template.getName()).replaceFirst("\\{1}", template.getTemplateId())) .addToModel(model); } else { session.setTemplateName(TEMPLATE_NAME); TemplateSummary template = CreateTemplateService.createTemplate(apiClient, accountId, CreateTemplateService.makeTemplate("Example Signer and CC template")); session.setTemplateId(template.getTemplateId()); - DoneExample.createDefault(title) - .withMessage(String.format( - "The template has been created!
    Template name: %s, ID %s.", - template.getName(), template.getTemplateId())) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage( + "The template has been created!" + this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", template.getName()).replaceFirst("\\{1}", template.getTemplateId())) .addToModel(model); } return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index 050313a7..2c5e3d42 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -40,7 +40,7 @@ public class EG009ControllerUseTemplate extends AbstractEsignatureController { @Autowired public EG009ControllerUseTemplate(DSConfiguration config, Session session, User user) { - super(config, "eg009", "Envelope sent"); + super(config, "eg009"); this.session = session; this.user = user; } @@ -71,10 +71,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelope); session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelopeSummary) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index 29e8ae6c..da1a8304 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -30,7 +30,7 @@ public class EG010ControllerSendBinaryDocs extends AbstractEsignatureController @Autowired public EG010ControllerSendBinaryDocs(DSConfiguration config, Session session, User user) { - super(config, "eg010", "Send envelope with multipart mime"); + super(config, "eg010"); this.session = session; this.user = user; } @@ -52,8 +52,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String envelopeId = obj.getString("envelopeId"); session.setEnvelopeId(envelopeId); - DoneExample.createDefault(title) - .withMessage("The envelope has been created and sent!
    Envelope ID " + envelopeId + ".") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeId) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java index e3edb1cb..46e1ee88 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG011ControllerEmbeddedSending.java @@ -34,7 +34,7 @@ public class EG011ControllerEmbeddedSending extends AbstractEsignatureController @Autowired public EG011ControllerEmbeddedSending(DSConfiguration config, Session session, User user) { - super(config, "eg011", "Signing request by email"); + super(config, "eg011"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java index 99dcf832..0745a56e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG012ControllerEmbeddedConsole.java @@ -34,7 +34,7 @@ public class EG012ControllerEmbeddedConsole extends AbstractEsignatureController @Autowired public EG012ControllerEmbeddedConsole(DSConfiguration config, Session session, User user) { - super(config, "eg012", "Embedded DocuSign web tool"); + super(config, "eg012"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java index aa555af1..95e0d741 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG013ControllerAddDocToTemplate.java @@ -34,7 +34,7 @@ public class EG013ControllerAddDocToTemplate extends AbstractEsignatureControlle @Autowired public EG013ControllerAddDocToTemplate(DSConfiguration config, Session session, User user) { - super(config, "eg013", "Use embedded signing from template and extra doc"); + super(config, "eg013"); this.session = session; this.user = user; } @@ -71,7 +71,5 @@ protected Object doWork(WorkArguments args, ModelMap model, args ); return new RedirectView(embeddedEnvelope.getUrl()); - - -} + } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index d81e13ea..26d85478 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -44,7 +44,7 @@ public class EG014ControllerCollectPayment extends AbstractEsignatureController @Autowired public EG014ControllerCollectPayment(DSConfiguration config, Session session, User user) { - super(config, "eg014", "Envelope sent"); + super(config, "eg014"); this.session = session; this.user = user; } @@ -75,9 +75,10 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2. call Envelopes::create API method EnvelopeSummary envelopeSummary = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); - DoneExample.createDefault(title) - .withMessage(String.join("", "The envelope has been created and sent!
    Envelope ID ", - envelopeSummary.getEnvelopeId(), ".")) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java index 6ffc15cf..67158da8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java @@ -31,7 +31,7 @@ public class EG015ControllerGetTabValues extends AbstractEsignatureController { @Autowired public EG015ControllerGetTabValues(DSConfiguration config, Session session, User user) { - super(config, "eg015", "Get Envelope Tabs"); + super(config, "eg015"); this.session = session; this.user = user; } @@ -51,9 +51,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId(), session.getEnvelopeId()); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelopeFormData) - .withMessage("Results from the Envelope::GetFormData method:") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java index 84e46145..339955bb 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG016ControllerSetTabValues.java @@ -31,7 +31,7 @@ public class EG016ControllerSetTabValues extends AbstractEsignatureController { @Autowired public EG016ControllerSetTabValues(DSConfiguration config, Session session, User user) { - super(config, "eg016", "Set envelope tab values"); + super(config, "eg016"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java index 93a235d5..0a0b9df2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG017ControllerSetTemplateTabValues.java @@ -30,7 +30,7 @@ public class EG017ControllerSetTemplateTabValues extends AbstractEsignatureContr @Autowired public EG017ControllerSetTemplateTabValues(DSConfiguration config, Session session, User user) { - super(config, "eg017", "Set template tab values"); + super(config, "eg017"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java index 6e0c461b..fc7fb8ee 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java @@ -31,7 +31,7 @@ public class EG018ControllerEnvelopeCustomFieldValues extends AbstractEsignature @Autowired public EG018ControllerEnvelopeCustomFieldValues(DSConfiguration config, Session session, User user) { - super(config, "eg018", "Get Envelope Custom Field Data"); + super(config, "eg018"); this.session = session; this.user = user; } @@ -54,9 +54,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse session.getEnvelopeId() ); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(customFieldsEnvelope) - .withMessage("Results from the Envelope::GetFormData method:") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index c37b030f..fa87e41a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -32,7 +32,7 @@ public class EG019ControllerAccessCodeAuthentication extends AbstractEsignatureC @Autowired public EG019ControllerAccessCodeAuthentication(DSConfiguration config, Session session, User user) { - super(config, "eg019", "Signing request by email"); + super(config, "eg019"); this.session = session; this.user = user; } @@ -59,10 +59,11 @@ protected Object doWork(WorkArguments args, ModelMap model, ); session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelopeSummary) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + session.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", session.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index 638f1a88..dafa2293 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -47,7 +47,7 @@ public class EG020ControllerPhoneAuthentication extends AbstractEsignatureContro @Autowired public EG020ControllerPhoneAuthentication(DSConfiguration config, Session session, User user) { - super(config, "eg020", "Require Phone Authentication for a Recipient"); + super(config, "eg020"); this.session = session; this.user = user; } @@ -86,9 +86,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 4.1 end session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(title).withJsonObject(results) - .withMessage( - "The envelope has been created and sent!
    Envelope ID " + results.getEnvelopeId() + ".") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withJsonObject(results) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", results.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index 9a203b82..2286070f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -31,7 +31,7 @@ public class EG022ControllerKBAAuthentication extends AbstractEsignatureControll @Autowired public EG022ControllerKBAAuthentication(DSConfiguration config, Session session, User user) { - super(config, "eg022", "Signing request by email"); + super(config, "eg022"); this.session = session; this.user = user; } @@ -56,10 +56,11 @@ protected Object doWork(WorkArguments args, ModelMap model, ); session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelopeSummary) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index 9d874daf..a8a3d467 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -38,7 +38,7 @@ public class EG023ControllerIdvAuthentication extends AbstractEsignatureControll @Autowired public EG023ControllerIdvAuthentication(DSConfiguration config, Session session, User user) { - super(config, "eg023", "ID Verification Authentication"); + super(config, "eg023"); this.session = session; this.user = user; } @@ -63,10 +63,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 5 end session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(results) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + results.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", results.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java index 8ec4eab4..8cd4cfea 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java @@ -31,7 +31,7 @@ public class EG024ControllerPermissionCreate extends AbstractEsignatureControlle @Autowired public EG024ControllerPermissionCreate(DSConfiguration config, Session session, User user) { - super(config, "eg024", "Creates a new permission profile"); + super(config, "eg024"); this.session = session; this.user = user; } @@ -50,10 +50,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getPermissionProfileName() ); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(newProfile) - .withMessage("The permission profile is created!
    Permission profile ID: " - + newProfile.getPermissionProfileId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", newProfile.getPermissionProfileId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java index 05ece245..d7db3a10 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java @@ -38,7 +38,7 @@ public class EG025ControllerPermissionSetUserGroups extends AbstractEsignatureCo @Autowired public EG025ControllerPermissionSetUserGroups(DSConfiguration config, Session session, User user) { - super(config, "eg025", "Setting a permission profile"); + super(config, "eg025"); this.session = session; this.user = user; } @@ -79,9 +79,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .addToModel(model); return ERROR_PAGE; } - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(newGroupInfo) - .withMessage("The permission profile was successfully set to the user group!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java index 7580b1e6..3787ab7b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java @@ -37,7 +37,7 @@ public class EG026ControllerPermissionChangeSingleSetting extends AbstractEsigna @Autowired public EG026ControllerPermissionChangeSingleSetting(DSConfiguration config, Session session, User user) { - super(config, "eg026", "Change single permission setting"); + super(config, "eg026"); this.session = session; this.user = user; } @@ -82,8 +82,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse curProfileId ); - DoneExample.createDefault(title).withMessage("The permission profile is updated!
    Permission profile ID: " - + newProfile.getPermissionProfileId() + ".").addToModel(model); + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", newProfile.getPermissionProfileId()) + ) + .addToModel(model); return DONE_EXAMPLE_PAGE_COMPARE; } } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java index d0ff6c29..3ddb5694 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java @@ -34,7 +34,7 @@ public class EG027ControllerPermissionDelete extends AbstractEsignatureControlle @Autowired public EG027ControllerPermissionDelete(DSConfiguration config, Session session, User user) { - super(config, "eg027", "Deleting a permission profile"); + super(config, "eg027"); this.session = session; this.user = user; } @@ -58,8 +58,10 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse PermissionDeleteService.permissionDelete(accountsApi, session.getAccountId(), curProfileId); // Step 4: Show 'done' (successful) page - DoneExample.createDefault(title) - .withMessage(String.join("", "The permission profile '", curProfileId, "' is deleted.")) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", curProfileId) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java index c619302d..450c0bf2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java @@ -33,7 +33,7 @@ public class EG028ControllerCreateBrand extends AbstractEsignatureController { @Autowired public EG028ControllerCreateBrand(DSConfiguration config, Session session, User user) { - super(config, "eg028", "Creating a brand"); + super(config, "eg028"); this.session = session; this.user = user; } @@ -60,10 +60,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse session.getAccountId() ); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(brandsResponse) - .withMessage("The brand has been created!
    Brand ID " - + brandsResponse.getBrands().get(0).getBrandId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", brandsResponse.getBrands().get(0).getBrandId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index ee741abc..76f44e2a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -36,7 +36,7 @@ public class EG029ControllerApplyBrandToEnvelope extends AbstractEsignatureContr @Autowired public EG029ControllerApplyBrandToEnvelope(DSConfiguration config, Session session, User user) { - super(config, "eg029", "Apply brand to envelope"); + super(config, "eg029"); this.session = session; this.user = user; } @@ -69,10 +69,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelope ); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelopeSummary) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index 63e91cfd..87093250 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -51,7 +51,7 @@ public class EG030ControllerApplyBrandToTemplate extends AbstractEsignatureContr @Autowired public EG030ControllerApplyBrandToTemplate(DSConfiguration config, Session session, User user) { - super(config, "eg030", "Apply brand to template"); + super(config, "eg030"); this.session = session; this.user = user; } @@ -85,10 +85,11 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelope ); - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(envelopeSummary) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index c8454b12..18552792 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -54,7 +54,7 @@ public class EG031ControllerBulkSendEnvelopes extends AbstractEsignatureControll @Autowired public EG031ControllerBulkSendEnvelopes(DSConfiguration config, Session session, User user) { - super(config, "eg031", "Bulk send envelopes"); + super(config, "eg031"); this.session = session; this.user = user; } @@ -93,12 +93,12 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // For 2000 recipients, it can take about an hour BulkSendBatchStatus status = bulkEnvelopesApi.getBulkSendBatchStatus(accountId, batchId); // Step 7 end - DoneExample.createDefault(title) + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) .withJsonObject(status) .withMessage(String.join( "", "Bulk request queued to ", status.getQueued(), " user lists.")) - .withMessage(String.join("", "Results from BulkSend:getBulkSendBatchStatus method:")) + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); } catch (InterruptedException exception) { Thread.currentThread().interrupt(); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index 3068cf2b..5ad69c9d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -31,7 +31,7 @@ public class EG032ControllerPauseSignatureWorkflow extends AbstractEsignatureCon @Autowired public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session session, User user) { - super(config, "eg032", "Pause a signature workflow."); + super(config, "eg032"); this.session = session; this.user = user; } @@ -62,9 +62,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) .withJsonObject(envelopeSummary) - .withMessage( - "The envelope where the workflow is paused before the envelope is sent to a second recipient " + - "has been created and sent!
    Envelope ID " + this.session.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", this.session.getEnvelopeId()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index 7276cdc8..4e0d3107 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -29,7 +29,7 @@ public class EG033ControllerUnpauseSignatureWorkflow extends AbstractEsignatureC @Autowired public EG033ControllerUnpauseSignatureWorkflow(DSConfiguration config, Session session, User user) { - super(config, "eg033", "Unpause a signature workflow"); + super(config, "eg033"); this.session = session; this.user = user; } @@ -49,7 +49,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse DoneExample.createDefault(this.title) .withJsonObject(envelopeUpdateSummary) - .withMessage("A paused envelope was resumed.") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index 4657b8ce..8df64a1d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -32,7 +32,7 @@ public class EG034ControllerUseConditionalRecipients extends AbstractEsignatureC @Autowired public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session session, User user) { - super(config, "eg034", "Use conditional recipients."); + super(config, "eg034"); this.session = session; this.user = user; } @@ -66,10 +66,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) .withJsonObject(envelopeSummary) - .withMessage( - "An envelope where the workflow is routed to different recipients based on the value of a transaction " + - "has been created and sent!
    Envelope ID " - + this.session.getEnvelopeId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", this.session.getEnvelopeId())) .addToModel(model); } catch (ApiException apiException) { if (!apiException.getMessage().contains(NOT_ALLOWED_ERROR_MESSAGE)) { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java index fed6ea91..af76a964 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java @@ -40,7 +40,7 @@ public class EG035ControllerScheduledSending extends AbstractEsignatureControlle @Autowired public EG035ControllerScheduledSending(DSConfiguration config, Session session, User user) { - super(config, "eg035", "Schedule an Envelope"); + super(config, "eg035"); this.session = session; this.user = user; } @@ -74,9 +74,10 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(title) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + results.getEnvelopeId() + ".") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", results.getEnvelopeId()) + ) .withJsonObject(results) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java index 2cc4be3d..8ac0711b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java @@ -40,7 +40,7 @@ public class EG036ControllerDelayedRouting extends AbstractEsignatureController @Autowired public EG036ControllerDelayedRouting(DSConfiguration config, Session session, User user) { - super(config, "eg036", "Send an envelope with delayed routing"); + super(config, "eg036"); this.session = session; this.user = user; } @@ -70,9 +70,10 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(title) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + results.getEnvelopeId() + ".") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", results.getEnvelopeId()) + ) .withJsonObject(results) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java index 095436f3..b5a01965 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java @@ -31,7 +31,7 @@ public class EG037ControllerSMSDelivery extends AbstractEsignatureController { @Autowired public EG037ControllerSMSDelivery(DSConfiguration config, Session session, User user) { - super(config, "eg037", "Request a signature by SMS delivery"); + super(config, "eg037"); this.session = session; this.user = user; } @@ -63,9 +63,10 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(title) - .withMessage("The envelope has been created and sent!
    Envelope ID " - + envelopeSummary.getEnvelopeId() + ".") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) + ) .withJsonObject(envelopeSummary) .addToModel(model); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java index 48f8df91..6799b33e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG038ControllerResponsiveSigning.java @@ -32,7 +32,7 @@ public class EG038ControllerResponsiveSigning extends AbstractEsignatureControll @Autowired public EG038ControllerResponsiveSigning(DSConfiguration config, Session session, User user) { - super(config, "eg038", "Use responsive signing"); + super(config, "eg038"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java index 28794095..dc149ba2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -32,7 +32,7 @@ public class EG039ControllerInPersonSigning extends AbstractEsignatureController @Autowired public EG039ControllerInPersonSigning(DSConfiguration config, Session session, User user) { - super(config, "eg039", "In-person signing"); + super(config, "eg039"); this.session = session; this.user = user; } diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index f4ecd579..4d1ad6cd 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -17,8 +17,8 @@ public abstract class AbstractMonitorController extends AbstractController { private static final String EXAMPLE_PAGES_PATH = "pages/monitor/examples/"; - public AbstractMonitorController(DSConfiguration config, String exampleName, String title) { - super(config, exampleName, title); + public AbstractMonitorController(DSConfiguration config, String exampleName) { + super(config, exampleName); } protected String getExamplePagesPath() { diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 03873f7e..6cf7b8f4 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -27,7 +27,7 @@ public class M001GetMonitoringData extends AbstractMonitorController { @Autowired public M001GetMonitoringData(DSConfiguration config, Session session, User user) { - super(config, "m001", "Monitoring data result"); + super(config, "m001"); this.session = session; this.user = user; } @@ -47,8 +47,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String monitoringDataCleaned = monitoringData.toString().replaceAll("'", ""); // Process results - DoneExample.createDefault(title) - .withMessage("Results from DataSet:getStream method:") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(monitoringDataCleaned) .addToModel(model); diff --git a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java index 787a4f8a..32cec6af 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java @@ -34,7 +34,7 @@ public class M002WebQueryEndpoint extends AbstractMonitorController { @Autowired public M002WebQueryEndpoint(DSConfiguration config, Session session, User user) { - super(config, "m002", "Query monitoring data with filters"); + super(config, "m002"); this.session = session; this.user = user; } @@ -71,8 +71,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String queryResultCleaned = queryResult.toString().replaceAll("'", ""); // Process results - DoneExample.createDefault(title) - .withMessage("Results from DataSet:postWebQuery method:") + DoneExample.createDefault(this.codeExampleText.ResultsPageHeader) + .withMessage(this.codeExampleText.ResultsPageText) .withJsonObject(queryResultCleaned) .addToModel(model); diff --git a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java index 74c8b4d1..66b3aa08 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java +++ b/src/main/java/com/docusign/controller/rooms/examples/AbstractRoomsController.java @@ -24,8 +24,8 @@ public abstract class AbstractRoomsController extends AbstractController { private static final String EXAMPLE_PAGES_PATH = "pages/rooms/examples/"; - public AbstractRoomsController(DSConfiguration config, String exampleName, String title) { - super(config, exampleName, title); + public AbstractRoomsController(DSConfiguration config, String exampleName) { + super(config, exampleName); } protected String getExamplePagesPath() { diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index 1bb05e9d..3084a071 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -31,7 +31,7 @@ public class R001ControllerCreateRoom extends AbstractRoomsController { @Autowired public R001ControllerCreateRoom(DSConfiguration config, Session session, User user) { - super(config, "r001", "Create a room"); + super(config, "r001"); this.session = session; this.user = user; } @@ -55,7 +55,9 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(createdRoom) - .withMessage("The room has been created!
    Room ID " + createdRoom.getRoomId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", createdRoom.getRoomId().toString()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 2d5931cd..b51a8ff9 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -34,7 +34,7 @@ public class R002ControllerCreateRoomWithTemplate extends AbstractRoomsControlle @Autowired public R002ControllerCreateRoomWithTemplate(DSConfiguration config, Session session, User user) { - super(config, "r002", "Create a room with template"); + super(config, "r002"); this.session = session; this.user = user; } @@ -74,7 +74,9 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(createdRoom) - .withMessage("The room has been created!
    Room ID " + createdRoom.getRoomId() + ".") + .withMessage(this.codeExampleText.ResultsPageText + .replaceFirst("\\{0}", createdRoom.getRoomId().toString()) + ) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index 30e35f7f..ee3d5612 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -32,7 +32,7 @@ public class R003ControllerExportingDataFromRoom extends AbstractRoomsController @Autowired public R003ControllerExportingDataFromRoom(DSConfiguration config, Session session, User user) { - super(config, "r003", "Exporting data from a room"); + super(config, "r003"); this.session = session; this.user = user; } @@ -61,7 +61,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(fieldData) - .withMessage("The room data has been exported!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 61e24951..4e1ae4da 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -36,7 +36,7 @@ public class R004ControllerAddingFormsToRoom extends AbstractRoomsController { @Autowired public R004ControllerAddingFormsToRoom(DSConfiguration config, Session session, User user) { - super(config, "r004", "Adding forms to a room"); + super(config, "r004"); this.session = session; this.user = user; } @@ -72,7 +72,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(roomDocument) - .withMessage("The form has been added to the room!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index f81031ac..74447f36 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -37,7 +37,7 @@ public class R005ControllerGetRoomsWithFilters extends AbstractRoomsController { @Autowired public R005ControllerGetRoomsWithFilters(DSConfiguration config, Session session, User user) { - super(config, "r005", "Get Rooms with filters"); + super(config, "r005"); this.session = session; this.user = user; } @@ -70,7 +70,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(rooms) - .withMessage("Rooms has been filtered and returned!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index a6d111b2..accffe42 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -37,7 +37,7 @@ public class R006ControllerCreateExternalFormFillSession extends AbstractRoomsCo @Autowired public R006ControllerCreateExternalFormFillSession(DSConfiguration config, Session session, User user) { - super(config, "r006", "Creating an external form fill session"); + super(config, "r006"); this.session = session; this.user = user; } @@ -76,7 +76,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(externalFormFillSession) - .withMessage("An external form fill session has been added!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 41ac71b0..8f5e398f 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -29,7 +29,7 @@ public class R007ControllerCreateFormGroup extends AbstractRoomsController { @Autowired public R007ControllerCreateFormGroup(DSConfiguration config, Session session, User user) { - super(config, "r007", "Creating create a form group"); + super(config, "r007"); this.session = session; this.user = user; } @@ -50,7 +50,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(formGroup) - .withMessage("A form group has been created!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index 0b9651d6..93850db4 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -34,7 +34,7 @@ public class R008ControllerGrantOfficeAccessToFormGroup extends AbstractRoomsCon @Autowired public R008ControllerGrantOfficeAccessToFormGroup(DSConfiguration config, Session session, User user) { - super(config, "r008", "Granting office access to a form group"); + super(config, "r008"); this.session = session; this.user = user; } @@ -75,7 +75,7 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 5 End DoneExample.createDefault(this.title) - .withMessage("Office has been granted access to a form group!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); } catch (ApiException apiException) { if (!apiException.getMessage().contains(OFFICE_ALREADY_HAS_ACCESS_TO_FORM_GROUP_ERROR_MESSAGE)) { diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 8272d769..8dc70295 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -37,7 +37,7 @@ public class R009ControllerAssignFormToFormGroup extends AbstractRoomsController @Autowired public R009ControllerAssignFormToFormGroup(DSConfiguration config, Session session, User user) { - super(config, "r009", "Assigning a form to a form group"); + super(config, "r009"); this.session = session; this.user = user; } @@ -78,7 +78,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(formGroupFormToAssign) - .withMessage("A form has been assigned to a form group!") + .withMessage(this.codeExampleText.ResultsPageText) .addToModel(model); } catch (ApiException apiException) { if (!apiException.getMessage().contains(FORM_ALREADY_EXISTS_ERROR_MESSAGE)) { diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index cf59e5fc..ccaddd08 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -5,6 +5,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; +import com.docusign.core.model.manifestModels.CodeExampleText; import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.oauth2.client.OAuth2ClientContext; @@ -42,6 +43,8 @@ public abstract class AbstractController { protected static final String EXAMPLE_PENDING_PAGE = "pages/example_pending"; protected static final String ERROR_PAGE = "error"; + private static final String EXAMPLE_TEXT = "example"; + @Autowired private OAuth2ClientContext oAuth2ClientContext; @@ -49,15 +52,15 @@ public abstract class AbstractController { protected Session session; protected final String exampleName; - protected final String title; + protected CodeExampleText codeExampleText; + protected String title; private final String pagePath; protected final DSConfiguration config; - public AbstractController(DSConfiguration config, String exampleName, String title) { + public AbstractController(DSConfiguration config, String exampleName) { this.config = config; this.exampleName = exampleName; this.pagePath = this.getExamplePagesPath() + exampleName; - this.title = title; } protected abstract String getExamplePagesPath(); @@ -105,6 +108,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception model.addAttribute("sourceFile", clazz.getSimpleName() + ".java"); model.addAttribute("sourceUrl", srcPath); model.addAttribute("documentation", config.getDocumentationPath() + exampleName); + + this.codeExampleText = GetExampleText(); + this.title = this.codeExampleText.PageTitle; + model.addAttribute(EXAMPLE_TEXT, this.codeExampleText); } /** @@ -138,4 +145,25 @@ private boolean isTokenExpired() { session.setRefreshToken(tokenExpired); return tokenExpired; } + + + protected CodeExampleText GetExampleText() { + var groups = config.getCodeExamplesText().Groups; + var exampleNumberToSearch = Integer.parseInt(this.exampleName.replaceAll("\\D+", "")); + + for(var i = 0; i < groups.size(); ++i) + { + CodeExampleText codeExampleText = (CodeExampleText) Arrays + .stream(groups.get(i).Examples.toArray()) + .filter(x -> ((CodeExampleText) x).ExampleNumber == exampleNumberToSearch) + .findFirst() + .orElse(null); + + if (codeExampleText != null) + { + return codeExampleText; + } + } + return null; + } } diff --git a/src/main/java/com/docusign/core/controller/IndexController.java b/src/main/java/com/docusign/core/controller/IndexController.java index 453d46fc..c4fb8757 100644 --- a/src/main/java/com/docusign/core/controller/IndexController.java +++ b/src/main/java/com/docusign/core/controller/IndexController.java @@ -44,6 +44,7 @@ public class IndexController { private static final String ATTR_STATE = "state"; private static final String ATTR_EVENT = "event"; private static final String ATTR_TITLE = "title"; + private static final String LAUNCHER_TEXTS = "launcherTexts"; @Autowired private Session session; @@ -69,6 +70,7 @@ public String index(ModelMap model, HttpServletResponse response) throws IOExcep return null; } + model.addAttribute(LAUNCHER_TEXTS, config.getCodeExamplesText().Groups.toArray()); return session.getApiIndexPath(); } diff --git a/src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java b/src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java index ebc44f12..66c411e3 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java +++ b/src/main/java/com/docusign/core/model/manifestModels/AdditionalPage.java @@ -3,6 +3,8 @@ import lombok.Getter; import lombok.Setter; +@Getter +@Setter public class AdditionalPage { public String Name; diff --git a/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java b/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java index 72963f07..c1e5f42d 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java +++ b/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java @@ -6,6 +6,8 @@ import java.util.ArrayList; import java.util.List; +@Getter +@Setter public class CodeExampleText { public int ExampleNumber; diff --git a/src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java b/src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java index 1e7311a1..93d905fb 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java +++ b/src/main/java/com/docusign/core/model/manifestModels/LinkToAPIMethods.java @@ -3,6 +3,8 @@ import lombok.Getter; import lombok.Setter; +@Getter +@Setter public class LinkToAPIMethods { public String Path; diff --git a/src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java b/src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java index 7e5392d4..b09bc3ed 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java +++ b/src/main/java/com/docusign/core/model/manifestModels/ManifestGroup.java @@ -6,6 +6,8 @@ import java.util.ArrayList; import java.util.List; +@Getter +@Setter public class ManifestGroup { public List Examples = new ArrayList<>(); diff --git a/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java b/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java index 6e3403bc..3e782042 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java +++ b/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java @@ -6,6 +6,8 @@ import java.util.ArrayList; import java.util.List; +@Getter +@Setter public class ManifestStructure { public List Groups = new ArrayList(); } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp index 5195395a..130ef88e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a001.jsp @@ -1,22 +1,14 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    1. Create a new active eSignature user

    -

    Demonstrates how to create a new eSignature user and activate their account automatically.

    +

    1. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - AccountPermissionProfiles:list. - Groups:list. - eSignUserManagement:createUser. - -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp index 18e9e4f8..49e3a937 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp @@ -1,9 +1,8 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    2. Create a new active user for CLM and eSignature

    -

    Demonstrates how to create a new DocuSign user (valid for both CLM and eSignature) and activate their account - automatically.

    +

    2. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example. @@ -11,14 +10,7 @@ -

    API methods used: - MultiProductUserManagement:getProductPermissionProfiles, - MultiProductUserManagement:getDsGroups, - MultiProductUserManagement:addOrUpdateUser. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp index 6e3c76fb..ea7e43d0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp @@ -1,19 +1,14 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    3. Bulk export user data

    -

    Demonstrates how to bulk export user accounts within an organization into a CSV (comma separated value) file.

    +

    3. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - UserExport:createUserListExport, -UserExport:getUserListExport. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp index 74178f56..55194b42 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp @@ -1,17 +1,14 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    3a. Check request status

    -

    Check the status of your pending request and, if complete, obtain a URL that you can call to download the CSV file containing the export data.

    +

    3a. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - UserExport:getUserListExport. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp index b6e3362f..f6408e10 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp @@ -1,18 +1,13 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    4. Add users via bulk import

    -

    Demonstrates how to bulk import users and add user data from an example CSV (comma-separated value) file into a DocuSign Admin organization.

    +

    4. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - UserImport:addBulkUserImport, -UserImport:getBulkUserImportRequest. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp index d2d5a833..fe58cbac 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp @@ -1,17 +1,14 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    4a. Check request status

    -

    Check the status of your pending request and, if complete, obtain a URL that you can call to download the CSV file containing the data to verify that the updates were made.

    +

    4a. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - UserImport :getBulkUserImportRequest. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp index d6077b2d..f3e767c7 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp @@ -2,20 +2,15 @@ -

    5. Audit users

    -

    - Demonstrates how to audit the users in your account by retrieving the profiles of users that were modified after a specified date. -

    +

    5. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Users:getUsers, - eSignUserManagement:getUserProfiles. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp index b230b058..a7811a52 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp @@ -1,18 +1,13 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    6. Retrieve the user's DocuSign profile using an email address

    -

    Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's email address.

    - +

    6. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    - API method used: - MultiProductUserManagement:getUserDSProfilesByEmail. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp index 145f4187..15e27aba 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp @@ -1,20 +1,14 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    7. Retrieve the user's DocuSign profile using a User ID

    -

    - Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's User ID. -

    +

    7. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    - API method used: - MultiProductUserManagement:getUserDSProfile. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp index 45217ebc..c3606375 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp @@ -2,21 +2,14 @@ -

    8. Update user product permission profiles using an email address

    -

    Demonstrates how to update user product permission profiles. There may only be one permission profile assigned to a user per product.

    - +

    8. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    - API methods used: - MultiProductUserManagement:getProductPermissionProfiles, - MultiProductUserManagement:addUserProductPermissionProfilesByEmail. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp index d43f17c8..557e6229 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp @@ -2,23 +2,14 @@ -

    9. Delete user product permission profiles using an email address

    -

    - Demonstrates how to list and delete DocuSign Admin user product permission profiles. -

    - +

    9. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    - API methods used: - MultiProductUserManagement:getUserProductPermissionProfilesByEmail, - MultiProductUserManagement:removeUserProductPermission. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp index 3141850a..a913b7d4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp @@ -25,135 +25,49 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    - -

    Admin API Code Examples

    -

    1. Create a new active eSignature user

    -

    - Demonstrates how to create a new eSignature user and activate their account automatically. -

    -

    - API methods used: - AccountPermissionProfiles:list, - Groups:list, - eSignUserManagement:createUser -

    -

    2. Create a new active user for CLM and eSignature

    -

    - Demonstrates how to create a new DocuSign user (valid for both CLM and eSignature) and activate their account automatically. -

    -

    - API methods used: - MultiProductUserManagement:getProductPermissionProfiles, - MultiProductUserManagement:getDsGroups, - MultiProductUserManagement:addOrUpdateUser -

    - - - -

    3. Bulk export user data

    -

    - Demonstrates how to bulk export user accounts within an organization into a CSV (comma-separated value) file. -

    -

    - API methods used: - UserExport:createUserListExport, - UserExport:getUserListExport -

    - - - -

    4. Add users via bulk import

    -

    - Demonstrates how to bulk import users and add user data from an example CSV (comma-separated value) file into a DocuSign Admin organization. -

    -

    - API methods used: - UserImport:addBulkUserImport, - UserImport:getBulkUserImportRequest -

    - - - - -

    5. Audit users

    -

    - Demonstrates how to audit the users in your account by retrieving the profiles of users that were modified after a specified date. -

    -

    - API methods used: - Users:getUsers, - eSignUserManagement:getUserProfiles -

    - -

    6. Retrieve the user's DocuSign profile using an email address

    -

    - Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's email address. -

    -

    - API method used: - MultiProductUserManagement:getUserDSProfilesByEmail -

    - -

    7. Retrieve the user's DocuSign profile using a User ID

    -

    Demonstrates how to obtain the user's DocuSign profile information across all DocuSign accounts by specifying the user's User ID.

    -

    - API method used: - MultiProductUserManagement:getUserDSProfile -

    - -

    8. Update user product permission profiles using an email address

    -

    Demonstrates how to update user product permission profiles. There may only be one permission profile assigned to a user per product.

    -

    - API methods used: - MultiProductUserManagement:getProductPermissionProfiles, - MultiProductUserManagement:addUserProductPermissionProfilesByEmail -

    - -

    9. Delete user product permission profiles using an email address

    -

    Demonstrates how to list and delete DocuSign Admin user product permission profiles.

    -

    - API methods used: - MultiProductUserManagement:getUserProductPermissionProfilesByEmail, - MultiProductUserManagement:removeUserProductPermission -

    + +

    ${group.getName()}

    + + +

    + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    + +

    + + + API method used: + + + API methods used: + + + + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index 93f85f40..00b1c534 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -1,14 +1,9 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    1. Create a clickwrap.

    - -

    - Creates a clickwrap that you can embed in your website or app. -

    -

    API method used: - ClickWraps:createClickwrap. -

    +

    1. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index 52b76963..ea6acb44 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -1,15 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Activate a clickwrap.

    +

    2. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    - Activates a new clickwrap that you have already created. By default, new clickwraps are - inactive. You must activate your clickwrap before you can use it. -

    -

    API method used: - ClickWraps:updateClickwrapVersion. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 00d04f36..2e938311 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -1,18 +1,9 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    3. Create a new clickwrap version.

    - -

    - Creates a new version of a clickwrap. -

    -

    - You can specify whether you require users who have previously accepted the clickwrap - to accept the new version when they return to your website. -

    -

    API method used: - ClickWraps:createClickwrapVersion -

    +

    3. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index c88e070a..f89ed792 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -1,14 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    4. Get a list of clickwraps.

    +

    4. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    - Gets a list of clickwraps associated with a specific DocuSign user. -

    -

    API method used: - ClickWraps:getClickwraps -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index edefb9fa..cd53b293 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -1,14 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    5. Get clickwrap responses.

    +

    5. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    - Gets user responses to your clickwrap agreements. -

    -

    API method used: - ClickWraps:getClickwrapAgreements -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index e5ac4ffc..f683113f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -25,41 +25,48 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Click examples

    -

    1. Create a clickwrap

    -

    Creates a clickwrap that you can embed in your website or app. -

    -

    API method used: - ClickWraps:createClickwrap. -

    + +

    ${group.getName()}

    -

    2. Activate a clickwrap

    -

    Activates a new clickwrap that you have already created. -

    -

    API method used: - ClickWraps:updateClickwrapVersion -

    + +

    + + ${example.getExampleName()} + +

    -

    3. Create a new clickwrap version

    -

    Creates a new version of a clickwrap. -

    -

    API method used: - ClickWraps:createClickwrapVersion -

    +

    ${example.getExampleDescription()}

    -

    4. Get a list of clickwraps

    -

    Gets a list of clickwraps associated with a specific DocuSign user. -

    -

    API method used: - ClickWraps:getClickwraps -

    +

    + + + API method used: + + + API methods used: + + -

    5. Get clickwrap responses

    -

    Gets user responses to your clickwrap agreements. -

    -

    API method used: - ClickWraps:getClickwrapAgreements -

    + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp index c92d6906..8a69913e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp @@ -1,21 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Embedded Signing

    -

    This example sends an envelope, and then uses Embedded signing for the first signer.

    -

    Embedded signing provides a smoother user experience for the signer: DocuSign signing is initiated from - your website.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    + -

    API methods used: - Envelopes::create - and - EnvelopeViews::createRecipient. -

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp index 52372d19..db13a6ac 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp @@ -1,20 +1,13 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with a remote (email) signer and cc recipient

    -

    The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    -

    This is a general example of creating and sending an envelope (a signing request) to multiple recipients, - with multiple documents, and with signature fields for the documents.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp index 1b86f5ee..940ed4cb 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp @@ -1,18 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    List envelopes in the user's account

    -

    List the envelopes created in the last 30 days.

    -

    This example demonstrates how to query DocuSign about envelopes sent by the current user.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::listStatusChanges. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index 27febcc2..4406b527 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -1,25 +1,15 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Get an envelope's basic information and status

    -

    List the basic information about an envelope, including its overall status. - Additional API/SDK methods may be used to get additional information about the - envelope, its documents, recipients, etc.

    - -

    This example demonstrates how to obtain the latest information about - an envelope from DocuSign. Often an alternative is to use Connect - to enable DocuSign to proactively send your application updates when the - status of an envelope changes. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::get. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index dfefbabc..80d78b19 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -1,18 +1,15 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    List an envelope's recipients and their status

    -

    List the envelope's recipients, including their current status.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - EnvelopeRecipients::list. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index 35dce7a4..134ebb69 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -1,21 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    List an envelope's documents

    -

    List the envelope's documents. A Certificate of Completion document - is also associated with every envelope. -

    - -

    This method is often used to dynamically create a list of an envelope's documents - in preparation for enabling your user to download one or more of the documents.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - EnvelopeDocuments::list. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index 14e0d54d..3b5b8202 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -1,27 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Download a document from an envelope

    -

    An envelope's documents can be downloaded one by one or as a complete set.

    -

    Document download options:

    -
      -
    • Combined: a PDF with the combined content of all documents and the - certificate -
    • -
    • Zip Archive: a ZIP archive that contains all of the PDF documents, - the certificate, and any .WAV files used for voice authentication. -
    • -
    • The envelope's individual documents
    • -
    • The envelope's Certificate of Completion
    • -
    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - EnvelopeDocuments::get. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp index cd378762..36c6599c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp @@ -1,26 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Create a template

    -

    Create a template with two roles, signer and cc. - The template includes three documents. -

    - -

    Templates are usually created using the DocuSign web tool. This example creates - a template that will later be used by other examples in this launcher.

    - -

    This example first lists the user's templates and only creates a new template if one does not already exist in your - account. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Templates::list, - Templates::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index 7a87b97a..c47c10d9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -1,24 +1,15 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope using a template

    -

    The envelope is defined by the template. - The signer and cc recipient name and email are used to fill in the template's roles.

    - -

    This example demonstrates a common pattern for DocuSign integrations: envelopes will - be sent programmatically, based on a template. If the template definition needs to be - updated, the DocuSign web tool can be used to easily update the template, thus - avoiding the need to make software changes. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp index 231a1e89..52e89dd4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp @@ -1,22 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope using binary document transfer

    -

    The envelope includes a pdf, Word, and HTML document.

    -

    Multipart data transfer is used to send the documents in binary format to DocuSign. - Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. -

    - -

    Since binary transfer is not yet supported by the SDK, this example uses the API directly and - demonstrates how to do so.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 0838a729..a02f77ef 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -1,28 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Use embedded sending

    -

    An envelope will be created in draft mode. Your browser will then be redirected to - the DocuSign web tool where the envelope can be (optionally) updated and then sent.

    -

    The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents.

    -

    DocuSign recommends that you enhance your application as needed to avoid the need - for the embedded sender view. -

    -

    For example, if the sender view is used to optionally - add additional documents to the envelope, enhance your app to provide the - needed feature (see example 13 for adding additional documents programmatically). -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createSender. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index d18d232d..d1b79c26 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -1,25 +1,15 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Embedded DocuSign web tool

    -

    Redirect the user to the DocuSign web tool.

    -

    Use this API call to open the DocuSign web tool, the NDSE (New DocuSign Signing Experience), - with the user already logged in.

    -

    The starting view can be either an envelope's documents or the web tool's front page.

    -

    The user does not necessarily return from the NDSE, so using this API call is often a final - step for your application. - Or you can open the NDSE in a new tab for the user. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - EnvelopeViews::createConsole. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index d4c31fe8..2dcb61a3 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -1,21 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Use embedded signing from a template with an added document

    +

    ${example.getExampleName()}

    + -

    This example sends an envelope based on a template.

    -

    In addition to the template's document(s), the example adds an - additional document to the envelope by using the - Composite - Templates - feature.

    -

    In this example, the additional document is an HTML document that - includes order details with information from the form below.

    -

    This example then enables you to sign the envelope using embedded signing.

    -

    Embedded signing provides a smoother user experience for a signer who is - already logged into your web application since the DocuSign - signing is initiated from your website.

    +

    ${example.getExampleDescriptionExtended()}

    @@ -23,12 +12,7 @@ -

    API methods used: - Envelopes::create - and - EnvelopeViews::createRecipient. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp index 03483d7f..f34c77d7 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp @@ -1,26 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with an order form, including a payment field.

    - -
    Note: This example will only work if the sender's DocuSign account - is set up with a DocuSign payment gateway. Since the Payment Gateway ID - is set in the configuration file, you will need to run your - own instance of this project to set it. -
    - -

    Anchor strings - (AutoPlace) - are used to position the fields in the documents. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp index 2f10b8b6..f4a0c941 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp @@ -1,15 +1,8 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Get the tab data from an envelope.

    - -

    Get the tab (field) values from an envelope for all of the envelope's recipients.

    - -

    - This method is used to read the updated tab values from - the envelope. The method can be used after the envelope is complete or while it is - still in progress. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    @@ -17,10 +10,7 @@

    Documentation about this example.

    -

    - API method used: - EnvelopeFormData::get. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp index 340667ed..d94b2683 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp @@ -1,13 +1,8 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Set tab values for an envelope.

    - -

    - This example creates an example with both read-only tabs (fields) and tabs that can - be updated by the recipient. -

    -

    The example also sets custom metadata in the envelope via the envelope custom fields feature.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    @@ -15,10 +10,7 @@

    Documentation about this example.

    -

    - API method used: - EnvelopeFormData::get. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index 86e31a87..22a204e0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -2,20 +2,14 @@ -

    Set template tab values

    -

    - This example sets the value of a template's tabs. It includes setting - radio button and checkbox tabs. -

    -

    The example also sets custom metadata in the envelope via the envelope custom fields feature.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index d89ffcbe..6109c735 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -1,28 +1,15 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Get the custom field data for an envelope

    -

    - Get the data values associated with the envelope itself. The custom data fields enable you to - add additional meta-data to the envelope. The custom data fields can be set by the Sender - via the DocuSign web tool, or can be set programmatically. The data can be included in the - envelope's certificate of completion. -

    - -

    - This method is used to read the custom field values from - an envelope. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    - API method used: - EnvelopeCustomFields::list. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp index 851d5553..1a789b24 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp @@ -1,24 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with a recipient using Access Code Authentication.

    - -

    - The envelope includes a pdf document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    -

    - This is a general example of creating and sending an envelope (a signing request) using An Access Code for Recipient Authentication. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp index 36b24f9c..40dac1ee 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp @@ -1,19 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Require Phone Authentication for a Recipient

    -

    Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

    -

    The envelope includes a PDF file. Anchor text - (AutoPlace) - is used to position the signing fields in the documents.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp index 320aa574..f10d887a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp @@ -1,15 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with a recipient using Knowledge-Based Authentication.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp index 468ca7ed..56caaf9b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp @@ -1,25 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Requiring Id Verification for a Recipient

    - -

    - The envelope includes a pdf document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    -

    - This is a general example of creating and sending an envelope (a signing request) using ID Verification for Recipient Authentication. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    - API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp index c2a387af..85da155c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp @@ -1,21 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    -Permission profiles are collections of account settings that determine the behavior and actions -available to the user groups to which they're applied. This code example demonstrates how to -create a permission profile with the eSignature REST API. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - AccountPermissionProfiles::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp index cc8c0b73..9c99989a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp @@ -1,21 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    - Permission profiles are collections of account settings that determine the behavior and actions - available to the user groups to which they're applied. This code example demonstrates how to - the permission profile for the group with the eSignature REST API. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Groups::update. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp index 6e8e0b18..3cf49a5c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp @@ -1,20 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    -This code example demonstrates how to edit individual permission settings on a permissions profile -with the eSignature REST API. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - AccountPermissionProfiles::update. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp index 5dd3c4db..5c833cce 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg027.jsp @@ -1,21 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    - Permission profiles are collections of account settings that determine the behavior and actions - available to the user groups to which they're applied. This code example demonstrates how to - delete a permission profile with the eSignature REST API. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - AccountPermissionProfiles::delete. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp index bd32c635..5e4e453e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg028.jsp @@ -1,25 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Creating a brand.

    - -

    - The brand includes a Brand Name Configure Brands. -

    -

    - DocuSign enables you to customize the eSignature sending and signing experience with your own - branding elements-logo, colors, and more-stored as a collection of settings called a brand in - your DocuSign account. This code example demonstrates how to create a brand with the - eSignature REST API that you subsequently apply to a DocuSign envelope. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - AccountBrands::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp index fb007f7d..9cd23961 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg029.jsp @@ -1,18 +1,8 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -

    Applying a brand to an envelope

    -

    - The envelope includes a pdf document. Anchor text (AutoPlace) - is used to position the signing fields in the documents. -

    -

    - DocuSign enables you to customize the eSignature sending and signing experience with your own - branding elements-logo, colors, and more-stored as a collection of settings called a brand in - your DocuSign account. This code example demonstrates how to create a brand with the eSignature - REST API that you subsequently apply to a DocuSign envelope. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about @@ -21,10 +11,7 @@ -

    - API method used: Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp index 2fc9dbc1..d755345f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg030.jsp @@ -1,19 +1,8 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> -

    Applying a brand to a template

    -

    This code example demonstrates how to apply a brand to an template.

    -

    - The envelope is defined by the template. The signer and cc recipient - name and email are used to fill in the template's roles. -

    - -

    - This example demonstrates a common pattern for DocuSign integrations: envelopes will be sent - programmatically, based on a template. If the template definition needs to be updated, the - DocuSign web tool can be used to easily update the template, thus avoiding the need to make - software changes. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example. @@ -21,10 +10,7 @@ -

    - API method used: Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp index c0b2171c..1f1d8aeb 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg031.jsp @@ -1,25 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    - Demonstrates how to send envelopes in bulk to multiple recipients. First, this example - creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk - envelope sending. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - BulkSend::createBulkSendList, - Envelopes::create, - EnvelopeCustomFields::create, - BulkSend::createBulkSendRequest, - BulkSend::getBulkSendBatchStatus. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp index e4969bf8..89bf598e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg032.jsp @@ -1,23 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    - This topic demonstrates how to create an envelope where the workflow is paused before the - envelope is sent to a second recipient. For information on resuming a workflow see - - How to unpause a signature workflow - . The envelope includes a txt document. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp index a2b1538d..d0861e31 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg033.jsp @@ -1,23 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    - This topic demonstrates how to resume an envelope workflow that has been paused. - For information on creating an envelope with a paused workflow, see - - How to pause a signature workflow - . The envelope includes a txt document. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Envelopes::update. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp index 790ae380..1bcc3e93 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg034.jsp @@ -1,20 +1,13 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    - -

    - This topic demonstrates how to create an envelope where the workflow is routed to - different recipients based on the value of a transaction. The envelope includes a txt document. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    - -

    API methods used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp index 3c8442e0..e5ffa3c1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg035.jsp @@ -1,17 +1,15 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Schedule an envelope

    -

    Demonstrates how to schedule an envelope using the scheduled sending feature.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp index 26483adc..c0e81f3f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg036.jsp @@ -1,17 +1,15 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with delayed routing

    -

    Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp index 0c49c4ed..8d72d3c1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg037.jsp @@ -1,15 +1,13 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Request a signature by SMS delivery

    -

    Sends a signature request via an SMS message.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp index bead6ccd..1e92d803 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg038.jsp @@ -1,17 +1,14 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Create a signable HTML document

    -

    Demonstrates how to create an HTML document for responsive signing.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp index e6898f85..ee576d32 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg039.jsp @@ -1,18 +1,13 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope to an In Person Signer

    -

    - Demonstrates how to host an In Person Signing session with embedded signing. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Envelopes::create , - EnvelopeViews::createRecipient. -

    +

    View source file ${sourceFile} on GitHub. diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp index fa056187..654d6cf4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/quickEmbeddedSigning.jsp @@ -38,20 +38,13 @@

    -

    Use embedded signing

    -

    This example sends an envelope, and then uses embedded signing for the first signer.

    -

    Embedded signing provides a smoother user experience for the signer: the DocuSign signing is initiated from your website.

    - +

    ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API methods used: - Envelopes::create - and - EnvelopeViews::createRecipient. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index 58fd1b63..9348b9d6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -26,344 +26,51 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Basic examples

    - -

    Use embedded signing

    -

    This example sends an envelope, and then uses embedded signing for the first signer. - With embedded signing, the DocuSign signing is initiated from your website. -

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    - -

    Send an envelope with a remote (email) signer and cc recipient

    -

    The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    -

    API method used: - Envelopes::create. -

    - -

    List envelopes in the user's account

    -

    List the envelopes created in the last 30 days. -

    -

    API method used: - Envelopes::listStatusChanges. -

    - -

    Get an envelope's basic information and status

    -

    List the basic information about an envelope, including its overall status. - Additional API/SDK methods may be used to get additional information about the - envelope, its documents, recipients, etc. -

    -

    API method used: - Envelopes::get. -

    - -

    List an envelope's recipients and their status

    -

    List the envelope's recipients, including their current status. -

    -

    API method used: - EnvelopeRecipients::list. -

    - -

    List an envelope's documents

    -

    List the envelope's documents. A Certificate of Completion document - is also associated with every envelope. -

    -

    API method used: - EnvelopeDocuments::list. -

    - -

    Download a document from an envelope

    -

    An envelope's documents can be downloaded one by one or as a complete set. -

    -

    API method used: - EnvelopeDocuments::get. -

    - -

    Create a template

    -

    Create a template with two roles, signer and cc.

    -

    API methods used: - Templates::list, - Templates::create. -

    - -

    Send an envelope using a template

    -

    The envelope is defined by the template. - The signer and cc recipient name and email are used to fill in the template's roles.

    -

    API method used: - Envelopes::create. -

    - -

    Send an envelope using binary document transfer

    -

    The envelope includes a pdf, Word, and HTML document.

    -

    Multipart data transfer is used to send the documents in binary format to DocuSign. - Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. - Binary transfer is not yet supported by the SDK. -

    -

    API method used: - Envelopes::create. -

    - -

    Use embedded sending

    -

    An envelope will be created in draft mode. The DocuSign - web tool (NDSE) will then be shown, enabling further updates - to the envelope before it is sent. -

    -

    API methods used: - Envelopes::create, - EnvelopeViews::createSender. - -

    Embedded DocuSign web tool

    -

    Redirect the user to the DocuSign web tool.

    -

    API method used: - EnvelopeViews::createConsole. -

    - -

    Use embedded signing from a template with an added document

    -

    This example sends an envelope based on a template.

    -

    In addition to the template's document(s), the example adds an - additional document to the envelope by using the - Composite Templates - feature.

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    -

    Send an envelope to an In Person Signer

    -

    - Demonstrates how to host an In Person Signing session with embedded signing. -

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    - -

    Payments

    - -

    Send an envelope with an order form and payment field

    -

    Anchor text - (AutoPlace) - is used to position the fields in the documents. -

    -

    API method used: - Envelopes::create. -

    - -

    Tabs

    - -

    Get the tab data from an envelope

    -

    This example retrieves the tab (field) values from an envelope.

    -

    - API method used: - EnvelopeFormData::get. -

    - -

    Set tab values for an envelope

    -

    This example sets the tab (field) values for an envelope including tabs that can and cannot be changed by the signer.

    -

    - API method used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    - -

    Set template tab values

    -

    This example sets the tab (field) values for a template being used by an envelope.

    -

    - API method used: - Envelopes::create and - EnvelopeViews::createRecipient. -

    - -

    List envelope custom metadata field values

    -

    This example lists the envelope's custom metadata field values.

    -

    - API method used: - EnvelopeCustomFields::list. -

    - -

    Recipient authentication

    - -

    Require access code authentication for a recipient

    -

    Sends an envelope that requires entering an access code for the purpose of multifactor authentication.

    -

    API method used: - Envelopes::create. -

    - -

    Require phone authentication for a recipient

    -

    Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

    -

    API method used: - Envelopes::create. -

    - -

    Require knowledge-based authentication (KBA) for a recipient

    -

    Sends an envelope that requires passing a public records check to validate identity for the purpose of multifactor authentication.

    -

    API method used: - Envelopes::create. -

    - -

    Require ID verification (IDV) for a recipient

    -

    Sends an envelope that requires the recipient to upload a government-issued ID for the purpose of multifactor authentication.

    -

    - API method used: - Envelopes::create. -

    - -

    Permissions

    - -

    Create a new permission profile

    -

    - API method used: - AccountPermissionProfiles::create. -

    - -

    Setting a permission profile

    -

    This example allows you to set a permission profile on an existing user group.

    -

    API method used: - Groups::update. -

    - -

    Updating individual permission profile settings

    -

    - This example will update individual permission settings for a given account. -

    -

    - API method used: - AccountPermissionProfiles::update. -

    - -

    Deleting a permission profile

    -

    This example lists all available permissions profiles and allows you to delete any without associated users. Please note that you cannot remove "Everyone" nor "Administrator" permission profiles.

    -

    API method used: - AccountPermissionProfiles::create. -

    - -

    Brands

    - -

    Create a brand

    -

    This example will create an account brand that can be used to apply customization to your envelopes such as your own logo, colors, and text elements.

    -

    API method used: - AccountBrands::create. -

    - -

    Applying a brand to an envelope

    -

    This example will show you how to create an envelope using any of the created brands on your account.

    -

    API method used: - Envelopes::create. -

    - -

    Applying a brand to a template

    -

    This example will show you how to create an envelope using a brand

    -

    API method used: - Envelopes::create. -

    - -

    Bulk operations

    - -

    Bulk send envelopes

    - -

    - Demonstrates how to send envelopes in bulk to multiple recipients. First, this example - creates a bulk-send recipients list, then creates an envelope. After that, it initiates bulk - envelope sending. -

    -

    - API methods used: - BulkSend::createBulkSendList, - Envelopes::create, - EnvelopeCustomFields::create, - BulkSend::createBulkSendRequest, - BulkSend::getBulkSendBatchStatus. -

    - -

    Advanced recipient routing

    - -

    Pause a signature workflow

    - -

    - This topic demonstrates how to create an envelope where the workflow is paused before the - envelope is sent to a second recipient. For information on resuming a workflow see - - How to unpause a signature workflow - . -

    -

    - API methods used: - Envelopes::create. -

    - -

    Unpause a signature workflow

    - -

    - This topic demonstrates how to resume an envelope workflow that has been paused. - For information on creating an envelope with a paused workflow, see - - How to pause a signature workflow - . -

    -

    - API methods used: - Envelopes::update. -

    - -

    Use conditional recipients

    - -

    - This topic demonstrates how to create an envelope where the workflow is routed to - different recipients based on the value of a transaction. -

    -

    - API methods used: - Envelopes::create. -

    - -

    Schedule an envelope

    -

    - Demonstrates how to schedule an envelope using the scheduled sending feature. -

    -

    - API method used: - Envelopes::create. -

    - -

    Send an envelope with delayed routing

    -

    - Demonstrates how to delay an envelope's delivery between recipients using the delayed routing feature. -

    -

    - API method used: - Envelopes::create. -

    - -

    Premium features

    -

    Request a signature by SMS delivery

    -

    - Sends a signature requet via an SMS message. -

    -

    - API method used: - Envelopes::create. -

    - -

    Create a signable HTML document

    -

    - Demonstrates how to create an HTML document for responsive signing. -

    - API methods used: - Envelopes::create, - EnvelopeViews::createRecipient. -

    + +

    ${group.getName()}

    + + +

    + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    + +

    + + + API method used: + + + API methods used: + + + + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    - diff --git a/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp b/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp new file mode 100644 index 00000000..f08a8d95 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp @@ -0,0 +1,30 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +

    + + + API method used: + + + API methods used: + + + + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp index b2c43c60..d8d65a70 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp @@ -1,17 +1,14 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    1. Get monitoring data

    -

    Demonstrates how to get and display all of your organization's monitoring data.

    +

    1. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    Documentation about this example.

    -

    API method used: - DataSet:getStream. -

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp index 2a1448f3..f73d8a95 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp @@ -1,12 +1,9 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Query monitoring data with filters

    -

    Demonstrates how to query an organization's data based on specified filters and aggregations.

    -

    - API method used: - DataSet:postWebQuery. -

    +

    2. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    +

    View source file ${sourceFile} on GitHub.

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 43fe8181..4d021b7a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -22,21 +22,48 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Monitor API Code examples

    - -

    1. Get monitoring data

    -

    Demonstrates how to get and display all of your organization's monitoring data.

    -

    - API method used: - DataSet:getStream -

    - -

    2. Query monitoring data with filters

    -

    Demonstrates how to query an organization's data based on specified filters and aggregations.

    -

    - API method used: - DataSet:postWebQuery. -

    + +

    ${group.getName()}

    + + +

    + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    + +

    + + + API method used: + + + API methods used: + + + + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp index 74864924..f496fb9b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp @@ -1,14 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    1. Creating a room.

    +

    1. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates creating a DocuSign room.

    - -

    API methods used: - Roles::GetRoles and - Rooms::CreateRoom. -

    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp index 46a6ab6f..da58b28b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp @@ -1,19 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Creating a room with a template.

    +

    2. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates creating a DocuSign Room using a predefined template. - If you've created a template - for your organization in either Rooms for Mortgage or Rooms for Real Estate, - you can create rooms based on this template using the Rooms API. -

    - -

    API method used: - RoomTemplates::GetRoomTemplates, - Roles::GetRoles and - Rooms::CreateRoom. -

    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp index 67d9a110..af8ae856 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp @@ -1,15 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    3. Exporting data from a room.

    +

    3. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates how to export rooms data from a DocuSign Room. -

    - -

    API method used: - Rooms::GetRooms and - Rooms::GetRoomFieldSet. -

    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp index 60e3aba0..4fad939e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp @@ -1,16 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    4. Adding forms to a room.

    +

    4. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates how to attach forms to a room using the Rooms API. -

    - -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraryForms and - Rooms::AddFormToRoom. -

    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp index 023655e0..51b7ea4a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp @@ -1,17 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    5. Get Rooms with filters.

    +

    5. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates how to return rooms filtered by your parameters using the - Rooms API. - This specific code example filters for all rooms that have had their field data, updated within - the date range, as shown on the Details tab in the UI. -

    - -

    API method used: - Rooms::GetRooms. -

    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp index dcf3323b..2c3cc259 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp @@ -1,21 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    6. Creating an external form fill session.

    +

    6. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    The DocuSign Rooms API offers developers the option to have users fill out forms without - logging in to the Rooms UI through the use of an external form fill session. - This example demonstrates how to create an external form fill session using the - Rooms API: - the result of this code example is the URL for the form fill session, which you can embed in - your integration or send to the user. -

    - -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraries and - ExternalFormFillSessions::CreateExternalFormFillSession, -

    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp index 34d3763a..81bb65e4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp @@ -1,13 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    7. Creating a form group.

    +

    7. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates creating a form group for your DocuSign Rooms for Real Estate account.

    - -

    API methods used: - FormGroups:CreateFormGroup. -

    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp index 48f9b54d..68843e3d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp @@ -1,19 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    8. Granting office access to a form group.

    +

    8. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates how to assign an office to - a form group - for your DocuSign Rooms for Real Estate account. Granting office access to a form group will - enable you to filter which form groups are available based on that office. -

    - -

    API method used: - FormGroups:GrantOfficeAccessToFormGroup, - FormGroups:GetFormGroups and - Offices:GetOffices. -

    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp index de6ad104..a51c65f3 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp @@ -1,21 +1,10 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    9. Assigning a form to a form group.

    +

    9. ${example.getExampleName()}

    +

    ${example.getExampleDescriptionExtended()}

    -

    This example demonstrates how to assign a form to - a form group - for your DocuSign Rooms for Real Estate account. As a prerequisite, ensure that you have - created a form group - and set the office ID on this form group - before proceeding. -

    - -

    API method used: - FormGroups:AssignFormGroupForm, - FormGroups:GetFormGroups and - FormLibraries::GetFormLibraryForms. -

    + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp index 4d3e40a6..81bc23de 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp @@ -27,102 +27,48 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Rooms examples

    + +

    ${group.getName()}

    -

    1. Creating a room with data

    -

    This example demonstrates creating a DocuSign room. -

    -

    API methods used: - Roles::GetRoles and - Rooms::CreateRoom. -

    + +

    + + ${example.getExampleName()} + +

    -

    2. Creating a room with a template

    -

    This example demonstrates creating a DocuSign Room using a predefined template. - If you've created a template - for your organization in either Rooms for Mortgage or Rooms for Real Estate, - you can create rooms based on this template using the Rooms API. -

    -

    API method used: - RoomTemplates::GetRoomTemplates, - Roles::GetRoles and - Rooms::CreateRoom. -

    +

    ${example.getExampleDescription()}

    -

    3. Exporting data from a room

    -

    This example demonstrates how to export rooms data from aDocuSign Room. -

    -

    API method used: - Rooms::GetRooms and - Rooms::GetRoomFieldSet. -

    +

    + + + API method used: + + + API methods used: + + -

    4. Adding forms to a room

    -

    This example demonstrates how to attach forms to a room using the Rooms API. -

    -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraryForms and - Rooms::AddFormToRoom. -

    + + + ${link.getPathName()} + -

    5. Get Rooms with filters

    -

    This example demonstrates how to return rooms filtered by your parameters using the - Rooms API. - This specific code example filters for all rooms that have had their field data, updated within - the last 10 days, as shown on the Details tab in the UI. -

    -

    API method used: - Rooms::GetRooms. -

    - -

    6. Creating an external form fill session

    -

    The DocuSign Rooms API offers developers the option to have users fill out forms without - logging in to the Rooms UI through the use of an external form fill session. - This example demonstrates how to create an external form fill session using the - Rooms API: - the result of this code example is the URL for the form fill session, which you can embed in - your integration or send to the user. -

    -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraries and - ExternalFormFillSessions::CreateExternalFormFillSession, -

    - -

    7. Creating a form group

    -

    This example demonstrates creating a form group for your DocuSign - Rooms for Real Estate account. -

    -

    API method used: - FormGroups:CreateFormGroup. -

    - -

    8. Granting office access to a form group

    -

    This example demonstrates how to assign an office to - a form group - for your DocuSign Rooms for Real Estate account. Granting office access to a form group will - enable you to filter which form groups are available based on that office. -

    -

    API method used: - FormGroups:GrantOfficeAccessToFormGroup, - FormGroups:GetFormGroups and - Offices:GetOffices. -

    - -

    9. Assigning a form to a form group

    -

    This example demonstrates how to assign a form to - a form group - for your DocuSign Rooms for Real Estate account. As a prerequisite, ensure that you have - created a form group - and set the office ID on this form group - before proceeding. -

    -

    API method used: - FormGroups:AssignFormGroupForm, - FormGroups:GetFormGroups and - FormLibraries::GetFormLibraryForms. -

    + + + . + + + and + + + , + + +
    +

    +
    +
    From 0265beb7be45167ccebdd9abeccbc77bf60de63e Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 16 Aug 2022 13:56:27 -0700 Subject: [PATCH 327/699] Adding PDF Portfolio option to eSig7 --- .../eSignature/examples/EG007ControllerEnvelopeGetDoc.java | 4 ++++ .../templates/views/pages/esignature/examples/eg007.jsp | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index 9a3a4277..889eb6d3 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -62,6 +62,8 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception OptionItem doc = new OptionItem(docInfo.getName(), docInfo.getDocumentId()); documentOptions.add(doc); } + OptionItem pdfp = new OptionItem("PDF Portfolio", "portfolio"); + documentOptions.add(pdfp); model.addAttribute(MODEL_DOCUMENT_OPTIONS, documentOptions); } @@ -86,6 +88,8 @@ protected Object doWork(WorkArguments args, ModelMap model, // Process results List envelopeDocuments = session.getEnvelopeDocuments(); + EnvelopeDocumentInfo pdfp = new EnvelopeDocumentInfo("PDF Portfolio", "content", "portfolio"); + envelopeDocuments.add(pdfp); EnvelopeDocumentInfo docItem = find(envelopeDocuments, documentId); String docName = docItem.getName(); diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index 39914969..a8a3b79e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -11,6 +11,9 @@
  • Zip Archive: a ZIP archive that contains all of the PDF documents, the certificate, and any .WAV files used for voice authentication.
  • +
  • + PDF Portfolio: Retrieves the envelope documents as a PDF portfolio +
  • The envelope's individual documents
  • The envelope's Certificate of Completion
  • @@ -30,7 +33,7 @@

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient..
    - You will then need to use example 6 to create the list of documents.
    + You will then need to use List an envelope's documents to create the list of documents.
    Thank you.

    @@ -39,7 +42,7 @@

    Problem: please first create a list of the envelope's documents using - example 6.
    + List an envelope's documents.
    Thank you.

    From 47d8379b7a73d6c19ef3a7cd5cccd68866b9f27b Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 17 Aug 2022 12:23:28 -0700 Subject: [PATCH 328/699] Fixing an issue found by Patrick --- .../examples/EG007ControllerEnvelopeGetDoc.java | 10 ++++++++-- .../views/pages/esignature/examples/eg007.jsp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java index 889eb6d3..dd29ca4d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG007ControllerEnvelopeGetDoc.java @@ -57,13 +57,19 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception return; } + boolean foundPdfp = false; ArrayList documentOptions = new ArrayList<>(); for (EnvelopeDocumentInfo docInfo : envelopeDocuments) { + if (docInfo.getName() == "PDF Portfolio") { + foundPdfp = true; + } OptionItem doc = new OptionItem(docInfo.getName(), docInfo.getDocumentId()); documentOptions.add(doc); } - OptionItem pdfp = new OptionItem("PDF Portfolio", "portfolio"); - documentOptions.add(pdfp); + if (! foundPdfp) { + OptionItem pdfp = new OptionItem("PDF Portfolio", "portfolio"); + documentOptions.add(pdfp); + } model.addAttribute(MODEL_DOCUMENT_OPTIONS, documentOptions); } diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index a8a3b79e..7edd25fb 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -58,7 +58,7 @@
    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp index 49e3a937..03edd751 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a002.jsp @@ -2,7 +2,7 @@

    2. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example. @@ -13,7 +13,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -66,7 +66,7 @@
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp index ea7e43d0..ef35411f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003.jsp @@ -2,7 +2,7 @@

    3. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,12 +10,12 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp index 974ffe2d..1b2bb89f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a003a.jsp @@ -2,7 +2,7 @@

    3a. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,7 +10,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -18,7 +18,7 @@

    Uses the export information that was received during previous step

    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp index f6408e10..4932f958 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004.jsp @@ -2,7 +2,7 @@

    4. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,12 +10,12 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp index fe58cbac..a86051c1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a004a.jsp @@ -2,7 +2,7 @@

    4a. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,7 +10,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -18,7 +18,7 @@

    Uses the import information that was received during previous step

    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp index f3e767c7..c2e8cc10 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a005.jsp @@ -3,7 +3,7 @@

    5. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    @@ -13,12 +13,12 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp index a7811a52..b4f0f214 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a006.jsp @@ -2,7 +2,7 @@

    6. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,7 +10,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -21,6 +21,6 @@
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp index 15e27aba..59fc17e5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a007.jsp @@ -2,7 +2,7 @@

    7. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -23,6 +23,6 @@
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp index c3606375..b31e1345 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a008.jsp @@ -3,7 +3,7 @@

    8. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -12,7 +12,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -39,7 +39,7 @@ - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp index 557e6229..2fc73d8d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/examples/a009.jsp @@ -3,7 +3,7 @@

    9. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -12,7 +12,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -30,7 +30,7 @@ - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp index ea6509b7..40000d6b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp @@ -9,7 +9,7 @@

    Java Launcher

    -

    Run and explore DocuSign Admin API code examples with Authorization Code Grant or JWT Grant authentication

    +

    ${launcherTexts.getHomePageText()}

    @@ -25,7 +25,7 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    - +

    ${group.getName()}

    @@ -42,10 +42,10 @@

    - API method used: + ${launcherTexts.getAPIMethodUsed()} - API methods used: + ${launcherTexts.getAPIMethodUsedPlural()} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index 00b1c534..8725b858 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -2,10 +2,10 @@

    1. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -14,7 +14,7 @@ - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index ea6acb44..9375c47c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -2,11 +2,11 @@

    2. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -22,7 +22,7 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 2e938311..6528abb1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -2,10 +2,10 @@

    3. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -24,7 +24,7 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index f89ed792..842e8889 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -2,17 +2,17 @@

    4. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index cd53b293..5f3f85e1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -2,11 +2,11 @@

    5. ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -22,7 +22,7 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index 9eebb49a..06cabfe4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -9,7 +9,7 @@

    Java Launcher

    -

    Welcome to the DocuSign Java examples using multiple OAuth flows (JWT and Authorization Code Grant).

    +

    ${launcherTexts.getHomePageText()}

    @@ -25,7 +25,7 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    - +

    ${group.getName()}

    @@ -42,10 +42,10 @@

    - API method used: + ${launcherTexts.getAPIMethodUsed()} - API methods used: + ${launcherTexts.getAPIMethodUsedPlural()} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp index 498ffdf2..5e210c05 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp @@ -2,8 +2,7 @@

    -

    Please Authenticate with DocuSign

    -

    Please choose your authentication type

    + ${launcherTexts.getLoginPage().getLoginHeader()}

    - +


    -

    You need to authenticate with DocuSign to continue your request.

    +

    ${launcherTexts.getLoginPage().getLoginHelperText()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp index 393bdc79..18ca65e7 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp @@ -20,6 +20,6 @@ -

    Continue

    +

    ${launcherTexts.getContinueButton()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp index 308ab905..053aa3f2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp @@ -2,8 +2,7 @@
    -

    Please choose an API

    -

    Please choose your API type

    + ${launcherTexts.getSelectAPIPage().getSelectAPIHeader()}

    - +

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp index 8a69913e..203253d1 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,7 +10,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -27,7 +27,7 @@ value="${locals.dsConfig.signerName}" required>
    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp index db13a6ac..608cacb3 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,7 +10,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -40,7 +40,7 @@ required> - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp index 940ed4cb..0727ba23 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -10,12 +10,12 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index a96d89d1..cf109e45 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -12,7 +12,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -21,7 +21,7 @@
    - +
    @@ -29,7 +29,7 @@ Thank you.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index 0a8049e2..b8777fc3 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -20,7 +20,7 @@
    - +
    @@ -28,7 +28,7 @@ Thank you.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index b92fa7b4..dc42c71c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -20,7 +20,7 @@
    - +
    @@ -28,7 +28,7 @@ Thank you.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index f2304f13..8e1aaa25 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -21,7 +21,7 @@ Thank you.

    - +
    @@ -30,7 +30,7 @@ Thank you.

    - +
    @@ -50,7 +50,7 @@ - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp index 36c6599c..b86dbe03 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,12 +11,12 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index e65aa7a2..10ef9cf3 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -54,7 +54,7 @@ required> - + @@ -62,7 +62,7 @@ Thank you.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp index 52e89dd4..f57bb41e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -39,7 +39,7 @@ required> - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index a02f77ef..cb3f60f2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -46,7 +46,7 @@ required> - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index 9bdbd928..cf251ffa 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -12,7 +12,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    Optional: to use the Envelope's document view please first create an envelope using @@ -31,7 +31,7 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index 8dc266cd..03b85e07 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -4,7 +4,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    @@ -14,7 +14,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -75,7 +75,7 @@ - + @@ -83,7 +83,7 @@ Thank you.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp index f34c77d7..bb8535da 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -41,7 +41,7 @@ required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp index f4a0c941..7a83bfd6 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    @@ -13,7 +13,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -25,7 +25,7 @@
    - +
    @@ -33,7 +33,7 @@ Thank you.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp index d94b2683..4728eff5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    @@ -13,7 +13,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -42,7 +42,7 @@ required > - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index 558e2de3..f4785a6d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -3,7 +3,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -54,7 +54,7 @@ required> - + @@ -63,7 +63,7 @@ Thank you.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index fa7d18c4..3391745c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -22,14 +22,14 @@

    - +

    Problem: Please first create an envelope using Set tab values for an envelope.

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp index 1a789b24..ae985e63 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -35,7 +35,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp index 40dac1ee..f8c3e82e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -42,7 +42,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp index f10d887a..cd5ffb74 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -29,7 +29,7 @@ value="${locals.dsConfig.signerName}" required> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp index 56caaf9b..f08deb09 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -28,7 +28,7 @@ value="${locals.dsConfig.signerName}" required> - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp index 85da155c..2f9b0cef 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -21,7 +21,7 @@ - + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp index 9c99989a..cd5fd2bd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -35,7 +35,7 @@ - + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp index 3cf49a5c..be758cf0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp @@ -2,7 +2,7 @@

    ${example.getExampleName()}

    -

    ${example.getExampleDescriptionExtended()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    @@ -11,7 +11,7 @@

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    @@ -44,7 +44,7 @@ <%--
    --%> <%--
    --%> - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index 93f85f40..63f8c213 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -1,25 +1,31 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    1. Create a clickwrap.

    + + +

    1. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    - Creates a clickwrap that you can embed in your website or app. -

    -

    API method used: - ClickWraps:createClickwrap. -

    -

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + + +
    - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index 52b76963..bbeb44dd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -1,25 +1,28 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Activate a clickwrap.

    + + + + +

    2. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    + +

    - Activates a new clickwrap that you have already created. By default, new clickwraps are - inactive. You must activate your clickwrap before you can use it. -

    -

    API method used: - ClickWraps:updateClickwrapVersion. -

    -

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    Please choose a clickwrap to activate

    +

    ${example.getForms().get(formNumber).getFormName()}

    - + +
    - +

    - Problem: You do not have clickwraps to activate. Go to example#1 and create one: - create clickwrap.
    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 00d04f36..08008954 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -1,27 +1,27 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    3. Create a new clickwrap version.

    + + + + + +

    3. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    - Creates a new version of a clickwrap. -

    -

    - You can specify whether you require users who have previously accepted the clickwrap - to accept the new version when they return to your website. -

    -

    API method used: - ClickWraps:createClickwrapVersion -

    -

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - + +
    - - + + +
    - +

    - Problem: You do not have clickwraps to activate. Go to example#1 and create one: - create clickwrap.
    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index c88e070a..842e8889 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -1,22 +1,18 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    4. Get a list of clickwraps.

    +

    4. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    - Gets a list of clickwraps associated with a specific DocuSign user. -

    -

    API method used: - ClickWraps:getClickwraps -

    -

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index edefb9fa..c4b5c18a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -1,24 +1,28 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    5. Get clickwrap responses.

    + + + + +

    5. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    + +

    - Gets user responses to your clickwrap agreements. -

    -

    API method used: - ClickWraps:getClickwrapAgreements -

    -

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    Please choose a clickwrap

    +

    ${example.getForms().get(formNumber).getFormName()}

    - + +
    - +

    - Problem: You do not have clickwraps. Go to example#1 and create one: - create clickwrap.
    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index e5ac4ffc..06cabfe4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -9,7 +9,7 @@

    Java Launcher

    -

    Welcome to the DocuSign Java examples using multiple OAuth flows (JWT and Authorization Code Grant).

    +

    ${launcherTexts.getHomePageText()}

    @@ -25,41 +25,51 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Click examples

    -

    1. Create a clickwrap

    -

    Creates a clickwrap that you can embed in your website or app. -

    -

    API method used: - ClickWraps:createClickwrap. -

    + +

    ${group.getName()}

    -

    2. Activate a clickwrap

    -

    Activates a new clickwrap that you have already created. -

    -

    API method used: - ClickWraps:updateClickwrapVersion -

    + + +

    + ${example.getExampleNumber()}. + + ${example.getExampleName()} + +

    -

    3. Create a new clickwrap version

    -

    Creates a new version of a clickwrap. -

    -

    API method used: - ClickWraps:createClickwrapVersion -

    +

    ${example.getExampleDescription()}

    -

    4. Get a list of clickwraps

    -

    Gets a list of clickwraps associated with a specific DocuSign user. -

    -

    API method used: - ClickWraps:getClickwraps -

    +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + -

    5. Get clickwrap responses

    -

    Gets user responses to your clickwrap agreements. -

    -

    API method used: - ClickWraps:getClickwrapAgreements -

    + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp index 498ffdf2..5e210c05 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_must_authenticate.jsp @@ -2,8 +2,7 @@
    -

    Please Authenticate with DocuSign

    -

    Please choose your authentication type

    + ${launcherTexts.getLoginPage().getLoginHeader()}

    - +


    -

    You need to authenticate with DocuSign to continue your request.

    +

    ${launcherTexts.getLoginPage().getLoginHelperText()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp index 393bdc79..18ca65e7 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_return.jsp @@ -20,6 +20,6 @@ -

    Continue

    +

    ${launcherTexts.getContinueButton()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp index 308ab905..053aa3f2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp @@ -2,8 +2,7 @@
    -

    Please choose an API

    -

    Please choose your API type

    + ${launcherTexts.getSelectAPIPage().getSelectAPIHeader()}

    - +

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp index c92d6906..4f6762a4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg001.jsp @@ -1,40 +1,56 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Embedded Signing

    -

    This example sends an envelope, and then uses Embedded signing for the first signer.

    -

    Embedded signing provides a smoother user experience for the signer: DocuSign signing is initiated from - your website.

    + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    + -

    API methods used: - Envelopes::create - and - EnvelopeViews::createRecipient. -

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp index 52372d19..c91be407 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg002.jsp @@ -1,53 +1,87 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with a remote (email) signer and cc recipient

    -

    The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    -

    This is a general example of creating and sending an envelope (a signing request) to multiple recipients, - with multiple documents, and with signature fields for the documents.

    + + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - - - The email and/or name for the cc recipient must be different - from the signer. + + + + + + ${launcherTexts.getHelpingTexts().getCCEmailShouldDifferFromSigner()}
    - - + ${example.getForms().get(formNumber).getInputs().get(ccNameInputNumber).getInputName()} + + +
    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp index 1b86f5ee..0727ba23 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg003.jsp @@ -1,25 +1,21 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    List envelopes in the user's account

    -

    List the envelopes created in the last 30 days.

    -

    This example demonstrates how to query DocuSign about envelopes sent by the current user.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::listStatusChanges. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp index 3eda6a33..80878ef4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg004.jsp @@ -1,45 +1,40 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Get an envelope's basic information and status

    -

    List the basic information about an envelope, including its overall status. - Additional API/SDK methods may be used to get additional information about the - envelope, its documents, recipients, etc.

    - -

    This example demonstrates how to obtain the latest information about - an envelope from DocuSign. Often an alternative is to use Connect - to enable DocuSign to proactively send your application updates when the - status of an envelope changes. -

    + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::get. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient will be queried.

    +

    + ${example.getForms().get(formNumber).getFormName()} +

    - +
    -

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient.
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToSecondCodeExample)}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp index 44c8aaf0..d950776f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg005.jsp @@ -1,37 +1,39 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    List an envelope's recipients and their status

    -

    List the envelope's recipients, including their current status.

    + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - EnvelopeRecipients::list. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient. will be queried.

    +

    + ${example.getForms().get(formNumber).getFormName()} +

    - +
    -

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient..
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToSecondCodeExample)}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp index 308b9506..0da48cac 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg006.jsp @@ -1,41 +1,39 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    List an envelope's documents

    -

    List the envelope's documents. A Certificate of Completion document - is also associated with every envelope. -

    + + + -

    This method is often used to dynamically create a list of an envelope's documents - in preparation for enabling your user to download one or more of the documents.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - EnvelopeDocuments::list. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    The envelope you created via Send an envelope with a remote (email) signer and cc recipient will be queried.

    +

    + ${example.getForms().get(formNumber).getFormName()} +

    - +
    -

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToSecondCodeExample)}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp index 39914969..45d14e81 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg007.jsp @@ -1,61 +1,53 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Download a document from an envelope

    -

    An envelope's documents can be downloaded one by one or as a complete set.

    -

    Document download options:

    -
      -
    • Combined: a PDF with the combined content of all documents and the - certificate -
    • -
    • Zip Archive: a ZIP archive that contains all of the PDF documents, - the certificate, and any .WAV files used for voice authentication. -
    • -
    • The envelope's individual documents
    • -
    • The envelope's Certificate of Completion
    • -
    + + + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - EnvelopeDocuments::get. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    Problem: please first create an envelope using Send an envelope with a remote (email) signer and cc recipient..
    - You will then need to use example 6 to create the list of documents.
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectSecondNumber).getRedirectText().replaceFirst("\\{0}", redirectToSecondCodeExample)}

    - +
    -

    Problem: please first create a list of the envelope's documents using - example 6.
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectSixNumber).getRedirectText().replaceFirst("\\{0}", redirectToSixthCodeExample)}

    - +
    -

    Please choose a document.
    - The document list is from your results for example 6.

    +

    ${example.getForms().get(formNumber).getFormName()}

    - + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp index cd378762..b86dbe03 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg008.jsp @@ -1,34 +1,22 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Create a template

    -

    Create a template with two roles, signer and cc. - The template includes three documents. -

    - -

    Templates are usually created using the DocuSign web tool. This example creates - a template that will later be used by other examples in this launcher.

    - -

    This example first lists the user's templates and only creates a new template if one does not already exist in your - account. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API methods used: - Templates::list, - Templates::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp index 311d2fbf..5da55c55 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg009.jsp @@ -1,35 +1,38 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope using a template

    -

    The envelope is defined by the template. - The signer and cc recipient name and email are used to fill in the template's roles.

    - -

    This example demonstrates a common pattern for DocuSign integrations: envelopes will - be sent programmatically, based on a template. If the template definition needs to be - updated, the DocuSign web tool can be used to easily update the template, thus - avoiding the need to make software changes. -

    + + + + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    The template you created via Create a template will be used.

    +

    ${example.getForms().get(formNumber).getFormName()}

    - @@ -37,41 +40,77 @@
    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()}
    - - + + +
    - - - The email and/or name for the cc recipient must be - different from the signer. + + + + + + ${launcherTexts.getHelpingTexts().getCCEmailShouldDifferFromSigner()}
    - - + ${example.getForms().get(formNumber).getInputs().get(ccNameInputNumber).getInputName()} + + +
    + - +
    -

    Problem: please first create the template using Create a template.
    - Thank you.

    +

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToEigthCodeExample)} +

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp index 231a1e89..a66a5380 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg010.jsp @@ -1,53 +1,88 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope using binary document transfer

    -

    The envelope includes a pdf, Word, and HTML document.

    -

    Multipart data transfer is used to send the documents in binary format to DocuSign. - Binary transfer is 33% more efficient than base64 encoding and is recommended for documents over 15M Bytes. -

    + + + + + -

    Since binary transfer is not yet supported by the SDK, this example uses the API directly and - demonstrates how to do so.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - - - The email and/or name for the cc recipient must be different from the signer. + + + + + + ${launcherTexts.getHelpingTexts().getCCEmailShouldDifferFromSigner()} +
    - - + ${example.getForms().get(formNumber).getInputs().get(ccNameInputNumber).getInputName()} + + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp index 8bb8b348..f4ceacce 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg011.jsp @@ -1,66 +1,99 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Use embedded sending

    -

    An envelope will be created in draft mode. Your browser will then be redirected to - the DocuSign web tool where the envelope can be (optionally) updated and then sent.

    -

    The envelope includes a pdf, Word, and HTML document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents.

    -

    DocuSign recommends that you enhance your application as needed to avoid the need - for the embedded sender view. -

    -

    For example, if the sender view is used to optionally - add additional documents to the envelope, enhance your app to provide the - needed feature (see Use embedded signing from a template with an added document for adding additional documents programmatically). -

    + + + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API methods used: - Envelopes::create and - EnvelopeViews::createSender. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - + +
    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - - - The email and/or name for the cc recipient must be different from the signer. + + + + + + ${launcherTexts.getHelpingTexts().getCCEmailShouldDifferFromSigner()} +
    - - + ${example.getForms().get(formNumber).getInputs().get(ccNameInputNumber).getInputName()} + + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp index eefb33e3..bf2cf05d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg012.jsp @@ -1,38 +1,35 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Embedded DocuSign web tool

    -

    Redirect the user to the DocuSign web tool.

    -

    Use this API call to open the DocuSign web tool, the NDSE (New DocuSign Signing Experience), - with the user already logged in.

    -

    The starting view can be either an envelope's documents or the web tool's front page.

    -

    The user does not necessarily return from the NDSE, so using this API call is often a final - step for your application. - Or you can open the NDSE in a new tab for the user. -

    + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - EnvelopeViews::createConsole. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    Optional: to use the Envelope's document view please first create an envelope using - Send an envelope with a remote (email) signer and cc recipient.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToSecondCodeExample)}

    - + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp index c123983e..7d8c1864 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg013.jsp @@ -1,21 +1,20 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Use embedded signing from a template with an added document

    + + + + + + + + + + +

    ${example.getExampleName()}

    + -

    This example sends an envelope based on a template.

    -

    In addition to the template's document(s), the example adds an - additional document to the envelope by using the - Composite - Templates - feature.

    -

    In this example, the additional document is an HTML document that - includes order details with information from the form below.

    -

    This example then enables you to sign the envelope using embedded signing.

    -

    Embedded signing provides a smoother user experience for a signer who is - already logged into your web application since the DocuSign - signing is initiated from your website.

    +

    ${example.getExampleDescription()}

    @@ -23,52 +22,83 @@ -

    API methods used: - Envelopes::create - and - EnvelopeViews::createRecipient. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    The template you created via Create a template will be used.

    +

    ${example.getForms().get(formNumber).getFormName()}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()}
    - - + + +
    - - - The email and/or name for the cc recipient must be - different - from the signer. + + + + + + ${launcherTexts.getHelpingTexts().getCCEmailShouldDifferFromSigner()}
    - - + ${example.getForms().get(formNumber).getInputs().get(ccNameInputNumber).getInputName()} + + +


    - + +
    - + +
    - +
    -

    Problem: please first create the template using Create a template.
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToEigthCodeExample)}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp index 03483d7f..65114bca 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg014.jsp @@ -1,63 +1,96 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with an order form, including a payment field.

    + + + + + + -
    Note: This example will only work if the sender's DocuSign account - is set up with a DocuSign payment gateway. Since the Payment Gateway ID - is set in the configuration file, you will need to run your - own instance of this project to set it. -
    - -

    Anchor strings - (AutoPlace) - are used to position the fields in the documents. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    ${example.getNotes()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - - - The email for the cc recipient must be different from the signer's email. + + + + + + ${launcherTexts.getHelpingTexts().getCCEmailShouldDifferFromSigner()}} +
    - - + ${example.getForms().get(formNumber).getInputs().get(ccNameInputNumber).getInputName()} + + +
    - +
    -

    Problem: please set the DS_PAYMENT_GATEWAY_ID value in the configuration file.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp index 2f10b8b6..3326b3e0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg015.jsp @@ -1,49 +1,37 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Get the tab data from an envelope.

    - -

    Get the tab (field) values from an envelope for all of the envelope's recipients.

    - -

    - This method is used to read the updated tab values from - the envelope. The method can be used after the envelope is complete or while it is - still in progress. -

    - + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    - API method used: - EnvelopeFormData::get. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    - The last envelope you created with this example launcher will be queried. - Recommendation: use example 9, then this example, since example 9 includes many tabs of different types. -

    +

    ${example.getForms().get(formNumber).getFormName()}

    - +
    -

    Problem: please first create an envelope using example 9.
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToNinthCodeExample)}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp index 340667ed..3a5b7eee 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg016.jsp @@ -1,56 +1,59 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Set tab values for an envelope.

    - -

    - This example creates an example with both read-only tabs (fields) and tabs that can - be updated by the recipient. -

    -

    The example also sets custom metadata in the envelope via the envelope custom fields feature.

    - + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    - API method used: - EnvelopeFormData::get. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. -
    -
    - - -
    -
    - - - The email for the cc recipient must be different from the signer's email. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    + - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp index 55bbbd21..84b1b749 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg017.jsp @@ -1,32 +1,35 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + + -

    Set template tab values

    -

    - This example sets the value of a template's tabs. It includes setting - radio button and checkbox tabs. -

    -

    The example also sets custom metadata in the envelope via the envelope custom fields feature.

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    -

    The template you created via Create a template will be used.

    -
    - @@ -34,42 +37,75 @@
    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()}
    - - + + +
    - - - The email and/or name for the cc recipient must be - different from the signer. + + + + + + ${launcherTexts.getHelpingTexts().getCCEmailShouldDifferFromSigner()}
    - - + ${example.getForms().get(formNumber).getInputs().get(ccNameInputNumber).getInputName()} + + +
    - +
    -

    Problem: please first create the template using Create a template.
    - Thank you.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToEightCodeExample)}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp index a408375b..dbfbff5d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg018.jsp @@ -1,48 +1,38 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Get the custom field data for an envelope

    -

    - Get the data values associated with the envelope itself. The custom data fields enable you to - add additional meta-data to the envelope. The custom data fields can be set by the Sender - via the DocuSign web tool, or can be set programmatically. The data can be included in the - envelope's certificate of completion. -

    + + + -

    - This method is used to read the custom field values from - an envelope. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    +

    - API method used: - EnvelopeCustomFields::list. -

    -

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - The last envelope you created with this example launcher will be queried. - Recommendation: Create an envelope using Set tab values for an envelope then use this example in order to see an example of custom tab values. + ${example.getForms().get(formNumber).getFormName().replaceFirst("\\{0}", redirectTo16CodeExample)}

    - +
    -

    Problem: Please first create an envelope using Set tab values for an envelope.

    +

    ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectTo16CodeExample)}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp index 851d5553..cd8f573b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg019.jsp @@ -1,51 +1,75 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with a recipient using Access Code Authentication.

    + + + + -

    - The envelope includes a pdf document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    -

    - This is a general example of creating and sending an envelope (a signing request) using An Access Code for Recipient Authentication. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    +
    +
    + + + + + + ${launcherTexts.getHelpingTexts().getAccessCodeText()} + +
    +
    + + + + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} + +
    +
    + - -
    - - - Provide this string to a recipient that is different such as in person or by mail or via different email. -
    -
    - - - We'll never share your email with anyone else. -
    -
    - - -
    - - - + +
    + + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp index 36b24f9c..6ea12093 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg020.jsp @@ -1,53 +1,89 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Require Phone Authentication for a Recipient

    -

    Sends an envelope that requires entering a six-digit code from a text message or phone call for the purpose of multifactor authentication.

    -

    The envelope includes a PDF file. Anchor text - (AutoPlace) - is used to position the signing fields in the documents.

    + + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + + +
    - - + + +
    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp index 320aa574..70957600 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg022.jsp @@ -1,36 +1,59 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Send an envelope with a recipient using Knowledge-Based Authentication.

    + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    ${example.getNotes()}

    Documentation about this example.

    -

    API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp index 468ca7ed..201da42b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg023.jsp @@ -1,45 +1,58 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    Requiring Id Verification for a Recipient

    + + + -

    - The envelope includes a pdf document. Anchor text - (AutoPlace) - is used to position the signing fields in the documents. -

    -

    - This is a general example of creating and sending an envelope (a signing request) using ID Verification for Recipient Authentication. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    ${example.getNotes()}

    Documentation about this example.

    -

    - API method used: - Envelopes::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + ${example.getForms().get(formNumber).getInputs().get(signerEmailInputNumber).getInputName()} + + + - We'll never share your email with anyone else. + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} +
    - - + + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp index c2a387af..b2c39bb4 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg024.jsp @@ -1,34 +1,39 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    + + -

    -Permission profiles are collections of account settings that determine the behavior and actions -available to the user groups to which they're applied. This code example demonstrates how to -create a permission profile with the eSignature REST API. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - AccountPermissionProfiles::create. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - - + + +
    - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp index cc8c0b73..b656914b 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg025.jsp @@ -1,30 +1,30 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    + + + -

    - Permission profiles are collections of account settings that determine the behavior and actions - available to the user groups to which they're applied. This code example demonstrates how to - the permission profile for the group with the eSignature REST API. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - Groups::update. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - + + @@ -42,7 +45,7 @@
    - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp index 6e8e0b18..958ff8f9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg026.jsp @@ -1,29 +1,29 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    ${title}.

    + + -

    -This code example demonstrates how to edit individual permission settings on a permissions profile -with the eSignature REST API. -

    +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - AccountPermissionProfiles::update. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - + + --%> -<%--
    --%> -<%-- --%> -<%--

    There is no account role settings is defined

    --%> -<%--
    --%> -<%-- --%> -<%-- --%> -<%-- --%> -<%-- --%> -<%-- --%> -<%-- --%> -<%-- --%> -<%-- --%> -<%--
    ${property.name}${property.leftValue}
    --%> - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp b/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp index ae29cb63..76d6ac1f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/example_done.jsp @@ -21,7 +21,7 @@ -

    Continue

    +

    ${launcherTexts.getContinueButton()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp b/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp index d5b5edd7..238602e2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/example_done_compare.jsp @@ -23,6 +23,6 @@
    -

    Continue

    +

    ${launcherTexts.getContinueButton()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp b/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp new file mode 100644 index 00000000..b3048d63 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/links_to_api_methods.jsp @@ -0,0 +1,28 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + + + + ${link.getPathName()} + + + + . + + + and + + + , + + + +

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp index b2c43c60..3c554970 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m001.jsp @@ -1,24 +1,21 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> -

    1. Get monitoring data

    -

    Demonstrates how to get and display all of your organization's monitoring data.

    +

    1. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    Documentation about this example.

    -

    API method used: - DataSet:getStream. -

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp index 2a1448f3..990a6fd9 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/examples/m002.jsp @@ -1,34 +1,49 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Query monitoring data with filters

    -

    Demonstrates how to query an organization's data based on specified filters and aggregations.

    -

    - API method used: - DataSet:postWebQuery. -

    + + + + +

    2. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    - View source file ${sourceFile} on GitHub. + ${viewSourceFile}

    - Please select start and end dates. + ${example.getForms().get(formNumber).getFormName()}

    - - + + +
    - - + + +
    - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp index 43fe8181..484ff4de 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp @@ -7,7 +7,7 @@

    Java Launcher

    -

    Welcome to the Java code examples for DocuSign Monitor API with JWT Grant authentication

    +

    ${launcherTexts.getHomePageText()}

    @@ -22,21 +22,51 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Monitor API Code examples

    - -

    1. Get monitoring data

    -

    Demonstrates how to get and display all of your organization's monitoring data.

    -

    - API method used: - DataSet:getStream -

    - -

    2. Query monitoring data with filters

    -

    Demonstrates how to query an organization's data based on specified filters and aggregations.

    -

    - API method used: - DataSet:postWebQuery. -

    + +

    ${group.getName()}

    + + + +

    + ${example.getExampleNumber()}. + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    + +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + + + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp index 74864924..487737af 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r001.jsp @@ -1,22 +1,32 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    1. Creating a room.

    + + -

    This example demonstrates creating a DocuSign room.

    +

    1. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    -

    API methods used: - Roles::GetRoles and - Rooms::CreateRoom. +

    + ${viewSourceFile}

    +
    - - + + +
    - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp index 46a6ab6f..2b2bb2c5 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r002.jsp @@ -1,33 +1,42 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    2. Creating a room with a template.

    + + + -

    This example demonstrates creating a DocuSign Room using a predefined template. - If you've created a template - for your organization in either Rooms for Mortgage or Rooms for Real Estate, - you can create rooms based on this template using the Rooms API. -

    - -

    API method used: - RoomTemplates::GetRoomTemplates, - Roles::GetRoles and - Rooms::CreateRoom. +

    2. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    + -

    Cannot find any templates. Please first create a template. +

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText()}

    - - + + +
    - + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp index 67d9a110..8e5cfa87 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r003.jsp @@ -1,27 +1,31 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    3. Exporting data from a room.

    + + + + -

    This example demonstrates how to export rooms data from a DocuSign Room. -

    - -

    API method used: - Rooms::GetRooms and - Rooms::GetRoomFieldSet. +

    3. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    + -

    Cannot find any rooms. Please first create a room using - example 1 or - example 2. +

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)}

    - + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp index 60e3aba0..d1d99549 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r004.jsp @@ -1,23 +1,28 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    4. Adding forms to a room.

    + + + + + -

    This example demonstrates how to attach forms to a room using the Rooms API. -

    - -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraryForms and - Rooms::AddFormToRoom. +

    4. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    +
    - + + @@ -50,7 +58,7 @@ - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp index 023655e0..cfb5b301 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r005.jsp @@ -1,32 +1,46 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    5. Get Rooms with filters.

    + + + -

    This example demonstrates how to return rooms filtered by your parameters using the - Rooms API. - This specific code example filters for all rooms that have had their field data, updated within - the date range, as shown on the Details tab in the UI. -

    - -

    API method used: - Rooms::GetRooms. +

    5. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    +
    - - + + +
    - - + + +
    + - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp index dcf3323b..39d174d2 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r006.jsp @@ -1,28 +1,30 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    6. Creating an external form fill session.

    + + + + + + + -

    The DocuSign Rooms API offers developers the option to have users fill out forms without - logging in to the Rooms UI through the use of an external form fill session. - This example demonstrates how to create an external form fill session using the - Rooms API: - the result of this code example is the URL for the form fill session, which you can embed in - your integration or send to the user. -

    - -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraries and - ExternalFormFillSessions::CreateExternalFormFillSession, +

    6. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    +
    - + + @@ -49,8 +54,7 @@
    -

    Problem: selected rooms does not have any documents. Please first add form to a room using example 4

    -

    Thank you

    + ${example.getRedirectsToOtherCodeExamples().get(redirectForthNumber).getRedirectText().replaceFirst("\\{0}", redirectToForthCodeExample)}
    @@ -58,7 +62,7 @@ - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp index 34d3763a..1bafbced 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r007.jsp @@ -1,21 +1,31 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    7. Creating a form group.

    + + -

    This example demonstrates creating a form group for your DocuSign Rooms for Real Estate account.

    - -

    API methods used: - FormGroups:CreateFormGroup. +

    7. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    +
    - - + + +
    - +
    \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp index 48f9b54d..c258f0ce 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r008.jsp @@ -1,32 +1,33 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    8. Granting office access to a form group.

    + + + + + -

    This example demonstrates how to assign an office to - a form group - for your DocuSign Rooms for Real Estate account. Granting office access to a form group will - enable you to filter which form groups are available based on that office. -

    - -

    API method used: - FormGroups:GrantOfficeAccessToFormGroup, - FormGroups:GetFormGroups and - Offices:GetOffices. +

    8. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    +
    -

    Problem: please first create a form group using example 7

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToSeventhCodeExample)}

    Problem: cannot find any offices

    - +
    - +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp index de6ad104..c9909c1f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/examples/r009.jsp @@ -1,34 +1,34 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    9. Assigning a form to a form group.

    - -

    This example demonstrates how to assign a form to - a form group - for your DocuSign Rooms for Real Estate account. As a prerequisite, ensure that you have - created a form group - and set the office ID on this form group - before proceeding. -

    + + + + + -

    API method used: - FormGroups:AssignFormGroupForm, - FormGroups:GetFormGroups and - FormLibraries::GetFormLibraryForms. +

    9. ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    +

    + ${viewSourceFile}

    +
    -

    Problem: please first create a form group using example 7

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToSeventhCodeExample)}

    Problem: cannot find any forms, please first create a form

    - + +
    - + +
    - +
    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp index 4d3e40a6..86e725bd 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp @@ -9,7 +9,7 @@

    Java Launcher

    -

    Welcome to the DocuSign Java examples using multiple OAuth flows (JWT and Authorization Code Grant).

    +

    ${launcherTexts.getHomePageText()}

    @@ -21,108 +21,55 @@
    -

    Welcome

    -

    This launcher both demonstrates use of common OAuth2 grant flows and multiple usage examples from the DocuSign Rooms REST API.

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -

    Rooms examples

    + +

    ${group.getName()}

    -

    1. Creating a room with data

    -

    This example demonstrates creating a DocuSign room. -

    -

    API methods used: - Roles::GetRoles and - Rooms::CreateRoom. -

    + + +

    + ${example.getExampleNumber()}. + + ${example.getExampleName()} + +

    -

    2. Creating a room with a template

    -

    This example demonstrates creating a DocuSign Room using a predefined template. - If you've created a template - for your organization in either Rooms for Mortgage or Rooms for Real Estate, - you can create rooms based on this template using the Rooms API. -

    -

    API method used: - RoomTemplates::GetRoomTemplates, - Roles::GetRoles and - Rooms::CreateRoom. -

    +

    ${example.getExampleDescription()}

    -

    3. Exporting data from a room

    -

    This example demonstrates how to export rooms data from aDocuSign Room. -

    -

    API method used: - Rooms::GetRooms and - Rooms::GetRoomFieldSet. -

    +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + -

    4. Adding forms to a room

    -

    This example demonstrates how to attach forms to a room using the Rooms API. -

    -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraryForms and - Rooms::AddFormToRoom. -

    + + + ${link.getPathName()} + -

    5. Get Rooms with filters

    -

    This example demonstrates how to return rooms filtered by your parameters using the - Rooms API. - This specific code example filters for all rooms that have had their field data, updated within - the last 10 days, as shown on the Details tab in the UI. -

    -

    API method used: - Rooms::GetRooms. -

    - -

    6. Creating an external form fill session

    -

    The DocuSign Rooms API offers developers the option to have users fill out forms without - logging in to the Rooms UI through the use of an external form fill session. - This example demonstrates how to create an external form fill session using the - Rooms API: - the result of this code example is the URL for the form fill session, which you can embed in - your integration or send to the user. -

    -

    API method used: - Rooms::GetRooms, - FormLibraries::GetFormLibraries and - ExternalFormFillSessions::CreateExternalFormFillSession, -

    - -

    7. Creating a form group

    -

    This example demonstrates creating a form group for your DocuSign - Rooms for Real Estate account. -

    -

    API method used: - FormGroups:CreateFormGroup. -

    - -

    8. Granting office access to a form group

    -

    This example demonstrates how to assign an office to - a form group - for your DocuSign Rooms for Real Estate account. Granting office access to a form group will - enable you to filter which form groups are available based on that office. -

    -

    API method used: - FormGroups:GrantOfficeAccessToFormGroup, - FormGroups:GetFormGroups and - Offices:GetOffices. -

    - -

    9. Assigning a form to a form group

    -

    This example demonstrates how to assign a form to - a form group - for your DocuSign Rooms for Real Estate account. As a prerequisite, ensure that you have - created a form group - and set the office ID on this form group - before proceeding. -

    -

    API method used: - FormGroups:AssignFormGroupForm, - FormGroups:GetFormGroups and - FormLibraries::GetFormLibraryForms. -

    + + + . + + + and + + + , + + +
    +

    +
    +
    +
    diff --git a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp index 97ed149f..3a49e9b0 100644 --- a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp +++ b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp @@ -29,43 +29,36 @@ - - - - - @@ -80,7 +73,7 @@
    - + From a78045336384bbb7fd16ae19cd910c901f72e3fb Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 3 Oct 2022 08:59:36 -0700 Subject: [PATCH 341/699] DEVDOCS-8839 - fixing the application.example.json to include the eSign only manifest link --- Quick_ACG/src/main/resources/application.example.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Quick_ACG/src/main/resources/application.example.json b/Quick_ACG/src/main/resources/application.example.json index a66e0672..2dbceb49 100644 --- a/Quick_ACG/src/main/resources/application.example.json +++ b/Quick_ACG/src/main/resources/application.example.json @@ -26,6 +26,8 @@ "com.docusign.github.example-uri": "https://github.com/docusign/code-examples-java/blob/master/src/main/java/", "com.docusign.documentation-path": "", + "ESignatureManifest": "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/eSignatureManifest.json", + "server.tomcat.additional-tld-skip-patterns": "*jaxb*.jar", "server.servlet.session.tracking-modes": "cookie", "server.servlet.session.persistent": false, From 2e7dace517c0c39194c8be28a173765733716030 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Mon, 3 Oct 2022 15:07:37 -0700 Subject: [PATCH 342/699] Fixing ACG Quickstart issue --- Quick_ACG/src/main/resources/application.example.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Quick_ACG/src/main/resources/application.example.json b/Quick_ACG/src/main/resources/application.example.json index a66e0672..2dbceb49 100644 --- a/Quick_ACG/src/main/resources/application.example.json +++ b/Quick_ACG/src/main/resources/application.example.json @@ -26,6 +26,8 @@ "com.docusign.github.example-uri": "https://github.com/docusign/code-examples-java/blob/master/src/main/java/", "com.docusign.documentation-path": "", + "ESignatureManifest": "https://raw.githubusercontent.com/docusign/code-examples-csharp/master/manifest/eSignatureManifest.json", + "server.tomcat.additional-tld-skip-patterns": "*jaxb*.jar", "server.servlet.session.tracking-modes": "cookie", "server.servlet.session.persistent": false, From c7e176fda71bba2c3716c0c4f478f0e6312dbe7c Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Tue, 18 Oct 2022 15:22:21 -0700 Subject: [PATCH 343/699] DEVDOCS-8780 - Monitor API examples, adding try/catch and providing useful message to developers --- .../examples/M001GetMonitoringData.java | 9 ++++ .../examples/M002WebQueryEndpoint.java | 9 ++++ .../services/GetMonitoringDataService.java | 46 +++++++++++-------- .../services/WebQueryEndpointService.java | 30 +++++++----- 4 files changed, 64 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 3e531c35..f9cb0333 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -42,6 +42,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // step 1 end JSONArray monitoringData = GetMonitoringDataService.getMonitoringData(createDataSetApi(accessToken, this.session)); + if (monitoringData.getJSONObject(0).has("Error")) + { + new DoneExample() + .withTitle(getTextForCodeExample().ExampleName) + .withName("") + .withMessage(monitoringData.getJSONObject(0).getString("Error")) + .addToModel(model, config); + return ERROR_PAGE; + } // Cleaning the data from wrong symbols String monitoringDataCleaned = monitoringData.toString().replaceAll("'", ""); diff --git a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java index 05e5dc78..2f45f30e 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java @@ -67,6 +67,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getEndDate() ); + if (queryResult.has("Error")) + { + new DoneExample() + .withTitle(getTextForCodeExample().ExampleName) + .withName("") + .withMessage(queryResult.getString("Error")) + .addToModel(model, config); + return ERROR_PAGE; + } // Cleaning the data from unsupported symbols String queryResultCleaned = queryResult.toString().replaceAll("'", ""); diff --git a/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java index a5a29530..77afbd89 100644 --- a/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java +++ b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java @@ -18,28 +18,36 @@ public static JSONArray getMonitoringData(DataSetApi datasetApi) throws Exceptio // After each call, save the cursor and use it to make the next // call from the point where the previous one left off when iterating through // the monitoring records - do - { - if(!cursorValue.isEmpty()) - options.setCursor(cursorValue); - - CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); - - String endCursor = cursoredResult.getEndCursor(); - - // If the endCursor from the response is the same as the one that you already have, - // it means that you have reached the end of the records - if (endCursor.equals(cursorValue)) + try { + + do { - complete = true; - } - else - { - cursorValue = endCursor; - monitoringData.put(new JSONObject(cursoredResult)); + if(!cursorValue.isEmpty()) + options.setCursor(cursorValue); + + CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); + + String endCursor = cursoredResult.getEndCursor(); + + // If the endCursor from the response is the same as the one that you already have, + // it means that you have reached the end of the records + if (endCursor.equals(cursorValue)) + { + complete = true; + } + else + { + cursorValue = endCursor; + monitoringData.put(new JSONObject(cursoredResult)); + } } + while (!complete); } - while (!complete); + catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("Error", "You do not have Monitor enabled for your account, follow How to enable Monitor for your account to get it enabled."); + monitoringData.put(jsonObject); + } return monitoringData; } diff --git a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java index 9656177f..f4984581 100644 --- a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java +++ b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java @@ -19,19 +19,27 @@ public static JSONObject postWebQueryMethod( String accountId, String filterStartDate, String filterEndDate) throws ApiException { - AggregateResult aggregateResult = datasetApi.postWebQuery( - API_VERSION, - NAME_OF_DATASET, - prepareWebQueryOptions(accountId, filterStartDate, filterEndDate)); - - AggregateResultResult methodResult = null; - List aggregateResultList = aggregateResult.getResult(); - // Step 4 end - if (aggregateResultList != null && !aggregateResultList.isEmpty()) { - methodResult = aggregateResultList.get(0); + try { + AggregateResult aggregateResult = datasetApi.postWebQuery( + API_VERSION, + NAME_OF_DATASET, + prepareWebQueryOptions(accountId, filterStartDate, filterEndDate)); + + AggregateResultResult methodResult = null; + List aggregateResultList = aggregateResult.getResult(); + // Step 4 end + if (aggregateResultList != null && !aggregateResultList.isEmpty()) { + methodResult = aggregateResultList.get(0); + } + + return new JSONObject(methodResult); } - return new JSONObject(methodResult); + catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("Error", "You do not have Monitor enabled for your account, follow How to enable Monitor for your account to get it enabled."); + return jsonObject; + } } // Step 3 start From cc44b587c22b68d968016690592dcbf31a58dc2f Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 19 Oct 2022 16:47:28 +0300 Subject: [PATCH 344/699] added search logic --- code-examples-java.iml | 6 +- .../java/com/docusign/DSConfiguration.java | 48 +--- .../java/com/docusign/WebSecurityConfig.java | 1 - .../admin/examples/A001AddActiveUser.java | 5 +- .../A002CreateActiveCLMESignUser.java | 6 +- .../examples/A003BulkExportUserData.java | 4 +- .../examples/A003aCheckRequestStatus.java | 4 +- .../examples/A004BulkImportUserData.java | 4 +- .../A004CheckImportRequestStatus.java | 4 +- .../admin/examples/A005AuditUsers.java | 4 +- ...RetrieveDocuSignProfileByEmailAddress.java | 4 +- .../A007RetrieveDocuSignProfileByUserID.java | 4 +- ...008UpdateUserProductPermissionProfile.java | 4 +- ...009DeleteUserProductPermissionProfile.java | 4 +- .../C001ControllerCreateClickwrap.java | 2 +- .../C002ControllerActivateClickwrap.java | 2 +- ...03ControllerCreateNewVersionClickwrap.java | 2 +- .../C004ControllerGetListClickwraps.java | 2 +- .../C005ControllerGetClickwrapResponses.java | 2 +- .../EG002ControllerSigningViaEmail.java | 4 +- .../EG003ControllerListEnvelopes.java | 4 +- .../examples/EG004ControllerEnvelopeInfo.java | 4 +- .../EG005ControllerEnvelopeRecipients.java | 4 +- .../examples/EG006ControllerEnvelopeDocs.java | 4 +- .../EG008ControllerCreateTemplate.java | 8 +- .../examples/EG009ControllerUseTemplate.java | 4 +- .../EG010ControllerSendBinaryDocs.java | 4 +- .../EG014ControllerCollectPayment.java | 4 +- .../examples/EG015ControllerGetTabValues.java | 4 +- ...18ControllerEnvelopeCustomFieldValues.java | 4 +- ...019ControllerAccessCodeAuthentication.java | 4 +- .../EG020ControllerPhoneAuthentication.java | 6 +- .../EG022ControllerKBAAuthentication.java | 4 +- .../EG023ControllerIdvAuthentication.java | 6 +- .../EG024ControllerPermissionCreate.java | 4 +- ...G025ControllerPermissionSetUserGroups.java | 6 +- ...ntrollerPermissionChangeSingleSetting.java | 4 +- .../EG027ControllerPermissionDelete.java | 6 +- .../examples/EG028ControllerCreateBrand.java | 4 +- .../EG029ControllerApplyBrandToEnvelope.java | 4 +- .../EG030ControllerApplyBrandToTemplate.java | 4 +- .../EG031ControllerBulkSendEnvelopes.java | 6 +- ...EG032ControllerPauseSignatureWorkflow.java | 2 +- ...033ControllerUnpauseSignatureWorkflow.java | 2 +- ...034ControllerUseConditionalRecipients.java | 6 +- .../EG035ControllerScheduledSending.java | 4 +- .../EG036ControllerDelayedRouting.java | 4 +- .../examples/EG037ControllerSMSDelivery.java | 4 +- .../examples/M001GetMonitoringData.java | 4 +- .../examples/M002WebQueryEndpoint.java | 4 +- .../examples/R001ControllerCreateRoom.java | 2 +- .../R002ControllerCreateRoomWithTemplate.java | 2 +- .../R003ControllerExportingDataFromRoom.java | 2 +- .../R004ControllerAddingFormsToRoom.java | 2 +- .../R005ControllerGetRoomsWithFilters.java | 2 +- ...ntrollerCreateExternalFormFillSession.java | 2 +- .../R007ControllerCreateFormGroup.java | 2 +- ...ontrollerGrantOfficeAccessToFormGroup.java | 2 +- .../R009ControllerAssignFormToFormGroup.java | 6 +- .../core/controller/AbstractController.java | 38 ++- .../core/controller/IndexController.java | 17 +- .../core/model/manifestModels/APIs.java | 15 ++ .../manifestModels/ManifestStructure.java | 2 +- .../model/manifestModels/SupportingTexts.java | 2 + .../JWTAuthorizationCodeResourceDetails.java | 5 +- src/main/resources/public/assets/css.css | 16 ++ src/main/resources/public/assets/search.js | 238 ++++++++++++++++++ .../templates/views/pages/admin/index.jsp | 80 ------ .../templates/views/pages/click/index.jsp | 79 ------ .../views/pages/esignature/index.jsp | 99 +++++--- .../templates/views/pages/monitor/index.jsp | 77 ------ .../templates/views/pages/rooms/index.jsp | 79 ------ .../WEB-INF/templates/views/partials/foot.jsp | 4 + 73 files changed, 502 insertions(+), 519 deletions(-) create mode 100644 src/main/java/com/docusign/core/model/manifestModels/APIs.java create mode 100644 src/main/resources/public/assets/search.js delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp diff --git a/code-examples-java.iml b/code-examples-java.iml index 70016873..e0467c98 100644 --- a/code-examples-java.iml +++ b/code-examples-java.iml @@ -1,9 +1,7 @@ - - + + diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index b3f8311e..87637a91 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -82,20 +82,8 @@ public class DSConfiguration { @Value("${DS_ADMIN_BASE_PATH}") private String adminBasePath; - @Value("${AdminManifest}") - private String adminManifest; - - @Value("${ESignatureManifest}") - private String eSignatureManifest; - - @Value("${ClickManifest}") - private String clickManifest; - - @Value("${RoomsManifest}") - private String roomsManifest; - - @Value("${MonitorManifest}") - private String monitorManifest; + @Value("${CodeExamplesManifest}") + private String codeExamplesManifest; public String examplesApiPath = "examplesApi.json"; @@ -146,7 +134,7 @@ public ManifestStructure getCodeExamplesText() { } try { - String json = loadFileData(getTextManifestDependingOnCurrentAPI()); + String json = loadFileData(codeExamplesManifest); codeExamplesText = new ObjectMapper().readValue(json, ManifestStructure.class); } catch (JSONException | IOException e){ e.printStackTrace(); @@ -157,35 +145,7 @@ public ManifestStructure getCodeExamplesText() { return codeExamplesText; } - private String getTextManifestDependingOnCurrentAPI() throws IOException { - String linkToManifest = ""; - - ApiIndex selectedApiIndex = getSelectedApiIndex(); - if (selectedApiIndex == ApiIndex.ESIGNATURE) - { - linkToManifest = eSignatureManifest; - } - else if (selectedApiIndex == ApiIndex.CLICK) - { - linkToManifest = clickManifest; - } - else if (selectedApiIndex == ApiIndex.ROOMS) - { - linkToManifest = roomsManifest; - } - else if (selectedApiIndex == ApiIndex.MONITOR) - { - linkToManifest = monitorManifest; - } - else if (selectedApiIndex == ApiIndex.ADMIN) - { - linkToManifest = adminManifest; - } - - return linkToManifest; - } - - private String loadFileData(String filePath) throws Exception { + public String loadFileData(String filePath) throws Exception { URL fullRequestPath = new URL(filePath); HttpURLConnection httpConnection = (HttpURLConnection) fullRequestPath.openConnection(); httpConnection.setRequestMethod(HttpMethod.GET); diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index 02b5741e..b7b655be 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -84,7 +84,6 @@ public FilterRegistrationBean oAuth2ClientFilterRegis private List getScopes() throws IOException { return Arrays.asList(dsConfiguration.getSelectedApiType().getScopes()); - } private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() throws IOException { diff --git a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java index 40ca8a12..1dd1794d 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A001AddActiveUser.java @@ -5,6 +5,7 @@ import com.docusign.admin.model.*; import com.docusign.common.WorkArguments; import com.docusign.controller.admin.services.AddActiveUserService; +import com.docusign.core.model.ApiType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -91,8 +92,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(result) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java index 06a7675f..efe6fc5f 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java +++ b/src/main/java/com/docusign/controller/admin/examples/A002CreateActiveCLMESignUser.java @@ -91,7 +91,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception if (groups.getTotalCount() == 0) { - throw new ApiException(getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage); + throw new ApiException(getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage); } } @@ -124,8 +124,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(result) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java index 6d1ea280..b4bec932 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003BulkExportUserData.java @@ -85,8 +85,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .bulkExportsUserData(bulkExportsApi, this.getOrganizationId(this.user.getAccessToken(), this.session.getBasePath())); // Process results DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText.replaceFirst("\\{0}", saveFilePath)) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText.replaceFirst("\\{0}", saveFilePath)) .withJsonObject(results).addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java index 93db0d31..5d4b9e01 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A003aCheckRequestStatus.java @@ -54,8 +54,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().AdditionalPage.get(0).ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).AdditionalPage.get(0).ResultsPageText) .withJsonObject(result) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java index fa2e7c3c..cde634cd 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004BulkImportUserData.java @@ -46,8 +46,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(result) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java index e0c03bd2..64750b73 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java +++ b/src/main/java/com/docusign/controller/admin/examples/A004CheckImportRequestStatus.java @@ -70,8 +70,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(result) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java index 43132f3c..966b1867 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java +++ b/src/main/java/com/docusign/controller/admin/examples/A005AuditUsers.java @@ -58,8 +58,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Process results DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(resultsArr).addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java b/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java index bce005ae..ea0545aa 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java +++ b/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java @@ -39,8 +39,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .getDocuSignProfileByEmailAddress(usersApi, organizationId, args.getEmail()); // Step 3 end DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(usersResponse.getUsers()).addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java b/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java index ee310400..5983a4f8 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java +++ b/src/main/java/com/docusign/controller/admin/examples/A007RetrieveDocuSignProfileByUserID.java @@ -40,8 +40,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse getDocuSignProfileByUserId(usersApi, organizationId, args.getUserId()); // Step 3 end DoneExample - .createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + .createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(usersResponse.getUsers()).addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java b/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java index c7a65a0a..0f8fee4d 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java +++ b/src/main/java/com/docusign/controller/admin/examples/A008UpdateUserProductPermissionProfile.java @@ -125,8 +125,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse existingAccountId ); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(productPermissionProfile) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java index 4dfdc22e..70f5ebd0 100644 --- a/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java +++ b/src/main/java/com/docusign/controller/admin/examples/A009DeleteUserProductPermissionProfile.java @@ -123,8 +123,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse organizationId, existingAccountId); //Step 5 end - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(removeUserProductsRepsonse) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java index 13d3f905..b7f3aaf7 100644 --- a/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C001ControllerCreateClickwrap.java @@ -61,7 +61,7 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) - .withMessage(getTextForCodeExample().ResultsPageText.replaceFirst("\\{0}", createdClickwrap.getClickwrapName())) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText.replaceFirst("\\{0}", createdClickwrap.getClickwrapName())) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java index 0c9b7459..bf186483 100644 --- a/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C002ControllerActivateClickwrap.java @@ -64,7 +64,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(updatedClickwrap) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java index 636c7d31..78187d63 100644 --- a/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C003ControllerCreateNewVersionClickwrap.java @@ -69,7 +69,7 @@ protected Object doWork(WorkArguments args, ModelMap model, this.session.setClickwrapVersionNumber(createdClickwrap.getVersionNumber()); DoneExample.createDefault(this.title) .withJsonObject(createdClickwrap) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", createdClickwrap.getVersionNumber()) .replaceFirst("\\{1}", createdClickwrap.getClickwrapName())) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java index bba87792..7fe1364b 100644 --- a/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java +++ b/src/main/java/com/docusign/controller/click/examples/C004ControllerGetListClickwraps.java @@ -46,7 +46,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(clickwrapsResponse) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java index bb4e3547..cc31d382 100644 --- a/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java +++ b/src/main/java/com/docusign/controller/click/examples/C005ControllerGetClickwrapResponses.java @@ -59,7 +59,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(clickwrapAgreementsResponse) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java index 5d3e90b2..bd113097 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG002ControllerSigningViaEmail.java @@ -63,8 +63,8 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) ) .withJsonObject(envelopeSummary) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java index 90583d57..e3cc5ca7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG003ControllerListEnvelopes.java @@ -44,8 +44,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(envelopesInformation) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java index ec70ba97..2a51221b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG004ControllerEnvelopeInfo.java @@ -55,9 +55,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId(), session.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelope) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java index b6540ee4..fd8bf836 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG005ControllerEnvelopeRecipients.java @@ -51,9 +51,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId(), session.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(recipients) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java index a18f5469..28ea009a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG006ControllerEnvelopeDocs.java @@ -77,9 +77,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopeDocItems.add(new EnvelopeDocumentInfo(documentName, doc.getType(), doc.getDocumentId())); } - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelopeDocumentsResult) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java index 05b837f8..204da22f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG008ControllerCreateTemplate.java @@ -59,9 +59,9 @@ protected Object doWork(WorkArguments args, ModelMap model, EnvelopeTemplate template = envelopeTemplateResults.getEnvelopeTemplates().get(0); session.setTemplateId(template.getTemplateId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withMessage( - "The template already exists in your account." + getTextForCodeExample().ResultsPageText + "The template already exists in your account." + getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", template.getName()).replaceFirst("\\{1}", template.getTemplateId())) .addToModel(model, config); } else { @@ -69,9 +69,9 @@ protected Object doWork(WorkArguments args, ModelMap model, TemplateSummary template = CreateTemplateService.createTemplate(apiClient, accountId, CreateTemplateService.makeTemplate("Example Signer and CC template")); session.setTemplateId(template.getTemplateId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withMessage( - "The template has been created!" + getTextForCodeExample().ResultsPageText + "The template has been created!" + getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", template.getName()).replaceFirst("\\{1}", template.getTemplateId())) .addToModel(model, config); } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java index 5d1ea504..38402fe0 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG009ControllerUseTemplate.java @@ -71,9 +71,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelope); session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelopeSummary) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java index e4c45252..c19abc11 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG010ControllerSendBinaryDocs.java @@ -52,8 +52,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String envelopeId = obj.getString("envelopeId"); session.setEnvelopeId(envelopeId); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeId) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 9beb6fa6..9ea51b51 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -75,8 +75,8 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 2. call Envelopes::create API method EnvelopeSummary envelopeSummary = CollectPaymentService.collectPayment(envelopesApi, envelope, session.getAccountId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java index 4a4bd9fb..b2543c4e 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG015ControllerGetTabValues.java @@ -51,9 +51,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelopesApi, session.getAccountId(), session.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelopeFormData) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java index d5c461d3..b8cc2c0a 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG018ControllerEnvelopeCustomFieldValues.java @@ -54,9 +54,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse session.getEnvelopeId() ); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(customFieldsEnvelope) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java index 06cbc6e1..679dfa71 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG019ControllerAccessCodeAuthentication.java @@ -59,9 +59,9 @@ protected Object doWork(WorkArguments args, ModelMap model, ); session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelopeSummary) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", session.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index fb662944..3f37ffc9 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -78,7 +78,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse logger.info("workflowId = " + workflowId); if (workflowId.equals("")) { - throw new ApiException(0, getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage); + throw new ApiException(0, getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage); }EnvelopeDefinition envelope = PhoneAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), args.getCountryCode(), args.getPhoneNumber(), workflowId); // Step 4.1 start @@ -86,9 +86,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 4.1 end session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(results) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", results.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java index a9d41ec5..269adf9f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG022ControllerKBAAuthentication.java @@ -56,9 +56,9 @@ protected Object doWork(WorkArguments args, ModelMap model, ); session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelopeSummary) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java index 9259d7f6..2196fef8 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG023ControllerIdvAuthentication.java @@ -53,7 +53,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse logger.info("workflowId = " + workflowId); if (workflowId.equals("")) { - throw new ApiException(0, getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage); + throw new ApiException(0, getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage); } // Step 4-1 start EnvelopeDefinition envelope = IdvAuthenticationService.createEnvelope(args.getSignerName(), args.getSignerEmail(), workflowId); @@ -63,9 +63,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // Step 5 end session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(results) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", results.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java index 6a40cf23..8a01b900 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG024ControllerPermissionCreate.java @@ -50,9 +50,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getPermissionProfileName() ); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(newProfile) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", newProfile.getPermissionProfileId()) .replaceFirst("\\{1}", newProfile.getPermissionProfileName()) ) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java index 9e4acc1e..70aeb358 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG025ControllerPermissionSetUserGroups.java @@ -76,15 +76,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .withTitle(exampleName) .withName(title) .withMessage( - getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage + getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage + "< br />Reason:" + errorDetails.getMessage()) .addToModel(model, config); return ERROR_PAGE; } - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(newGroupInfo) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java index aecca6c9..4529c245 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG026ControllerPermissionChangeSingleSetting.java @@ -82,8 +82,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse curProfileId ); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", newProfile.getPermissionProfileId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java index b4e5c48e..2afb7927 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG027ControllerPermissionDelete.java @@ -59,8 +59,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse PermissionDeleteService.permissionDelete(accountsApi, session.getAccountId(), curProfileId); // Step 4: Show 'done' (successful) page - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText.replaceFirst("\\{0}", curProfileId)) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText.replaceFirst("\\{0}", curProfileId)) .addToModel(model, config); return DONE_EXAMPLE_PAGE; @@ -68,7 +68,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse new DoneExample() .withTitle(exampleName) .withName(title) - .withMessage(getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage) .addToModel(model, config); return ERROR_PAGE; diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java index b2d409c2..346cd75d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG028ControllerCreateBrand.java @@ -60,9 +60,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse session.getAccountId() ); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(brandsResponse) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", brandsResponse.getBrands().get(0).getBrandId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java index 6172252e..d6949cb3 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG029ControllerApplyBrandToEnvelope.java @@ -69,9 +69,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelope ); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelopeSummary) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java index 86d32f09..9a7c50d2 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG030ControllerApplyBrandToTemplate.java @@ -85,9 +85,9 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse envelope ); - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(envelopeSummary) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java index 60753e58..bd2d97f4 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG031ControllerBulkSendEnvelopes.java @@ -93,12 +93,12 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // For 2000 recipients, it can take about an hour BulkSendBatchStatus status = bulkEnvelopesApi.getBulkSendBatchStatus(accountId, batchId); // Step 7 end - DoneExample.createDefault(getTextForCodeExample().ExampleName) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) .withJsonObject(status) .withMessage(String.join( "", "Bulk request queued to ", status.getQueued(), " user lists.")) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; @@ -109,7 +109,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse .withTitle(exampleName) .withName(title) .withMessage( - getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage + getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage + "< br />Reason:" + exception.getMessage() ) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index 4180462d..4100b9dd 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -62,7 +62,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) .withJsonObject(envelopeSummary) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", this.session.getEnvelopeId()) ) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index 5e98afb0..e192baeb 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -49,7 +49,7 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse DoneExample.createDefault(this.title) .withJsonObject(envelopeUpdateSummary) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index 68389d57..bac01471 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -65,15 +65,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse this.session.setEnvelopeId(envelopeSummary.getEnvelopeId()); DoneExample.createDefault(this.title) .withJsonObject(envelopeSummary) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", this.session.getEnvelopeId())) .addToModel(model, config); } catch (ApiException apiException) { - if (!apiException.getMessage().contains(getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessageCheck)) { + if (!apiException.getMessage().contains(getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessageCheck)) { throw apiException; } DoneExample.createDefault(this.title) - .withMessage(getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage) .addToModel(model, config); } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java index e475100f..21ecebf7 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG035ControllerScheduledSending.java @@ -74,8 +74,8 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", results.getEnvelopeId()) ) .withJsonObject(results) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java index 3f88a6d4..3e4b9e2f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java @@ -70,8 +70,8 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(results.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", results.getEnvelopeId()) ) .withJsonObject(results) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java index 2fb6cea5..fbf9da2f 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java @@ -63,8 +63,8 @@ protected Object doWork(WorkArguments args, ModelMap model, // process results session.setEnvelopeId(envelopeSummary.getEnvelopeId()); - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", envelopeSummary.getEnvelopeId()) ) .withJsonObject(envelopeSummary) diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 3e531c35..00c352e7 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -47,8 +47,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String monitoringDataCleaned = monitoringData.toString().replaceAll("'", ""); // Process results - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(monitoringDataCleaned) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java index 05e5dc78..a4ad8b1a 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java @@ -71,8 +71,8 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse String queryResultCleaned = queryResult.toString().replaceAll("'", ""); // Process results - DoneExample.createDefault(getTextForCodeExample().ExampleName) - .withMessage(getTextForCodeExample().ResultsPageText) + DoneExample.createDefault(getTextForCodeExample(getAPITypeFromLink()).ExampleName) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(queryResultCleaned) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java index f2a124e4..6c0a0ee3 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R001ControllerCreateRoom.java @@ -55,7 +55,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(createdRoom) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", createdRoom.getName()) .replaceFirst("\\{1}", createdRoom.getRoomId().toString()) ) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java index 4f1785c3..0e59aa07 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R002ControllerCreateRoomWithTemplate.java @@ -74,7 +74,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(createdRoom) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", createdRoom.getName()) .replaceFirst("\\{1}", createdRoom.getRoomId().toString()) ) diff --git a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java index a59bf506..d888f84f 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R003ControllerExportingDataFromRoom.java @@ -61,7 +61,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(fieldData) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java index 9037a83d..b6612d84 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R004ControllerAddingFormsToRoom.java @@ -71,7 +71,7 @@ protected Object doWork(WorkArguments args, ModelMap model, args.getRoomId()); DoneExample.createDefault(this.title) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .withJsonObject(roomDocument) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java index d0ce41dc..ca5f4c69 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R005ControllerGetRoomsWithFilters.java @@ -70,7 +70,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(rooms) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java index cc218209..c58d7c70 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R006ControllerCreateExternalFormFillSession.java @@ -76,7 +76,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(externalFormFillSession) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText) .addToModel(model, config); return DONE_EXAMPLE_PAGE; } diff --git a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java index 40e9f86d..801e5e56 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R007ControllerCreateFormGroup.java @@ -50,7 +50,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(formGroup) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", formGroup.getName())) .addToModel(model, config); return DONE_EXAMPLE_PAGE; diff --git a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java index a5bad4a7..750f1301 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R008ControllerGrantOfficeAccessToFormGroup.java @@ -75,7 +75,7 @@ protected Object doWork(WorkArguments args, ModelMap model, // Step 5 End DoneExample.createDefault(this.title) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", String.valueOf(args.getOfficeId())) .replaceFirst("\\{1}", String.valueOf(args.getFormGroupId()))) .addToModel(model, config); diff --git a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java index 00ea6b4e..3498eb90 100644 --- a/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java +++ b/src/main/java/com/docusign/controller/rooms/examples/R009ControllerAssignFormToFormGroup.java @@ -78,7 +78,7 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withJsonObject(formGroupFormToAssign) - .withMessage(getTextForCodeExample().ResultsPageText + .withMessage(getTextForCodeExample(getAPITypeFromLink()).ResultsPageText .replaceFirst("\\{0}", String.valueOf(args.getOfficeId())) .replaceFirst("\\{1}", String.valueOf(args.getFormGroupId()))) .addToModel(model, config); @@ -87,9 +87,9 @@ protected Object doWork(WorkArguments args, ModelMap model, DoneExample.createDefault(this.title) .withMessage(FORM_ALREADY_EXISTS_ERROR_MESSAGE) .addToModel(model, config); - } else if (apiException.getMessage().contains(getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessageCheck)) { + } else if (apiException.getMessage().contains(getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessageCheck)) { DoneExample.createDefault(this.title) - .withMessage(getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage) + .withMessage(getTextForCodeExample(getAPITypeFromLink()).CustomErrorTexts.get(0).ErrorMessage) .addToModel(model, config); } diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index 060617f2..b4584d58 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -2,10 +2,13 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.core.model.ApiType; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; +import com.docusign.core.model.manifestModels.APIs; import com.docusign.core.model.manifestModels.CodeExampleText; +import com.docusign.core.model.manifestModels.ManifestGroup; import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.oauth2.client.OAuth2ClientContext; @@ -17,6 +20,7 @@ import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.Arrays; import java.util.Objects; @@ -62,12 +66,12 @@ public AbstractController(DSConfiguration config, String exampleName) { this.pagePath = this.getExamplePagesPath() + exampleName; } - public CodeExampleText getTextForCodeExample() { + public CodeExampleText getTextForCodeExample(ApiType apiType) { if (codeExampleText != null) { return codeExampleText; } - codeExampleText = GetExampleText(); + codeExampleText = GetExampleText(apiType); return codeExampleText; } @@ -110,7 +114,7 @@ public Object create(WorkArguments args, ModelMap model, HttpServletResponse res * @throws Exception if calling API has failed */ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { - this.title = getTextForCodeExample().ExampleName; + this.title = getTextForCodeExample(getAPITypeFromLink()).ExampleName; Class clazz = Objects.requireNonNullElse(getClass().getEnclosingClass(), getClass()); String srcPath = String.join("", config.getExampleUrl(), clazz.getName().replace('.', '/'), ".java"); @@ -123,7 +127,7 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception model.addAttribute("title", title); model.addAttribute("viewSourceFile", viewSourceFile); model.addAttribute("documentation", config.getDocumentationPath() + exampleName); - model.addAttribute(EXAMPLE_TEXT, getTextForCodeExample()); + model.addAttribute(EXAMPLE_TEXT, getTextForCodeExample(getAPITypeFromLink())); model.addAttribute(LAUNCHER_TEXTS, config.getCodeExamplesText().SupportingTexts); } @@ -171,15 +175,33 @@ private boolean isTokenExpired() { return tokenExpired; } + protected ApiType getAPITypeFromLink() { + if (this.exampleName.contains("m")){ + return ApiType.MONITOR; + }else if (this.exampleName.contains("a")){ + return ApiType.ADMIN; + }else if (this.exampleName.contains("c")){ + return ApiType.CLICK; + }else if (this.exampleName.contains("r")){ + return ApiType.ROOMS; + }else { + return ApiType.ESIGNATURE; + } + } + + protected CodeExampleText GetExampleText(ApiType apiType) { + var manifestGroups = ((APIs) Arrays + .stream(config.getCodeExamplesText().APIs.toArray()) + .filter(x -> apiType.name().toLowerCase().contains(((APIs) x).Name.toLowerCase())) + .findFirst() + .orElse(null)).Groups; - protected CodeExampleText GetExampleText() { - var groups = config.getCodeExamplesText().Groups; var exampleNumberToSearch = Integer.parseInt(this.exampleName.replaceAll("\\D+", "")); - for(var i = 0; i < groups.size(); ++i) + for(var i = 0; i < manifestGroups.size(); ++i) { CodeExampleText codeExampleText = (CodeExampleText) Arrays - .stream(groups.get(i).Examples.toArray()) + .stream(manifestGroups.get(i).Examples.toArray()) .filter(x -> ((CodeExampleText) x).ExampleNumber == exampleNumberToSearch) .findFirst() .orElse(null); diff --git a/src/main/java/com/docusign/core/controller/IndexController.java b/src/main/java/com/docusign/core/controller/IndexController.java index bc790868..3a0b21ae 100644 --- a/src/main/java/com/docusign/core/controller/IndexController.java +++ b/src/main/java/com/docusign/core/controller/IndexController.java @@ -16,9 +16,16 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.text.SimpleDateFormat; import java.util.List; import java.util.Objects; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.datatype.joda.JodaModule; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; @@ -46,6 +53,7 @@ public class IndexController { private static final String ATTR_TITLE = "title"; private static final String LAUNCHER_TEXTS = "launcherTexts"; private static final String CODE_EXAMPLE_GROUPS = "codeExampleGroups"; + private static final String API_DATA = "APIData"; @Autowired private Session session; @@ -60,19 +68,20 @@ public class IndexController { private DSConfiguration config; @GetMapping(path = "/") - public String index(ModelMap model, HttpServletResponse response) throws IOException { + public String index(ModelMap model, HttpServletResponse response) throws Exception { model.addAttribute(ATTR_TITLE,"Home"); - if (config.getQuickstart().equals("true") && config.getSelectedApiIndex().equals(ApiIndex.ESIGNATURE) && + if (config.getQuickstart().equals("true") && !(SecurityContextHolder.getContext().getAuthentication() instanceof OAuth2Authentication)){ - String site = config.getSelectedApiIndex().getPathOfFirstExample(); + String site = ApiIndex.ESIGNATURE.getPathOfFirstExample(); response.setStatus(response.SC_MOVED_TEMPORARILY); response.setHeader("Location", site); return null; } model.addAttribute(LAUNCHER_TEXTS, config.getCodeExamplesText().SupportingTexts); - model.addAttribute(CODE_EXAMPLE_GROUPS, config.getCodeExamplesText().Groups.toArray()); + model.addAttribute(CODE_EXAMPLE_GROUPS, config.getCodeExamplesText().APIs.toArray()); + model.addAttribute(API_DATA, config.loadFileData(config.getCodeExamplesManifest())); return session.getApiIndexPath(); } diff --git a/src/main/java/com/docusign/core/model/manifestModels/APIs.java b/src/main/java/com/docusign/core/model/manifestModels/APIs.java new file mode 100644 index 00000000..5cae44b3 --- /dev/null +++ b/src/main/java/com/docusign/core/model/manifestModels/APIs.java @@ -0,0 +1,15 @@ +package com.docusign.core.model.manifestModels; + +import lombok.Getter; +import lombok.Setter; + +import java.util.ArrayList; +import java.util.List; + +@Getter +@Setter +public class APIs { + public String Name; + + public List Groups = new ArrayList(); +} diff --git a/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java b/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java index b65d6aa3..33d11773 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java +++ b/src/main/java/com/docusign/core/model/manifestModels/ManifestStructure.java @@ -11,5 +11,5 @@ public class ManifestStructure { public SupportingTexts SupportingTexts; - public List Groups = new ArrayList(); + public List APIs = new ArrayList(); } diff --git a/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java b/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java index d5985574..01331c7b 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java +++ b/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java @@ -24,6 +24,8 @@ public class SupportingTexts { public String LogoutButton; + public String SearchFailed; + public String ChangeAPITypeButton; public String WelcomeText; diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 46e6106b..535d50a3 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -4,6 +4,7 @@ import com.docusign.core.exception.LauncherException; import com.docusign.core.model.ApiType; import com.docusign.esign.client.ApiClient; +import io.swagger.annotations.Api; import lombok.Getter; import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; @@ -11,6 +12,8 @@ import org.springframework.security.oauth2.client.token.grant.redirect.AbstractRedirectResourceDetails; import org.springframework.util.FileCopyUtils; import java.io.IOException; +import java.lang.reflect.Array; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -43,11 +46,9 @@ public ApiClient getApiClient() { return apiClient; } - public List getScopes() throws IOException { ApiType apiType = dsConfiguration.getSelectedApiType(); return Arrays.asList(apiType.getScopes()); - } } diff --git a/src/main/resources/public/assets/css.css b/src/main/resources/public/assets/css.css index 1aedd5d9..5518c422 100644 --- a/src/main/resources/public/assets/css.css +++ b/src/main/resources/public/assets/css.css @@ -144,4 +144,20 @@ pre.json-display { .your-class div{ float:left; margin-left: 10px; +} + +.has-search .form-control { + padding-left: 2.375rem; +} + +.has-search .form-control-feedback { + position: absolute; + z-index: 2; + display: block; + width: 2.375rem; + height: 2.375rem; + line-height: 2.375rem; + text-align: center; + pointer-events: none; + color: #aaa; } \ No newline at end of file diff --git a/src/main/resources/public/assets/search.js b/src/main/resources/public/assets/search.js new file mode 100644 index 00000000..7d57ea51 --- /dev/null +++ b/src/main/resources/public/assets/search.js @@ -0,0 +1,238 @@ +let DS_SEARCH = (function () { + const API_TYPES = { + ESIGNATURE: 'esignature', + MONITOR: 'monitor', + CLICK: 'click', + ROOMS: 'rooms', + ADMIN: 'admin', + }; + + let processJSONData = function() { + let json_raw = $("#api_json_data").text(), + jsonData = json_raw ? JSON.parse(json_raw) : false; + + return jsonData; + } + + function checkIfExampleMatches(example, matches) { + const name = example.ExampleName; + const description = example.ExampleDescription; + const pathNames = example.LinksToAPIMethod.map(a => a.PathName); + + for (let i = 0; i < matches.length; i++) { + if (name === matches[i].value || description === matches[i].value || pathNames.indexOf(matches[i].value) > -1) { + return true; + } + } + + return false; + } + + function clearNonMatchingExamples(examples, matches) { + for (let i = examples.length - 1; i >= 0; i--) { + if (!checkIfExampleMatches(examples[i], matches)) { + examples.splice(i, 1); + } + } + } + + function clearResultsAfterMatching(api, matches) { + const groups = api.Groups; + + for (let i = groups.length - 1; i >= 0; i--) { + const group = groups[i]; + clearNonMatchingExamples(group.Examples, matches); + + if (group.Examples.length === 0) { + groups.splice(i, 1); + } + } + } + + let findCodeExamplesByKeywords = function(json, pattern) { + const options = { + isCaseSensitive: false, + minMatchCharLength: pattern.length, + threshold: -0.0, + includeMatches: true, + ignoreLocation: true, + useExtendedSearch: true, + keys: [ + "Groups.Examples.ExampleName", + "Groups.Examples.ExampleDescription", + "Groups.Examples.LinksToAPIMethod.PathName" + ] + }; + + const fuse = new Fuse(json, options); + + var searchResults = fuse.search(JSON.stringify(pattern)) + + searchResults.forEach(searchResult => clearResultsAfterMatching(searchResult.item, searchResult.matches)); + + return searchResults; + } + + let getExamplesByAPIType = function(apiType, codeExamples) { + let codeExamplesByAPI = codeExamples.find(x => x.Name.toLowerCase() === apiType); + + if (codeExamplesByAPI != null) { + return [codeExamplesByAPI]; + } else { + return null; + } + } + + let getEnteredAPIType = function(inputValue) { + const inputLength = inputValue.length; + + for (const key in API_TYPES) { + if (Object.hasOwnProperty.call(API_TYPES, key)) { + const apiType = API_TYPES[key]; + const comparedValue = apiType.substr(0, inputLength); + + if(inputValue === comparedValue){ + return apiType; + } + } + } + + return null; + } + + function getLinkForApiType(apiName) { + switch (apiName) { + case API_TYPES.ADMIN: + return "a"; + case API_TYPES.CLICK: + return "c"; + case API_TYPES.ROOMS: + return "r"; + case API_TYPES.MONITOR: + return "m"; + case API_TYPES.ESIGNATURE: + return "eg" + } + } + + let addCodeExampleToHomepage = function(codeExamples) { + codeExamples.forEach( + element => { + let linkToCodeExample = getLinkForApiType(element.Name.toLowerCase()); + + element.Groups.forEach( + group => { + $("#filtered_code_examples").append("

    " + group.Name + "

    "); + + group.Examples.forEach( + example => { + if (!example.SkipForLanguages || !example.SkipForLanguages.toLowerCase().includes("c#")) + { + $("#filtered_code_examples").append( + "

    " + + "" + + example.ExampleName + + "

    " + ); + + $("#filtered_code_examples").append("

    " + example.ExampleDescription + "

    "); + + $("#filtered_code_examples").append("

    "); + + if (example.LinksToAPIMethod.length == 1) + { + $("#filtered_code_examples").append(processJSONData().SupportingTexts.APIMethodUsed); + } + else + { + $("#filtered_code_examples").append(processJSONData().SupportingTexts.APIMethodUsedPlural); + } + + for (let index = 0; index < example.LinksToAPIMethod.length; index++) { + $("#filtered_code_examples").append( + " " + + example.LinksToAPIMethod[index].PathName + + "" + ); + + if (index + 1 === example.LinksToAPIMethod.length) + { + $("#filtered_code_examples").append(""); + } + else if (index + 1 === example.LinksToAPIMethod.length - 1) + { + $("#filtered_code_examples").append(" and "); + } + else + { + $("#filtered_code_examples").append(", "); + } + + } + + $("#filtered_code_examples").append("

    "); + } + } + ); + } + ); + } + ); + } + + let textCouldNotBeFound = function() { + $("#filtered_code_examples").append(processJSONData().SupportingTexts.SearchFailed); + } + + return { + processJSONData: processJSONData, + getEnteredAPIType: getEnteredAPIType, + getExamplesByAPIType: getExamplesByAPIType, + findCodeExamplesByKeywords: findCodeExamplesByKeywords, + textCouldNotBeFound: textCouldNotBeFound, + addCodeExampleToHomepage: addCodeExampleToHomepage + } +})(); + +const input = document.getElementById('code_example_search'); + +input.addEventListener('input', updateValue); + +function updateValue(esearchPattern) { + document.getElementById('filtered_code_examples').innerHTML = ""; + + const inputValue = esearchPattern.target.value.toLowerCase(); + const json = DS_SEARCH.processJSONData().APIs; + let tempJson = json; + + if (inputValue === "") + { + DS_SEARCH.addCodeExampleToHomepage(tempJson); + } + else + { + const apiType = DS_SEARCH.getEnteredAPIType(inputValue); + + if (apiType !== null) + { + const adminExamples = DS_SEARCH.getExamplesByAPIType(apiType, tempJson); + DS_SEARCH.addCodeExampleToHomepage(adminExamples); + } + else + { + const result = DS_SEARCH.findCodeExamplesByKeywords(tempJson, inputValue); + if (result.length < 1) { + DS_SEARCH.textCouldNotBeFound(); + } else { + result.forEach(x => { + DS_SEARCH.addCodeExampleToHomepage([x.item]); + }); + } + } + } +} diff --git a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp deleted file mode 100644 index 40000d6b..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/admin/index.jsp +++ /dev/null @@ -1,80 +0,0 @@ -<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> - - - - -
    -
    - - - - - - -
    -

    Java Launcher

    -

    ${launcherTexts.getHomePageText()}

    -
    - -
    -
    - - -
    - -

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -
    - - -

    ${group.getName()}

    - - - -

    - ${example.getExampleNumber()}. - - ${example.getExampleName()} - -

    - -

    ${example.getExampleDescription()}

    - -

    - - - ${launcherTexts.getAPIMethodUsed()} - - - ${launcherTexts.getAPIMethodUsedPlural()} - - - - - - ${link.getPathName()} - - - - - . - - - and - - - , - - - -

    -
    -
    -
    -
    - - - - - - - diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp deleted file mode 100644 index 06cabfe4..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ /dev/null @@ -1,79 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - -
    -
    - - - - - - -
    -

    Java Launcher

    -

    ${launcherTexts.getHomePageText()}

    -
    - -
    -
    - - -
    - -

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -
    - - -

    ${group.getName()}

    - - - -

    - ${example.getExampleNumber()}. - - ${example.getExampleName()} - -

    - -

    ${example.getExampleDescription()}

    - -

    - - - ${launcherTexts.getAPIMethodUsed()} - - - ${launcherTexts.getAPIMethodUsedPlural()} - - - - - - ${link.getPathName()} - - - - - . - - - and - - - , - - - -

    -
    -
    -
    -
    - - - - - - diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index ef7c02d1..ff6e10c7 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -26,53 +26,86 @@

    Documentation on using OAuth Authorization Code Grant from a Java application.

    - -

    ${group.getName()}

    + - -

    - - ${example.getExampleName()} - -

    + -

    ${example.getExampleDescription()}

    +
    + + + + + + + + + + + + + + + + + + + + + +

    ${group.getName()}

    + + +

    + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    + +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + + + + + ${link.getPathName()} + -

    - - ${launcherTexts.getAPIMethodUsed()} + + . + + + and - ${launcherTexts.getAPIMethodUsedPlural()} + , - - - - ${link.getPathName()} - - - - - . - - - and - - - , - - + +

    +
    -

    - +
    - + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp deleted file mode 100644 index 484ff4de..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/monitor/index.jsp +++ /dev/null @@ -1,77 +0,0 @@ -<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> - - -
    -
    - - - - - - -
    -

    Java Launcher

    -

    ${launcherTexts.getHomePageText()}

    -
    - -
    -
    - -
    - -

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -
    - - -

    ${group.getName()}

    - - - -

    - ${example.getExampleNumber()}. - - ${example.getExampleName()} - -

    - -

    ${example.getExampleDescription()}

    - -

    - - - ${launcherTexts.getAPIMethodUsed()} - - - ${launcherTexts.getAPIMethodUsedPlural()} - - - - - - ${link.getPathName()} - - - - - . - - - and - - - , - - - -

    -
    -
    -
    -
    - - - - - - - diff --git a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp deleted file mode 100644 index 86e725bd..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/rooms/index.jsp +++ /dev/null @@ -1,79 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - - - -
    -
    - - - - - - -
    -

    Java Launcher

    -

    ${launcherTexts.getHomePageText()}

    -
    - -
    -
    - - -
    - -

    Documentation on using OAuth Authorization Code Grant from a Java application.

    -
    - - -

    ${group.getName()}

    - - - -

    - ${example.getExampleNumber()}. - - ${example.getExampleName()} - -

    - -

    ${example.getExampleDescription()}

    - -

    - - - ${launcherTexts.getAPIMethodUsed()} - - - ${launcherTexts.getAPIMethodUsedPlural()} - - - - - - ${link.getPathName()} - - - - - . - - - and - - - , - - - -

    -
    -
    -
    -
    - - - - - - diff --git a/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp b/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp index 0c4b0d1c..3a2d4be6 100644 --- a/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp +++ b/src/main/webapp/WEB-INF/templates/views/partials/foot.jsp @@ -18,11 +18,15 @@ integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"> + + + + From bb42d9750bace099ab366f096298e8f01eb3ee5b Mon Sep 17 00:00:00 2001 From: annahileta Date: Thu, 20 Oct 2022 11:29:24 +0300 Subject: [PATCH 345/699] fixed issues with the login --- .gitignore | 1 - .../java/com/docusign/DSConfiguration.java | 2 - .../java/com/docusign/DSConfiguration.java | 33 ++++---------- .../java/com/docusign/WebSecurityConfig.java | 12 ++++- .../java/com/docusign/common/ApiIndex.java | 19 +++----- .../examples/AbstractMonitorController.java | 13 ++++-- .../core/controller/AbstractController.java | 9 ++-- .../controller/GlobalControllerAdvice.java | 15 ++----- .../core/controller/IndexController.java | 44 ------------------- .../JWTAuthorizationCodeResourceDetails.java | 10 ++++- src/main/resources/examplesApi.json | 1 - .../templates/views/pages/ds_select_api.jsp | 20 --------- .../WEB-INF/templates/views/partials/head.jsp | 4 -- 13 files changed, 50 insertions(+), 133 deletions(-) delete mode 100644 src/main/resources/examplesApi.json delete mode 100644 src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp diff --git a/.gitignore b/.gitignore index c10e79b4..96cc3880 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,4 @@ src/main/java/com/docusign/admin/ # according to gitignore.io this shouldnt be shared .factorypath src/main/resources/ExportedUserData.csv -examplesApi.json app.config diff --git a/Quick_ACG/src/main/java/com/docusign/DSConfiguration.java b/Quick_ACG/src/main/java/com/docusign/DSConfiguration.java index 57311b21..cdf1d70c 100644 --- a/Quick_ACG/src/main/java/com/docusign/DSConfiguration.java +++ b/Quick_ACG/src/main/java/com/docusign/DSConfiguration.java @@ -78,8 +78,6 @@ public class DSConfiguration { @Value("${DS_ADMIN_BASE_PATH}") private String adminBasePath; - public String examplesApiPath = "examplesApi.json"; - public String apiTypeHeader = "ApiType"; @Value("${ESignatureManifest}") diff --git a/src/main/java/com/docusign/DSConfiguration.java b/src/main/java/com/docusign/DSConfiguration.java index 87637a91..36c9c778 100644 --- a/src/main/java/com/docusign/DSConfiguration.java +++ b/src/main/java/com/docusign/DSConfiguration.java @@ -85,8 +85,6 @@ public class DSConfiguration { @Value("${CodeExamplesManifest}") private String codeExamplesManifest; - public String examplesApiPath = "examplesApi.json"; - public String apiTypeHeader = "ApiType"; public String getDsReturnUrl() { @@ -98,34 +96,19 @@ public String getDsPingUrl() { } public ApiType getSelectedApiType() throws IOException { - return ApiType.valueOf(getSelectedApi()); - } + if (selectedApiType == null){ + return ApiType.ESIGNATURE; + } - public ApiIndex getSelectedApiIndex() throws IOException { - return ApiIndex.valueOf(getSelectedApi()); + return ApiType.valueOf(selectedApiType); } - private String getSelectedApi() throws IOException { - if (selectedApiType != null){ - return selectedApiType; - } - - if(Boolean.valueOf(quickACG)){ - return ApiIndex.ESIGNATURE.name(); + public ApiIndex getSelectedApiIndex() throws IOException { + if (selectedApiType == null){ + return ApiIndex.ESIGNATURE; } - ClassPathResource resource = new ClassPathResource(examplesApiPath); - String source = StreamUtils.copyToString(resource.getInputStream(), StandardCharsets.UTF_8); - try { - Object apiTypeValues = new JSONObject(source).get(apiTypeHeader); - if (apiTypeValues == null || !EnumUtils.isValidEnum(ApiIndex.class, apiTypeValues.toString())) { - throw new JSONException(String.format("The wrong format of the %s file.", examplesApiPath)); - } - selectedApiType = apiTypeValues.toString(); - } catch (JSONException e){ - e.printStackTrace(); - } - return selectedApiType; + return ApiIndex.valueOf(selectedApiType); } public ManifestStructure getCodeExamplesText() { diff --git a/src/main/java/com/docusign/WebSecurityConfig.java b/src/main/java/com/docusign/WebSecurityConfig.java index b7b655be..90bbe446 100644 --- a/src/main/java/com/docusign/WebSecurityConfig.java +++ b/src/main/java/com/docusign/WebSecurityConfig.java @@ -83,7 +83,15 @@ public FilterRegistrationBean oAuth2ClientFilterRegis private List getScopes() throws IOException { - return Arrays.asList(dsConfiguration.getSelectedApiType().getScopes()); + ArrayList scopes = new ArrayList<>(); + + for (ApiType apiType : ApiType.values()) + { + for(String scope : apiType.getScopes()){ + scopes.add(scope); + } + } + return Arrays.asList(Arrays.stream(scopes.toArray()).distinct().toArray(String[]::new)); } private OAuth2ClientAuthenticationProcessingFilter authCodeGrantFilter() throws IOException { @@ -130,7 +138,7 @@ protected void configure(HttpSecurity http) throws Exception { .antMatcher("/**") .authorizeRequests() .antMatchers( "/", "/login**", "/error**", "/assets/**","/ds/mustAuthenticate**", - "/ds/authenticate**", "/ds/selectApi**") + "/ds/authenticate**") .permitAll() .anyRequest() .authenticated() diff --git a/src/main/java/com/docusign/common/ApiIndex.java b/src/main/java/com/docusign/common/ApiIndex.java index 6ea59e49..a56352e8 100644 --- a/src/main/java/com/docusign/common/ApiIndex.java +++ b/src/main/java/com/docusign/common/ApiIndex.java @@ -1,18 +1,16 @@ package com.docusign.common; public enum ApiIndex { - ESIGNATURE("/pages/esignature/index", "/restapi", "/eg001"), - ROOMS("/pages/rooms/index", "/restapi", "/r001"), - CLICK("/pages/click/index", "/clickapi", "/c001"), - MONITOR("/pages/monitor/index", "", "/m001"), - ADMIN("/pages/admin/index", "/management", "/a001"); + ESIGNATURE( "/restapi", "/eg001"), + ROOMS( "/restapi", "/r001"), + CLICK("/clickapi", "/c001"), + MONITOR( "", "/m001"), + ADMIN("/management", "/a001"); - private final String indexPath; private final String baseUrlSuffix; private final String firstExamplePath; - ApiIndex(final String indexPath, final String baseUrlSuffix, final String firstExamplePath) { - this.indexPath = indexPath; + ApiIndex(final String baseUrlSuffix, final String firstExamplePath) { this.baseUrlSuffix = baseUrlSuffix; this.firstExamplePath = firstExamplePath; } @@ -24,9 +22,4 @@ public String getBaseUrlSuffix() { public String getPathOfFirstExample() { return firstExamplePath; } - - @Override - public String toString() { - return this.indexPath; - } } diff --git a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java index 4d1ad6cd..f7725a4d 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java +++ b/src/main/java/com/docusign/controller/monitor/examples/AbstractMonitorController.java @@ -1,12 +1,16 @@ package com.docusign.controller.monitor.examples; import com.docusign.DSConfiguration; +import com.docusign.WebSecurityConfig; import com.docusign.core.controller.AbstractController; import com.docusign.core.model.AuthType; import com.docusign.core.model.Session; +import com.docusign.core.security.jwt.JWTAuthorizationCodeResourceDetails; +import com.docusign.core.security.jwt.JWTOAuth2RestTemplate; import com.docusign.monitor.api.DataSetApi; import com.docusign.monitor.client.ApiClient; import org.springframework.http.HttpHeaders; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; import org.springframework.stereotype.Controller; /** @@ -27,10 +31,13 @@ protected String getExamplePagesPath() { protected String ensureUsageOfJWTToken(String accessToken, Session session) { if (session.getAuthTypeSelected() != AuthType.JWT || accessToken.isEmpty()){ - return REDIRECT_SELECT_API_PAGE; - } else { - return accessToken; + WebSecurityConfig securityConfig = new WebSecurityConfig(); + JWTAuthorizationCodeResourceDetails jwtCodeGrantClient = securityConfig.jwtCodeGrantClient(); + + OAuth2RestTemplate restTemplate = new JWTOAuth2RestTemplate(jwtCodeGrantClient, oAuth2ClientContext); + return restTemplate.getAccessToken().toString(); } + return accessToken; } /** diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index b4584d58..41626e8c 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -39,7 +39,7 @@ public abstract class AbstractController { private static final String REDIRECT_PREFIX = "redirect:"; - protected static final String REDIRECT_SELECT_API_PAGE = REDIRECT_PREFIX + "/ds/selectApi"; + protected static final String REDIRECT_AUTHENTICATION_PAGE = REDIRECT_PREFIX + "/ds/mustAuthenticate"; protected static final String BEARER_AUTHENTICATION = "Bearer "; protected static final String DONE_EXAMPLE_PAGE = "pages/example_done"; protected static final String DONE_EXAMPLE_PAGE_COMPARE = "pages/example_done_compare"; @@ -49,7 +49,7 @@ public abstract class AbstractController { protected static final String LAUNCHER_TEXTS = "launcherTexts"; @Autowired - private OAuth2ClientContext oAuth2ClientContext; + protected OAuth2ClientContext oAuth2ClientContext; @Autowired protected Session session; @@ -71,6 +71,7 @@ public CodeExampleText getTextForCodeExample(ApiType apiType) { return codeExampleText; } + config.setSelectedApiType(apiType.toString()); codeExampleText = GetExampleText(apiType); return codeExampleText; @@ -81,7 +82,7 @@ public CodeExampleText getTextForCodeExample(ApiType apiType) { @GetMapping public String get(WorkArguments args, ModelMap model) { if (isTokenExpired()) { - return REDIRECT_SELECT_API_PAGE; + return REDIRECT_AUTHENTICATION_PAGE; } try { @@ -95,7 +96,7 @@ public String get(WorkArguments args, ModelMap model) { @PostMapping public Object create(WorkArguments args, ModelMap model, HttpServletResponse response) { if (isTokenExpired()) { - return REDIRECT_SELECT_API_PAGE; + return REDIRECT_AUTHENTICATION_PAGE; } try { diff --git a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java index be018bc0..556a3306 100644 --- a/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java +++ b/src/main/java/com/docusign/core/controller/GlobalControllerAdvice.java @@ -45,16 +45,14 @@ public class GlobalControllerAdvice { private static final String ERROR_ACCOUNT_NOT_FOUND = "Could not find account information for the user"; - private static final String SELECTED_API_NOT_SUPPORTED = "Currently selected api is not supported by launcher. Please, check appsettings.json file."; + private static final String PATH_TO_HOMEPAGE = "/pages/esignature/index"; private final DSConfiguration config; private final Session session; private final User user; private Optional account; - private AuthType authTypeSelected = AuthType.AGC; private ApiType apiTypeSelected = ApiType.ESIGNATURE; - @Autowired public GlobalControllerAdvice(DSConfiguration config, Session session, User user, Optional account) { this.config = config; @@ -97,14 +95,7 @@ public boolean populateShowDoc() { public Locals populateLocals() throws IOException { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - - ApiIndex apiIndex = ApiIndex.ESIGNATURE; - - if (config.getSelectedApiIndex() != null){ - apiIndex = config.getSelectedApiIndex(); - } - - session.setApiIndexPath(apiIndex.toString()); + session.setApiIndexPath(PATH_TO_HOMEPAGE); if (!(authentication instanceof OAuth2Authentication)) { return new Locals(config, session, null, ""); @@ -126,7 +117,7 @@ public Locals populateLocals() throws IOException { session.setAccountId(oauthAccount.getAccountId()); session.setAccountName(oauthAccount.getAccountName()); //TODO set this more efficiently with more APIs as they're added in - String basePath = this.getBaseUrl(apiIndex, oauthAccount) + apiIndex.getBaseUrlSuffix(); + String basePath = this.getBaseUrl(config.getSelectedApiIndex(), oauthAccount) + config.getSelectedApiIndex().getBaseUrlSuffix(); session.setBasePath(basePath); } diff --git a/src/main/java/com/docusign/core/controller/IndexController.java b/src/main/java/com/docusign/core/controller/IndexController.java index 3a0b21ae..0b84cac4 100644 --- a/src/main/java/com/docusign/core/controller/IndexController.java +++ b/src/main/java/com/docusign/core/controller/IndexController.java @@ -106,50 +106,6 @@ else if (config.getSelectedApiType().equals(ApiType.MONITOR)) { } } - @GetMapping(path = "/ds/selectApi") - public Object choseApiType(ModelMap model) { - model.addAttribute(LAUNCHER_TEXTS, config.getCodeExamplesText().SupportingTexts); - return new ModelAndView("pages/ds_select_api"); - } - - @RequestMapping(path = "/ds/selectApi", method = RequestMethod.POST) - public Object getApiType(ModelMap model, @RequestBody MultiValueMap formParams) throws IOException, URISyntaxException { - model.addAttribute(LAUNCHER_TEXTS, config.getCodeExamplesText().SupportingTexts); - - if (!formParams.containsKey("selectApiType")) { - model.addAttribute("message", "Select option with selectApiType name must be provided."); - return new RedirectView("pages/error"); - } - List selectApiTypeObject = formParams.get("selectApiType"); - ApiType apiTypeSelected = ApiType.valueOf(selectApiTypeObject.get(0)); - writeApiTypeIntoFile(apiTypeSelected); - - return new ModelAndView("pages/ds_restart"); - } - - private void writeApiTypeIntoFile(ApiType apiTypeSelected) throws URISyntaxException, IOException { - JSONObject currentApiType = new JSONObject(); - currentApiType.put(config.getApiTypeHeader(), apiTypeSelected.name()); - - Path exampleApiSourcePath = Paths.get("").resolve("src").resolve("main") - .resolve("resources").resolve(config.getExamplesApiPath()); - if (Files.exists(exampleApiSourcePath)) { - try (BufferedWriter bufferedWriter = new BufferedWriter( - new FileWriter(exampleApiSourcePath.toAbsolutePath().toString())) - ) { - bufferedWriter.write(currentApiType.toString()); - } - } else { - // Works in case we create war and run it on 'tomcat' server - URL exampleApiURL = getClass().getClassLoader().getResource(config.getExamplesApiPath()); - try (BufferedWriter bufferedWriter = new BufferedWriter( - new FileWriter(new File(Objects.requireNonNull(exampleApiURL).toURI()))) - ) { - bufferedWriter.write(currentApiType.toString()); - } - } - } - @RequestMapping(path = "/ds/authenticate", method = RequestMethod.POST) public RedirectView authenticate(ModelMap model, @RequestBody MultiValueMap formParams) { if (!formParams.containsKey("selectAuthType")) { diff --git a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java index 535d50a3..32f18305 100644 --- a/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java +++ b/src/main/java/com/docusign/core/security/jwt/JWTAuthorizationCodeResourceDetails.java @@ -47,8 +47,14 @@ public ApiClient getApiClient() { } public List getScopes() throws IOException { - ApiType apiType = dsConfiguration.getSelectedApiType(); + ArrayList scopes = new ArrayList<>(); - return Arrays.asList(apiType.getScopes()); + for (ApiType apiType : ApiType.values()) + { + for(String scope : apiType.getScopes()){ + scopes.add(scope); + } + } + return Arrays.asList(Arrays.stream(scopes.toArray()).distinct().toArray(String[]::new)); } } diff --git a/src/main/resources/examplesApi.json b/src/main/resources/examplesApi.json deleted file mode 100644 index 1cb9c700..00000000 --- a/src/main/resources/examplesApi.json +++ /dev/null @@ -1 +0,0 @@ -{"ApiType":"ESIGNATURE"} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp b/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp deleted file mode 100644 index 053aa3f2..00000000 --- a/src/main/webapp/WEB-INF/templates/views/pages/ds_select_api.jsp +++ /dev/null @@ -1,20 +0,0 @@ -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> - - -
    - ${launcherTexts.getSelectAPIPage().getSelectAPIHeader()} -
    -
    - -
    -

    - -

    - -
    -
    -
    diff --git a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp index 3a49e9b0..8523ea25 100644 --- a/src/main/webapp/WEB-INF/templates/views/partials/head.jsp +++ b/src/main/webapp/WEB-INF/templates/views/partials/head.jsp @@ -45,10 +45,6 @@ -
  • - ${launcherTexts.getChangeAPITypeButton()}(current) -
  • From 7234e95e89f4f3146830b72ffb4360e6ba25470d Mon Sep 17 00:00:00 2001 From: annahileta Date: Thu, 20 Oct 2022 12:55:15 +0300 Subject: [PATCH 346/699] minor fixes for Quick ACG project to prevent issues during build --- Quick_ACG/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Quick_ACG/pom.xml b/Quick_ACG/pom.xml index ac880fb9..2373f1e2 100644 --- a/Quick_ACG/pom.xml +++ b/Quick_ACG/pom.xml @@ -9,7 +9,7 @@ - com.quickACG + com.docusign code-examples-java-acg 1.0-SNAPSHOT From 06dc266d3cb4d9f82ecdbda4c8b5e059d69000d1 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Thu, 20 Oct 2022 10:19:29 -0700 Subject: [PATCH 347/699] Updating Monitor API code examples to give useful error message if Monitor is not enabled --- .../examples/M001GetMonitoringData.java | 9 ++++ .../examples/M002WebQueryEndpoint.java | 9 ++++ .../services/GetMonitoringDataService.java | 46 +++++++++++-------- .../services/WebQueryEndpointService.java | 30 +++++++----- 4 files changed, 64 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java index 3e531c35..f9cb0333 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M001GetMonitoringData.java @@ -42,6 +42,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse // step 1 end JSONArray monitoringData = GetMonitoringDataService.getMonitoringData(createDataSetApi(accessToken, this.session)); + if (monitoringData.getJSONObject(0).has("Error")) + { + new DoneExample() + .withTitle(getTextForCodeExample().ExampleName) + .withName("") + .withMessage(monitoringData.getJSONObject(0).getString("Error")) + .addToModel(model, config); + return ERROR_PAGE; + } // Cleaning the data from wrong symbols String monitoringDataCleaned = monitoringData.toString().replaceAll("'", ""); diff --git a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java index 05e5dc78..2f45f30e 100644 --- a/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java +++ b/src/main/java/com/docusign/controller/monitor/examples/M002WebQueryEndpoint.java @@ -67,6 +67,15 @@ protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse args.getEndDate() ); + if (queryResult.has("Error")) + { + new DoneExample() + .withTitle(getTextForCodeExample().ExampleName) + .withName("") + .withMessage(queryResult.getString("Error")) + .addToModel(model, config); + return ERROR_PAGE; + } // Cleaning the data from unsupported symbols String queryResultCleaned = queryResult.toString().replaceAll("'", ""); diff --git a/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java index a5a29530..77afbd89 100644 --- a/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java +++ b/src/main/java/com/docusign/controller/monitor/services/GetMonitoringDataService.java @@ -18,28 +18,36 @@ public static JSONArray getMonitoringData(DataSetApi datasetApi) throws Exceptio // After each call, save the cursor and use it to make the next // call from the point where the previous one left off when iterating through // the monitoring records - do - { - if(!cursorValue.isEmpty()) - options.setCursor(cursorValue); - - CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); - - String endCursor = cursoredResult.getEndCursor(); - - // If the endCursor from the response is the same as the one that you already have, - // it means that you have reached the end of the records - if (endCursor.equals(cursorValue)) + try { + + do { - complete = true; - } - else - { - cursorValue = endCursor; - monitoringData.put(new JSONObject(cursoredResult)); + if(!cursorValue.isEmpty()) + options.setCursor(cursorValue); + + CursoredResult cursoredResult = datasetApi.getStream("2.0", "monitor", options); + + String endCursor = cursoredResult.getEndCursor(); + + // If the endCursor from the response is the same as the one that you already have, + // it means that you have reached the end of the records + if (endCursor.equals(cursorValue)) + { + complete = true; + } + else + { + cursorValue = endCursor; + monitoringData.put(new JSONObject(cursoredResult)); + } } + while (!complete); } - while (!complete); + catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("Error", "You do not have Monitor enabled for your account, follow How to enable Monitor for your account to get it enabled."); + monitoringData.put(jsonObject); + } return monitoringData; } diff --git a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java index 9656177f..f4984581 100644 --- a/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java +++ b/src/main/java/com/docusign/controller/monitor/services/WebQueryEndpointService.java @@ -19,19 +19,27 @@ public static JSONObject postWebQueryMethod( String accountId, String filterStartDate, String filterEndDate) throws ApiException { - AggregateResult aggregateResult = datasetApi.postWebQuery( - API_VERSION, - NAME_OF_DATASET, - prepareWebQueryOptions(accountId, filterStartDate, filterEndDate)); - - AggregateResultResult methodResult = null; - List aggregateResultList = aggregateResult.getResult(); - // Step 4 end - if (aggregateResultList != null && !aggregateResultList.isEmpty()) { - methodResult = aggregateResultList.get(0); + try { + AggregateResult aggregateResult = datasetApi.postWebQuery( + API_VERSION, + NAME_OF_DATASET, + prepareWebQueryOptions(accountId, filterStartDate, filterEndDate)); + + AggregateResultResult methodResult = null; + List aggregateResultList = aggregateResult.getResult(); + // Step 4 end + if (aggregateResultList != null && !aggregateResultList.isEmpty()) { + methodResult = aggregateResultList.get(0); + } + + return new JSONObject(methodResult); } - return new JSONObject(methodResult); + catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("Error", "You do not have Monitor enabled for your account, follow How to enable Monitor for your account to get it enabled."); + return jsonObject; + } } // Step 3 start From ecc3a621dd1a1920525b0a1f1e4775941eaa0fc8 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Thu, 20 Oct 2022 10:21:26 -0700 Subject: [PATCH 348/699] Small update the ACG project --- Quick_ACG/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Quick_ACG/pom.xml b/Quick_ACG/pom.xml index ac880fb9..2373f1e2 100644 --- a/Quick_ACG/pom.xml +++ b/Quick_ACG/pom.xml @@ -9,7 +9,7 @@ - com.quickACG + com.docusign code-examples-java-acg 1.0-SNAPSHOT From 854acea3c22f29744d4ecc8369bea18234737e04 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Fri, 21 Oct 2022 13:50:30 -0700 Subject: [PATCH 349/699] Updating README --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 96951436..65cd3703 100644 --- a/README.md +++ b/README.md @@ -22,33 +22,32 @@ The OAuth library is used in the file [WebSecurityConfig.java](https://github.co ## eSignature API -For more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes). +For more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes). - -For a list of code examples that use the eSignature API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/esign-rest-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the eSignature API, see the [How-to guides overview](https://developers.docusign.com/docs/esign-rest-api/how-to/) on the DocuSign Developer Center. ## Rooms API **Note:** To use the Rooms API, you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. -For more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). +For more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). -For a list of code examples that use the Rooms API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/rooms-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the Rooms API, see the [How-to guides overview](https://developers.docusign.com/docs/rooms-api/how-to/) on the DocuSign Developer Center. ## Click API For more information about the scopes used for obtaining authorization to use the Click API, see [Required scopes](https://developers.docusign.com/docs/click-api/click101/auth/#required-scopes) - -For a list of code examples that use the Click API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/click-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the Click API, see the [How-to guides overview](https://developers.docusign.com/docs/click-api/how-to/) on the DocuSign Developer Center. ## Monitor API **Note:** To use the Monitor API, you must also [enable DocuSign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/). -For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). -For a list of code examples that use the Click API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/monitor-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). + +For a list of code examples that use the Monitor API, see the [How-to guides overview](https://developers.docusign.com/docs/monitor-api/how-to/) on the DocuSign Developer Center. ## Admin API @@ -57,7 +56,7 @@ For a list of code examples that use the Click API, select the Java tab under [E For information about the scopes used for obtaining authorization to use the Admin API, see the [scopes section](https://developers.docusign.com/docs/admin-api/admin101/auth/). -For a list of code examples that use the Admin API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/admin-api/how-to/code-launchers/#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the Admin API, see the [How-to guides overview](https://developers.docusign.com/docs/admin-api/how-to/) on the DocuSign Developer Center. ## Installation From b1273bbadfd4046b01cf6209923ded5653b8f86b Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Fri, 21 Oct 2022 14:32:09 -0700 Subject: [PATCH 350/699] README.md updates --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 96951436..65cd3703 100644 --- a/README.md +++ b/README.md @@ -22,33 +22,32 @@ The OAuth library is used in the file [WebSecurityConfig.java](https://github.co ## eSignature API -For more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes). +For more information about the scopes used for obtaining authorization to use the eSignature API, see [Required scopes](https://developers.docusign.com/docs/esign-rest-api/esign101/auth#required-scopes). - -For a list of code examples that use the eSignature API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/esign-rest-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the eSignature API, see the [How-to guides overview](https://developers.docusign.com/docs/esign-rest-api/how-to/) on the DocuSign Developer Center. ## Rooms API **Note:** To use the Rooms API, you must also [create your Rooms developer account](https://developers.docusign.com/docs/rooms-api/rooms101/create-account). Examples 4 and 6 require that you have the DocuSign Forms feature enabled in your Rooms for Real Estate account. -For more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). +For more information about the scopes used for obtaining authorization to use the Rooms API, see [Required scopes](https://developers.docusign.com/docs/rooms-api/rooms101/auth/). -For a list of code examples that use the Rooms API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/rooms-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the Rooms API, see the [How-to guides overview](https://developers.docusign.com/docs/rooms-api/how-to/) on the DocuSign Developer Center. ## Click API For more information about the scopes used for obtaining authorization to use the Click API, see [Required scopes](https://developers.docusign.com/docs/click-api/click101/auth/#required-scopes) - -For a list of code examples that use the Click API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/click-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the Click API, see the [How-to guides overview](https://developers.docusign.com/docs/click-api/how-to/) on the DocuSign Developer Center. ## Monitor API **Note:** To use the Monitor API, you must also [enable DocuSign Monitor for your organization](https://developers.docusign.com/docs/monitor-api/how-to/enable-monitor/). -For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). -For a list of code examples that use the Click API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/monitor-api/how-to/code-launchers#examples-and-languages) on the DocuSign Developer Center. +For information about the scopes used for obtaining authorization to use the Monitor API, see the [scopes section](https://developers.docusign.com/docs/monitor-api/monitor101/auth/). + +For a list of code examples that use the Monitor API, see the [How-to guides overview](https://developers.docusign.com/docs/monitor-api/how-to/) on the DocuSign Developer Center. ## Admin API @@ -57,7 +56,7 @@ For a list of code examples that use the Click API, select the Java tab under [E For information about the scopes used for obtaining authorization to use the Admin API, see the [scopes section](https://developers.docusign.com/docs/admin-api/admin101/auth/). -For a list of code examples that use the Admin API, select the Java tab under [Examples and languages](https://developers.docusign.com/docs/admin-api/how-to/code-launchers/#examples-and-languages) on the DocuSign Developer Center. +For a list of code examples that use the Admin API, see the [How-to guides overview](https://developers.docusign.com/docs/admin-api/how-to/) on the DocuSign Developer Center. ## Installation From 5f487c5919364f44b720bdc18e1341e9b256b5b8 Mon Sep 17 00:00:00 2001 From: annahileta Date: Wed, 9 Nov 2022 14:08:33 +0200 Subject: [PATCH 351/699] added SkipForLanguages check to the eSignature homepage --- .../views/pages/esignature/index.jsp | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index ef7c02d1..fb91f04e 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -30,42 +30,44 @@

    ${group.getName()}

    -

    - - ${example.getExampleName()} - -

    + +

    + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    -

    ${example.getExampleDescription()}

    +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + + + + + ${link.getPathName()} + -

    - - ${launcherTexts.getAPIMethodUsed()} + + . + + + and - ${launcherTexts.getAPIMethodUsedPlural()} + , - - - - ${link.getPathName()} - - - - - . - - - and - - - , - - - -

    +
    +

    +
    From d2d00772b588ed1fa4901c9d99a98c542880c0ae Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 9 Nov 2022 13:08:42 -0800 Subject: [PATCH 352/699] Initial checkin for DEVDOCS-8757 --- .factorypath | 1 - pom.xml | 2 +- .../com/docusign/common/WorkArguments.java | 4 ++ .../C006ControllerEmbedClickwrap.java | 72 +++++++++++++++++++ .../click/services/EmbedClickwrapService.java | 47 ++++++++++++ .../model/manifestModels/HelpingTexts.java | 10 +++ src/main/resources/examplesApi.json | 2 +- .../views/pages/click/examples/c001.jsp | 2 +- .../views/pages/click/examples/c002.jsp | 2 +- .../views/pages/click/examples/c003.jsp | 2 +- .../views/pages/click/examples/c004.jsp | 2 +- .../views/pages/click/examples/c005.jsp | 2 +- .../templates/views/pages/click/index.jsp | 1 - 13 files changed, 140 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java create mode 100644 src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java diff --git a/.factorypath b/.factorypath index 5ac4c88a..de9a33c5 100644 --- a/.factorypath +++ b/.factorypath @@ -87,7 +87,6 @@ - diff --git a/pom.xml b/pom.xml index f5ebf653..2699a6a6 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 2.11.0 3.18.0 1.1.0 - 1.0.0 + 1.2.2 1.1.0 1.1.0 diff --git a/src/main/java/com/docusign/common/WorkArguments.java b/src/main/java/com/docusign/common/WorkArguments.java index 2b5a762a..edd78b7b 100644 --- a/src/main/java/com/docusign/common/WorkArguments.java +++ b/src/main/java/com/docusign/common/WorkArguments.java @@ -73,4 +73,8 @@ public class WorkArguments { private String clickwrapId; private String hostEmail; private String hostName; + private String fullName; + private String company; + private String title; + private String date; } diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java new file mode 100644 index 00000000..022ac22e --- /dev/null +++ b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java @@ -0,0 +1,72 @@ +package com.docusign.controller.click.examples; + +import com.docusign.DSConfiguration; +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.model.ClickwrapVersionSummaryResponse; +import com.docusign.click.model.ClickwrapVersionsResponse; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.DoneExample; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.controller.click.services.EmbedClickwrapService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.servlet.http.HttpServletResponse; + +/** + * Activate a clickwrap. + */ +@Controller +@RequestMapping("/c006") +public class C006ControllerEmbedClickwrap extends AbstractClickController { + + private static final String MODEL_CLICKWRAPS = "clickwraps"; + private final Session session; + private final User user; + + @Autowired + public C006ControllerEmbedClickwrap(DSConfiguration config, Session session, User user) { + super(config, "c006"); + this.session = session; + this.user = user; + } + + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + super.onInitModel(args, model); + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + ClickwrapVersionsResponse clickwraps = EmbedClickwrapService.getActiveClickwraps(accountsApi, this.session.getAccountId()); + model.addAttribute(MODEL_CLICKWRAPS, clickwraps); + } + + @Override + // ***DS.snippet.0.start + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws ApiException { + // Step 2: Construct your API headers + AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); + + String clickwrapId = args.getClickwrap(); + String fullName = args.getFullName(); + String email = args.getEmail(); + String company = args.getCompany(); + String title = args.getTitle(); + String date = args.getDate(); + + String url = EmbedClickwrapService.createAgreementUrl( + accountsApi, this.session.getAccountId(), + clickwrapId, fullName, email, company, title, date); + + DoneExample.createDefault(this.title) + .withJsonObject(url) + .withMessage(getTextForCodeExample().ResultsPageText) + .addToModel(model, config); + return DONE_EXAMPLE_PAGE; + } + // ***DS.snippet.0.end +} diff --git a/src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java b/src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java new file mode 100644 index 00000000..d364ae32 --- /dev/null +++ b/src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java @@ -0,0 +1,47 @@ +package com.docusign.controller.click.services; + +import com.docusign.click.api.AccountsApi; +import com.docusign.click.client.ApiException; +import com.docusign.click.client.ApiResponse; +import com.docusign.click.model.ClickwrapVersionsResponse; +import com.docusign.click.model.UserAgreementRequest; +import com.docusign.click.model.UserAgreementResponse; + +import java.util.HashMap; +import java.util.Map; + +public final class EmbedClickwrapService { + public static String createAgreementUrl( + AccountsApi accountsApi, + String accountId, + String clickwrapId, + String fullName, + String email, + String company, + String title, + String date + ) throws ApiException { + + UserAgreementRequest userAgreementRequest = new UserAgreementRequest(); + userAgreementRequest.setClientUserId(email); + Map documentData = new HashMap(); + documentData.put("fullName", fullName); + documentData.put("email", email); + documentData.put("company", company); + documentData.put("title", title); + documentData.put("date", date); + userAgreementRequest.setDocumentData(documentData); + ApiResponse response = accountsApi.createHasAgreedWithHttpInfo(accountId, clickwrapId, userAgreementRequest); + + return response.getData().getAgreementUrl(); + } + + public static ClickwrapVersionsResponse getActiveClickwraps( + AccountsApi accountsApi, + String accountId + ) throws ApiException{ + AccountsApi.GetClickwrapsOptions options = accountsApi.new GetClickwrapsOptions(); + options.setStatus("active"); + return accountsApi.getClickwraps(accountId, options); + } +} diff --git a/src/main/java/com/docusign/core/model/manifestModels/HelpingTexts.java b/src/main/java/com/docusign/core/model/manifestModels/HelpingTexts.java index 6c100dd0..1a1d9d1f 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/HelpingTexts.java +++ b/src/main/java/com/docusign/core/model/manifestModels/HelpingTexts.java @@ -19,4 +19,14 @@ public class HelpingTexts { public String ChooseDateInTheFuture; public String PhoneNumberWillBeNotified; + + public String DynamicContentValue; + + public String DynamicContentNote; + + public String EmbedClickwrapURL; + + public String NOTAGREED; + + public String AGREED; } diff --git a/src/main/resources/examplesApi.json b/src/main/resources/examplesApi.json index 1cb9c700..38ebb990 100644 --- a/src/main/resources/examplesApi.json +++ b/src/main/resources/examplesApi.json @@ -1 +1 @@ -{"ApiType":"ESIGNATURE"} \ No newline at end of file +{"ApiType":"CLICK"} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp index 63f8c213..4ae83857 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c001.jsp @@ -4,7 +4,7 @@ -

    1. ${example.getExampleName()}

    +

    ${example.getExampleName()}

    ${example.getExampleDescription()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index bbeb44dd..289ae9c0 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -6,7 +6,7 @@ -

    2. ${example.getExampleName()}

    +

    ${example.getExampleName()}

    ${example.getExampleDescription()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp index 08008954..32aa9e0d 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c003.jsp @@ -7,7 +7,7 @@ -

    3. ${example.getExampleName()}

    +

    ${example.getExampleName()}

    ${example.getExampleDescription()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp index 842e8889..9e7e2561 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c004.jsp @@ -1,7 +1,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -

    4. ${example.getExampleName()}

    +

    ${example.getExampleName()}

    ${example.getExampleDescription()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp index c4b5c18a..12090083 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c005.jsp @@ -6,7 +6,7 @@ -

    5. ${example.getExampleName()}

    +

    ${example.getExampleName()}

    ${example.getExampleDescription()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp index 06cabfe4..532a9a44 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/index.jsp @@ -31,7 +31,6 @@

    - ${example.getExampleNumber()}. ${example.getExampleName()} From 0f29ff35b08721878ced5390c4bd82195599d01e Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 9 Nov 2022 14:44:54 -0800 Subject: [PATCH 353/699] Making progress.... --- .../C006ControllerEmbedClickwrap.java | 21 +++- .../click/services/EmbedClickwrapService.java | 9 +- .../views/pages/click/examples/c006.jsp | 103 ++++++++++++++++++ 3 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java index 022ac22e..b4a99bd8 100644 --- a/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java @@ -3,14 +3,12 @@ import com.docusign.DSConfiguration; import com.docusign.click.api.AccountsApi; import com.docusign.click.client.ApiException; -import com.docusign.click.model.ClickwrapVersionSummaryResponse; import com.docusign.click.model.ClickwrapVersionsResponse; import com.docusign.common.WorkArguments; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.controller.click.services.EmbedClickwrapService; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -62,11 +60,24 @@ protected Object doWork(WorkArguments args, ModelMap model, accountsApi, this.session.getAccountId(), clickwrapId, fullName, email, company, title, date); - DoneExample.createDefault(this.title) + if (url == "Already Agreed") + { + new DoneExample() + .withTitle(exampleName) + .withName(title) + .withMessage("The email address you provided was already use to agree to this elastic template, please provide a different email address if you want to view the agreement and agree to it") + .addToModel(model, config); + return ERROR_PAGE; + } + else + { + String HTMLSnippet = "

    NOT AGREED

    "; + DoneExample.createDefault(this.title) .withJsonObject(url) - .withMessage(getTextForCodeExample().ResultsPageText) + .withMessage(getTextForCodeExample().ResultsPageText + HTMLSnippet) .addToModel(model, config); - return DONE_EXAMPLE_PAGE; + return DONE_EXAMPLE_PAGE; + } } // ***DS.snippet.0.end } diff --git a/src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java b/src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java index d364ae32..08a5d322 100644 --- a/src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java +++ b/src/main/java/com/docusign/controller/click/services/EmbedClickwrapService.java @@ -33,7 +33,14 @@ public static String createAgreementUrl( userAgreementRequest.setDocumentData(documentData); ApiResponse response = accountsApi.createHasAgreedWithHttpInfo(accountId, clickwrapId, userAgreementRequest); - return response.getData().getAgreementUrl(); + if (response.getStatusCode() == 201) + { + return response.getData().getAgreementUrl(); + } + else + { + return "Already Agreed"; + } } public static ClickwrapVersionsResponse getActiveClickwraps( diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp new file mode 100644 index 00000000..261231ca --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp @@ -0,0 +1,103 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + + + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    + + +

    + ${viewSourceFile} +

    + + + +

    ${example.getForms().get(formNumber).getFormName()}

    +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    + + +
    +
    + +

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)} +

    +
    +
    + + \ No newline at end of file From 91d6c7e8d170e682373b3f2c63832ec2e657f720 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 9 Nov 2022 15:28:46 -0800 Subject: [PATCH 354/699] Initial fix for checking if not active/inactive click wraps --- .../WEB-INF/templates/views/pages/click/examples/c002.jsp | 2 +- .../WEB-INF/templates/views/pages/click/examples/c006.jsp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp index 289ae9c0..8531398a 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c002.jsp @@ -15,7 +15,7 @@

    - +

    ${example.getForms().get(formNumber).getFormName()}

    diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp index 261231ca..652fc02f 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp @@ -20,7 +20,7 @@

    - +

    ${example.getForms().get(formNumber).getFormName()}

    From e657ecf4eecf9453d8a20651c2040d7f7a756603 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Thu, 10 Nov 2022 11:53:46 -0800 Subject: [PATCH 355/699] Finalizing the errors --- .../C006ControllerEmbedClickwrap.java | 4 ++++ .../views/pages/click/examples/c006.jsp | 21 ++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java index b4a99bd8..bc5e02d3 100644 --- a/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java @@ -8,6 +8,7 @@ import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; +import com.docusign.controller.click.services.ActivateClickwrapService; import com.docusign.controller.click.services.EmbedClickwrapService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -39,7 +40,10 @@ protected void onInitModel(WorkArguments args, ModelMap model) throws Exception super.onInitModel(args, model); AccountsApi accountsApi = createAccountsApiClient(this.session.getBasePath(), this.user.getAccessToken()); ClickwrapVersionsResponse clickwraps = EmbedClickwrapService.getActiveClickwraps(accountsApi, this.session.getAccountId()); + ClickwrapVersionsResponse inactiveClickwraps = ActivateClickwrapService.getInactiveClickwraps(accountsApi, this.session.getAccountId()); + Boolean hasInactiveClickraps = (inactiveClickwraps.getClickwraps().size() > 0); model.addAttribute(MODEL_CLICKWRAPS, clickwraps); + model.addAttribute("hasInactiveClickraps", hasInactiveClickraps); } @Override diff --git a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp index 652fc02f..d150a654 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/click/examples/c006.jsp @@ -9,7 +9,9 @@ - + + +

    ${example.getExampleName()}

    ${example.getExampleDescription()}

    @@ -94,10 +96,19 @@ -

    - ${example.getRedirectsToOtherCodeExamples().get(redirectNumber).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)} -

    -
    + + +

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumberTo2).getRedirectText().replaceFirst("\\{0}", redirectToSecondCodeExample)} +

    +
    + +

    + ${example.getRedirectsToOtherCodeExamples().get(redirectNumberTo1).getRedirectText().replaceFirst("\\{0}", redirectToFirstCodeExample)} +

    +
    +
    + \ No newline at end of file From b9e594a94b3814a76a552f0a4b4cd642771aa455 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Fri, 11 Nov 2022 11:20:32 -0800 Subject: [PATCH 356/699] Setting examplesApi.json back to eSign --- src/main/resources/examplesApi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/examplesApi.json b/src/main/resources/examplesApi.json index 38ebb990..1cb9c700 100644 --- a/src/main/resources/examplesApi.json +++ b/src/main/resources/examplesApi.json @@ -1 +1 @@ -{"ApiType":"CLICK"} \ No newline at end of file +{"ApiType":"ESIGNATURE"} \ No newline at end of file From 422a5ba5efb198720bc8f127eb6ef6f0faa8e3e3 Mon Sep 17 00:00:00 2001 From: Inbar Gazit Date: Wed, 16 Nov 2022 15:08:23 -0800 Subject: [PATCH 357/699] Fixing Click error message --- .../controller/click/examples/C006ControllerEmbedClickwrap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java index bc5e02d3..18f1fc6b 100644 --- a/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java +++ b/src/main/java/com/docusign/controller/click/examples/C006ControllerEmbedClickwrap.java @@ -69,7 +69,7 @@ protected Object doWork(WorkArguments args, ModelMap model, new DoneExample() .withTitle(exampleName) .withName(title) - .withMessage("The email address you provided was already use to agree to this elastic template, please provide a different email address if you want to view the agreement and agree to it") + .withMessage("The email address was already used to agree to this elastic template. Provide a different email address if you want to view the agreement and agree to it.") .addToModel(model, config); return ERROR_PAGE; } From 1917e08f58613936f7531bb1a61a72692c1edf53 Mon Sep 17 00:00:00 2001 From: Karissa Jacobsen Date: Thu, 17 Nov 2022 14:13:43 -0800 Subject: [PATCH 358/699] CFR part 11 example --- pom.xml | 6 +- .../EG001ControllerEmbeddedSigning.java | 13 ++ .../EG014ControllerCollectPayment.java | 6 + .../EG020ControllerPhoneAuthentication.java | 10 ++ ...EG032ControllerPauseSignatureWorkflow.java | 10 ++ ...033ControllerUnpauseSignatureWorkflow.java | 10 ++ ...034ControllerUseConditionalRecipients.java | 10 ++ .../EG036ControllerDelayedRouting.java | 10 ++ .../examples/EG037ControllerSMSDelivery.java | 10 ++ .../EG039ControllerInPersonSigning.java | 10 ++ .../EG040ControllerSetDocumentVisibility.java | 10 ++ .../EG041ControllerCfrEmbeddedSigning.java | 130 ++++++++++++++++++ .../services/CfrEmbeddedSigningService.java | 118 ++++++++++++++++ .../java/com/docusign/core/common/Utils.java | 25 ++++ .../core/controller/AbstractController.java | 12 +- .../core/controller/IndexController.java | 31 ++++- .../java/com/docusign/core/model/Session.java | 1 + .../model/manifestModels/CodeExampleText.java | 2 + .../model/manifestModels/SupportingTexts.java | 2 + .../views/pages/esignature/examples/eg041.jsp | 91 ++++++++++++ .../views/pages/esignature/index.jsp | 118 +++++++++++----- 21 files changed, 589 insertions(+), 46 deletions(-) create mode 100644 src/main/java/com/docusign/controller/eSignature/examples/EG041ControllerCfrEmbeddedSigning.java create mode 100644 src/main/java/com/docusign/controller/eSignature/services/CfrEmbeddedSigningService.java create mode 100644 src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp diff --git a/pom.xml b/pom.xml index f5ebf653..44c54ef6 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 11 2.5.6 2.11.0 - 3.18.0 + 3.21.0 1.1.0 1.0.0 1.1.0 @@ -160,10 +160,10 @@ - + - + org.bouncycastle diff --git a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java index 12ba8000..2f093a07 100644 --- a/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java +++ b/src/main/java/com/docusign/EG001ControllerEmbeddedSigning.java @@ -2,6 +2,7 @@ import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.examples.AbstractEsignatureController; +import com.docusign.core.common.Utils; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; @@ -46,6 +47,18 @@ public EG001ControllerEmbeddedSigning(DSConfiguration config, Session session, U this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + if(config.getQuickstart().equals("true")){ + config.setQuickstart("false"); + } + super.onInitModel(args, model); + } + @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws Exception { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java index 9beb6fa6..16d7a468 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG014ControllerCollectPayment.java @@ -2,10 +2,12 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.model.ErrorDetails; import com.docusign.esign.client.ApiException; import com.docusign.esign.model.EnvelopeDefinition; import com.docusign.esign.model.EnvelopeSummary; @@ -51,6 +53,10 @@ public EG014ControllerCollectPayment(DSConfiguration config, Session session, Us @Override protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } super.onInitModel(args, model); model.addAttribute(MODEL_GATEWAY_OK, null != config.getGatewayAccountId()); } diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java index fb662944..09839e5d 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG020ControllerPhoneAuthentication.java @@ -3,6 +3,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.services.PhoneAuthenticationService; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -52,6 +53,15 @@ public EG020ControllerPhoneAuthentication(DSConfiguration config, Session sessio this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java index 4180462d..6e99cf8b 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG032ControllerPauseSignatureWorkflow.java @@ -2,6 +2,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.esign.api.EnvelopesApi; @@ -36,6 +37,15 @@ public EG032ControllerPauseSignatureWorkflow(DSConfiguration config, Session ses this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java index 5e98afb0..524d50ad 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG033ControllerUnpauseSignatureWorkflow.java @@ -2,6 +2,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -34,6 +35,15 @@ public EG033ControllerUnpauseSignatureWorkflow(DSConfiguration config, Session s this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java index 68389d57..492662ee 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG034ControllerUseConditionalRecipients.java @@ -2,6 +2,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -36,6 +37,15 @@ public EG034ControllerUseConditionalRecipients(DSConfiguration config, Session s this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override // ***DS.snippet.0.start protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java index 3f88a6d4..71d7a6ba 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG036ControllerDelayedRouting.java @@ -3,6 +3,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.services.DelayedRoutingService; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -45,6 +46,15 @@ public EG036ControllerDelayedRouting(DSConfiguration config, Session session, Us this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java index 2fb6cea5..07274eaa 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG037ControllerSMSDelivery.java @@ -2,6 +2,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -36,6 +37,15 @@ public EG037ControllerSMSDelivery(DSConfiguration config, Session session, User this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java index dc149ba2..c8026619 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG039ControllerInPersonSigning.java @@ -3,6 +3,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.services.InPersonSigningService; +import com.docusign.core.common.Utils; import com.docusign.core.model.Session; import com.docusign.core.model.User; import com.docusign.esign.api.EnvelopesApi; @@ -37,6 +38,15 @@ public EG039ControllerInPersonSigning(DSConfiguration config, Session session, U this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java index 50d65c3d..32e3e931 100644 --- a/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG040ControllerSetDocumentVisibility.java @@ -3,6 +3,7 @@ import com.docusign.DSConfiguration; import com.docusign.common.WorkArguments; import com.docusign.controller.eSignature.services.SetDocumentVisibilityService; +import com.docusign.core.common.Utils; import com.docusign.core.model.DoneExample; import com.docusign.core.model.Session; import com.docusign.core.model.User; @@ -39,6 +40,15 @@ public EG040ControllerSetDocumentVisibility(DSConfiguration config, Session sess this.user = user; } + @Override + protected void onInitModel(WorkArguments args, ModelMap model) throws Exception { + if(Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId())){ + session.setStatusCFR("enabled"); + throw new Exception(config.getCodeExamplesText().getSupportingTexts().getCFRError()); + } + super.onInitModel(args, model); + } + @Override protected Object doWork(WorkArguments args, ModelMap model, HttpServletResponse response) throws ApiException, IOException { diff --git a/src/main/java/com/docusign/controller/eSignature/examples/EG041ControllerCfrEmbeddedSigning.java b/src/main/java/com/docusign/controller/eSignature/examples/EG041ControllerCfrEmbeddedSigning.java new file mode 100644 index 00000000..6f665954 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/examples/EG041ControllerCfrEmbeddedSigning.java @@ -0,0 +1,130 @@ +package com.docusign.controller.eSignature.examples; + +import com.docusign.DSConfiguration; +import com.docusign.common.WorkArguments; +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.AccountIdentityVerificationResponse; +import com.docusign.esign.model.AccountIdentityVerificationWorkflow; +import com.docusign.esign.model.EnvelopeDefinition; +import com.docusign.esign.model.EnvelopeSummary; +import com.docusign.esign.model.RecipientViewRequest; +import com.docusign.esign.model.ViewUrl; + +import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.docusign.controller.eSignature.services.CfrEmbeddedSigningService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.view.RedirectView; + +import javax.servlet.http.HttpServletResponse; + + +/** + * Use embedded signing.
    + * This example sends an envelope, and then uses embedded signing + * for the first signer. Embedded signing provides a smoother user experience + * for the signer: the DocuSign signing is initiated from your site. + */ +@Controller +@RequestMapping("/eg041") +public class EG041ControllerCfrEmbeddedSigning extends AbstractEsignatureController { + + private static final Logger logger = LoggerFactory.getLogger(EG023ControllerIdvAuthentication.class); + private static final String DOCUMENT_FILE_NAME = "World_Wide_Corp_lorem.pdf"; + private static final String DOCUMENT_NAME = "Lorem Ipsum"; + private static final int ANCHOR_OFFSET_Y = -30; + private static final int ANCHOR_OFFSET_X = 10; + private final Session session; + private final User user; + + @Autowired + public EG041ControllerCfrEmbeddedSigning(DSConfiguration config, Session session, User user){ + super(config, "eg041"); + this.session = session; + this.user = user; + } + + @Override + protected Object doWork(WorkArguments args, ModelMap model, + HttpServletResponse response) throws Exception { + String signerName = args.getSignerName(); + String signerEmail = args.getSignerEmail(); + String signerClientId = args.getSignerEmail(); + String countryCode = args.getCountryCode(); + String phoneNumber = args.getPhoneNumber(); + String accountId = session.getAccountId(); + + // Step 2 start + ApiClient apiClient = createApiClient(session.getBasePath(), user.getAccessToken()); + // Step 2 end + + // Step 3 start + AccountsApi workflowDetails = new AccountsApi(apiClient); + AccountIdentityVerificationResponse workflowRes = workflowDetails.getAccountIdentityVerification(session.getAccountId()); + List identityVerification = workflowRes.getIdentityVerification(); + String workflowId = ""; + for (int i = 0; i < identityVerification.size(); i++) + { + if (identityVerification.get(i).getDefaultName().equals("SMS for access & signatures")) + { + workflowId = identityVerification.get(i).getWorkflowId(); + } + } + // Step 3 end + logger.info("workflowId = " + workflowId); + if (workflowId.equals("")) + { + throw new ApiException(0, getTextForCodeExample().CustomErrorTexts.get(0).ErrorMessage); + } + + + // Step 1. Create the envelope definition + EnvelopeDefinition envelope = CfrEmbeddedSigningService.makeEnvelope( + signerName, + signerEmail, + countryCode, + phoneNumber, + workflowId, + signerClientId, + ANCHOR_OFFSET_Y, + ANCHOR_OFFSET_X, + DOCUMENT_FILE_NAME, + DOCUMENT_NAME); + + // Step 2. Call DocuSign to create the envelope + EnvelopesApi envelopesApi = new EnvelopesApi(apiClient); + EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelope); + + String envelopeId = envelopeSummary.getEnvelopeId(); + session.setEnvelopeId(envelopeId); + + // Step 3. create the recipient view, the embedded signing + RecipientViewRequest viewRequest = CfrEmbeddedSigningService.makeRecipientViewRequest( + signerEmail, + signerName, + config, + signerClientId); + + ViewUrl viewUrl = CfrEmbeddedSigningService.embeddedSigning( + envelopesApi, + accountId, + envelopeId, + viewRequest + ); + + // Step 4. Redirect the user to the embedded signing + // Don't use an iFrame! + // State can be stored/recovered using the framework's session or a + // query parameter on the returnUrl (see the makeRecipientViewRequest method) + return new RedirectView(viewUrl.getUrl()); + } +} diff --git a/src/main/java/com/docusign/controller/eSignature/services/CfrEmbeddedSigningService.java b/src/main/java/com/docusign/controller/eSignature/services/CfrEmbeddedSigningService.java new file mode 100644 index 00000000..485a1428 --- /dev/null +++ b/src/main/java/com/docusign/controller/eSignature/services/CfrEmbeddedSigningService.java @@ -0,0 +1,118 @@ +package com.docusign.controller.eSignature.services; + +import com.docusign.DSConfiguration; +import com.docusign.controller.eSignature.examples.EnvelopeHelpers; +import com.docusign.esign.api.EnvelopesApi; +import com.docusign.esign.client.ApiException; +import com.docusign.esign.model.*; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; + +public final class CfrEmbeddedSigningService { + public static ViewUrl embeddedSigning( + EnvelopesApi envelopesApi, + String accountId, + String envelopeId, + RecipientViewRequest viewRequest + ) throws ApiException { + return envelopesApi.createRecipientView(accountId, envelopeId, viewRequest); + } + + public static RecipientViewRequest makeRecipientViewRequest( + String signerEmail, + String signerName, + DSConfiguration config, + String clientUserId + ) { + RecipientViewRequest viewRequest = new RecipientViewRequest(); + // Set the url where you want the recipient to go once they are done signing + // should typically be a callback route somewhere in your app. + // The query parameter is included as an example of how + // to save/recover state information during the redirect to + // the DocuSign signing. It's usually better to use + // the session mechanism of your web framework. Query parameters + // can be changed/spoofed very easily. + String stateValue = "?state=123"; + viewRequest.setReturnUrl(config.getDsReturnUrl() + stateValue); + + // How has your app authenticated the user? In addition to your app's + // authentication, you can include authenticate steps from DocuSign. + // Eg, SMS authentication + String authenticationMethod = "none"; + viewRequest.setAuthenticationMethod(authenticationMethod); + + // Recipient information must match embedded recipient info + // we used to create the envelope. + viewRequest.setEmail(signerEmail); + viewRequest.setUserName(signerName); + viewRequest.setClientUserId(clientUserId); + + // DocuSign recommends that you redirect to DocuSign for the + // embedded signing. There are multiple ways to save state. + // To maintain your application's session, use the pingUrl + // parameter. It causes the DocuSign signing web page + // (not the DocuSign server) to send pings via AJAX to your app. + // NOTE: The pings will only be sent if the pingUrl is an https address + String pingFrequency = "600"; + viewRequest.setPingFrequency(pingFrequency); // seconds + viewRequest.setPingUrl(config.getDsPingUrl()); + + return viewRequest; + } + + public static EnvelopeDefinition makeEnvelope( + String signerName, + String signerEmail, + String countryCode, + String number, + String workflowId, + String signerClientId, + Integer anchorOffsetY, + Integer anchorOffsetX, + String documentFileName, + String documentName + ) throws IOException { + // Create a signer recipient to sign the document, identified by name and email + // We set the clientUserId to enable embedded signing for the recipient + + + RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber(); + phoneNumber.setCountryCode(countryCode); + phoneNumber.setNumber(number); + + RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption(); + inputOption.setName("phone_number_list"); + inputOption.setValueType("PhoneNumberList"); + inputOption.setPhoneNumberList(Arrays.asList(phoneNumber)); + + RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification(); + + identityVerifcation.setWorkflowId(workflowId); + identityVerifcation.setInputOptions(Arrays.asList(inputOption)); + + Signer signer = new Signer(); + signer.setEmail(signerEmail); + signer.setName(signerName); + signer.clientUserId(signerClientId); + signer.recipientId("1"); + signer.setTabs(EnvelopeHelpers.createSingleSignerTab("/sn1/", anchorOffsetY, anchorOffsetX)); + signer.setIdentityVerification(identityVerifcation); + + // Add the recipient to the envelope object + Recipients recipients = new Recipients(); + recipients.setSigners(Collections.singletonList(signer)); + + EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition(); + envelopeDefinition.setEmailSubject("Please sign this document"); + envelopeDefinition.setRecipients(recipients); + Document doc = EnvelopeHelpers.createDocumentFromFile(documentFileName, documentName, "3"); + envelopeDefinition.setDocuments(Collections.singletonList(doc)); + // Request that the envelope be sent by setting |status| to "sent". + // To request that the envelope be created as a draft, set to "created" + envelopeDefinition.setStatus(EnvelopeHelpers.ENVELOPE_STATUS_SENT); + + return envelopeDefinition; + } +} diff --git a/src/main/java/com/docusign/core/common/Utils.java b/src/main/java/com/docusign/core/common/Utils.java index eaaaec2b..94cb8d76 100644 --- a/src/main/java/com/docusign/core/common/Utils.java +++ b/src/main/java/com/docusign/core/common/Utils.java @@ -8,6 +8,13 @@ import org.apache.commons.codec.binary.StringUtils; import org.apache.commons.lang3.ObjectUtils; +import org.springframework.http.HttpHeaders; + +import com.docusign.core.model.Session; +import com.docusign.core.model.User; +import com.docusign.esign.api.AccountsApi; +import com.docusign.esign.client.ApiClient; +import com.docusign.esign.model.AccountInformation; public final class Utils { @@ -73,4 +80,22 @@ public static List findDifferentFields(Object left, Object right, boo .filter(field -> !StringUtils.equals(field.getLeftValue(), field.getRightValue())) .collect(Collectors.toList()); } + + public static Boolean isCfr(String basePath, String accessToken, String accountId) throws Exception { + if(accessToken == null){ + + } + ApiClient apiClient = new ApiClient(basePath); + apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); + AccountsApi accountsApi = new AccountsApi(apiClient); + + AccountInformation accountInfo = accountsApi.getAccountInformation(accountId); + String isEnabled = accountInfo.getStatus21CFRPart11(); + + if(isEnabled != null && isEnabled.equals("enabled")){ + return true; + } else { + return false; + } + } } diff --git a/src/main/java/com/docusign/core/controller/AbstractController.java b/src/main/java/com/docusign/core/controller/AbstractController.java index 060617f2..8a4f0084 100644 --- a/src/main/java/com/docusign/core/controller/AbstractController.java +++ b/src/main/java/com/docusign/core/controller/AbstractController.java @@ -43,6 +43,7 @@ public abstract class AbstractController { protected static final String ERROR_PAGE = "error"; private static final String EXAMPLE_TEXT = "example"; protected static final String LAUNCHER_TEXTS = "launcherTexts"; + protected static final String REDIRECT_CFR_QUICKSTART = REDIRECT_PREFIX + "/eg041"; @Autowired private OAuth2ClientContext oAuth2ClientContext; @@ -84,7 +85,12 @@ public String get(WorkArguments args, ModelMap model) { onInitModel(args, model); return pagePath; } catch (Exception exception) { - return handleException(exception, model); + if (config.getQuickstart().equals("true") && exception.getMessage() == config.getCodeExamplesText().getSupportingTexts().getCFRError()){ + config.setQuickstart("false"); + return handleRedirectToCfr(model); + } else { + return handleException(exception, model); + } } } @@ -164,6 +170,10 @@ private String handleException(Exception exception, ModelMap model) { return ERROR_PAGE; } + private String handleRedirectToCfr(ModelMap model) { + return REDIRECT_CFR_QUICKSTART; + } + private boolean isTokenExpired() { OAuth2AccessToken accessToken = oAuth2ClientContext.getAccessToken(); boolean tokenExpired = accessToken != null && accessToken.isExpired(); diff --git a/src/main/java/com/docusign/core/controller/IndexController.java b/src/main/java/com/docusign/core/controller/IndexController.java index bc790868..6ab3b35e 100644 --- a/src/main/java/com/docusign/core/controller/IndexController.java +++ b/src/main/java/com/docusign/core/controller/IndexController.java @@ -2,10 +2,14 @@ import com.docusign.DSConfiguration; import com.docusign.common.ApiIndex; +import com.docusign.core.common.Utils; import com.docusign.core.model.ApiType; import com.docusign.core.model.AuthType; import com.docusign.core.model.Session; +import com.docusign.core.model.User; import com.docusign.core.security.OAuthProperties; +import com.docusign.esign.model.Group; +import com.docusign.core.controller.AbstractController; import java.io.BufferedWriter; import java.io.File; @@ -46,10 +50,14 @@ public class IndexController { private static final String ATTR_TITLE = "title"; private static final String LAUNCHER_TEXTS = "launcherTexts"; private static final String CODE_EXAMPLE_GROUPS = "codeExampleGroups"; + private static final String STATUS_CFR = "statusCFR"; @Autowired private Session session; + @Autowired + private User user; + @Autowired private OAuthProperties jwtGrantSso; @@ -62,15 +70,26 @@ public class IndexController { @GetMapping(path = "/") public String index(ModelMap model, HttpServletResponse response) throws IOException { model.addAttribute(ATTR_TITLE,"Home"); - + Boolean isCFR = false; + if(user.getAccessToken() != null){ + try { + isCFR = Utils.isCfr(session.getBasePath(), user.getAccessToken(), session.getAccountId()); + } catch (Exception exception) { + return exception.toString(); + } + } if (config.getQuickstart().equals("true") && config.getSelectedApiIndex().equals(ApiIndex.ESIGNATURE) && !(SecurityContextHolder.getContext().getAuthentication() instanceof OAuth2Authentication)){ - String site = config.getSelectedApiIndex().getPathOfFirstExample(); - response.setStatus(response.SC_MOVED_TEMPORARILY); - response.setHeader("Location", site); - return null; + String site = config.getSelectedApiIndex().getPathOfFirstExample(); + response.setStatus(response.SC_MOVED_TEMPORARILY); + response.setHeader("Location", site); + return null; } + if (isCFR){ + session.setStatusCFR("enabled"); + model.addAttribute(STATUS_CFR, "enabled"); + } model.addAttribute(LAUNCHER_TEXTS, config.getCodeExamplesText().SupportingTexts); model.addAttribute(CODE_EXAMPLE_GROUPS, config.getCodeExamplesText().Groups.toArray()); return session.getApiIndexPath(); @@ -81,7 +100,7 @@ public ModelAndView mustAuthenticateController(ModelMap model) throws IOExceptio model.addAttribute(LAUNCHER_TEXTS, config.getCodeExamplesText().SupportingTexts); model.addAttribute(ATTR_TITLE, config.getCodeExamplesText().SupportingTexts.LoginPage.LoginButton); if (session.isRefreshToken() || config.getQuickstart().equals("true")) { - config.setQuickstart("false"); + if (config.getSelectedApiType().equals(ApiType.MONITOR)) { return new ModelAndView(getRedirectView(AuthType.JWT)); diff --git a/src/main/java/com/docusign/core/model/Session.java b/src/main/java/com/docusign/core/model/Session.java index fa5ee37a..46f2844b 100644 --- a/src/main/java/com/docusign/core/model/Session.java +++ b/src/main/java/com/docusign/core/model/Session.java @@ -24,6 +24,7 @@ public class Session implements Serializable { private String envelopeId; private String templateId; private String templateName; + private String statusCFR; private List envelopeDocuments; private String permissionProfileId; private String permissionProfileName; diff --git a/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java b/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java index dc1912ac..e3ad7124 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java +++ b/src/main/java/com/docusign/core/model/manifestModels/CodeExampleText.java @@ -13,6 +13,8 @@ public class CodeExampleText { public String ExampleName; + public String CFREnabled; + public String ExampleDescription; public String Notes; diff --git a/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java b/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java index d5985574..55925424 100644 --- a/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java +++ b/src/main/java/com/docusign/core/model/manifestModels/SupportingTexts.java @@ -28,6 +28,8 @@ public class SupportingTexts { public String WelcomeText; + public String CFRError; + public LoginPage LoginPage; public SelectAPIPage SelectAPIPage; diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp new file mode 100644 index 00000000..5d449a38 --- /dev/null +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp @@ -0,0 +1,91 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + + + +

    ${example.getExampleName()}

    +

    ${example.getExampleDescription()}

    + +

    Documentation about this example.

    +
    + + + +

    + ${viewSourceFile} +

    + +
    +
    + + + +
    +
    + + + + + + ${launcherTexts.getHelpingTexts().getEmailWontBeShared()} + +
    +
    + + + + + + ${launcherTexts.getHelpingTexts().getCountryCodeText()} + +
    +
    + + + + + + ${launcherTexts.getHelpingTexts().getPhoneNumberWillBeNotified()} ${launcherTexts.getHelpingTexts().getPhoneNumberWontBeShared()} + +
    + + +
    + + diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp index fb91f04e..fe5d2578 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/index.jsp @@ -31,42 +31,88 @@ -

    - - ${example.getExampleName()} - -

    - -

    ${example.getExampleDescription()}

    - -

    - - - ${launcherTexts.getAPIMethodUsed()} - - - ${launcherTexts.getAPIMethodUsedPlural()} - - - - - - ${link.getPathName()} - - - - - . - - - and - - - , - - - -

    + + + +

    + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    + +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + + + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    + + +

    + + ${example.getExampleName()} + +

    + +

    ${example.getExampleDescription()}

    + +

    + + + ${launcherTexts.getAPIMethodUsed()} + + + ${launcherTexts.getAPIMethodUsedPlural()} + + + + + + ${link.getPathName()} + + + + + . + + + and + + + , + + + +

    +
    +
    +
    From 47a5a821a10a6e0282b0a91a3dce1954352c02d0 Mon Sep 17 00:00:00 2001 From: Karissa Jacobsen Date: Thu, 17 Nov 2022 14:54:34 -0800 Subject: [PATCH 359/699] update field order --- .../views/pages/esignature/examples/eg041.jsp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp index 5d449a38..609ba33c 100644 --- a/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp +++ b/src/main/webapp/WEB-INF/templates/views/pages/esignature/examples/eg041.jsp @@ -2,8 +2,8 @@ - - + + @@ -20,19 +20,6 @@

    -
    - - - -
    +
    + + + +