@rinse-dental/open-dental 0.1.7 → 1.0.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.
Files changed (52) hide show
  1. package/deploy_notes.txt +6 -2
  2. package/dist/api/definitions.d.ts +16 -0
  3. package/dist/api/definitions.d.ts.map +1 -0
  4. package/dist/api/definitions.js +25 -0
  5. package/dist/api/discountPlanSubs.d.ts +46 -0
  6. package/dist/api/discountPlanSubs.d.ts.map +1 -0
  7. package/dist/api/discountPlanSubs.js +69 -0
  8. package/dist/api/index.d.ts +6 -1
  9. package/dist/api/index.d.ts.map +1 -1
  10. package/dist/api/index.js +12 -2
  11. package/dist/api/operatories.d.ts +4 -4
  12. package/dist/api/operatories.js +4 -4
  13. package/dist/api/patFields.d.ts +3 -3
  14. package/dist/api/patFields.js +3 -3
  15. package/dist/api/payments.d.ts +49 -0
  16. package/dist/api/payments.d.ts.map +1 -0
  17. package/dist/api/payments.js +69 -0
  18. package/dist/api/providers.d.ts +38 -38
  19. package/dist/api/providers.js +38 -38
  20. package/dist/api/schedules.d.ts +4 -4
  21. package/dist/api/schedules.js +4 -4
  22. package/dist/api/treatplans.d.ts +9 -9
  23. package/dist/api/treatplans.d.ts.map +1 -1
  24. package/dist/api/treatplans.js +9 -9
  25. package/dist/openDental.d.ts +17 -2
  26. package/dist/openDental.d.ts.map +1 -1
  27. package/dist/openDental.js +32 -2
  28. package/dist/types/definitionTypes.d.ts +23 -0
  29. package/dist/types/definitionTypes.d.ts.map +1 -0
  30. package/dist/types/definitionTypes.js +2 -0
  31. package/dist/types/discountPlanSubTypes.d.ts +43 -0
  32. package/dist/types/discountPlanSubTypes.d.ts.map +1 -0
  33. package/dist/types/discountPlanSubTypes.js +2 -0
  34. package/dist/types/paymentTypes.d.ts +67 -0
  35. package/dist/types/paymentTypes.d.ts.map +1 -0
  36. package/dist/types/paymentTypes.js +2 -0
  37. package/dist/types/scheduleTypes.d.ts +2 -2
  38. package/package.json +3 -3
  39. package/src/api/definitions.ts +35 -0
  40. package/src/api/discountPlanSubs.ts +86 -0
  41. package/src/api/index.ts +6 -1
  42. package/src/api/operatories.ts +4 -4
  43. package/src/api/patFields.ts +3 -3
  44. package/src/api/payments.ts +86 -0
  45. package/src/api/providers.ts +38 -38
  46. package/src/api/schedules.ts +4 -4
  47. package/src/api/treatplans.ts +9 -10
  48. package/src/openDental.ts +34 -2
  49. package/src/types/definitionTypes.ts +24 -0
  50. package/src/types/discountPlanSubTypes.ts +46 -0
  51. package/src/types/paymentTypes.ts +70 -0
  52. package/src/types/scheduleTypes.ts +10 -10
@@ -0,0 +1,86 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ DiscountPlanSub,
4
+ GetDiscountPlanSubsParams,
5
+ CreateDiscountPlanSubParams,
6
+ UpdateDiscountPlanSubParams,
7
+ } from "../types/discountPlanSubTypes";
8
+
9
+ export default class DiscountPlanSubs {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Fetch multiple definitinos with optional filtering and pagination.
18
+ * @param {Object} params - The parameters for filtering and pagination.
19
+ * @param {number} [params.PatNum] - Filter by patient.
20
+ * @param {number} [params.Offset] - Pagination offset for results.
21
+ * @returns {Promise<DiscountPlanSub[]>} - A list of appointments.
22
+ */
23
+ public async getDiscountPlanSubs({
24
+ PatNum,
25
+ Offset,
26
+ }: GetDiscountPlanSubsParams = {}): Promise<DiscountPlanSub[]> {
27
+ const params = {
28
+ PatNum,
29
+ Offset,
30
+ };
31
+
32
+ return this.httpClient.get<DiscountPlanSub[]>("/discountplansubs", params);
33
+ }
34
+
35
+ /**
36
+ * Create a new discount plan sub.
37
+ * @param {Object} data - The details of discount plan sub to create.
38
+ * @param {number} data.DiscountPlanNum - Required: FK to discount plan.
39
+ * @param {number} data.PatNum - Required: Patient number.
40
+ * @param {number} [data.DateEffective] - Optional: Patient number.
41
+ * @param {number} [data.DateTerm] - Optional: Patient number.
42
+ * @param {number} [data.SubNote] - Optional: Patient number.
43
+ * @returns {Promise<DiscountPlanSub>} - The created discount plan sub.
44
+ * @throws {Error} - If required fields are missing or the API returns an error.
45
+ */
46
+ public async createDiscountPlanSub(data: CreateDiscountPlanSubParams): Promise<DiscountPlanSub> {
47
+ if (!data.DiscountPlanNum || !data.PatNum) {
48
+ throw new Error("Invalid data: DiscountPlanNum and PatNum are required.");
49
+ }
50
+
51
+ return this.httpClient.post<DiscountPlanSub>("/discountplansubs", data);
52
+ }
53
+
54
+ /**
55
+ * Update a discount plan sub.
56
+ * @param {Object} data - The details of the discount sub to update.
57
+ * @param {number} data.DiscountSubNum - Required: PK
58
+ * @param {number} data.PatNum - Required: Patient number.
59
+ * @param {number} [data.DateEffective] - Optional: Patient number.
60
+ * @param {number} [data.DateTerm] - Optional: Patient number.
61
+ * @param {number} [data.SubNote] - Optional: Patient number.
62
+ * @returns {Promise<DiscountPlanSub>} - The updated discount plan sub.
63
+ * @throws {Error} - If required fields are missing or the API returns an error.
64
+ */
65
+ public async updateDiscountPlanSub(data: UpdateDiscountPlanSubParams): Promise<DiscountPlanSub> {
66
+ if (!data.DiscountSubNum || !data.PatNum) {
67
+ throw new Error("Invalid data: DiscountSubNum and PatNum are required.");
68
+ }
69
+
70
+ return this.httpClient.put<DiscountPlanSub>(`/discountplansubs/${data.DiscountSubNum}`, data);
71
+ }
72
+
73
+ /**
74
+ * Delete a discount plan sub entry.
75
+ * @param {number} [DiscountSubNum] - Required: The unique identifier of the discount plan sub to delete.
76
+ * @returns {Promise<void>} - Resolves when the discount plan sub is deleted.
77
+ * @throws {Error} - If `DiscountSubNum` is not valid or the API returns an error.
78
+ */
79
+ public async deleteDiscountPlanSub(DiscountSubNum: number): Promise<void> {
80
+ if (!DiscountSubNum || typeof DiscountSubNum !== "number") {
81
+ throw new Error("Invalid parameter: ProcNum must be a valid number.");
82
+ }
83
+
84
+ return this.httpClient.delete<void>(`/discountplansubs/${DiscountSubNum}`);
85
+ }
86
+ }
package/src/api/index.ts CHANGED
@@ -6,5 +6,10 @@ export { default as Patients } from "./patients";
6
6
  export { default as ProcedureLogs } from "./procedureLog";
7
7
  export { default as Recalls } from "./recalls";
8
8
  export { default as TreatmentPlans } from "./treatplans";
9
- export { default as Schedule } from "./schedules";
9
+ export { default as Schedules } from "./schedules";
10
+ export { default as Providers } from "./providers";
11
+ export { default as Operatories } from "./operatories";
12
+ export { default as Payments } from "./payments";
13
+ export { default as Definitions } from "./definitions";
14
+ export { default as DiscountPlanSubs } from "./discountPlanSubs";
10
15
  // Add other APIs as needed
@@ -13,9 +13,9 @@ export default class Operatories {
13
13
 
14
14
  /**
15
15
  * Fetch a single operatory by its ID.
16
- * @param {number} OperatoryNum - The ID of the patfield.
17
- * @returns {Promise<Operatory>} - The patient data.
18
- * @throws {Error} - If `PatNum` is not valid or the API returns an error.
16
+ * @param {number} OperatoryNum - The ID of the operatory.
17
+ * @returns {Promise<Operatory>} - The operatory data.
18
+ * @throws {Error} - If `OperatoryNum` is not valid or the API returns an error.
19
19
  */
20
20
  public async getOperatory(OperatoryNum: number): Promise<Operatory> {
21
21
  if (!OperatoryNum || typeof OperatoryNum !== "number") {
@@ -30,7 +30,7 @@ export default class Operatories {
30
30
  * @param {Object} params - Filtering and pagination parameters.
31
31
  * @param {string} [params.ClinicNum] - Filter by clinicnum
32
32
  * @param {string} [params.Offset] - Filter by clinicnum
33
- * @returns {Promise<Operatory[]>} - A list of summarized patient data.
33
+ * @returns {Promise<Operatory[]>} - A list of operatories.
34
34
  * @throws {Error} - If the API returns an error.
35
35
  */
36
36
  public async getOperatories({
@@ -15,7 +15,7 @@ export default class PatFields {
15
15
  /**
16
16
  * Fetch a single patfield by its ID.
17
17
  * @param {number} PatFieldNum - The ID of the patfield.
18
- * @returns {Promise<PatField>} - The patient data.
18
+ * @returns {Promise<PatField>} - The patfield data.
19
19
  * @throws {Error} - If `PatNum` is not valid or the API returns an error.
20
20
  */
21
21
  public async getPatField(PatFieldNum: number): Promise<PatField> {
@@ -27,12 +27,12 @@ export default class PatFields {
27
27
  }
28
28
 
29
29
  /**
30
- * Fetch multiple patients with optional filtering and pagination.
30
+ * Fetch multiple patfields with optional filtering and pagination.
31
31
  * @param {Object} params - Filtering and pagination parameters.
32
32
  * @param {string} [params.PatNum] - Filter by last name (case-insensitive, partial match).
33
33
  * @param {string} [params.FieldName] - Filter by last name (case-insensitive, partial match).
34
34
  * @param {string} [params.SecDateTEdit] - Filter by last name (case-insensitive, partial match).
35
- * @returns {Promise<PatField[]>} - A list of summarized patient data.
35
+ * @returns {Promise<PatField[]>} - A list of patfields.
36
36
  * @throws {Error} - If the API returns an error.
37
37
  */
38
38
  public async getPatFields({
@@ -0,0 +1,86 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ Payment,
4
+ GetPaymentsParams,
5
+ CreatePaymentParams,
6
+ UpdatePaymentParams,
7
+ } from "../types/paymentTypes";
8
+
9
+ export default class Payments {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Fetch multiple payments with optional filtering and pagination.
18
+ * @param {Object} params - The parameters for filtering and pagination.
19
+ * @param {number} [params.PayType] - Filter by PayType, definition.DefNum where definition.Category=10.
20
+ * @param {number} [params.PatNum] - FK to patient.PatNum.
21
+ * @param {string} [params.DateEntry] - String in "yyyy-MM-dd" format. Gets all payments made on or after a certain date.
22
+ * @param {number} [params.Offset] - Pagination offset for results.
23
+ * @returns {Promise<Payment[]>} - A list of payments.
24
+ */
25
+ public async getPayments({
26
+ PayType,
27
+ PatNum,
28
+ DateEntry,
29
+ Offset,
30
+ }: GetPaymentsParams = {}): Promise<Payment[]> {
31
+ const params = {
32
+ PayType,
33
+ PatNum,
34
+ DateEntry,
35
+ Offset,
36
+ };
37
+
38
+ return this.httpClient.get<Payment[]>("/payments", params);
39
+ }
40
+
41
+ /**
42
+ * Create a payment.
43
+ * @param {Object} data - Data for the new payment.
44
+ * @param {string} data.PayAmt - Required: String amount of payment as 0.00 (float.toString())
45
+ * @param {number} data.PatNum - Required: FK to Patient
46
+ * @param {string} [data.PayType] - Optional: definition.DefNum where definition.Category=10. Defaults to the ApiPaymentType preference.
47
+ * @param {string} [data.PayDate] - Optional. String in "yyyy-MM-dd" format. Defaults to today's date. Follows the office's preference to allow future-dated payments.
48
+ * @param {string} [data.CheckNum] - Optional.
49
+ * @param {string} [data.PayNote] - Optional.
50
+ * @param {string} [data.BankBranch] - Optional.
51
+ * @param {string} [data.ClinicNum] - Optional: Defaults to patient.ClinicNum
52
+ * @param {"true" | "false"} [data.isPatientPreferred="false"] - Optional. When entering a payment through Open Dental directly, there is a checkbox for this option. This API field allows the same functionality. It causes the splits to go to the patient instead of being split among family members on a FIFO basis. Default "false".
53
+ * @param {"true" | "false"} [data.isPrepayment="false"] - Optional. Creates a single paysplit using the default unearned type for unallocated paysplits stored in the PrepaymentUnearnedType preference. See also Unearned / Prepayment. Default "false".
54
+ * @param {number[]} [data.procNums=[]] - Optional. An array of ProcNums, in [1,2,3] format to apply this Payment to. Procedures are paid by Procedure.ProcDate on a FIFO basis. Procedures not in the Patient's family will be silently ignored. Ignored if isPrepayment is set to "true". Default is an empty array.
55
+ * @param {number} [data.payPlanNum=0] - Optional. FK to payplan.PayPlanNum for a Dynamic Payment Plan. Only allowed if isPrepayment is "true" prior to version 23.3.4. Default 0.
56
+ * @returns {Promise<Payment>} - The created payment.
57
+ * @throws {Error} - If required fields are missing.
58
+ */
59
+ public async createPayment(data: CreatePaymentParams): Promise<Payment> {
60
+ if (!data.PayAmt || !data.PatNum) {
61
+ throw new Error("PayAmt and PatNum are required.");
62
+ }
63
+
64
+ return this.httpClient.post<Payment>("/payments", data);
65
+ }
66
+
67
+ /**
68
+ * Update a payment.
69
+ * @param {Object} data - Data for the new payment.
70
+ * @param {string} data.PayNum - Required: PK of Payment to update.
71
+ * @param {string} [data.PayType] - Optional: definition.DefNum where definition.Category=10. Defaults to the ApiPaymentType preference.
72
+ * @param {string} [data.CheckNum] - Optional.
73
+ * @param {string} [data.PayNote] - Optional.
74
+ * @param {string} [data.BankBranch] - Optional.
75
+ * @param {"OnlineProcessed" | "OnlinePending"} [data.ProcessStatus] - Indicates whether a payment came from in office or online, and if the online payment is processed or pending. Either "OnlineProcessed" or "OnlinePending".
76
+ * @returns {Promise<Payment>} - The updated payment.
77
+ * @throws {Error} - If required fields are missing.
78
+ */
79
+ public async updatePayment(data: UpdatePaymentParams): Promise<Payment> {
80
+ if (!data.PayNum) {
81
+ throw new Error("PayNum is required.");
82
+ }
83
+
84
+ return this.httpClient.put<Payment>(`/payments/${data.PayNum}`, data);
85
+ }
86
+ }
@@ -33,7 +33,7 @@ export default class Providers {
33
33
  * @param {number} [params.ClinicNum] - Get providers by ClinicNum
34
34
  * @param {string} [params.DateTStamp] - Get providers altered after the specified date and time
35
35
  * @param {string} [params.Offset] - Pagination
36
- * @returns {Promise<Provider[]>} - A list of summarized patient data.
36
+ * @returns {Promise<Provider[]>} - A list of providers.
37
37
  * @throws {Error} - If the API returns an error.
38
38
  */
39
39
  public async getProviders({
@@ -51,25 +51,25 @@ export default class Providers {
51
51
 
52
52
  /**
53
53
  * Creates a provider. Cannot create PatFields associated with hidden PatFieldDefs.
54
- * @param {Object} data - The data for the new patfield.
54
+ * @param {Object} data - The data for the new provider.
55
55
  * @param {string} data.Abbr - Required.
56
- * @param {string} data.LName - Optional.
57
- * @param {string} data.FName - Optional.
58
- * @param {string} data.MI - Optional.
59
- * @param {string} data.Suffix - Optional.
60
- * @param {number} data.FeeSched - Optional.
61
- * @param {number} data.Specialty - Optional.
62
- * @param {string} data.SSN - Optional.
63
- * @param {'true' | 'false'} data.IsSecondary - Optional.
64
- * @param {'true' | 'false'} data.IsHidden - Optional.
65
- * @param {'true' | 'false'} data.UsingTIN - Optional.
66
- * @param {'true' | 'false'} data.SigOnFile - Optional.
67
- * @param {'true' | 'false'} data.IsNotPerson - Optional.
68
- * @param {'true' | 'false'} data.IsHiddenReport - Optional.
69
- * @param {string} data.Birthdate - Optional.
70
- * @param {string} data.SchedNote - Optional.
71
- * @param {string} data.PreferredName - Optional.
72
- * @returns {Promise<Provider>} - The created PatField.
56
+ * @param {string} [data.LName] - Optional.
57
+ * @param {string} [data.FName] - Optional.
58
+ * @param {string} [data.MI] - Optional.
59
+ * @param {string} [data.Suffix] - Optional.
60
+ * @param {number} [data.FeeSched] - Optional.
61
+ * @param {number} [data.Specialty] - Optional.
62
+ * @param {string} [data.SSN] - Optional.
63
+ * @param {'true' | 'false'} [data.IsSecondary] - Optional.
64
+ * @param {'true' | 'false'} [data.IsHidden] - Optional.
65
+ * @param {'true' | 'false'} [data.UsingTIN] - Optional.
66
+ * @param {'true' | 'false'} [data.SigOnFile] - Optional.
67
+ * @param {'true' | 'false'} [data.IsNotPerson] - Optional.
68
+ * @param {'true' | 'false'} [data.IsHiddenReport] - Optional.
69
+ * @param {string} [data.Birthdate] - Optional.
70
+ * @param {string} [data.SchedNote] - Optional.
71
+ * @param {string} [data.PreferredName] - Optional.
72
+ * @returns {Promise<Provider>} - The created provider.
73
73
  * @throws {Error} - If the data is invalid or the API returns an error.
74
74
  */
75
75
  public async createProvider({
@@ -118,25 +118,25 @@ export default class Providers {
118
118
  /**
119
119
  * Update a provider.
120
120
  * @param {number} ProvNum - The ID of the provider.
121
- * @param {Object} data - The data for the new patfield.
122
- * @param {string} data.Abbr - Optional but must not be blank.
123
- * @param {string} data.LName - Optional.
124
- * @param {string} data.FName - Optional.
125
- * @param {string} data.MI - Optional.
126
- * @param {string} data.Suffix - Optional.
127
- * @param {number} data.FeeSched - Optional.
128
- * @param {number} data.Specialty - Optional.
129
- * @param {string} data.SSN - Optional.
130
- * @param {'true' | 'false'} data.IsSecondary - Optional.
131
- * @param {'true' | 'false'} data.IsHidden - Optional.
132
- * @param {'true' | 'false'} data.UsingTIN - Optional.
133
- * @param {'true' | 'false'} data.SigOnFile - Optional.
134
- * @param {'true' | 'false'} data.IsNotPerson - Optional.
135
- * @param {'true' | 'false'} data.IsHiddenReport - Optional.
136
- * @param {string} data.Birthdate - Optional.
137
- * @param {string} data.SchedNote - Optional.
138
- * @param {string} data.PreferredName - Optional.
139
- * @returns {Promise<Provider>} - The created PatField.
121
+ * @param {Object} data - The data for a provider.
122
+ * @param {string} [data.Abbr] - Optional but must not be blank.
123
+ * @param {string} [data.LName] - Optional.
124
+ * @param {string} [data.FName] - Optional.
125
+ * @param {string} [data.MI] - Optional.
126
+ * @param {string} [data.Suffix] - Optional.
127
+ * @param {number} [data.FeeSched] - Optional.
128
+ * @param {number} [data.Specialty] - Optional.
129
+ * @param {string} [data.SSN] - Optional.
130
+ * @param {'true' | 'false'} [data.IsSecondary] - Optional.
131
+ * @param {'true' | 'false'} [data.IsHidden] - Optional.
132
+ * @param {'true' | 'false'} [data.UsingTIN] - Optional.
133
+ * @param {'true' | 'false'} [data.SigOnFile] - Optional.
134
+ * @param {'true' | 'false'} [data.IsNotPerson] - Optional.
135
+ * @param {'true' | 'false'} [data.IsHiddenReport] - Optional.
136
+ * @param {string} [data.Birthdate] - Optional.
137
+ * @param {string} [data.SchedNote] - Optional.
138
+ * @param {string} [data.PreferredName] - Optional.
139
+ * @returns {Promise<Provider>} - The updated Provider.
140
140
  * @throws {Error} - If the data is invalid or the API returns an error.
141
141
  */
142
142
  public async updateProvider({
@@ -13,8 +13,8 @@ export default class Schedules {
13
13
 
14
14
  /**
15
15
  * Fetch a single Schedule by its ID.
16
- * @param {number} ScheduleNum - The ID of the patfield.
17
- * @returns {Promise<Schedule>} - The patient data.
16
+ * @param {number} ScheduleNum - The ID of a schedule.
17
+ * @returns {Promise<Schedule>} - The schedule data.
18
18
  * @throws {Error} - If `PatNum` is not valid or the API returns an error.
19
19
  */
20
20
  public async getSchedule(ScheduleNum: number): Promise<Schedule> {
@@ -26,7 +26,7 @@ export default class Schedules {
26
26
  }
27
27
 
28
28
  /**
29
- * Fetch multiple patients with optional filtering and pagination.
29
+ * Fetch multiple schedules with optional filtering and pagination.
30
30
  * @param {Object} params - Filtering and pagination parameters.
31
31
  * @param {string} [params.date] - Optional: For a single day. Today's date by default.
32
32
  * @param {string} [params.dateStart] - Optional: For a single day. Today's date by default.
@@ -36,7 +36,7 @@ export default class Schedules {
36
36
  * @param {number} [params.ProvNum] - FK to provider.ProvNum.
37
37
  * @param {number} [params.EmployeeNum] - FK to employee.EmployeeNum.
38
38
  * @param {number} [params.Offset] - Pagination offset.
39
- * @returns {Promise<Schedule[]>} - A list of summarized patient data.
39
+ * @returns {Promise<Schedule[]>} - A list of schedules.
40
40
  * @throws {Error} - If the API returns an error.
41
41
  */
42
42
  public async getSchedules({
@@ -6,7 +6,6 @@ import {
6
6
  UpdateTreatmentPlanParams,
7
7
  SaveTreatmentPlanParams,
8
8
  } from "../types/treatPlanTypes";
9
- import { updateProcedureLogParams } from "../types/procedurelogTypes";
10
9
 
11
10
  export default class TreatmentPlans {
12
11
  private httpClient: HttpClient;
@@ -21,7 +20,7 @@ export default class TreatmentPlans {
21
20
  * @param {string} [params.PatNum] - patient.PatNum.
22
21
  * @param {string} [params.SecDateTEdit] - Only include TreatPlans with a SecDateTEdit altered after the specified date and time. String in "yyyy-MM-dd HH:mm:ss" format.
23
22
  * @param {"Saved" | "Active" | "Inactive"} [params.TPStatus] - Either "Saved", "Active", or "Inactive". Default all.
24
- * @returns {Promise<TreatmentPlan[]>} - An array of recall list objects.
23
+ * @returns {Promise<TreatmentPlan[]>} - An array of treatplan objects.
25
24
  */
26
25
  public async getTreatmentPlans({
27
26
  PatNum,
@@ -39,12 +38,12 @@ export default class TreatmentPlans {
39
38
 
40
39
  /**
41
40
  * Create a new TreatPlan.
42
- * @param {Object} data - Data for the new appointment.
41
+ * @param {Object} data - Data for the new treatment plan.
43
42
  * @param {number} data.PatNum - Required. FK to patient.PatNum.
44
43
  * @param {string} [data.Heading] - Optional. Defaults to the heading of the supplied Treatment Plan.
45
44
  * @param {string} [data.Note] - Optional: An administrative note for staff use.
46
45
  * @param {"Insurance" | "Discount"} [params.TPType] - Optional. Either "Insurance" or "Discount". If the patient is subscribed to a Discount Plan, this will default to "Discount". Otherwise, defaults to "Insurance".
47
- * @returns {Promise<TreatmentPlan>} - The created recall object.
46
+ * @returns {Promise<TreatmentPlan>} - The created treatment plan object.
48
47
  * @throws {Error} - If required fields are missing.
49
48
  */
50
49
  public async createTreatmentPlan(data: CreateTreatmentPlanParams): Promise<TreatmentPlan> {
@@ -57,11 +56,11 @@ export default class TreatmentPlans {
57
56
 
58
57
  /**
59
58
  * Creates an unsigned Saved TreatPlan from an existing Active or Inactive TreatPlan.
60
- * @param {Object} data - Data for the new appointment.
59
+ * @param {Object} data - Data for saved treatment plan.
61
60
  * @param {number} data.TreatPlanNum - Required.
62
61
  * @param {string} [data.Heading] - Optional. Defaults to the heading of the supplied Treatment Plan.
63
62
  * @param {string} [data.UserNumPresenter=0] - Optional. FK to userod.UserNum. Default 0.
64
- * @returns {Promise<TreatmentPlan>} - The created recall object.
63
+ * @returns {Promise<TreatmentPlan>} - The saved treatment plan object.
65
64
  * @throws {Error} - If required fields are missing.
66
65
  */
67
66
  public async saveTreatmentPlan(data: SaveTreatmentPlanParams): Promise<TreatmentPlan> {
@@ -73,10 +72,10 @@ export default class TreatmentPlans {
73
72
  }
74
73
 
75
74
  /**
76
- * Create a new TreatPlan.
77
- * @param {Object} data - Data for the new appointment.
75
+ * Update a TreatPlan.
76
+ * @param {Object} data - Data for the treatplan.
78
77
  * @param {number} data.TreatPlanNum - Required.
79
- * @param {string} [data.Heading] - The heading that shows at the top of the treatment plan.
78
+ * @param {string} [data.Heading] - Optional. The heading that shows at the top of the treatment plan.
80
79
  * @param {string} [data.Note] - Optional: An administrative note for staff use.
81
80
  * @param {number} [data.ResponsParty] - FK to patient.PatNum. The patient responsible for approving the treatment.
82
81
  * @param {"Insurance" | "Discount"} [params.TPType] - Optional. Either "Insurance" or "Discount". If the patient is subscribed to a Discount Plan, this will default to "Discount". Otherwise, defaults to "Insurance".
@@ -84,7 +83,7 @@ export default class TreatmentPlans {
84
83
  * @param {string} [data.SignaturePracticeText] - The typed name of the person who signed the patient signature.
85
84
  * @param {"true" | "false"} [data.isSigned] - The typed name of the person who signed the patient signature.
86
85
  * @param {"true" | "false"} [data.isSignedPractice] - Either "true" or "false". True updates the treatplan SignaturePractice, digitally signs for the practice, and overwrites existing signature. False clears the exisiting treatplan SignaturePractice.
87
- * @returns {Promise<TreatmentPlan>} - The created recall object.
86
+ * @returns {Promise<TreatmentPlan>} - The updated treatplan object.
88
87
  * @throws {Error} - If required fields are missing.
89
88
  */
90
89
  public async updateTreatmentPlan(data: UpdateTreatmentPlanParams): Promise<TreatmentPlan> {
package/src/openDental.ts CHANGED
@@ -10,6 +10,9 @@ import TreatmentPlans from "./api/treatplans";
10
10
  import Schedules from "./api/schedules";
11
11
  import Providers from "./api/providers";
12
12
  import Operatories from "./api/operatories";
13
+ import Payments from "./api/payments";
14
+ import Definitions from "./api/definitions";
15
+ import DiscountPlanSubs from "./api/discountPlanSubs";
13
16
 
14
17
  class OpenDental {
15
18
  private static httpClient: HttpClient;
@@ -120,7 +123,7 @@ class OpenDental {
120
123
  }
121
124
 
122
125
  /**
123
- * Create a new instance of the Schedules API.
126
+ * Create a new instance of the Providers API.
124
127
  */
125
128
  public static Providers() {
126
129
  if (!this.httpClient) {
@@ -130,7 +133,7 @@ class OpenDental {
130
133
  }
131
134
 
132
135
  /**
133
- * Create a new instance of the Schedules API.
136
+ * Create a new instance of the Operatories API.
134
137
  */
135
138
  public static Operatories() {
136
139
  if (!this.httpClient) {
@@ -138,6 +141,35 @@ class OpenDental {
138
141
  }
139
142
  return new Operatories(this.httpClient);
140
143
  }
144
+
145
+ /**
146
+ * Create a new instance of the Payments API.
147
+ */
148
+ public static Payments() {
149
+ if (!this.httpClient) {
150
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
151
+ }
152
+ return new Payments(this.httpClient);
153
+ }
154
+
155
+ /**
156
+ * Create a new instance of the Definitions API.
157
+ */
158
+ public static Definitions() {
159
+ if (!this.httpClient) {
160
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
161
+ }
162
+ return new Definitions(this.httpClient);
163
+ }
164
+ /**
165
+ * Create a new instance of the DiscountPlanSubs API.
166
+ */
167
+ public static DiscountPlanSubs() {
168
+ if (!this.httpClient) {
169
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
170
+ }
171
+ return new DiscountPlanSubs(this.httpClient);
172
+ }
141
173
  }
142
174
 
143
175
  export { OpenDental };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Represents a definition in the Open Dental system.
3
+ * Used in multiple definition-related endpoints.
4
+ * @see https://www.opendental.com/site/apidefinitions.html
5
+ */
6
+ export interface Definition {
7
+ DefNum?: number; //PK
8
+ ItemName?: string; //
9
+ ItemValue?: string; //
10
+ Category?: number; //
11
+ category?: string; //
12
+ isHidden?: 'true' | 'false'; //
13
+ }
14
+
15
+ /**
16
+ * Parameters for GET Definitions.
17
+ * @see https://www.opendental.com/site/apidefinitions.html
18
+ */
19
+ export interface GetDefinitionsParams {
20
+ Category?: number; //definition.DefNum where definition.Category=10. Defaults to the ApiPaymentType preference.
21
+ includeHidden?: 'true' | 'false'; //optional parameter that defaults to false.
22
+ Offset?: number; // Pagination offset for results
23
+ }
24
+
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Represents a subscription to a discount plan in the Open Dental system.
3
+ * @see https://www.opendental.com/site/apidiscountplansubs.html
4
+ */
5
+ export interface DiscountPlanSub {
6
+ DiscountSubNum?: number; //PK
7
+ DiscountPlanNum?: number; //FK to discount plan
8
+ PatNum?: number; //FK to patient
9
+ DateEffective?: string; //String in "yyyy-MM-dd" format.
10
+ DateTerm?: string; //String in "yyyy-MM-dd" format.
11
+ SubNote?: string; //
12
+ }
13
+
14
+ /**
15
+ * Parameters for GET discount plan subs.
16
+ * @see https://www.opendental.com/site/apidiscountplansubs.html
17
+ */
18
+ export interface GetDiscountPlanSubsParams {
19
+ PatNum?: number; // FK to patient.PatNum.
20
+ Offset?: number; // Pagination offset for results
21
+ }
22
+
23
+ /**
24
+ * Parameters for creating a discount plan sub.
25
+ * @see https://www.opendental.com/site/apidiscountplansubs.html
26
+ */
27
+ export interface CreateDiscountPlanSubParams {
28
+ PatNum: number; //FK to patient
29
+ DiscountPlanNum: number; //FK to discount plan
30
+ DateEffective?: string; //Optional. String in "yyyy-MM-dd" format. The date when the plan will start impacting procedure fees. Default "0001-01-01" to indicate the beginning of the current calendar year.
31
+ DateTerm?: string; //Optional. String in "yyyy-MM-dd" format. The date when the plan will no longer impact procedure fees. Default "0001-01-01" to indicate no end date.
32
+ SubNote?: string; //Optional. Subscriber note.
33
+ }
34
+
35
+ /**
36
+ * Parameters for updating a discount plan sub.
37
+ * @see https://www.opendental.com/site/apidiscountplansubs.html
38
+ */
39
+ export interface UpdateDiscountPlanSubParams {
40
+ DiscountSubNum: number; //PK
41
+ PatNum: string; //FK to patient
42
+ DateEffective?: string; //Optional. String in "yyyy-MM-dd" format. The date when the plan will start impacting procedure fees. Default "0001-01-01" to indicate the beginning of the current calendar year.
43
+ DateTerm?: string; //Optional. String in "yyyy-MM-dd" format. The date when the plan will no longer impact procedure fees. Default "0001-01-01" to indicate no end date.
44
+ SubNote?: string; //Optional. Subscriber note.
45
+ }
46
+
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Represents an appointment in the Open Dental system.
3
+ * Used in multiple appointment-related endpoints.
4
+ * @see https://www.opendental.com/site/apipayments.html
5
+ */
6
+ export interface Payment {
7
+ PayNum?: number; //PK
8
+ PayType?: number; //definition.DefNum where definition.Category=10. Defaults to the ApiPaymentType preference.
9
+ payType?: string; //
10
+ PayDate?: string; //String in "yyyy-MM-dd" format. Defaults to today's date. Follows the office's preference to allow future-dated payments.
11
+ PayAmt?: string; //
12
+ CheckNum?: string; //
13
+ BankBranch?: string; //
14
+ PayNote?: string; //
15
+ PatNum?: number; //FK to patient.PatNum.
16
+ ClinicNum?: string; //
17
+ DateEntry?: string; //
18
+ DepositNum?: number; //
19
+ Receipt?: string; //
20
+ IsRecurringCC?: 'true' | 'false'; //
21
+ PaymentSource?: string; //
22
+ ProcessStatus?: string; //
23
+ RecurringChargeDate?: string; //
24
+ IsCcCompleted?: 'true' | 'false'; //
25
+ serverDateTime?: string; //
26
+ }
27
+
28
+ /**
29
+ * Parameters for GET Payments.
30
+ * @see https://www.opendental.com/site/apipayments.html
31
+ */
32
+ export interface GetPaymentsParams {
33
+ PayType?: number; //definition.DefNum where definition.Category=10. Defaults to the ApiPaymentType preference.
34
+ PatNum?: number; //FK to patient.PatNum.
35
+ DateEntry?: string; //String in "yyyy-MM-dd" format. Gets all payments made on or after a certain date.
36
+ Offset?: number; // Pagination offset for results
37
+ }
38
+
39
+ /**
40
+ * Parameters for creating a payment.
41
+ * @see https://www.opendental.com/site/apipayments.html
42
+ */
43
+ export interface CreatePaymentParams {
44
+ PatNum: number; //Required. FK to patient.PatNum.
45
+ PayAmt: string; //String amount of payment as 0.00 (float.toString())
46
+ PayType?: number; //definition.DefNum where definition.Category=10. Defaults to the ApiPaymentType preference.
47
+ PayDate?: string; //String in "yyyy-MM-dd" format. Defaults to today's date. Follows the office's preference to allow future-dated payments.
48
+ CheckNum?: string; //
49
+ PayNote?: string; //
50
+ BankBranch?: string; //
51
+ ClinicNum?: string; //Defaults to patient.ClinicNum
52
+ isPatientPreferred?: 'true' | 'false'; //When entering a payment through Open Dental directly, there is a checkbox for this option. This API field allows the same functionality. It causes the splits to go to the patient instead of being split among family members on a FIFO basis. Default "false".
53
+ isPrepayment?: 'true' | 'false'; //Creates a single paysplit using the default unearned type for unallocated paysplits stored in the PrepaymentUnearnedType preference. See also Unearned / Prepayment. Default "false".
54
+ procNums?: number[]; //An array of ProcNums, in [1,2,3] format to apply this Payment to. Procedures are paid by Procedure.ProcDate on a FIFO basis. Procedures not in the Patient's family will be silently ignored. Ignored if isPrepayment is set to "true". Default is an empty array.
55
+ payPlanNum?: number; //FK to payplan.PayPlanNum for a Dynamic Payment Plan. Only allowed if isPrepayment is "true" prior to version 23.3.4. Default 0.
56
+ }
57
+
58
+ /**
59
+ * Parameters for updating a payment.
60
+ * @see https://www.opendental.com/site/apipayments.html
61
+ */
62
+ export interface UpdatePaymentParams {
63
+ PayNum: number; //Required PK
64
+ PayType?: number; //definition.DefNum where definition.Category=10. Defaults to the ApiPaymentType preference.
65
+ CheckNum?: string; //
66
+ BankBranch?: string; //
67
+ PayNote?: string; //
68
+ ProcessStatus?: 'OnlineProcessed' | 'OnlinePending'; //Indicates whether a payment came from in office or online, and if the online payment is processed or pending. Either "OnlineProcessed" or "OnlinePending".
69
+ }
70
+