nazar-salary 1.7.2 → 2.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.
- package/index.d.ts +111 -0
- package/index.js +44 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -57,6 +57,114 @@ declare module 'nazar-salary' {
|
|
|
57
57
|
new_password?: string;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
export interface BankReceiptUploadResponse {
|
|
61
|
+
status: 'processing';
|
|
62
|
+
log_id: number;
|
|
63
|
+
message: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface BankReceiptStatusResponse {
|
|
67
|
+
status: 'processing' | 'completed' | 'failed';
|
|
68
|
+
log_id: number;
|
|
69
|
+
file_name: string;
|
|
70
|
+
uploaded_by: string;
|
|
71
|
+
uploaded_at: number;
|
|
72
|
+
completed_at?: number;
|
|
73
|
+
summary?: BankReceiptSummary;
|
|
74
|
+
details?: {
|
|
75
|
+
verified_students: VerifiedStudent[];
|
|
76
|
+
discrepancies: PaymentDiscrepancy[];
|
|
77
|
+
orphan_payments: OrphanPayment[];
|
|
78
|
+
};
|
|
79
|
+
error_message?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface BankReceiptListItem {
|
|
83
|
+
log_id: number;
|
|
84
|
+
file_name: string;
|
|
85
|
+
status: 'processing' | 'completed' | 'failed';
|
|
86
|
+
uploaded_by: string;
|
|
87
|
+
uploaded_at: number;
|
|
88
|
+
completed_at?: number;
|
|
89
|
+
summary?: {
|
|
90
|
+
total_transactions: number;
|
|
91
|
+
verified: number;
|
|
92
|
+
discrepancies: number;
|
|
93
|
+
orphan_payments: number;
|
|
94
|
+
};
|
|
95
|
+
error_message?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface BankReceiptsListParams {
|
|
99
|
+
page?: number;
|
|
100
|
+
limit?: number;
|
|
101
|
+
status?: 'processing' | 'completed' | 'failed';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface BankReceiptsListResponse {
|
|
105
|
+
receipts: BankReceiptListItem[];
|
|
106
|
+
pagination: Pagination;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface BankReceiptSummary {
|
|
110
|
+
total_transactions: number;
|
|
111
|
+
processed_transactions: number;
|
|
112
|
+
verified_count: number;
|
|
113
|
+
discrepancies_count: number;
|
|
114
|
+
orphan_payments_count: number;
|
|
115
|
+
skipped_count: number;
|
|
116
|
+
skipped_non_purchase: number;
|
|
117
|
+
skipped_amount_too_low: number;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface VerifiedStudent {
|
|
121
|
+
student_purchase_id: number;
|
|
122
|
+
student_id: number;
|
|
123
|
+
student_name: string;
|
|
124
|
+
manager_name: string;
|
|
125
|
+
amount: number;
|
|
126
|
+
commission: number;
|
|
127
|
+
net_amount: number;
|
|
128
|
+
manager_commission: number;
|
|
129
|
+
payment_method: string;
|
|
130
|
+
transaction_date: string;
|
|
131
|
+
operation_number: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface PaymentDiscrepancy {
|
|
135
|
+
student_purchase_id: number;
|
|
136
|
+
student_id: number;
|
|
137
|
+
student_name: string;
|
|
138
|
+
manager_name: string;
|
|
139
|
+
system_amount: number;
|
|
140
|
+
bank_amount: number;
|
|
141
|
+
discrepancy: number;
|
|
142
|
+
operation_number: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface OrphanPayment {
|
|
146
|
+
store_address: string;
|
|
147
|
+
operation_date: string;
|
|
148
|
+
operation_time: string;
|
|
149
|
+
amount: number;
|
|
150
|
+
commission: number;
|
|
151
|
+
payment_method: string;
|
|
152
|
+
operation_number: string;
|
|
153
|
+
purchase_details: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface BankReceiptResponse {
|
|
157
|
+
summary: BankReceiptSummary;
|
|
158
|
+
verified_students: VerifiedStudent[];
|
|
159
|
+
discrepancies: PaymentDiscrepancy[];
|
|
160
|
+
orphan_payments: OrphanPayment[];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface UploadBankReceiptOptions {
|
|
164
|
+
period_from?: string;
|
|
165
|
+
period_to?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
60
168
|
export interface UpdateUserData {
|
|
61
169
|
first_name?: string;
|
|
62
170
|
last_name?: string;
|
|
@@ -515,6 +623,9 @@ declare module 'nazar-salary' {
|
|
|
515
623
|
getManagers(): Promise<ManagersResponse>;
|
|
516
624
|
updateManager(managerId: number, data: UpdateManagerData): Promise<UpdateManagerResponse>;
|
|
517
625
|
deleteManager(managerId: number): Promise<void>;
|
|
626
|
+
uploadKaspiReceipt(file: File | Buffer, options?: UploadBankReceiptOptions): Promise<BankReceiptUploadResponse>;
|
|
627
|
+
getReceiptsList(params?: BankReceiptsListParams): Promise<BankReceiptsListResponse>;
|
|
628
|
+
getReceiptStatus(logId: number): Promise<BankReceiptStatusResponse>;
|
|
518
629
|
|
|
519
630
|
// Teacher endpoints
|
|
520
631
|
getTeacherLanguages(): Promise<TeacherLanguagesResponse>;
|
package/index.js
CHANGED
|
@@ -177,6 +177,50 @@ class SalaryAPI {
|
|
|
177
177
|
return await this.client.delete(`/api/v1/admin/manager/${managerId}`);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Upload bank receipt Excel file for verification (Admin only)
|
|
182
|
+
* Supports Kaspi, Halyk, Jusan and other bank statements
|
|
183
|
+
* Processing happens asynchronously, use getReceiptStatus to check progress
|
|
184
|
+
* @param {File|Buffer} file - Excel file (.xlsx) with bank statement
|
|
185
|
+
* @param {object} [options] - Upload options
|
|
186
|
+
* @param {string} [options.period_from] - Period start date (YYYY-MM-DD)
|
|
187
|
+
* @param {string} [options.period_to] - Period end date (YYYY-MM-DD)
|
|
188
|
+
* @returns {Promise<{status: string, log_id: number, message: string}>}
|
|
189
|
+
*/
|
|
190
|
+
async uploadKaspiReceipt(file, options = {}) {
|
|
191
|
+
const formData = new FormData();
|
|
192
|
+
formData.append('file', file);
|
|
193
|
+
if (options.period_from) formData.append('period_from', options.period_from);
|
|
194
|
+
if (options.period_to) formData.append('period_to', options.period_to);
|
|
195
|
+
|
|
196
|
+
return await this.client.post("/api/v1/admin/receipts/upload", formData, {
|
|
197
|
+
headers: {
|
|
198
|
+
'Content-Type': 'multipart/form-data',
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Get list of all receipt uploads (Admin only)
|
|
205
|
+
* @param {object} [params] - Query parameters
|
|
206
|
+
* @param {number} [params.page=1] - Page number
|
|
207
|
+
* @param {number} [params.limit=20] - Items per page
|
|
208
|
+
* @param {string} [params.status] - Filter by status (processing, completed, failed)
|
|
209
|
+
* @returns {Promise<{receipts: array, pagination: object}>}
|
|
210
|
+
*/
|
|
211
|
+
async getReceiptsList(params = {}) {
|
|
212
|
+
return await this.client.get("/api/v1/admin/receipts/", { params });
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Get bank receipt processing status (Admin only)
|
|
217
|
+
* @param {number} logId - Receipt log ID from uploadKaspiReceipt
|
|
218
|
+
* @returns {Promise<{status: string, log_id: number, file_name: string, summary?: object, details?: object, error_message?: string}>}
|
|
219
|
+
*/
|
|
220
|
+
async getReceiptStatus(logId) {
|
|
221
|
+
return await this.client.get(`/api/v1/admin/receipts/${logId}`);
|
|
222
|
+
}
|
|
223
|
+
|
|
180
224
|
// ===== TEACHER ENDPOINTS =====
|
|
181
225
|
|
|
182
226
|
/**
|