@rinse-dental/open-dental 1.2.0 → 1.4.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,66 @@
1
+ /**
2
+ * Represents a ClaimProc in the Open Dental system.
3
+ * @see https://www.opendental.com/site/apiclaimprocs.html
4
+ */
5
+ export interface ClaimProc {
6
+ ClaimProcNum?: number;
7
+ ProcNum?: number;
8
+ ClaimNum?: number;
9
+ PatNum?: number;
10
+ ProvNum?: number;
11
+ FeeBilled?: number;
12
+ InsPayEst?: number;
13
+ DedApplied?: number;
14
+ Status?: "NotReceived" | "Received" | "Preauth" | "Adjustment" | "Supplemental" | "CapClaim" | "Estimate" | "CapComplete" | "CapEstimate" | "InsHist";
15
+ InsPayAmt?: number;
16
+ Remarks?: string;
17
+ ClaimPaymentNum?: number;
18
+ PlanNum?: number;
19
+ DateCP?: string;
20
+ WriteOff?: number;
21
+ CodeSent?: string;
22
+ AllowedOverride?: number;
23
+ Percentage?: number;
24
+ PercentOverride?: number;
25
+ CopayAmt?: number;
26
+ NoBillIns?: true | false;
27
+ PaidOtherIns?: number;
28
+ BaseEst?: number;
29
+ CopayOverride?: number;
30
+ ProcDate?: string;
31
+ DateEntry?: string;
32
+ DedEst?: number;
33
+ DedEstOverride?: number;
34
+ InsEstTotal?: number;
35
+ InsEstTotalOverride?: number;
36
+ PaidOtherInsOverride?: number;
37
+ EstimateNote?: string;
38
+ WriteOffEst?: number;
39
+ WriteOffEstOverride?: number;
40
+ ClinicNum?: number;
41
+ InsSubNum?: number;
42
+ PaymentRow?: number;
43
+ PayPlanNum?: number;
44
+ ClaimPaymentTracking?: number;
45
+ claimPaymentTracking?: string;
46
+ SecUserNumEntry?: number;
47
+ SecDateEntry?: string;
48
+ SecDateTEdit?: string;
49
+ DateSuppReceived?: string;
50
+ DateInsFinalized?: string;
51
+ IsTransfer?: "true" | "false";
52
+ ClaimAdjReasonCodes?: string;
53
+ }
54
+ /**
55
+ * Gets all ClaimProcs based on provided parameters. If no parameter is given, it will get all ClaimProcs ordered by ClaimProcNum.
56
+ * @see https://www.opendental.com/site/apiclaimprocs.html
57
+ */
58
+ export interface GetClaimProcsParams {
59
+ ProcNum?: number;
60
+ ClaimNum?: number;
61
+ PatNum?: number;
62
+ Status?: "NotReceived" | "Received" | "Preauth" | "Adjustment" | "Supplemental" | "CapClaim" | "Estimate" | "CapComplete" | "CapEstimate" | "InsHist";
63
+ ClaimPaymentNum?: number;
64
+ Offset?: number;
65
+ }
66
+ //# sourceMappingURL=claimProcTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claimProcTypes.d.ts","sourceRoot":"","sources":["../../src/types/claimProcTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;IACtJ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,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,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;IACtJ,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @see https://www.opendental.com/site/apiinsplans.html
3
+ */
4
+ export interface InsPlan {
5
+ PlanNum?: number;
6
+ GroupName?: string;
7
+ GroupNum?: string;
8
+ PlanNote?: string;
9
+ FeeSched?: number;
10
+ PlanType?: "" | "p" | "f" | "c";
11
+ ClaimFormNum?: number;
12
+ CopayFeeSched?: number;
13
+ EmployerNum?: number;
14
+ CarrierNum?: number;
15
+ CodeSubstNone?: "true" | "false";
16
+ IsHidden?: "true" | "false";
17
+ MonthRenew?: number;
18
+ SecUserNumEntry?: number;
19
+ SecDateEntry?: string;
20
+ SecDateTEdit?: string;
21
+ IsBlueBookEnabled?: "true" | "false";
22
+ }
23
+ /**
24
+ * Gets a list of PatPlans that meet a set of search criteria.
25
+ * @see https://www.opendental.com/site/apiinsplans.html
26
+ */
27
+ export interface GetInsPlansParams {
28
+ PlanType?: "percentage" | "p" | "f" | "c";
29
+ CarrierNum?: number;
30
+ Offset?: number;
31
+ }
32
+ /**
33
+ * Parameters for creating a new insplan.
34
+ * @see https://www.opendental.com/site/apiinsplans.html
35
+ */
36
+ export interface CreateInsPlanParams {
37
+ CarrierNum: number;
38
+ GroupName?: string;
39
+ GroupNum?: string;
40
+ PlanNote?: string;
41
+ FeeSched?: number;
42
+ PlanType?: "" | "p" | "f" | "c";
43
+ CopayFeeSched?: number;
44
+ EmployerNum?: number;
45
+ CodeSubstNone?: "true" | "false";
46
+ IsHidden?: "true" | "false";
47
+ MonthRenew?: number;
48
+ IsBlueBookEnabled?: "true" | "false";
49
+ }
50
+ /**
51
+ * Parameters to update an insplan.
52
+ * @see https://www.opendental.com/site/apiinsplans.html
53
+ */
54
+ export interface UpdateInsPlanParams {
55
+ PlanNum: number;
56
+ GroupName?: string;
57
+ GroupNum?: string;
58
+ PlanNote?: string;
59
+ FeeSched?: number;
60
+ PlanType?: "" | "p" | "f" | "c";
61
+ CopayFeeSched?: number;
62
+ EmployerNum?: number;
63
+ CarrierNum: number;
64
+ CodeSubstNone?: "true" | "false";
65
+ IsHidden?: "true" | "false";
66
+ MonthRenew?: number;
67
+ IsBlueBookEnabled?: "true" | "false";
68
+ }
69
+ //# sourceMappingURL=insPlanTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insPlanTypes.d.ts","sourceRoot":"","sources":["../../src/types/insPlanTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,OAAO;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;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nB,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rinse-dental/open-dental",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "A TypeScript library for easily accessing Open Dental APIs.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/release.sh CHANGED
@@ -41,5 +41,5 @@ gh release create "$NEW_TAG" --title "Release $NEW_TAG" --notes "$COMMIT_MSG"
41
41
 
42
42
 
43
43
  #example ./release.sh "Some commit message" patch
44
- #example ./release.sh "Some commit message" minor
44
+ #example ./release.sh "Added insplans and benefits" minor
45
45
  #example ./release.sh "Some commit message" major
@@ -0,0 +1,155 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ Benefit,
4
+ GetBenefitsParams,
5
+ CreateBenefitParams,
6
+ UpdateBenefitParams,
7
+ } from "../types/benefitTypes";
8
+
9
+ export default class Benefits {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Fetch multiple benefits with optional filtering and pagination.
18
+ * @param {Object} params - The parameters for filtering and pagination.
19
+ * @param {number} [params.PlanNum] - FK to InsPlan.PlanNum.
20
+ * @param {number} [params.PatPlanNum] - FK to PatPlan.PatPlanNum.
21
+ * @param {number} [params.Offset] - Pagination offset for results.
22
+ * @returns {Promise<Benefit[]>} - A list of benefits.
23
+ */
24
+ public async getBenefits({
25
+ PlanNum,
26
+ PatPlanNum,
27
+ Offset,
28
+ }: GetBenefitsParams = {}): Promise<Benefit[]> {
29
+ const params = {
30
+ PlanNum,
31
+ PatPlanNum,
32
+ Offset,
33
+ };
34
+
35
+ return this.httpClient.get<Benefit[]>("/benefits", params);
36
+ }
37
+
38
+ /**
39
+ * This adds a Benefit row to the database.
40
+ * @param {Object} data - The details of the Benefit to create.
41
+ * @param {number} data.PlanNum - This or PatPlanNum is required. FK to InsPlan.PlanNum.
42
+ * @param {number} data.PatPlanNum - This or PlanNum is required. FK to PatPlan.PlanNum.
43
+ * @param {"ActiveCoverage" | "CoInsurance" | "Deductible" | "CoPayment" | "Exclusions" | "Limitations" | "WaitingPeriod"} data.BenefitType - Required. Either "ActiveCoverage", "CoInsurance", "Deductible", "CoPayment", "Exclusions", "Limitations", or "WaitingPeriod".
44
+ * @param {"None" | "Individual" | "Family"} data.CoverageLevel - Required. Either "None", "Individual", or "Family".
45
+ * @param {number} [data.CovCatNum] - Optional. FK to covcat.CovCatNum.
46
+ * @param {number} [data.Percent] - Optional. Only allowed if BenefitType is "CoInsurance". Must be a value between 0 and 100. Default -1 (Indicating empty).
47
+ * @param {number} [data.MonetaryAmt] - Optional. Only used if BenefitType is "CoPayment", "Limitations", or "Deductible". Default -1.0 (Indicating empty).
48
+ * @param {"None" | "ServiceYear" | "CalendarYear" | "Lifetime" | "Years" | "NumberInLast12Months"} [data.TimePeriod] - Optional. Either "None", "ServiceYear", "CalendarYear", "Lifetime", "Years", or "NumberInLast12Months". Default "CalendarYear".
49
+ * @param {"None" | "NumberOfServices" | "AgeLimit" | "Visits" | "Years" | "Months"} [data.QuantityQualifier] - Optional. Either "None", "NumberOfServices", "AgeLimit", "Visits", "Years", or "Months". Default "None". Must be "Months" or "Years" if BenefitType is "WaitingPeriod".
50
+ * @param {number} [data.Quantity] - Optional. Must be a value between 0 and 100. Default 0. Must be a value greater than 0 if QuantityQualifier is "AgeLimit".
51
+ * @param {number} [data.CodeNum] - Optional. FK to procedurecode.CodeNum. Only allowed if CovCatNum is 0. Will be used over procCode if both are specified. Default 0.
52
+ * @param {string} [data.procCode] - Optional. FK to procedurecode.ProcCode. Only allowed if CovCatNum is 0. Default empty string.
53
+ * @param {number} [data.CodeGroupNum] - Optional. (Added in version 23.2.62) FK to codegroup.CodeGroupNum. The group of procedure codes that apply to this Frequency Limitation benefit.
54
+ * @returns {Promise<Benefit>} - The created a benefit.
55
+ * @throws {Error} - If required fields are missing or the API returns an error.
56
+ */
57
+ public async createBenefit({
58
+ PlanNum,
59
+ PatPlanNum,
60
+ BenefitType,
61
+ CoverageLevel,
62
+ CovCatNum,
63
+ Percent,
64
+ MonetaryAmt,
65
+ TimePeriod,
66
+ QuantityQualifier,
67
+ Quantity,
68
+ CodeNum,
69
+ procCode,
70
+ CodeGroupNum,
71
+ } : CreateBenefitParams): Promise<Benefit> {
72
+ if (!BenefitType || !CoverageLevel) {
73
+ throw new Error("Invalid data: Either PlanNum or PatPlanNum and BenefitType and CoverageLevel are required.");
74
+ }
75
+
76
+ return this.httpClient.post<Benefit>("/benefits", {
77
+ PlanNum,
78
+ PatPlanNum,
79
+ BenefitType,
80
+ CoverageLevel,
81
+ CovCatNum,
82
+ Percent,
83
+ MonetaryAmt,
84
+ TimePeriod,
85
+ QuantityQualifier,
86
+ Quantity,
87
+ CodeNum,
88
+ procCode,
89
+ CodeGroupNum,
90
+ });
91
+ }
92
+
93
+ /**
94
+ * Update a Benefit.
95
+ * @param {Object} data - The details of Benefit to update.
96
+ * @param {number} data.BenefitNum - Required. PK
97
+ * @param {number} [data.CovCatNum] - Optional. FK to covcat.CovCatNum.
98
+ * @param {"ActiveCoverage" | "CoInsurance" | "Deductible" | "CoPayment" | "Exclusions" | "Limitations" | "WaitingPeriod"} [data.BenefitType] - Optional. Either "ActiveCoverage", "CoInsurance", "Deductible", "CoPayment", "Exclusions", "Limitations", or "WaitingPeriod".
99
+ * @param {number} [data.Percent] - Optional. Only allowed if BenefitType is "CoInsurance". Must be a value between 0 and 100. Default -1 (Indicating empty).
100
+ * @param {number} [data.MonetaryAmt] - Optional. Only used if BenefitType is "CoPayment", "Limitations", or "Deductible". Default -1.0 (Indicating empty).
101
+ * @param {"None" | "ServiceYear" | "CalendarYear" | "Lifetime" | "Years" | "NumberInLast12Months"} [data.TimePeriod] - Optional. Either "None", "ServiceYear", "CalendarYear", "Lifetime", "Years", or "NumberInLast12Months". Default "CalendarYear".
102
+ * @param {"None" | "NumberOfServices" | "AgeLimit" | "Visits" | "Years" | "Months"} [data.QuantityQualifier] - Optional. Either "None", "NumberOfServices", "AgeLimit", "Visits", "Years", or "Months". Default "None". Must be "Months" or "Years" if BenefitType is "WaitingPeriod".
103
+ * @param {number} [data.Quantity] - Optional. Must be a value between 0 and 100. Default 0. Must be a value greater than 0 if QuantityQualifier is "AgeLimit".
104
+ * @param {number} [data.CodeNum] - Optional. FK to procedurecode.CodeNum. Only allowed if CovCatNum is 0. Will be used over procCode if both are specified.
105
+ * @param {string} [data.procCode] - Optional. FK to procedurecode.ProcCode. Only allowed if CovCatNum is 0.
106
+ * @param {"None" | "Individual" | "Family"} [data.CoverageLevel] - Optional. Either "None", "Individual", or "Family".
107
+ * @returns {Promise<Benefit>} - The updated Benefit.
108
+ * @throws {Error} - If required fields are missing or the API returns an error.
109
+ */
110
+ public async updateBenefit({
111
+ BenefitNum,
112
+ CovCatNum,
113
+ BenefitType,
114
+ Percent,
115
+ MonetaryAmt,
116
+ TimePeriod,
117
+ QuantityQualifier,
118
+ Quantity,
119
+ CodeNum,
120
+ procCode,
121
+ CoverageLevel,
122
+ } : UpdateBenefitParams): Promise<Benefit> {
123
+ if (!BenefitNum || typeof BenefitNum !== "number") {
124
+ throw new Error("Invalid data: A Valid BenefitNum is required.");
125
+ }
126
+
127
+ return this.httpClient.put<Benefit>(`/benefits/${BenefitNum}`, {
128
+ CovCatNum,
129
+ BenefitType,
130
+ Percent,
131
+ MonetaryAmt,
132
+ TimePeriod,
133
+ QuantityQualifier,
134
+ Quantity,
135
+ CodeNum,
136
+ procCode,
137
+ CoverageLevel,
138
+ });
139
+ }
140
+
141
+ /**
142
+ * Delete a Benefit entry.
143
+ * This removes a Benefit row from the database.
144
+ * @param {number} BenefitNum - Required: The unique identifier of the Benefit to delete.
145
+ * @returns {Promise<void>} - Resolves when the Benefit is deleted.
146
+ * @throws {Error} - If `BenefitNum` is not valid or the API returns an error.
147
+ */
148
+ public async deletePatPlan(BenefitNum: number): Promise<void> {
149
+ if (!BenefitNum || typeof BenefitNum !== "number") {
150
+ throw new Error("Invalid parameter: BenefitNum must be a valid number.");
151
+ }
152
+
153
+ return this.httpClient.delete<void>(`/benefits/${BenefitNum}`);
154
+ }
155
+ }
@@ -0,0 +1,44 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ ClaimProc,
4
+ GetClaimProcsParams,
5
+ } from "../types/claimProcTypes";
6
+
7
+ export default class ClaimProcs {
8
+ private httpClient: HttpClient;
9
+
10
+ constructor(httpClient: HttpClient) {
11
+ this.httpClient = httpClient;
12
+ }
13
+
14
+ /**
15
+ * Fetch multiple ClaimProcs with optional filtering and pagination.
16
+ * @param {Object} params - The parameters for filtering and pagination.
17
+ * @param {number} [params.ProcNum] - FK to procedurelog.ProcNum.
18
+ * @param {number} [params.ClaimNum] - FK to claim.ClaimNum.
19
+ * @param {number} [params.PatNum] - FK to patient.PatNum.
20
+ * @param {"NotReceived" | "Received" | "Preauth" | "Adjustment" | "Supplemental" | "CapClaim" | "Estimate" | "CapComplete" | "CapEstimate" | "InsHist"} [params.Status] - Either "NotReceived", "Received", "Preauth", "Adjustment", "Supplemental", "CapClaim", "Estimate",
21
+ * @param {number} [params.ClaimPaymentNum] - FK to claimpayment.ClaimPaymentNum.
22
+ * @param {number} [params.Offset] - Pagination offset for results.
23
+ * @returns {Promise<ClaimProc[]>} - A list of ClaimProcs.
24
+ */
25
+ public async getClaimProcs({
26
+ ProcNum,
27
+ ClaimNum,
28
+ PatNum,
29
+ Status,
30
+ ClaimPaymentNum,
31
+ Offset,
32
+ }: GetClaimProcsParams = {}): Promise<ClaimProc[]> {
33
+ const params = {
34
+ ProcNum,
35
+ ClaimNum,
36
+ PatNum,
37
+ Status,
38
+ ClaimPaymentNum,
39
+ Offset,
40
+ };
41
+
42
+ return this.httpClient.get<ClaimProc[]>("/claimprocs", params);
43
+ }
44
+ }
@@ -0,0 +1,158 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ InsPlan,
4
+ GetInsPlansParams,
5
+ CreateInsPlanParams,
6
+ UpdateInsPlanParams,
7
+ } from "../types/insPlanTypes";
8
+
9
+ export default class InsPlans {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Fetch a single insplan by its ID.
18
+ * @param {number} PlanNum - The ID of the insplan.
19
+ * @returns {Promise<InsPlan>} - The insplan data.
20
+ * @throws {Error} - If `InsPlan` is not valid or the API returns an error.
21
+ */
22
+ public async getInsPlan(PlanNum: number): Promise<InsPlan> {
23
+ if (!PlanNum || typeof PlanNum !== "number") {
24
+ throw new Error("Invalid parameter: PlanNum must be a valid number.");
25
+ }
26
+
27
+ return await this.httpClient.get<InsPlan>(`/insplans/${PlanNum}`);
28
+ }
29
+
30
+
31
+ /**
32
+ * Fetch multiple insplans with optional filtering and pagination.
33
+ * @param {Object} params - The parameters for filtering and pagination.
34
+ * @param {"percentage" | "p" | "f" | "c" } [params.PlanType] - Must be one of the following: "percentage" (Percentage), "p" (PPO Percentage), "f" (Flat Copay), or "c" (Capitation). Percentage PlanTypes are stored as blank in the database.
35
+ * @param {number} [params.CarrierNum] - FK to carrier.CarrierNum.
36
+ * @param {number} [params.Offset] - Pagination offset for results.
37
+ * @returns {Promise<InsPlan[]>} - A list of InsPlans.
38
+ */
39
+ public async getInsPlans({
40
+ PlanType,
41
+ CarrierNum,
42
+ Offset,
43
+ }: GetInsPlansParams = {}): Promise<InsPlan[]> {
44
+ const params = {
45
+ PlanType,
46
+ CarrierNum,
47
+ Offset,
48
+ };
49
+
50
+ return this.httpClient.get<InsPlan[]>("/insplans", params);
51
+ }
52
+
53
+ /**
54
+ * This adds an InsPlan row to the database.
55
+ * @param {Object} data - The details of the insplan to create.
56
+ * @param {number} data.CarrierNum - Required. FK to carrier.CarrierNum.
57
+ * @param {string} [data.GroupName] - Optional. Typically the same as the employer. Used to identify difference in plans.
58
+ * @param {string} [data.GroupNum] - Optional. The carrier assigned identifier, unique for each plan.
59
+ * @param {string} [data.PlanNote] - Optional. Note for this plan. Same for all subscribers.
60
+ * @param {number} [data.FeeSched] - Optional. FK to feesched.FeeSchedNum. Default 0.
61
+ * @param {"" | "p" | "f" | "c"} [data.PlanType] - Optional. Either "" (Percentage), "p" (PPO Percentage), "f" (Flat Copay), or "c". Default is "" (Percentage).
62
+ * @param {number} [data.CopayFeeSched] - Optional. FK to feesched.FeeSchedNum when FeeSchedType is CoPay. Typically only used for capitation or copay plans. Default 0.
63
+ * @param {number} [data.EmployerNum] - Optional. FK to employer.EmployerNum. Default 0.
64
+ * @param {"true" | "false"} [data.CodeSubstNone] - Optional. Either "true" or "false". Set "true" if this Insurance Plan should ignore any Substitution Codes. Default "false".
65
+ * @param {"true" | "false"} [data.IsHidden] - ?: "true" | "false"; // Optional. Either "true" or "false". Default "false".
66
+ * @param {number} [data.MonthRenew] - Optional. The month, 1-12, when the insurance plan renews. It will renew on the first of the month. Default 0 to indicate calendar year.
67
+ * @param {"true" | "false"} [data.IsBlueBookEnabled] - Optional. Determines if the plan utilizes BlueBook or not. Cannot be set to true if PlanType is set to anything other than "" (Percentage). Defaults to true if AllowedFeeSchedsAutomate is set to BlueBook, otherwise defaults to false.
68
+ * @returns {Promise<InsPlan>} - The created insplan.
69
+ * @throws {Error} - If required fields are missing or the API returns an error.
70
+ */
71
+ public async createInsPlan({
72
+ CarrierNum,
73
+ GroupName,
74
+ GroupNum,
75
+ PlanNote,
76
+ FeeSched,
77
+ PlanType,
78
+ CopayFeeSched,
79
+ EmployerNum,
80
+ CodeSubstNone,
81
+ IsHidden,
82
+ MonthRenew,
83
+ IsBlueBookEnabled,
84
+ } : CreateInsPlanParams): Promise<InsPlan> {
85
+ if (!CarrierNum) {
86
+ throw new Error("Invalid data: CarrierNum is required.");
87
+ }
88
+
89
+ return this.httpClient.post<InsPlan>("/insplans", {
90
+ CarrierNum,
91
+ GroupName,
92
+ GroupNum,
93
+ PlanNote,
94
+ FeeSched,
95
+ PlanType,
96
+ CopayFeeSched,
97
+ EmployerNum,
98
+ CodeSubstNone,
99
+ IsHidden,
100
+ MonthRenew,
101
+ IsBlueBookEnabled,
102
+ });
103
+ }
104
+
105
+ /**
106
+ * Update a InsPlan.
107
+ * @param {Object} data - The details of InsPlan to update.
108
+ * @param {number} data.PlanNum - Required. Primary key.
109
+ * @param {string} [data.GroupName] - Optional. Typically the same as the employer. Used to identify difference in plans.
110
+ * @param {string} [data.GroupNum] - Optional. The carrier assigned identifier, unique for each plan.
111
+ * @param {string} [data.PlanNote] - Optional. Note for this plan. Same for all subscribers.
112
+ * @param {number} [data.FeeSched] - Optional. FK to feesched.FeeSchedNum. Default 0.
113
+ * @param {"" | "p" | "f" | "c"} [data.PlanType] - Optional. Either "" (Percentage), "p" (PPO Percentage), "f" (Flat Copay), or "c". Default is "" (Percentage).
114
+ * @param {number} [data.CopayFeeSched] - Optional. FK to feesched.FeeSchedNum when FeeSchedType is CoPay. Typically only used for capitation or copay plans. Default 0.
115
+ * @param {number} [data.EmployerNum] - Optional. FK to employer.EmployerNum. Default 0.
116
+ * @param {number} [data.CarrierNum] - Optional. FK to carrier.CarrierNum.
117
+ * @param {"true" | "false"} [data.CodeSubstNone] - Optional. Either "true" or "false". Set "true" if this Insurance Plan should ignore any Substitution Codes. Default "false".
118
+ * @param {"true" | "false"} [data.IsHidden] - ?: "true" | "false"; // Optional. Either "true" or "false". Default "false".
119
+ * @param {number} [data.MonthRenew] - Optional. The month, 1-12, when the insurance plan renews. It will renew on the first of the month. Default 0 to indicate calendar year.
120
+ * @param {"true" | "false"} [data.IsBlueBookEnabled] - Optional. Determines if the plan utilizes BlueBook or not. Cannot be set to true if PlanType is set to anything other than "" (Percentage). Defaults to true if AllowedFeeSchedsAutomate is set to BlueBook, otherwise defaults to false.
121
+ * @returns {Promise<InsPlan>} - The updated InsPlan.
122
+ * @throws {Error} - If required fields are missing or the API returns an error.
123
+ */
124
+ public async updateInsPlan({
125
+ PlanNum,
126
+ GroupName,
127
+ GroupNum,
128
+ PlanNote,
129
+ FeeSched,
130
+ PlanType,
131
+ CopayFeeSched,
132
+ EmployerNum,
133
+ CarrierNum,
134
+ CodeSubstNone,
135
+ IsHidden,
136
+ MonthRenew,
137
+ IsBlueBookEnabled,
138
+ } : UpdateInsPlanParams): Promise<InsPlan> {
139
+ if (!PlanNum || typeof PlanNum !== "number") {
140
+ throw new Error("Invalid data: A Valid PlanNum is required.");
141
+ }
142
+
143
+ return this.httpClient.put<InsPlan>(`/insplans/${PlanNum}`, {
144
+ GroupName,
145
+ GroupNum,
146
+ PlanNote,
147
+ FeeSched,
148
+ PlanType,
149
+ CopayFeeSched,
150
+ EmployerNum,
151
+ CarrierNum,
152
+ CodeSubstNone,
153
+ IsHidden,
154
+ MonthRenew,
155
+ IsBlueBookEnabled,
156
+ });
157
+ }
158
+ }
@@ -97,10 +97,10 @@ export default class PatPlans {
97
97
  }
98
98
 
99
99
  /**
100
- * Delete an PatPlan entry.
100
+ * Delete a PatPlan entry.
101
101
  * This is called "Drop" in the Open Dental UI. This removes a PatPlan row from the database, indicating no coverage, but does not affect the InsPlan itself.
102
102
  * @param {number} PatPlanNum - Required: The unique identifier of the inssub to delete.
103
- * @returns {Promise<void>} - Resolves when the discount plan sub is deleted.
103
+ * @returns {Promise<void>} - Resolves when the PatPlan is deleted.
104
104
  * @throws {Error} - If `PatPlanNum` is not valid or the API returns an error.
105
105
  */
106
106
  public async deletePatPlan(PatPlanNum: number): Promise<void> {
package/src/openDental.ts CHANGED
@@ -19,6 +19,9 @@ import PatPlans from "./api/patPlans";
19
19
  import LabCases from "./api/labCases";
20
20
  import Referrals from "./api/referrals";
21
21
  import RefAttaches from "./api/refAttaches";
22
+ import InsPlans from "./api/insPlans";
23
+ import Benefits from "./api/benefits";
24
+ import ClaimProcs from "./api/claimProcs";
22
25
 
23
26
  class OpenDental {
24
27
  private static httpClient: HttpClient;
@@ -229,7 +232,7 @@ class OpenDental {
229
232
  }
230
233
 
231
234
  /**
232
- * Create a new instance of the LabCases API.
235
+ * Create a new instance of the RefAttaches API.
233
236
  */
234
237
  public static RefAttaches() {
235
238
  if (!this.httpClient) {
@@ -237,6 +240,36 @@ class OpenDental {
237
240
  }
238
241
  return new RefAttaches(this.httpClient);
239
242
  }
243
+
244
+ /**
245
+ * Create a new instance of the InsPlans API.
246
+ */
247
+ public static InsPlans() {
248
+ if (!this.httpClient) {
249
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
250
+ }
251
+ return new InsPlans(this.httpClient);
252
+ }
253
+
254
+ /**
255
+ * Create a new instance of the Benefits API.
256
+ */
257
+ public static Benefits() {
258
+ if (!this.httpClient) {
259
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
260
+ }
261
+ return new Benefits(this.httpClient);
262
+ }
263
+
264
+ /**
265
+ * Create a new instance of the ClaimProcs API.
266
+ */
267
+ public static ClaimProcs() {
268
+ if (!this.httpClient) {
269
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
270
+ }
271
+ return new ClaimProcs(this.httpClient);
272
+ }
240
273
  }
241
274
 
242
275
  export { OpenDental };