@rinse-dental/open-dental 1.4.0 → 1.5.1

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,48 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import { Adjustment, GetAdjustmentsParams, CreateAdjustmentParams, UpdateAdjustmentParams } from "../types/adjustmentTypes";
3
+ export default class Adjustments {
4
+ private httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ /**
7
+ * Fetch multiple adjustments with filtering and pagination.
8
+ * @param {Object} params - The parameters for filtering and pagination.
9
+ * @param {number} params.PatNum - Required. FK to patient.PatNum.
10
+ * @param {number} [params.AdjType] - Optional. definition.DefNum where definition.Category=1.
11
+ * @param {number} [params.ProcNum] - Optional. FK to procedure.ProcNum.
12
+ * @param {number} [params.Offset] - Pagination offset for results.
13
+ * @returns {Promise<Adjustment[]>} - A list of adjustments.
14
+ */
15
+ getAdjustments({ PatNum, AdjType, ProcNum, Offset, }: GetAdjustmentsParams): Promise<Adjustment>;
16
+ /**
17
+ * This adds an adjustments to a patient's account.
18
+ * @param {Object} data - The details of the adjustment to create.
19
+ * @param {number} data.PatNum - Required. FK to patient.PatNum
20
+ * @param {number} data.AdjType - Required. definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
21
+ * @param {number} data.AdjAmt - Required. Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
22
+ * @param {string} data.AdjDate - Required. Cannot be a future date. String in "yyyy-MM-dd" format.
23
+ * @param {string} [data.ProvNum] - Optional. FK to provider.ProvNum
24
+ * @param {string} [data.ProcNum] - Optional. Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
25
+ * @param {string} [data.ClinicNum] - Optional. Default patient.ClinicNum.
26
+ * @param {string} [data.ProcDate] - Optional. String in "yyyy-MM-dd" format. If attaching to a procedure then this will default to the procedure's ProcDate. Otherwise, defaults to today's date.
27
+ * @param {string} [data.AdjNote] - Optional. Note for the adjustment.
28
+ * @returns {Promise<Adjustment>} - The created adjustment.
29
+ * @throws {Error} - If required fields are missing or the API returns an error.
30
+ */
31
+ createAdjustment({ PatNum, AdjType, AdjAmt, AdjDate, ProvNum, ProcNum, ClinicNum, ProcDate, AdjNote, }: CreateAdjustmentParams): Promise<Adjustment>;
32
+ /**
33
+ * Update an adjustment.
34
+ * @param {Object} data - The details of adjustment to update.
35
+ * @param {number} data.AdjNum - Required. Primary key.
36
+ * @param {string} data.AdjDate - Cannot be a future date. String in "yyyy-MM-dd" format.
37
+ * @param {number} data.AdjAmt - Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
38
+ * @param {number} data.AdjType - definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
39
+ * @param {string} [data.ProvNum] - Optional. FK to provider.ProvNum
40
+ * @param {string} [data.AdjNote] - Optional. Note for the adjustment.
41
+ * @param {string} [data.ProcNum] - Optional. Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
42
+ * @param {string} [data.ClinicNum] - Optional. Default patient.ClinicNum.
43
+ * @returns {Promise<Adjustment>} - The updated adjustment.
44
+ * @throws {Error} - If required fields are missing or the API returns an error.
45
+ */
46
+ updateAdjustment({ AdjNum, AdjDate, AdjAmt, AdjType, ProvNum, AdjNote, ProcNum, ClinicNum, }: UpdateAdjustmentParams): Promise<Adjustment>;
47
+ }
48
+ //# sourceMappingURL=adjustments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adjustments.d.ts","sourceRoot":"","sources":["../../src/api/adjustments.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;;;;QAQI;IACS,cAAc,CAAC,EAC1B,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,GAEP,EAAG,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;IAa9C;;;;;;;;;;;;;;OAcG;IACU,gBAAgB,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,GACR,EAAG,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;IAkBhD;;;;;;;;;;;;;OAaG;IACU,gBAAgB,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,SAAS,GACV,EAAG,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;CAgBjD"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Adjustments {
4
+ httpClient;
5
+ constructor(httpClient) {
6
+ this.httpClient = httpClient;
7
+ }
8
+ /**
9
+ * Fetch multiple adjustments with filtering and pagination.
10
+ * @param {Object} params - The parameters for filtering and pagination.
11
+ * @param {number} params.PatNum - Required. FK to patient.PatNum.
12
+ * @param {number} [params.AdjType] - Optional. definition.DefNum where definition.Category=1.
13
+ * @param {number} [params.ProcNum] - Optional. FK to procedure.ProcNum.
14
+ * @param {number} [params.Offset] - Pagination offset for results.
15
+ * @returns {Promise<Adjustment[]>} - A list of adjustments.
16
+ */
17
+ async getAdjustments({ PatNum, AdjType, ProcNum, Offset, }) {
18
+ if (!PatNum || typeof PatNum !== "number") {
19
+ throw new Error("Invalid data: A Valid PatNum is required.");
20
+ }
21
+ return this.httpClient.get("/adjustments", {
22
+ PatNum,
23
+ AdjType,
24
+ ProcNum,
25
+ Offset,
26
+ });
27
+ }
28
+ /**
29
+ * This adds an adjustments to a patient's account.
30
+ * @param {Object} data - The details of the adjustment to create.
31
+ * @param {number} data.PatNum - Required. FK to patient.PatNum
32
+ * @param {number} data.AdjType - Required. definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
33
+ * @param {number} data.AdjAmt - Required. Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
34
+ * @param {string} data.AdjDate - Required. Cannot be a future date. String in "yyyy-MM-dd" format.
35
+ * @param {string} [data.ProvNum] - Optional. FK to provider.ProvNum
36
+ * @param {string} [data.ProcNum] - Optional. Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
37
+ * @param {string} [data.ClinicNum] - Optional. Default patient.ClinicNum.
38
+ * @param {string} [data.ProcDate] - Optional. String in "yyyy-MM-dd" format. If attaching to a procedure then this will default to the procedure's ProcDate. Otherwise, defaults to today's date.
39
+ * @param {string} [data.AdjNote] - Optional. Note for the adjustment.
40
+ * @returns {Promise<Adjustment>} - The created adjustment.
41
+ * @throws {Error} - If required fields are missing or the API returns an error.
42
+ */
43
+ async createAdjustment({ PatNum, AdjType, AdjAmt, AdjDate, ProvNum, ProcNum, ClinicNum, ProcDate, AdjNote, }) {
44
+ if (!PatNum || !AdjType || !AdjAmt || !AdjDate) {
45
+ throw new Error("Invalid data: PatNum, AdjType, AdjAmt, and AdjDate are required.");
46
+ }
47
+ return this.httpClient.post("/adjustments", {
48
+ PatNum,
49
+ AdjType,
50
+ AdjAmt,
51
+ AdjDate,
52
+ ProvNum,
53
+ ProcNum,
54
+ ClinicNum,
55
+ ProcDate,
56
+ AdjNote,
57
+ });
58
+ }
59
+ /**
60
+ * Update an adjustment.
61
+ * @param {Object} data - The details of adjustment to update.
62
+ * @param {number} data.AdjNum - Required. Primary key.
63
+ * @param {string} data.AdjDate - Cannot be a future date. String in "yyyy-MM-dd" format.
64
+ * @param {number} data.AdjAmt - Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
65
+ * @param {number} data.AdjType - definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
66
+ * @param {string} [data.ProvNum] - Optional. FK to provider.ProvNum
67
+ * @param {string} [data.AdjNote] - Optional. Note for the adjustment.
68
+ * @param {string} [data.ProcNum] - Optional. Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
69
+ * @param {string} [data.ClinicNum] - Optional. Default patient.ClinicNum.
70
+ * @returns {Promise<Adjustment>} - The updated adjustment.
71
+ * @throws {Error} - If required fields are missing or the API returns an error.
72
+ */
73
+ async updateAdjustment({ AdjNum, AdjDate, AdjAmt, AdjType, ProvNum, AdjNote, ProcNum, ClinicNum, }) {
74
+ if (!AdjNum || typeof AdjNum !== "number") {
75
+ throw new Error("Invalid data: A valid AdjNum is required.");
76
+ }
77
+ return this.httpClient.put(`/adjustments/${AdjNum}`, {
78
+ AdjNum,
79
+ AdjDate,
80
+ AdjAmt,
81
+ AdjType,
82
+ ProvNum,
83
+ AdjNote,
84
+ ProcNum,
85
+ ClinicNum,
86
+ });
87
+ }
88
+ }
89
+ exports.default = Adjustments;
@@ -21,6 +21,7 @@ import RefAttaches from "./api/refAttaches";
21
21
  import InsPlans from "./api/insPlans";
22
22
  import Benefits from "./api/benefits";
23
23
  import ClaimProcs from "./api/claimProcs";
24
+ import Adjustments from "./api/adjustments";
24
25
  declare class OpenDental {
25
26
  private static httpClient;
26
27
  /**
@@ -119,6 +120,10 @@ declare class OpenDental {
119
120
  * Create a new instance of the ClaimProcs API.
120
121
  */
121
122
  static ClaimProcs(): ClaimProcs;
123
+ /**
124
+ * Create a new instance of the Adjustments API.
125
+ */
126
+ static Adjustments(): Adjustments;
122
127
  }
123
128
  export { OpenDental };
124
129
  //# sourceMappingURL=openDental.d.ts.map
@@ -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;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AO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,cAAM,UAAU;IACd,OAAO,CAAC,MAAM,CAAC,UAAU,CAAa;IAEtC;;OAEG;WACW,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAWlE;;OAEG;WACa,YAAY;IAQ5B;;OAEG;WACa,QAAQ;IAOxB;;OAEG;WACW,YAAY;IAO1B;;SAEK;WACS,SAAS;IAOvB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,aAAa;IAO3B;;OAEG;WACW,OAAO;IAOrB;;OAEG;WACW,cAAc;IAO5B;;OAEG;WACa,SAAS;IAOzB;;OAEG;WACa,SAAS;IAOzB;;OAEG;WACa,WAAW;IAO3B;;OAEG;WACa,QAAQ;IAOxB;;OAEG;WACW,WAAW;IAOzB;;OAEG;WACW,gBAAgB;IAO9B;;OAEG;WACW,aAAa;IAO3B;;OAEG;WACW,OAAO;IAOrB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,SAAS;IAOvB;;OAEG;WACW,WAAW;IAOzB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,UAAU;IAOxB;;OAEG;WACW,WAAW;CAM1B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -28,6 +28,7 @@ const refAttaches_1 = __importDefault(require("./api/refAttaches"));
28
28
  const insPlans_1 = __importDefault(require("./api/insPlans"));
29
29
  const benefits_1 = __importDefault(require("./api/benefits"));
30
30
  const claimProcs_1 = __importDefault(require("./api/claimProcs"));
31
+ const adjustments_1 = __importDefault(require("./api/adjustments"));
31
32
  class OpenDental {
32
33
  static httpClient;
33
34
  /**
@@ -248,5 +249,14 @@ class OpenDental {
248
249
  }
249
250
  return new claimProcs_1.default(this.httpClient);
250
251
  }
252
+ /**
253
+ * Create a new instance of the Adjustments API.
254
+ */
255
+ static Adjustments() {
256
+ if (!this.httpClient) {
257
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
258
+ }
259
+ return new adjustments_1.default(this.httpClient);
260
+ }
251
261
  }
252
262
  exports.OpenDental = OpenDental;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Represents an InsSub in the Open Dental system. Links an InsPlan to a Subscriber (patient.PatNum). Also, see PatPlans to indicate coverage.
3
+ * @see https://www.opendental.com/site/apiadjustments.html
4
+ */
5
+ export interface Adjustment {
6
+ AdjNum?: number;
7
+ AdjDate?: string;
8
+ AdjAmt?: number;
9
+ PatNum?: number;
10
+ AdjType?: number;
11
+ adjType?: string;
12
+ ProvNum?: number;
13
+ AdjNote?: string;
14
+ ProcDate?: string;
15
+ ProcNum?: number;
16
+ DateEntry?: string;
17
+ ClinicNum?: number;
18
+ SecUserNumEntry?: number;
19
+ SecDateTEdit?: string;
20
+ }
21
+ /**
22
+ * Gets adjustments based on PatNum and provided parameters.
23
+ * @see https://www.opendental.com/site/apiadjustments.html
24
+ */
25
+ export interface GetAdjustmentsParams {
26
+ PatNum: number;
27
+ AdjType?: number;
28
+ ProcNum?: number;
29
+ Offset?: number;
30
+ }
31
+ /**
32
+ * Parameters for creating an adjustment for a patient.
33
+ * @see https://www.opendental.com/site/apiadjustments.html
34
+ */
35
+ export interface CreateAdjustmentParams {
36
+ PatNum: number;
37
+ AdjType: number;
38
+ AdjAmt: number;
39
+ AdjDate: string;
40
+ ProvNum?: number;
41
+ ProcNum?: number;
42
+ ClinicNum?: number;
43
+ ProcDate?: string;
44
+ AdjNote?: string;
45
+ }
46
+ /**
47
+ * Parameters for updating an adjustment for a patient.
48
+ * @see https://www.opendental.com/site/apiadjustments.html
49
+ */
50
+ export interface UpdateAdjustmentParams {
51
+ AdjNum: number;
52
+ AdjDate?: string;
53
+ AdjAmt?: number;
54
+ AdjType?: number;
55
+ ProvNum?: number;
56
+ AdjNote?: string;
57
+ ProcNum?: number;
58
+ ClinicNum?: number;
59
+ }
60
+ //# sourceMappingURL=adjustmentTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adjustmentTypes.d.ts","sourceRoot":"","sources":["../../src/types/adjustmentTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,UAAU;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -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.4.0",
3
+ "version": "1.5.1",
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",
@@ -0,0 +1,126 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ Adjustment,
4
+ GetAdjustmentsParams,
5
+ CreateAdjustmentParams,
6
+ UpdateAdjustmentParams,
7
+ } from "../types/adjustmentTypes";
8
+
9
+ export default class Adjustments {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Fetch multiple adjustments with filtering and pagination.
18
+ * @param {Object} params - The parameters for filtering and pagination.
19
+ * @param {number} params.PatNum - Required. FK to patient.PatNum.
20
+ * @param {number} [params.AdjType] - Optional. definition.DefNum where definition.Category=1.
21
+ * @param {number} [params.ProcNum] - Optional. FK to procedure.ProcNum.
22
+ * @param {number} [params.Offset] - Pagination offset for results.
23
+ * @returns {Promise<Adjustment[]>} - A list of adjustments.
24
+ */
25
+ public async getAdjustments({
26
+ PatNum,
27
+ AdjType,
28
+ ProcNum,
29
+ Offset,
30
+
31
+ } : GetAdjustmentsParams): Promise<Adjustment> {
32
+ if (!PatNum || typeof PatNum !== "number") {
33
+ throw new Error("Invalid data: A Valid PatNum is required.");
34
+ }
35
+
36
+ return this.httpClient.get<Adjustment>("/adjustments", {
37
+ PatNum,
38
+ AdjType,
39
+ ProcNum,
40
+ Offset,
41
+ });
42
+ }
43
+
44
+ /**
45
+ * This adds an adjustments to a patient's account.
46
+ * @param {Object} data - The details of the adjustment to create.
47
+ * @param {number} data.PatNum - Required. FK to patient.PatNum
48
+ * @param {number} data.AdjType - Required. definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
49
+ * @param {number} data.AdjAmt - Required. Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
50
+ * @param {string} data.AdjDate - Required. Cannot be a future date. String in "yyyy-MM-dd" format.
51
+ * @param {string} [data.ProvNum] - Optional. FK to provider.ProvNum
52
+ * @param {string} [data.ProcNum] - Optional. Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
53
+ * @param {string} [data.ClinicNum] - Optional. Default patient.ClinicNum.
54
+ * @param {string} [data.ProcDate] - Optional. String in "yyyy-MM-dd" format. If attaching to a procedure then this will default to the procedure's ProcDate. Otherwise, defaults to today's date.
55
+ * @param {string} [data.AdjNote] - Optional. Note for the adjustment.
56
+ * @returns {Promise<Adjustment>} - The created adjustment.
57
+ * @throws {Error} - If required fields are missing or the API returns an error.
58
+ */
59
+ public async createAdjustment({
60
+ PatNum,
61
+ AdjType,
62
+ AdjAmt,
63
+ AdjDate,
64
+ ProvNum,
65
+ ProcNum,
66
+ ClinicNum,
67
+ ProcDate,
68
+ AdjNote,
69
+ } : CreateAdjustmentParams): Promise<Adjustment> {
70
+ if (!PatNum || !AdjType || !AdjAmt || !AdjDate) {
71
+ throw new Error("Invalid data: PatNum, AdjType, AdjAmt, and AdjDate are required.");
72
+ }
73
+
74
+ return this.httpClient.post<Adjustment>("/adjustments", {
75
+ PatNum,
76
+ AdjType,
77
+ AdjAmt,
78
+ AdjDate,
79
+ ProvNum,
80
+ ProcNum,
81
+ ClinicNum,
82
+ ProcDate,
83
+ AdjNote,
84
+ });
85
+ }
86
+
87
+ /**
88
+ * Update an adjustment.
89
+ * @param {Object} data - The details of adjustment to update.
90
+ * @param {number} data.AdjNum - Required. Primary key.
91
+ * @param {string} data.AdjDate - Cannot be a future date. String in "yyyy-MM-dd" format.
92
+ * @param {number} data.AdjAmt - Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
93
+ * @param {number} data.AdjType - definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
94
+ * @param {string} [data.ProvNum] - Optional. FK to provider.ProvNum
95
+ * @param {string} [data.AdjNote] - Optional. Note for the adjustment.
96
+ * @param {string} [data.ProcNum] - Optional. Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
97
+ * @param {string} [data.ClinicNum] - Optional. Default patient.ClinicNum.
98
+ * @returns {Promise<Adjustment>} - The updated adjustment.
99
+ * @throws {Error} - If required fields are missing or the API returns an error.
100
+ */
101
+ public async updateAdjustment({
102
+ AdjNum,
103
+ AdjDate,
104
+ AdjAmt,
105
+ AdjType,
106
+ ProvNum,
107
+ AdjNote,
108
+ ProcNum,
109
+ ClinicNum,
110
+ } : UpdateAdjustmentParams): Promise<Adjustment> {
111
+ if (!AdjNum || typeof AdjNum !== "number") {
112
+ throw new Error("Invalid data: A valid AdjNum is required.");
113
+ }
114
+
115
+ return this.httpClient.put<Adjustment>(`/adjustments/${AdjNum}`, {
116
+ AdjNum,
117
+ AdjDate,
118
+ AdjAmt,
119
+ AdjType,
120
+ ProvNum,
121
+ AdjNote,
122
+ ProcNum,
123
+ ClinicNum,
124
+ });
125
+ }
126
+ }
package/src/openDental.ts CHANGED
@@ -22,6 +22,7 @@ import RefAttaches from "./api/refAttaches";
22
22
  import InsPlans from "./api/insPlans";
23
23
  import Benefits from "./api/benefits";
24
24
  import ClaimProcs from "./api/claimProcs";
25
+ import Adjustments from "./api/adjustments";
25
26
 
26
27
  class OpenDental {
27
28
  private static httpClient: HttpClient;
@@ -270,6 +271,16 @@ class OpenDental {
270
271
  }
271
272
  return new ClaimProcs(this.httpClient);
272
273
  }
274
+
275
+ /**
276
+ * Create a new instance of the Adjustments API.
277
+ */
278
+ public static Adjustments() {
279
+ if (!this.httpClient) {
280
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
281
+ }
282
+ return new Adjustments(this.httpClient);
283
+ }
273
284
  }
274
285
 
275
286
  export { OpenDental };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Represents an InsSub in the Open Dental system. Links an InsPlan to a Subscriber (patient.PatNum). Also, see PatPlans to indicate coverage.
3
+ * @see https://www.opendental.com/site/apiadjustments.html
4
+ */
5
+ export interface Adjustment {
6
+ AdjNum?: number; // Primary Key
7
+ AdjDate?: string; // Cannot be a future date. String in "yyyy-MM-dd" format.
8
+ AdjAmt?: number; // Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
9
+ PatNum?: number; // FK to patient.PatNum
10
+ AdjType?: number; // definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
11
+ adjType?: string; // definition.ItemName where AdjType == definition.DefNum && definition.Category == 1.
12
+ ProvNum?: number; // FK to provider.ProvNum
13
+ AdjNote?: string; // Note for the adjustment.
14
+ ProcDate?: string; // String in "yyyy-MM-dd" format. If attaching to a procedure then this will default to the procedure's ProcDate. Otherwise, defaults to today's date.
15
+ ProcNum?: number; // Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
16
+ DateEntry?: string; // String in "yyyy-MM-dd" format.
17
+ ClinicNum?: number; // Default patient.ClinicNum.
18
+ SecUserNumEntry?: number; //
19
+ SecDateTEdit?: string; // String in "yyyy-MM-dd HH:mm:ss" format
20
+ }
21
+
22
+ /**
23
+ * Gets adjustments based on PatNum and provided parameters.
24
+ * @see https://www.opendental.com/site/apiadjustments.html
25
+ */
26
+ export interface GetAdjustmentsParams {
27
+ PatNum: number; // Required. FK to patient.PatNum
28
+ AdjType?: number; // Optional. definition.DefNum where definition.Category=1.
29
+ ProcNum?: number; // Optional. FK to procedure.ProcNum.
30
+ Offset?: number; // Pagination offset for results.
31
+ }
32
+
33
+ /**
34
+ * Parameters for creating an adjustment for a patient.
35
+ * @see https://www.opendental.com/site/apiadjustments.html
36
+ */
37
+ export interface CreateAdjustmentParams {
38
+ PatNum: number; // Required. FK to patient.PatNum
39
+ AdjType: number; // Required. definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
40
+ AdjAmt: number; // Required. Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
41
+ AdjDate: string; // Required. Cannot be a future date. String in "yyyy-MM-dd" format.
42
+ ProvNum?: number; // FK to provider.ProvNum
43
+ ProcNum?: number; // Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
44
+ ClinicNum?: number; // Default patient.ClinicNum.
45
+ ProcDate?: string; // String in "yyyy-MM-dd" format. If attaching to a procedure then this will default to the procedure's ProcDate. Otherwise, defaults to today's date.
46
+ AdjNote?: string; // Note for the adjustment.
47
+ }
48
+
49
+ /**
50
+ * Parameters for updating an adjustment for a patient.
51
+ * @see https://www.opendental.com/site/apiadjustments.html
52
+ */
53
+ export interface UpdateAdjustmentParams {
54
+ AdjNum: number; // Required. Primary Key
55
+ AdjDate?: string; // Cannot be a future date. String in "yyyy-MM-dd" format.
56
+ AdjAmt?: number; // Must be positive if AdjType has an ItemValue of "+", or negative if it has an ItemValue of "-".
57
+ AdjType?: number; // definition.DefNum where definition.Category=1, and definition.ItemValue="+" or "-".
58
+ ProvNum?: number; // FK to provider.ProvNum
59
+ AdjNote?: string; // Note for the adjustment.
60
+ ProcNum?: number; // Only used if attaching this adjustment to a procedure. The procedure must be associated to the patient. Default 0.
61
+ ClinicNum?: number; // Default patient.ClinicNum.
62
+ }
63
+