@rinse-dental/open-dental 3.0.0 → 3.2.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,34 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import { Claim, GetClaimsParams, GetClaimByIdParams, CreateClaimParams, UpdateClaimParams } from "../types/claimTypes";
3
+ export default class Claims {
4
+ private httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ /**
7
+ * Fetch multiple claims with optional filtering.
8
+ * Mirrors GET /claims
9
+ * @see https://www.opendental.com/site/apiclaims.html
10
+ */
11
+ getClaims(params?: GetClaimsParams): Promise<Claim[]>;
12
+ /**
13
+ * Fetch a single claim by ClaimNum.
14
+ * Mirrors GET /claims/{ClaimNum}
15
+ */
16
+ getClaim({ ClaimNum }: GetClaimByIdParams): Promise<Claim>;
17
+ /**
18
+ * Create a new claim.
19
+ * Mirrors POST /claims
20
+ * Required:
21
+ * - PatNum
22
+ * - procNums (non-empty)
23
+ * - ClaimType
24
+ * If ClaimType is "PreAuth" or "Other", InsSubNum and PatRelat are required.
25
+ */
26
+ createClaim(data: CreateClaimParams): Promise<Claim>;
27
+ /**
28
+ * Update an existing claim by ClaimNum.
29
+ * Mirrors PUT /claims/{ClaimNum}
30
+ * All fields (except ClaimNum) are optional; send only what you intend to change.
31
+ */
32
+ updateClaim(data: UpdateClaimParams): Promise<Claim>;
33
+ }
34
+ //# sourceMappingURL=claims.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../../src/api/claims.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EAElB,MAAM,qBAAqB,CAAC;AAS7B,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;OAIG;IACU,SAAS,CAAC,MAAM,GAAE,eAAoB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IActE;;;OAGG;IACU,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;IAOvE;;;;;;;;OAQG;IACU,WAAW,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;IA2CjE;;;;OAIG;IACU,WAAW,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC;CA4DlE"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /** Utility to remove undefined fields from objects (for API payloads) */
4
+ const clean = (obj) => {
5
+ return Object.fromEntries(Object.entries(obj).filter(([_, v]) => v !== undefined));
6
+ };
7
+ class Claims {
8
+ httpClient;
9
+ constructor(httpClient) {
10
+ this.httpClient = httpClient;
11
+ }
12
+ /**
13
+ * Fetch multiple claims with optional filtering.
14
+ * Mirrors GET /claims
15
+ * @see https://www.opendental.com/site/apiclaims.html
16
+ */
17
+ async getClaims(params = {}) {
18
+ const query = clean({
19
+ PatNum: params.PatNum,
20
+ ClaimStatus: params.ClaimStatus,
21
+ ClaimType: params.ClaimType,
22
+ PlanNum: params.PlanNum,
23
+ PlanNum2: params.PlanNum2,
24
+ ClaimIdentifier: params.ClaimIdentifier,
25
+ SecDateTEdit: params.SecDateTEdit,
26
+ Offset: params.Offset,
27
+ });
28
+ return this.httpClient.get("/claims", query);
29
+ }
30
+ /**
31
+ * Fetch a single claim by ClaimNum.
32
+ * Mirrors GET /claims/{ClaimNum}
33
+ */
34
+ async getClaim({ ClaimNum }) {
35
+ if (!ClaimNum || typeof ClaimNum !== "number") {
36
+ throw new Error("Invalid parameter: ClaimNum must be a valid number.");
37
+ }
38
+ return this.httpClient.get(`/claims/${ClaimNum}`);
39
+ }
40
+ /**
41
+ * Create a new claim.
42
+ * Mirrors POST /claims
43
+ * Required:
44
+ * - PatNum
45
+ * - procNums (non-empty)
46
+ * - ClaimType
47
+ * If ClaimType is "PreAuth" or "Other", InsSubNum and PatRelat are required.
48
+ */
49
+ async createClaim(data) {
50
+ // Base validation common to all claim types
51
+ if (!data || typeof data !== "object") {
52
+ throw new Error("Invalid payload: createClaim requires a request body.");
53
+ }
54
+ if (!data.PatNum || typeof data.PatNum !== "number") {
55
+ throw new Error("Invalid payload: PatNum is required and must be a number.");
56
+ }
57
+ if (!Array.isArray(data.procNums) || data.procNums.length === 0) {
58
+ throw new Error("Invalid payload: procNums must be a non-empty number array.");
59
+ }
60
+ if (!("ClaimType" in data)) {
61
+ throw new Error("Invalid payload: ClaimType is required.");
62
+ }
63
+ // Type-specific validation
64
+ if (data.ClaimType === "PreAuth" || data.ClaimType === "Other") {
65
+ const requires = data.InsSubNum && data.PatRelat;
66
+ if (!requires) {
67
+ throw new Error(`Invalid payload: InsSubNum and PatRelat are required when ClaimType is "${data.ClaimType}".`);
68
+ }
69
+ // Optional small guard to keep PatRelat within the documented domain
70
+ const patRel = data.PatRelat;
71
+ const validRel = [
72
+ "Self", "Spouse", "Child", "Employee", "HandicapDep", "SignifOther",
73
+ "InjuredPlaintiff", "LifePartner", "Dependent",
74
+ ];
75
+ if (!validRel.includes(patRel)) {
76
+ throw new Error(`Invalid PatRelat value: ${patRel}`);
77
+ }
78
+ }
79
+ // Send cleaned payload
80
+ const payload = clean({
81
+ ...data,
82
+ });
83
+ return this.httpClient.post("/claims", payload);
84
+ }
85
+ /**
86
+ * Update an existing claim by ClaimNum.
87
+ * Mirrors PUT /claims/{ClaimNum}
88
+ * All fields (except ClaimNum) are optional; send only what you intend to change.
89
+ */
90
+ async updateClaim(data) {
91
+ if (!data?.ClaimNum || typeof data.ClaimNum !== "number") {
92
+ throw new Error("Invalid payload: ClaimNum is required and must be a number.");
93
+ }
94
+ const { ClaimNum, ClaimStatus, DateSent, DateReceived, ProvTreat, IsProsthesis, PriorDate, ClaimNote, ReasonUnderPaid, ProvBill, PlaceService, AccidentRelated, AccidentDate, AccidentST, IsOrtho, OrthoRemainM, OrthoDate, PatRelat, PatRelat2, ClaimForm, InsSubNum2, PriorAuthorizationNumber, MedType, OrthoTotalM, } = data;
95
+ const payload = clean({
96
+ ClaimStatus,
97
+ DateSent,
98
+ DateReceived,
99
+ ProvTreat,
100
+ IsProsthesis,
101
+ PriorDate,
102
+ ClaimNote,
103
+ ReasonUnderPaid,
104
+ ProvBill,
105
+ PlaceService,
106
+ AccidentRelated,
107
+ AccidentDate,
108
+ AccidentST,
109
+ IsOrtho,
110
+ OrthoRemainM,
111
+ OrthoDate,
112
+ PatRelat,
113
+ PatRelat2,
114
+ ClaimForm,
115
+ InsSubNum2,
116
+ PriorAuthorizationNumber,
117
+ MedType,
118
+ OrthoTotalM,
119
+ });
120
+ return this.httpClient.put(`/claims/${ClaimNum}`, payload);
121
+ }
122
+ }
123
+ exports.default = Claims;
@@ -0,0 +1,36 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import { InsVerify, GetInsVerifiesParams, UpdateInsVerifiesParams } from "../types/insVerifiesTypes";
3
+ export default class InsVerifies {
4
+ private httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ /**
7
+ * Fetch a single InsVerifies by its ID.
8
+ * @param {number} InsVerifyNum - The ID of the InsVerifies.
9
+ * @returns {Promise<InsVerify>} - The InsVerifies data.
10
+ * @throws {Error} - If `InsVerify` is not valid or the API returns an error.
11
+ */
12
+ getInsVerify(InsVerifyNum: number): Promise<InsVerify>;
13
+ /**
14
+ * Fetch multiple InsVerifies with optional filtering and pagination.
15
+ * @param {Object} params - The parameters for filtering and pagination.
16
+ * @param {"PatientEnrollment" | "InsuranceBenefit" } [params.VerifyType] - Required if FKey is specified. Either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
17
+ * @param {number} [params.FKey] - (Added in version 24.4.17) FK to patplan.PatPlanNum or FK to insplan.PlanNum depending on the VerifyType.
18
+ * @param {number} [params.SecDateTEdit] - Only include InsVerifies with a SecDateTEdit altered after the specified date and time. String in "yyyy-MM-dd HH:mm:ss" format.
19
+ * @param {number} [params.Offset] - Pagination offset for results.
20
+ * @returns {Promise<InsVerify[]>} - A list of InsVerifies.
21
+ */
22
+ getInsVerifies({ VerifyType, FKey, SecDateTEdit, Offset, }?: GetInsVerifiesParams): Promise<InsVerify[]>;
23
+ /**
24
+ * This adds an InsVerify row to the database.
25
+ * @param {Object} data - The details of the InsVerify to create.
26
+ * @param {string} [data.DateLastVerified] - (Optional after version 24.1.17) String in "yyyy-MM-dd" format.
27
+ * @param {"PatientEnrollment" | "InsuranceBenefit" } data.VerifyType - Required. Can be either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
28
+ * @param {number} data.FKey - Required. If "PatientEnrollment" was passed in for VerifyType, then FKey must be a valid patplan.PatPlanNum. If "InsuranceBenefit" was passed in for VerifyType, FKey must be a valid insplan.PlanNum.
29
+ * @param {number} [data.DefNum] - Optional. Must be a valid DefNum where definition.Category=38.
30
+ * @param {"string"} [data.Note] - (Added in version 24.1.17) Optional. Status note for this insurance verification.
31
+ * @returns {Promise<InsVerify>} - The created InsVerify.
32
+ * @throws {Error} - If required fields are missing or the API returns an error.
33
+ */
34
+ createInsVerifies({ DateLastVerified, VerifyType, FKey, DefNum, Note, }: UpdateInsVerifiesParams): Promise<InsVerify>;
35
+ }
36
+ //# sourceMappingURL=insVerifies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insVerifies.d.ts","sourceRoot":"","sources":["../../src/api/insVerifies.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;OAKG;IACU,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IASnE;;;;;;;;QAQI;IACS,cAAc,CAAC,EAC1B,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,MAAM,GACP,GAAE,oBAAyB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAWnD;;;;;;;;;;OAUG;IACU,iBAAiB,CAAC,EAC7B,gBAAgB,EAChB,UAAU,EACV,IAAI,EACJ,MAAM,EACN,IAAI,GACL,EAAG,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC;CAajD"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class InsVerifies {
4
+ httpClient;
5
+ constructor(httpClient) {
6
+ this.httpClient = httpClient;
7
+ }
8
+ /**
9
+ * Fetch a single InsVerifies by its ID.
10
+ * @param {number} InsVerifyNum - The ID of the InsVerifies.
11
+ * @returns {Promise<InsVerify>} - The InsVerifies data.
12
+ * @throws {Error} - If `InsVerify` is not valid or the API returns an error.
13
+ */
14
+ async getInsVerify(InsVerifyNum) {
15
+ if (!InsVerifyNum || typeof InsVerifyNum !== "number") {
16
+ throw new Error("Invalid parameter: InsVerifyNum must be a valid number.");
17
+ }
18
+ return await this.httpClient.get(`/insverifies/${InsVerifyNum}`);
19
+ }
20
+ /**
21
+ * Fetch multiple InsVerifies with optional filtering and pagination.
22
+ * @param {Object} params - The parameters for filtering and pagination.
23
+ * @param {"PatientEnrollment" | "InsuranceBenefit" } [params.VerifyType] - Required if FKey is specified. Either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
24
+ * @param {number} [params.FKey] - (Added in version 24.4.17) FK to patplan.PatPlanNum or FK to insplan.PlanNum depending on the VerifyType.
25
+ * @param {number} [params.SecDateTEdit] - Only include InsVerifies with a SecDateTEdit altered after the specified date and time. String in "yyyy-MM-dd HH:mm:ss" format.
26
+ * @param {number} [params.Offset] - Pagination offset for results.
27
+ * @returns {Promise<InsVerify[]>} - A list of InsVerifies.
28
+ */
29
+ async getInsVerifies({ VerifyType, FKey, SecDateTEdit, Offset, } = {}) {
30
+ const params = {
31
+ VerifyType,
32
+ FKey,
33
+ SecDateTEdit,
34
+ Offset,
35
+ };
36
+ return this.httpClient.get("/insverifies", params);
37
+ }
38
+ /**
39
+ * This adds an InsVerify row to the database.
40
+ * @param {Object} data - The details of the InsVerify to create.
41
+ * @param {string} [data.DateLastVerified] - (Optional after version 24.1.17) String in "yyyy-MM-dd" format.
42
+ * @param {"PatientEnrollment" | "InsuranceBenefit" } data.VerifyType - Required. Can be either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
43
+ * @param {number} data.FKey - Required. If "PatientEnrollment" was passed in for VerifyType, then FKey must be a valid patplan.PatPlanNum. If "InsuranceBenefit" was passed in for VerifyType, FKey must be a valid insplan.PlanNum.
44
+ * @param {number} [data.DefNum] - Optional. Must be a valid DefNum where definition.Category=38.
45
+ * @param {"string"} [data.Note] - (Added in version 24.1.17) Optional. Status note for this insurance verification.
46
+ * @returns {Promise<InsVerify>} - The created InsVerify.
47
+ * @throws {Error} - If required fields are missing or the API returns an error.
48
+ */
49
+ async createInsVerifies({ DateLastVerified, VerifyType, FKey, DefNum, Note, }) {
50
+ if (!VerifyType || !FKey) {
51
+ throw new Error("Invalid data: VerifyType and FKey are required.");
52
+ }
53
+ return this.httpClient.put("/insverifies", {
54
+ DateLastVerified,
55
+ VerifyType,
56
+ FKey,
57
+ DefNum,
58
+ Note,
59
+ });
60
+ }
61
+ }
62
+ exports.default = InsVerifies;
@@ -23,6 +23,7 @@ import Referrals from "./api/referrals";
23
23
  import RefAttaches from "./api/refAttaches";
24
24
  import InsPlans from "./api/insPlans";
25
25
  import Benefits from "./api/benefits";
26
+ import Claims from "./api/claims";
26
27
  import ClaimProcs from "./api/claimProcs";
27
28
  import Adjustments from "./api/adjustments";
28
29
  import ProcedureCodes from "./api/procedureCodes";
@@ -36,6 +37,7 @@ import ProcNotes from "./api/procNotes";
36
37
  import Queries from "./api/queries";
37
38
  import SecurityLogs from "./api/securityLogs";
38
39
  import AppointmentTypes from "./api/appointmentTypes";
40
+ import InsVerifies from "./api/insVerifies";
39
41
  import * as Transformers from './transformers';
40
42
  declare class OpenDental {
41
43
  private static httpClient;
@@ -139,6 +141,10 @@ declare class OpenDental {
139
141
  * Create a new instance of the Benefits API.
140
142
  */
141
143
  static Benefits(): Benefits;
144
+ /**
145
+ * Create a new instance of the Claims API.
146
+ */
147
+ static Claims(): Claims;
142
148
  /**
143
149
  * Create a new instance of the ClaimProcs API.
144
150
  */
@@ -195,6 +201,10 @@ declare class OpenDental {
195
201
  * Create a new instance of the SecurityLogs API.
196
202
  */
197
203
  static AppointmentTypes(): AppointmentTypes;
204
+ /**
205
+ * Create a new instance of the InsVerifies API.
206
+ */
207
+ static InsVerifies(): InsVerifies;
198
208
  /**
199
209
  * Access stateless Transformers (no initialization needed)
200
210
  */
@@ -1 +1 @@
1
- {"version":3,"file":"openDental.d.ts","sourceRoot":"","sources":["../src/openDental.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,SAAS,MAAM,iBAAiB,CAAC;AACxC,OAAO,WAAW,MAAM,mBAAmB,CAAC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AEG;WACW,cAAc;IAO5B;;OAEG;WACW,OAAO;IAOrB;;OAEG;WACW,SAAS;IAOvB;;OAEG;WACW,OAAO;IAOrB;;OAEG;WACW,YAAY;IAO1B;;KAEC;WACa,gBAAgB;IAO9B;;KAEC;WACa,WAAW;IAOzB;;OAEG;WACW,YAAY;CAI3B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -63,6 +63,7 @@ const referrals_1 = __importDefault(require("./api/referrals"));
63
63
  const refAttaches_1 = __importDefault(require("./api/refAttaches"));
64
64
  const insPlans_1 = __importDefault(require("./api/insPlans"));
65
65
  const benefits_1 = __importDefault(require("./api/benefits"));
66
+ const claims_1 = __importDefault(require("./api/claims"));
66
67
  const claimProcs_1 = __importDefault(require("./api/claimProcs"));
67
68
  const adjustments_1 = __importDefault(require("./api/adjustments"));
68
69
  const procedureCodes_1 = __importDefault(require("./api/procedureCodes"));
@@ -76,6 +77,7 @@ const procNotes_1 = __importDefault(require("./api/procNotes"));
76
77
  const queries_1 = __importDefault(require("./api/queries"));
77
78
  const securityLogs_1 = __importDefault(require("./api/securityLogs"));
78
79
  const appointmentTypes_1 = __importDefault(require("./api/appointmentTypes"));
80
+ const insVerifies_1 = __importDefault(require("./api/insVerifies"));
79
81
  const Transformers = __importStar(require("./transformers"));
80
82
  class OpenDental {
81
83
  static httpClient;
@@ -306,6 +308,15 @@ class OpenDental {
306
308
  }
307
309
  return new benefits_1.default(this.httpClient);
308
310
  }
311
+ /**
312
+ * Create a new instance of the Claims API.
313
+ */
314
+ static Claims() {
315
+ if (!this.httpClient) {
316
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
317
+ }
318
+ return new claims_1.default(this.httpClient);
319
+ }
309
320
  /**
310
321
  * Create a new instance of the ClaimProcs API.
311
322
  */
@@ -432,6 +443,15 @@ class OpenDental {
432
443
  }
433
444
  return new appointmentTypes_1.default(this.httpClient);
434
445
  }
446
+ /**
447
+ * Create a new instance of the InsVerifies API.
448
+ */
449
+ static InsVerifies() {
450
+ if (!this.httpClient) {
451
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
452
+ }
453
+ return new insVerifies_1.default(this.httpClient);
454
+ }
435
455
  /**
436
456
  * Access stateless Transformers (no initialization needed)
437
457
  */
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Claim types for Open Dental REST API
3
+ * Spec refs:
4
+ * - https://www.opendental.com/site/apiclaims.html
5
+ * - "Claim Database Schema" (columns and domain values)
6
+ *
7
+ * Notes:
8
+ * - Dates are strings from the API (yyyy-MM-dd or yyyy-MM-dd HH:mm:ss).
9
+ * - Some fields reference Definitions or DB enums; where Open Dental allows
10
+ * broader values, we model them as string unions with known values or `string`.
11
+ */
12
+ /** One-letter claim status sent by the API. */
13
+ export type ClaimStatus = "U" | "H" | "W" | "S" | "R" | "I";
14
+ /** Claim type per API (includes PreAuth and Other). */
15
+ export type ClaimType = "P" | "S" | "PreAuth" | "Cap" | "Other";
16
+ /** Medical type per API. */
17
+ export type MedType = "Dental" | "Medical" | "Institutional";
18
+ /** AccidentRelated per API. */
19
+ export type AccidentRelated = "No" | "A" | "E" | "O" | "";
20
+ /**
21
+ * Place of service: API examples include "Office", "OtherLocation".
22
+ * Database schema supports additional values, so keep this open-ended.
23
+ */
24
+ export type PlaceService = "Office" | "OtherLocation" | string;
25
+ /** PatRelat per API. */
26
+ export type PatientRelationship = "Self" | "Spouse" | "Child" | "Employee" | "HandicapDep" | "SignifOther" | "InjuredPlaintiff" | "LifePartner" | "Dependent";
27
+ /**
28
+ * Represents a Claim returned by the Open Dental API.
29
+ * Mirrors the response payload of GET/POST/PUT endpoints.
30
+ */
31
+ export interface Claim {
32
+ ClaimNum: number;
33
+ PatNum: number;
34
+ DateService: string;
35
+ DateSent: string;
36
+ ClaimStatus: Exclude<ClaimStatus, "I">;
37
+ DateReceived: string;
38
+ PlanNum: number;
39
+ ProvTreat: number;
40
+ ClaimFee: number;
41
+ InsPayEst: number;
42
+ InsPayAmt: number;
43
+ DedApplied: number;
44
+ IsProsthesis: "N" | "I" | "R";
45
+ PriorDate: string;
46
+ ReasonUnderPaid: string;
47
+ ClaimNote: string;
48
+ ClaimType: ClaimType;
49
+ ProvBill: number;
50
+ PlaceService: PlaceService;
51
+ AccidentRelated: AccidentRelated;
52
+ AccidentDate: string;
53
+ AccidentST: string;
54
+ IsOrtho: "true" | "false";
55
+ OrthoRemainM: number;
56
+ OrthoDate: string;
57
+ PatRelat: PatientRelationship;
58
+ PlanNum2: number;
59
+ PatRelat2: PatientRelationship;
60
+ WriteOff: number;
61
+ ClaimForm: string;
62
+ InsSubNum: number;
63
+ InsSubNum2: number;
64
+ PriorAuthorizationNumber: string;
65
+ MedType: MedType;
66
+ CustomTracking: number;
67
+ customTracking: string;
68
+ CorrectionType: string;
69
+ ClaimIdentifier: string;
70
+ OrigRefNum: string;
71
+ OrthoTotalM: number;
72
+ ShareOfCost: number;
73
+ SecDateTEdit: string;
74
+ }
75
+ /** GET /claims (multiple) query params. */
76
+ export interface GetClaimsParams {
77
+ /** Optional after 23.3.11 */
78
+ PatNum?: number;
79
+ /**
80
+ * Added 23.3.11
81
+ * "U"=Unsent, "H"=Hold until pri received, "W"=Waiting in queue,
82
+ * "S"=Sent, "R"=Received, "I"=Hold for In Process
83
+ */
84
+ ClaimStatus?: ClaimStatus;
85
+ /** Added 25.3.41 */
86
+ ClaimType?: ClaimType;
87
+ /** Added 25.3.41 */
88
+ PlanNum?: number;
89
+ /** Added 25.3.41 - Other coverage plan */
90
+ PlanNum2?: number;
91
+ /** Added 25.3.41 - X12 CLM01 semi-unique identifier */
92
+ ClaimIdentifier?: string;
93
+ /**
94
+ * Added 23.3.11 - returns claims on/after this edit timestamp
95
+ * Format: "yyyy-MM-dd HH:mm:ss"
96
+ */
97
+ SecDateTEdit?: string;
98
+ /** Optional offset (if your client/SDK supports pagination). */
99
+ Offset?: number;
100
+ }
101
+ /** GET /claims/{ClaimNum} - path parameter only. */
102
+ export interface GetClaimByIdParams {
103
+ ClaimNum: number;
104
+ }
105
+ /**
106
+ * POST /claims body.
107
+ * - Required: PatNum, procNums[], ClaimType
108
+ * - If ClaimType is "PreAuth" or "Other", InsSubNum and PatRelat are required.
109
+ * - For "P"/"S", plan is implied by patient’s primary/secondary coverage.
110
+ */
111
+ export interface CreateClaimParamsBase {
112
+ PatNum: number;
113
+ procNums: number[];
114
+ DateService?: string;
115
+ DateSent?: string;
116
+ ClaimForm?: number;
117
+ ProvTreat?: number;
118
+ ProvBill?: number;
119
+ }
120
+ /** Primary claim. */
121
+ export interface CreatePrimaryClaimParams extends CreateClaimParamsBase {
122
+ ClaimType: "P";
123
+ }
124
+ /** Secondary claim. */
125
+ export interface CreateSecondaryClaimParams extends CreateClaimParamsBase {
126
+ ClaimType: "S";
127
+ }
128
+ /** Preauthorization claim. */
129
+ export interface CreatePreAuthClaimParams extends CreateClaimParamsBase {
130
+ ClaimType: "PreAuth";
131
+ InsSubNum: number;
132
+ PatRelat: PatientRelationship;
133
+ InsSubNum2?: number;
134
+ PatRelat2?: PatientRelationship;
135
+ }
136
+ /** Other claim (added 25.3.41). */
137
+ export interface CreateOtherClaimParams extends CreateClaimParamsBase {
138
+ ClaimType: "Other";
139
+ InsSubNum: number;
140
+ PatRelat: PatientRelationship;
141
+ InsSubNum2?: number;
142
+ PatRelat2?: PatientRelationship;
143
+ }
144
+ /** Union for POST body. */
145
+ export type CreateClaimParams = CreatePrimaryClaimParams | CreateSecondaryClaimParams | CreatePreAuthClaimParams | CreateOtherClaimParams;
146
+ /**
147
+ * PUT /claims/{ClaimNum}
148
+ * All fields optional; send only what you intend to change.
149
+ * API recalculates as Open Dental does; some fields constrained by claim state.
150
+ */
151
+ export interface UpdateClaimParams {
152
+ ClaimNum: number;
153
+ ClaimStatus?: Exclude<ClaimStatus, "I">;
154
+ DateSent?: string;
155
+ DateReceived?: string;
156
+ ProvTreat?: number;
157
+ IsProsthesis?: "N" | "I" | "R";
158
+ PriorDate?: string;
159
+ ClaimNote?: string;
160
+ ReasonUnderPaid?: string;
161
+ ProvBill?: number;
162
+ PlaceService?: PlaceService;
163
+ AccidentRelated?: AccidentRelated;
164
+ AccidentDate?: string;
165
+ AccidentST?: string;
166
+ IsOrtho?: "true" | "false";
167
+ OrthoRemainM?: number;
168
+ OrthoDate?: string;
169
+ PatRelat?: PatientRelationship;
170
+ PatRelat2?: PatientRelationship;
171
+ ClaimForm?: number | 0;
172
+ InsSubNum2?: number;
173
+ PriorAuthorizationNumber?: string;
174
+ MedType?: MedType;
175
+ OrthoTotalM?: number;
176
+ }
177
+ /** Minimal helper to detect "zero" dates in responses. */
178
+ export declare const isZeroDate: (d?: string | null) => boolean;
179
+ /** Narrow helper for timestamps that can be zeroed by the API. */
180
+ export declare const isZeroDateTime: (d?: string | null) => boolean;
181
+ /** Example runtime guard for ClaimStatus values. */
182
+ export declare const isClaimStatus: (s: string) => s is ClaimStatus;
183
+ /** Example runtime guard for ClaimType values. */
184
+ export declare const isClaimType: (t: string) => t is ClaimType;
185
+ //# sourceMappingURL=claimTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claimTypes.d.ts","sourceRoot":"","sources":["../../src/types/claimTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,WAAW,GACnB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAC;AAER,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;AAEhE,4BAA4B;AAC5B,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,eAAe,CAAC;AAE7D,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,eAAe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E,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,0DAA0D;AAC1D,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,GAAG,IAAI,KAAG,OACrB,CAAC;AAE3B,kEAAkE;AAClE,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,GAAG,IAAI,KAAG,OACjB,CAAC;AAEnC,oDAAoD;AACpD,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,WACH,CAAC;AAE7C,kDAAkD;AAClD,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,SACM,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * Claim types for Open Dental REST API
4
+ * Spec refs:
5
+ * - https://www.opendental.com/site/apiclaims.html
6
+ * - "Claim Database Schema" (columns and domain values)
7
+ *
8
+ * Notes:
9
+ * - Dates are strings from the API (yyyy-MM-dd or yyyy-MM-dd HH:mm:ss).
10
+ * - Some fields reference Definitions or DB enums; where Open Dental allows
11
+ * broader values, we model them as string unions with known values or `string`.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.isClaimType = exports.isClaimStatus = exports.isZeroDateTime = exports.isZeroDate = void 0;
15
+ /** Minimal helper to detect "zero" dates in responses. */
16
+ const isZeroDate = (d) => !d || d === "0001-01-01";
17
+ exports.isZeroDate = isZeroDate;
18
+ /** Narrow helper for timestamps that can be zeroed by the API. */
19
+ const isZeroDateTime = (d) => !d || d.startsWith("0001-01-01");
20
+ exports.isZeroDateTime = isZeroDateTime;
21
+ /** Example runtime guard for ClaimStatus values. */
22
+ const isClaimStatus = (s) => ["U", "H", "W", "S", "R", "I"].includes(s);
23
+ exports.isClaimStatus = isClaimStatus;
24
+ /** Example runtime guard for ClaimType values. */
25
+ const isClaimType = (t) => ["P", "S", "PreAuth", "Cap", "Other"].includes(t);
26
+ exports.isClaimType = isClaimType;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @see https://www.opendental.com/site/apiinsverifies.html
3
+ */
4
+ export interface InsVerify {
5
+ InsVerifyNum?: number;
6
+ DateLastVerified?: string;
7
+ UserNum?: number;
8
+ VerifyType?: string;
9
+ FKey?: number;
10
+ DefNum?: number;
11
+ Note?: string;
12
+ DateLastAssigned?: string;
13
+ SecDateTEdit?: string;
14
+ }
15
+ /**
16
+ * Gets insurance verifications.
17
+ * @see https://www.opendental.com/site/apiinsverifies.html
18
+ */
19
+ export interface GetInsVerifiesParams {
20
+ VerifyType?: string;
21
+ FKey?: number;
22
+ SecDateTEdit?: string;
23
+ Offset?: number;
24
+ }
25
+ /**
26
+ * Parameters to update an InsVerifies.
27
+ * @see https://www.opendental.com/site/apiinsverifies.html
28
+ */
29
+ export interface UpdateInsVerifiesParams {
30
+ DateLastVerified?: string;
31
+ VerifyType: string;
32
+ FKey: number;
33
+ DefNum?: number;
34
+ Note?: string;
35
+ }
36
+ //# sourceMappingURL=insVerifiesTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insVerifiesTypes.d.ts","sourceRoot":"","sources":["../../src/types/insVerifiesTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
@@ -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": "3.0.0",
3
+ "version": "3.2.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,7 +41,7 @@ gh release create "$NEW_TAG" --title "Release $NEW_TAG" --notes "$COMMIT_MSG"
41
41
 
42
42
 
43
43
  #example ./release.sh "updated axios error return" patch
44
- #example ./release.sh "Added procedure codes" minor
44
+ #example ./release.sh "Added InsVerifies" minor
45
45
  #example ./release.sh "Some commit message" major
46
46
 
47
47
  #./release.sh "Added readme" patch
@@ -0,0 +1,173 @@
1
+ // src/apis/Claims.ts
2
+ import HttpClient from "../utils/httpClient";
3
+ import {
4
+ Claim,
5
+ GetClaimsParams,
6
+ GetClaimByIdParams,
7
+ CreateClaimParams,
8
+ UpdateClaimParams,
9
+ PatientRelationship,
10
+ } from "../types/claimTypes";
11
+
12
+ /** Utility to remove undefined fields from objects (for API payloads) */
13
+ const clean = (obj: Record<string, any>): Record<string, any> => {
14
+ return Object.fromEntries(
15
+ Object.entries(obj).filter(([_, v]) => v !== undefined)
16
+ );
17
+ };
18
+
19
+ export default class Claims {
20
+ private httpClient: HttpClient;
21
+
22
+ constructor(httpClient: HttpClient) {
23
+ this.httpClient = httpClient;
24
+ }
25
+
26
+ /**
27
+ * Fetch multiple claims with optional filtering.
28
+ * Mirrors GET /claims
29
+ * @see https://www.opendental.com/site/apiclaims.html
30
+ */
31
+ public async getClaims(params: GetClaimsParams = {}): Promise<Claim[]> {
32
+ const query = clean({
33
+ PatNum: params.PatNum,
34
+ ClaimStatus: params.ClaimStatus,
35
+ ClaimType: params.ClaimType,
36
+ PlanNum: params.PlanNum,
37
+ PlanNum2: params.PlanNum2,
38
+ ClaimIdentifier: params.ClaimIdentifier,
39
+ SecDateTEdit: params.SecDateTEdit,
40
+ Offset: params.Offset,
41
+ });
42
+ return this.httpClient.get<Claim[]>("/claims", query);
43
+ }
44
+
45
+ /**
46
+ * Fetch a single claim by ClaimNum.
47
+ * Mirrors GET /claims/{ClaimNum}
48
+ */
49
+ public async getClaim({ ClaimNum }: GetClaimByIdParams): Promise<Claim> {
50
+ if (!ClaimNum || typeof ClaimNum !== "number") {
51
+ throw new Error("Invalid parameter: ClaimNum must be a valid number.");
52
+ }
53
+ return this.httpClient.get<Claim>(`/claims/${ClaimNum}`);
54
+ }
55
+
56
+ /**
57
+ * Create a new claim.
58
+ * Mirrors POST /claims
59
+ * Required:
60
+ * - PatNum
61
+ * - procNums (non-empty)
62
+ * - ClaimType
63
+ * If ClaimType is "PreAuth" or "Other", InsSubNum and PatRelat are required.
64
+ */
65
+ public async createClaim(data: CreateClaimParams): Promise<Claim> {
66
+ // Base validation common to all claim types
67
+ if (!data || typeof data !== "object") {
68
+ throw new Error("Invalid payload: createClaim requires a request body.");
69
+ }
70
+ if (!data.PatNum || typeof data.PatNum !== "number") {
71
+ throw new Error("Invalid payload: PatNum is required and must be a number.");
72
+ }
73
+ if (!Array.isArray(data.procNums) || data.procNums.length === 0) {
74
+ throw new Error("Invalid payload: procNums must be a non-empty number array.");
75
+ }
76
+ if (!("ClaimType" in data)) {
77
+ throw new Error("Invalid payload: ClaimType is required.");
78
+ }
79
+
80
+ // Type-specific validation
81
+ if (data.ClaimType === "PreAuth" || data.ClaimType === "Other") {
82
+ const requires =
83
+ (data as any).InsSubNum && (data as any).PatRelat;
84
+ if (!requires) {
85
+ throw new Error(
86
+ `Invalid payload: InsSubNum and PatRelat are required when ClaimType is "${data.ClaimType}".`
87
+ );
88
+ }
89
+ // Optional small guard to keep PatRelat within the documented domain
90
+ const patRel = (data as any).PatRelat as PatientRelationship;
91
+ const validRel: PatientRelationship[] = [
92
+ "Self","Spouse","Child","Employee","HandicapDep","SignifOther",
93
+ "InjuredPlaintiff","LifePartner","Dependent",
94
+ ];
95
+ if (!validRel.includes(patRel)) {
96
+ throw new Error(`Invalid PatRelat value: ${patRel}`);
97
+ }
98
+ }
99
+
100
+ // Send cleaned payload
101
+ const payload = clean({
102
+ ...data,
103
+ });
104
+
105
+ return this.httpClient.post<Claim>("/claims", payload);
106
+ }
107
+
108
+ /**
109
+ * Update an existing claim by ClaimNum.
110
+ * Mirrors PUT /claims/{ClaimNum}
111
+ * All fields (except ClaimNum) are optional; send only what you intend to change.
112
+ */
113
+ public async updateClaim(data: UpdateClaimParams): Promise<Claim> {
114
+ if (!data?.ClaimNum || typeof data.ClaimNum !== "number") {
115
+ throw new Error("Invalid payload: ClaimNum is required and must be a number.");
116
+ }
117
+
118
+ const {
119
+ ClaimNum,
120
+ ClaimStatus,
121
+ DateSent,
122
+ DateReceived,
123
+ ProvTreat,
124
+ IsProsthesis,
125
+ PriorDate,
126
+ ClaimNote,
127
+ ReasonUnderPaid,
128
+ ProvBill,
129
+ PlaceService,
130
+ AccidentRelated,
131
+ AccidentDate,
132
+ AccidentST,
133
+ IsOrtho,
134
+ OrthoRemainM,
135
+ OrthoDate,
136
+ PatRelat,
137
+ PatRelat2,
138
+ ClaimForm,
139
+ InsSubNum2,
140
+ PriorAuthorizationNumber,
141
+ MedType,
142
+ OrthoTotalM,
143
+ } = data;
144
+
145
+ const payload = clean({
146
+ ClaimStatus,
147
+ DateSent,
148
+ DateReceived,
149
+ ProvTreat,
150
+ IsProsthesis,
151
+ PriorDate,
152
+ ClaimNote,
153
+ ReasonUnderPaid,
154
+ ProvBill,
155
+ PlaceService,
156
+ AccidentRelated,
157
+ AccidentDate,
158
+ AccidentST,
159
+ IsOrtho,
160
+ OrthoRemainM,
161
+ OrthoDate,
162
+ PatRelat,
163
+ PatRelat2,
164
+ ClaimForm,
165
+ InsSubNum2,
166
+ PriorAuthorizationNumber,
167
+ MedType,
168
+ OrthoTotalM,
169
+ });
170
+
171
+ return this.httpClient.put<Claim>(`/claims/${ClaimNum}`, payload);
172
+ }
173
+ }
@@ -0,0 +1,85 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ InsVerify,
4
+ GetInsVerifiesParams,
5
+ UpdateInsVerifiesParams,
6
+ } from "../types/insVerifiesTypes";
7
+
8
+ export default class InsVerifies {
9
+ private httpClient: HttpClient;
10
+
11
+ constructor(httpClient: HttpClient) {
12
+ this.httpClient = httpClient;
13
+ }
14
+
15
+ /**
16
+ * Fetch a single InsVerifies by its ID.
17
+ * @param {number} InsVerifyNum - The ID of the InsVerifies.
18
+ * @returns {Promise<InsVerify>} - The InsVerifies data.
19
+ * @throws {Error} - If `InsVerify` is not valid or the API returns an error.
20
+ */
21
+ public async getInsVerify(InsVerifyNum: number): Promise<InsVerify> {
22
+ if (!InsVerifyNum || typeof InsVerifyNum !== "number") {
23
+ throw new Error("Invalid parameter: InsVerifyNum must be a valid number.");
24
+ }
25
+
26
+ return await this.httpClient.get<InsVerify>(`/insverifies/${InsVerifyNum}`);
27
+ }
28
+
29
+
30
+ /**
31
+ * Fetch multiple InsVerifies with optional filtering and pagination.
32
+ * @param {Object} params - The parameters for filtering and pagination.
33
+ * @param {"PatientEnrollment" | "InsuranceBenefit" } [params.VerifyType] - Required if FKey is specified. Either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
34
+ * @param {number} [params.FKey] - (Added in version 24.4.17) FK to patplan.PatPlanNum or FK to insplan.PlanNum depending on the VerifyType.
35
+ * @param {number} [params.SecDateTEdit] - Only include InsVerifies with a SecDateTEdit altered after the specified date and time. String in "yyyy-MM-dd HH:mm:ss" format.
36
+ * @param {number} [params.Offset] - Pagination offset for results.
37
+ * @returns {Promise<InsVerify[]>} - A list of InsVerifies.
38
+ */
39
+ public async getInsVerifies({
40
+ VerifyType,
41
+ FKey,
42
+ SecDateTEdit,
43
+ Offset,
44
+ }: GetInsVerifiesParams = {}): Promise<InsVerify[]> {
45
+ const params = {
46
+ VerifyType,
47
+ FKey,
48
+ SecDateTEdit,
49
+ Offset,
50
+ };
51
+
52
+ return this.httpClient.get<InsVerify[]>("/insverifies", params);
53
+ }
54
+
55
+ /**
56
+ * This adds an InsVerify row to the database.
57
+ * @param {Object} data - The details of the InsVerify to create.
58
+ * @param {string} [data.DateLastVerified] - (Optional after version 24.1.17) String in "yyyy-MM-dd" format.
59
+ * @param {"PatientEnrollment" | "InsuranceBenefit" } data.VerifyType - Required. Can be either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
60
+ * @param {number} data.FKey - Required. If "PatientEnrollment" was passed in for VerifyType, then FKey must be a valid patplan.PatPlanNum. If "InsuranceBenefit" was passed in for VerifyType, FKey must be a valid insplan.PlanNum.
61
+ * @param {number} [data.DefNum] - Optional. Must be a valid DefNum where definition.Category=38.
62
+ * @param {"string"} [data.Note] - (Added in version 24.1.17) Optional. Status note for this insurance verification.
63
+ * @returns {Promise<InsVerify>} - The created InsVerify.
64
+ * @throws {Error} - If required fields are missing or the API returns an error.
65
+ */
66
+ public async createInsVerifies({
67
+ DateLastVerified,
68
+ VerifyType,
69
+ FKey,
70
+ DefNum,
71
+ Note,
72
+ } : UpdateInsVerifiesParams): Promise<InsVerify> {
73
+ if (!VerifyType || !FKey) {
74
+ throw new Error("Invalid data: VerifyType and FKey are required.");
75
+ }
76
+
77
+ return this.httpClient.put<InsVerify>("/insverifies", {
78
+ DateLastVerified,
79
+ VerifyType,
80
+ FKey,
81
+ DefNum,
82
+ Note,
83
+ });
84
+ }
85
+ }
package/src/openDental.ts CHANGED
@@ -24,6 +24,7 @@ import Referrals from "./api/referrals";
24
24
  import RefAttaches from "./api/refAttaches";
25
25
  import InsPlans from "./api/insPlans";
26
26
  import Benefits from "./api/benefits";
27
+ import Claims from "./api/claims";
27
28
  import ClaimProcs from "./api/claimProcs";
28
29
  import Adjustments from "./api/adjustments";
29
30
  import ProcedureCodes from "./api/procedureCodes";
@@ -37,10 +38,10 @@ import ProcNotes from "./api/procNotes";
37
38
  import Queries from "./api/queries";
38
39
  import SecurityLogs from "./api/securityLogs";
39
40
  import AppointmentTypes from "./api/appointmentTypes";
41
+ import InsVerifies from "./api/insVerifies";
40
42
 
41
43
  import * as Transformers from './transformers';
42
44
 
43
-
44
45
  class OpenDental {
45
46
  private static httpClient: HttpClient;
46
47
 
@@ -299,6 +300,16 @@ class OpenDental {
299
300
  return new Benefits(this.httpClient);
300
301
  }
301
302
 
303
+ /**
304
+ * Create a new instance of the Claims API.
305
+ */
306
+ public static Claims() {
307
+ if (!this.httpClient) {
308
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
309
+ }
310
+ return new Claims(this.httpClient);
311
+ }
312
+
302
313
  /**
303
314
  * Create a new instance of the ClaimProcs API.
304
315
  */
@@ -439,6 +450,16 @@ class OpenDental {
439
450
  return new AppointmentTypes(this.httpClient);
440
451
  }
441
452
 
453
+ /**
454
+ * Create a new instance of the InsVerifies API.
455
+ */
456
+ public static InsVerifies() {
457
+ if (!this.httpClient) {
458
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
459
+ }
460
+ return new InsVerifies(this.httpClient);
461
+ }
462
+
442
463
  /**
443
464
  * Access stateless Transformers (no initialization needed)
444
465
  */
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Claim types for Open Dental REST API
3
+ * Spec refs:
4
+ * - https://www.opendental.com/site/apiclaims.html
5
+ * - "Claim Database Schema" (columns and domain values)
6
+ *
7
+ * Notes:
8
+ * - Dates are strings from the API (yyyy-MM-dd or yyyy-MM-dd HH:mm:ss).
9
+ * - Some fields reference Definitions or DB enums; where Open Dental allows
10
+ * broader values, we model them as string unions with known values or `string`.
11
+ */
12
+
13
+ /** One-letter claim status sent by the API. */
14
+ export type ClaimStatus =
15
+ | "U" // Unsent
16
+ | "H" // Hold until pri received
17
+ | "W" // Waiting in queue
18
+ | "S" // Sent
19
+ | "R" // Received
20
+ | "I"; // Hold for In Process (only available in GET multiple filter)
21
+
22
+ /** Claim type per API (includes PreAuth and Other). */
23
+ export type ClaimType = "P" | "S" | "PreAuth" | "Cap" | "Other";
24
+
25
+ /** Medical type per API. */
26
+ export type MedType = "Dental" | "Medical" | "Institutional";
27
+
28
+ /** AccidentRelated per API. */
29
+ export type AccidentRelated = "No" | "A" | "E" | "O" | "";
30
+
31
+ /**
32
+ * Place of service: API examples include "Office", "OtherLocation".
33
+ * Database schema supports additional values, so keep this open-ended.
34
+ */
35
+ export type PlaceService = "Office" | "OtherLocation" | string;
36
+
37
+ /** PatRelat per API. */
38
+ export type PatientRelationship =
39
+ | "Self"
40
+ | "Spouse"
41
+ | "Child"
42
+ | "Employee"
43
+ | "HandicapDep"
44
+ | "SignifOther"
45
+ | "InjuredPlaintiff"
46
+ | "LifePartner"
47
+ | "Dependent";
48
+
49
+ /**
50
+ * Represents a Claim returned by the Open Dental API.
51
+ * Mirrors the response payload of GET/POST/PUT endpoints.
52
+ */
53
+ export interface Claim {
54
+ ClaimNum: number; // PK
55
+ PatNum: number; // FK to patient.PatNum
56
+ DateService: string; // "yyyy-MM-dd" | "0001-01-01"
57
+ DateSent: string; // "yyyy-MM-dd" | "0001-01-01"
58
+ ClaimStatus: Exclude<ClaimStatus, "I">; // "U" | "H" | "W" | "S" | "R"
59
+ DateReceived: string; // "yyyy-MM-dd" | "0001-01-01"
60
+ PlanNum: number; // FK to insplan.PlanNum
61
+ ProvTreat: number; // FK to provider.ProvNum
62
+ ClaimFee: number; // Total fee on claim
63
+ InsPayEst: number; // Estimated insurance payment
64
+ InsPayAmt: number; // Actual insurance payment
65
+ DedApplied: number; // Deductible applied to claim
66
+ IsProsthesis: "N" | "I" | "R"; // No / Initial / Replacement
67
+ PriorDate: string; // "yyyy-MM-dd" | "0001-01-01"
68
+ ReasonUnderPaid: string; // Free text (patient statement note)
69
+ ClaimNote: string; // Note to insurance (claim-level)
70
+ ClaimType: ClaimType; // "P" | "S" | "PreAuth" | "Cap" | "Other"
71
+ ProvBill: number; // FK to provider.ProvNum (billing)
72
+ PlaceService: PlaceService; // Usually "Office"
73
+ AccidentRelated: AccidentRelated; // "", "No", "A", "E", "O"
74
+ AccidentDate: string; // "yyyy-MM-dd" | "0001-01-01"
75
+ AccidentST: string; // 2-char state or ""
76
+ IsOrtho: "true" | "false";
77
+ OrthoRemainM: number; // 0..36
78
+ OrthoDate: string; // "yyyy-MM-dd" | "0001-01-01"
79
+ PatRelat: PatientRelationship; // Relationship for primary plan
80
+ PlanNum2: number; // FK to insplan.PlanNum (other coverage)
81
+ PatRelat2: PatientRelationship; // Relationship for other coverage
82
+ WriteOff: number;
83
+ ClaimForm: string; // FK to claimform.ClaimFormNum as string
84
+ InsSubNum: number; // FK to inssub.InsSubNum (primary/selected)
85
+ InsSubNum2: number; // FK to inssub.InsSubNum (other coverage)
86
+ PriorAuthorizationNumber: string; // Rare; medical claims
87
+ MedType: MedType; // "Dental" | "Medical" | "Institutional"
88
+ CustomTracking: number; // DefNum (Definitions: Claim Custom Tracking)
89
+ customTracking: string; // Human-readable name for CustomTracking
90
+ CorrectionType: string; // Open Dental supports more; keep open
91
+ ClaimIdentifier: string; // Semi-unique per DB (e.g., "PatNum/ClaimNum")
92
+ OrigRefNum: string; // Original reference number if corrected
93
+ OrthoTotalM: number; // 0..36
94
+ ShareOfCost: number; // For specific payor scenarios
95
+ SecDateTEdit: string; // "yyyy-MM-dd HH:mm:ss"
96
+ }
97
+
98
+ /** GET /claims (multiple) query params. */
99
+ export interface GetClaimsParams {
100
+ /** Optional after 23.3.11 */
101
+ PatNum?: number;
102
+ /**
103
+ * Added 23.3.11
104
+ * "U"=Unsent, "H"=Hold until pri received, "W"=Waiting in queue,
105
+ * "S"=Sent, "R"=Received, "I"=Hold for In Process
106
+ */
107
+ ClaimStatus?: ClaimStatus;
108
+ /** Added 25.3.41 */
109
+ ClaimType?: ClaimType;
110
+ /** Added 25.3.41 */
111
+ PlanNum?: number;
112
+ /** Added 25.3.41 - Other coverage plan */
113
+ PlanNum2?: number;
114
+ /** Added 25.3.41 - X12 CLM01 semi-unique identifier */
115
+ ClaimIdentifier?: string;
116
+ /**
117
+ * Added 23.3.11 - returns claims on/after this edit timestamp
118
+ * Format: "yyyy-MM-dd HH:mm:ss"
119
+ */
120
+ SecDateTEdit?: string;
121
+ /** Optional offset (if your client/SDK supports pagination). */
122
+ Offset?: number;
123
+ }
124
+
125
+ /** GET /claims/{ClaimNum} - path parameter only. */
126
+ export interface GetClaimByIdParams {
127
+ ClaimNum: number;
128
+ }
129
+
130
+ /**
131
+ * POST /claims body.
132
+ * - Required: PatNum, procNums[], ClaimType
133
+ * - If ClaimType is "PreAuth" or "Other", InsSubNum and PatRelat are required.
134
+ * - For "P"/"S", plan is implied by patient’s primary/secondary coverage.
135
+ */
136
+ export interface CreateClaimParamsBase {
137
+ PatNum: number;
138
+ procNums: number[];
139
+ DateService?: string; // "yyyy-MM-dd" (ignored for "PreAuth")
140
+ DateSent?: string; // "yyyy-MM-dd" (default to today)
141
+ ClaimForm?: number; // FK to claimform.ClaimFormNum
142
+ ProvTreat?: number; // FK to provider.ProvNum
143
+ ProvBill?: number; // FK to provider.ProvNum
144
+ }
145
+
146
+ /** Primary claim. */
147
+ export interface CreatePrimaryClaimParams extends CreateClaimParamsBase {
148
+ ClaimType: "P";
149
+ }
150
+
151
+ /** Secondary claim. */
152
+ export interface CreateSecondaryClaimParams extends CreateClaimParamsBase {
153
+ ClaimType: "S";
154
+ }
155
+
156
+ /** Preauthorization claim. */
157
+ export interface CreatePreAuthClaimParams extends CreateClaimParamsBase {
158
+ ClaimType: "PreAuth";
159
+ InsSubNum: number; // required
160
+ PatRelat: PatientRelationship; // required
161
+ InsSubNum2?: number;
162
+ PatRelat2?: PatientRelationship;
163
+ }
164
+
165
+ /** Other claim (added 25.3.41). */
166
+ export interface CreateOtherClaimParams extends CreateClaimParamsBase {
167
+ ClaimType: "Other";
168
+ InsSubNum: number; // required
169
+ PatRelat: PatientRelationship; // required
170
+ InsSubNum2?: number;
171
+ PatRelat2?: PatientRelationship;
172
+ }
173
+
174
+ /** Union for POST body. */
175
+ export type CreateClaimParams =
176
+ | CreatePrimaryClaimParams
177
+ | CreateSecondaryClaimParams
178
+ | CreatePreAuthClaimParams
179
+ | CreateOtherClaimParams;
180
+
181
+ /**
182
+ * PUT /claims/{ClaimNum}
183
+ * All fields optional; send only what you intend to change.
184
+ * API recalculates as Open Dental does; some fields constrained by claim state.
185
+ */
186
+ export interface UpdateClaimParams {
187
+ ClaimNum: number; // in URL
188
+ ClaimStatus?: Exclude<ClaimStatus, "I">; // "U" | "H" | "W" | "S" | "R"
189
+ DateSent?: string; // "yyyy-MM-dd" (added 25.3.41)
190
+ DateReceived?: string; // "yyyy-MM-dd"
191
+ ProvTreat?: number;
192
+ IsProsthesis?: "N" | "I" | "R";
193
+ PriorDate?: string; // "yyyy-MM-dd"
194
+ ClaimNote?: string; // overwrites existing
195
+ ReasonUnderPaid?: string; // overwrites existing
196
+ ProvBill?: number;
197
+ PlaceService?: PlaceService;
198
+ AccidentRelated?: AccidentRelated;
199
+ AccidentDate?: string; // "yyyy-MM-dd"
200
+ AccidentST?: string; // 2 chars
201
+ IsOrtho?: "true" | "false";
202
+ OrthoRemainM?: number; // 1..36
203
+ OrthoDate?: string; // "yyyy-MM-dd"
204
+ PatRelat?: PatientRelationship; // added 24.4.35
205
+ PatRelat2?: PatientRelationship; // added 24.4.35
206
+ ClaimForm?: number | 0; // 0 to clear
207
+ InsSubNum2?: number; // added 24.4.35
208
+ PriorAuthorizationNumber?: string;
209
+ MedType?: MedType; // added 25.3.41
210
+ OrthoTotalM?: number; // 1..36
211
+ }
212
+
213
+ /** Minimal helper to detect "zero" dates in responses. */
214
+ export const isZeroDate = (d?: string | null): boolean =>
215
+ !d || d === "0001-01-01";
216
+
217
+ /** Narrow helper for timestamps that can be zeroed by the API. */
218
+ export const isZeroDateTime = (d?: string | null): boolean =>
219
+ !d || d.startsWith("0001-01-01");
220
+
221
+ /** Example runtime guard for ClaimStatus values. */
222
+ export const isClaimStatus = (s: string): s is ClaimStatus =>
223
+ ["U", "H", "W", "S", "R", "I"].includes(s);
224
+
225
+ /** Example runtime guard for ClaimType values. */
226
+ export const isClaimType = (t: string): t is ClaimType =>
227
+ ["P", "S", "PreAuth", "Cap", "Other"].includes(t);
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @see https://www.opendental.com/site/apiinsverifies.html
3
+ */
4
+ export interface InsVerify {
5
+ InsVerifyNum?: number; // PK
6
+ DateLastVerified?: string; // String in "yyyy-MM-dd" format
7
+ UserNum?: number; //
8
+ VerifyType?: string; //
9
+ FKey?: number; //
10
+ DefNum?: number; //
11
+ Note?: string; //
12
+ DateLastAssigned?: string; // String in "yyyy-MM-dd" format
13
+ SecDateTEdit?: string; // String in "yyyy-MM-dd HH:mm:ss" format
14
+ }
15
+
16
+ /**
17
+ * Gets insurance verifications.
18
+ * @see https://www.opendental.com/site/apiinsverifies.html
19
+ */
20
+ export interface GetInsVerifiesParams {
21
+ VerifyType?: string; // Required if FKey is specified. Either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
22
+ FKey?: number; // (Added in version 24.4.17) FK to patplan.PatPlanNum or FK to insplan.PlanNum depending on the VerifyType.
23
+ SecDateTEdit?: string; // Only include InsVerifies with a SecDateTEdit altered after the specified date and time. String in "yyyy-MM-dd HH:mm:ss" format.
24
+ Offset?: number; // Pagination offset for results
25
+ }
26
+
27
+ /**
28
+ * Parameters to update an InsVerifies.
29
+ * @see https://www.opendental.com/site/apiinsverifies.html
30
+ */
31
+ export interface UpdateInsVerifiesParams {
32
+ DateLastVerified?: string; // (Optional after version 24.1.17) String in "yyyy-MM-dd" format.
33
+ VerifyType: string; // Required. Can be either "PatientEnrollment" to verify a patient's insurance eligibility, or "InsuranceBenefit" to verify an insurance plan's benefits.
34
+ FKey: number; // Required. If "PatientEnrollment" was passed in for VerifyType, then FKey must be a valid patplan.PatPlanNum. If "InsuranceBenefit" was passed in for VerifyType, FKey must be a valid insplan.PlanNum.
35
+ DefNum?: number; // Optional. Must be a valid DefNum where definition.Category=38.
36
+ Note?: string; // (Added in version 24.1.17) Optional. Status note for this insurance verification.
37
+ }
38
+