@voyant-travel/finance 0.138.1 → 0.138.3
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/routes-booking-billing.d.ts +34 -10
- package/dist/routes-booking-billing.d.ts.map +1 -1
- package/dist/routes-booking-billing.js +47 -19
- package/dist/routes-booking-reads.d.ts +4 -3
- package/dist/routes-booking-reads.d.ts.map +1 -1
- package/dist/routes-public.d.ts +8 -6
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes.d.ts +38 -13
- package/dist/routes.d.ts.map +1 -1
- package/dist/service-booking-guarantees.d.ts.map +1 -1
- package/dist/service-booking-guarantees.js +28 -3
- package/dist/service-booking-item-billing.d.ts.map +1 -1
- package/dist/service-booking-item-billing.js +26 -1
- package/dist/service-invoice-core.d.ts.map +1 -1
- package/dist/service-invoice-core.js +24 -2
- package/dist/service-invoice-from-booking.d.ts.map +1 -1
- package/dist/service-invoice-from-booking.js +3 -1
- package/dist/service-invoice-payments.d.ts.map +1 -1
- package/dist/service-invoice-payments.js +4 -1
- package/dist/service-issue.d.ts.map +1 -1
- package/dist/service-issue.js +10 -1
- package/dist/service-payment-sessions.d.ts.map +1 -1
- package/dist/service-payment-sessions.js +16 -1
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +67 -33
- package/dist/service-shared.d.ts +1 -0
- package/dist/service-shared.d.ts.map +1 -1
- package/dist/service-shared.js +5 -0
- package/package.json +5 -5
|
@@ -86,9 +86,13 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
86
86
|
};
|
|
87
87
|
output: {
|
|
88
88
|
error: string;
|
|
89
|
+
code: string;
|
|
90
|
+
details?: {
|
|
91
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
92
|
+
} | undefined;
|
|
89
93
|
};
|
|
90
94
|
outputFormat: "json";
|
|
91
|
-
status:
|
|
95
|
+
status: 400;
|
|
92
96
|
} | {
|
|
93
97
|
input: {
|
|
94
98
|
param: {
|
|
@@ -112,7 +116,7 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
112
116
|
error: string;
|
|
113
117
|
};
|
|
114
118
|
outputFormat: "json";
|
|
115
|
-
status:
|
|
119
|
+
status: 404;
|
|
116
120
|
} | {
|
|
117
121
|
input: {
|
|
118
122
|
param: {
|
|
@@ -164,13 +168,13 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
164
168
|
};
|
|
165
169
|
} & {
|
|
166
170
|
json: {
|
|
171
|
+
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
172
|
+
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
167
173
|
channelId?: string | null | undefined;
|
|
168
174
|
recipientType?: "other" | "supplier" | "channel" | "agency" | "internal" | "affiliate" | "agent" | undefined;
|
|
169
|
-
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
170
175
|
currency?: string | null | undefined;
|
|
171
176
|
amountCents?: number | null | undefined;
|
|
172
177
|
rateBasisPoints?: number | null | undefined;
|
|
173
|
-
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
174
178
|
payableAt?: string | null | undefined;
|
|
175
179
|
paidAt?: string | null | undefined;
|
|
176
180
|
notes?: string | null | undefined;
|
|
@@ -178,9 +182,13 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
178
182
|
};
|
|
179
183
|
output: {
|
|
180
184
|
error: string;
|
|
185
|
+
code: string;
|
|
186
|
+
details?: {
|
|
187
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
188
|
+
} | undefined;
|
|
181
189
|
};
|
|
182
190
|
outputFormat: "json";
|
|
183
|
-
status:
|
|
191
|
+
status: 400;
|
|
184
192
|
} | {
|
|
185
193
|
input: {
|
|
186
194
|
param: {
|
|
@@ -189,13 +197,13 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
189
197
|
};
|
|
190
198
|
} & {
|
|
191
199
|
json: {
|
|
200
|
+
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
201
|
+
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
192
202
|
channelId?: string | null | undefined;
|
|
193
203
|
recipientType?: "other" | "supplier" | "channel" | "agency" | "internal" | "affiliate" | "agent" | undefined;
|
|
194
|
-
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
195
204
|
currency?: string | null | undefined;
|
|
196
205
|
amountCents?: number | null | undefined;
|
|
197
206
|
rateBasisPoints?: number | null | undefined;
|
|
198
|
-
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
199
207
|
payableAt?: string | null | undefined;
|
|
200
208
|
paidAt?: string | null | undefined;
|
|
201
209
|
notes?: string | null | undefined;
|
|
@@ -205,7 +213,7 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
205
213
|
error: string;
|
|
206
214
|
};
|
|
207
215
|
outputFormat: "json";
|
|
208
|
-
status:
|
|
216
|
+
status: 404;
|
|
209
217
|
} | {
|
|
210
218
|
input: {
|
|
211
219
|
param: {
|
|
@@ -214,13 +222,13 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
214
222
|
};
|
|
215
223
|
} & {
|
|
216
224
|
json: {
|
|
225
|
+
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
226
|
+
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
217
227
|
channelId?: string | null | undefined;
|
|
218
228
|
recipientType?: "other" | "supplier" | "channel" | "agency" | "internal" | "affiliate" | "agent" | undefined;
|
|
219
|
-
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
220
229
|
currency?: string | null | undefined;
|
|
221
230
|
amountCents?: number | null | undefined;
|
|
222
231
|
rateBasisPoints?: number | null | undefined;
|
|
223
|
-
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
224
232
|
payableAt?: string | null | undefined;
|
|
225
233
|
paidAt?: string | null | undefined;
|
|
226
234
|
notes?: string | null | undefined;
|
|
@@ -1100,6 +1108,22 @@ export declare const financeBookingBillingRoutes: OpenAPIHono<Env, import("hono/
|
|
|
1100
1108
|
} & {
|
|
1101
1109
|
"/bookings/:bookingId/guarantees/:guaranteeId": {
|
|
1102
1110
|
$delete: {
|
|
1111
|
+
input: {
|
|
1112
|
+
param: {
|
|
1113
|
+
bookingId: string;
|
|
1114
|
+
guaranteeId: string;
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
output: {
|
|
1118
|
+
error: string;
|
|
1119
|
+
code: string;
|
|
1120
|
+
details?: {
|
|
1121
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
1122
|
+
} | undefined;
|
|
1123
|
+
};
|
|
1124
|
+
outputFormat: "json";
|
|
1125
|
+
status: 400;
|
|
1126
|
+
} | {
|
|
1103
1127
|
input: {
|
|
1104
1128
|
param: {
|
|
1105
1129
|
bookingId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-booking-billing.d.ts","sourceRoot":"","sources":["../src/routes-booking-billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAM/D,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"routes-booking-billing.d.ts","sourceRoot":"","sources":["../src/routes-booking-billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAM/D,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AA45BvD,eAAO,MAAM,2BAA2B;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAME,CAAA"}
|
|
@@ -499,6 +499,10 @@ const deleteBookingGuaranteeRoute = createRoute({
|
|
|
499
499
|
description: "Guarantee deleted",
|
|
500
500
|
content: { "application/json": { schema: successResponseSchema } },
|
|
501
501
|
},
|
|
502
|
+
400: {
|
|
503
|
+
description: "invalid_request: guarantee state does not allow deletion",
|
|
504
|
+
content: { "application/json": { schema: paymentValidationErrorSchema } },
|
|
505
|
+
},
|
|
502
506
|
404: {
|
|
503
507
|
description: "Booking guarantee not found",
|
|
504
508
|
content: { "application/json": { schema: errorResponseSchema } },
|
|
@@ -552,16 +556,24 @@ const bookingGuaranteeRoutes = new OpenAPIHono({ defaultHook: openApiValidationH
|
|
|
552
556
|
return c.json({ data: row }, 200);
|
|
553
557
|
})
|
|
554
558
|
.openapi(deleteBookingGuaranteeRoute, async (c) => {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
try {
|
|
560
|
+
const runtime = getFinanceRouteRuntime(c);
|
|
561
|
+
const row = await financeService.deleteBookingGuarantee(c.get("db"), c.req.valid("param").guaranteeId, {
|
|
562
|
+
eventBus: runtime?.eventBus,
|
|
563
|
+
actionLedgerContext: getActionLedgerRequestContext(c),
|
|
564
|
+
actionLedgerAuthorizationSource: "finance.booking_guarantee.route",
|
|
565
|
+
});
|
|
566
|
+
if (!row) {
|
|
567
|
+
return notFound(c, "Booking guarantee not found");
|
|
568
|
+
}
|
|
569
|
+
return c.json({ success: true }, 200);
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
if (error instanceof PaymentValidationError) {
|
|
573
|
+
return c.json({ error: error.message, code: error.code, details: error.details }, 400);
|
|
574
|
+
}
|
|
575
|
+
throw error;
|
|
563
576
|
}
|
|
564
|
-
return c.json({ success: true }, 200);
|
|
565
577
|
});
|
|
566
578
|
// ===========================================================================
|
|
567
579
|
// Booking Item Tax Lines
|
|
@@ -704,7 +716,7 @@ const createBookingItemCommissionRoute = createRoute({
|
|
|
704
716
|
},
|
|
705
717
|
400: {
|
|
706
718
|
description: "invalid_request: request body failed validation",
|
|
707
|
-
content: { "application/json": { schema:
|
|
719
|
+
content: { "application/json": { schema: paymentValidationErrorSchema } },
|
|
708
720
|
},
|
|
709
721
|
404: {
|
|
710
722
|
description: "Booking item not found",
|
|
@@ -731,7 +743,7 @@ const updateBookingItemCommissionRoute = createRoute({
|
|
|
731
743
|
},
|
|
732
744
|
400: {
|
|
733
745
|
description: "invalid_request: request body failed validation",
|
|
734
|
-
content: { "application/json": { schema:
|
|
746
|
+
content: { "application/json": { schema: paymentValidationErrorSchema } },
|
|
735
747
|
},
|
|
736
748
|
404: {
|
|
737
749
|
description: "Booking item commission not found",
|
|
@@ -759,18 +771,34 @@ const bookingItemCommissionRoutes = new OpenAPIHono({ defaultHook: openApiValida
|
|
|
759
771
|
data: await financeService.listBookingItemCommissions(c.get("db"), c.req.valid("param").bookingItemId),
|
|
760
772
|
}, 200))
|
|
761
773
|
.openapi(createBookingItemCommissionRoute, async (c) => {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
774
|
+
try {
|
|
775
|
+
const row = await financeService.createBookingItemCommission(c.get("db"), c.req.valid("param").bookingItemId, c.req.valid("json"));
|
|
776
|
+
if (!row) {
|
|
777
|
+
return notFound(c, "Booking item not found");
|
|
778
|
+
}
|
|
779
|
+
return c.json({ data: row }, 201);
|
|
780
|
+
}
|
|
781
|
+
catch (error) {
|
|
782
|
+
if (error instanceof PaymentValidationError) {
|
|
783
|
+
return c.json({ error: error.message, code: error.code, details: error.details }, 400);
|
|
784
|
+
}
|
|
785
|
+
throw error;
|
|
765
786
|
}
|
|
766
|
-
return c.json({ data: row }, 201);
|
|
767
787
|
})
|
|
768
788
|
.openapi(updateBookingItemCommissionRoute, async (c) => {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
789
|
+
try {
|
|
790
|
+
const row = await financeService.updateBookingItemCommission(c.get("db"), c.req.valid("param").commissionId, c.req.valid("json"));
|
|
791
|
+
if (!row) {
|
|
792
|
+
return notFound(c, "Booking item commission not found");
|
|
793
|
+
}
|
|
794
|
+
return c.json({ data: row }, 200);
|
|
795
|
+
}
|
|
796
|
+
catch (error) {
|
|
797
|
+
if (error instanceof PaymentValidationError) {
|
|
798
|
+
return c.json({ error: error.message, code: error.code, details: error.details }, 400);
|
|
799
|
+
}
|
|
800
|
+
throw error;
|
|
772
801
|
}
|
|
773
|
-
return c.json({ data: row }, 200);
|
|
774
802
|
})
|
|
775
803
|
.openapi(deleteBookingItemCommissionRoute, async (c) => {
|
|
776
804
|
const row = await financeService.deleteBookingItemCommission(c.get("db"), c.req.valid("param").commissionId);
|
|
@@ -29,9 +29,10 @@ export declare const financeBookingReadRoutes: OpenAPIHono<Env, {
|
|
|
29
29
|
bookingId: string;
|
|
30
30
|
payments: {
|
|
31
31
|
id: string;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
source: "payment" | "voucher_redemption";
|
|
33
|
+
invoiceId: string | null;
|
|
34
|
+
invoiceNumber: string | null;
|
|
35
|
+
invoiceType: "invoice" | "proforma" | "credit_note" | null;
|
|
35
36
|
status: "pending" | "completed" | "failed" | "refunded";
|
|
36
37
|
paymentMethod: "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | "voucher" | "other";
|
|
37
38
|
amountCents: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-booking-reads.d.ts","sourceRoot":"","sources":["../src/routes-booking-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAG/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAuB7C,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"routes-booking-reads.d.ts","sourceRoot":"","sources":["../src/routes-booking-reads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAG/D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAuB7C,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAYnC,CAAA"}
|
package/dist/routes-public.d.ts
CHANGED
|
@@ -1124,9 +1124,10 @@ export declare function createPublicFinanceRoutes(options?: PublicFinanceRouteOp
|
|
|
1124
1124
|
bookingId: string;
|
|
1125
1125
|
payments: {
|
|
1126
1126
|
id: string;
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1127
|
+
source: "payment" | "voucher_redemption";
|
|
1128
|
+
invoiceId: string | null;
|
|
1129
|
+
invoiceNumber: string | null;
|
|
1130
|
+
invoiceType: "invoice" | "proforma" | "credit_note" | null;
|
|
1130
1131
|
status: "pending" | "completed" | "failed" | "refunded";
|
|
1131
1132
|
paymentMethod: "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | "voucher" | "other";
|
|
1132
1133
|
amountCents: number;
|
|
@@ -2518,9 +2519,10 @@ export declare const publicFinanceRoutes: OpenAPIHono<Env, import("hono/types").
|
|
|
2518
2519
|
bookingId: string;
|
|
2519
2520
|
payments: {
|
|
2520
2521
|
id: string;
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2522
|
+
source: "payment" | "voucher_redemption";
|
|
2523
|
+
invoiceId: string | null;
|
|
2524
|
+
invoiceNumber: string | null;
|
|
2525
|
+
invoiceType: "invoice" | "proforma" | "credit_note" | null;
|
|
2524
2526
|
status: "pending" | "completed" | "failed" | "refunded";
|
|
2525
2527
|
paymentMethod: "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | "voucher" | "other";
|
|
2526
2528
|
amountCents: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAW/D,OAAO,EAAE,KAAK,GAAG,EAA2B,MAAM,oBAAoB,CAAA;AAqBtE,MAAM,WAAW,yBAAyB;IACxC,0BAA0B,CAAC,EAAE,CAC3B,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAA8B,CAAA;AAE9D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
package/dist/routes.d.ts
CHANGED
|
@@ -2842,9 +2842,13 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2842
2842
|
};
|
|
2843
2843
|
output: {
|
|
2844
2844
|
error: string;
|
|
2845
|
+
code: string;
|
|
2846
|
+
details?: {
|
|
2847
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
2848
|
+
} | undefined;
|
|
2845
2849
|
};
|
|
2846
2850
|
outputFormat: "json";
|
|
2847
|
-
status:
|
|
2851
|
+
status: 400;
|
|
2848
2852
|
} | {
|
|
2849
2853
|
input: {
|
|
2850
2854
|
param: {
|
|
@@ -2868,7 +2872,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2868
2872
|
error: string;
|
|
2869
2873
|
};
|
|
2870
2874
|
outputFormat: "json";
|
|
2871
|
-
status:
|
|
2875
|
+
status: 404;
|
|
2872
2876
|
} | {
|
|
2873
2877
|
input: {
|
|
2874
2878
|
param: {
|
|
@@ -2920,13 +2924,13 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2920
2924
|
};
|
|
2921
2925
|
} & {
|
|
2922
2926
|
json: {
|
|
2927
|
+
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
2928
|
+
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
2923
2929
|
channelId?: string | null | undefined;
|
|
2924
2930
|
recipientType?: "other" | "supplier" | "channel" | "agency" | "internal" | "affiliate" | "agent" | undefined;
|
|
2925
|
-
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
2926
2931
|
currency?: string | null | undefined;
|
|
2927
2932
|
amountCents?: number | null | undefined;
|
|
2928
2933
|
rateBasisPoints?: number | null | undefined;
|
|
2929
|
-
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
2930
2934
|
payableAt?: string | null | undefined;
|
|
2931
2935
|
paidAt?: string | null | undefined;
|
|
2932
2936
|
notes?: string | null | undefined;
|
|
@@ -2934,9 +2938,13 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2934
2938
|
};
|
|
2935
2939
|
output: {
|
|
2936
2940
|
error: string;
|
|
2941
|
+
code: string;
|
|
2942
|
+
details?: {
|
|
2943
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
2944
|
+
} | undefined;
|
|
2937
2945
|
};
|
|
2938
2946
|
outputFormat: "json";
|
|
2939
|
-
status:
|
|
2947
|
+
status: 400;
|
|
2940
2948
|
} | {
|
|
2941
2949
|
input: {
|
|
2942
2950
|
param: {
|
|
@@ -2945,13 +2953,13 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2945
2953
|
};
|
|
2946
2954
|
} & {
|
|
2947
2955
|
json: {
|
|
2956
|
+
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
2957
|
+
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
2948
2958
|
channelId?: string | null | undefined;
|
|
2949
2959
|
recipientType?: "other" | "supplier" | "channel" | "agency" | "internal" | "affiliate" | "agent" | undefined;
|
|
2950
|
-
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
2951
2960
|
currency?: string | null | undefined;
|
|
2952
2961
|
amountCents?: number | null | undefined;
|
|
2953
2962
|
rateBasisPoints?: number | null | undefined;
|
|
2954
|
-
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
2955
2963
|
payableAt?: string | null | undefined;
|
|
2956
2964
|
paidAt?: string | null | undefined;
|
|
2957
2965
|
notes?: string | null | undefined;
|
|
@@ -2961,7 +2969,7 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2961
2969
|
error: string;
|
|
2962
2970
|
};
|
|
2963
2971
|
outputFormat: "json";
|
|
2964
|
-
status:
|
|
2972
|
+
status: 404;
|
|
2965
2973
|
} | {
|
|
2966
2974
|
input: {
|
|
2967
2975
|
param: {
|
|
@@ -2970,13 +2978,13 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
2970
2978
|
};
|
|
2971
2979
|
} & {
|
|
2972
2980
|
json: {
|
|
2981
|
+
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
2982
|
+
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
2973
2983
|
channelId?: string | null | undefined;
|
|
2974
2984
|
recipientType?: "other" | "supplier" | "channel" | "agency" | "internal" | "affiliate" | "agent" | undefined;
|
|
2975
|
-
commissionModel?: "percentage" | "fixed" | "markup" | "net" | undefined;
|
|
2976
2985
|
currency?: string | null | undefined;
|
|
2977
2986
|
amountCents?: number | null | undefined;
|
|
2978
2987
|
rateBasisPoints?: number | null | undefined;
|
|
2979
|
-
status?: "paid" | "void" | "pending" | "accrued" | "payable" | undefined;
|
|
2980
2988
|
payableAt?: string | null | undefined;
|
|
2981
2989
|
paidAt?: string | null | undefined;
|
|
2982
2990
|
notes?: string | null | undefined;
|
|
@@ -3856,6 +3864,22 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
3856
3864
|
} & {
|
|
3857
3865
|
"/bookings/:bookingId/guarantees/:guaranteeId": {
|
|
3858
3866
|
$delete: {
|
|
3867
|
+
input: {
|
|
3868
|
+
param: {
|
|
3869
|
+
bookingId: string;
|
|
3870
|
+
guaranteeId: string;
|
|
3871
|
+
};
|
|
3872
|
+
};
|
|
3873
|
+
output: {
|
|
3874
|
+
error: string;
|
|
3875
|
+
code: string;
|
|
3876
|
+
details?: {
|
|
3877
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
3878
|
+
} | undefined;
|
|
3879
|
+
};
|
|
3880
|
+
outputFormat: "json";
|
|
3881
|
+
status: 400;
|
|
3882
|
+
} | {
|
|
3859
3883
|
input: {
|
|
3860
3884
|
param: {
|
|
3861
3885
|
bookingId: string;
|
|
@@ -9068,9 +9092,10 @@ export declare const financeRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
|
9068
9092
|
bookingId: string;
|
|
9069
9093
|
payments: {
|
|
9070
9094
|
id: string;
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9095
|
+
source: "payment" | "voucher_redemption";
|
|
9096
|
+
invoiceId: string | null;
|
|
9097
|
+
invoiceNumber: string | null;
|
|
9098
|
+
invoiceType: "invoice" | "proforma" | "credit_note" | null;
|
|
9074
9099
|
status: "pending" | "completed" | "failed" | "refunded";
|
|
9075
9100
|
paymentMethod: "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "wallet" | "direct_bill" | "voucher" | "other";
|
|
9076
9101
|
amountCents: number;
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAI7D,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAE3F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AAU7C,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAI7D,OAAO,EAAE,6BAA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;;;;;;;;;;;4BAwBa,CAAA;AAEvC,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAChD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-booking-guarantees.d.ts","sourceRoot":"","sources":["../src/service-booking-guarantees.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,2BAA2B,EAC3B,sCAAsC,EACtC,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-booking-guarantees.d.ts","sourceRoot":"","sources":["../src/service-booking-guarantees.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,2BAA2B,EAC3B,sCAAsC,EACtC,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAgB5B,eAAO,MAAM,8BAA8B;8BACf,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BASzD,kBAAkB,aACX,MAAM,QACX,2BAA2B,YACxB,qBAAqB;;;;;;;;;;;;;;;;;;;;iDA6D1B,kBAAkB,eACT,MAAM,QACb,sCAAsC,YACnC,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAgE1B,kBAAkB,eACT,MAAM,QACb,2BAA2B,YACxB,qBAAqB;;;;;;;;;;;;;;;;;;;;+BA2C1B,kBAAkB,eACT,MAAM,YACV,qBAAqB;;;CA2EjC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { financePaymentProcessingService } from "./service-payment-processing.js";
|
|
2
|
-
import { appendActionLedgerMutation, bookingGuarantees, bookings, buildBookingGuaranteeCreateActionLedgerInput, buildBookingGuaranteeDeleteActionLedgerInput, buildBookingGuaranteeUpdateActionLedgerInput, desc, eq, toTimestamp, } from "./service-shared.js";
|
|
2
|
+
import { and, appendActionLedgerMutation, bookingGuarantees, bookings, buildBookingGuaranteeCreateActionLedgerInput, buildBookingGuaranteeDeleteActionLedgerInput, buildBookingGuaranteeUpdateActionLedgerInput, desc, eq, ne, PaymentValidationError, toTimestamp, } from "./service-shared.js";
|
|
3
3
|
export const financeBookingGuaranteeService = {
|
|
4
4
|
listBookingGuarantees(db, bookingId) {
|
|
5
5
|
return db
|
|
@@ -128,6 +128,16 @@ export const financeBookingGuaranteeService = {
|
|
|
128
128
|
return row ?? null;
|
|
129
129
|
},
|
|
130
130
|
async deleteBookingGuarantee(db, guaranteeId, runtime = {}) {
|
|
131
|
+
function assertCanDeleteGuarantee(guarantee) {
|
|
132
|
+
if (guarantee.status === "active") {
|
|
133
|
+
throw new PaymentValidationError("Active guarantees must be released, cancelled, failed, or expired before deletion", { field: "status", status: guarantee.status, guaranteeId: guarantee.id }, { code: "active_guarantee_delete_forbidden" });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function assertDeleteSucceeded(row, guaranteeId) {
|
|
137
|
+
if (!row) {
|
|
138
|
+
throw new PaymentValidationError("Active guarantees must be released, cancelled, failed, or expired before deletion", { field: "status", status: "active", guaranteeId }, { code: "active_guarantee_delete_forbidden" });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
131
141
|
const actionLedgerContext = runtime.actionLedgerContext;
|
|
132
142
|
if (actionLedgerContext) {
|
|
133
143
|
return db.transaction(async (tx) => {
|
|
@@ -139,15 +149,30 @@ export const financeBookingGuaranteeService = {
|
|
|
139
149
|
if (!existing) {
|
|
140
150
|
return null;
|
|
141
151
|
}
|
|
142
|
-
|
|
152
|
+
assertCanDeleteGuarantee(existing);
|
|
153
|
+
const [deleted] = await tx
|
|
154
|
+
.delete(bookingGuarantees)
|
|
155
|
+
.where(and(eq(bookingGuarantees.id, guaranteeId), ne(bookingGuarantees.status, "active")))
|
|
156
|
+
.returning({ id: bookingGuarantees.id });
|
|
157
|
+
assertDeleteSucceeded(deleted, guaranteeId);
|
|
143
158
|
await appendActionLedgerMutation(tx, buildBookingGuaranteeDeleteActionLedgerInput(actionLedgerContext, { guarantee: existing }, { authorizationSource: runtime.actionLedgerAuthorizationSource }));
|
|
144
159
|
return { id: existing.id };
|
|
145
160
|
});
|
|
146
161
|
}
|
|
162
|
+
const [existing] = await db
|
|
163
|
+
.select()
|
|
164
|
+
.from(bookingGuarantees)
|
|
165
|
+
.where(eq(bookingGuarantees.id, guaranteeId))
|
|
166
|
+
.limit(1);
|
|
167
|
+
if (!existing) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
assertCanDeleteGuarantee(existing);
|
|
147
171
|
const [row] = await db
|
|
148
172
|
.delete(bookingGuarantees)
|
|
149
|
-
.where(eq(bookingGuarantees.id, guaranteeId))
|
|
173
|
+
.where(and(eq(bookingGuarantees.id, guaranteeId), ne(bookingGuarantees.status, "active")))
|
|
150
174
|
.returning({ id: bookingGuarantees.id });
|
|
175
|
+
assertDeleteSucceeded(row, guaranteeId);
|
|
151
176
|
return row ?? null;
|
|
152
177
|
},
|
|
153
178
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-booking-item-billing.d.ts","sourceRoot":"","sources":["../src/service-booking-item-billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,6BAA6B,EAC7B,kBAAkB,EAClB,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-booking-item-billing.d.ts","sourceRoot":"","sources":["../src/service-booking-item-billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,6BAA6B,EAC7B,kBAAkB,EAClB,gCAAgC,EAChC,6BAA6B,EAC9B,MAAM,qBAAqB,CAAA;AAmD5B,eAAO,MAAM,gCAAgC;gCACf,kBAAkB,iBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAS/D,kBAAkB,iBACP,MAAM,QACf,6BAA6B;;;;;;;;;;;;;;;;iCAqB/B,kBAAkB,aACX,MAAM,QACX,6BAA6B;;;;;;;;;;;;;;;;iCAWF,kBAAkB,aAAa,MAAM;;;mCASzC,kBAAkB,iBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCASlE,kBAAkB,iBACP,MAAM,QACf,gCAAgC;;;;;;;;;;;;;;;;oCAuBlC,kBAAkB,gBACR,MAAM,QACd,gCAAgC;;;;;;;;;;;;;;;;oCAuBF,kBAAkB,gBAAgB,MAAM;;;CAQ/E,CAAA"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import { asc, bookingItemCommissions, bookingItems, bookingItemTaxLines, desc, eq, } from "./service-shared.js";
|
|
1
|
+
import { asc, bookingItemCommissions, bookingItems, bookingItemTaxLines, desc, eq, PaymentValidationError, } from "./service-shared.js";
|
|
2
|
+
function validateBookingItemCommissionState(data) {
|
|
3
|
+
const commissionModel = data.commissionModel ?? "percentage";
|
|
4
|
+
if (commissionModel === "percentage" && data.rateBasisPoints == null) {
|
|
5
|
+
throw new PaymentValidationError("Percentage commissions require rateBasisPoints", { field: "rateBasisPoints", commissionModel }, { code: "invalid_commission_basis" });
|
|
6
|
+
}
|
|
7
|
+
if (commissionModel === "fixed" && (data.amountCents == null || !data.currency)) {
|
|
8
|
+
throw new PaymentValidationError("Fixed commissions require amountCents and currency", {
|
|
9
|
+
field: data.amountCents == null ? "amountCents" : "currency",
|
|
10
|
+
commissionModel,
|
|
11
|
+
}, { code: "invalid_commission_basis" });
|
|
12
|
+
}
|
|
13
|
+
if (data.status === "paid" && !data.paidAt) {
|
|
14
|
+
throw new PaymentValidationError("Paid commissions require paidAt settlement metadata", { field: "paidAt", status: data.status }, { code: "missing_commission_settlement_metadata" });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
2
17
|
export const financeBookingItemBillingService = {
|
|
3
18
|
listBookingItemTaxLines(db, bookingItemId) {
|
|
4
19
|
return db
|
|
@@ -53,6 +68,7 @@ export const financeBookingItemBillingService = {
|
|
|
53
68
|
if (!bookingItem) {
|
|
54
69
|
return null;
|
|
55
70
|
}
|
|
71
|
+
validateBookingItemCommissionState(data);
|
|
56
72
|
const [row] = await db
|
|
57
73
|
.insert(bookingItemCommissions)
|
|
58
74
|
.values({ ...data, bookingItemId })
|
|
@@ -60,6 +76,15 @@ export const financeBookingItemBillingService = {
|
|
|
60
76
|
return row ?? null;
|
|
61
77
|
},
|
|
62
78
|
async updateBookingItemCommission(db, commissionId, data) {
|
|
79
|
+
const [existing] = await db
|
|
80
|
+
.select()
|
|
81
|
+
.from(bookingItemCommissions)
|
|
82
|
+
.where(eq(bookingItemCommissions.id, commissionId))
|
|
83
|
+
.limit(1);
|
|
84
|
+
if (!existing) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
validateBookingItemCommissionState({ ...existing, ...data });
|
|
63
88
|
const [row] = await db
|
|
64
89
|
.update(bookingItemCommissions)
|
|
65
90
|
.set({ ...data, updatedAt: new Date() })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-invoice-core.d.ts","sourceRoot":"","sources":["../src/service-invoice-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAEhB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-invoice-core.d.ts","sourceRoot":"","sources":["../src/service-invoice-core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAEhB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,qBAAqB,CAAA;AA6B5B,eAAO,MAAM,yBAAyB;qBACb,kBAAkB,SAAS,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAmH1C,kBAAkB,QAAQ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAK3C,kBAAkB,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAqBjD,kBAAkB,MAClB,MAAM,QACJ,kBAAkB,YACf,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAoDR,kBAAkB,MAAM,MAAM,YAAW,qBAAqB;;;;;;;oBAgDhF,kBAAkB,MAClB,MAAM,UACH,gBAAgB,YACd,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4IjC,CAAA"}
|