public class CreateTransactionViewModel extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
CreateTransactionViewModel.AddDocumentListener
provides the listener with certain events regarding adding a document to a Transaction.
|
static interface |
CreateTransactionViewModel.CreateTransactionListener
provides the listener with certain events regarding creation of a Transaction
|
static class |
CreateTransactionViewModel.SupportedFileTypes |
Constructor and Description |
---|
CreateTransactionViewModel() |
Modifier and Type | Method and Description |
---|---|
static Approval |
addApproval(String roleId) |
static String |
addDocument(String transactionId,
Uri documentUri,
CreateTransactionViewModel.AddDocumentListener listener)
Adds a document to a transaction.
|
static String |
addDocument(String transactionId,
Uri documentUri,
String documentId,
String documentName,
String documentDescription,
CreateTransactionViewModel.AddDocumentListener listener)
Adds a document to a transaction.
|
static String |
addDocument(String transactionId,
Uri documentUri,
String documentId,
String documentName,
String documentDescription,
List<Approval> approvals,
CreateTransactionViewModel.AddDocumentListener listener)
Adds a document to a transaction.
|
static Role |
addGroupAsRole(String transactionId,
String groupId,
String replaceRoleWithId,
String signerId,
int position)
Adds a group as signing role to a transaction.
|
static Role |
addRole(String transactionId,
String firstName,
String lastName,
String email,
String company,
String title)
Adds a new signing role to a transaction.
|
static Role |
addSenderAsRole(String transactionId)
Adds sender of the transaction as a signing role to the transaction.
|
static Transaction |
createTransaction(String name)
Creates new transaction object and returns it.
|
static void |
createTransactionFromTemplate(String name,
String templateId,
CreateTransactionViewModel.CreateTransactionListener createTransactionListener)
Creates new transaction object from a template.
|
static List<Role> |
getAllRolesForTransactionWithID(String transactionID)
returns a list of all signing roles for a transaction.
|
static List<Group> |
getAvailableGroupsForTransaction(String transactionId)
returns the list of available groups that are not still added to transaction.
|
static String |
getCurrentTransactionIdFromId(String id)
This method is for internal use
|
static Role |
getRoleForEmail(String transactionId,
String email)
finds and returns the corresponding role for a signer with known email address in a transaction.
|
static String |
getServerTransactionId(String currentTransactionId)
gets the permanent unique identifier a transaction from a temporary transaction id.
|
static Transaction |
getTransactionFromCache(String transactionId)
Gets a locally saved transaction and returns it.
|
static void |
moveDocumentToPosition(String transactionId,
String documentId,
int position)
Changes the order of documents by moving a document to a new position.
|
static boolean |
moveRoleToPosition(String transactionId,
String roleId,
int position)
Used for ordered signing scenario.
|
static void |
removeDocument(String transactionId,
String documentId)
Removes a document from a transaction.
|
static boolean |
removeRole(String transactionId,
String roleId)
Removes a role from a transaction.
|
static List<Role> |
rolesForEditSession(String transactionId)
Returns all roles for editing session of a transaction.
|
static void |
sendTransaction(String transactionId)
Sends a transaction for signing.
|
static void |
setInPersonSigning(String transactionId,
boolean inPerson)
Enables /Disables in-person signing mode for an existing transaction.
|
static boolean |
setOrderedSigning(String transactionId,
boolean ordered)
Enables/Disables the ordered signing feature of the transaction.
|
static boolean |
setRoleAuthToEmail(String transactionId,
String roleId)
Set authentication method of a role to email.
|
static boolean |
setRoleAuthToQaA(String transactionId,
String roleId,
String question1,
String answer1,
boolean maskAnswer1,
String question2,
String answer2,
boolean maskAnswer2)
Set authentication method of a role to Question and Answer.
|
static boolean |
setRoleAuthToSMS(String transactionId,
String roleId,
String cellphone)
Set authentication method of a role to SMS.
|
static boolean |
setRoleDetails(String transactionId,
String roleId,
String emailMessage,
boolean allowChangeRecipient)
Sets additional details to a role of a transaction.
|
static void |
setServerTransactionId(String tempId,
String serverId)
Sets the permanent identifier received from server to a transaction.
|
static void |
setTransactionAutocomplete(String transactionId,
boolean autocomplete)
Enables/Disables reviewing of documents before completing the transaction for the owner of the transaction.
|
static void |
setTransactionDescription(String transactionId,
String description)
Set a new description to an existing transaction.
|
static void |
setTransactionDueDate(String transactionId,
Date dueDate)
Sets a due date for an existing transaction.
|
static void |
setTransactionEmailMessage(String transactionId,
String emailMessage)
Set a new email message to an existing transaction.
|
static void |
setTransactionName(String transactionId,
String name)
Set a new name to an existing transaction.
|
static void |
setTransactionSettings(String transactionId,
String name,
String description,
String emailMessage,
boolean inPersonSigning,
boolean autocomplete,
Date dueDate)
Sets Settings attributes to a Transaction.
|
static String |
updateRole(String transactionId,
String roleId,
String firstName,
String lastName,
String email,
String company,
String title)
Updates a signing role details in a transaction.
|
static String |
updateRoleWithGroup(String transactionId,
String roleId,
String groupId)
Updates a signing role with a group signer.
|
public static Transaction createTransaction(String name)
CreateTransactionListener
) should be implemented.
This method returns a transaction with a temporary ID, once the object is synced an updated ID would be returned.name
- the desired name of the transaction.public static void createTransactionFromTemplate(String name, String templateId, CreateTransactionViewModel.CreateTransactionListener createTransactionListener)
ESignLive.getInstance().downloadTemplateWithId(...)
A list of templates could be obtained from ESignLive.getInstance().getTemplateList(..)
.
Use any templateId from that list.name
- the desired name of the transaction.templateId
- The unique Identifier of the template to be used.public static void setTransactionSettings(String transactionId, String name, String description, String emailMessage, boolean inPersonSigning, boolean autocomplete, Date dueDate) throws TransactionNotFoundException
transactionId
- The Transactions unique identifier.name
- the new name of the transaction.description
- the new description of the transaction.emailMessage
- the new email Message that gets sent to all recipients.inPersonSigning
- Flag to set if the Transaction could be signed in Person.autocomplete
- Flag to allow transaction owner to review the Transaction after the signing is complete.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static void setTransactionName(String transactionId, String name) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.name
- the new name of the transactionTransactionNotFoundException
- When there is no such transaction with the given identifier.public static void setTransactionDescription(String transactionId, String description) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.description
- the new description of the transactionTransactionNotFoundException
- When there is no such transaction with the given identifier.public static void setTransactionEmailMessage(String transactionId, String emailMessage) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.emailMessage
- the new email Message.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static void setInPersonSigning(String transactionId, boolean inPerson) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.inPerson
- true, if you wish to enable in-person signing mode.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static void setTransactionDueDate(String transactionId, Date dueDate) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.dueDate
- The date before which the all the signing must be completed.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static void setTransactionAutocomplete(String transactionId, boolean autocomplete) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.autocomplete
- Flag to allow transaction owner to review the Transaction after the signing is complete.
Set it to false if you want to enable reviewing before completion.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static boolean setOrderedSigning(String transactionId, boolean ordered) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.ordered
- true, if you wish to enable the ordered signing feature for the transaction.TransactionNotFoundException
public static Transaction getTransactionFromCache(String transactionId) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static String addDocument(String transactionId, Uri documentUri, @Nullable CreateTransactionViewModel.AddDocumentListener listener) throws FileNotFoundException, TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.documentUri
- the document Uri.listener
- AddDocumentListener that receives events regarding the success or failure of adding the document.FileNotFoundException
TransactionNotFoundException
public static String addDocument(String transactionId, Uri documentUri, @Nullable String documentId, String documentName, String documentDescription, @Nullable CreateTransactionViewModel.AddDocumentListener listener) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.documentUri
- the document Uri.documentId
- the id of the documentdocumentName
- the desired name of the document. If null is passed, the SDK will try to parse the name from the provided Uri.documentDescription
- description for the document to be added.listener
- AddDocumentListener that receives events regarding the success or failure of adding the document.TransactionNotFoundException
public static String addDocument(String transactionId, Uri documentUri, @Nullable String documentId, String documentName, String documentDescription, @Nullable List<Approval> approvals, @Nullable CreateTransactionViewModel.AddDocumentListener listener) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.documentUri
- the document Uri.documentId
- the id of the documentdocumentName
- the desired name of the document. If null is passed, the SDK will try to parse the name from the provided Uri.documentDescription
- description for the document to be added.approvals
- A list of all approvals being added to the document.listener
- AddDocumentListener that receives events regarding the success or failure of adding the document.TransactionNotFoundException
public static void moveDocumentToPosition(String transactionId, String documentId, int position) throws TransactionNotFoundException, DocumentNotFoundException
transactionId
- The unique identifier of the Transaction.documentId
- The unique identifier of the document to be moved.position
- The new position of the document.TransactionNotFoundException
- When there is no such transaction with the given identifier.DocumentNotFoundException
- When there is no such document with the given identifier found in transaction.public static void removeDocument(String transactionId, String documentId) throws TransactionNotFoundException, DocumentNotFoundException
transactionId
- The unique identifier of the Transaction.documentId
- The unique identifier of the document to be moved.TransactionNotFoundException
- When there is no such transaction with the given identifier.DocumentNotFoundException
- When there is no such document with the given identifier found in transaction.@Nullable public static Role addRole(String transactionId, String firstName, String lastName, String email, @Nullable String company, @Nullable String title) throws TransactionNotFoundException, FirstNameMissingException, LastNameMissingException, EmailMissingException, EmailValidationException, RoleAlreadyAddedException
transactionId
- The unique identifier of the Transaction.firstName
- The first name of the new signer to be added. This parameter is mandatory.lastName
- The last name of the new signer to be added. This parameter is mandatory.email
- The email address of the new signer to be added. This parameter is mandatory.company
- The company name of the new signer to be added. This parameter is optional.title
- The new signer's title. This parameter is optional.TransactionNotFoundException
- When there is no such transaction with the given identifier.FirstNameMissingException
- When the provided first name is null or empty.LastNameMissingException
- When the provided last name is null or empty.EmailMissingException
- When the provided email address is null or empty.EmailValidationException
- When the provided email address is not valid. Validity of emails can be checked using ESignLive.getInstance().isEmailFormatValid(...)
RoleAlreadyAddedException
- When another Role with same details is already added.public static Role addSenderAsRole(String transactionId) throws TransactionNotFoundException, FirstNameMissingException, RoleAlreadyAddedException, EmailValidationException, LastNameMissingException, EmailMissingException
transactionId
- The unique identifier of the Transaction.TransactionNotFoundException
- When there is no such transaction with the given identifier.FirstNameMissingException
- When the provided first name is null or empty.RoleAlreadyAddedException
- When another Role with same details is already added.EmailValidationException
- When the provided email address is not valid. Validity of emails can be checked using ESignLive.getInstance().isEmailFormatValid(...)
LastNameMissingException
- When the provided last name is null or empty.EmailMissingException
- When the provided email address is null or empty.public static String updateRole(String transactionId, String roleId, String firstName, String lastName, String email, @Nullable String company, @Nullable String title) throws TransactionNotFoundException, RoleNotFoundException, FirstNameMissingException, EmailValidationException, LastNameMissingException, EmailMissingException, RoleAlreadyAddedException, RoleDeletionException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be updated.firstName
- The first name of the new signer to be added. This parameter is mandatory.lastName
- The last name of the new signer to be added. This parameter is mandatory.email
- The email address of the new signer to be added. This parameter is mandatory.company
- The company name of the new signer to be added. This parameter is optional.title
- The new signer's title. This parameter is optional.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.FirstNameMissingException
- When the provided first name is null or empty.EmailValidationException
- When the provided email address is not valid. Validity of emails can be checked using ESignLive.getInstance().isEmailFormatValid(...)
LastNameMissingException
- When the provided last name is null or empty.EmailMissingException
- When the provided email address is null or empty.RoleAlreadyAddedException
- When another Role with same details is already added.RoleDeletionException
- When the role is already deleted.public static String updateRoleWithGroup(String transactionId, String roleId, String groupId) throws TransactionNotFoundException, RoleNotFoundException, GroupNotFoundException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be updated.groupId
- The unique identifier of the group being added.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.GroupNotFoundException
- When there is no such group with the given identifier.public static Role addGroupAsRole(String transactionId, String groupId, @Nullable String replaceRoleWithId, @Nullable String signerId, int position) throws TransactionNotFoundException, GroupNotFoundException
transactionId
- The unique identifier of the Transaction.groupId
- The unique identifier of the group being added.replaceRoleWithId
- The unique identifier of an existing role to be replaced by the group. Enter null to create a new Role with the group.signerId
- The unique identifier of the group signer. Enter null to let SDK to generate an Id.position
- If position is set to -1, the group will be added after all other roles. If position is 0 or bigger, it will be placed on the
corresponding place. If position is bigger that the roles number, the group will be placed last.TransactionNotFoundException
- When there is no such transaction with the given identifier.GroupNotFoundException
- When there is no such group with the given identifier.public static boolean removeRole(String transactionId, String roleId) throws TransactionNotFoundException, RoleNotFoundException, RoleDeletionException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be removed.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.RoleDeletionException
- When thr role can not be deleted.public static boolean moveRoleToPosition(String transactionId, String roleId, int position) throws TransactionNotFoundException, RoleNotFoundException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be moved.position
- New position of the role.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.public static boolean setRoleAuthToEmail(String transactionId, String roleId) throws TransactionNotFoundException, RoleNotFoundException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be moved.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.public static boolean setRoleAuthToSMS(String transactionId, String roleId, String cellphone) throws TransactionNotFoundException, RoleNotFoundException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be moved.cellphone
- The cell phone number which is going to receive the SMS.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.public static boolean setRoleAuthToQaA(String transactionId, String roleId, String question1, String answer1, boolean maskAnswer1, @Nullable String question2, @Nullable String answer2, boolean maskAnswer2) throws TransactionNotFoundException, RoleNotFoundException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be moved.question1
- first question. this field is mandatory.answer1
- answer to first question. this field is mandatory.maskAnswer1
- when set to true, the first answer text will be masked at signing time.question2
- second question. This field is optional.answer2
- answer to second question. This field is optional.maskAnswer2
- when set to true, the second answer text will be masked at signing time.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.public static List<Role> rolesForEditSession(String transactionId) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static List<Role> getAllRolesForTransactionWithID(String transactionID) throws TransactionNotFoundException
transactionID
- The unique identifier of the Transaction.TransactionNotFoundException
- When there is no such transaction with the given identifier.public static boolean setRoleDetails(String transactionId, String roleId, @Nullable String emailMessage, boolean allowChangeRecipient) throws TransactionNotFoundException, RoleNotFoundException
transactionId
- The unique identifier of the Transaction.roleId
- The unique identifier of the Role to be moved.emailMessage
- An email message sent to the particular signer at the time of sending the transaction. When using this feature, no email message should be set on transaction settings level.allowChangeRecipient
- A flag to allow changing the recipient.TransactionNotFoundException
- When there is no such transaction with the given identifier.RoleNotFoundException
- When there is no such role with the given identifier.@Nullable public static Role getRoleForEmail(String transactionId, String email)
transactionId
- The unique identifier of the Transaction.email
- email address of the signer.public static List<Group> getAvailableGroupsForTransaction(String transactionId) throws TransactionNotFoundException
transactionId
- The unique identifier of the Transaction.TransactionNotFoundException
- When there is no such transaction with the given identifier.@Nullable public static String getServerTransactionId(String currentTransactionId)
currentTransactionId
- temporary transaction identifier.public static void setServerTransactionId(String tempId, String serverId)
tempId
- temporary identifier of the transaction.serverId
- permanent identifier received from the server.public static void sendTransaction(String transactionId)
transactionId
- temporary identifier of the transaction.