washday-sdk 1.6.65 → 1.6.66

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/api/index.js CHANGED
@@ -154,6 +154,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
154
154
  sendOrderUncollectedCustomerNotification: ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
155
155
  recordFailedServiceAttempt: ordersEndpoints.postModule.recordFailedServiceAttempt,
156
156
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
157
+ deleteOrderEvidence: ordersEndpoints.deleteModule.deleteOrderEvidence,
157
158
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
158
159
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
159
160
  setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
11
+ const GET_SET_ORDER = 'api/v2/order';
11
12
  const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
12
13
  export const deletePaymentLineById = function (orderId, id) {
13
14
  return __awaiter(this, void 0, void 0, function* () {
@@ -23,6 +24,20 @@ export const deletePaymentLineById = function (orderId, id) {
23
24
  }
24
25
  });
25
26
  };
27
+ export const deleteOrderEvidence = function (orderId, evidenceId) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ try {
30
+ const config = {
31
+ headers: { Authorization: `Bearer ${this.apiToken}` }
32
+ };
33
+ return yield this.axiosInstance.delete(`${GET_SET_ORDER}/${orderId}/evidence/${evidenceId}`, config);
34
+ }
35
+ catch (error) {
36
+ console.error('Error fetching deleteOrderEvidence:', error);
37
+ throw error;
38
+ }
39
+ });
40
+ };
26
41
  export const cancelOrderByIdCustomersApp = function (id) {
27
42
  return __awaiter(this, void 0, void 0, function* () {
28
43
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.6.65",
3
+ "version": "1.6.66",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -161,6 +161,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
161
161
  sendOrderUncollectedCustomerNotification: ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
162
162
  recordFailedServiceAttempt: ordersEndpoints.postModule.recordFailedServiceAttempt,
163
163
  deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
164
+ deleteOrderEvidence: ordersEndpoints.deleteModule.deleteOrderEvidence,
164
165
  getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
165
166
  getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
166
167
  setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
@@ -1,6 +1,7 @@
1
1
  import { WashdayClientInstance } from "../../interfaces/Api";
2
2
  import axiosInstance from "../axiosInstance";
3
3
  const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
4
+ const GET_SET_ORDER = 'api/v2/order';
4
5
  const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
5
6
 
6
7
  export const deletePaymentLineById = async function (this: WashdayClientInstance, orderId: string, id: string): Promise<any> {
@@ -15,6 +16,18 @@ export const deletePaymentLineById = async function (this: WashdayClientInstance
15
16
  }
16
17
  };
17
18
 
19
+ export const deleteOrderEvidence = async function (this: WashdayClientInstance, orderId: string, evidenceId: string): Promise<any> {
20
+ try {
21
+ const config = {
22
+ headers: { Authorization: `Bearer ${this.apiToken}` }
23
+ };
24
+ return await this.axiosInstance.delete(`${GET_SET_ORDER}/${orderId}/evidence/${evidenceId}`, config);
25
+ } catch (error) {
26
+ console.error('Error fetching deleteOrderEvidence:', error);
27
+ throw error;
28
+ }
29
+ };
30
+
18
31
 
19
32
  export const cancelOrderByIdCustomersApp = async function (this: WashdayClientInstance, id: string): Promise<any> {
20
33
  try {
@@ -146,6 +146,7 @@ export interface WashdayClientInstance {
146
146
  sendOrderUncollectedCustomerNotification: typeof ordersEndpoints.postModule.sendOrderUncollectedCustomerNotification,
147
147
  recordFailedServiceAttempt: typeof ordersEndpoints.postModule.recordFailedServiceAttempt,
148
148
  deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
149
+ deleteOrderEvidence: typeof ordersEndpoints.deleteModule.deleteOrderEvidence;
149
150
  getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
150
151
  getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
151
152
  setOrderAcceptedBySequence: typeof ordersEndpoints.putModule.setOrderAcceptedBySequence,
@@ -46,6 +46,16 @@ export interface IOrderPaymentLines {
46
46
  facturapiPaymentInvoiceID?: string | null,
47
47
  }
48
48
 
49
+ export interface IOrderEvidence {
50
+ _id?: any,
51
+ url: string,
52
+ cloudinaryPublicId?: string,
53
+ notes?: string,
54
+ type: 'pickup' | 'delivery' | 'signature' | 'other',
55
+ createdBy: IUser | string,
56
+ uploadedAt: Date,
57
+ }
58
+
49
59
  export type TaxBreakdownKey = "taxOne" | "taxTwo" | "taxThree";
50
60
 
51
61
  export interface ITaxBreakdownItem {
@@ -165,6 +175,7 @@ export interface IOrder {
165
175
  appliedStoreDiscounts: Array<string> | null,
166
176
  appliedDiscountCodes: Array<string> | null,
167
177
  paymentLines: Array<IOrderPaymentLines> | Array<string> | any,
178
+ evidence?: Array<IOrderEvidence>,
168
179
  facturapiInvoiceID?: string | null,
169
180
  pricingSnapshot?: IOrderPricingSnapshot | null,
170
181
  }
@@ -0,0 +1,37 @@
1
+ import { deleteOrderEvidence } from "../src/api/order/delete";
2
+
3
+ describe("orders.deleteOrderEvidence", () => {
4
+ it("deletes order evidence with the expected URL and auth header", async () => {
5
+ const deleteRequest = jest.fn().mockResolvedValue({
6
+ data: {
7
+ data: {
8
+ deleted: true,
9
+ evidenceId: "evidence-1",
10
+ cloudinaryResult: "ok",
11
+ },
12
+ },
13
+ });
14
+ const client = {
15
+ apiToken: "token-123",
16
+ axiosInstance: { delete: deleteRequest },
17
+ } as any;
18
+
19
+ const result = await deleteOrderEvidence.call(client, "order-1", "evidence-1");
20
+
21
+ expect(deleteRequest).toHaveBeenCalledWith(
22
+ "api/v2/order/order-1/evidence/evidence-1",
23
+ {
24
+ headers: { Authorization: "Bearer token-123" },
25
+ }
26
+ );
27
+ expect(result).toEqual({
28
+ data: {
29
+ data: {
30
+ deleted: true,
31
+ evidenceId: "evidence-1",
32
+ cloudinaryResult: "ok",
33
+ },
34
+ },
35
+ });
36
+ });
37
+ });