@12stonechurch/omnihive-worker-documents
Advanced tools
Comparing version 2.0.67 to 2.0.68
@@ -7,4 +7,5 @@ import { IGraphEndpointWorker } from "@withonevision/omnihive-core/interfaces/IGraphEndpointWorker"; | ||
private getDocuSignTemplateId; | ||
private createMpEnvelopeData; | ||
private storeEnvelopeData; | ||
} | ||
//# sourceMappingURL=generateDocument.d.ts.map |
@@ -32,4 +32,5 @@ "use strict"; | ||
if (docusignWorker) { | ||
const envelopeData = yield docusignWorker.createEnvelope(templateId, email, name, customArgs.role); | ||
yield this.storeEnvelopeData(customArgs.templateId, contactData.id, envelopeData); | ||
const mpId = yield this.createMpEnvelopeData(customArgs.templateId, contactData.id); | ||
const envelopeData = yield docusignWorker.createEnvelope(templateId, email, name, customArgs.role, mpId); | ||
yield this.storeEnvelopeData(mpId, envelopeData); | ||
const url = yield docusignWorker.getEnvelopeUrl(customArgs.redirectUrl, email, name, envelopeData.envelopeId); | ||
@@ -54,3 +55,4 @@ return { envelopeUrl: url }; | ||
}); | ||
this.storeEnvelopeData = (formId, contactId, data) => __awaiter(this, void 0, void 0, function* () { | ||
this.createMpEnvelopeData = (formId, contactId) => __awaiter(this, void 0, void 0, function* () { | ||
var _a, _b, _c; | ||
const databaseWorker = this.getWorker(HiveWorkerType_1.HiveWorkerType.Database, "dbMinistryPlatform"); | ||
@@ -60,8 +62,22 @@ if (!databaseWorker) { | ||
} | ||
const dateCreated = dayjs_1.default(data.statusDateTime).format("YYYY-MM-DD hh:mm:ssa"); | ||
const insertData = { | ||
Form_ID: formId, | ||
Contact_ID: contactId, | ||
Form_ID: formId, | ||
Status_ID: 1, | ||
Domain_ID: 1, | ||
}; | ||
const queryBuilder = databaseWorker === null || databaseWorker === void 0 ? void 0 : databaseWorker.connection.queryBuilder(); | ||
queryBuilder.from("DocuSign_Envelopes"); | ||
queryBuilder.insert(insertData, ["DocuSign_Envelope_ID"]); | ||
return (_c = (_b = (_a = (yield databaseWorker.executeQuery(queryBuilder.toString()))) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.DocuSign_Envelope_ID; | ||
}); | ||
this.storeEnvelopeData = (mpId, data) => __awaiter(this, void 0, void 0, function* () { | ||
const databaseWorker = this.getWorker(HiveWorkerType_1.HiveWorkerType.Database, "dbMinistryPlatform"); | ||
if (!databaseWorker) { | ||
throw new Error("Database worker not configured"); | ||
} | ||
const dateCreated = dayjs_1.default(data.statusDateTime).format("YYYY-MM-DD hh:mm:ssa"); | ||
const updateData = { | ||
Envelope_ID: data.envelopeId, | ||
Created_Date: dateCreated, | ||
Status_ID: 2, | ||
Last_Updated_Date: dateCreated, | ||
@@ -72,3 +88,4 @@ Domain_ID: 1, | ||
queryBuilder.from("DocuSign_Envelopes"); | ||
queryBuilder.insert(insertData); | ||
queryBuilder.update(updateData); | ||
queryBuilder.where("DocuSign_Envelope_ID", mpId); | ||
yield databaseWorker.executeQuery(queryBuilder.toString()); | ||
@@ -75,0 +92,0 @@ }); |
{ | ||
"name": "@12stonechurch/omnihive-worker-documents", | ||
"version": "2.0.67", | ||
"version": "2.0.68", | ||
"description": "OmniHive Custom Function package", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17278
161