washday-sdk 1.6.12 → 1.6.13
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 +1 -0
- package/dist/api/order/post.js +24 -0
- package/package.json +1 -1
- package/src/api/index.ts +1 -0
- package/src/api/order/post.ts +37 -0
- package/src/interfaces/Api.ts +1 -0
package/dist/api/index.js
CHANGED
|
@@ -136,6 +136,7 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD', clientId, c
|
|
|
136
136
|
createOrderEvidence: ordersEndpoints.postModule.createOrderEvidence,
|
|
137
137
|
getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
138
138
|
setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
|
|
139
|
+
payAndCollect: ordersEndpoints.postModule.payAndCollect,
|
|
139
140
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
140
141
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
141
142
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
package/dist/api/order/post.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
const GET_SET_ORDER_PAYMENTLINES = (orderId) => `/api/v2/order/${orderId}/paymentLines`;
|
|
11
11
|
const GET_SET_ORDER = 'api/v2/order';
|
|
12
12
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
13
|
+
const PAY_AND_COLLECT = (sequence, storeId) => `/api/v2/order/${sequence}/${storeId}/pay-and-collect`;
|
|
13
14
|
export const createPaymentLine = function (id, data) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
try {
|
|
@@ -126,3 +127,26 @@ export const setOrderUncollected = function (data) {
|
|
|
126
127
|
}
|
|
127
128
|
});
|
|
128
129
|
};
|
|
130
|
+
export const payAndCollect = function (params) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
try {
|
|
133
|
+
const config = {
|
|
134
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
135
|
+
};
|
|
136
|
+
return yield this.axiosInstance.post(PAY_AND_COLLECT(params.sequence, params.storeId), {
|
|
137
|
+
paymentMethod: params.paymentMethod,
|
|
138
|
+
cashierBoxId: params.cashierBoxId,
|
|
139
|
+
amount: params.amount,
|
|
140
|
+
paymentDate: params.paymentDate,
|
|
141
|
+
collectedDateTime: params.collectedDateTime,
|
|
142
|
+
collectWithAmountDue: params.collectWithAmountDue,
|
|
143
|
+
pinUserId: params.pinUserId,
|
|
144
|
+
attemptId: params.attemptId,
|
|
145
|
+
}, config);
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.error('Error fetching payAndCollect:', error);
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -143,6 +143,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
143
143
|
createOrderEvidence: ordersEndpoints.postModule.createOrderEvidence,
|
|
144
144
|
getRedeemPointsPreview: ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
145
145
|
setOrderUncollected: ordersEndpoints.postModule.setOrderUncollected,
|
|
146
|
+
payAndCollect: ordersEndpoints.postModule.payAndCollect,
|
|
146
147
|
deletePaymentLineById: ordersEndpoints.deleteModule.deletePaymentLineById,
|
|
147
148
|
getListCustomersApp: ordersEndpoints.getModule.getListCustomersApp,
|
|
148
149
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
package/src/api/order/post.ts
CHANGED
|
@@ -6,6 +6,7 @@ import axiosInstance from "../axiosInstance";
|
|
|
6
6
|
const GET_SET_ORDER_PAYMENTLINES = (orderId: string) => `/api/v2/order/${orderId}/paymentLines`;
|
|
7
7
|
const GET_SET_ORDER = 'api/v2/order';
|
|
8
8
|
const GET_SET_ORDER_CUSTOMERS_APP = 'api/v2/washdayapp/orders';
|
|
9
|
+
const PAY_AND_COLLECT = (sequence: string, storeId: string) => `/api/v2/order/${sequence}/${storeId}/pay-and-collect`;
|
|
9
10
|
|
|
10
11
|
export const createPaymentLine = async function (this: WashdayClientInstance, id: string, data: {
|
|
11
12
|
amountPaid: number,
|
|
@@ -132,4 +133,40 @@ export const setOrderUncollected = async function (this: WashdayClientInstance,
|
|
|
132
133
|
console.error('Error fetching setOrderUncollected:', error);
|
|
133
134
|
throw error;
|
|
134
135
|
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const payAndCollect = async function (this: WashdayClientInstance, params: {
|
|
139
|
+
sequence: string;
|
|
140
|
+
storeId: string;
|
|
141
|
+
paymentMethod: string;
|
|
142
|
+
cashierBoxId?: string;
|
|
143
|
+
amount?: number;
|
|
144
|
+
paymentDate?: string | Date;
|
|
145
|
+
collectedDateTime?: string | Date;
|
|
146
|
+
collectWithAmountDue?: boolean;
|
|
147
|
+
pinUserId?: string;
|
|
148
|
+
attemptId?: string;
|
|
149
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
150
|
+
try {
|
|
151
|
+
const config = {
|
|
152
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
153
|
+
};
|
|
154
|
+
return await this.axiosInstance.post(
|
|
155
|
+
PAY_AND_COLLECT(params.sequence, params.storeId),
|
|
156
|
+
{
|
|
157
|
+
paymentMethod: params.paymentMethod,
|
|
158
|
+
cashierBoxId: params.cashierBoxId,
|
|
159
|
+
amount: params.amount,
|
|
160
|
+
paymentDate: params.paymentDate,
|
|
161
|
+
collectedDateTime: params.collectedDateTime,
|
|
162
|
+
collectWithAmountDue: params.collectWithAmountDue,
|
|
163
|
+
pinUserId: params.pinUserId,
|
|
164
|
+
attemptId: params.attemptId,
|
|
165
|
+
},
|
|
166
|
+
config
|
|
167
|
+
);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.error('Error fetching payAndCollect:', error);
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
135
172
|
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -128,6 +128,7 @@ export interface WashdayClientInstance {
|
|
|
128
128
|
createOrderEvidence: typeof ordersEndpoints.postModule.createOrderEvidence,
|
|
129
129
|
getRedeemPointsPreview: typeof ordersEndpoints.postModule.getRedeemPointsPreview,
|
|
130
130
|
setOrderUncollected: typeof ordersEndpoints.postModule.setOrderUncollected,
|
|
131
|
+
payAndCollect: typeof ordersEndpoints.postModule.payAndCollect,
|
|
131
132
|
deletePaymentLineById: typeof ordersEndpoints.deleteModule.deletePaymentLineById;
|
|
132
133
|
getListCustomersApp: typeof ordersEndpoints.getModule.getListCustomersApp;
|
|
133
134
|
getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
|