-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDevicePaymentPlan.ts
More file actions
54 lines (51 loc) · 2.02 KB
/
Copy pathDevicePaymentPlan.ts
File metadata and controls
54 lines (51 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
export enum PaymentPlanState {
Pending = "pending",
Required = "required",
Active = "active",
Lifetime = "lifetime",
Reviewing = "reviewing",
Invalid = "invalid"
}
export class DevicePaymentPlan {
idx?: number;
deviceId: string;
state: PaymentPlanState | null;
dateStart: Date | null;
stripeSubscriptionId: string | null;
stripeCustomerId: string | null;
storeOrderId: number | null;
paymentCount: number;
paymentDuration: number;
paymentTotal: number;
notes: string | null;
jiraManufacturingKey: string | null;
jiraFulfilmentKey: string | null;
changeUserId: number | null;
createdAt: Date | null;
updatedAt: Date | null;
[key: string]: any; // Allow any additional properties
constructor(initObj: Partial<DevicePaymentPlan> & Record<string, any>) {
this.idx = initObj.idx;
this.deviceId = initObj.deviceId!;
this.state = initObj.state!;
this.dateStart = initObj.dateStart ? new Date(initObj.dateStart) : null;
this.stripeSubscriptionId = initObj.stripeSubscriptionId || null;
this.stripeCustomerId = initObj.stripeCustomerId || null;
this.storeOrderId = initObj.storeOrderId ?? null;
this.paymentCount = initObj.paymentCount ?? 0;
this.paymentDuration = initObj.paymentDuration ?? 0;
this.paymentTotal = initObj.paymentTotal ?? 0;
this.notes = initObj.notes || null;
this.jiraManufacturingKey = initObj.jiraManufacturingKey || null;
this.jiraFulfilmentKey = initObj.jiraFulfilmentKey || null;
this.changeUserId = initObj.changeUserId ?? null;
this.createdAt = initObj.createdAt ? new Date(initObj.createdAt) : null;
this.updatedAt = initObj.updatedAt ? new Date(initObj.updatedAt) : null;
// Assign other properties from initObj to this instance
for (const key in initObj) {
if (initObj.hasOwnProperty(key) && !this.hasOwnProperty(key)) {
this[key] = initObj[key];
}
}
}
}