forked from signnow/SignNowJavaAPiClient
-
Notifications
You must be signed in to change notification settings - Fork 0
feature/TECH-3959 Embedding Group Invites Additions #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
VitaliiSkuratovskyi
merged 4 commits into
master
from
feature/TECH-3959_embedding_invites_additions
Aug 5, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0351a32
Add embedded invite enhancements: roles, field invite state, delete e…
VitaliiSkuratovskyi 6089804
Add document group embedded invite support, bump to 1.0.8
VitaliiSkuratovskyi 8c0c6c5
Merge remote-tracking branch 'origin' into feature/TECH-3959_embeddin…
VitaliiSkuratovskyi 4435b22
removed Claude generated CHANGELOG file
VitaliiSkuratovskyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...b/src/test/java/com/signnow/library/dto/DocumentGroupEmbeddedInviteSerializationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| package com.signnow.library.dto; | ||
|
|
||
| import com.fasterxml.jackson.databind.JsonNode; | ||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
| import static org.junit.jupiter.api.Assertions.assertNull; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| /** | ||
| * Wire-format tests for the embedded group invite DTOs: request bodies must carry | ||
| * the exact snake_case keys with nulls omitted, responses must tolerate unknown keys | ||
| * (the mapper below fails on unknown properties, like the client's Jackson provider). | ||
| */ | ||
| class DocumentGroupEmbeddedInviteSerializationTest { | ||
| private final ObjectMapper mapper = new ObjectMapper(); | ||
|
|
||
| @Test | ||
| void createRequestSerializesExactKeys() throws Exception { | ||
| DocumentGroup.EmbeddedGroupInviteDocument document = | ||
| new DocumentGroup.EmbeddedGroupInviteDocument("doc123", "Signer 1"); | ||
| DocumentGroup.EmbeddedGroupInviteSigner signer = | ||
| new DocumentGroup.EmbeddedGroupInviteSigner("signer@example.com", document); | ||
| signer.firstName = "John"; | ||
| signer.lastName = "Doe"; | ||
| signer.language = "en"; | ||
| DocumentGroup.EmbeddedGroupInviteRequest request = new DocumentGroup.EmbeddedGroupInviteRequest( | ||
| new DocumentGroup.EmbeddedGroupInviteStep(1, signer)); | ||
|
|
||
| JsonNode actual = mapper.readTree(mapper.writeValueAsString(request)); | ||
| JsonNode expected = mapper.readTree("{" | ||
| + "\"invites\":[{\"order\":1,\"signers\":[{" | ||
| + "\"email\":\"signer@example.com\",\"auth_method\":\"none\"," | ||
| + "\"first_name\":\"John\",\"last_name\":\"Doe\",\"language\":\"en\"," | ||
| + "\"documents\":[{\"id\":\"doc123\",\"action\":\"sign\",\"role\":\"Signer 1\"}]" | ||
| + "}]}]," | ||
| + "\"sign_as_merged\":true}"); | ||
|
|
||
| assertEquals(expected, actual); | ||
| } | ||
|
|
||
| @Test | ||
| void createRequestOmitsNullOptionalFields() throws Exception { | ||
| DocumentGroup.EmbeddedGroupInviteRequest request = new DocumentGroup.EmbeddedGroupInviteRequest( | ||
| new DocumentGroup.EmbeddedGroupInviteStep(1, | ||
| new DocumentGroup.EmbeddedGroupInviteSigner("signer@example.com", | ||
| new DocumentGroup.EmbeddedGroupInviteDocument("doc123", "Signer 1")))); | ||
|
|
||
| JsonNode signer = mapper.readTree(mapper.writeValueAsString(request)) | ||
| .get("invites").get(0).get("signers").get(0); | ||
|
|
||
| assertFalse(signer.has("first_name")); | ||
| assertFalse(signer.has("last_name")); | ||
| assertFalse(signer.has("language")); | ||
| } | ||
|
|
||
| @Test | ||
| void linkRequestSerializesExactKeys() throws Exception { | ||
| DocumentGroup.EmbeddedGroupInviteLinkRequest request = | ||
| new DocumentGroup.EmbeddedGroupInviteLinkRequest("signer@example.com"); | ||
|
|
||
| JsonNode actual = mapper.readTree(mapper.writeValueAsString(request)); | ||
| JsonNode expected = mapper.readTree( | ||
| "{\"email\":\"signer@example.com\",\"auth_method\":\"none\",\"link_expiration\":45}"); | ||
|
|
||
| assertEquals(expected, actual); | ||
| } | ||
|
|
||
| @Test | ||
| void createResponseToleratesUnknownKeys() throws Exception { | ||
| DocumentGroup.EmbeddedGroupInviteResponse response = mapper.readValue( | ||
| "{\"data\":{\"id\":\"invite123\",\"unexpected\":\"x\"},\"extra\":1}", | ||
| DocumentGroup.EmbeddedGroupInviteResponse.class); | ||
|
|
||
| assertEquals("invite123", response.getId()); | ||
| } | ||
|
|
||
| @Test | ||
| void linkResponseToleratesUnknownKeys() throws Exception { | ||
| DocumentGroup.EmbeddedGroupInviteLinkResponse response = mapper.readValue( | ||
| "{\"data\":{\"link\":\"https://example.com/sign\"},\"extra\":\"x\"}", | ||
| DocumentGroup.EmbeddedGroupInviteLinkResponse.class); | ||
|
|
||
| assertEquals("https://example.com/sign", response.getLink()); | ||
| } | ||
|
|
||
| @Test | ||
| void groupInfoV2ResponseToleratesUnknownKeys() throws Exception { | ||
| DocumentGroup.DocumentGroupV2Response response = mapper.readValue("{\"data\":{" | ||
| + "\"id\":\"group123\",\"name\":\"Bundle\",\"created\":1712233114," | ||
| + "\"invite_id\":null,\"pending_step_id\":\"step1\",\"state\":\"pending\"," | ||
| + "\"last_invite_id\":\"inv1\",\"folder_id\":\"f1\"," | ||
| + "\"documents\":[{\"id\":\"doc1\",\"roles\":[\"Signer 1\"]," | ||
| + "\"document_name\":\"Contract\",\"updated\":1712233114," | ||
| + "\"field_invites\":[{\"id\":\"fi1\",\"status\":\"pending\"," | ||
| + "\"signer_email\":\"signer@example.com\",\"created\":1712233114}]}]," | ||
| + "\"freeform_invite\":{\"id\":null,\"last_id\":null}}}", | ||
| DocumentGroup.DocumentGroupV2Response.class); | ||
|
|
||
| assertEquals("group123", response.data.id); | ||
| assertNull(response.data.inviteId); | ||
| assertEquals("pending", response.data.state); | ||
| assertEquals("doc1", response.data.documents.get(0).id); | ||
| assertTrue(response.data.documents.get(0).roles.contains("Signer 1")); | ||
| assertEquals("pending", response.data.documents.get(0).fieldInvites.get(0).status); | ||
| assertEquals("signer@example.com", response.data.documents.get(0).fieldInvites.get(0).signerEmail); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.