-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PB-27291 Ability to return transaction GUIDs only
- Loading branch information
mateusz
authored and
john
committed
May 28, 2019
1 parent
98a4b4a
commit 9033055
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
sdk/src/main/java/com/silanis/esl/sdk/examples/GetPackageFieldsListExample.java
This file contains 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,51 @@ | ||
package com.silanis.esl.sdk.examples; | ||
|
||
import com.google.common.collect.Sets; | ||
import com.silanis.esl.sdk.DocumentPackage; | ||
import com.silanis.esl.sdk.DocumentType; | ||
import com.silanis.esl.sdk.PackageStatus; | ||
import com.silanis.esl.sdk.Page; | ||
import com.silanis.esl.sdk.PageRequest; | ||
import com.silanis.esl.sdk.builder.FieldBuilder; | ||
import java.util.Map; | ||
|
||
import static com.silanis.esl.sdk.builder.DocumentBuilder.newDocumentWithName; | ||
import static com.silanis.esl.sdk.builder.PackageBuilder.newPackageNamed; | ||
import static com.silanis.esl.sdk.builder.SignatureBuilder.signatureFor; | ||
import static com.silanis.esl.sdk.builder.SignerBuilder.newSignerWithEmail; | ||
import static org.joda.time.DateMidnight.now; | ||
|
||
public class GetPackageFieldsListExample extends SDKSample { | ||
|
||
public Page<Map<String, String>> packages; | ||
|
||
public static void main( String... args ) { | ||
new GetPackageFieldsListExample().run(); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
DocumentPackage superDuperPackage = newPackageNamed(getPackageName()) | ||
.describedAs( "This is a package created using the eSignLive SDK" ) | ||
.expiresAt( now().plusMonths( 1 ).toDate() ) | ||
.withEmailMessage( "This message should be delivered to all signers" ) | ||
.withSigner( newSignerWithEmail( email1 ) | ||
.withFirstName( "John" ) | ||
.withLastName( "Smith" ) | ||
.withTitle( "Managing Director" ) | ||
.withCompany( "Acme Inc." ) ) | ||
.withDocument( newDocumentWithName( "First Document" ) | ||
.fromStream( documentInputStream1, DocumentType.PDF ) | ||
.withSignature( signatureFor( email1 ) | ||
.onPage( 0 ) | ||
.atPosition( 100, 100 ) | ||
.withField( FieldBuilder.textField() | ||
.onPage( 0 ) | ||
.atPosition( 400, 100 ) | ||
.withSize( 200, 50 ) ) ) ) | ||
.build(); | ||
|
||
packageId = eslClient.createPackage( superDuperPackage ); | ||
packages = eslClient.getPackageService().getPackagesFields(PackageStatus.DRAFT, new PageRequest( 1 ), Sets.newHashSet("id")); | ||
} | ||
} |
This file contains 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 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
17 changes: 17 additions & 0 deletions
17
tester/src/test/java/com/silanis/esl/sdk/examples/GetPackageFieldsListExampleTest.java
This file contains 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,17 @@ | ||
package com.silanis.esl.sdk.examples; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
public class GetPackageFieldsListExampleTest { | ||
@Test | ||
public void verifyResult() { | ||
GetPackageFieldsListExample example = new GetPackageFieldsListExample(); | ||
example.run(); | ||
|
||
assertThat(example.packages.getResults().get(0).get("id"), is(example.packageId.getId())); | ||
} | ||
|
||
} |