nazar-salary 2.0.1 → 2.2.0
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 +102 -1
- package/index.js +60 -7
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -165,6 +165,86 @@ declare module 'nazar-salary' {
|
|
|
165
165
|
period_to?: string;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
export interface ManualPaymentData {
|
|
169
|
+
operation_number: string;
|
|
170
|
+
bank_id: string;
|
|
171
|
+
payment_method: string;
|
|
172
|
+
amount: number;
|
|
173
|
+
transaction_date?: string;
|
|
174
|
+
transaction_time?: string;
|
|
175
|
+
comment?: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface ManualPaymentStudent {
|
|
179
|
+
id: number;
|
|
180
|
+
first_name: string;
|
|
181
|
+
last_name: string;
|
|
182
|
+
phone?: string;
|
|
183
|
+
manager_name?: string;
|
|
184
|
+
purchase_amount?: number;
|
|
185
|
+
is_verified: boolean;
|
|
186
|
+
verified_at?: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface ManualPaymentDetails {
|
|
190
|
+
operation_number: string;
|
|
191
|
+
amount: number;
|
|
192
|
+
bank_commission?: number;
|
|
193
|
+
net_amount?: number;
|
|
194
|
+
manager_commission?: number;
|
|
195
|
+
discrepancy_amount?: number;
|
|
196
|
+
payment_method?: string;
|
|
197
|
+
manual_verification?: boolean;
|
|
198
|
+
verified_by?: number;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface ManualPaymentResponse {
|
|
202
|
+
status: 'success' | 'error';
|
|
203
|
+
result: 'verified' | 'discrepancy' | 'orphan';
|
|
204
|
+
message: string;
|
|
205
|
+
student?: ManualPaymentStudent;
|
|
206
|
+
payment: ManualPaymentDetails;
|
|
207
|
+
code?: string;
|
|
208
|
+
details?: any;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface OrphanPaymentItem {
|
|
212
|
+
id: number;
|
|
213
|
+
operation_number: string;
|
|
214
|
+
amount: number;
|
|
215
|
+
bank_name: string;
|
|
216
|
+
payment_method: string;
|
|
217
|
+
commission_rate: number;
|
|
218
|
+
bank_commission: number;
|
|
219
|
+
net_amount: number;
|
|
220
|
+
transaction_date?: string;
|
|
221
|
+
transaction_time?: string;
|
|
222
|
+
comment?: string;
|
|
223
|
+
created_by: string;
|
|
224
|
+
created_at: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface OrphanPaymentsResponse {
|
|
228
|
+
orphan_payments: OrphanPaymentItem[];
|
|
229
|
+
pagination: Pagination;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface PaymentMethod {
|
|
233
|
+
payment_method_id: string;
|
|
234
|
+
payment_method_name: string;
|
|
235
|
+
commission_rate: number;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface BankConfig {
|
|
239
|
+
bank_id: string;
|
|
240
|
+
bank_name: string;
|
|
241
|
+
payment_methods: PaymentMethod[];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface BanksConfigResponse {
|
|
245
|
+
banks: BankConfig[];
|
|
246
|
+
}
|
|
247
|
+
|
|
168
248
|
export interface UpdateUserData {
|
|
169
249
|
first_name?: string;
|
|
170
250
|
last_name?: string;
|
|
@@ -425,6 +505,23 @@ declare module 'nazar-salary' {
|
|
|
425
505
|
main_course?: string;
|
|
426
506
|
}
|
|
427
507
|
|
|
508
|
+
export interface ChangeStudentManagerData {
|
|
509
|
+
new_manager_id: number;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export interface ChangeStudentManagerResponse {
|
|
513
|
+
student_id: number;
|
|
514
|
+
old_manager: {
|
|
515
|
+
id: number;
|
|
516
|
+
name: string;
|
|
517
|
+
};
|
|
518
|
+
new_manager: {
|
|
519
|
+
id: number;
|
|
520
|
+
name: string;
|
|
521
|
+
};
|
|
522
|
+
reassigned_at: number;
|
|
523
|
+
}
|
|
524
|
+
|
|
428
525
|
export interface StudentBasicInfo {
|
|
429
526
|
id: number;
|
|
430
527
|
first_name: string;
|
|
@@ -569,7 +666,7 @@ declare module 'nazar-salary' {
|
|
|
569
666
|
}
|
|
570
667
|
|
|
571
668
|
/** @deprecated Use StudentsListParams instead */
|
|
572
|
-
export interface ManagerStudentsParams extends Omit<StudentsListParams, 'manager_id'> {}
|
|
669
|
+
export interface ManagerStudentsParams extends Omit<StudentsListParams, 'manager_id'> { }
|
|
573
670
|
|
|
574
671
|
/** @deprecated Use StudentsListResponse instead */
|
|
575
672
|
export interface ManagerStudentsResponse extends StudentsListResponse {
|
|
@@ -626,6 +723,9 @@ declare module 'nazar-salary' {
|
|
|
626
723
|
uploadKaspiReceipt(file: File | Buffer, options?: UploadBankReceiptOptions): Promise<BankReceiptUploadResponse>;
|
|
627
724
|
getReceiptsList(params?: BankReceiptsListParams): Promise<BankReceiptsListResponse>;
|
|
628
725
|
getReceiptStatus(logId: number): Promise<BankReceiptStatusResponse>;
|
|
726
|
+
addManualPayment(data: ManualPaymentData): Promise<ManualPaymentResponse>;
|
|
727
|
+
getOrphanPayments(params?: { page?: number; limit?: number }): Promise<OrphanPaymentsResponse>;
|
|
728
|
+
getBanksConfig(): Promise<BanksConfigResponse>;
|
|
629
729
|
|
|
630
730
|
// Teacher endpoints
|
|
631
731
|
getTeacherLanguages(): Promise<TeacherLanguagesResponse>;
|
|
@@ -647,6 +747,7 @@ declare module 'nazar-salary' {
|
|
|
647
747
|
createStudent(data: CreateStudentData): Promise<Student>;
|
|
648
748
|
updateStudent(studentId: number, data: UpdateStudentData): Promise<UpdatedStudent>;
|
|
649
749
|
transferStudent(studentId: number, data: TransferStudentData): Promise<TransferResponse>;
|
|
750
|
+
changeStudentManager(studentId: number, data: ChangeStudentManagerData): Promise<ChangeStudentManagerResponse>;
|
|
650
751
|
getStudent(studentId: number): Promise<StudentDetail>;
|
|
651
752
|
searchStudents(params: SearchStudentsParams): Promise<SearchStudentsResponse>;
|
|
652
753
|
getStudentsList(params?: StudentsListParams): Promise<StudentsListResponse>;
|
package/index.js
CHANGED
|
@@ -179,7 +179,7 @@ class SalaryAPI {
|
|
|
179
179
|
|
|
180
180
|
/**
|
|
181
181
|
* Upload bank receipt Excel file for verification (Admin only)
|
|
182
|
-
* Supports Kaspi
|
|
182
|
+
* Supports Kaspi only
|
|
183
183
|
* Processing happens asynchronously, use getReceiptStatus to check progress
|
|
184
184
|
* @param {File|Buffer} file - Excel file (.xlsx) with bank statement
|
|
185
185
|
* @param {object} [options] - Upload options
|
|
@@ -189,13 +189,14 @@ class SalaryAPI {
|
|
|
189
189
|
*/
|
|
190
190
|
async uploadKaspiReceipt(file, options = {}) {
|
|
191
191
|
const formData = new FormData();
|
|
192
|
-
formData.append(
|
|
193
|
-
if (options.period_from)
|
|
194
|
-
|
|
192
|
+
formData.append("file", file);
|
|
193
|
+
if (options.period_from)
|
|
194
|
+
formData.append("period_from", options.period_from);
|
|
195
|
+
if (options.period_to) formData.append("period_to", options.period_to);
|
|
195
196
|
|
|
196
197
|
return await this.client.post("/api/v1/admin/receipts/upload", formData, {
|
|
197
198
|
headers: {
|
|
198
|
-
|
|
199
|
+
"Content-Type": "multipart/form-data",
|
|
199
200
|
},
|
|
200
201
|
});
|
|
201
202
|
}
|
|
@@ -218,7 +219,42 @@ class SalaryAPI {
|
|
|
218
219
|
* @returns {Promise<{status: string, log_id: number, file_name: string, summary?: object, details?: object, error_message?: string}>}
|
|
219
220
|
*/
|
|
220
221
|
async getReceiptStatus(logId) {
|
|
221
|
-
return await this.client.get(`/api/v1/admin/receipts/${logId}`);
|
|
222
|
+
return await this.client.get(`/api/v1/admin/receipts/logs/${logId}`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Manually add payment from non-Kaspi banks (Admin only)
|
|
227
|
+
* @param {object} data - Payment data
|
|
228
|
+
* @param {string} data.operation_number - 11-digit operation number
|
|
229
|
+
* @param {string} data.bank_id - Bank ID (halyk, forte, jusan, freedom, centercredit)
|
|
230
|
+
* @param {string} data.payment_method - Payment method ID
|
|
231
|
+
* @param {number} data.amount - Payment amount (2000-10000000 KZT)
|
|
232
|
+
* @param {string} [data.transaction_date] - Transaction date
|
|
233
|
+
* @param {string} [data.transaction_time] - Transaction time
|
|
234
|
+
* @param {string} [data.comment] - Comment (max 500 chars)
|
|
235
|
+
* @returns {Promise<{status: string, result: string, message: string, student?: object, payment: object}>}
|
|
236
|
+
*/
|
|
237
|
+
async addManualPayment(data) {
|
|
238
|
+
return await this.client.post("/api/v1/admin/receipts/manual-add", data);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Get list of orphan (unused) payments (Admin only)
|
|
243
|
+
* @param {object} [params] - Query parameters
|
|
244
|
+
* @param {number} [params.page=1] - Page number
|
|
245
|
+
* @param {number} [params.limit=30] - Items per page
|
|
246
|
+
* @returns {Promise<{orphan_payments: array, pagination: object}>}
|
|
247
|
+
*/
|
|
248
|
+
async getOrphanPayments(params = {}) {
|
|
249
|
+
return await this.client.get("/api/v1/admin/receipts/orphan", { params });
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Get available banks and payment methods configuration (Admin only)
|
|
254
|
+
* @returns {Promise<{banks: array}>}
|
|
255
|
+
*/
|
|
256
|
+
async getBanksConfig() {
|
|
257
|
+
return await this.client.get("/api/v1/admin/receipts/banks");
|
|
222
258
|
}
|
|
223
259
|
|
|
224
260
|
// ===== TEACHER ENDPOINTS =====
|
|
@@ -417,7 +453,24 @@ class SalaryAPI {
|
|
|
417
453
|
* @returns {Promise<object>}
|
|
418
454
|
*/
|
|
419
455
|
async transferStudent(studentId, data) {
|
|
420
|
-
return await this.client.post(
|
|
456
|
+
return await this.client.post(
|
|
457
|
+
`/api/v1/student/${studentId}/transfer`,
|
|
458
|
+
data,
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Change student manager (Admin only)
|
|
464
|
+
* @param {number} studentId - Student ID
|
|
465
|
+
* @param {object} data - Change manager data
|
|
466
|
+
* @param {number} data.new_manager_id - New manager user ID
|
|
467
|
+
* @returns {Promise<{student_id: number, old_manager: object, new_manager: object, reassigned_at: number}>}
|
|
468
|
+
*/
|
|
469
|
+
async changeStudentManager(studentId, data) {
|
|
470
|
+
return await this.client.post(
|
|
471
|
+
`/api/v1/student/${studentId}/change-manager`,
|
|
472
|
+
data,
|
|
473
|
+
);
|
|
421
474
|
}
|
|
422
475
|
|
|
423
476
|
/**
|