@devlider001/washlab-backend 1.0.0 → 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.
@@ -0,0 +1,36 @@
1
+ import { MutationCtx } from "../_generated/server";
2
+ import { Id } from "../_generated/dataModel";
3
+ /**
4
+ * Audit logging utilities
5
+ *
6
+ * These functions create audit log entries for all important actions
7
+ * to maintain accountability and compliance.
8
+ */
9
+ interface AuditLogParams {
10
+ ctx: MutationCtx;
11
+ actorId: string;
12
+ actorType: "customer" | "attendant" | "admin";
13
+ actorRole: string;
14
+ action: string;
15
+ entityType: string;
16
+ entityId?: string;
17
+ branchId?: Id<"branches">;
18
+ deviceId?: string;
19
+ details?: string;
20
+ oldValue?: string;
21
+ newValue?: string;
22
+ }
23
+ /**
24
+ * Create an audit log entry
25
+ */
26
+ export declare function createAuditLog({ ctx, actorId, actorType, actorRole, action, entityType, entityId, branchId, deviceId, details, oldValue, newValue, }: AuditLogParams): Promise<Id<"auditLogs">>;
27
+ /**
28
+ * Create audit log for order status change
29
+ */
30
+ export declare function logOrderStatusChange(ctx: MutationCtx, orderId: Id<"orders">, attendantId: Id<"attendants">, oldStatus: string, newStatus: string, branchId: Id<"branches">, notes?: string): Promise<Id<"auditLogs">>;
31
+ /**
32
+ * Create audit log for payment
33
+ */
34
+ export declare function logPayment(ctx: MutationCtx, paymentId: Id<"payments">, orderId: Id<"orders">, customerId: Id<"users">, action: string, amount: number, paymentMethod: string, branchId?: Id<"branches">, attendantId?: Id<"attendants">, reason?: string): Promise<Id<"auditLogs">>;
35
+ export {};
36
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1,92 @@
1
+ import { QueryCtx, MutationCtx } from "../_generated/server";
2
+ import { Id } from "../_generated/dataModel";
3
+ /**
4
+ * Get the current authenticated Clerk user identity
5
+ * @throws Error if user is not authenticated
6
+ */
7
+ export declare function getClerkIdentity(ctx: QueryCtx | MutationCtx): Promise<import("convex/server").UserIdentity>;
8
+ /**
9
+ * Get current customer user from Clerk identity
10
+ * @throws Error if user is not authenticated or not found
11
+ */
12
+ export declare function getCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise<{
13
+ _id: import("convex/values").GenericId<"users">;
14
+ _creationTime: number;
15
+ email?: string | undefined;
16
+ clerkUserId?: string | undefined;
17
+ lastLoginAt?: number | undefined;
18
+ preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
19
+ phoneNumber: string;
20
+ name: string;
21
+ isRegistered: boolean;
22
+ isVerified: boolean;
23
+ createdAt: number;
24
+ isDeleted: boolean;
25
+ }>;
26
+ /**
27
+ * Get current attendant from Clerk identity
28
+ * @throws Error if user is not authenticated or not found
29
+ */
30
+ export declare function getCurrentAttendant(ctx: QueryCtx | MutationCtx): Promise<{
31
+ _id: import("convex/values").GenericId<"attendants">;
32
+ _creationTime: number;
33
+ lastLoginAt?: number | undefined;
34
+ passcode?: string | undefined;
35
+ phoneNumber: string;
36
+ email: string;
37
+ name: string;
38
+ clerkUserId: string;
39
+ createdAt: number;
40
+ isDeleted: boolean;
41
+ branchId: import("convex/values").GenericId<"branches">;
42
+ isActive: boolean;
43
+ }>;
44
+ /**
45
+ * Get current admin from Clerk identity
46
+ * @throws Error if user is not authenticated or not found
47
+ */
48
+ export declare function getCurrentAdmin(ctx: QueryCtx | MutationCtx): Promise<{
49
+ _id: import("convex/values").GenericId<"admins">;
50
+ _creationTime: number;
51
+ lastLoginAt?: number | undefined;
52
+ email: string;
53
+ name: string;
54
+ clerkUserId: string;
55
+ createdAt: number;
56
+ isDeleted: boolean;
57
+ role: "super_admin" | "admin";
58
+ }>;
59
+ /**
60
+ * Get current admin with super admin role check
61
+ * @throws Error if user is not authenticated, not found, or not super admin
62
+ */
63
+ export declare function getSuperAdmin(ctx: QueryCtx | MutationCtx): Promise<{
64
+ _id: import("convex/values").GenericId<"admins">;
65
+ _creationTime: number;
66
+ lastLoginAt?: number | undefined;
67
+ email: string;
68
+ name: string;
69
+ clerkUserId: string;
70
+ createdAt: number;
71
+ isDeleted: boolean;
72
+ role: "super_admin" | "admin";
73
+ }>;
74
+ /**
75
+ * Verify attendant is assigned to the specified branch
76
+ * @throws Error if attendant is not assigned to the branch
77
+ */
78
+ export declare function verifyAttendantBranch(ctx: QueryCtx | MutationCtx, attendantId: Id<"attendants">, branchId: Id<"branches">): Promise<{
79
+ _id: import("convex/values").GenericId<"attendants">;
80
+ _creationTime: number;
81
+ lastLoginAt?: number | undefined;
82
+ passcode?: string | undefined;
83
+ phoneNumber: string;
84
+ email: string;
85
+ name: string;
86
+ clerkUserId: string;
87
+ createdAt: number;
88
+ isDeleted: boolean;
89
+ branchId: import("convex/values").GenericId<"branches">;
90
+ isActive: boolean;
91
+ }>;
92
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Utility functions for common operations
3
+ */
4
+ /**
5
+ * Generate unique order number
6
+ * Format: WL-YYYY-XXXXXX (where XXXXXX is sequential)
7
+ */
8
+ export declare function generateOrderNumber(): string;
9
+ /**
10
+ * Calculate order price based on weight and branch pricing
11
+ */
12
+ export declare function calculateOrderPrice(weight: number, pricingPerKg: number, deliveryFee: number, isDelivery: boolean): {
13
+ basePrice: number;
14
+ deliveryFee: number;
15
+ totalPrice: number;
16
+ };
17
+ /**
18
+ * Calculate service price based on service type
19
+ * Service pricing:
20
+ * - wash_only: ₵25/load
21
+ * - wash_and_dry: ₵50/load
22
+ * - dry_only: ₵25/load
23
+ */
24
+ export declare function calculateServicePrice(serviceType: "wash_only" | "wash_and_dry" | "dry_only", estimatedWeight: number, estimatedLoads: number, pricingPerKg: number, // Fallback pricing per kg
25
+ deliveryFee: number, isDelivery: boolean): {
26
+ basePrice: number;
27
+ deliveryFee: number;
28
+ totalPrice: number;
29
+ };
30
+ /**
31
+ * Format date to YYYY-MM-DD string
32
+ */
33
+ export declare function formatDate(date: Date): string;
34
+ /**
35
+ * Get current timestamp in milliseconds
36
+ */
37
+ export declare function getCurrentTimestamp(): number;
38
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Loyalty Functions
3
+ *
4
+ * Handles loyalty points earning, redemption, and balance management.
5
+ * Rules: 1 point per completed order, 10 points = 1 free wash.
6
+ */
7
+ /**
8
+ * Get customer loyalty points balance
9
+ */
10
+ export declare const getBalance: import("convex/server").RegisteredQuery<"public", {}, Promise<{
11
+ points: number;
12
+ totalEarned: number;
13
+ totalRedeemed: number;
14
+ lastEarnedAt: number | undefined;
15
+ lastRedeemedAt: number | undefined;
16
+ }>>;
17
+ /**
18
+ * Get loyalty transaction history
19
+ */
20
+ /**
21
+ * Get loyalty transactions - Paginated
22
+ * Supports usePaginatedQuery for infinite scroll
23
+ */
24
+ export declare const getTransactions: import("convex/server").RegisteredQuery<"public", {
25
+ cursor?: string | undefined;
26
+ numItems?: number | undefined;
27
+ }, Promise<{
28
+ page: {
29
+ _id: import("convex/values").GenericId<"loyaltyTransactions">;
30
+ _creationTime: number;
31
+ createdBy?: import("convex/values").GenericId<"admins"> | undefined;
32
+ orderId?: import("convex/values").GenericId<"orders"> | undefined;
33
+ description?: string | undefined;
34
+ createdAt: number;
35
+ isDeleted: boolean;
36
+ type: "earned" | "redeemed" | "expired" | "adjusted";
37
+ customerId: import("convex/values").GenericId<"users">;
38
+ points: number;
39
+ balanceAfter: number;
40
+ }[];
41
+ isDone: boolean;
42
+ continueCursor: string;
43
+ }>>;
44
+ /**
45
+ * Earn loyalty points (internal - called when order is completed)
46
+ */
47
+ export declare const earnPoints: import("convex/server").RegisteredMutation<"internal", {
48
+ customerId: import("convex/values").GenericId<"users">;
49
+ orderId: import("convex/values").GenericId<"orders">;
50
+ points: number;
51
+ }, Promise<void>>;
52
+ /**
53
+ * Redeem loyalty points for free wash
54
+ */
55
+ export declare const redeemPoints: import("convex/server").RegisteredMutation<"public", {
56
+ orderId: import("convex/values").GenericId<"orders">;
57
+ pointsToRedeem: number;
58
+ }, Promise<{
59
+ pointsRedeemed: number;
60
+ newBalance: number;
61
+ discountAmount: number;
62
+ finalPrice: number;
63
+ }>>;
64
+ /**
65
+ * Adjust loyalty points (admin only)
66
+ */
67
+ export declare const adjustPoints: import("convex/server").RegisteredMutation<"public", {
68
+ customerId: import("convex/values").GenericId<"users">;
69
+ points: number;
70
+ description: string;
71
+ }, Promise<{
72
+ _id: import("convex/values").GenericId<"loyaltyPoints">;
73
+ _creationTime: number;
74
+ lastEarnedAt?: number | undefined;
75
+ lastRedeemedAt?: number | undefined;
76
+ isDeleted: boolean;
77
+ customerId: import("convex/values").GenericId<"users">;
78
+ points: number;
79
+ totalEarned: number;
80
+ totalRedeemed: number;
81
+ }>>;
82
+ //# sourceMappingURL=loyalty.d.ts.map
@@ -0,0 +1,250 @@
1
+ /**
2
+ * Order Functions
3
+ *
4
+ * Handles order creation (walk-in and online), status updates, and queries.
5
+ */
6
+ /**
7
+ * Get order by order number
8
+ */
9
+ export declare const getByOrderNumber: import("convex/server").RegisteredQuery<"public", {
10
+ orderNumber: string;
11
+ }, Promise<{
12
+ _id: import("convex/values").GenericId<"orders">;
13
+ _creationTime: number;
14
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
15
+ estimatedWeight?: number | undefined;
16
+ actualWeight?: number | undefined;
17
+ itemCount?: number | undefined;
18
+ estimatedLoads?: number | undefined;
19
+ whitesSeparate?: boolean | undefined;
20
+ notes?: string | undefined;
21
+ deliveryAddress?: string | undefined;
22
+ deliveryPhoneNumber?: string | undefined;
23
+ deliveryHall?: string | undefined;
24
+ deliveryRoom?: string | undefined;
25
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
26
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
27
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
28
+ createdAt: number;
29
+ isDeleted: boolean;
30
+ branchId: import("convex/values").GenericId<"branches">;
31
+ deliveryFee: number;
32
+ customerId: import("convex/values").GenericId<"users">;
33
+ customerPhoneNumber: string;
34
+ orderNumber: string;
35
+ orderType: "walk_in" | "online";
36
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
37
+ isDelivery: boolean;
38
+ basePrice: number;
39
+ totalPrice: number;
40
+ finalPrice: number;
41
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
42
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
43
+ updatedAt: number;
44
+ statusHistory: {
45
+ notes?: string | undefined;
46
+ status: string;
47
+ changedAt: number;
48
+ changedBy: import("convex/values").GenericId<"attendants">;
49
+ }[];
50
+ } | null>>;
51
+ /**
52
+ * Get orders by customer (from authenticated session)
53
+ */
54
+ export declare const getByCustomer: import("convex/server").RegisteredQuery<"public", {
55
+ status?: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled" | undefined;
56
+ limit?: number | undefined;
57
+ }, Promise<{
58
+ _id: import("convex/values").GenericId<"orders">;
59
+ _creationTime: number;
60
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
61
+ estimatedWeight?: number | undefined;
62
+ actualWeight?: number | undefined;
63
+ itemCount?: number | undefined;
64
+ estimatedLoads?: number | undefined;
65
+ whitesSeparate?: boolean | undefined;
66
+ notes?: string | undefined;
67
+ deliveryAddress?: string | undefined;
68
+ deliveryPhoneNumber?: string | undefined;
69
+ deliveryHall?: string | undefined;
70
+ deliveryRoom?: string | undefined;
71
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
72
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
73
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
74
+ createdAt: number;
75
+ isDeleted: boolean;
76
+ branchId: import("convex/values").GenericId<"branches">;
77
+ deliveryFee: number;
78
+ customerId: import("convex/values").GenericId<"users">;
79
+ customerPhoneNumber: string;
80
+ orderNumber: string;
81
+ orderType: "walk_in" | "online";
82
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
83
+ isDelivery: boolean;
84
+ basePrice: number;
85
+ totalPrice: number;
86
+ finalPrice: number;
87
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
88
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
89
+ updatedAt: number;
90
+ statusHistory: {
91
+ notes?: string | undefined;
92
+ status: string;
93
+ changedAt: number;
94
+ changedBy: import("convex/values").GenericId<"attendants">;
95
+ }[];
96
+ }[]>>;
97
+ /**
98
+ * Get orders by branch (for POS)
99
+ */
100
+ export declare const getByBranch: import("convex/server").RegisteredQuery<"public", {
101
+ status?: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled" | undefined;
102
+ limit?: number | undefined;
103
+ branchId: import("convex/values").GenericId<"branches">;
104
+ }, Promise<{
105
+ _id: import("convex/values").GenericId<"orders">;
106
+ _creationTime: number;
107
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
108
+ estimatedWeight?: number | undefined;
109
+ actualWeight?: number | undefined;
110
+ itemCount?: number | undefined;
111
+ estimatedLoads?: number | undefined;
112
+ whitesSeparate?: boolean | undefined;
113
+ notes?: string | undefined;
114
+ deliveryAddress?: string | undefined;
115
+ deliveryPhoneNumber?: string | undefined;
116
+ deliveryHall?: string | undefined;
117
+ deliveryRoom?: string | undefined;
118
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
119
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
120
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
121
+ createdAt: number;
122
+ isDeleted: boolean;
123
+ branchId: import("convex/values").GenericId<"branches">;
124
+ deliveryFee: number;
125
+ customerId: import("convex/values").GenericId<"users">;
126
+ customerPhoneNumber: string;
127
+ orderNumber: string;
128
+ orderType: "walk_in" | "online";
129
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
130
+ isDelivery: boolean;
131
+ basePrice: number;
132
+ totalPrice: number;
133
+ finalPrice: number;
134
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
135
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
136
+ updatedAt: number;
137
+ statusHistory: {
138
+ notes?: string | undefined;
139
+ status: string;
140
+ changedAt: number;
141
+ changedBy: import("convex/values").GenericId<"attendants">;
142
+ }[];
143
+ }[]>>;
144
+ /**
145
+ * Get pending online orders (awaiting drop-off at POS)
146
+ */
147
+ export declare const getPending: import("convex/server").RegisteredQuery<"public", {
148
+ branchId: import("convex/values").GenericId<"branches">;
149
+ }, Promise<{
150
+ _id: import("convex/values").GenericId<"orders">;
151
+ _creationTime: number;
152
+ createdBy?: import("convex/values").GenericId<"attendants"> | undefined;
153
+ estimatedWeight?: number | undefined;
154
+ actualWeight?: number | undefined;
155
+ itemCount?: number | undefined;
156
+ estimatedLoads?: number | undefined;
157
+ whitesSeparate?: boolean | undefined;
158
+ notes?: string | undefined;
159
+ deliveryAddress?: string | undefined;
160
+ deliveryPhoneNumber?: string | undefined;
161
+ deliveryHall?: string | undefined;
162
+ deliveryRoom?: string | undefined;
163
+ paymentMethod?: "mobile_money" | "card" | "cash" | undefined;
164
+ paymentId?: import("convex/values").GenericId<"payments"> | undefined;
165
+ fulfilledBy?: import("convex/values").GenericId<"attendants"> | undefined;
166
+ createdAt: number;
167
+ isDeleted: boolean;
168
+ branchId: import("convex/values").GenericId<"branches">;
169
+ deliveryFee: number;
170
+ customerId: import("convex/values").GenericId<"users">;
171
+ customerPhoneNumber: string;
172
+ orderNumber: string;
173
+ orderType: "walk_in" | "online";
174
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
175
+ isDelivery: boolean;
176
+ basePrice: number;
177
+ totalPrice: number;
178
+ finalPrice: number;
179
+ status: "pending" | "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
180
+ paymentStatus: "pending" | "paid" | "failed" | "refunded";
181
+ updatedAt: number;
182
+ statusHistory: {
183
+ notes?: string | undefined;
184
+ status: string;
185
+ changedAt: number;
186
+ changedBy: import("convex/values").GenericId<"attendants">;
187
+ }[];
188
+ }[]>>;
189
+ /**
190
+ * Create walk-in order (attendant creates at POS)
191
+ */
192
+ export declare const createWalkIn: import("convex/server").RegisteredMutation<"public", {
193
+ notes?: string | undefined;
194
+ deliveryAddress?: string | undefined;
195
+ branchId: import("convex/values").GenericId<"branches">;
196
+ customerPhoneNumber: string;
197
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
198
+ actualWeight: number;
199
+ itemCount: number;
200
+ isDelivery: boolean;
201
+ customerName: string;
202
+ }, Promise<import("convex/values").GenericId<"orders">>>;
203
+ /**
204
+ * Create online order (customer creates from website)
205
+ * Supports both guest checkout and authenticated users
206
+ */
207
+ export declare const createOnline: import("convex/server").RegisteredMutation<"public", {
208
+ estimatedLoads?: number | undefined;
209
+ whitesSeparate?: boolean | undefined;
210
+ notes?: string | undefined;
211
+ deliveryAddress?: string | undefined;
212
+ deliveryPhoneNumber?: string | undefined;
213
+ deliveryHall?: string | undefined;
214
+ deliveryRoom?: string | undefined;
215
+ branchId: import("convex/values").GenericId<"branches">;
216
+ customerPhoneNumber: string;
217
+ serviceType: "wash_only" | "wash_and_dry" | "dry_only";
218
+ estimatedWeight: number;
219
+ itemCount: number;
220
+ isDelivery: boolean;
221
+ customerName: string;
222
+ }, Promise<{
223
+ orderId: import("convex/values").GenericId<"orders">;
224
+ orderNumber: string;
225
+ isGuest: boolean;
226
+ }>>;
227
+ /**
228
+ * Update order weight (when customer drops off online order)
229
+ */
230
+ export declare const updateWeight: import("convex/server").RegisteredMutation<"public", {
231
+ actualWeight: number;
232
+ itemCount: number;
233
+ orderId: import("convex/values").GenericId<"orders">;
234
+ }, Promise<void>>;
235
+ /**
236
+ * Update order status (attendant operation)
237
+ */
238
+ export declare const updateStatus: import("convex/server").RegisteredMutation<"public", {
239
+ notes?: string | undefined;
240
+ orderId: import("convex/values").GenericId<"orders">;
241
+ newStatus: "in_progress" | "ready_for_pickup" | "delivered" | "completed" | "cancelled";
242
+ }, Promise<void>>;
243
+ /**
244
+ * Cancel order
245
+ */
246
+ export declare const cancel: import("convex/server").RegisteredMutation<"public", {
247
+ reason?: string | undefined;
248
+ orderId: import("convex/values").GenericId<"orders">;
249
+ }, Promise<import("convex/values").GenericId<"orders">>>;
250
+ //# sourceMappingURL=orders.d.ts.map
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Payment Functions
3
+ *
4
+ * Handles payment creation, confirmation, and refunds.
5
+ */
6
+ /**
7
+ * Get payment by order ID
8
+ */
9
+ export declare const getByOrder: import("convex/server").RegisteredQuery<"public", {
10
+ orderId: import("convex/values").GenericId<"orders">;
11
+ }, Promise<{
12
+ _id: import("convex/values").GenericId<"payments">;
13
+ _creationTime: number;
14
+ gatewayTransactionId?: string | undefined;
15
+ gatewayResponse?: string | undefined;
16
+ completedAt?: number | undefined;
17
+ processedBy?: import("convex/values").GenericId<"attendants"> | undefined;
18
+ createdAt: number;
19
+ isDeleted: boolean;
20
+ customerId: import("convex/values").GenericId<"users">;
21
+ status: "pending" | "completed" | "failed" | "refunded" | "processing";
22
+ paymentMethod: "mobile_money" | "card" | "cash";
23
+ orderId: import("convex/values").GenericId<"orders">;
24
+ amount: number;
25
+ currency: string;
26
+ } | null>>;
27
+ /**
28
+ * Get payment history by customer
29
+ */
30
+ export declare const getByCustomer: import("convex/server").RegisteredQuery<"public", {
31
+ limit?: number | undefined;
32
+ }, Promise<{
33
+ _id: import("convex/values").GenericId<"payments">;
34
+ _creationTime: number;
35
+ gatewayTransactionId?: string | undefined;
36
+ gatewayResponse?: string | undefined;
37
+ completedAt?: number | undefined;
38
+ processedBy?: import("convex/values").GenericId<"attendants"> | undefined;
39
+ createdAt: number;
40
+ isDeleted: boolean;
41
+ customerId: import("convex/values").GenericId<"users">;
42
+ status: "pending" | "completed" | "failed" | "refunded" | "processing";
43
+ paymentMethod: "mobile_money" | "card" | "cash";
44
+ orderId: import("convex/values").GenericId<"orders">;
45
+ amount: number;
46
+ currency: string;
47
+ }[]>>;
48
+ /**
49
+ * Create payment record
50
+ */
51
+ export declare const create: import("convex/server").RegisteredMutation<"public", {
52
+ currency?: string | undefined;
53
+ paymentMethod: "mobile_money" | "card" | "cash";
54
+ orderId: import("convex/values").GenericId<"orders">;
55
+ amount: number;
56
+ }, Promise<import("convex/values").GenericId<"payments">>>;
57
+ /**
58
+ * Initiate payment (for gateway integration)
59
+ * This would typically call an external payment gateway API
60
+ */
61
+ export declare const initiate: import("convex/server").RegisteredMutation<"public", {
62
+ paymentId: import("convex/values").GenericId<"payments">;
63
+ }, Promise<{
64
+ paymentId: import("convex/values").GenericId<"payments">;
65
+ status: string;
66
+ }>>;
67
+ /**
68
+ * Confirm payment completion
69
+ */
70
+ export declare const confirm: import("convex/server").RegisteredMutation<"public", {
71
+ gatewayTransactionId?: string | undefined;
72
+ gatewayResponse?: string | undefined;
73
+ paymentId: import("convex/values").GenericId<"payments">;
74
+ }, Promise<import("convex/values").GenericId<"payments">>>;
75
+ /**
76
+ * Mark payment as failed
77
+ */
78
+ export declare const fail: import("convex/server").RegisteredMutation<"public", {
79
+ reason?: string | undefined;
80
+ paymentId: import("convex/values").GenericId<"payments">;
81
+ }, Promise<import("convex/values").GenericId<"payments">>>;
82
+ /**
83
+ * Process refund
84
+ */
85
+ export declare const refund: import("convex/server").RegisteredMutation<"public", {
86
+ reason?: string | undefined;
87
+ paymentId: import("convex/values").GenericId<"payments">;
88
+ }, Promise<import("convex/values").GenericId<"payments">>>;
89
+ //# sourceMappingURL=payments.d.ts.map
@@ -0,0 +1,88 @@
1
+ import { Id } from "./_generated/dataModel";
2
+ /**
3
+ * Resource Usage Functions
4
+ *
5
+ * Handles daily resource consumption tracking (detergent, tokens, water cycles).
6
+ * Used by attendants to log daily resource usage at branches.
7
+ */
8
+ /**
9
+ * Get resource usage by branch
10
+ */
11
+ export declare const getByBranch: import("convex/server").RegisteredQuery<"public", {
12
+ startDate?: string | undefined;
13
+ endDate?: string | undefined;
14
+ limit?: number | undefined;
15
+ branchId: import("convex/values").GenericId<"branches">;
16
+ }, Promise<{
17
+ _id: import("convex/values").GenericId<"resourceUsageLogs">;
18
+ _creationTime: number;
19
+ notes?: string | undefined;
20
+ waterCycles?: number | undefined;
21
+ isDeleted: boolean;
22
+ branchId: import("convex/values").GenericId<"branches">;
23
+ attendantId: import("convex/values").GenericId<"attendants">;
24
+ date: string;
25
+ detergentUnits: number;
26
+ tokensUsed: number;
27
+ loggedAt: number;
28
+ }[]>>;
29
+ /**
30
+ * Get resource usage by date
31
+ */
32
+ export declare const getByDate: import("convex/server").RegisteredQuery<"public", {
33
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
34
+ date: string;
35
+ }, Promise<{
36
+ _id: import("convex/values").GenericId<"resourceUsageLogs">;
37
+ _creationTime: number;
38
+ notes?: string | undefined;
39
+ waterCycles?: number | undefined;
40
+ isDeleted: boolean;
41
+ branchId: import("convex/values").GenericId<"branches">;
42
+ attendantId: import("convex/values").GenericId<"attendants">;
43
+ date: string;
44
+ detergentUnits: number;
45
+ tokensUsed: number;
46
+ loggedAt: number;
47
+ }[]>>;
48
+ /**
49
+ * Get daily resource report for a branch
50
+ */
51
+ export declare const getDailyReport: import("convex/server").RegisteredQuery<"public", {
52
+ branchId: import("convex/values").GenericId<"branches">;
53
+ date: string;
54
+ }, Promise<{
55
+ date: string;
56
+ branchId: import("convex/values").GenericId<"branches">;
57
+ logs: {
58
+ _id: import("convex/values").GenericId<"resourceUsageLogs">;
59
+ _creationTime: number;
60
+ notes?: string | undefined;
61
+ waterCycles?: number | undefined;
62
+ isDeleted: boolean;
63
+ branchId: import("convex/values").GenericId<"branches">;
64
+ attendantId: import("convex/values").GenericId<"attendants">;
65
+ date: string;
66
+ detergentUnits: number;
67
+ tokensUsed: number;
68
+ loggedAt: number;
69
+ }[];
70
+ totals: {
71
+ detergentUnits: number;
72
+ tokensUsed: number;
73
+ waterCycles: number;
74
+ };
75
+ logCount: number;
76
+ }>>;
77
+ /**
78
+ * Log daily resource usage
79
+ */
80
+ export declare const logUsage: import("convex/server").RegisteredMutation<"public", {
81
+ notes?: string | undefined;
82
+ date?: string | undefined;
83
+ waterCycles?: number | undefined;
84
+ branchId: import("convex/values").GenericId<"branches">;
85
+ detergentUnits: number;
86
+ tokensUsed: number;
87
+ }, Promise<Id<"resourceUsageLogs">>>;
88
+ //# sourceMappingURL=resources.d.ts.map