nazar-salary 2.5.1 → 2.6.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.
Files changed (3) hide show
  1. package/index.d.ts +22 -0
  2. package/index.js +14 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -948,6 +948,27 @@ declare module 'nazar-salary' {
948
948
  students: StudentLiteItem[];
949
949
  }
950
950
 
951
+ export interface DeletedPurchaseInfo {
952
+ id: number;
953
+ operation_number: string;
954
+ purchase_amount: number;
955
+ }
956
+
957
+ export interface RemainingPayment {
958
+ id: number;
959
+ operation_number: string;
960
+ purchase_amount: number;
961
+ prepayment: boolean;
962
+ is_verified: boolean;
963
+ }
964
+
965
+ export interface DeleteStudentPurchaseResponse {
966
+ message: string;
967
+ deleted_purchase: DeletedPurchaseInfo;
968
+ remaining_payments: RemainingPayment[];
969
+ total_purchase_amount: number;
970
+ }
971
+
951
972
  export default class SalaryAPI {
952
973
  constructor(options?: SalaryAPIOptions);
953
974
 
@@ -1012,6 +1033,7 @@ declare module 'nazar-salary' {
1012
1033
  /** @deprecated Use getStudentsList instead */
1013
1034
  getManagerStudents(managerId: number, params?: ManagerStudentsParams): Promise<ManagerStudentsResponse>;
1014
1035
  getStudentsListLite(params?: StudentsListLiteParams): Promise<StudentsListLiteResponse>;
1036
+ deleteStudentPurchase(studentId: number, purchaseId: number): Promise<DeleteStudentPurchaseResponse>;
1015
1037
 
1016
1038
  // Custom request
1017
1039
  request(method: string, path: string, data?: any): Promise<any>;
package/index.js CHANGED
@@ -652,6 +652,20 @@ class SalaryAPI {
652
652
  return await this.client.get("/api/v1/student/list/lite", { params });
653
653
  }
654
654
 
655
+ /**
656
+ * Delete student purchase/payment (requireAuth)
657
+ * Managers can only delete non-verified payments
658
+ * Admins can delete any payment
659
+ * @param {number} studentId - Student ID
660
+ * @param {number} purchaseId - Purchase ID to delete
661
+ * @returns {Promise<{message: string, deleted_purchase: object, remaining_payments: array, total_purchase_amount: number}>}
662
+ */
663
+ async deleteStudentPurchase(studentId, purchaseId) {
664
+ return await this.client.delete(
665
+ `/api/v1/student/${studentId}/purchase/${purchaseId}`,
666
+ );
667
+ }
668
+
655
669
  // ===== CUSTOM REQUEST =====
656
670
 
657
671
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nazar-salary",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Frontend library for Nazar Salary API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",