@ottoai/documents 1.4.3 → 1.5.0

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.
@@ -0,0 +1,61 @@
1
+ export declare class AddressDto {
2
+ address_line_1: string;
3
+ address_line_2?: string;
4
+ city: string;
5
+ state: string;
6
+ postal_code: string;
7
+ country?: string;
8
+ }
9
+ export declare enum TaxYearType {
10
+ CALENDAR_YEAR = "calendar",
11
+ FISCAL_YEAR = "fiscal",
12
+ WEEK_52_53_DECEMBER = "52-53-december",
13
+ WEEK_52_53_OTHER = "52-53-other"
14
+ }
15
+ export declare class ShareholderDto {
16
+ name: string;
17
+ address: AddressDto;
18
+ numberOfShares: number;
19
+ percentageOwnership?: number;
20
+ dateAcquired: string;
21
+ taxIdNumber: string;
22
+ taxYearEnd: string;
23
+ }
24
+ export declare class Form2553DataDto {
25
+ corporationName: string;
26
+ corporationAddress: AddressDto;
27
+ employerIdNumber: string;
28
+ dateIncorporated: string;
29
+ stateOfIncorporation: string;
30
+ changedName?: boolean;
31
+ changedAddress?: boolean;
32
+ electionEffectiveDate: string;
33
+ selectedTaxYear: TaxYearType;
34
+ fiscalYearEndDate?: string;
35
+ weekEndingMonth?: string;
36
+ moreThan100ShareholdersFamilyTreated?: boolean;
37
+ officerName: string;
38
+ officerTitle: string;
39
+ officerPhoneNumber: string;
40
+ isLateElection?: boolean;
41
+ shareholders: ShareholderDto[];
42
+ formFilingDate?: string;
43
+ }
44
+ export declare class Form2553ValidationDto {
45
+ static validateFilingDeadline(incorporationDate: string, filingDate: string): boolean;
46
+ static validateShareholderOwnership(shareholders: ShareholderDto[]): boolean;
47
+ static validateEIN(ein: string): boolean;
48
+ static validateMaxShareholdersForPDF(shareholders: ShareholderDto[]): {
49
+ isValid: boolean;
50
+ message?: string;
51
+ };
52
+ static validateLateElection(incorporationDate: string, electionEffectiveDate: string, filingDate?: string): {
53
+ isLate: boolean;
54
+ daysSinceIncorporation?: number;
55
+ daysSinceElectionDate?: number;
56
+ };
57
+ static validateSCorpEligibility(data: Form2553DataDto): {
58
+ isEligible: boolean;
59
+ issues: string[];
60
+ };
61
+ }
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Form2553ValidationDto = exports.Form2553DataDto = exports.ShareholderDto = exports.TaxYearType = exports.AddressDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class AddressDto {
15
+ }
16
+ exports.AddressDto = AddressDto;
17
+ __decorate([
18
+ (0, class_validator_1.IsString)(),
19
+ (0, class_validator_1.IsNotEmpty)(),
20
+ (0, class_validator_1.Length)(1, 100),
21
+ __metadata("design:type", String)
22
+ ], AddressDto.prototype, "address_line_1", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsOptional)(),
25
+ (0, class_validator_1.IsString)(),
26
+ (0, class_validator_1.Length)(1, 100),
27
+ __metadata("design:type", String)
28
+ ], AddressDto.prototype, "address_line_2", void 0);
29
+ __decorate([
30
+ (0, class_validator_1.IsString)(),
31
+ (0, class_validator_1.IsNotEmpty)(),
32
+ (0, class_validator_1.Length)(1, 50),
33
+ __metadata("design:type", String)
34
+ ], AddressDto.prototype, "city", void 0);
35
+ __decorate([
36
+ (0, class_validator_1.IsString)(),
37
+ (0, class_validator_1.IsNotEmpty)(),
38
+ (0, class_validator_1.Length)(2, 50),
39
+ __metadata("design:type", String)
40
+ ], AddressDto.prototype, "state", void 0);
41
+ __decorate([
42
+ (0, class_validator_1.IsString)(),
43
+ (0, class_validator_1.IsNotEmpty)(),
44
+ (0, class_validator_1.Matches)(/^\d{5}(-\d{4})?$/, { message: "Invalid ZIP code format" }),
45
+ __metadata("design:type", String)
46
+ ], AddressDto.prototype, "postal_code", void 0);
47
+ __decorate([
48
+ (0, class_validator_1.IsOptional)(),
49
+ (0, class_validator_1.IsString)(),
50
+ (0, class_validator_1.Length)(2, 50),
51
+ __metadata("design:type", String)
52
+ ], AddressDto.prototype, "country", void 0);
53
+ var TaxYearType;
54
+ (function (TaxYearType) {
55
+ TaxYearType["CALENDAR_YEAR"] = "calendar";
56
+ TaxYearType["FISCAL_YEAR"] = "fiscal";
57
+ TaxYearType["WEEK_52_53_DECEMBER"] = "52-53-december";
58
+ TaxYearType["WEEK_52_53_OTHER"] = "52-53-other";
59
+ })(TaxYearType || (exports.TaxYearType = TaxYearType = {}));
60
+ class ShareholderDto {
61
+ }
62
+ exports.ShareholderDto = ShareholderDto;
63
+ __decorate([
64
+ (0, class_validator_1.IsString)(),
65
+ (0, class_validator_1.IsNotEmpty)(),
66
+ (0, class_validator_1.Length)(1, 100),
67
+ __metadata("design:type", String)
68
+ ], ShareholderDto.prototype, "name", void 0);
69
+ __decorate([
70
+ (0, class_validator_1.IsObject)(),
71
+ (0, class_validator_1.ValidateNested)(),
72
+ __metadata("design:type", AddressDto)
73
+ ], ShareholderDto.prototype, "address", void 0);
74
+ __decorate([
75
+ (0, class_validator_1.IsNumber)(),
76
+ (0, class_validator_1.Min)(0),
77
+ __metadata("design:type", Number)
78
+ ], ShareholderDto.prototype, "numberOfShares", void 0);
79
+ __decorate([
80
+ (0, class_validator_1.IsOptional)(),
81
+ (0, class_validator_1.IsNumber)(),
82
+ (0, class_validator_1.Min)(0),
83
+ (0, class_validator_1.Max)(100),
84
+ __metadata("design:type", Number)
85
+ ], ShareholderDto.prototype, "percentageOwnership", void 0);
86
+ __decorate([
87
+ (0, class_validator_1.IsDateString)(),
88
+ __metadata("design:type", String)
89
+ ], ShareholderDto.prototype, "dateAcquired", void 0);
90
+ __decorate([
91
+ (0, class_validator_1.IsString)(),
92
+ (0, class_validator_1.IsNotEmpty)(),
93
+ (0, class_validator_1.Matches)(/^\d{3}-\d{2}-\d{4}$|^\d{2}-\d{7}$/, {
94
+ message: "Must be valid SSN (XXX-XX-XXXX) or EIN (XX-XXXXXXX) format",
95
+ }),
96
+ __metadata("design:type", String)
97
+ ], ShareholderDto.prototype, "taxIdNumber", void 0);
98
+ __decorate([
99
+ (0, class_validator_1.IsString)(),
100
+ (0, class_validator_1.IsNotEmpty)(),
101
+ (0, class_validator_1.Matches)(/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])$/, {
102
+ message: "Tax year end date must be in MM/DD format",
103
+ }),
104
+ __metadata("design:type", String)
105
+ ], ShareholderDto.prototype, "taxYearEnd", void 0);
106
+ class Form2553DataDto {
107
+ }
108
+ exports.Form2553DataDto = Form2553DataDto;
109
+ __decorate([
110
+ (0, class_validator_1.IsString)(),
111
+ (0, class_validator_1.IsNotEmpty)(),
112
+ (0, class_validator_1.Length)(1, 150),
113
+ __metadata("design:type", String)
114
+ ], Form2553DataDto.prototype, "corporationName", void 0);
115
+ __decorate([
116
+ (0, class_validator_1.IsObject)(),
117
+ (0, class_validator_1.ValidateNested)(),
118
+ __metadata("design:type", AddressDto)
119
+ ], Form2553DataDto.prototype, "corporationAddress", void 0);
120
+ __decorate([
121
+ (0, class_validator_1.IsString)(),
122
+ (0, class_validator_1.IsNotEmpty)(),
123
+ (0, class_validator_1.Matches)(/^\d{2}-\d{7}$|^Applied for$/, {
124
+ message: 'Must be valid EIN format (XX-XXXXXXX) or "Applied for"',
125
+ }),
126
+ __metadata("design:type", String)
127
+ ], Form2553DataDto.prototype, "employerIdNumber", void 0);
128
+ __decorate([
129
+ (0, class_validator_1.IsDateString)(),
130
+ __metadata("design:type", String)
131
+ ], Form2553DataDto.prototype, "dateIncorporated", void 0);
132
+ __decorate([
133
+ (0, class_validator_1.IsString)(),
134
+ (0, class_validator_1.IsNotEmpty)(),
135
+ (0, class_validator_1.Length)(2, 50),
136
+ __metadata("design:type", String)
137
+ ], Form2553DataDto.prototype, "stateOfIncorporation", void 0);
138
+ __decorate([
139
+ (0, class_validator_1.IsOptional)(),
140
+ (0, class_validator_1.IsBoolean)(),
141
+ __metadata("design:type", Boolean)
142
+ ], Form2553DataDto.prototype, "changedName", void 0);
143
+ __decorate([
144
+ (0, class_validator_1.IsOptional)(),
145
+ (0, class_validator_1.IsBoolean)(),
146
+ __metadata("design:type", Boolean)
147
+ ], Form2553DataDto.prototype, "changedAddress", void 0);
148
+ __decorate([
149
+ (0, class_validator_1.IsDateString)(),
150
+ __metadata("design:type", String)
151
+ ], Form2553DataDto.prototype, "electionEffectiveDate", void 0);
152
+ __decorate([
153
+ (0, class_validator_1.IsEnum)(TaxYearType),
154
+ __metadata("design:type", String)
155
+ ], Form2553DataDto.prototype, "selectedTaxYear", void 0);
156
+ __decorate([
157
+ (0, class_validator_1.IsOptional)(),
158
+ (0, class_validator_1.IsString)(),
159
+ (0, class_validator_1.Matches)(/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])$/),
160
+ __metadata("design:type", String)
161
+ ], Form2553DataDto.prototype, "fiscalYearEndDate", void 0);
162
+ __decorate([
163
+ (0, class_validator_1.IsOptional)(),
164
+ (0, class_validator_1.IsString)(),
165
+ __metadata("design:type", String)
166
+ ], Form2553DataDto.prototype, "weekEndingMonth", void 0);
167
+ __decorate([
168
+ (0, class_validator_1.IsOptional)(),
169
+ (0, class_validator_1.IsBoolean)(),
170
+ __metadata("design:type", Boolean)
171
+ ], Form2553DataDto.prototype, "moreThan100ShareholdersFamilyTreated", void 0);
172
+ __decorate([
173
+ (0, class_validator_1.IsString)(),
174
+ (0, class_validator_1.IsNotEmpty)(),
175
+ (0, class_validator_1.Length)(1, 100),
176
+ __metadata("design:type", String)
177
+ ], Form2553DataDto.prototype, "officerName", void 0);
178
+ __decorate([
179
+ (0, class_validator_1.IsString)(),
180
+ (0, class_validator_1.IsNotEmpty)(),
181
+ (0, class_validator_1.Length)(1, 50),
182
+ __metadata("design:type", String)
183
+ ], Form2553DataDto.prototype, "officerTitle", void 0);
184
+ __decorate([
185
+ (0, class_validator_1.IsString)(),
186
+ (0, class_validator_1.IsNotEmpty)(),
187
+ (0, class_validator_1.IsPhoneNumber)("US"),
188
+ __metadata("design:type", String)
189
+ ], Form2553DataDto.prototype, "officerPhoneNumber", void 0);
190
+ __decorate([
191
+ (0, class_validator_1.IsOptional)(),
192
+ (0, class_validator_1.IsBoolean)(),
193
+ __metadata("design:type", Boolean)
194
+ ], Form2553DataDto.prototype, "isLateElection", void 0);
195
+ __decorate([
196
+ (0, class_validator_1.IsArray)(),
197
+ (0, class_validator_1.ValidateNested)({ each: true }),
198
+ __metadata("design:type", Array)
199
+ ], Form2553DataDto.prototype, "shareholders", void 0);
200
+ __decorate([
201
+ (0, class_validator_1.IsOptional)(),
202
+ (0, class_validator_1.IsDateString)(),
203
+ __metadata("design:type", String)
204
+ ], Form2553DataDto.prototype, "formFilingDate", void 0);
205
+ class Form2553ValidationDto {
206
+ static validateFilingDeadline(incorporationDate, filingDate) {
207
+ const incorporation = new Date(incorporationDate);
208
+ const filing = new Date(filingDate);
209
+ const daysDifference = Math.floor((filing.getTime() - incorporation.getTime()) / (1000 * 60 * 60 * 24));
210
+ return daysDifference <= 75;
211
+ }
212
+ static validateShareholderOwnership(shareholders) {
213
+ const totalPercentage = shareholders.reduce((sum, shareholder) => {
214
+ return sum + (shareholder.percentageOwnership || 0);
215
+ }, 0);
216
+ return Math.abs(totalPercentage - 100) < 0.01;
217
+ }
218
+ static validateEIN(ein) {
219
+ if (ein === "Applied for")
220
+ return true;
221
+ const einRegex = /^\d{2}-\d{7}$/;
222
+ return einRegex.test(ein);
223
+ }
224
+ static validateMaxShareholdersForPDF(shareholders) {
225
+ if (shareholders.length > 4) {
226
+ return {
227
+ isValid: false,
228
+ message: "Only the first 4 shareholders will be included in the PDF. Consider splitting into multiple forms if more shareholders need to be documented.",
229
+ };
230
+ }
231
+ return { isValid: true };
232
+ }
233
+ static validateLateElection(incorporationDate, electionEffectiveDate, filingDate) {
234
+ const incorporation = new Date(incorporationDate);
235
+ const election = new Date(electionEffectiveDate);
236
+ const filing = filingDate ? new Date(filingDate) : new Date();
237
+ const daysSinceIncorporation = Math.floor((filing.getTime() - incorporation.getTime()) / (1000 * 60 * 60 * 24));
238
+ const daysSinceElectionDate = Math.floor((filing.getTime() - election.getTime()) / (1000 * 60 * 60 * 24));
239
+ const isLate = daysSinceIncorporation > 75 || daysSinceElectionDate > 75;
240
+ return {
241
+ isLate,
242
+ daysSinceIncorporation,
243
+ daysSinceElectionDate,
244
+ };
245
+ }
246
+ static validateSCorpEligibility(data) {
247
+ const issues = [];
248
+ if (data.shareholders.length > 100) {
249
+ issues.push("S-Corporation cannot have more than 100 shareholders");
250
+ }
251
+ data.shareholders.forEach((shareholder, index) => {
252
+ if (!shareholder.taxIdNumber) {
253
+ issues.push(`Shareholder ${index + 1} tax ID number is required`);
254
+ }
255
+ });
256
+ const totalPercentage = data.shareholders.reduce((sum, shareholder) => {
257
+ return sum + (shareholder.percentageOwnership || 0);
258
+ }, 0);
259
+ if (Math.abs(totalPercentage - 100) > 0.01) {
260
+ issues.push(`Shareholder ownership percentages must total 100%, currently ${totalPercentage}%`);
261
+ }
262
+ if (!data.corporationName) {
263
+ issues.push("Corporation name is required");
264
+ }
265
+ if (!data.employerIdNumber) {
266
+ issues.push("Employer ID number is required");
267
+ }
268
+ return {
269
+ isEligible: issues.length === 0,
270
+ issues,
271
+ };
272
+ }
273
+ }
274
+ exports.Form2553ValidationDto = Form2553ValidationDto;
275
+ //# sourceMappingURL=form.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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CACT,gEAAgE,eAAe,GAAG,CACnF,CAAC;QACJ,CAAC;QAGD,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAChD,CAAC;QAMD,OAAO;YACL,UAAU,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC/B,MAAM;SACP,CAAC;IACJ,CAAC;CACF;AA9ID,sDA8IC"}
@@ -0,0 +1,18 @@
1
+ import { Form2553DataDto } from "./form.dto";
2
+ declare const formatAddress: (addressLine1: string, addressLine2?: string, city?: string, state?: string, postalCode?: string, country?: string) => string;
3
+ declare const formatFullAddress: (addressLine1: string, addressLine2?: string, city?: string, state?: string, postalCode?: string, country?: string) => {
4
+ line1: string;
5
+ line2: string;
6
+ line3: string;
7
+ };
8
+ declare const splitTextIntoLines: (text: string, maxLength?: number) => string[];
9
+ declare const form2553Coordinates: (data: Form2553DataDto) => Record<string, string>[];
10
+ declare const validateForm2553Data: (data: Form2553DataDto) => void;
11
+ export declare const form2553: (data: Form2553DataDto) => Promise<Buffer>;
12
+ export { validateForm2553Data, formatAddress, formatFullAddress, form2553Coordinates, splitTextIntoLines, };
13
+ export declare const generateForm2553WithValidation: (data: Form2553DataDto, options?: {
14
+ skipSignatureValidation?: boolean;
15
+ skipOwnershipValidation?: boolean;
16
+ skipFilingDeadlineWarning?: boolean;
17
+ maxShareholdersPerPage?: number;
18
+ }) => Promise<Buffer>;
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateForm2553WithValidation = exports.splitTextIntoLines = exports.form2553Coordinates = exports.formatFullAddress = exports.formatAddress = exports.validateForm2553Data = exports.form2553 = void 0;
7
+ const fs_1 = require("fs");
8
+ const util_1 = require("util");
9
+ const path_1 = require("path");
10
+ const date_fns_1 = require("date-fns");
11
+ const generator_1 = require("../../util/pdfme/generator");
12
+ const text_1 = __importDefault(require("../../util/pdfme/schemas/text"));
13
+ const image_1 = __importDefault(require("../../util/pdfme/schemas/graphics/image"));
14
+ const buffer_1 = require("../../util/buffer");
15
+ const constants_1 = require("../constants");
16
+ const schema_json_1 = __importDefault(require("./schema.json"));
17
+ const form_dto_1 = require("./form.dto");
18
+ const readFilePromise = (0, util_1.promisify)(fs_1.readFile);
19
+ const DATE_FORMAT = "MM/dd/yyyy";
20
+ const formatAddress = (addressLine1, addressLine2, city, state, postalCode, country) => {
21
+ const parts = [
22
+ addressLine1,
23
+ addressLine2,
24
+ city && state && postalCode ? `${city}, ${state} ${postalCode}` : "",
25
+ country && country !== "United States" && country !== "US" ? country : "",
26
+ ].filter(Boolean);
27
+ return parts.join(", ");
28
+ };
29
+ exports.formatAddress = formatAddress;
30
+ const formatFullAddress = (addressLine1, addressLine2, city, state, postalCode, country) => {
31
+ return {
32
+ line1: addressLine1 || "",
33
+ line2: addressLine2 || "",
34
+ line3: `${city || ""}, ${state || ""} ${postalCode || ""}${country && country !== "United States" && country !== "US"
35
+ ? `, ${country}`
36
+ : ""}`.trim(),
37
+ };
38
+ };
39
+ exports.formatFullAddress = formatFullAddress;
40
+ const splitTextIntoLines = (text, maxLength = 80) => {
41
+ if (!text)
42
+ return [];
43
+ const words = text.split(" ");
44
+ const lines = [];
45
+ let currentLine = "";
46
+ for (const word of words) {
47
+ if ((currentLine + word).length <= maxLength) {
48
+ currentLine += (currentLine ? " " : "") + word;
49
+ }
50
+ else {
51
+ if (currentLine)
52
+ lines.push(currentLine);
53
+ currentLine = word;
54
+ }
55
+ }
56
+ if (currentLine)
57
+ lines.push(currentLine);
58
+ return lines;
59
+ };
60
+ exports.splitTextIntoLines = splitTextIntoLines;
61
+ const form2553Coordinates = (data) => {
62
+ const page1 = {
63
+ corporation_name: data.corporationName || "",
64
+ address_line_1: data.corporationAddress.address_line_1 || "",
65
+ address_city_state_zip_country: `${data.corporationAddress.city || ""}, ${data.corporationAddress.state || ""} ${data.corporationAddress.postal_code || ""}${data.corporationAddress.country &&
66
+ data.corporationAddress.country !== "United States" &&
67
+ data.corporationAddress.country !== "US"
68
+ ? `, ${data.corporationAddress.country}`
69
+ : ""}`.trim(),
70
+ employer_id_number: data.employerIdNumber || "",
71
+ date_incorporated: data.dateIncorporated
72
+ ? (0, date_fns_1.format)(new Date(data.dateIncorporated), DATE_FORMAT)
73
+ : "",
74
+ state_of_incorporation: data.stateOfIncorporation || "",
75
+ name_change_checkbox: data.changedName ? constants_1.CHECKED_IMAGE : "",
76
+ address_change_checkbox: data.changedAddress ? constants_1.CHECKED_IMAGE : "",
77
+ election_effective_date: data.electionEffectiveDate
78
+ ? (0, date_fns_1.format)(new Date(data.electionEffectiveDate), DATE_FORMAT)
79
+ : "",
80
+ calendar_year_checkbox: data.selectedTaxYear === form_dto_1.TaxYearType.CALENDAR_YEAR ? constants_1.CHECKED_IMAGE : "",
81
+ fiscal_year_checkbox: data.selectedTaxYear === form_dto_1.TaxYearType.FISCAL_YEAR ? constants_1.CHECKED_IMAGE : "",
82
+ week_52_53_december_checkbox: data.selectedTaxYear === form_dto_1.TaxYearType.WEEK_52_53_DECEMBER
83
+ ? constants_1.CHECKED_IMAGE
84
+ : "",
85
+ week_52_53_other_checkbox: data.selectedTaxYear === form_dto_1.TaxYearType.WEEK_52_53_OTHER
86
+ ? constants_1.CHECKED_IMAGE
87
+ : "",
88
+ fiscal_year_end_date: data.fiscalYearEndDate || "",
89
+ week_ending_month: data.weekEndingMonth || "",
90
+ more_than_100_shareholders_checkbox: data.moreThan100ShareholdersFamilyTreated ? constants_1.CHECKED_IMAGE : "",
91
+ officer_name_title: `${data.officerName || ""} - ${data.officerTitle || ""}`
92
+ .replace(" - ", " - ")
93
+ .trim(),
94
+ officer_phone: data.officerPhoneNumber || "",
95
+ ...(data.isLateElection && {
96
+ late_election_title_page: "Filed Pursuant to Rev Proc 2013-30",
97
+ late_election_explanation_line_1: `The corporation intended to be classified as an S corporation effective ${data.electionEffectiveDate
98
+ ? (0, date_fns_1.format)(new Date(data.electionEffectiveDate), DATE_FORMAT)
99
+ : "01/01/2025"} but failed to timely file Form 2553`,
100
+ late_election_explanation_line_2: "due to reasonable cause. Specifically, the responsible party was unaware of the IRS filing deadline required to make the election.",
101
+ late_election_explanation_line_3: "As soon as the mistake was identified, corrective action was taken to file Form 2553.",
102
+ late_election_explanation_line_4: "We respectfully request relief under Revenue Procedure 2013-30.",
103
+ }),
104
+ officer_title: data.officerTitle || "",
105
+ };
106
+ const page2 = {
107
+ corporation_name_page2: data.corporationName || "",
108
+ employer_id_number_page2: data.employerIdNumber || "",
109
+ };
110
+ if (data.shareholders && data.shareholders.length > 0) {
111
+ data.shareholders
112
+ .slice(0, 4)
113
+ .forEach((shareholder, index) => {
114
+ const shareholderPrefix = `shareholder_${index + 1}`;
115
+ page2[`${shareholderPrefix}_name`] = shareholder.name || "";
116
+ const shareholderAddress = [
117
+ shareholder.address.address_line_1,
118
+ shareholder.address.address_line_2,
119
+ `${shareholder.address.city || ""}, ${shareholder.address.state || ""} ${shareholder.address.postal_code || ""}`,
120
+ shareholder.address.country &&
121
+ shareholder.address.country !== "United States" &&
122
+ shareholder.address.country !== "US"
123
+ ? shareholder.address.country
124
+ : "",
125
+ ]
126
+ .filter(Boolean)
127
+ .join("\n");
128
+ page2[`${shareholderPrefix}_address`] = shareholderAddress;
129
+ page2[`${shareholderPrefix}_shares`] =
130
+ shareholder.numberOfShares?.toString() || "";
131
+ page2[`${shareholderPrefix}_percentage`] =
132
+ shareholder.percentageOwnership?.toString() || "";
133
+ page2[`${shareholderPrefix}_date_acquired`] = shareholder.dateAcquired
134
+ ? (0, date_fns_1.format)(new Date(shareholder.dateAcquired), DATE_FORMAT)
135
+ : "";
136
+ page2[`${shareholderPrefix}_tax_id`] = shareholder.taxIdNumber || "";
137
+ page2[`${shareholderPrefix}_tax_year_end`] =
138
+ shareholder.taxYearEnd || "";
139
+ });
140
+ }
141
+ const page3 = {
142
+ corporation_name_page3: data.corporationName || "",
143
+ employer_id_number_page3: data.employerIdNumber || "",
144
+ };
145
+ const page4 = {
146
+ corporation_name_page4: data.corporationName || "",
147
+ employer_id_number_page4: data.employerIdNumber || "",
148
+ };
149
+ return [{ ...page1, ...page2, ...page3, ...page4 }];
150
+ };
151
+ exports.form2553Coordinates = form2553Coordinates;
152
+ let pdfBufferInstance;
153
+ const getPDFInstance = async () => {
154
+ if (!pdfBufferInstance) {
155
+ pdfBufferInstance = await readFilePromise((0, path_1.resolve)(__dirname, "./template.pdf"));
156
+ }
157
+ return pdfBufferInstance;
158
+ };
159
+ const validateForm2553Data = (data) => {
160
+ if (data.employerIdNumber !== "Applied for" &&
161
+ !/^\d{2}-\d{7}$/.test(data.employerIdNumber)) {
162
+ throw new Error("Invalid EIN format. Must be XX-XXXXXXX or 'Applied for'");
163
+ }
164
+ if (data.dateIncorporated && data.formFilingDate) {
165
+ const incorporation = new Date(data.dateIncorporated);
166
+ const filing = new Date(data.formFilingDate);
167
+ const daysDifference = Math.floor((filing.getTime() - incorporation.getTime()) / (1000 * 60 * 60 * 24));
168
+ if (daysDifference > 75 && !data.isLateElection) {
169
+ console.warn("Form 2553 may be filed late. Consider checking late election option and providing explanation.");
170
+ }
171
+ }
172
+ if (data.shareholders.length > 0) {
173
+ const totalPercentage = data.shareholders.reduce((sum, shareholder) => {
174
+ return sum + (shareholder.percentageOwnership || 0);
175
+ }, 0);
176
+ if (Math.abs(totalPercentage - 100) > 0.01) {
177
+ console.warn(`Shareholder ownership percentages total ${totalPercentage}%, should equal 100%`);
178
+ }
179
+ }
180
+ if (data.shareholders.length > 4) {
181
+ console.warn("Only first 4 shareholders will be included in the PDF");
182
+ }
183
+ if (data.shareholders.length > 100) {
184
+ throw new Error("S-Corporation cannot have more than 100 shareholders");
185
+ }
186
+ if (!data.corporationName) {
187
+ throw new Error("Corporation name is required");
188
+ }
189
+ if (!data.employerIdNumber) {
190
+ throw new Error("Employer ID number is required");
191
+ }
192
+ if (!data.dateIncorporated) {
193
+ throw new Error("Date incorporated is required");
194
+ }
195
+ if (!data.stateOfIncorporation) {
196
+ throw new Error("State of incorporation is required");
197
+ }
198
+ if (!data.electionEffectiveDate) {
199
+ throw new Error("Election effective date is required");
200
+ }
201
+ if (!data.officerName) {
202
+ throw new Error("Officer name is required");
203
+ }
204
+ if (!data.officerTitle) {
205
+ throw new Error("Officer title is required");
206
+ }
207
+ if (!data.officerPhoneNumber) {
208
+ throw new Error("Officer phone number is required");
209
+ }
210
+ if (!data.shareholders || data.shareholders.length === 0) {
211
+ throw new Error("At least one shareholder is required");
212
+ }
213
+ };
214
+ exports.validateForm2553Data = validateForm2553Data;
215
+ const form2553 = async (data) => {
216
+ validateForm2553Data(data);
217
+ const pdfBuffer = await getPDFInstance();
218
+ const template = {
219
+ basePdf: (0, buffer_1.toArrayBuffer)(pdfBuffer),
220
+ schemas: schema_json_1.default,
221
+ };
222
+ const plugins = {
223
+ Text: text_1.default,
224
+ Image: image_1.default,
225
+ };
226
+ const inputs = form2553Coordinates(data);
227
+ return (0, generator_1.generate)({ template, inputs, plugins }).then((pdf) => {
228
+ return (0, buffer_1.toBuffer)(pdf);
229
+ });
230
+ };
231
+ exports.form2553 = form2553;
232
+ const generateForm2553WithValidation = async (data, options = {}) => {
233
+ try {
234
+ const maxShareholdersPerPage = options.maxShareholdersPerPage || 4;
235
+ if (!options.skipSignatureValidation) {
236
+ validateForm2553Data(data);
237
+ }
238
+ if (!options.skipOwnershipValidation) {
239
+ const totalPercentage = data.shareholders.reduce((sum, shareholder) => {
240
+ return sum + (shareholder.percentageOwnership || 0);
241
+ }, 0);
242
+ if (Math.abs(totalPercentage - 100) > 0.01) {
243
+ throw new Error(`Shareholder ownership percentages must total 100%, currently ${totalPercentage}%`);
244
+ }
245
+ }
246
+ if (data.shareholders.length > maxShareholdersPerPage) {
247
+ console.warn(`Only first ${maxShareholdersPerPage} shareholders will be included in the PDF`);
248
+ }
249
+ const pdfBuffer = await (0, exports.form2553)(data);
250
+ return pdfBuffer;
251
+ }
252
+ catch (error) {
253
+ console.error("Error generating Form 2553:", error);
254
+ throw error;
255
+ }
256
+ };
257
+ exports.generateForm2553WithValidation = generateForm2553WithValidation;
258
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/create/pdf/united-states/form-2553/index.ts"],"names":[],"mappings":";;;;;;AACA,2BAA8B;AAC9B,+BAAiC;AACjC,+BAA+B;AAC/B,uCAAkC;AAGlC,0DAAsD;AACtD,yEAAuD;AACvD,oFAAkE;AAClE,8CAA4D;AAC5D,4CAA6C;AAC7C,gEAA2C;AAC3C,yCAA0E;AAE1E,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,aAAQ,CAAC,CAAC;AAE5C,MAAM,WAAW,GAAG,YAAY,CAAC;AAIjC,MAAM,aAAa,GAAG,CACpB,YAAoB,EACpB,YAAqB,EACrB,IAAa,EACb,KAAc,EACd,UAAmB,EACnB,OAAgB,EACR,EAAE;IACV,MAAM,KAAK,GAAG;QACZ,YAAY;QACZ,YAAY;QACZ,IAAI,IAAI,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,KAAK,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;QACpE,OAAO,IAAI,OAAO,KAAK,eAAe,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;KAC1E,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAElB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC,CAAC;AA4XA,sCAAa;AAvXf,MAAM,iBAAiB,GAAG,CACxB,YAAoB,EAC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