Skip to content

Commit

Permalink
feat: Add iframeable_embed_url field to BoxSignRequestSigner class
Browse files Browse the repository at this point in the history
Closes: SDK-3318
  • Loading branch information
lukaszsocha2 committed Sep 11, 2023
1 parent d515262 commit 27998bd
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
28 changes: 28 additions & 0 deletions src/main/java/com/box/sdk/BoxSignRequestSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class BoxSignRequestSigner extends BoxJSONObject {
private String embedUrl;
private String redirectUrl;
private String declinedRedirectUrl;
private String iframeableEmedUrl;
private BoxAPIConnection api;

/**
Expand Down Expand Up @@ -247,6 +248,30 @@ public BoxSignRequestSigner setDeclinedRedirectUrl(String declinedRedirectUrl) {
return this;
}

/**
* Gets the URL designed for signing documents within an HTML iframe tag.
* It will be returned in the response only if the embedUrlExternalUserId parameter was passed
* in the create sign request call.
*
* @return url for signing documents within an HTML iframe tag.
*/
public String getIframeableEmedUrl() {
return this.iframeableEmedUrl;
}

/**
* Sets the URL designed for signing documents within an HTML iframe tag.
* It will be returned in the response only if the embedUrlExternalUserId parameter was passed
* in the create sign request call.
*
* @param iframeableEmedUrl url for signing documents within an HTML iframe tag.
* @return this BoxSignRequestSigner object for chaining.
*/
public BoxSignRequestSigner setIframeableEmedUrl(String iframeableEmedUrl) {
this.iframeableEmedUrl = iframeableEmedUrl;
return this;
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -298,6 +323,9 @@ void parseJSONMember(JsonObject.Member member) {
case "declined_redirect_url":
this.declinedRedirectUrl = value.asString();
break;
case "iframeable_embed_url":
this.iframeableEmedUrl = value.asString();
break;
default:
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/Fixtures/BoxSignRequest/CreateSignRequest200.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
],
"embed_url": "https://example.com",
"redirect_url": "https://box.com/redirect_url_signer_1",
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1"
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1",
"iframeable_embed_url": "https://app.box.com/embed/sign/document/gfhr4222-a331-494b-808b-79bc7f3992a3/f14d7098-a331-494b-808b-79bc7f3992a4"
}
],
"source_files": [
Expand Down
3 changes: 2 additions & 1 deletion src/test/Fixtures/BoxSignRequest/GetAllSignRequests200.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
],
"embed_url": "https://example.com",
"redirect_url": "https://box.com/redirect_url_signer_1",
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1"
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1",
"iframeable_embed_url": "https://app.box.com/embed/sign/document/gfhr4222-a331-494b-808b-79bc7f3992a3/f14d7098-a331-494b-808b-79bc7f3992a4"
}
],
"source_files": [
Expand Down
3 changes: 2 additions & 1 deletion src/test/Fixtures/BoxSignRequest/GetSignRequest200.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
],
"embed_url": "https://example.com",
"redirect_url": "https://box.com/redirect_url_signer_1",
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1"
"declined_redirect_url": "https://box.com/declined_redirect_url_signer_1",
"iframeable_embed_url": "https://app.box.com/embed/sign/document/gfhr4222-a331-494b-808b-79bc7f3992a3/f14d7098-a331-494b-808b-79bc7f3992a4"
}
],
"source_files": [
Expand Down
7 changes: 7 additions & 0 deletions src/test/java/com/box/sdk/BoxSignRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public void createSignRequestSucceeds() {
final String prepareUrl = "https://prepareurl.com";
final String redirectUrl = "https://box.com/redirect_url";
final String declinedRedirectUrl = "https://box.com/declined_redirect_url";
final String iframeableEmedUrl = "https://app.box.com/embed/sign/document/gfhr4222-a331-494b-808b-79bc7f3992a3/f14d7098-a331-494b-808b-79bc7f3992a4";

final String signerRedirectUrl = "https://box.com/redirect_url_signer_1";
final String signerDeclinedRedirectUrl = "https://box.com/declined_redirect_url_signer_1";
Expand All @@ -63,6 +64,7 @@ public void createSignRequestSucceeds() {

List<BoxSignRequestSigner> signers = new ArrayList<>();
BoxSignRequestSigner newSigner = new BoxSignRequestSigner("[email protected]");
newSigner.setEmbedUrlExternalUserId("1234");
signers.add(newSigner);

String parentFolderId = "55555";
Expand All @@ -77,6 +79,7 @@ public void createSignRequestSucceeds() {
BoxSignRequestSigner signer = signRequestInfo.getSigners().get(0);
BoxSignerInput input = signer.getInputs().get(0);
assertEquals(signerRedirectUrl, signer.getRedirectUrl());
assertEquals(iframeableEmedUrl, signer.getIframeableEmedUrl());
assertEquals(signerDeclinedRedirectUrl, signer.getDeclinedRedirectUrl());

assertEquals(prepareUrl, signRequestInfo.getPrepareUrl());
Expand All @@ -102,6 +105,7 @@ public void getSignRequestInfoSucceeds() {
final String prepareUrl = "https://prepareurl.com";
final String redirectUrl = "https://box.com/redirect_url";
final String declinedRedirectUrl = "https://box.com/declined_redirect_url";
final String iframeableEmedUrl = "https://app.box.com/embed/sign/document/gfhr4222-a331-494b-808b-79bc7f3992a3/f14d7098-a331-494b-808b-79bc7f3992a4";

final String signerRedirectUrl = "https://box.com/redirect_url_signer_1";
final String signerDeclinedRedirectUrl = "https://box.com/declined_redirect_url_signer_1";
Expand All @@ -125,6 +129,7 @@ public void getSignRequestInfoSucceeds() {
BoxSignerInput input = signer.getInputs().get(0);
assertEquals(signerRedirectUrl, signer.getRedirectUrl());
assertEquals(signerDeclinedRedirectUrl, signer.getDeclinedRedirectUrl());
assertEquals(iframeableEmedUrl, signer.getIframeableEmedUrl());

assertEquals(prepareUrl, signRequestInfo.getPrepareUrl());
assertEquals(redirectUrl, signRequestInfo.getRedirectUrl());
Expand All @@ -148,6 +153,7 @@ public void getAllSignRequestsSucceeds() {
final String prepareUrl = "https://prepareurl.com";
final String redirectUrl = "https://box.com/redirect_url";
final String declinedRedirectUrl = "https://box.com/declined_redirect_url";
final String iframeableEmedUrl = "https://app.box.com/embed/sign/document/gfhr4222-a331-494b-808b-79bc7f3992a3/f14d7098-a331-494b-808b-79bc7f3992a4";

final String signerRedirectUrl = "https://box.com/redirect_url_signer_1";
final String signerDeclinedRedirectUrl = "https://box.com/declined_redirect_url_signer_1";
Expand All @@ -170,6 +176,7 @@ public void getAllSignRequestsSucceeds() {
BoxSignerInput input = signer.getInputs().get(0);
assertEquals(signerRedirectUrl, signer.getRedirectUrl());
assertEquals(signerDeclinedRedirectUrl, signer.getDeclinedRedirectUrl());
assertEquals(iframeableEmedUrl, signer.getIframeableEmedUrl());

assertEquals(prepareUrl, firstSignRequest.getPrepareUrl());
assertEquals(redirectUrl, firstSignRequest.getRedirectUrl());
Expand Down

0 comments on commit 27998bd

Please sign in to comment.