@rinse-dental/open-dental 3.3.0 → 3.3.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.
- package/dist/api/payPlanCharges.d.ts +18 -0
- package/dist/api/payPlanCharges.d.ts.map +1 -0
- package/dist/api/payPlanCharges.js +34 -0
- package/dist/api/payPlans.d.ts +9 -2
- package/dist/api/payPlans.d.ts.map +1 -1
- package/dist/api/payPlans.js +6 -5
- package/dist/openDental.d.ts +5 -0
- package/dist/openDental.d.ts.map +1 -1
- package/dist/openDental.js +10 -0
- package/dist/types/payPlanChargeTypes.d.ts +57 -0
- package/dist/types/payPlanChargeTypes.d.ts.map +1 -0
- package/dist/types/payPlanChargeTypes.js +32 -0
- package/package.json +1 -1
- package/src/api/payPlanCharges.ts +49 -0
- package/src/api/payPlans.ts +6 -6
- package/src/openDental.ts +11 -0
- package/src/types/payPlanChargeTypes.ts +77 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import HttpClient from "../utils/httpClient";
|
|
2
|
+
import { PayPlanCharge } from "../types/payPlanChargeTypes";
|
|
3
|
+
export default class PayPlanCharges {
|
|
4
|
+
private httpClient;
|
|
5
|
+
constructor(httpClient: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* Fetch all payment plan charges for a specified payment plan.
|
|
8
|
+
* Mirrors GET /payplancharges
|
|
9
|
+
* Added in version 23.2.28
|
|
10
|
+
*
|
|
11
|
+
* @see https://www.opendental.com/site/apipayplancharges.html
|
|
12
|
+
* @param params - Query parameters: { PayPlanNum: number } (required)
|
|
13
|
+
*/
|
|
14
|
+
getPayPlanCharges(params: {
|
|
15
|
+
PayPlanNum: number;
|
|
16
|
+
}): Promise<PayPlanCharge[]>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=payPlanCharges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payPlanCharges.d.ts","sourceRoot":"","sources":["../../src/api/payPlanCharges.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAS5D,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;;;OAOG;IACU,iBAAiB,CAC5B,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAC7B,OAAO,CAAC,aAAa,EAAE,CAAC;CAoB5B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 PayPlanCharges {
|
|
8
|
+
httpClient;
|
|
9
|
+
constructor(httpClient) {
|
|
10
|
+
this.httpClient = httpClient;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Fetch all payment plan charges for a specified payment plan.
|
|
14
|
+
* Mirrors GET /payplancharges
|
|
15
|
+
* Added in version 23.2.28
|
|
16
|
+
*
|
|
17
|
+
* @see https://www.opendental.com/site/apipayplancharges.html
|
|
18
|
+
* @param params - Query parameters: { PayPlanNum: number } (required)
|
|
19
|
+
*/
|
|
20
|
+
async getPayPlanCharges(params) {
|
|
21
|
+
// Validate required parameter
|
|
22
|
+
if (!params || typeof params !== "object") {
|
|
23
|
+
throw new Error("Invalid parameters: getPayPlanCharges requires a params object.");
|
|
24
|
+
}
|
|
25
|
+
if (!params.PayPlanNum || typeof params.PayPlanNum !== "number") {
|
|
26
|
+
throw new Error("Invalid parameter: PayPlanNum is required and must be a number.");
|
|
27
|
+
}
|
|
28
|
+
const query = clean({
|
|
29
|
+
PayPlanNum: params.PayPlanNum,
|
|
30
|
+
});
|
|
31
|
+
return this.httpClient.get("/payplancharges", query);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = PayPlanCharges;
|
package/dist/api/payPlans.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import HttpClient from "../utils/httpClient";
|
|
2
|
-
import { PayPlan,
|
|
2
|
+
import { PayPlan, GetPayPlanByIdParams, CreateDynamicPayPlanParams, CreatePayPlanParams, ClosePayPlanParams, UpdateDynamicPayPlanParams } from "../types/payPlanTypes";
|
|
3
3
|
export default class PayPlans {
|
|
4
4
|
private httpClient;
|
|
5
5
|
constructor(httpClient: HttpClient);
|
|
@@ -7,8 +7,15 @@ export default class PayPlans {
|
|
|
7
7
|
* Fetch multiple payment plans with filtering by PatNum or Guarantor.
|
|
8
8
|
* Mirrors GET /payplans
|
|
9
9
|
* @see https://www.opendental.com/site/apipayplans.html
|
|
10
|
+
* @param params - Query parameters: { PatNum: number } OR { Guarantor: number } (mutually exclusive, one required)
|
|
10
11
|
*/
|
|
11
|
-
getPayPlans(params
|
|
12
|
+
getPayPlans(params: {
|
|
13
|
+
PatNum: number;
|
|
14
|
+
Guarantor?: never;
|
|
15
|
+
} | {
|
|
16
|
+
Guarantor: number;
|
|
17
|
+
PatNum?: never;
|
|
18
|
+
}): Promise<PayPlan[]>;
|
|
12
19
|
/**
|
|
13
20
|
* Fetch a single payment plan by PayPlanNum.
|
|
14
21
|
* Mirrors GET /payplans/{PayPlanNum}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payPlans.d.ts","sourceRoot":"","sources":["../../src/api/payPlans.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,OAAO,EACP,
|
|
1
|
+
{"version":3,"file":"payPlans.d.ts","sourceRoot":"","sources":["../../src/api/payPlans.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAC;AAS/B,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;OAKG;IACU,WAAW,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAsBnI;;;;OAIG;IACU,UAAU,CAAC,EACtB,UAAU,GACX,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IAO1C;;;;;;;;;;;OAWG;IACU,oBAAoB,CAC/B,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,OAAO,CAAC;IA4DnB;;;;;;;;;;;OAWG;IACU,aAAa,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAuDvE;;;;OAIG;IACU,YAAY,CAAC,EACxB,UAAU,GACX,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAaxC;;;;;;OAMG;IACU,oBAAoB,CAC/B,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,OAAO,CAAC;CAoCpB"}
|
package/dist/api/payPlans.js
CHANGED
|
@@ -13,18 +13,19 @@ class PayPlans {
|
|
|
13
13
|
* Fetch multiple payment plans with filtering by PatNum or Guarantor.
|
|
14
14
|
* Mirrors GET /payplans
|
|
15
15
|
* @see https://www.opendental.com/site/apipayplans.html
|
|
16
|
+
* @param params - Query parameters: { PatNum: number } OR { Guarantor: number } (mutually exclusive, one required)
|
|
16
17
|
*/
|
|
17
|
-
async getPayPlans(params
|
|
18
|
+
async getPayPlans(params) {
|
|
18
19
|
// API requires either PatNum OR Guarantor, not both
|
|
19
|
-
if (params.PatNum && params.Guarantor) {
|
|
20
|
+
if ('PatNum' in params && 'Guarantor' in params && params.PatNum && params.Guarantor) {
|
|
20
21
|
throw new Error("Invalid parameters: PatNum and Guarantor are mutually exclusive. Provide only one.");
|
|
21
22
|
}
|
|
22
|
-
if (!
|
|
23
|
+
if (!('PatNum' in params) && !('Guarantor' in params)) {
|
|
23
24
|
throw new Error("Invalid parameters: Either PatNum or Guarantor is required.");
|
|
24
25
|
}
|
|
25
26
|
const query = clean({
|
|
26
|
-
PatNum: params.PatNum,
|
|
27
|
-
Guarantor: params.Guarantor,
|
|
27
|
+
PatNum: 'PatNum' in params ? params.PatNum : undefined,
|
|
28
|
+
Guarantor: 'Guarantor' in params ? params.Guarantor : undefined,
|
|
28
29
|
});
|
|
29
30
|
return this.httpClient.get("/payplans", query);
|
|
30
31
|
}
|
package/dist/openDental.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import Operatories from "./api/operatories";
|
|
|
13
13
|
import Payments from "./api/payments";
|
|
14
14
|
import PaySplits from "./api/paySplits";
|
|
15
15
|
import PayPlans from "./api/payPlans";
|
|
16
|
+
import PayPlanCharges from "./api/payPlanCharges";
|
|
16
17
|
import Definitions from "./api/definitions";
|
|
17
18
|
import DiscountPlans from "./api/discountPlans";
|
|
18
19
|
import DiscountPlanSubs from "./api/discountPlanSubs";
|
|
@@ -166,6 +167,10 @@ declare class OpenDental {
|
|
|
166
167
|
* Create a new instance of the PayPlans API.
|
|
167
168
|
*/
|
|
168
169
|
static PayPlans(): PayPlans;
|
|
170
|
+
/**
|
|
171
|
+
* Create a new instance of the PayPlanCharges API.
|
|
172
|
+
*/
|
|
173
|
+
static PayPlanCharges(): PayPlanCharges;
|
|
169
174
|
/**
|
|
170
175
|
* Create a new instance of the Fees API.
|
|
171
176
|
*/
|
package/dist/openDental.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openDental.d.ts","s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AAY;IAO1B;;SAEK;WACS,SAAS;IAOvB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,aAAa;IAO3B;;OAEG;WACW,OAAO;IAOrB;;OAEG;WACW,cAAc;IAO5B;;OAEG;WACW,qBAAqB;IAOnC;;OAEG;WACW,SAAS;IAOvB;;OAEG;WACW,SAAS;IAOvB;;OAEG;WACW,WAAW;IAOzB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,WAAW;IAOzB;;OAEG;WACW,aAAa;IAO3B;;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,MAAM;IAOpB;;OAEG;WACW,UAAU;IAOxB;;OAEG;WACW,WAAW;IAOzB;;OAEG;WACW,cAAc;IAO5B;;OAEG;WACW,SAAS;IAOvB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,cAAc;IAO5B;;OAEG;WACW,IAAI;IAOlB;;KAEC;WACa,SAAS;IAOvB;;OAEG;WACW,QAAQ;IAOtB;;OAEG;WACW,SAAS;IAOvB;;OAEG;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"}
|
package/dist/openDental.js
CHANGED
|
@@ -53,6 +53,7 @@ const operatories_1 = __importDefault(require("./api/operatories"));
|
|
|
53
53
|
const payments_1 = __importDefault(require("./api/payments"));
|
|
54
54
|
const paySplits_1 = __importDefault(require("./api/paySplits"));
|
|
55
55
|
const payPlans_1 = __importDefault(require("./api/payPlans"));
|
|
56
|
+
const payPlanCharges_1 = __importDefault(require("./api/payPlanCharges"));
|
|
56
57
|
const definitions_1 = __importDefault(require("./api/definitions"));
|
|
57
58
|
const discountPlans_1 = __importDefault(require("./api/discountPlans"));
|
|
58
59
|
const discountPlanSubs_1 = __importDefault(require("./api/discountPlanSubs"));
|
|
@@ -363,6 +364,15 @@ class OpenDental {
|
|
|
363
364
|
}
|
|
364
365
|
return new payPlans_1.default(this.httpClient);
|
|
365
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* Create a new instance of the PayPlanCharges API.
|
|
369
|
+
*/
|
|
370
|
+
static PayPlanCharges() {
|
|
371
|
+
if (!this.httpClient) {
|
|
372
|
+
throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
|
|
373
|
+
}
|
|
374
|
+
return new payPlanCharges_1.default(this.httpClient);
|
|
375
|
+
}
|
|
366
376
|
/**
|
|
367
377
|
* Create a new instance of the Fees API.
|
|
368
378
|
*/
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PayPlanCharge types for Open Dental REST API
|
|
3
|
+
* Spec refs:
|
|
4
|
+
* - https://www.opendental.com/site/apipayplancharges.html
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* - Dates are strings from the API (yyyy-MM-dd or yyyy-MM-dd HH:mm:ss).
|
|
8
|
+
* - PayPlanCharges represent individual charges within a payment plan
|
|
9
|
+
* - Each charge can be a debit (payment due) or credit (payment received)
|
|
10
|
+
* @see https://www.opendental.com/site/apipayplancharges.html
|
|
11
|
+
*/
|
|
12
|
+
/** Charge type for payment plan charges */
|
|
13
|
+
export type ChargeType = "Debit" | "Credit";
|
|
14
|
+
/** Link type for payment plan charges */
|
|
15
|
+
export type LinkType = "Procedure" | "Adjustment" | "Payment" | "None" | string;
|
|
16
|
+
/**
|
|
17
|
+
* Represents a PayPlanCharge returned by the Open Dental API.
|
|
18
|
+
* Mirrors the response payload of GET endpoints.
|
|
19
|
+
*/
|
|
20
|
+
export interface PayPlanCharge {
|
|
21
|
+
PayPlanChargeNum: number;
|
|
22
|
+
PayPlanNum: number;
|
|
23
|
+
Guarantor: number;
|
|
24
|
+
PatNum: number;
|
|
25
|
+
ChargeDate: string;
|
|
26
|
+
Principal: number;
|
|
27
|
+
Interest: number;
|
|
28
|
+
Note: string;
|
|
29
|
+
ProvNum: number;
|
|
30
|
+
ClinicNum: number;
|
|
31
|
+
ChargeType: ChargeType;
|
|
32
|
+
ProcNum: number;
|
|
33
|
+
SecDateTEntry: string;
|
|
34
|
+
SecDateTEdit: string;
|
|
35
|
+
StatementNum: number;
|
|
36
|
+
FKey: number;
|
|
37
|
+
LinkType: LinkType;
|
|
38
|
+
IsOffset: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** GET /payplancharges query params */
|
|
41
|
+
export interface GetPayPlanChargesParams {
|
|
42
|
+
/** Payment plan number - Required */
|
|
43
|
+
PayPlanNum: number;
|
|
44
|
+
}
|
|
45
|
+
/** Minimal helper to detect "zero" dates in responses */
|
|
46
|
+
export declare const isZeroDate: (d?: string | null) => boolean;
|
|
47
|
+
/** Narrow helper for timestamps that can be zeroed by the API */
|
|
48
|
+
export declare const isZeroDateTime: (d?: string | null) => boolean;
|
|
49
|
+
/** Runtime guard for ChargeType values */
|
|
50
|
+
export declare const isChargeType: (s: string) => s is ChargeType;
|
|
51
|
+
/** Helper to determine if a charge is a debit (payment due) */
|
|
52
|
+
export declare const isDebitCharge: (charge: PayPlanCharge) => boolean;
|
|
53
|
+
/** Helper to determine if a charge is a credit (payment received) */
|
|
54
|
+
export declare const isCreditCharge: (charge: PayPlanCharge) => boolean;
|
|
55
|
+
/** Helper to calculate total charge amount (principal + interest) */
|
|
56
|
+
export declare const getTotalChargeAmount: (charge: PayPlanCharge) => number;
|
|
57
|
+
//# sourceMappingURL=payPlanChargeTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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AElC,+DAA+D;AAC/D,eAAO,MAAM,aAAa,GAAI,QAAQ,aAAa,KAAG,OACvB,CAAC;AAEhC,qEAAqE;AACrE,eAAO,MAAM,cAAc,GAAI,QAAQ,aAAa,KAAG,OACvB,CAAC;AAEjC,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,GAAI,QAAQ,aAAa,KAAG,MACzB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PayPlanCharge types for Open Dental REST API
|
|
4
|
+
* Spec refs:
|
|
5
|
+
* - https://www.opendental.com/site/apipayplancharges.html
|
|
6
|
+
*
|
|
7
|
+
* Notes:
|
|
8
|
+
* - Dates are strings from the API (yyyy-MM-dd or yyyy-MM-dd HH:mm:ss).
|
|
9
|
+
* - PayPlanCharges represent individual charges within a payment plan
|
|
10
|
+
* - Each charge can be a debit (payment due) or credit (payment received)
|
|
11
|
+
* @see https://www.opendental.com/site/apipayplancharges.html
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.getTotalChargeAmount = exports.isCreditCharge = exports.isDebitCharge = exports.isChargeType = 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
|
+
/** Runtime guard for ChargeType values */
|
|
22
|
+
const isChargeType = (s) => ["Debit", "Credit"].includes(s);
|
|
23
|
+
exports.isChargeType = isChargeType;
|
|
24
|
+
/** Helper to determine if a charge is a debit (payment due) */
|
|
25
|
+
const isDebitCharge = (charge) => charge.ChargeType === "Debit";
|
|
26
|
+
exports.isDebitCharge = isDebitCharge;
|
|
27
|
+
/** Helper to determine if a charge is a credit (payment received) */
|
|
28
|
+
const isCreditCharge = (charge) => charge.ChargeType === "Credit";
|
|
29
|
+
exports.isCreditCharge = isCreditCharge;
|
|
30
|
+
/** Helper to calculate total charge amount (principal + interest) */
|
|
31
|
+
const getTotalChargeAmount = (charge) => charge.Principal + charge.Interest;
|
|
32
|
+
exports.getTotalChargeAmount = getTotalChargeAmount;
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/api/payPlanCharges.ts
|
|
2
|
+
import HttpClient from "../utils/httpClient";
|
|
3
|
+
import { PayPlanCharge } from "../types/payPlanChargeTypes";
|
|
4
|
+
|
|
5
|
+
/** Utility to remove undefined fields from objects (for API payloads) */
|
|
6
|
+
const clean = (obj: Record<string, any>): Record<string, any> => {
|
|
7
|
+
return Object.fromEntries(
|
|
8
|
+
Object.entries(obj).filter(([_, v]) => v !== undefined)
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default class PayPlanCharges {
|
|
13
|
+
private httpClient: HttpClient;
|
|
14
|
+
|
|
15
|
+
constructor(httpClient: HttpClient) {
|
|
16
|
+
this.httpClient = httpClient;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Fetch all payment plan charges for a specified payment plan.
|
|
21
|
+
* Mirrors GET /payplancharges
|
|
22
|
+
* Added in version 23.2.28
|
|
23
|
+
*
|
|
24
|
+
* @see https://www.opendental.com/site/apipayplancharges.html
|
|
25
|
+
* @param params - Query parameters: { PayPlanNum: number } (required)
|
|
26
|
+
*/
|
|
27
|
+
public async getPayPlanCharges(
|
|
28
|
+
params: { PayPlanNum: number }
|
|
29
|
+
): Promise<PayPlanCharge[]> {
|
|
30
|
+
// Validate required parameter
|
|
31
|
+
if (!params || typeof params !== "object") {
|
|
32
|
+
throw new Error(
|
|
33
|
+
"Invalid parameters: getPayPlanCharges requires a params object."
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!params.PayPlanNum || typeof params.PayPlanNum !== "number") {
|
|
38
|
+
throw new Error(
|
|
39
|
+
"Invalid parameter: PayPlanNum is required and must be a number."
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const query = clean({
|
|
44
|
+
PayPlanNum: params.PayPlanNum,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return this.httpClient.get<PayPlanCharge[]>("/payplancharges", query);
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/api/payPlans.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import HttpClient from "../utils/httpClient";
|
|
3
3
|
import {
|
|
4
4
|
PayPlan,
|
|
5
|
-
GetPayPlansParams,
|
|
6
5
|
GetPayPlanByIdParams,
|
|
7
6
|
CreateDynamicPayPlanParams,
|
|
8
7
|
CreatePayPlanParams,
|
|
@@ -28,24 +27,25 @@ export default class PayPlans {
|
|
|
28
27
|
* Fetch multiple payment plans with filtering by PatNum or Guarantor.
|
|
29
28
|
* Mirrors GET /payplans
|
|
30
29
|
* @see https://www.opendental.com/site/apipayplans.html
|
|
30
|
+
* @param params - Query parameters: { PatNum: number } OR { Guarantor: number } (mutually exclusive, one required)
|
|
31
31
|
*/
|
|
32
|
-
public async getPayPlans(params:
|
|
32
|
+
public async getPayPlans(params: { PatNum: number; Guarantor?: never } | { Guarantor: number; PatNum?: never }): Promise<PayPlan[]> {
|
|
33
33
|
// API requires either PatNum OR Guarantor, not both
|
|
34
|
-
if (params.PatNum && params.Guarantor) {
|
|
34
|
+
if ('PatNum' in params && 'Guarantor' in params && params.PatNum && params.Guarantor) {
|
|
35
35
|
throw new Error(
|
|
36
36
|
"Invalid parameters: PatNum and Guarantor are mutually exclusive. Provide only one."
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
if (!
|
|
40
|
+
if (!('PatNum' in params) && !('Guarantor' in params)) {
|
|
41
41
|
throw new Error(
|
|
42
42
|
"Invalid parameters: Either PatNum or Guarantor is required."
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const query = clean({
|
|
47
|
-
PatNum: params.PatNum,
|
|
48
|
-
Guarantor: params.Guarantor,
|
|
47
|
+
PatNum: 'PatNum' in params ? params.PatNum : undefined,
|
|
48
|
+
Guarantor: 'Guarantor' in params ? params.Guarantor : undefined,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
return this.httpClient.get<PayPlan[]>("/payplans", query);
|
package/src/openDental.ts
CHANGED
|
@@ -14,6 +14,7 @@ import Operatories from "./api/operatories";
|
|
|
14
14
|
import Payments from "./api/payments";
|
|
15
15
|
import PaySplits from "./api/paySplits";
|
|
16
16
|
import PayPlans from "./api/payPlans";
|
|
17
|
+
import PayPlanCharges from "./api/payPlanCharges";
|
|
17
18
|
import Definitions from "./api/definitions";
|
|
18
19
|
import DiscountPlans from "./api/discountPlans";
|
|
19
20
|
import DiscountPlanSubs from "./api/discountPlanSubs";
|
|
@@ -361,6 +362,16 @@ class OpenDental {
|
|
|
361
362
|
return new PayPlans(this.httpClient);
|
|
362
363
|
}
|
|
363
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Create a new instance of the PayPlanCharges API.
|
|
367
|
+
*/
|
|
368
|
+
public static PayPlanCharges() {
|
|
369
|
+
if (!this.httpClient) {
|
|
370
|
+
throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
|
|
371
|
+
}
|
|
372
|
+
return new PayPlanCharges(this.httpClient);
|
|
373
|
+
}
|
|
374
|
+
|
|
364
375
|
/**
|
|
365
376
|
* Create a new instance of the Fees API.
|
|
366
377
|
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PayPlanCharge types for Open Dental REST API
|
|
3
|
+
* Spec refs:
|
|
4
|
+
* - https://www.opendental.com/site/apipayplancharges.html
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* - Dates are strings from the API (yyyy-MM-dd or yyyy-MM-dd HH:mm:ss).
|
|
8
|
+
* - PayPlanCharges represent individual charges within a payment plan
|
|
9
|
+
* - Each charge can be a debit (payment due) or credit (payment received)
|
|
10
|
+
* @see https://www.opendental.com/site/apipayplancharges.html
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Charge type for payment plan charges */
|
|
14
|
+
export type ChargeType = "Debit" | "Credit";
|
|
15
|
+
|
|
16
|
+
/** Link type for payment plan charges */
|
|
17
|
+
export type LinkType =
|
|
18
|
+
| "Procedure"
|
|
19
|
+
| "Adjustment"
|
|
20
|
+
| "Payment"
|
|
21
|
+
| "None"
|
|
22
|
+
| string; // Open to allow for other types
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Represents a PayPlanCharge returned by the Open Dental API.
|
|
26
|
+
* Mirrors the response payload of GET endpoints.
|
|
27
|
+
*/
|
|
28
|
+
export interface PayPlanCharge {
|
|
29
|
+
PayPlanChargeNum: number; // PK - Unique charge identifier
|
|
30
|
+
PayPlanNum: number; // FK to payplan.PayPlanNum
|
|
31
|
+
Guarantor: number; // FK to patient.PatNum (guarantor)
|
|
32
|
+
PatNum: number; // FK to patient.PatNum
|
|
33
|
+
ChargeDate: string; // "yyyy-MM-dd" - Date of charge
|
|
34
|
+
Principal: number; // Principal amount (decimal)
|
|
35
|
+
Interest: number; // Interest amount (decimal)
|
|
36
|
+
Note: string; // Optional note for the charge
|
|
37
|
+
ProvNum: number; // FK to provider.ProvNum
|
|
38
|
+
ClinicNum: number; // FK to clinic.ClinicNum
|
|
39
|
+
ChargeType: ChargeType; // Type of charge ("Debit" | "Credit")
|
|
40
|
+
ProcNum: number; // FK to procedurelog.ProcNum
|
|
41
|
+
SecDateTEntry: string; // "yyyy-MM-dd HH:mm:ss" - Entry timestamp
|
|
42
|
+
SecDateTEdit: string; // "yyyy-MM-dd HH:mm:ss" - Last edit timestamp
|
|
43
|
+
StatementNum: number; // FK to statement.StatementNum
|
|
44
|
+
FKey: number; // Foreign key reference (context-dependent)
|
|
45
|
+
LinkType: LinkType; // Link type (e.g., "Procedure", "Adjustment")
|
|
46
|
+
IsOffset: boolean; // Whether this is an offset charge
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** GET /payplancharges query params */
|
|
50
|
+
export interface GetPayPlanChargesParams {
|
|
51
|
+
/** Payment plan number - Required */
|
|
52
|
+
PayPlanNum: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Minimal helper to detect "zero" dates in responses */
|
|
56
|
+
export const isZeroDate = (d?: string | null): boolean =>
|
|
57
|
+
!d || d === "0001-01-01";
|
|
58
|
+
|
|
59
|
+
/** Narrow helper for timestamps that can be zeroed by the API */
|
|
60
|
+
export const isZeroDateTime = (d?: string | null): boolean =>
|
|
61
|
+
!d || d.startsWith("0001-01-01");
|
|
62
|
+
|
|
63
|
+
/** Runtime guard for ChargeType values */
|
|
64
|
+
export const isChargeType = (s: string): s is ChargeType =>
|
|
65
|
+
["Debit", "Credit"].includes(s);
|
|
66
|
+
|
|
67
|
+
/** Helper to determine if a charge is a debit (payment due) */
|
|
68
|
+
export const isDebitCharge = (charge: PayPlanCharge): boolean =>
|
|
69
|
+
charge.ChargeType === "Debit";
|
|
70
|
+
|
|
71
|
+
/** Helper to determine if a charge is a credit (payment received) */
|
|
72
|
+
export const isCreditCharge = (charge: PayPlanCharge): boolean =>
|
|
73
|
+
charge.ChargeType === "Credit";
|
|
74
|
+
|
|
75
|
+
/** Helper to calculate total charge amount (principal + interest) */
|
|
76
|
+
export const getTotalChargeAmount = (charge: PayPlanCharge): number =>
|
|
77
|
+
charge.Principal + charge.Interest;
|