boldsign 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +2 -0
- package/README.md +2 -0
- package/api/apis.ts +1 -1
- package/dist/api/apis.d.ts +1 -1
- package/dist/api/apis.js +1 -1
- package/dist/model/accessCodeDetail.d.ts +2 -0
- package/dist/model/accessCodeDetail.js +5 -0
- package/dist/model/accessCodeDetail.js.map +1 -1
- package/dist/model/authenticationSettings.d.ts +22 -0
- package/dist/model/authenticationSettings.js +27 -0
- package/dist/model/authenticationSettings.js.map +1 -0
- package/dist/model/documentSigner.d.ts +2 -0
- package/dist/model/documentSigner.js +5 -0
- package/dist/model/documentSigner.js.map +1 -1
- package/dist/model/documentSignerDetails.d.ts +2 -0
- package/dist/model/documentSignerDetails.js +5 -0
- package/dist/model/documentSignerDetails.js.map +1 -1
- package/dist/model/index.d.ts +3 -1
- package/dist/model/index.js +10 -3
- package/dist/model/index.js.map +1 -1
- package/dist/model/role.d.ts +2 -0
- package/dist/model/role.js +5 -0
- package/dist/model/role.js.map +1 -1
- package/dist/model/signerAuthenticationSettings.d.ts +15 -0
- package/dist/model/signerAuthenticationSettings.js +23 -0
- package/dist/model/signerAuthenticationSettings.js.map +1 -0
- package/dist/tests/config.d.ts +5 -0
- package/dist/tests/config.js +43 -0
- package/dist/tests/config.js.map +1 -0
- package/dist/tests/integration/BrandingApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/BrandingApiTest.spec.js +310 -0
- package/dist/tests/integration/BrandingApiTest.spec.js.map +1 -0
- package/dist/tests/integration/ContactsApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/ContactsApiTest.spec.js +249 -0
- package/dist/tests/integration/ContactsApiTest.spec.js.map +1 -0
- package/dist/tests/integration/CustomFieldApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/CustomFieldApiTest.spec.js +289 -0
- package/dist/tests/integration/CustomFieldApiTest.spec.js.map +1 -0
- package/dist/tests/integration/DocumentApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/DocumentApiTest.spec.js +1691 -0
- package/dist/tests/integration/DocumentApiTest.spec.js.map +1 -0
- package/dist/tests/integration/TemplateApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/TemplateApiTest.spec.js +1440 -0
- package/dist/tests/integration/TemplateApiTest.spec.js.map +1 -0
- package/dist/tests/integration/planApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/planApiTest.spec.js +41 -0
- package/dist/tests/integration/planApiTest.spec.js.map +1 -0
- package/dist/tests/integration/senderIdentity.spec.d.ts +1 -0
- package/dist/tests/integration/senderIdentity.spec.js +481 -0
- package/dist/tests/integration/senderIdentity.spec.js.map +1 -0
- package/dist/tests/integration/teamsApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/teamsApiTest.spec.js +230 -0
- package/dist/tests/integration/teamsApiTest.spec.js.map +1 -0
- package/dist/tests/integration/usersApiTest.spec.d.ts +1 -0
- package/dist/tests/integration/usersApiTest.spec.js +290 -0
- package/dist/tests/integration/usersApiTest.spec.js.map +1 -0
- package/dist/tests/unit/brandingApi.spec.d.ts +1 -0
- package/dist/tests/unit/brandingApi.spec.js +174 -0
- package/dist/tests/unit/brandingApi.spec.js.map +1 -0
- package/dist/tests/unit/contactsApi.spec.d.ts +1 -0
- package/dist/tests/unit/contactsApi.spec.js +154 -0
- package/dist/tests/unit/contactsApi.spec.js.map +1 -0
- package/dist/tests/unit/customFieldApi.spec.d.ts +1 -0
- package/dist/tests/unit/customFieldApi.spec.js +140 -0
- package/dist/tests/unit/customFieldApi.spec.js.map +1 -0
- package/dist/tests/unit/documentApi.spec.d.ts +1 -0
- package/dist/tests/unit/documentApi.spec.js +476 -0
- package/dist/tests/unit/documentApi.spec.js.map +1 -0
- package/dist/tests/unit/planApi.spec.d.ts +1 -0
- package/dist/tests/unit/planApi.spec.js +69 -0
- package/dist/tests/unit/planApi.spec.js.map +1 -0
- package/dist/tests/unit/senderIdentitiesApi.spec.d.ts +1 -0
- package/dist/tests/unit/senderIdentitiesApi.spec.js +148 -0
- package/dist/tests/unit/senderIdentitiesApi.spec.js.map +1 -0
- package/dist/tests/unit/teamApi.spec.d.ts +1 -0
- package/dist/tests/unit/teamApi.spec.js +116 -0
- package/dist/tests/unit/teamApi.spec.js.map +1 -0
- package/dist/tests/unit/templateApi.spec.d.ts +1 -0
- package/dist/tests/unit/templateApi.spec.js +285 -0
- package/dist/tests/unit/templateApi.spec.js.map +1 -0
- package/dist/tests/unit/userApi.spec.d.ts +1 -0
- package/dist/tests/unit/userApi.spec.js +163 -0
- package/dist/tests/unit/userApi.spec.js.map +1 -0
- package/docs/AccessCodeDetail.md +19 -0
- package/docs/AccessCodeDetails.md +13 -0
- package/docs/Address.md +16 -0
- package/docs/AttachmentInfo.md +14 -0
- package/docs/AuditTrail.md +18 -0
- package/docs/AuthenticationSettings.md +11 -0
- package/docs/Base64File.md +12 -0
- package/docs/BehalfDocument.md +27 -0
- package/docs/BehalfDocumentRecords.md +12 -0
- package/docs/BehalfOf.md +12 -0
- package/docs/BillingViewModel.md +11 -0
- package/docs/BrandCreated.md +11 -0
- package/docs/BrandCustomFieldDetails.md +16 -0
- package/docs/BrandingApi.md +258 -0
- package/docs/BrandingMessage.md +11 -0
- package/docs/BrandingRecords.md +11 -0
- package/docs/ChangeRecipient.md +18 -0
- package/docs/ConditionalRule.md +13 -0
- package/docs/ContactCreated.md +12 -0
- package/docs/ContactDetails.md +15 -0
- package/docs/ContactPageDetails.md +13 -0
- package/docs/ContactsApi.md +176 -0
- package/docs/ContactsDetails.md +16 -0
- package/docs/ContactsList.md +12 -0
- package/docs/CreateContactResponse.md +11 -0
- package/docs/CreateSenderIdentityRequest.md +16 -0
- package/docs/CreateTeamRequest.md +11 -0
- package/docs/CreateTemplateRequest.md +35 -0
- package/docs/CreateUser.md +14 -0
- package/docs/CustomDomainSettings.md +12 -0
- package/docs/CustomFieldApi.md +174 -0
- package/docs/CustomFieldCollection.md +11 -0
- package/docs/CustomFieldMessage.md +12 -0
- package/docs/CustomFormField.md +43 -0
- package/docs/Date.md +13 -0
- package/docs/DeleteCustomFieldReply.md +11 -0
- package/docs/Document.md +26 -0
- package/docs/DocumentApi.md +756 -0
- package/docs/DocumentCC.md +11 -0
- package/docs/DocumentCcDetails.md +12 -0
- package/docs/DocumentCreated.md +11 -0
- package/docs/DocumentExpirySettings.md +16 -0
- package/docs/DocumentFiles.md +13 -0
- package/docs/DocumentFormFields.md +49 -0
- package/docs/DocumentInfo.md +14 -0
- package/docs/DocumentProperties.md +50 -0
- package/docs/DocumentReassign.md +13 -0
- package/docs/DocumentRecords.md +12 -0
- package/docs/DocumentSenderDetail.md +14 -0
- package/docs/DocumentSigner.md +31 -0
- package/docs/DocumentSignerDetails.md +37 -0
- package/docs/DocumentTags.md +12 -0
- package/docs/DownloadImageRequest.md +16 -0
- package/docs/EditSenderIdentityRequest.md +14 -0
- package/docs/EditTemplateRequest.md +29 -0
- package/docs/EditableDateFieldSettings.md +13 -0
- package/docs/EmbeddedCreateTemplateRequest.md +46 -0
- package/docs/EmbeddedCustomFieldCreated.md +11 -0
- package/docs/EmbeddedDocumentRequest.md +55 -0
- package/docs/EmbeddedFileDetails.md +16 -0
- package/docs/EmbeddedFileLink.md +11 -0
- package/docs/EmbeddedMergeTemplateFormRequest.md +56 -0
- package/docs/EmbeddedSendCreated.md +12 -0
- package/docs/EmbeddedSendTemplateFormRequest.md +53 -0
- package/docs/EmbeddedSigningLink.md +11 -0
- package/docs/EmbeddedTemplateCreated.md +12 -0
- package/docs/EmbeddedTemplateEditRequest.md +21 -0
- package/docs/EmbeddedTemplateEdited.md +11 -0
- package/docs/Error.md +12 -0
- package/docs/ErrorResult.md +11 -0
- package/docs/ExistingFormField.md +15 -0
- package/docs/ExtendExpiry.md +14 -0
- package/docs/FileInfo.md +14 -0
- package/docs/Font.md +18 -0
- package/docs/FormField.md +50 -0
- package/docs/FormGroup.md +15 -0
- package/docs/FormulaFieldSettings.md +12 -0
- package/docs/IdDocument.md +21 -0
- package/docs/IdReport.md +14 -0
- package/docs/IdVerification.md +18 -0
- package/docs/IdentityVerificationApi.md +109 -0
- package/docs/IdentityVerificationSettings.md +16 -0
- package/docs/ImageInfo.md +13 -0
- package/docs/MergeAndSendForSignForm.md +46 -0
- package/docs/NotificationSettings.md +22 -0
- package/docs/PageDetails.md +16 -0
- package/docs/PhoneNumber.md +12 -0
- package/docs/PlanApi.md +38 -0
- package/docs/PrefillField.md +12 -0
- package/docs/PrefillFieldRequest.md +12 -0
- package/docs/ProblemDetails.md +15 -0
- package/docs/RecipientNotificationSettings.md +22 -0
- package/docs/Rectangle.md +14 -0
- package/docs/ReminderMessage.md +13 -0
- package/docs/ReminderSettings.md +13 -0
- package/docs/RemoveAuthentication.md +14 -0
- package/docs/RevokeDocument.md +12 -0
- package/docs/Role.md +33 -0
- package/docs/Roles.md +33 -0
- package/docs/SendForSign.md +45 -0
- package/docs/SendForSignFromTemplateForm.md +43 -0
- package/docs/SenderIdentitiesApi.md +209 -0
- package/docs/SenderIdentityCreated.md +11 -0
- package/docs/SenderIdentityList.md +12 -0
- package/docs/SenderIdentityViewModel.md +19 -0
- package/docs/SignerAuthenticationSettings.md +12 -0
- package/docs/Size.md +12 -0
- package/docs/TeamCreated.md +11 -0
- package/docs/TeamDocumentRecords.md +12 -0
- package/docs/TeamListResponse.md +12 -0
- package/docs/TeamPageDetails.md +12 -0
- package/docs/TeamResponse.md +15 -0
- package/docs/TeamUpdateRequest.md +12 -0
- package/docs/TeamUsers.md +16 -0
- package/docs/Teams.md +14 -0
- package/docs/TeamsApi.md +141 -0
- package/docs/Template.md +29 -0
- package/docs/TemplateApi.md +484 -0
- package/docs/TemplateCC.md +12 -0
- package/docs/TemplateCreated.md +11 -0
- package/docs/TemplateFormFields.md +50 -0
- package/docs/TemplateProperties.md +37 -0
- package/docs/TemplateRecords.md +12 -0
- package/docs/TemplateRole.md +28 -0
- package/docs/TemplateSenderDetail.md +12 -0
- package/docs/TemplateSenderDetails.md +13 -0
- package/docs/TemplateSharedTemplateDetail.md +12 -0
- package/docs/TemplateSignerDetails.md +27 -0
- package/docs/TemplateTag.md +14 -0
- package/docs/TextTagDefinition.md +40 -0
- package/docs/TextTagOffset.md +12 -0
- package/docs/UpdateUser.md +14 -0
- package/docs/UpdateUserMetaData.md +12 -0
- package/docs/UserApi.md +240 -0
- package/docs/UserPageDetails.md +12 -0
- package/docs/UserProperties.md +21 -0
- package/docs/UserRecords.md +12 -0
- package/docs/UsersDetails.md +21 -0
- package/docs/Validation.md +13 -0
- package/docs/VerificationDataRequest.md +15 -0
- package/docs/ViewBrandDetails.md +34 -0
- package/docs/ViewCustomFieldDetails.md +17 -0
- package/model/accessCodeDetail.ts +7 -0
- package/model/authenticationSettings.ts +39 -0
- package/model/documentSigner.ts +7 -0
- package/model/documentSignerDetails.ts +7 -0
- package/model/index.ts +7 -0
- package/model/role.ts +7 -0
- package/model/signerAuthenticationSettings.ts +37 -0
- package/package.json +2 -1
|
@@ -0,0 +1,1691 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
const documentApi_1 = require("../../api/documentApi");
|
|
49
|
+
const brandingApi_1 = require("../../api/brandingApi");
|
|
50
|
+
const model_1 = require("../../model");
|
|
51
|
+
const fs = __importStar(require("fs"));
|
|
52
|
+
const config_1 = __importDefault(require("../config"));
|
|
53
|
+
function imageToBase64(imagePath) {
|
|
54
|
+
const imageBuffer = fs.readFileSync(imagePath);
|
|
55
|
+
const imageType = imagePath.substring(imagePath.lastIndexOf('.') + 1);
|
|
56
|
+
return `data:image/${imageType};base64,${imageBuffer.toString('base64')}`;
|
|
57
|
+
}
|
|
58
|
+
describe('Document API Test Suite', () => {
|
|
59
|
+
let brandingApi;
|
|
60
|
+
let documentApi;
|
|
61
|
+
let brandId;
|
|
62
|
+
let createdDocumentId;
|
|
63
|
+
let sendDocumentOnBehalfId;
|
|
64
|
+
let senderEmail;
|
|
65
|
+
const generateRandomEmail = () => {
|
|
66
|
+
const randomNum = Math.floor(1000 + Math.random() * 9000);
|
|
67
|
+
return `sdktesting${randomNum}@syncfusion.com`;
|
|
68
|
+
};
|
|
69
|
+
beforeAll(() => {
|
|
70
|
+
createdDocumentId = null;
|
|
71
|
+
sendDocumentOnBehalfId = null;
|
|
72
|
+
senderEmail = null;
|
|
73
|
+
const apiKey = config_1.default.apiKey;
|
|
74
|
+
const baseUrl = config_1.default.baseUrl;
|
|
75
|
+
if (!apiKey || !baseUrl) {
|
|
76
|
+
throw new Error("Environment variables 'API_KEY' or 'HOST_URL' are not set.");
|
|
77
|
+
}
|
|
78
|
+
documentApi = new documentApi_1.DocumentApi(baseUrl);
|
|
79
|
+
documentApi.setApiKey(apiKey);
|
|
80
|
+
brandingApi = new brandingApi_1.BrandingApi(baseUrl);
|
|
81
|
+
brandingApi.setApiKey(apiKey);
|
|
82
|
+
});
|
|
83
|
+
test('Test1: should fetch sender email details', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
var _a, _b, _c;
|
|
85
|
+
try {
|
|
86
|
+
const page = 1;
|
|
87
|
+
const pageSize = 10;
|
|
88
|
+
const listDocumentsResponse = yield documentApi.listDocuments(page, undefined, undefined, undefined, undefined, pageSize, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
89
|
+
senderEmail = (_c = (_b = (_a = listDocumentsResponse === null || listDocumentsResponse === void 0 ? void 0 : listDocumentsResponse.result) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.senderDetail) === null || _c === void 0 ? void 0 : _c.emailAddress;
|
|
90
|
+
console.log("Sender email fetched:", senderEmail !== null && senderEmail !== void 0 ? senderEmail : 'Not available');
|
|
91
|
+
expect(listDocumentsResponse.result).toBeDefined();
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error("Error occurred while fetching sender details:", error.message);
|
|
95
|
+
expect(error.message).toBeUndefined();
|
|
96
|
+
}
|
|
97
|
+
}), 20000);
|
|
98
|
+
test('Test2: should create a brand successfully with audit trail', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
+
const brandName = "NodeSDK";
|
|
100
|
+
const brandLogo = fs.createReadStream("tests/documents/logo.jpg");
|
|
101
|
+
const backgroundColor = "Blue";
|
|
102
|
+
const buttonColor = "Black";
|
|
103
|
+
const buttonTextColor = "White";
|
|
104
|
+
const emailDisplayName = "{SenderName} from Syncfusion";
|
|
105
|
+
const auditTrail = "true";
|
|
106
|
+
const disclaimerTitle = "Important Disclaimer";
|
|
107
|
+
try {
|
|
108
|
+
const createBrandApiResponse = yield brandingApi.createBrand(brandName, brandLogo, backgroundColor, buttonColor, buttonTextColor, emailDisplayName, auditTrail, disclaimerTitle);
|
|
109
|
+
console.log("Brand created successfully:", createBrandApiResponse.brandId);
|
|
110
|
+
brandId = createBrandApiResponse.brandId;
|
|
111
|
+
expect(createBrandApiResponse).toBeDefined();
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.log("Error occurred while creating the brand:", error);
|
|
115
|
+
expect(error).toBeUndefined();
|
|
116
|
+
}
|
|
117
|
+
}), 20000);
|
|
118
|
+
test('Test3: should send a document for signing successfully with existing brand ID and one signer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
119
|
+
try {
|
|
120
|
+
const signer1 = new model_1.DocumentSigner();
|
|
121
|
+
signer1.name = 'Test Signer';
|
|
122
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
123
|
+
signer1.signerOrder = 1;
|
|
124
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
125
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
126
|
+
signer1.authenticationCode = '123456';
|
|
127
|
+
const formField1 = new model_1.FormField();
|
|
128
|
+
formField1.name = 'Sign';
|
|
129
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
130
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
131
|
+
formField1.pageNumber = 1;
|
|
132
|
+
formField1.isRequired = true;
|
|
133
|
+
formField1.bounds = new model_1.Rectangle();
|
|
134
|
+
signer1.formFields = [formField1];
|
|
135
|
+
signer1.privateMessage = 'This is a private message for signer';
|
|
136
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
137
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
138
|
+
sendDocumentRequest.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
139
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
140
|
+
sendDocumentRequest.signers = [signer1];
|
|
141
|
+
sendDocumentRequest.brandId = brandId;
|
|
142
|
+
sendDocumentRequest.message = 'Please sign this document';
|
|
143
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
144
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
145
|
+
const createdDocumentId = sendDocumentResponse.documentId;
|
|
146
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.error('Error occurred while sending document for signing:', error);
|
|
150
|
+
expect(error).toBeUndefined();
|
|
151
|
+
}
|
|
152
|
+
}), 20000);
|
|
153
|
+
test('Test4: should send a document for signing successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
154
|
+
try {
|
|
155
|
+
const signer1 = new model_1.DocumentSigner();
|
|
156
|
+
signer1.name = 'Test Signer';
|
|
157
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
158
|
+
signer1.signerOrder = 1;
|
|
159
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
160
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
161
|
+
signer1.authenticationCode = '123456';
|
|
162
|
+
const formField1 = new model_1.FormField();
|
|
163
|
+
formField1.name = 'Sign';
|
|
164
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
165
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
166
|
+
formField1.pageNumber = 1;
|
|
167
|
+
formField1.isRequired = true;
|
|
168
|
+
formField1.bounds = new model_1.Rectangle();
|
|
169
|
+
signer1.formFields = [formField1];
|
|
170
|
+
signer1.privateMessage = 'This is private message for signer';
|
|
171
|
+
const signer2 = new model_1.DocumentSigner();
|
|
172
|
+
signer2.name = 'Test Reviewer';
|
|
173
|
+
signer2.emailAddress = 'mohammedmushraf.abuthakir+5@syncfusion.com';
|
|
174
|
+
signer2.signerOrder = 2;
|
|
175
|
+
signer2.signerType = model_1.DocumentSigner.SignerTypeEnum.Reviewer;
|
|
176
|
+
signer2.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.EmailOtp;
|
|
177
|
+
signer2.privateMessage = 'This is private message for Reviewer';
|
|
178
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
179
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
180
|
+
sendDocumentRequest.files = [
|
|
181
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
182
|
+
];
|
|
183
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
184
|
+
sendDocumentRequest.signers = [signer1, signer2];
|
|
185
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
186
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
187
|
+
createdDocumentId = sendDocumentResponse.documentId;
|
|
188
|
+
console.log('Created Document ID:', createdDocumentId);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
192
|
+
expect(error.message).toBeUndefined();
|
|
193
|
+
}
|
|
194
|
+
}), 20000);
|
|
195
|
+
test('Test5: should send a document for signing successfully with inperson signer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
196
|
+
try {
|
|
197
|
+
console.log("Sender email fetched:", senderEmail);
|
|
198
|
+
const signer1 = new model_1.DocumentSigner();
|
|
199
|
+
signer1.name = 'Test Signer';
|
|
200
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
201
|
+
signer1.signerOrder = 1;
|
|
202
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
203
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
204
|
+
signer1.authenticationCode = '123456';
|
|
205
|
+
const formField1 = new model_1.FormField();
|
|
206
|
+
formField1.name = 'Sign';
|
|
207
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
208
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
209
|
+
formField1.pageNumber = 1;
|
|
210
|
+
formField1.isRequired = true;
|
|
211
|
+
formField1.bounds = new model_1.Rectangle();
|
|
212
|
+
signer1.formFields = [formField1];
|
|
213
|
+
signer1.privateMessage = 'This is private message for signer';
|
|
214
|
+
signer1.recipientNotificationSettings = {
|
|
215
|
+
signatureRequest: true,
|
|
216
|
+
declined: true,
|
|
217
|
+
revoked: true,
|
|
218
|
+
signed: true,
|
|
219
|
+
completed: true,
|
|
220
|
+
expired: true,
|
|
221
|
+
reassigned: true,
|
|
222
|
+
deleted: true,
|
|
223
|
+
reminders: true,
|
|
224
|
+
editRecipient: true
|
|
225
|
+
};
|
|
226
|
+
const signer2 = new model_1.DocumentSigner();
|
|
227
|
+
signer2.name = 'Test Reviewer';
|
|
228
|
+
signer2.emailAddress = 'mohammedmushraf.abuthakir+5@syncfusion.com';
|
|
229
|
+
signer2.signerOrder = 2;
|
|
230
|
+
signer2.signerType = model_1.DocumentSigner.SignerTypeEnum.Reviewer;
|
|
231
|
+
signer2.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.EmailOtp;
|
|
232
|
+
signer2.privateMessage = 'This is private message for Reviewer';
|
|
233
|
+
signer2.phoneNumber = {
|
|
234
|
+
countryCode: '+91',
|
|
235
|
+
number: '6381261236'
|
|
236
|
+
};
|
|
237
|
+
signer2.deliveryMode = model_1.DocumentSigner.DeliveryModeEnum.EmailAndSms;
|
|
238
|
+
const signer3 = new model_1.DocumentSigner();
|
|
239
|
+
signer3.name = 'Test In-Person Signer';
|
|
240
|
+
signer3.emailAddress = 'mohammedmushraf.abuthakir+4@syncfusion.com';
|
|
241
|
+
signer3.signerOrder = 3;
|
|
242
|
+
signer3.signerType = model_1.DocumentSigner.SignerTypeEnum.InPersonSigner;
|
|
243
|
+
signer3.hostEmail = senderEmail;
|
|
244
|
+
signer3.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.EmailOtp;
|
|
245
|
+
const formField2 = new model_1.FormField();
|
|
246
|
+
formField2.name = 'Sign';
|
|
247
|
+
formField2.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
248
|
+
formField2.font = model_1.FormField.FontEnum.Helvetica;
|
|
249
|
+
formField2.pageNumber = 1;
|
|
250
|
+
formField2.isRequired = true;
|
|
251
|
+
formField2.bounds = new model_1.Rectangle();
|
|
252
|
+
signer3.formFields = [formField2];
|
|
253
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
254
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
255
|
+
sendDocumentRequest.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
256
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
257
|
+
sendDocumentRequest.hideDocumentId = true;
|
|
258
|
+
sendDocumentRequest.enableReassign = false;
|
|
259
|
+
sendDocumentRequest.signers = [signer1, signer2, signer3];
|
|
260
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
261
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
262
|
+
const createdDocumentId = sendDocumentResponse.documentId;
|
|
263
|
+
console.log('Created Document ID:', createdDocumentId);
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
console.error('Error occurred while sending document for signing:', error);
|
|
267
|
+
expect(error).toBeUndefined();
|
|
268
|
+
}
|
|
269
|
+
}), 20000);
|
|
270
|
+
test('Test6: should send a document with multiple CCs successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
271
|
+
try {
|
|
272
|
+
const files = [
|
|
273
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
274
|
+
];
|
|
275
|
+
const formFields = [];
|
|
276
|
+
const signatureField = new model_1.FormField();
|
|
277
|
+
signatureField.pageNumber = 1;
|
|
278
|
+
signatureField.bounds = new model_1.Rectangle();
|
|
279
|
+
signatureField.bounds.x = 100;
|
|
280
|
+
signatureField.bounds.y = 100;
|
|
281
|
+
signatureField.bounds.width = 100;
|
|
282
|
+
signatureField.bounds.height = 50;
|
|
283
|
+
formFields.push(signatureField);
|
|
284
|
+
const signers = [];
|
|
285
|
+
const signer1 = new model_1.DocumentSigner();
|
|
286
|
+
signer1.name = 'Mohammed';
|
|
287
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+88@syncfusion.com';
|
|
288
|
+
signer1.signerRole = 'SIGNER';
|
|
289
|
+
signer1.formFields = formFields;
|
|
290
|
+
signers.push(signer1);
|
|
291
|
+
const signer2 = new model_1.DocumentSigner();
|
|
292
|
+
signer2.name = 'Mohammed';
|
|
293
|
+
signer2.emailAddress = 'mohammedmushraf.abuthakir+80@syncfusion.com';
|
|
294
|
+
signer2.signerRole = 'SIGNER';
|
|
295
|
+
signer2.formFields = formFields;
|
|
296
|
+
signers.push(signer2);
|
|
297
|
+
const ccList = [];
|
|
298
|
+
for (let i = 1; i <= 20; i++) {
|
|
299
|
+
const cc = new model_1.DocumentCC();
|
|
300
|
+
cc.emailAddress = `mohammedmushraf.abuthakir+${i + 2}@syncfusion.com`;
|
|
301
|
+
ccList.push(cc);
|
|
302
|
+
}
|
|
303
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
304
|
+
sendDocumentRequest.title = 'Agreement Document';
|
|
305
|
+
sendDocumentRequest.files = files;
|
|
306
|
+
sendDocumentRequest.signers = signers;
|
|
307
|
+
sendDocumentRequest.cc = ccList;
|
|
308
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
309
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
310
|
+
const hasSyncfusionCC = ccList.some(cc => cc.emailAddress.includes('@syncfusion.com'));
|
|
311
|
+
const createdDocumentId = sendDocumentResponse.documentId;
|
|
312
|
+
console.log('Document sent successfully with document ID:', createdDocumentId);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
316
|
+
expect(error.message).toBeUndefined();
|
|
317
|
+
}
|
|
318
|
+
}), 20000);
|
|
319
|
+
test('Test7: should send a document with multiple files for signing successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
320
|
+
try {
|
|
321
|
+
const files = [
|
|
322
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
323
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
324
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
325
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
326
|
+
];
|
|
327
|
+
const formFields = [];
|
|
328
|
+
const signatureField = new model_1.FormField();
|
|
329
|
+
signatureField.pageNumber = 1;
|
|
330
|
+
signatureField.bounds = new model_1.Rectangle();
|
|
331
|
+
signatureField.bounds.x = 100;
|
|
332
|
+
signatureField.bounds.y = 100;
|
|
333
|
+
signatureField.bounds.width = 100;
|
|
334
|
+
signatureField.bounds.height = 50;
|
|
335
|
+
formFields.push(signatureField);
|
|
336
|
+
const signers = [];
|
|
337
|
+
const signer1 = new model_1.DocumentSigner();
|
|
338
|
+
signer1.name = 'Signer1';
|
|
339
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+5@syncfusion.com';
|
|
340
|
+
signer1.formFields = formFields;
|
|
341
|
+
signers.push(signer1);
|
|
342
|
+
const signer2 = new model_1.DocumentSigner();
|
|
343
|
+
signer2.name = 'Signer2';
|
|
344
|
+
signer2.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
345
|
+
signer2.formFields = formFields;
|
|
346
|
+
signers.push(signer2);
|
|
347
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
348
|
+
sendDocumentRequest.title = 'Agreement with Multiple Files';
|
|
349
|
+
sendDocumentRequest.files = files;
|
|
350
|
+
sendDocumentRequest.signers = signers;
|
|
351
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
352
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
353
|
+
const createdDocumentId = sendDocumentResponse.documentId;
|
|
354
|
+
console.log('Created Document ID:', createdDocumentId);
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
358
|
+
expect(error.message).toBeUndefined();
|
|
359
|
+
}
|
|
360
|
+
}), 20000);
|
|
361
|
+
test('Test8: should send a document with many signers successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
362
|
+
try {
|
|
363
|
+
const files = [
|
|
364
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
365
|
+
];
|
|
366
|
+
const formFields = [];
|
|
367
|
+
const signatureField = new model_1.FormField();
|
|
368
|
+
signatureField.pageNumber = 1;
|
|
369
|
+
signatureField.bounds = new model_1.Rectangle();
|
|
370
|
+
signatureField.bounds.x = 100;
|
|
371
|
+
signatureField.bounds.y = 100;
|
|
372
|
+
signatureField.bounds.width = 100;
|
|
373
|
+
signatureField.bounds.height = 50;
|
|
374
|
+
formFields.push(signatureField);
|
|
375
|
+
const signers = [];
|
|
376
|
+
for (let i = 0; i < 15; i++) {
|
|
377
|
+
const signer = new model_1.DocumentSigner();
|
|
378
|
+
signer.name = `Signer${i}`;
|
|
379
|
+
signer.emailAddress = `mohammedmushraf.abuthakir+${i}@syncfusion.com`;
|
|
380
|
+
signer.formFields = formFields;
|
|
381
|
+
signers.push(signer);
|
|
382
|
+
}
|
|
383
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
384
|
+
sendDocumentRequest.title = 'Agreement';
|
|
385
|
+
sendDocumentRequest.files = files;
|
|
386
|
+
sendDocumentRequest.signers = signers;
|
|
387
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
388
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
389
|
+
console.log('Created Document ID:', sendDocumentResponse.documentId);
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
393
|
+
expect(error.message).toBeUndefined();
|
|
394
|
+
}
|
|
395
|
+
}), 20000);
|
|
396
|
+
test('Test9: should fail to create document with no signers', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
397
|
+
try {
|
|
398
|
+
const sendForSign = {
|
|
399
|
+
title: 'Agreement',
|
|
400
|
+
files: [
|
|
401
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
402
|
+
],
|
|
403
|
+
signers: [],
|
|
404
|
+
};
|
|
405
|
+
const response = yield documentApi.sendDocument(sendForSign);
|
|
406
|
+
console.error('Expected error for missing signers, but document was created:', response);
|
|
407
|
+
}
|
|
408
|
+
catch (error) {
|
|
409
|
+
console.error('Error occurred while creating document:', error.message);
|
|
410
|
+
expect(error.message).toBeDefined();
|
|
411
|
+
}
|
|
412
|
+
}), 20000);
|
|
413
|
+
test('Test10: should fail to send a document for signing with an empty email address', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
414
|
+
try {
|
|
415
|
+
const signer1 = new model_1.DocumentSigner();
|
|
416
|
+
signer1.name = 'Test Signer';
|
|
417
|
+
signer1.emailAddress = '';
|
|
418
|
+
signer1.signerOrder = 1;
|
|
419
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
420
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
421
|
+
signer1.authenticationCode = '123456';
|
|
422
|
+
const formField1 = new model_1.FormField();
|
|
423
|
+
formField1.name = 'Sign';
|
|
424
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
425
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
426
|
+
formField1.pageNumber = 1;
|
|
427
|
+
formField1.isRequired = true;
|
|
428
|
+
formField1.bounds = new model_1.Rectangle();
|
|
429
|
+
signer1.formFields = [formField1];
|
|
430
|
+
signer1.privateMessage = 'This is private message for signer';
|
|
431
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
432
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
433
|
+
sendDocumentRequest.files = [
|
|
434
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
435
|
+
];
|
|
436
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
437
|
+
sendDocumentRequest.signers = [signer1];
|
|
438
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
439
|
+
console.log('Created Document ID:', createdDocumentId);
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
443
|
+
expect(error.message).toBeDefined();
|
|
444
|
+
}
|
|
445
|
+
}), 20000);
|
|
446
|
+
test('Test11: should fail to send a document for signing with an invalid email address', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
447
|
+
try {
|
|
448
|
+
const signer1 = new model_1.DocumentSigner();
|
|
449
|
+
signer1.name = 'Signer';
|
|
450
|
+
signer1.emailAddress = 'invalid-email.com';
|
|
451
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
452
|
+
const signer2 = new model_1.DocumentSigner();
|
|
453
|
+
signer2.name = 'Signer1';
|
|
454
|
+
signer2.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
455
|
+
signer2.signerOrder = 2;
|
|
456
|
+
signer2.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
457
|
+
const formField1 = new model_1.FormField();
|
|
458
|
+
formField1.name = 'Sign';
|
|
459
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
460
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
461
|
+
formField1.pageNumber = 1;
|
|
462
|
+
formField1.isRequired = true;
|
|
463
|
+
formField1.bounds = new model_1.Rectangle();
|
|
464
|
+
signer1.formFields = [formField1];
|
|
465
|
+
signer2.formFields = [formField1];
|
|
466
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
467
|
+
sendDocumentRequest.title = 'Agreement';
|
|
468
|
+
sendDocumentRequest.files = [
|
|
469
|
+
fs.createReadStream('tests/documents/agreement.pdf'),
|
|
470
|
+
];
|
|
471
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
472
|
+
sendDocumentRequest.signers = [signer1, signer2];
|
|
473
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
474
|
+
expect(sendDocumentResponse).toBeUndefined();
|
|
475
|
+
}
|
|
476
|
+
catch (error) {
|
|
477
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
478
|
+
expect(error.message).toBeDefined();
|
|
479
|
+
}
|
|
480
|
+
}), 20000);
|
|
481
|
+
test('Test12: should retrieve embedded sign link successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
482
|
+
try {
|
|
483
|
+
const documentId = createdDocumentId;
|
|
484
|
+
const signerEmail = "mohammedmushraf.abuthakir+6@syncfusion.com";
|
|
485
|
+
const countryCode = "+91";
|
|
486
|
+
const phoneNumber = "";
|
|
487
|
+
const signLinkValidTill = new Date("2025-03-03T00:00:00+00:00");
|
|
488
|
+
const redirectUrl = "https://www.syncfusion.com/";
|
|
489
|
+
const response = yield documentApi.getEmbeddedSignLink(documentId, signerEmail, countryCode, phoneNumber, signLinkValidTill, redirectUrl);
|
|
490
|
+
expect(response.signLink).toBeDefined();
|
|
491
|
+
}
|
|
492
|
+
catch (error) {
|
|
493
|
+
console.error('Error occurred while getting the embedded signing link:', error.message);
|
|
494
|
+
expect(error.message).toBeUndefined();
|
|
495
|
+
}
|
|
496
|
+
}), 20000);
|
|
497
|
+
test('Test13: should fail to retrieve embedded sign link with invalid document id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
498
|
+
try {
|
|
499
|
+
const signerEmail = "divya.boopathy+30@syncfusion.com";
|
|
500
|
+
const countryCode = "+91";
|
|
501
|
+
const phoneNumber = "";
|
|
502
|
+
const signLinkValidTill = new Date("2023-01-01T00:00:00+00:00");
|
|
503
|
+
const redirectUrl = "https://www.syncfusion.com/";
|
|
504
|
+
const invalidDocumentId = "invalid-document-id";
|
|
505
|
+
const response = yield documentApi.getEmbeddedSignLink(invalidDocumentId, signerEmail, countryCode, phoneNumber, signLinkValidTill, redirectUrl);
|
|
506
|
+
console.error('Test failed: Response should not have succeeded with invalid document ID');
|
|
507
|
+
expect(response).toBeUndefined();
|
|
508
|
+
}
|
|
509
|
+
catch (error) {
|
|
510
|
+
console.error('Error occurred while getting the embedded signing link:', error.message);
|
|
511
|
+
expect(error.message).toBeDefined();
|
|
512
|
+
}
|
|
513
|
+
}), 20000);
|
|
514
|
+
test('Test14: should fail to retrieve embedded sign link with invalid email id', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
515
|
+
try {
|
|
516
|
+
const documentId = createdDocumentId;
|
|
517
|
+
const invalidSignerEmail = "invalid-emailid";
|
|
518
|
+
const countryCode = "+91";
|
|
519
|
+
const phoneNumber = "";
|
|
520
|
+
const signLinkValidTill = new Date("2025-03-03T00:00:00+00:00");
|
|
521
|
+
const redirectUrl = "https://www.syncfusion.com/";
|
|
522
|
+
const response = yield documentApi.getEmbeddedSignLink(documentId, invalidSignerEmail, countryCode, phoneNumber, signLinkValidTill, redirectUrl);
|
|
523
|
+
console.error('Test failed: Response should not have succeeded with invalid email ID');
|
|
524
|
+
}
|
|
525
|
+
catch (error) {
|
|
526
|
+
console.error('Error occurred while getting the embedded signing link:', error.message);
|
|
527
|
+
expect(error.message).toBeDefined();
|
|
528
|
+
}
|
|
529
|
+
}), 20000);
|
|
530
|
+
test('Test15: should throw an error for list document invalid page number and page size', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
531
|
+
const page = -1;
|
|
532
|
+
const invalidPageSize = 250;
|
|
533
|
+
try {
|
|
534
|
+
yield documentApi.listDocuments(page, undefined, undefined, undefined, undefined, invalidPageSize, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
535
|
+
throw new Error("Expected an ApiException to be thrown due to invalid page number or page size.");
|
|
536
|
+
}
|
|
537
|
+
catch (error) {
|
|
538
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
539
|
+
expect(error.message).toBeDefined();
|
|
540
|
+
}
|
|
541
|
+
}), 20000);
|
|
542
|
+
test('Test16:should fetch behalf documents successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
543
|
+
const page = 1;
|
|
544
|
+
try {
|
|
545
|
+
const behalfDocumentResponse = yield documentApi.behalfDocuments(page);
|
|
546
|
+
console.log("Behalf Documents fetched successfully:", behalfDocumentResponse);
|
|
547
|
+
expect(behalfDocumentResponse.result).toBeDefined;
|
|
548
|
+
}
|
|
549
|
+
catch (error) {
|
|
550
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
551
|
+
expect(error.message).toBeUndefined();
|
|
552
|
+
}
|
|
553
|
+
}), 20000);
|
|
554
|
+
test('Test17:should fail to fetch behalf documents due to invalid page number', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
555
|
+
const invalidPage = -1;
|
|
556
|
+
try {
|
|
557
|
+
const behalfDocumentResponse = yield documentApi.behalfDocuments(invalidPage);
|
|
558
|
+
console.error("Expected an error, but the response was:", behalfDocumentResponse);
|
|
559
|
+
throw new Error("Expected an error, but got a response.");
|
|
560
|
+
}
|
|
561
|
+
catch (error) {
|
|
562
|
+
console.log("Error occurred while calling the API:", error.message);
|
|
563
|
+
expect(error.message).toBeDefined();
|
|
564
|
+
}
|
|
565
|
+
}), 20000);
|
|
566
|
+
test('Test18:should fetch team documents successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
567
|
+
const page = 1;
|
|
568
|
+
try {
|
|
569
|
+
const teamDocumentResponse = yield documentApi.teamDocuments(page);
|
|
570
|
+
console.log("Team Documents fetched successfully:", teamDocumentResponse);
|
|
571
|
+
expect(teamDocumentResponse.result).toBeDefined;
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
console.error("Error occurred while fetching team documents:", error.message);
|
|
575
|
+
expect(error.message).toBeUndefined();
|
|
576
|
+
}
|
|
577
|
+
}), 20000);
|
|
578
|
+
test('Test19:should fail to fetch team documents with invalid page number', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
579
|
+
const invalidPage = -1;
|
|
580
|
+
try {
|
|
581
|
+
const teamDocumentResponse = yield documentApi.teamDocuments(invalidPage);
|
|
582
|
+
throw new Error("Expected API call to fail but it succeeded");
|
|
583
|
+
}
|
|
584
|
+
catch (error) {
|
|
585
|
+
console.error("Error occurred while fetching team documents:", error.message);
|
|
586
|
+
expect(error.message).toBeDefined();
|
|
587
|
+
}
|
|
588
|
+
}), 20000);
|
|
589
|
+
test('Test20:should remove authentication successfully from the document', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
590
|
+
const documentId = createdDocumentId;
|
|
591
|
+
const emailId = "mohammedmushraf.abuthakir+5@syncfusion.com";
|
|
592
|
+
const removeAuthentication = new model_1.RemoveAuthentication();
|
|
593
|
+
removeAuthentication.emailId = emailId;
|
|
594
|
+
try {
|
|
595
|
+
const response = yield documentApi.removeAuthentication(documentId, removeAuthentication);
|
|
596
|
+
console.log("Authentication removed successfully:", response);
|
|
597
|
+
}
|
|
598
|
+
catch (error) {
|
|
599
|
+
console.error("Error occurred while removing authentication:", error.message);
|
|
600
|
+
expect(error.message).toBeUndefined();
|
|
601
|
+
}
|
|
602
|
+
}), 20000);
|
|
603
|
+
test('Test21:should fail to remove authentication from the document with invalid data', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
604
|
+
const documentId = "invalid-document-id";
|
|
605
|
+
const emailId = "mohammedmushraf.abuthakir+5@syncfusion.com";
|
|
606
|
+
const removeAuthentication = new model_1.RemoveAuthentication();
|
|
607
|
+
removeAuthentication.emailId = emailId;
|
|
608
|
+
try {
|
|
609
|
+
const response = yield documentApi.removeAuthentication(documentId, removeAuthentication);
|
|
610
|
+
console.error("Authentication was unexpectedly removed:", response);
|
|
611
|
+
}
|
|
612
|
+
catch (error) {
|
|
613
|
+
console.error("Expected error occurred while removing authentication:", error.message);
|
|
614
|
+
expect(error.message).toBeDefined();
|
|
615
|
+
}
|
|
616
|
+
}), 20000);
|
|
617
|
+
test('Test22:should add authentication to document successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
618
|
+
const documentId = createdDocumentId;
|
|
619
|
+
const accessCodeDetail = new model_1.AccessCodeDetail();
|
|
620
|
+
accessCodeDetail.authenticationType = model_1.AccessCodeDetail.AuthenticationTypeEnum.EmailOtp;
|
|
621
|
+
accessCodeDetail.emailId = "mohammedmushraf.abuthakir+5@syncfusion.com";
|
|
622
|
+
try {
|
|
623
|
+
const response = yield documentApi.addAuthentication(documentId, accessCodeDetail);
|
|
624
|
+
console.log("Authentication added successfully:", response);
|
|
625
|
+
}
|
|
626
|
+
catch (error) {
|
|
627
|
+
console.error("Error occurred while adding authentication:", error.message);
|
|
628
|
+
expect(error.message).toBeUndefined();
|
|
629
|
+
}
|
|
630
|
+
}), 20000);
|
|
631
|
+
test('Test23:should fail to add authentication to document due to invalid documentId', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
632
|
+
const invalidDocumentId = "invalid-document-id";
|
|
633
|
+
const accessCodeDetail = new model_1.AccessCodeDetail();
|
|
634
|
+
accessCodeDetail.authenticationType = model_1.AccessCodeDetail.AuthenticationTypeEnum.EmailOtp;
|
|
635
|
+
accessCodeDetail.emailId = "mohammedmushraf.abuthakir+5@syncfusion.com";
|
|
636
|
+
try {
|
|
637
|
+
const response = yield documentApi.addAuthentication(invalidDocumentId, accessCodeDetail);
|
|
638
|
+
}
|
|
639
|
+
catch (error) {
|
|
640
|
+
console.error("Expected error occurred while adding authentication:", error.message);
|
|
641
|
+
expect(error.message).toBeDefined();
|
|
642
|
+
}
|
|
643
|
+
}), 20000);
|
|
644
|
+
test('Test24:should fetch document properties', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
645
|
+
try {
|
|
646
|
+
const response = yield documentApi.getProperties(createdDocumentId);
|
|
647
|
+
expect(response.documentId).toBeDefined();
|
|
648
|
+
}
|
|
649
|
+
catch (error) {
|
|
650
|
+
console.error("Error occurred while fetching document properties:", error.message);
|
|
651
|
+
expect(error.message).toBeUndefined();
|
|
652
|
+
}
|
|
653
|
+
}), 20000);
|
|
654
|
+
test('Test25:should fail to fetch document properties with invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
655
|
+
const invalidDocumentId = "invalid-document-id";
|
|
656
|
+
try {
|
|
657
|
+
const response = yield documentApi.getProperties(invalidDocumentId);
|
|
658
|
+
}
|
|
659
|
+
catch (error) {
|
|
660
|
+
console.error("Expected error occurred while fetching document properties:", error.message);
|
|
661
|
+
expect(error.message).toBeDefined();
|
|
662
|
+
}
|
|
663
|
+
}), 20000);
|
|
664
|
+
test('Test26:should fail to fetch document properties with invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
665
|
+
const invalidDocumentId = "";
|
|
666
|
+
try {
|
|
667
|
+
const response = yield documentApi.getProperties(invalidDocumentId);
|
|
668
|
+
}
|
|
669
|
+
catch (error) {
|
|
670
|
+
console.error("Expected error occurred while fetching document properties:", error);
|
|
671
|
+
expect(error).toBeDefined();
|
|
672
|
+
expect(error.response.status).toBe(400);
|
|
673
|
+
expect(error.response.statusText).toBe('Bad Request');
|
|
674
|
+
}
|
|
675
|
+
}), 20000);
|
|
676
|
+
test('Test27:should extend document expiry successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
677
|
+
try {
|
|
678
|
+
const currentDate = new Date();
|
|
679
|
+
const newExpiryDate = new Date(currentDate.setMonth(currentDate.getMonth() + 3));
|
|
680
|
+
const newExpiryDateStr = newExpiryDate.toISOString().split('T')[0];
|
|
681
|
+
const extendExpiry = new model_1.ExtendExpiry();
|
|
682
|
+
extendExpiry.newExpiryValue = newExpiryDateStr;
|
|
683
|
+
const response = yield documentApi.extendExpiry(createdDocumentId, extendExpiry);
|
|
684
|
+
}
|
|
685
|
+
catch (error) {
|
|
686
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
687
|
+
expect(error.message).toBeUndefined();
|
|
688
|
+
}
|
|
689
|
+
}), 20000);
|
|
690
|
+
test('Test28:should fail to extend document expiry due to invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
691
|
+
try {
|
|
692
|
+
const currentDate = new Date();
|
|
693
|
+
const newExpiryDate = new Date(currentDate.setMonth(currentDate.getMonth() + 3));
|
|
694
|
+
const newExpiryDateStr = newExpiryDate.toISOString().split('T')[0];
|
|
695
|
+
const extendExpiry = new model_1.ExtendExpiry();
|
|
696
|
+
extendExpiry.newExpiryValue = newExpiryDateStr;
|
|
697
|
+
const invalidDocumentId = "invalid-document-id";
|
|
698
|
+
yield documentApi.extendExpiry(invalidDocumentId, extendExpiry);
|
|
699
|
+
}
|
|
700
|
+
catch (error) {
|
|
701
|
+
console.log("Error occurred as expected:", error.message);
|
|
702
|
+
expect(error.message).toBeDefined();
|
|
703
|
+
}
|
|
704
|
+
}), 20000);
|
|
705
|
+
test('Test29: should send a reminder successfully with valid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
706
|
+
const reminderMessage = new model_1.ReminderMessage();
|
|
707
|
+
reminderMessage.message = "Please sign this soon";
|
|
708
|
+
const documentId = createdDocumentId;
|
|
709
|
+
const receiverEmails = ["mohammedmushraf.abuthakir+5@syncfusion.com"];
|
|
710
|
+
try {
|
|
711
|
+
const response = yield documentApi.remindDocument(documentId, receiverEmails, reminderMessage);
|
|
712
|
+
console.log("Reminder sent successfully:", response);
|
|
713
|
+
}
|
|
714
|
+
catch (error) {
|
|
715
|
+
console.error("Error occurred while sending the reminder:", error.message);
|
|
716
|
+
expect(error.message).toBeUndefined();
|
|
717
|
+
}
|
|
718
|
+
}), 20000);
|
|
719
|
+
test('Test30: should throw an error for invalid document ID while sending reminder', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
720
|
+
const reminderMessage = new model_1.ReminderMessage();
|
|
721
|
+
reminderMessage.message = "Please sign this soon";
|
|
722
|
+
const documentId = "invalid-document-id";
|
|
723
|
+
const receiverEmails = ["mohammedmushraf.abuthakir+5@syncfusion.com"];
|
|
724
|
+
try {
|
|
725
|
+
yield documentApi.remindDocument(documentId, receiverEmails, reminderMessage);
|
|
726
|
+
}
|
|
727
|
+
catch (error) {
|
|
728
|
+
console.error("Error occurred while sending the reminder:", error.message);
|
|
729
|
+
expect(error.message).toBeDefined();
|
|
730
|
+
}
|
|
731
|
+
}), 20000);
|
|
732
|
+
test('Test31: should download document successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
733
|
+
try {
|
|
734
|
+
const documentId = createdDocumentId;
|
|
735
|
+
const onBehalfOf = "mohammedmushraf.abuthakir+6@syncfusion.com";
|
|
736
|
+
const response = yield documentApi.downloadDocument(documentId, onBehalfOf);
|
|
737
|
+
console.log("Document downloaded successfully!");
|
|
738
|
+
}
|
|
739
|
+
catch (error) {
|
|
740
|
+
console.error("Error occurred while downloading the document:", error.message);
|
|
741
|
+
expect(error.message).toBeUndefined();
|
|
742
|
+
}
|
|
743
|
+
}), 20000);
|
|
744
|
+
test('Test32:should fail to download document with invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
745
|
+
const invalidDocumentId = "invalid-document-id";
|
|
746
|
+
const onBehalfOf = "mohammedmushraf.abuthakir+6@syncfusion.com";
|
|
747
|
+
try {
|
|
748
|
+
const response = yield documentApi.downloadDocument(invalidDocumentId, onBehalfOf);
|
|
749
|
+
}
|
|
750
|
+
catch (error) {
|
|
751
|
+
console.error("Error occurred while downloading the document:", error.message);
|
|
752
|
+
expect(error.message).toBeDefined();
|
|
753
|
+
}
|
|
754
|
+
}), 20000);
|
|
755
|
+
test('Test33:should change document access code successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
756
|
+
const accessCodeDetails = new model_1.AccessCodeDetails();
|
|
757
|
+
accessCodeDetails.accessCode = "12345";
|
|
758
|
+
const documentId = createdDocumentId;
|
|
759
|
+
const email = "mohammedmushraf.abuthakir+6@syncfusion.com";
|
|
760
|
+
try {
|
|
761
|
+
const response = yield documentApi.changeAccessCode(documentId, accessCodeDetails, email);
|
|
762
|
+
console.log("Access code changed successfully:", response);
|
|
763
|
+
}
|
|
764
|
+
catch (error) {
|
|
765
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
766
|
+
expect(error.message).toBeUndefined();
|
|
767
|
+
}
|
|
768
|
+
}), 20000);
|
|
769
|
+
test('Test34:should not change document access code due to invalid data', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
770
|
+
const accessCodeDetails = new model_1.AccessCodeDetails();
|
|
771
|
+
accessCodeDetails.accessCode = "123457";
|
|
772
|
+
const documentId = "invalidDocumentId";
|
|
773
|
+
const email = "mohammedmushraf.abuthakir+6@syncfusion.com";
|
|
774
|
+
try {
|
|
775
|
+
const response = yield documentApi.changeAccessCode(documentId, accessCodeDetails, email);
|
|
776
|
+
}
|
|
777
|
+
catch (error) {
|
|
778
|
+
console.error("Expected error occurred while calling the API:", error.message);
|
|
779
|
+
expect(error.message).toBeDefined();
|
|
780
|
+
}
|
|
781
|
+
}), 20000);
|
|
782
|
+
test('Test35:should successfully add tags to the document', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
783
|
+
const documentTags = new model_1.DocumentTags();
|
|
784
|
+
documentTags.documentId = createdDocumentId;
|
|
785
|
+
documentTags.tags = ["test", "api"];
|
|
786
|
+
try {
|
|
787
|
+
const response = yield documentApi.addTag(documentTags);
|
|
788
|
+
console.log("Tags added successfully!", response);
|
|
789
|
+
}
|
|
790
|
+
catch (error) {
|
|
791
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
792
|
+
expect(error.message).toBeUndefined();
|
|
793
|
+
}
|
|
794
|
+
}), 20000);
|
|
795
|
+
test('Test36:should fail to add tags to the document due to invalid data', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
796
|
+
const documentTags = new model_1.DocumentTags();
|
|
797
|
+
documentTags.documentId = 'invalidDocumentId';
|
|
798
|
+
documentTags.tags = ["test", "api"];
|
|
799
|
+
try {
|
|
800
|
+
const response = yield documentApi.addTag(documentTags);
|
|
801
|
+
}
|
|
802
|
+
catch (error) {
|
|
803
|
+
console.log("Error occurred as expected while calling the API:", error.message);
|
|
804
|
+
expect(error.message).toBeDefined();
|
|
805
|
+
}
|
|
806
|
+
}), 20000);
|
|
807
|
+
test('Test37: should fail to add tags with an empty tag array', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
808
|
+
const documentTags = new model_1.DocumentTags();
|
|
809
|
+
documentTags.documentId = createdDocumentId;
|
|
810
|
+
documentTags.tags = ["", ""];
|
|
811
|
+
try {
|
|
812
|
+
const response = yield documentApi.addTag(documentTags);
|
|
813
|
+
}
|
|
814
|
+
catch (error) {
|
|
815
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
816
|
+
expect(error.message).toBeDefined();
|
|
817
|
+
}
|
|
818
|
+
}), 20000);
|
|
819
|
+
test('Test38:should successfully delete tags from the document', function () {
|
|
820
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
821
|
+
const documentTags = new model_1.DocumentTags();
|
|
822
|
+
documentTags.documentId = createdDocumentId;
|
|
823
|
+
documentTags.tags = ["test", "api"];
|
|
824
|
+
try {
|
|
825
|
+
const response = yield documentApi.deleteTag(documentTags);
|
|
826
|
+
console.log("Tags deleted successfully!");
|
|
827
|
+
}
|
|
828
|
+
catch (error) {
|
|
829
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
830
|
+
expect(error.message).toBeUndefined();
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
}, 20000);
|
|
834
|
+
test('Test39:should fail to delete tags from the document due to invalid document ID', function () {
|
|
835
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
836
|
+
const documentTags = new model_1.DocumentTags();
|
|
837
|
+
documentTags.documentId = "invalid-document-id";
|
|
838
|
+
documentTags.tags = ["test", "api"];
|
|
839
|
+
try {
|
|
840
|
+
const response = yield documentApi.deleteTag(documentTags);
|
|
841
|
+
}
|
|
842
|
+
catch (error) {
|
|
843
|
+
console.log("Error occurred as expected:", error.message);
|
|
844
|
+
expect(error.message).toBeDefined();
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
}, 20000);
|
|
848
|
+
test('Test40: should fail to delete tags with an empty tag array', function () {
|
|
849
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
850
|
+
const documentTags = new model_1.DocumentTags();
|
|
851
|
+
documentTags.documentId = createdDocumentId;
|
|
852
|
+
documentTags.tags = ["", ""];
|
|
853
|
+
try {
|
|
854
|
+
const response = yield documentApi.deleteTag(documentTags);
|
|
855
|
+
}
|
|
856
|
+
catch (error) {
|
|
857
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
858
|
+
expect(error.message).toBeDefined();
|
|
859
|
+
}
|
|
860
|
+
});
|
|
861
|
+
}, 20000);
|
|
862
|
+
test('Test41: should change the recipient successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
863
|
+
try {
|
|
864
|
+
const oldSignerEmail = "mohammedmushraf.abuthakir+6@syncfusion.com";
|
|
865
|
+
const reason = "Wrongly sent";
|
|
866
|
+
const newSignerName = "Test Signer";
|
|
867
|
+
const newSignerEmail = "mohammedmushraf.abuthakir+15@syncfusion.com";
|
|
868
|
+
const changeRecipient = {
|
|
869
|
+
oldSignerEmail: oldSignerEmail,
|
|
870
|
+
reason: reason,
|
|
871
|
+
newSignerName: newSignerName,
|
|
872
|
+
newSignerEmail: newSignerEmail
|
|
873
|
+
};
|
|
874
|
+
const response = yield documentApi.changeRecipient(createdDocumentId, changeRecipient);
|
|
875
|
+
console.log("Recipient change succeeded.");
|
|
876
|
+
}
|
|
877
|
+
catch (error) {
|
|
878
|
+
console.error('Error occurred while changing the recipient:', error.message);
|
|
879
|
+
expect(error.message).toBeUndefined();
|
|
880
|
+
}
|
|
881
|
+
}), 20000);
|
|
882
|
+
test('Test42: should fail to change the recipient with invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
883
|
+
try {
|
|
884
|
+
const oldSignerEmail = "mohammedmushraf.abuthakir+6@syncfusion.com";
|
|
885
|
+
const reason = "Wrongly sent";
|
|
886
|
+
const newSignerName = "Test Signer";
|
|
887
|
+
const newSignerEmail = "mohammedmushraf.abuthakir+15@syncfusion.com";
|
|
888
|
+
const changeRecipient = {
|
|
889
|
+
oldSignerEmail: oldSignerEmail,
|
|
890
|
+
reason: reason,
|
|
891
|
+
newSignerName: newSignerName,
|
|
892
|
+
newSignerEmail: newSignerEmail
|
|
893
|
+
};
|
|
894
|
+
const invalidDocumentId = "invalid-document-id";
|
|
895
|
+
const response = yield documentApi.changeRecipient(invalidDocumentId, changeRecipient);
|
|
896
|
+
}
|
|
897
|
+
catch (error) {
|
|
898
|
+
console.error('Error occurred while changing the recipient:', error.message);
|
|
899
|
+
expect(error.message).toBeDefined();
|
|
900
|
+
}
|
|
901
|
+
}), 20000);
|
|
902
|
+
test('Test43:should revoke document successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
903
|
+
const revokeDocumentRequest = new model_1.RevokeDocument();
|
|
904
|
+
revokeDocumentRequest.message = "This is document revoke message";
|
|
905
|
+
const documentId = createdDocumentId;
|
|
906
|
+
try {
|
|
907
|
+
const response = yield documentApi.revokeDocument(documentId, revokeDocumentRequest);
|
|
908
|
+
console.log("Document revoked successfully:", response);
|
|
909
|
+
}
|
|
910
|
+
catch (error) {
|
|
911
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
912
|
+
expect(error.message).toBeUndefined();
|
|
913
|
+
}
|
|
914
|
+
}), 20000);
|
|
915
|
+
test('Test44:should fail to revoke document due to invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
916
|
+
const revokeDocumentRequest = new model_1.RevokeDocument();
|
|
917
|
+
revokeDocumentRequest.message = "This is document revoke message";
|
|
918
|
+
const invalidDocumentId = 'invalidDocumentId';
|
|
919
|
+
try {
|
|
920
|
+
const response = yield documentApi.revokeDocument(invalidDocumentId, revokeDocumentRequest);
|
|
921
|
+
}
|
|
922
|
+
catch (error) {
|
|
923
|
+
console.log("Error occurred as expected while calling the API:", error.message);
|
|
924
|
+
expect(error.message).toBeDefined();
|
|
925
|
+
}
|
|
926
|
+
}), 20000);
|
|
927
|
+
test('Test45:should delete document successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
928
|
+
const validDocumentId = createdDocumentId;
|
|
929
|
+
const deletePermanently = false;
|
|
930
|
+
try {
|
|
931
|
+
const response = yield documentApi.deleteDocument(validDocumentId, deletePermanently);
|
|
932
|
+
console.log("Document deleted successfully:", response);
|
|
933
|
+
}
|
|
934
|
+
catch (error) {
|
|
935
|
+
console.error("Error occurred while calling the API:", error.message);
|
|
936
|
+
expect(error.message).toBeUndefined();
|
|
937
|
+
}
|
|
938
|
+
}), 20000);
|
|
939
|
+
test('Test46:should fail to delete document due to invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
940
|
+
const invalidDocumentId = 'invalidDocumentId';
|
|
941
|
+
const deletePermanently = false;
|
|
942
|
+
try {
|
|
943
|
+
const response = yield documentApi.deleteDocument(invalidDocumentId, deletePermanently);
|
|
944
|
+
}
|
|
945
|
+
catch (error) {
|
|
946
|
+
console.log("Error occurred as expected while calling the API", error.message);
|
|
947
|
+
expect(error.message).toBeDefined();
|
|
948
|
+
}
|
|
949
|
+
}), 20000);
|
|
950
|
+
test('Test47: should send a document with an image field successfully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
951
|
+
try {
|
|
952
|
+
const imagePath = 'tests/documents/logo.jpg';
|
|
953
|
+
const base64Image = imageToBase64(imagePath);
|
|
954
|
+
const imageField = new model_1.FormField();
|
|
955
|
+
imageField.name = 'image_Test';
|
|
956
|
+
imageField.fieldType = model_1.FormField.FieldTypeEnum.Image;
|
|
957
|
+
imageField.font = model_1.FormField.FontEnum.Helvetica;
|
|
958
|
+
imageField.pageNumber = 1;
|
|
959
|
+
imageField.isRequired = true;
|
|
960
|
+
imageField.value = base64Image;
|
|
961
|
+
imageField.imageInfo = {
|
|
962
|
+
title: 'Image Test',
|
|
963
|
+
allowedFileExtensions: '.jpg',
|
|
964
|
+
description: 'Image for testing'
|
|
965
|
+
};
|
|
966
|
+
imageField.bounds = new model_1.Rectangle();
|
|
967
|
+
imageField.bounds.x = 50;
|
|
968
|
+
imageField.bounds.y = 50;
|
|
969
|
+
imageField.bounds.width = 100;
|
|
970
|
+
imageField.bounds.height = 150;
|
|
971
|
+
const signer = new model_1.DocumentSigner();
|
|
972
|
+
signer.name = 'Test Signer';
|
|
973
|
+
signer.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
974
|
+
signer.signerOrder = 1;
|
|
975
|
+
signer.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
976
|
+
signer.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
977
|
+
signer.authenticationCode = '123456';
|
|
978
|
+
signer.formFields = [imageField];
|
|
979
|
+
signer.privateMessage = 'This is private message for signer';
|
|
980
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
981
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
982
|
+
sendDocumentRequest.files = [
|
|
983
|
+
fs.createReadStream('tests/documents/agreement.pdf')
|
|
984
|
+
];
|
|
985
|
+
sendDocumentRequest.signers = [signer];
|
|
986
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
987
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
988
|
+
}
|
|
989
|
+
catch (error) {
|
|
990
|
+
console.error('Error occurred while sending document with image field:', error.message);
|
|
991
|
+
expect(error.message).toBeUndefined();
|
|
992
|
+
}
|
|
993
|
+
}), 20000);
|
|
994
|
+
test('Test48:should successfully send a document with a read-only checkbox field checked', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
995
|
+
try {
|
|
996
|
+
const bounds = new model_1.Rectangle();
|
|
997
|
+
bounds.x = 50;
|
|
998
|
+
bounds.y = 50;
|
|
999
|
+
bounds.width = 100;
|
|
1000
|
+
bounds.height = 150;
|
|
1001
|
+
const checkboxField = new model_1.FormField();
|
|
1002
|
+
checkboxField.id = 'CheckBox';
|
|
1003
|
+
checkboxField.name = 'CheckBox';
|
|
1004
|
+
checkboxField.fieldType = model_1.FormField.FieldTypeEnum.CheckBox;
|
|
1005
|
+
checkboxField.font = model_1.FormField.FontEnum.Helvetica;
|
|
1006
|
+
checkboxField.value = 'on';
|
|
1007
|
+
checkboxField.pageNumber = 1;
|
|
1008
|
+
checkboxField.isReadOnly = true;
|
|
1009
|
+
checkboxField.bounds = bounds;
|
|
1010
|
+
const documentSigner = new model_1.DocumentSigner();
|
|
1011
|
+
documentSigner.name = 'Test Signer';
|
|
1012
|
+
documentSigner.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusuion.com';
|
|
1013
|
+
documentSigner.signerOrder = 1;
|
|
1014
|
+
documentSigner.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1015
|
+
documentSigner.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
1016
|
+
documentSigner.authenticationCode = '123456';
|
|
1017
|
+
documentSigner.formFields = [checkboxField];
|
|
1018
|
+
const sendForSign = new model_1.SendForSign();
|
|
1019
|
+
sendForSign.title = 'Document SDK API';
|
|
1020
|
+
sendForSign.signers = [documentSigner];
|
|
1021
|
+
const files = fs.createReadStream('tests/documents/agreement.pdf');
|
|
1022
|
+
sendForSign.files = [files];
|
|
1023
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendForSign);
|
|
1024
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1025
|
+
console.log('Document sent successfully:', sendDocumentResponse.documentId);
|
|
1026
|
+
}
|
|
1027
|
+
catch (error) {
|
|
1028
|
+
console.error('Error occurred while calling the API:', error.message);
|
|
1029
|
+
expect(error.message).toBeUndefined();
|
|
1030
|
+
}
|
|
1031
|
+
}), 20000);
|
|
1032
|
+
test('Test49:should send document with multiple grouped checkboxes', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1033
|
+
try {
|
|
1034
|
+
const checkBox1 = new model_1.FormField();
|
|
1035
|
+
checkBox1.id = 'CheckBox1';
|
|
1036
|
+
checkBox1.name = 'CheckBox1';
|
|
1037
|
+
checkBox1.fieldType = model_1.FormField.FieldTypeEnum.CheckBox;
|
|
1038
|
+
checkBox1.font = model_1.FormField.FontEnum.Helvetica;
|
|
1039
|
+
checkBox1.pageNumber = 1;
|
|
1040
|
+
checkBox1.isRequired = true;
|
|
1041
|
+
checkBox1.bounds = new model_1.Rectangle();
|
|
1042
|
+
checkBox1.bounds.x = 50;
|
|
1043
|
+
checkBox1.bounds.y = 50;
|
|
1044
|
+
checkBox1.bounds.width = 100;
|
|
1045
|
+
checkBox1.bounds.height = 50;
|
|
1046
|
+
const checkBox2 = new model_1.FormField();
|
|
1047
|
+
checkBox2.id = 'CheckBox2';
|
|
1048
|
+
checkBox2.name = 'CheckBox2';
|
|
1049
|
+
checkBox2.fieldType = model_1.FormField.FieldTypeEnum.CheckBox;
|
|
1050
|
+
checkBox2.font = model_1.FormField.FontEnum.Helvetica;
|
|
1051
|
+
checkBox2.pageNumber = 1;
|
|
1052
|
+
checkBox2.isRequired = true;
|
|
1053
|
+
checkBox2.bounds = new model_1.Rectangle();
|
|
1054
|
+
checkBox2.bounds.x = 50;
|
|
1055
|
+
checkBox2.bounds.y = 150;
|
|
1056
|
+
checkBox2.bounds.width = 100;
|
|
1057
|
+
checkBox2.bounds.height = 50;
|
|
1058
|
+
const checkBox3 = new model_1.FormField();
|
|
1059
|
+
checkBox3.id = 'CheckBox3';
|
|
1060
|
+
checkBox3.name = 'CheckBox3';
|
|
1061
|
+
checkBox3.fieldType = model_1.FormField.FieldTypeEnum.CheckBox;
|
|
1062
|
+
checkBox3.font = model_1.FormField.FontEnum.Helvetica;
|
|
1063
|
+
checkBox3.pageNumber = 1;
|
|
1064
|
+
checkBox3.isRequired = true;
|
|
1065
|
+
checkBox3.bounds = new model_1.Rectangle();
|
|
1066
|
+
checkBox3.bounds.x = 50;
|
|
1067
|
+
checkBox3.bounds.y = 250;
|
|
1068
|
+
checkBox3.bounds.width = 100;
|
|
1069
|
+
checkBox3.bounds.height = 50;
|
|
1070
|
+
const checkBox4 = new model_1.FormField();
|
|
1071
|
+
checkBox4.id = 'CheckBox4';
|
|
1072
|
+
checkBox4.name = 'CheckBox4';
|
|
1073
|
+
checkBox4.fieldType = model_1.FormField.FieldTypeEnum.CheckBox;
|
|
1074
|
+
checkBox4.font = model_1.FormField.FontEnum.Helvetica;
|
|
1075
|
+
checkBox4.pageNumber = 1;
|
|
1076
|
+
checkBox4.isRequired = true;
|
|
1077
|
+
checkBox4.bounds = new model_1.Rectangle();
|
|
1078
|
+
checkBox4.bounds.x = 50;
|
|
1079
|
+
checkBox4.bounds.y = 350;
|
|
1080
|
+
checkBox4.bounds.width = 100;
|
|
1081
|
+
checkBox4.bounds.height = 50;
|
|
1082
|
+
const signer = new model_1.DocumentSigner();
|
|
1083
|
+
signer.name = 'Mohammed';
|
|
1084
|
+
signer.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1085
|
+
signer.signerOrder = 1;
|
|
1086
|
+
signer.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1087
|
+
signer.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
1088
|
+
signer.authenticationCode = '123456';
|
|
1089
|
+
signer.formFields = [checkBox1, checkBox2, checkBox3, checkBox4];
|
|
1090
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1091
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
1092
|
+
sendDocumentRequest.signers = [signer];
|
|
1093
|
+
const files = fs.createReadStream('tests/documents/agreement.pdf');
|
|
1094
|
+
sendDocumentRequest.files = [files];
|
|
1095
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
1096
|
+
const createdDocumentId = sendDocumentResponse.documentId;
|
|
1097
|
+
console.log('Created Document ID:', createdDocumentId);
|
|
1098
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1099
|
+
}
|
|
1100
|
+
catch (error) {
|
|
1101
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
1102
|
+
expect(error.message).toBeUndefined();
|
|
1103
|
+
}
|
|
1104
|
+
}), 20000);
|
|
1105
|
+
test('Test50:should replace fillable fields in a document', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1106
|
+
try {
|
|
1107
|
+
const signField = new model_1.FormField();
|
|
1108
|
+
signField.name = 'Sign';
|
|
1109
|
+
signField.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1110
|
+
signField.font = model_1.FormField.FontEnum.Helvetica;
|
|
1111
|
+
signField.pageNumber = 1;
|
|
1112
|
+
signField.isRequired = true;
|
|
1113
|
+
signField.bounds = new model_1.Rectangle();
|
|
1114
|
+
signField.bounds.x = 50;
|
|
1115
|
+
signField.bounds.y = 50;
|
|
1116
|
+
signField.bounds.width = 100;
|
|
1117
|
+
signField.bounds.height = 50;
|
|
1118
|
+
const signer = new model_1.DocumentSigner();
|
|
1119
|
+
signer.name = 'Test Signer';
|
|
1120
|
+
signer.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1121
|
+
signer.signerOrder = 1;
|
|
1122
|
+
signer.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1123
|
+
signer.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
1124
|
+
signer.authenticationCode = '123456';
|
|
1125
|
+
signer.formFields = [signField];
|
|
1126
|
+
signer.privateMessage = 'This is private message for signer';
|
|
1127
|
+
const files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1128
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1129
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
1130
|
+
sendDocumentRequest.files = files;
|
|
1131
|
+
sendDocumentRequest.signers = [signer];
|
|
1132
|
+
sendDocumentRequest.autoDetectFields = true;
|
|
1133
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
1134
|
+
const createdDocumentId = sendDocumentResponse.documentId;
|
|
1135
|
+
console.log('Created Document ID:', createdDocumentId);
|
|
1136
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1137
|
+
}
|
|
1138
|
+
catch (error) {
|
|
1139
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
1140
|
+
expect(error.message).toBeUndefined();
|
|
1141
|
+
}
|
|
1142
|
+
}), 20000);
|
|
1143
|
+
test('Tes51:should send document with text field', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1144
|
+
try {
|
|
1145
|
+
const textField = new model_1.FormField();
|
|
1146
|
+
textField.id = 'textValue';
|
|
1147
|
+
textField.fieldType = model_1.FormField.FieldTypeEnum.TextBox;
|
|
1148
|
+
textField.font = model_1.FormField.FontEnum.Helvetica;
|
|
1149
|
+
textField.pageNumber = 1;
|
|
1150
|
+
textField.isReadOnly = true;
|
|
1151
|
+
textField.validationType = model_1.FormField.ValidationTypeEnum.NumbersOnly;
|
|
1152
|
+
textField.bounds = new model_1.Rectangle();
|
|
1153
|
+
textField.bounds.x = 50;
|
|
1154
|
+
textField.bounds.y = 50;
|
|
1155
|
+
textField.bounds.width = 200;
|
|
1156
|
+
textField.bounds.height = 50;
|
|
1157
|
+
const signer = new model_1.DocumentSigner();
|
|
1158
|
+
signer.name = 'Test Signer';
|
|
1159
|
+
signer.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1160
|
+
signer.signerOrder = 1;
|
|
1161
|
+
signer.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1162
|
+
signer.formFields = [textField];
|
|
1163
|
+
const files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1164
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1165
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
1166
|
+
sendDocumentRequest.files = files;
|
|
1167
|
+
sendDocumentRequest.signers = [signer];
|
|
1168
|
+
sendDocumentRequest.autoDetectFields = true;
|
|
1169
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
1170
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1171
|
+
}
|
|
1172
|
+
catch (error) {
|
|
1173
|
+
console.error('Error occurred while sending document for signing:', error.message);
|
|
1174
|
+
expect(error.message).toBeUndefined();
|
|
1175
|
+
}
|
|
1176
|
+
}), 20000);
|
|
1177
|
+
test('Test52:should send document and disable email notifications', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1178
|
+
try {
|
|
1179
|
+
const textField = new model_1.FormField();
|
|
1180
|
+
textField.id = 'textValue';
|
|
1181
|
+
textField.fieldType = model_1.FormField.FieldTypeEnum.TextBox;
|
|
1182
|
+
textField.font = model_1.FormField.FontEnum.Helvetica;
|
|
1183
|
+
textField.pageNumber = 1;
|
|
1184
|
+
textField.isReadOnly = true;
|
|
1185
|
+
textField.validationType = model_1.FormField.ValidationTypeEnum.NumbersOnly;
|
|
1186
|
+
textField.bounds = { x: 50, y: 50, width: 100, height: 150 };
|
|
1187
|
+
const signer = new model_1.DocumentSigner();
|
|
1188
|
+
signer.name = 'Test Signer';
|
|
1189
|
+
signer.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1190
|
+
signer.signerOrder = 1;
|
|
1191
|
+
signer.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1192
|
+
signer.formFields = [textField];
|
|
1193
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1194
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
1195
|
+
sendDocumentRequest.files = [
|
|
1196
|
+
fs.createReadStream('tests/documents/agreement.pdf')
|
|
1197
|
+
];
|
|
1198
|
+
sendDocumentRequest.signers = [signer];
|
|
1199
|
+
sendDocumentRequest.disableEmails = true;
|
|
1200
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
1201
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1202
|
+
}
|
|
1203
|
+
catch (error) {
|
|
1204
|
+
console.error('Error occurred while sending the document for signing:', error.message);
|
|
1205
|
+
expect(error.message).toBeUndefined();
|
|
1206
|
+
}
|
|
1207
|
+
}), 20000);
|
|
1208
|
+
test('Test53:should send document on behalf of another user', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1209
|
+
try {
|
|
1210
|
+
const formField = new model_1.FormField();
|
|
1211
|
+
formField.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1212
|
+
formField.pageNumber = 1;
|
|
1213
|
+
formField.bounds = { x: 50, y: 50, width: 200, height: 25 };
|
|
1214
|
+
const documentSigner = new model_1.DocumentSigner();
|
|
1215
|
+
documentSigner.name = 'Test Signer';
|
|
1216
|
+
documentSigner.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1217
|
+
documentSigner.signerOrder = 1;
|
|
1218
|
+
documentSigner.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1219
|
+
documentSigner.formFields = [formField];
|
|
1220
|
+
const reminderSettings = new model_1.ReminderSettings();
|
|
1221
|
+
reminderSettings.reminderDays = 3;
|
|
1222
|
+
reminderSettings.reminderCount = 5;
|
|
1223
|
+
reminderSettings.enableAutoReminder = false;
|
|
1224
|
+
const sendForSign = new model_1.SendForSign();
|
|
1225
|
+
sendForSign.title = 'SDK Document Test case';
|
|
1226
|
+
sendForSign.message = 'Testing document from SDK integration test case';
|
|
1227
|
+
sendForSign.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1228
|
+
sendForSign.disableExpiryAlert = false;
|
|
1229
|
+
sendForSign.reminderSettings = reminderSettings;
|
|
1230
|
+
sendForSign.enableReassign = true;
|
|
1231
|
+
sendForSign.signers = [documentSigner];
|
|
1232
|
+
sendForSign.enablePrintAndSign = false;
|
|
1233
|
+
sendForSign.autoDetectFields = false;
|
|
1234
|
+
sendForSign.onBehalfOf = 'mohammedmushraf.abuthakir+900@syncfusion.com';
|
|
1235
|
+
sendForSign.enableSigningOrder = false;
|
|
1236
|
+
sendForSign.useTextTags = false;
|
|
1237
|
+
sendForSign.hideDocumentId = false;
|
|
1238
|
+
sendForSign.expiryValue = 60;
|
|
1239
|
+
sendForSign.disableEmails = false;
|
|
1240
|
+
sendForSign.disableSMS = false;
|
|
1241
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendForSign);
|
|
1242
|
+
console.log('Document created with ID:', sendDocumentResponse.documentId);
|
|
1243
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1244
|
+
}
|
|
1245
|
+
catch (error) {
|
|
1246
|
+
console.error('Error occurred while sending the document for signing:', error.message);
|
|
1247
|
+
expect(error.message).toBeUndefined();
|
|
1248
|
+
}
|
|
1249
|
+
}), 20000);
|
|
1250
|
+
test('Test54:should fail to send document on behalf of another user with invalid onbehalf email', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1251
|
+
try {
|
|
1252
|
+
const formField = new model_1.FormField();
|
|
1253
|
+
formField.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1254
|
+
formField.pageNumber = 1;
|
|
1255
|
+
formField.bounds = { x: 50, y: 50, width: 200, height: 25 };
|
|
1256
|
+
const documentSigner = new model_1.DocumentSigner();
|
|
1257
|
+
documentSigner.name = 'Test Signer';
|
|
1258
|
+
documentSigner.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1259
|
+
documentSigner.signerOrder = 1;
|
|
1260
|
+
documentSigner.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1261
|
+
documentSigner.formFields = [formField];
|
|
1262
|
+
const reminderSettings = new model_1.ReminderSettings();
|
|
1263
|
+
reminderSettings.reminderDays = 3;
|
|
1264
|
+
reminderSettings.reminderCount = 5;
|
|
1265
|
+
reminderSettings.enableAutoReminder = false;
|
|
1266
|
+
const sendForSign = new model_1.SendForSign();
|
|
1267
|
+
sendForSign.title = 'SDK Document Test case';
|
|
1268
|
+
sendForSign.message = 'Testing document from SDK integration test case';
|
|
1269
|
+
sendForSign.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1270
|
+
sendForSign.disableExpiryAlert = false;
|
|
1271
|
+
sendForSign.reminderSettings = reminderSettings;
|
|
1272
|
+
sendForSign.enableReassign = true;
|
|
1273
|
+
sendForSign.signers = [documentSigner];
|
|
1274
|
+
sendForSign.enablePrintAndSign = false;
|
|
1275
|
+
sendForSign.autoDetectFields = false;
|
|
1276
|
+
sendForSign.onBehalfOf = 'invalid-email';
|
|
1277
|
+
sendForSign.enableSigningOrder = false;
|
|
1278
|
+
sendForSign.useTextTags = false;
|
|
1279
|
+
sendForSign.hideDocumentId = false;
|
|
1280
|
+
sendForSign.expiryValue = 60;
|
|
1281
|
+
sendForSign.disableEmails = false;
|
|
1282
|
+
sendForSign.disableSMS = false;
|
|
1283
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendForSign);
|
|
1284
|
+
}
|
|
1285
|
+
catch (error) {
|
|
1286
|
+
console.error('Error occurred while sending the document for signing:', error);
|
|
1287
|
+
expect(error).toBeDefined();
|
|
1288
|
+
expect(error.response.status).toBe(400);
|
|
1289
|
+
expect(error.response.statusText).toBe('Bad Request');
|
|
1290
|
+
}
|
|
1291
|
+
}), 20000);
|
|
1292
|
+
test('Test55: should fail to download a document on behalf using invalid document ID', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1293
|
+
try {
|
|
1294
|
+
const onBehalfOfEmail = 'mohammedmushraf.abuthakir+900@syncfusion.com';
|
|
1295
|
+
const invalidDocumentId = 'invalid-document-id-1234';
|
|
1296
|
+
const downloadResponse = yield documentApi.downloadDocument(invalidDocumentId, onBehalfOfEmail);
|
|
1297
|
+
console.error("Expected an error but got a successful response:", downloadResponse);
|
|
1298
|
+
fail('Expected error was not thrown for invalid document ID');
|
|
1299
|
+
}
|
|
1300
|
+
catch (error) {
|
|
1301
|
+
console.log("Expected error received for invalid document ID:");
|
|
1302
|
+
expect(error).toBeDefined();
|
|
1303
|
+
expect(error.response.status).toBe(400);
|
|
1304
|
+
expect(error.response.statusText).toBe('Bad Request');
|
|
1305
|
+
}
|
|
1306
|
+
}), 20000);
|
|
1307
|
+
test('Test56: should fail to download a document with invalid onBehalfOf email', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1308
|
+
try {
|
|
1309
|
+
const invalidOnBehalfOfEmail = "invalid-email";
|
|
1310
|
+
const documentId = "invalid-document-id";
|
|
1311
|
+
const downloadResponse = yield documentApi.downloadDocument(documentId, invalidOnBehalfOfEmail);
|
|
1312
|
+
console.error("Expected error, but got success:", downloadResponse);
|
|
1313
|
+
fail('Expected failure for invalid onBehalfOf email was not thrown');
|
|
1314
|
+
}
|
|
1315
|
+
catch (error) {
|
|
1316
|
+
console.log("Expected error received:");
|
|
1317
|
+
expect(error).toBeDefined();
|
|
1318
|
+
expect(error.response.status).toBe(400);
|
|
1319
|
+
expect(error.response.statusText).toBe('Bad Request');
|
|
1320
|
+
}
|
|
1321
|
+
}), 20000);
|
|
1322
|
+
test('Test57:should create an embedded document request URL', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1323
|
+
try {
|
|
1324
|
+
const rectangle = { x: 50, y: 50, width: 200, height: 30 };
|
|
1325
|
+
const formField = new model_1.FormField();
|
|
1326
|
+
formField.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1327
|
+
formField.pageNumber = 1;
|
|
1328
|
+
formField.bounds = rectangle;
|
|
1329
|
+
const documentSigner = new model_1.DocumentSigner();
|
|
1330
|
+
documentSigner.name = 'Signer Name 1';
|
|
1331
|
+
documentSigner.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1332
|
+
documentSigner.signerOrder = 1;
|
|
1333
|
+
documentSigner.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1334
|
+
documentSigner.authenticationCode = '1123';
|
|
1335
|
+
documentSigner.privateMessage = 'This is private message for signer';
|
|
1336
|
+
documentSigner.formFields = [formField];
|
|
1337
|
+
documentSigner.locale = model_1.DocumentSigner.LocaleEnum.En;
|
|
1338
|
+
const embeddedDocumentRequest = new model_1.EmbeddedDocumentRequest();
|
|
1339
|
+
embeddedDocumentRequest.title = 'Sent from API Java SDK';
|
|
1340
|
+
embeddedDocumentRequest.showToolbar = true;
|
|
1341
|
+
embeddedDocumentRequest.showNavigationButtons = true;
|
|
1342
|
+
embeddedDocumentRequest.showPreviewButton = true;
|
|
1343
|
+
embeddedDocumentRequest.showSendButton = true;
|
|
1344
|
+
embeddedDocumentRequest.showSaveButton = true;
|
|
1345
|
+
embeddedDocumentRequest.sendViewOption = model_1.EmbeddedDocumentRequest.SendViewOptionEnum.PreparePage;
|
|
1346
|
+
embeddedDocumentRequest.locale = model_1.EmbeddedDocumentRequest.LocaleEnum.En;
|
|
1347
|
+
embeddedDocumentRequest.showTooltip = false;
|
|
1348
|
+
embeddedDocumentRequest.redirectUrl = 'https://boldsign.dev/sign/redirect';
|
|
1349
|
+
embeddedDocumentRequest.message = 'This is document message sent from API Java SDK';
|
|
1350
|
+
embeddedDocumentRequest.enableSigningOrder = false;
|
|
1351
|
+
embeddedDocumentRequest.signers = [documentSigner];
|
|
1352
|
+
const filePath = 'tests/documents/agreement.pdf';
|
|
1353
|
+
const file = fs.createReadStream(filePath);
|
|
1354
|
+
embeddedDocumentRequest.files = [file];
|
|
1355
|
+
const response = yield documentApi.createEmbeddedRequestUrlDocument(embeddedDocumentRequest);
|
|
1356
|
+
expect(response.sendUrl).toBeDefined();
|
|
1357
|
+
}
|
|
1358
|
+
catch (error) {
|
|
1359
|
+
console.log('Error occurred while creating the embedded document URL:', error.message);
|
|
1360
|
+
expect(error.message).toBeUndefined();
|
|
1361
|
+
}
|
|
1362
|
+
}), 20000);
|
|
1363
|
+
test('Test58: should fail to create an embedded document request URL with invalid signer email', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1364
|
+
var _a;
|
|
1365
|
+
try {
|
|
1366
|
+
const rectangle = { x: 50, y: 50, width: 200, height: 30 };
|
|
1367
|
+
const formField = new model_1.FormField();
|
|
1368
|
+
formField.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1369
|
+
formField.pageNumber = 1;
|
|
1370
|
+
formField.bounds = rectangle;
|
|
1371
|
+
const documentSigner = new model_1.DocumentSigner();
|
|
1372
|
+
documentSigner.name = 'Signer Name 1';
|
|
1373
|
+
documentSigner.emailAddress = 'invalid-email';
|
|
1374
|
+
documentSigner.signerOrder = 1;
|
|
1375
|
+
documentSigner.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1376
|
+
documentSigner.authenticationCode = '1123';
|
|
1377
|
+
documentSigner.privateMessage = 'This is private message for signer';
|
|
1378
|
+
documentSigner.formFields = [formField];
|
|
1379
|
+
documentSigner.locale = model_1.DocumentSigner.LocaleEnum.En;
|
|
1380
|
+
const embeddedDocumentRequest = new model_1.EmbeddedDocumentRequest();
|
|
1381
|
+
embeddedDocumentRequest.title = 'Sent from API Java SDK';
|
|
1382
|
+
embeddedDocumentRequest.showToolbar = true;
|
|
1383
|
+
embeddedDocumentRequest.showNavigationButtons = true;
|
|
1384
|
+
embeddedDocumentRequest.showPreviewButton = true;
|
|
1385
|
+
embeddedDocumentRequest.showSendButton = true;
|
|
1386
|
+
embeddedDocumentRequest.showSaveButton = true;
|
|
1387
|
+
embeddedDocumentRequest.sendViewOption = model_1.EmbeddedDocumentRequest.SendViewOptionEnum.PreparePage;
|
|
1388
|
+
embeddedDocumentRequest.locale = model_1.EmbeddedDocumentRequest.LocaleEnum.En;
|
|
1389
|
+
embeddedDocumentRequest.showTooltip = false;
|
|
1390
|
+
embeddedDocumentRequest.redirectUrl = 'https://boldsign.dev/sign/redirect';
|
|
1391
|
+
embeddedDocumentRequest.message = 'This is document message sent from API Java SDK';
|
|
1392
|
+
embeddedDocumentRequest.enableSigningOrder = false;
|
|
1393
|
+
embeddedDocumentRequest.signers = [documentSigner];
|
|
1394
|
+
const filePath = 'tests/documents/agreement.pdf';
|
|
1395
|
+
const file = fs.createReadStream(filePath);
|
|
1396
|
+
embeddedDocumentRequest.files = [file];
|
|
1397
|
+
const response = yield documentApi.createEmbeddedRequestUrlDocument(embeddedDocumentRequest);
|
|
1398
|
+
console.error('Expected failure but got response:', response);
|
|
1399
|
+
fail('Expected error due to invalid signer email was not thrown');
|
|
1400
|
+
}
|
|
1401
|
+
catch (error) {
|
|
1402
|
+
console.log('Expected error occurred while creating the embedded document URL:', error);
|
|
1403
|
+
expect(error).toBeDefined();
|
|
1404
|
+
expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBeGreaterThanOrEqual(400);
|
|
1405
|
+
expect(error.response.statusText).toBe('Bad Request');
|
|
1406
|
+
}
|
|
1407
|
+
}), 20000);
|
|
1408
|
+
test('Test59: should send a document with radio buttons and form fields', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1409
|
+
try {
|
|
1410
|
+
const radioButtonField1 = new model_1.FormField();
|
|
1411
|
+
radioButtonField1.id = "RadioButton1";
|
|
1412
|
+
radioButtonField1.name = "RadioButton1";
|
|
1413
|
+
radioButtonField1.fieldType = model_1.FormField.FieldTypeEnum.RadioButton;
|
|
1414
|
+
radioButtonField1.value = "OFF";
|
|
1415
|
+
radioButtonField1.pageNumber = 1;
|
|
1416
|
+
radioButtonField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
1417
|
+
radioButtonField1.isRequired = true;
|
|
1418
|
+
radioButtonField1.groupName = "Group1";
|
|
1419
|
+
radioButtonField1.bounds = {
|
|
1420
|
+
x: 50.0,
|
|
1421
|
+
y: 50.0,
|
|
1422
|
+
width: 100.0,
|
|
1423
|
+
height: 150.0,
|
|
1424
|
+
};
|
|
1425
|
+
const radioButtonField2 = new model_1.FormField();
|
|
1426
|
+
radioButtonField2.id = "RadioButton2";
|
|
1427
|
+
radioButtonField2.name = "RadioButton2";
|
|
1428
|
+
radioButtonField2.fieldType = model_1.FormField.FieldTypeEnum.RadioButton;
|
|
1429
|
+
radioButtonField2.value = "ON";
|
|
1430
|
+
radioButtonField2.pageNumber = 1;
|
|
1431
|
+
radioButtonField2.font = model_1.FormField.FontEnum.Helvetica;
|
|
1432
|
+
radioButtonField2.isRequired = true;
|
|
1433
|
+
radioButtonField2.groupName = "Group1";
|
|
1434
|
+
radioButtonField2.bounds = {
|
|
1435
|
+
x: 50.0,
|
|
1436
|
+
y: 100.0,
|
|
1437
|
+
width: 100.0,
|
|
1438
|
+
height: 150.0,
|
|
1439
|
+
};
|
|
1440
|
+
const signer = new model_1.DocumentSigner();
|
|
1441
|
+
signer.name = "Mohammed Mushraf";
|
|
1442
|
+
signer.emailAddress = "mohammedmushraf.abuthakir+300@syncfusion.com";
|
|
1443
|
+
signer.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1444
|
+
signer.formFields = [radioButtonField1, radioButtonField2];
|
|
1445
|
+
signer.locale = model_1.DocumentSigner.LocaleEnum.En;
|
|
1446
|
+
const reminderSettings = new model_1.ReminderSettings();
|
|
1447
|
+
reminderSettings.reminderDays = 3;
|
|
1448
|
+
reminderSettings.reminderCount = 5;
|
|
1449
|
+
reminderSettings.enableAutoReminder = false;
|
|
1450
|
+
const sendForSign = new model_1.SendForSign();
|
|
1451
|
+
sendForSign.files = [fs.createReadStream("tests/documents/agreement.pdf")];
|
|
1452
|
+
sendForSign.title = "SDK Document Test case";
|
|
1453
|
+
sendForSign.message = "Please sign this.";
|
|
1454
|
+
sendForSign.reminderSettings = reminderSettings;
|
|
1455
|
+
sendForSign.disableExpiryAlert = false;
|
|
1456
|
+
sendForSign.enableReassign = true;
|
|
1457
|
+
sendForSign.signers = [signer];
|
|
1458
|
+
sendForSign.enablePrintAndSign = false;
|
|
1459
|
+
sendForSign.disableEmails = false;
|
|
1460
|
+
sendForSign.disableSMS = false;
|
|
1461
|
+
sendForSign.autoDetectFields = false;
|
|
1462
|
+
sendForSign.enableSigningOrder = false;
|
|
1463
|
+
sendForSign.useTextTags = false;
|
|
1464
|
+
sendForSign.hideDocumentId = false;
|
|
1465
|
+
const response = yield documentApi.sendDocument(sendForSign);
|
|
1466
|
+
expect(response.documentId).toBeDefined();
|
|
1467
|
+
console.log(`Successfully sent document for signing. Document ID: ${response.documentId}`);
|
|
1468
|
+
}
|
|
1469
|
+
catch (error) {
|
|
1470
|
+
console.error('Error occurred while sending document with radio buttons:', error);
|
|
1471
|
+
expect(error).toBeUndefined();
|
|
1472
|
+
}
|
|
1473
|
+
}), 20000);
|
|
1474
|
+
test('Test60: should fail to send a document with missing title', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1475
|
+
var _a;
|
|
1476
|
+
try {
|
|
1477
|
+
const signer1 = new model_1.DocumentSigner();
|
|
1478
|
+
signer1.name = 'Test Signer';
|
|
1479
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1480
|
+
signer1.signerOrder = 1;
|
|
1481
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1482
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
1483
|
+
signer1.authenticationCode = '123456';
|
|
1484
|
+
const formField1 = new model_1.FormField();
|
|
1485
|
+
formField1.name = 'Sign';
|
|
1486
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1487
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
1488
|
+
formField1.pageNumber = 1;
|
|
1489
|
+
formField1.isRequired = true;
|
|
1490
|
+
formField1.bounds = new model_1.Rectangle();
|
|
1491
|
+
signer1.formFields = [formField1];
|
|
1492
|
+
signer1.privateMessage = 'This is a private message for signer';
|
|
1493
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1494
|
+
sendDocumentRequest.title = '';
|
|
1495
|
+
sendDocumentRequest.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1496
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
1497
|
+
sendDocumentRequest.signers = [signer1];
|
|
1498
|
+
sendDocumentRequest.message = 'Please sign this document';
|
|
1499
|
+
yield documentApi.sendDocument(sendDocumentRequest);
|
|
1500
|
+
}
|
|
1501
|
+
catch (error) {
|
|
1502
|
+
console.log("Expected error occurred:", error);
|
|
1503
|
+
expect(error).toBeDefined();
|
|
1504
|
+
expect((_a = error.response) === null || _a === void 0 ? void 0 : _a.status).toBeGreaterThanOrEqual(400);
|
|
1505
|
+
expect(error.response.statusText).toBe('Bad Request');
|
|
1506
|
+
}
|
|
1507
|
+
}), 20000);
|
|
1508
|
+
test('Test61: should list documents with valid pagination and date filters is Sent Between', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1509
|
+
try {
|
|
1510
|
+
const page = 1;
|
|
1511
|
+
const pageSize = 10;
|
|
1512
|
+
const startDate = new Date();
|
|
1513
|
+
startDate.setDate(startDate.getDate() - 30);
|
|
1514
|
+
const endDate = new Date();
|
|
1515
|
+
const dateFilterType = 'SentBetween';
|
|
1516
|
+
const response = yield documentApi.listDocuments(page, undefined, undefined, undefined, dateFilterType, pageSize, startDate, undefined, endDate, undefined, undefined, undefined);
|
|
1517
|
+
expect(response.result).toBeDefined();
|
|
1518
|
+
}
|
|
1519
|
+
catch (error) {
|
|
1520
|
+
console.error("Error occurred while listing documents:", error);
|
|
1521
|
+
expect(error).toBeUndefined();
|
|
1522
|
+
}
|
|
1523
|
+
}), 20000);
|
|
1524
|
+
test('Test62: should list documents with valid pagination and date filters is Expiring', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1525
|
+
try {
|
|
1526
|
+
const page = 1;
|
|
1527
|
+
const pageSize = 10;
|
|
1528
|
+
const startDate = new Date();
|
|
1529
|
+
startDate.setDate(startDate.getDate() - 30);
|
|
1530
|
+
const endDate = new Date();
|
|
1531
|
+
const dateFilterType = "Expiring";
|
|
1532
|
+
const response = yield documentApi.listDocuments(page, undefined, undefined, undefined, dateFilterType, pageSize, startDate, undefined, endDate, undefined, undefined, undefined);
|
|
1533
|
+
expect(response.result).toBeDefined();
|
|
1534
|
+
}
|
|
1535
|
+
catch (error) {
|
|
1536
|
+
console.error("Error occurred while listing documents:", error);
|
|
1537
|
+
expect(error).toBeUndefined();
|
|
1538
|
+
}
|
|
1539
|
+
}), 20000);
|
|
1540
|
+
test('Test63: should throw error when start date is after end date in listDocuments', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1541
|
+
try {
|
|
1542
|
+
const page = 1;
|
|
1543
|
+
const pageSize = 10;
|
|
1544
|
+
const startDate = new Date();
|
|
1545
|
+
const endDate = new Date();
|
|
1546
|
+
endDate.setDate(endDate.getDate() - 30);
|
|
1547
|
+
const dateFilterType = 'SentBetween';
|
|
1548
|
+
yield documentApi.listDocuments(page, undefined, undefined, undefined, dateFilterType, pageSize, startDate, undefined, endDate, undefined, undefined, undefined);
|
|
1549
|
+
throw new Error("Expected an error due to start date being after end date.");
|
|
1550
|
+
}
|
|
1551
|
+
catch (error) {
|
|
1552
|
+
console.error("Expected error occurred:", error);
|
|
1553
|
+
expect(error).toBeDefined();
|
|
1554
|
+
expect(error.response.status).toBe(400);
|
|
1555
|
+
expect(error.response.statusText).toBe("Bad Request");
|
|
1556
|
+
}
|
|
1557
|
+
}), 20000);
|
|
1558
|
+
test('Test64: should send a scheduled document for signing with existing brand ID and one signer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1559
|
+
try {
|
|
1560
|
+
const scheduledDate = new Date();
|
|
1561
|
+
scheduledDate.setDate(scheduledDate.getDate() + 1);
|
|
1562
|
+
const scheduledSendTime = Math.floor(scheduledDate.getTime() / 1000);
|
|
1563
|
+
const signer1 = new model_1.DocumentSigner();
|
|
1564
|
+
signer1.name = 'Test Signer';
|
|
1565
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1566
|
+
signer1.signerOrder = 1;
|
|
1567
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1568
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
1569
|
+
signer1.authenticationCode = '123456';
|
|
1570
|
+
const formField1 = new model_1.FormField();
|
|
1571
|
+
formField1.name = 'Sign';
|
|
1572
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1573
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
1574
|
+
formField1.pageNumber = 1;
|
|
1575
|
+
formField1.isRequired = true;
|
|
1576
|
+
formField1.bounds = {
|
|
1577
|
+
x: 50,
|
|
1578
|
+
y: 50,
|
|
1579
|
+
width: 100,
|
|
1580
|
+
height: 50
|
|
1581
|
+
};
|
|
1582
|
+
signer1.formFields = [formField1];
|
|
1583
|
+
signer1.privateMessage = 'This is a private message for signer';
|
|
1584
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1585
|
+
sendDocumentRequest.title = 'Document SDK API - Scheduled';
|
|
1586
|
+
sendDocumentRequest.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1587
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
1588
|
+
sendDocumentRequest.signers = [signer1];
|
|
1589
|
+
sendDocumentRequest.message = 'Please sign this document';
|
|
1590
|
+
sendDocumentRequest.scheduledSendTime = scheduledSendTime;
|
|
1591
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
1592
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1593
|
+
}
|
|
1594
|
+
catch (error) {
|
|
1595
|
+
console.error('Error occurred while sending scheduled document for signing:', error);
|
|
1596
|
+
expect(error).toBeUndefined();
|
|
1597
|
+
}
|
|
1598
|
+
}), 20000);
|
|
1599
|
+
test('Test65: should fail to send a scheduled document for signing with invalid signer email', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1600
|
+
try {
|
|
1601
|
+
const scheduledDate = new Date();
|
|
1602
|
+
scheduledDate.setDate(scheduledDate.getDate() + 1);
|
|
1603
|
+
const scheduledSendTime = Math.floor(scheduledDate.getTime() / 1000);
|
|
1604
|
+
const signer1 = new model_1.DocumentSigner();
|
|
1605
|
+
signer1.name = 'Test Signer';
|
|
1606
|
+
signer1.emailAddress = 'invalidemail.com';
|
|
1607
|
+
signer1.signerOrder = 1;
|
|
1608
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1609
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
1610
|
+
signer1.authenticationCode = '123456';
|
|
1611
|
+
const formField1 = new model_1.FormField();
|
|
1612
|
+
formField1.name = 'Sign';
|
|
1613
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1614
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
1615
|
+
formField1.pageNumber = 1;
|
|
1616
|
+
formField1.isRequired = true;
|
|
1617
|
+
formField1.bounds = {
|
|
1618
|
+
x: 50,
|
|
1619
|
+
y: 50,
|
|
1620
|
+
width: 100,
|
|
1621
|
+
height: 50
|
|
1622
|
+
};
|
|
1623
|
+
signer1.formFields = [formField1];
|
|
1624
|
+
signer1.privateMessage = 'This is a private message for signer';
|
|
1625
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1626
|
+
sendDocumentRequest.title = 'Document SDK API - Scheduled';
|
|
1627
|
+
sendDocumentRequest.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1628
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
1629
|
+
sendDocumentRequest.signers = [signer1];
|
|
1630
|
+
sendDocumentRequest.message = 'Please sign this document';
|
|
1631
|
+
sendDocumentRequest.scheduledSendTime = scheduledSendTime;
|
|
1632
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
1633
|
+
expect(sendDocumentResponse).toBeUndefined();
|
|
1634
|
+
}
|
|
1635
|
+
catch (error) {
|
|
1636
|
+
console.error('Error occurred while sending scheduled document for signing with invalid email:', error);
|
|
1637
|
+
expect(error).toBeDefined();
|
|
1638
|
+
expect(error.response.status).toBe(400);
|
|
1639
|
+
expect(error.response.statusText).toBe("Bad Request");
|
|
1640
|
+
}
|
|
1641
|
+
}), 20000);
|
|
1642
|
+
test('Test66: should send a document with recipient notifications', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
1643
|
+
try {
|
|
1644
|
+
console.log("Sender email fetched:", senderEmail);
|
|
1645
|
+
const signer1 = new model_1.DocumentSigner();
|
|
1646
|
+
signer1.name = 'Test Signer';
|
|
1647
|
+
signer1.emailAddress = 'mohammedmushraf.abuthakir+6@syncfusion.com';
|
|
1648
|
+
signer1.signerOrder = 1;
|
|
1649
|
+
signer1.signerType = model_1.DocumentSigner.SignerTypeEnum.Signer;
|
|
1650
|
+
signer1.authenticationType = model_1.DocumentSigner.AuthenticationTypeEnum.AccessCode;
|
|
1651
|
+
signer1.authenticationCode = '123456';
|
|
1652
|
+
const formField1 = new model_1.FormField();
|
|
1653
|
+
formField1.name = 'Sign';
|
|
1654
|
+
formField1.fieldType = model_1.FormField.FieldTypeEnum.Signature;
|
|
1655
|
+
formField1.font = model_1.FormField.FontEnum.Helvetica;
|
|
1656
|
+
formField1.pageNumber = 1;
|
|
1657
|
+
formField1.isRequired = true;
|
|
1658
|
+
formField1.bounds = new model_1.Rectangle();
|
|
1659
|
+
signer1.formFields = [formField1];
|
|
1660
|
+
signer1.privateMessage = 'This is private message for signer';
|
|
1661
|
+
signer1.recipientNotificationSettings = {
|
|
1662
|
+
signatureRequest: true,
|
|
1663
|
+
declined: true,
|
|
1664
|
+
revoked: true,
|
|
1665
|
+
signed: true,
|
|
1666
|
+
completed: true,
|
|
1667
|
+
expired: true,
|
|
1668
|
+
reassigned: true,
|
|
1669
|
+
deleted: true,
|
|
1670
|
+
reminders: true,
|
|
1671
|
+
editRecipient: true
|
|
1672
|
+
};
|
|
1673
|
+
const sendDocumentRequest = new model_1.SendForSign();
|
|
1674
|
+
sendDocumentRequest.title = 'Document SDK API';
|
|
1675
|
+
sendDocumentRequest.files = [fs.createReadStream('tests/documents/agreement.pdf')];
|
|
1676
|
+
sendDocumentRequest.enablePrintAndSign = true;
|
|
1677
|
+
sendDocumentRequest.hideDocumentId = true;
|
|
1678
|
+
sendDocumentRequest.enableReassign = false;
|
|
1679
|
+
sendDocumentRequest.signers = [signer1];
|
|
1680
|
+
const sendDocumentResponse = yield documentApi.sendDocument(sendDocumentRequest);
|
|
1681
|
+
expect(sendDocumentResponse.documentId).toBeDefined();
|
|
1682
|
+
const createdDocumentId = sendDocumentResponse.documentId;
|
|
1683
|
+
console.log('Created Document ID:', createdDocumentId);
|
|
1684
|
+
}
|
|
1685
|
+
catch (error) {
|
|
1686
|
+
console.error('Error occurred while sending document for signing:', error);
|
|
1687
|
+
expect(error).toBeUndefined();
|
|
1688
|
+
}
|
|
1689
|
+
}), 20000);
|
|
1690
|
+
});
|
|
1691
|
+
//# sourceMappingURL=DocumentApiTest.spec.js.map
|