@wyocrm/sdk 5.5.39 → 5.5.40
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/build/index.d.ts +551 -0
- package/build/index.js +1 -1
- package/build/index.js.LICENSE.txt +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -23,21 +23,123 @@ declare module '@wyocrm/sdk/services' {
|
|
|
23
23
|
static getHttpClient(skipInit?: boolean): AxiosInstance;
|
|
24
24
|
static getMerchantGuid(): string;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Interface for Terminal Services.
|
|
28
|
+
*/
|
|
26
29
|
export interface ITerminalServices {
|
|
30
|
+
/**
|
|
31
|
+
* Uploads a customer photo.
|
|
32
|
+
* @param customerId - The customer ID.
|
|
33
|
+
* @param file - The file to upload.
|
|
34
|
+
* @param axiosConfig - The Axios request configuration.
|
|
35
|
+
* @returns A promise that resolves to nothing.
|
|
36
|
+
*/
|
|
27
37
|
uploadCustomerPhoto(customerId: number, fileUpload: IFileUploadRequest, axiosConfig?: AxiosRequestConfig): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a customer.
|
|
40
|
+
* @param options - The customer options.
|
|
41
|
+
* @param axiosConfig - The Axios request configuration.
|
|
42
|
+
* @returns A promise that resolves to the created customer.
|
|
43
|
+
*/
|
|
28
44
|
createCustomer(options: ICustomerOptions, axiosConfig?: AxiosRequestConfig): Promise<ICustomer>;
|
|
45
|
+
/**
|
|
46
|
+
* Updates a customer.
|
|
47
|
+
* @param customerId - The customer ID.
|
|
48
|
+
* @param options - The customer options.
|
|
49
|
+
* @param axiosConfig - The Axios request configuration.
|
|
50
|
+
* @returns A promise that resolves to the updated customer.
|
|
51
|
+
*/
|
|
29
52
|
updateCustomer(customerId: number, options: ICustomerOptions, axiosConfig?: AxiosRequestConfig): Promise<ICustomer>;
|
|
53
|
+
/**
|
|
54
|
+
* Deletes a customer.
|
|
55
|
+
* @param id - The customer ID.
|
|
56
|
+
* @param axiosConfig - The Axios request configuration.
|
|
57
|
+
* @returns A promise that resolves to nothing.
|
|
58
|
+
*/
|
|
30
59
|
deleteCustomer(id: number, axiosConfig?: AxiosRequestConfig): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Retrieves a customer by ID.
|
|
62
|
+
* @param id - The customer ID.
|
|
63
|
+
* @param axiosConfig - The Axios request configuration.
|
|
64
|
+
* @returns A promise that resolves to the retrieved customer.
|
|
65
|
+
*/
|
|
31
66
|
getCustomerById(id: number, axiosConfig?: AxiosRequestConfig): Promise<ICustomer>;
|
|
67
|
+
/**
|
|
68
|
+
* Retrieves coupons by customer ID.
|
|
69
|
+
* @param id - The customer ID.
|
|
70
|
+
* @param axiosConfig - The Axios request configuration.
|
|
71
|
+
* @returns A promise that resolves to the retrieved coupons.
|
|
72
|
+
*/
|
|
32
73
|
getCouponsByCustomerId(id: number, axiosConfig?: AxiosRequestConfig): Promise<IApiResponse<ICouponItem>>;
|
|
74
|
+
/**
|
|
75
|
+
* Marks a coupon as used/redeemed.
|
|
76
|
+
* @param couponGuid - The coupon GUID.
|
|
77
|
+
* @param axiosConfig - The Axios request configuration.
|
|
78
|
+
* @returns A promise that resolves when the coupon is marked as used.
|
|
79
|
+
*/
|
|
33
80
|
markCouponAsUsed(couponGuid: string, axiosConfig?: AxiosRequestConfig): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Marks a coupon as unused/not redeemed.
|
|
83
|
+
* @param couponGuid - The coupon GUID.
|
|
84
|
+
* @param axiosConfig - The Axios request configuration.
|
|
85
|
+
* @returns A promise that resolves when the coupon is marked as unused.
|
|
86
|
+
*/
|
|
34
87
|
markCouponAsUnused(couponGuid: string, axiosConfig?: AxiosRequestConfig): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Searches customers based on a keyword.
|
|
90
|
+
* @param keyword - The keyword to search.
|
|
91
|
+
* @param builder - The query builder for customers.
|
|
92
|
+
* @param axiosConfig - The Axios request configuration.
|
|
93
|
+
* @returns A promise that resolves to an array of searched customers.
|
|
94
|
+
*/
|
|
35
95
|
searchCustomers(keyword: string, builder: QueryBuilder<ICustomer>, axiosConfig?: AxiosRequestConfig): Promise<ICustomer[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Queries customers based on a query builder.
|
|
98
|
+
* @param builder - The query builder for customers.
|
|
99
|
+
* @param searchKeywords - The search keywords.
|
|
100
|
+
* @param axiosConfig - The Axios request configuration.
|
|
101
|
+
* @returns A promise that resolves to an array of queried customers.
|
|
102
|
+
*/
|
|
36
103
|
queryCustomers(builder: QueryBuilder<ICustomer>, searchKeywords?: string, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<ICustomer>>;
|
|
104
|
+
/**
|
|
105
|
+
* Queries transactions based on a query builder.
|
|
106
|
+
* @param query - The query builder for transactions.
|
|
107
|
+
* @param axiosConfig - The Axios request configuration.
|
|
108
|
+
* @returns A promise that resolves to an array of queried transactions.
|
|
109
|
+
*/
|
|
37
110
|
queryTransactions(query: QueryBuilder<ITransaction>, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<ITransaction>>;
|
|
111
|
+
/**
|
|
112
|
+
* Queries orders based on a query builder.
|
|
113
|
+
* @param query - The query builder for orders.
|
|
114
|
+
* @param axiosConfig - The Axios request configuration.
|
|
115
|
+
* @returns A promise that resolves to an array of queried orders.
|
|
116
|
+
*/
|
|
38
117
|
queryOrders(query: QueryBuilder<IOrder>, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<IOrder>>;
|
|
118
|
+
/**
|
|
119
|
+
* Applicable payment method code: PNOW
|
|
120
|
+
* @param terminalId - The terminal ID.
|
|
121
|
+
* @param amount - The amount for the charge.
|
|
122
|
+
* @param invoiceRefId - The invoice reference ID.
|
|
123
|
+
* @param description - The description.
|
|
124
|
+
* @param paymentMethodCode - The payment method code.
|
|
125
|
+
* @param axiosConfig - The Axios request configuration.
|
|
126
|
+
* @returns A promise that resolves to the created charge.
|
|
127
|
+
*/
|
|
39
128
|
createCharge(terminalId: string, amount: number, invoiceRefId: string, description: string, paymentMethodCode?: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<ICharge>>;
|
|
129
|
+
/**
|
|
130
|
+
* Applicable payment method code: PNOW
|
|
131
|
+
* Retrieves a charge by ID.
|
|
132
|
+
* @param chargeId - The charge ID.
|
|
133
|
+
* @param axiosConfig - The Axios request configuration.
|
|
134
|
+
* @returns A promise that resolves to the retrieved charge.
|
|
135
|
+
*/
|
|
40
136
|
getCharge(chargeGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<ICharge>>;
|
|
137
|
+
/**
|
|
138
|
+
* Cancels a charge by charge GUID.
|
|
139
|
+
* @param chargeGuid - The charge GUID to cancel.
|
|
140
|
+
* @param axiosConfig - The Axios request configuration.
|
|
141
|
+
* @returns A promise that resolves to the cancelled charge response.
|
|
142
|
+
*/
|
|
41
143
|
cancelCharge(chargeGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<ICharge>>;
|
|
42
144
|
}
|
|
43
145
|
export class TerminalServices implements ITerminalServices {
|
|
@@ -58,7 +160,18 @@ declare module '@wyocrm/sdk/services' {
|
|
|
58
160
|
cancelCharge(chargeGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<ICharge>>;
|
|
59
161
|
}
|
|
60
162
|
export interface IAdminServices {
|
|
163
|
+
/**
|
|
164
|
+
* Gets merchants by admin user
|
|
165
|
+
* @param axiosConfig - The Axios request configuration
|
|
166
|
+
* @returns A promise that resolves to an array of merchants
|
|
167
|
+
*/
|
|
61
168
|
getMerchants(axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IMerchant[]>>;
|
|
169
|
+
/**
|
|
170
|
+
* Gets a merchant by guid
|
|
171
|
+
* @param merchantGuid - The merchant GUID
|
|
172
|
+
* @param axiosConfig - The Axios request configuration
|
|
173
|
+
* @returns A promise that resolves to a merchant
|
|
174
|
+
*/
|
|
62
175
|
getMerchantByGuid(merchantGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IMerchant>>;
|
|
63
176
|
}
|
|
64
177
|
export class AdminServices implements IAdminServices {
|
|
@@ -66,45 +179,242 @@ declare module '@wyocrm/sdk/services' {
|
|
|
66
179
|
getMerchantByGuid(merchantGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IMerchant>>;
|
|
67
180
|
}
|
|
68
181
|
export interface IClientService {
|
|
182
|
+
/**
|
|
183
|
+
* Exchanges credentials for access token using password grant
|
|
184
|
+
* @param request - Password grant request containing username and password
|
|
185
|
+
* @param headers - Custom headers including language preference
|
|
186
|
+
* @param axiosConfig - Axios request configuration
|
|
187
|
+
* @returns Promise resolving to token response
|
|
188
|
+
*/
|
|
69
189
|
exchangePasswordGrant(request: IPasswordGrantRequest, headers?: ICustomHeaders, axiosConfig?: AxiosRequestConfig): Promise<ITokenResponse>;
|
|
190
|
+
/**
|
|
191
|
+
* Exchanges Google ID token for access token
|
|
192
|
+
* @param request - Google ID token request
|
|
193
|
+
* @param headers - Custom headers including language preference
|
|
194
|
+
* @param axiosConfig - Axios request configuration
|
|
195
|
+
* @returns Promise resolving to token response
|
|
196
|
+
*/
|
|
70
197
|
exchangeGoogleIdToken(request: IGoogleIdTokenRequest, headers?: ICustomHeaders, axiosConfig?: AxiosRequestConfig): Promise<ITokenResponse>;
|
|
198
|
+
/**
|
|
199
|
+
* Exchanges Apple ID token for access token
|
|
200
|
+
* @param request - Apple ID token request
|
|
201
|
+
* @param headers - Custom headers including language preference
|
|
202
|
+
* @param axiosConfig - Axios request configuration
|
|
203
|
+
* @returns Promise resolving to token response
|
|
204
|
+
*/
|
|
71
205
|
exchangeAppleIdToken(request: IAppleIdTokenRequest, headers?: ICustomHeaders, axiosConfig?: AxiosRequestConfig): Promise<ITokenResponse>;
|
|
206
|
+
/**
|
|
207
|
+
* Exchanges WeChat authorization code for access token
|
|
208
|
+
* @param request - WeChat code request
|
|
209
|
+
* @param headers - Custom headers including language preference
|
|
210
|
+
* @param axiosConfig - Axios request configuration
|
|
211
|
+
* @returns Promise resolving to token response
|
|
212
|
+
*/
|
|
72
213
|
exchangeWeixinCode(request: IWeixinCodeRequest, headers?: ICustomHeaders, axiosConfig?: AxiosRequestConfig): Promise<ITokenResponse>;
|
|
214
|
+
/**
|
|
215
|
+
* Gets user information using access token
|
|
216
|
+
* @param axiosConfig - Axios request configuration
|
|
217
|
+
* @returns Promise resolving to user information
|
|
218
|
+
*/
|
|
73
219
|
getUserInfo(axiosConfig?: AxiosRequestConfig): Promise<IUserInfo>;
|
|
220
|
+
/**
|
|
221
|
+
* Sends OTP to customer for a specific merchant
|
|
222
|
+
* @param merchantGuid - The merchant GUID
|
|
223
|
+
* @param request - OTP request containing phone number
|
|
224
|
+
* @param headers - Custom headers including language preference
|
|
225
|
+
* @param axiosConfig - Axios request configuration
|
|
226
|
+
* @returns Promise resolving to response with headers
|
|
227
|
+
*/
|
|
74
228
|
sendOtp(merchantGuid: string, request: IOtpRequest, headers?: ICustomHeaders, axiosConfig?: AxiosRequestConfig): Promise<AxiosResponse<Response>>;
|
|
229
|
+
/**
|
|
230
|
+
* Retrieves terminal merchant account details.
|
|
231
|
+
* @param merchantGuid - The merchant GUID.
|
|
232
|
+
* @param axiosConfig - The Axios request configuration.
|
|
233
|
+
* @returns A promise that resolves to the merchant account details.
|
|
234
|
+
*/
|
|
75
235
|
getUserDetail(merchantGuid: string, axiosConfig?: AxiosRequestConfig): Promise<AxiosResponse<IObjectResponse<IUserDetail>>>;
|
|
236
|
+
/**
|
|
237
|
+
* Checks if a social account exists
|
|
238
|
+
* @param socialAccount - The social account type
|
|
239
|
+
* @param code - The social account code
|
|
240
|
+
* @param axiosConfig - The Axios request configuration
|
|
241
|
+
* @returns A promise that resolves to the social account existence
|
|
242
|
+
*/
|
|
76
243
|
socialAccountExists(socialAccount: 'apple' | 'google' | 'weixin', code: string, axiosConfig?: AxiosRequestConfig): Promise<AxiosResponse<IObjectResponse<boolean>>>;
|
|
244
|
+
/**
|
|
245
|
+
* Queries transactions for a specific merchant
|
|
246
|
+
* @param merchantGuid - The merchant GUID
|
|
247
|
+
* @param builder - Query builder for filtering and pagination
|
|
248
|
+
* @param axiosConfig - The Axios request configuration
|
|
249
|
+
* @returns A promise that resolves to a QueryResponse containing transactions
|
|
250
|
+
*/
|
|
77
251
|
queryTransactions(merchantGuid: string, builder: QueryBuilder<ITransaction & {
|
|
78
252
|
IncludeJointMerchants?: boolean;
|
|
79
253
|
}>, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<ITransaction>>;
|
|
254
|
+
/**
|
|
255
|
+
* Gets current user account information
|
|
256
|
+
* @param axiosConfig - Axios request configuration
|
|
257
|
+
* @returns Promise resolving to user account data
|
|
258
|
+
*/
|
|
80
259
|
getAccount(axiosConfig?: AxiosRequestConfig): Promise<ICustomer>;
|
|
260
|
+
/**
|
|
261
|
+
* Updates current user account information
|
|
262
|
+
* @param data - Partial user data to update
|
|
263
|
+
* @param axiosConfig - Axios request configuration
|
|
264
|
+
* @returns Promise resolving to updated user account data
|
|
265
|
+
*/
|
|
81
266
|
updateAccount(data: Partial<ICustomer>, axiosConfig?: AxiosRequestConfig): Promise<ICustomer>;
|
|
267
|
+
/**
|
|
268
|
+
* Uploads user profile photo
|
|
269
|
+
* @param file - File upload request with base64 encoded image
|
|
270
|
+
* @param axiosConfig - Axios request configuration
|
|
271
|
+
* @returns Promise resolving to updated user account data
|
|
272
|
+
*/
|
|
82
273
|
uploadProfilePhoto(file: IFileUploadRequest, axiosConfig?: AxiosRequestConfig): Promise<ICustomer>;
|
|
274
|
+
/**
|
|
275
|
+
* Changes user password
|
|
276
|
+
* @param request - Password change request with current and new password
|
|
277
|
+
* @param axiosConfig - Axios request configuration
|
|
278
|
+
* @returns Promise resolving to response
|
|
279
|
+
*/
|
|
83
280
|
changePassword(request: IChangePasswordRequest, axiosConfig?: AxiosRequestConfig): Promise<Response>;
|
|
281
|
+
/**
|
|
282
|
+
* Changes user phone number via OTP verification
|
|
283
|
+
* @param request - Phone number change request with new number and OTP
|
|
284
|
+
* @param axiosConfig - Axios request configuration
|
|
285
|
+
* @returns Promise resolving to response
|
|
286
|
+
*/
|
|
84
287
|
changePhoneNumberByOtp(request: IChangePhoneNumberRequest, axiosConfig?: AxiosRequestConfig): Promise<Response>;
|
|
288
|
+
/**
|
|
289
|
+
* Unsubscribes from topic notifications
|
|
290
|
+
* @param request - Unsubscribe request with topic and channel
|
|
291
|
+
* @param axiosConfig - Axios request configuration
|
|
292
|
+
* @returns Promise resolving to response
|
|
293
|
+
*/
|
|
85
294
|
unsubscribe(request: ISubscribeRequest, axiosConfig?: AxiosRequestConfig): Promise<Response>;
|
|
295
|
+
/**
|
|
296
|
+
* Agrees to PDPA terms
|
|
297
|
+
* @param axiosConfig - Axios request configuration
|
|
298
|
+
* @returns Promise resolving to response
|
|
299
|
+
*/
|
|
86
300
|
agreePdpa(axiosConfig?: AxiosRequestConfig): Promise<Response>;
|
|
301
|
+
/**
|
|
302
|
+
* Gets user addresses
|
|
303
|
+
* @param axiosConfig - Axios request configuration
|
|
304
|
+
* @returns Promise resolving to addresses list
|
|
305
|
+
*/
|
|
87
306
|
getAddresses(axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<Address[]>>;
|
|
307
|
+
/**
|
|
308
|
+
* Creates new address
|
|
309
|
+
* @param data - Address data
|
|
310
|
+
* @param axiosConfig - Axios request configuration
|
|
311
|
+
* @returns Promise resolving to created address
|
|
312
|
+
*/
|
|
88
313
|
createAddress(data: Partial<Address>, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<Address>>;
|
|
314
|
+
/**
|
|
315
|
+
* Updates existing address
|
|
316
|
+
* @param id - Address ID
|
|
317
|
+
* @param data - Address data to update
|
|
318
|
+
* @param axiosConfig - Axios request configuration
|
|
319
|
+
* @returns Promise resolving to updated address
|
|
320
|
+
*/
|
|
89
321
|
updateAddress(id: number, data: Partial<Address>, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<Address>>;
|
|
322
|
+
/**
|
|
323
|
+
* Deletes address
|
|
324
|
+
* @param id - Address ID
|
|
325
|
+
* @param axiosConfig - Axios request configuration
|
|
326
|
+
* @returns Promise resolving to deleted address
|
|
327
|
+
*/
|
|
90
328
|
deleteAddress(id: number, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<Address>>;
|
|
329
|
+
/**
|
|
330
|
+
* Gets user payment sources
|
|
331
|
+
* @param axiosConfig - Axios request configuration
|
|
332
|
+
* @returns Promise resolving to payment sources list
|
|
333
|
+
*/
|
|
91
334
|
getPaymentSources(axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IPaymentSource[]>>;
|
|
335
|
+
/**
|
|
336
|
+
* Creates new payment source
|
|
337
|
+
* @param data - Payment source data with payment method code and token
|
|
338
|
+
* @param axiosConfig - Axios request configuration
|
|
339
|
+
* @returns Promise resolving to created payment source
|
|
340
|
+
*/
|
|
92
341
|
createPaymentSource(data: Partial<IPaymentSource> & {
|
|
93
342
|
payment_method_code: string;
|
|
94
343
|
token: string;
|
|
95
344
|
}, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IPaymentSource>>;
|
|
345
|
+
/**
|
|
346
|
+
* Updates payment source default status
|
|
347
|
+
* @param data - Payment source ID and default flag
|
|
348
|
+
* @param axiosConfig - Axios request configuration
|
|
349
|
+
* @returns Promise resolving to updated payment source
|
|
350
|
+
*/
|
|
96
351
|
updatePaymentSource(data: {
|
|
97
352
|
id: number;
|
|
98
353
|
is_default: boolean;
|
|
99
354
|
}, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IPaymentSource>>;
|
|
355
|
+
/**
|
|
356
|
+
* Deletes payment source
|
|
357
|
+
* @param id - Payment source ID
|
|
358
|
+
* @param axiosConfig - Axios request configuration
|
|
359
|
+
* @returns Promise resolving to deleted payment source
|
|
360
|
+
*/
|
|
100
361
|
deletePaymentSource(id: number, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IPaymentSource>>;
|
|
362
|
+
/**
|
|
363
|
+
* Sends OTP via SMS
|
|
364
|
+
* @param request - OTP SMS request with phone number
|
|
365
|
+
* @param axiosConfig - Axios request configuration
|
|
366
|
+
* @returns Promise resolving to response
|
|
367
|
+
*/
|
|
101
368
|
sendOtpSms(request: IOtpSmsRequest, axiosConfig?: AxiosRequestConfig): Promise<Response>;
|
|
369
|
+
/**
|
|
370
|
+
* Gets customer Terms and Conditions agreement status
|
|
371
|
+
* @param phoneNumber - Customer's phone number
|
|
372
|
+
* @param axiosConfig - Axios request configuration
|
|
373
|
+
* @returns Promise resolving to T&C status
|
|
374
|
+
*/
|
|
102
375
|
getTermsAndConditionStatus(phoneNumber: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<boolean>>;
|
|
376
|
+
/**
|
|
377
|
+
* Collects a coupon by coupon guid
|
|
378
|
+
* @param couponGuid - The coupon GUID
|
|
379
|
+
* @param axiosConfig - Axios request configuration
|
|
380
|
+
* @returns Promise resolving to the collected coupon
|
|
381
|
+
*/
|
|
103
382
|
collectCouponByGuid(couponGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<ICouponItem>>;
|
|
383
|
+
/**
|
|
384
|
+
* Gets a coupon by coupon guid
|
|
385
|
+
* @param couponGuid - The coupon GUID
|
|
386
|
+
* @param axiosConfig - Axios request configuration
|
|
387
|
+
* @returns Promise resolving to the coupon details
|
|
388
|
+
*/
|
|
104
389
|
getCouponByGuid(couponGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<ICoupon>>;
|
|
390
|
+
/**
|
|
391
|
+
* Gets WhatsApp login request
|
|
392
|
+
* @param axiosConfig - Axios request configuration
|
|
393
|
+
* @returns Promise resolving to WhatsApp login response
|
|
394
|
+
*/
|
|
105
395
|
getWhatsAppLoginRequest(axiosConfig?: AxiosRequestConfig): Promise<IObjectResponse<IWhatsAppLoginResponse>>;
|
|
396
|
+
/**
|
|
397
|
+
* Gets WhatsApp login status
|
|
398
|
+
* @param sessionUid - The session UID
|
|
399
|
+
* @param axiosConfig - Axios request configuration
|
|
400
|
+
* @returns Promise resolving to WhatsApp login status response
|
|
401
|
+
*/
|
|
106
402
|
getWhatsAppLoginStatus(sessionUid: string, axiosConfig?: AxiosRequestConfig): Promise<IWhatsAppLoginStatusResponse>;
|
|
403
|
+
/**
|
|
404
|
+
* Exchanges WhatsApp session code for access token
|
|
405
|
+
* @param request - WhatsApp session request containing code
|
|
406
|
+
* @param headers - Custom headers including language preference
|
|
407
|
+
* @param axiosConfig - Axios request configuration
|
|
408
|
+
* @returns Promise resolving to token response
|
|
409
|
+
*/
|
|
107
410
|
exchangeWhatsAppSessionCode(request: IWhatsAppSessionRequest, headers?: ICustomHeaders, axiosConfig?: AxiosRequestConfig): Promise<ITokenResponse>;
|
|
411
|
+
/**
|
|
412
|
+
* Queries coupon items for a specific merchant
|
|
413
|
+
* @param merchantGuid - The merchant GUID
|
|
414
|
+
* @param builder - Query builder for filtering and pagination
|
|
415
|
+
* @param axiosConfig - The Axios request configuration
|
|
416
|
+
* @returns A promise that resolves to a QueryResponse containing coupon items
|
|
417
|
+
*/
|
|
108
418
|
queryCouponItems(merchantGuid: string, builder: QueryBuilder<ICouponItem & {
|
|
109
419
|
is_redeemed?: boolean;
|
|
110
420
|
is_expired?: boolean;
|
|
@@ -168,7 +478,9 @@ declare module '@wyocrm/sdk/types' {
|
|
|
168
478
|
delivery?: Delivery | undefined;
|
|
169
479
|
}
|
|
170
480
|
export interface Delivery {
|
|
481
|
+
/** When this transaction is created */
|
|
171
482
|
created_at?: Date;
|
|
483
|
+
/** Date and time of the latest update on this transaction */
|
|
172
484
|
updated_at?: Date;
|
|
173
485
|
errors?: string[] | undefined;
|
|
174
486
|
id?: number;
|
|
@@ -184,7 +496,9 @@ declare module '@wyocrm/sdk/types' {
|
|
|
184
496
|
to_address1?: Address | undefined;
|
|
185
497
|
}
|
|
186
498
|
export interface Address {
|
|
499
|
+
/** When this transaction is created */
|
|
187
500
|
created_at?: Date;
|
|
501
|
+
/** Date and time of the latest update on this transaction */
|
|
188
502
|
updated_at?: Date;
|
|
189
503
|
errors?: string[] | undefined;
|
|
190
504
|
id?: number;
|
|
@@ -213,43 +527,81 @@ declare module '@wyocrm/sdk/types' {
|
|
|
213
527
|
};
|
|
214
528
|
}
|
|
215
529
|
export interface ICustomer {
|
|
530
|
+
/** Unique membership ID */
|
|
216
531
|
membership_id: string;
|
|
532
|
+
/** Merchant Identifier */
|
|
217
533
|
license_id: number;
|
|
534
|
+
/** User's total credit */
|
|
218
535
|
credit: number;
|
|
536
|
+
/** User's total points */
|
|
219
537
|
point: number;
|
|
538
|
+
/** Total transaction amount */
|
|
220
539
|
transaction_total: number;
|
|
540
|
+
/** Number of transactions */
|
|
221
541
|
transaction_time: number;
|
|
542
|
+
/** User's tier */
|
|
222
543
|
tier: any | null;
|
|
544
|
+
/** Array of tag GUIDs */
|
|
223
545
|
tag_guids: string[] | null;
|
|
546
|
+
/** User's Group ID */
|
|
224
547
|
user_group_id: number;
|
|
548
|
+
/** Name of the User's Group */
|
|
225
549
|
user_group_name: string | null;
|
|
550
|
+
/** Expiration date of the group */
|
|
226
551
|
group_expires_at: string;
|
|
552
|
+
/** Error message */
|
|
227
553
|
error: string | null;
|
|
554
|
+
/** User's ID */
|
|
228
555
|
id: number;
|
|
556
|
+
/** Reference ID */
|
|
229
557
|
ref_id: string;
|
|
558
|
+
/** Image URL */
|
|
230
559
|
image_url: string | null;
|
|
560
|
+
/** Stripe token */
|
|
231
561
|
stripe_token: string | null;
|
|
562
|
+
/** Stripe customer ID */
|
|
232
563
|
stripe_customer_id: string | null;
|
|
564
|
+
/** Username */
|
|
233
565
|
username: string;
|
|
566
|
+
/** Company name */
|
|
234
567
|
company: string | null;
|
|
568
|
+
/** Identification number */
|
|
235
569
|
ic: string | null;
|
|
570
|
+
/** Display name */
|
|
236
571
|
display_name: string;
|
|
572
|
+
/** Full name */
|
|
237
573
|
full_name: string;
|
|
574
|
+
/** Birth date */
|
|
238
575
|
birth_date: string | null;
|
|
576
|
+
/** Gender */
|
|
239
577
|
gender: string | null;
|
|
578
|
+
/** Address */
|
|
240
579
|
address: string | null;
|
|
580
|
+
/** Postcode */
|
|
241
581
|
postcode: string | null;
|
|
582
|
+
/** Additional notes */
|
|
242
583
|
note: string | null;
|
|
584
|
+
/** Preferred language */
|
|
243
585
|
language: string | null;
|
|
586
|
+
/** Time zone */
|
|
244
587
|
time_zone: string | null;
|
|
588
|
+
/** Creation date and time */
|
|
245
589
|
created_at: string;
|
|
590
|
+
/** Last update date and time */
|
|
246
591
|
updated_at: string;
|
|
592
|
+
/** Comma-separated list of license IDs */
|
|
247
593
|
license_ids: string;
|
|
594
|
+
/** Security stamp */
|
|
248
595
|
security_stamp: string;
|
|
596
|
+
/** Phone number */
|
|
249
597
|
phone_number: string;
|
|
598
|
+
/** Email address */
|
|
250
599
|
email: string | null;
|
|
600
|
+
/** Whether the email is confirmed */
|
|
251
601
|
email_confirmed: boolean;
|
|
602
|
+
/** Whether the phone number is confirmed */
|
|
252
603
|
phone_number_confirmed: boolean;
|
|
604
|
+
/** Date and time of agreeing to PDPA */
|
|
253
605
|
agree_pdpa_at: string | null;
|
|
254
606
|
}
|
|
255
607
|
export class Customer implements ICustomer {
|
|
@@ -293,14 +645,23 @@ declare module '@wyocrm/sdk/types' {
|
|
|
293
645
|
agree_pdpa_at: any;
|
|
294
646
|
}
|
|
295
647
|
export type ICustomerOptions = {
|
|
648
|
+
/** Reference ID */
|
|
296
649
|
ref_id: string;
|
|
650
|
+
/** IC */
|
|
297
651
|
ic: string;
|
|
652
|
+
/** Display name of the user */
|
|
298
653
|
display_name: string;
|
|
654
|
+
/** URL of the user's image */
|
|
299
655
|
image_url: string;
|
|
656
|
+
/** Birth date of the user */
|
|
300
657
|
birth_date: string;
|
|
658
|
+
/** Gender of the user */
|
|
301
659
|
gender: string;
|
|
660
|
+
/** Language of the user */
|
|
302
661
|
language: string;
|
|
662
|
+
/** Phone number of the user */
|
|
303
663
|
phone_number: string;
|
|
664
|
+
/** Email of the user */
|
|
304
665
|
email: string;
|
|
305
666
|
};
|
|
306
667
|
export class CustomerOptions implements ICustomerOptions {
|
|
@@ -340,38 +701,67 @@ declare module '@wyocrm/sdk/types' {
|
|
|
340
701
|
At = "StartsWith"
|
|
341
702
|
}
|
|
342
703
|
export interface ITransactionMerchant {
|
|
704
|
+
/** Merchant name */
|
|
343
705
|
name?: string;
|
|
706
|
+
/** Merchant logo URL */
|
|
344
707
|
logo_url?: string;
|
|
345
708
|
}
|
|
346
709
|
export interface ITransactionMeta {
|
|
710
|
+
/** List of coupon IDs to redeem */
|
|
347
711
|
coupon_ids_to_redeem: string[];
|
|
348
712
|
}
|
|
349
713
|
export interface ITransaction {
|
|
714
|
+
/** Unique identifier for the order */
|
|
350
715
|
id: number;
|
|
716
|
+
/** Associated invoice ID, 0 if not applicable */
|
|
351
717
|
invoice_id: number;
|
|
718
|
+
/** Type of the order, e.g., 'revopos' */
|
|
352
719
|
type: string;
|
|
720
|
+
/** Primary license ID associated with the order */
|
|
353
721
|
primary_license_id: number;
|
|
722
|
+
/** License ID associated with the order */
|
|
354
723
|
license_id: number;
|
|
724
|
+
/** Reference ID for the order */
|
|
355
725
|
ref_id: string;
|
|
726
|
+
/** User ID who placed the order */
|
|
356
727
|
user_id: number;
|
|
728
|
+
/** Credit added to the order, default is 0.00 */
|
|
357
729
|
add_credit: number;
|
|
730
|
+
/** Credit subtracted from the order, default is 0.00 */
|
|
358
731
|
minus_credit: number;
|
|
732
|
+
/** Points added to the order, default is 0.00 */
|
|
359
733
|
add_point: number;
|
|
734
|
+
/** Points subtracted from the order, default is 0.00 */
|
|
360
735
|
minus_point: number;
|
|
736
|
+
/** Current status of the order, e.g., 'paid' */
|
|
361
737
|
status: string;
|
|
738
|
+
/** Grand total amount of the order */
|
|
362
739
|
grand_total: number;
|
|
740
|
+
/** Whether the order belongs to this shop */
|
|
363
741
|
is_local: boolean;
|
|
742
|
+
/** Timestamp when the order was closed */
|
|
364
743
|
closed_at: Date;
|
|
744
|
+
/** Timestamp when the order was created */
|
|
365
745
|
created_at: Date;
|
|
746
|
+
/** Timestamp when the order was last updated */
|
|
366
747
|
updated_at: Date;
|
|
748
|
+
/** List of errors, if any, during order processing */
|
|
367
749
|
errors: string[];
|
|
750
|
+
/** The complete invoice object */
|
|
368
751
|
invoice?: any;
|
|
752
|
+
/** The complete invoice configuration object */
|
|
369
753
|
config?: any;
|
|
754
|
+
/** Merchant information */
|
|
370
755
|
merchant?: ITransactionMerchant;
|
|
756
|
+
/** The complete coupon redemption object snapshot at the time of redemption */
|
|
371
757
|
coupon?: any;
|
|
758
|
+
/** The amount of credit which is used within expiry date */
|
|
372
759
|
used_credit: number;
|
|
760
|
+
/** The amount of credit which is expired */
|
|
373
761
|
expired_credit: number;
|
|
762
|
+
/** The credit expiry date and time */
|
|
374
763
|
expired_at: string | null;
|
|
764
|
+
/** The transaction meta data */
|
|
375
765
|
meta: ITransactionMeta;
|
|
376
766
|
}
|
|
377
767
|
export class Transaction implements ITransaction {
|
|
@@ -420,31 +810,55 @@ declare module '@wyocrm/sdk/types' {
|
|
|
420
810
|
PaymentDeclined = "Payment Declined"
|
|
421
811
|
}
|
|
422
812
|
export interface IMeta {
|
|
813
|
+
/** Date and time when the order was placed */
|
|
423
814
|
placed_at: string;
|
|
815
|
+
/** Current status of the order */
|
|
424
816
|
current_status: string;
|
|
817
|
+
/** Date and time when the order preparation started */
|
|
425
818
|
prepare_at: string;
|
|
819
|
+
/** Status of the order before the current status */
|
|
426
820
|
previous_status: string;
|
|
821
|
+
/** Date and time when the order is expected to be delivered */
|
|
427
822
|
deliver_at: string;
|
|
823
|
+
/** Date and time when the order was actually delivered */
|
|
428
824
|
delivered_at: string;
|
|
429
825
|
}
|
|
430
826
|
export interface IOrder {
|
|
827
|
+
/** Unique identifier for the order */
|
|
431
828
|
id: number;
|
|
829
|
+
/** Reference identifier for the order */
|
|
432
830
|
order_ref: string;
|
|
831
|
+
/** Table ID associated with the order (0 if not applicable) */
|
|
433
832
|
table_id: number;
|
|
833
|
+
/** Invoice ID associated with the order */
|
|
434
834
|
invoice_id: number;
|
|
835
|
+
/** Call number associated with the order (0 if not applicable) */
|
|
435
836
|
call_num: number;
|
|
837
|
+
/** User ID of the person who placed the order */
|
|
436
838
|
user_id: number;
|
|
839
|
+
/** License ID associated with the order */
|
|
437
840
|
license_id: number;
|
|
841
|
+
/** Charge ID associated with the order */
|
|
438
842
|
charge_id: number;
|
|
843
|
+
/** Delivery ID associated with the order */
|
|
439
844
|
delivery_id: number;
|
|
845
|
+
/** Type of the order (e.g., Delivery, Pickup) */
|
|
440
846
|
order_type: string;
|
|
847
|
+
/** Payment source ID used for the order */
|
|
441
848
|
payment_source_id: number;
|
|
849
|
+
/** Current status of the order (e.g., Delivered, Pending) */
|
|
442
850
|
status: OrderStatus;
|
|
851
|
+
/** Name of the customer */
|
|
443
852
|
customer_name: string;
|
|
853
|
+
/** Phone number of the customer */
|
|
444
854
|
customer_phone_number: string;
|
|
855
|
+
/** Metadata associated with the order */
|
|
445
856
|
meta: IMeta;
|
|
857
|
+
/** Date and time when the order was created */
|
|
446
858
|
created_at: string;
|
|
859
|
+
/** Date and time when the order was last updated */
|
|
447
860
|
updated_at: string;
|
|
861
|
+
/** List of errors encountered (if any) */
|
|
448
862
|
errors: string[];
|
|
449
863
|
}
|
|
450
864
|
export class Order implements IOrder {
|
|
@@ -500,7 +914,9 @@ declare module '@wyocrm/sdk/types' {
|
|
|
500
914
|
EXCLUSIVE = 3
|
|
501
915
|
}
|
|
502
916
|
export interface IApplying<T> {
|
|
917
|
+
/** Applying type */
|
|
503
918
|
applying_type: ApplyingType;
|
|
919
|
+
/** List of applying items */
|
|
504
920
|
applying_items: T[];
|
|
505
921
|
}
|
|
506
922
|
export class Applying<T> implements IApplying<T> {
|
|
@@ -509,34 +925,63 @@ declare module '@wyocrm/sdk/types' {
|
|
|
509
925
|
constructor();
|
|
510
926
|
}
|
|
511
927
|
export interface ICoupon {
|
|
928
|
+
/** Coupon GUID */
|
|
512
929
|
guid: string;
|
|
930
|
+
/** Promo code */
|
|
513
931
|
promo_code: string;
|
|
932
|
+
/** Flag for multi-store applicability */
|
|
514
933
|
is_multi_stores: boolean;
|
|
934
|
+
/** Name of the coupon */
|
|
515
935
|
name: string;
|
|
936
|
+
/** Alias of the coupon */
|
|
516
937
|
alias: string;
|
|
938
|
+
/** Coupon description */
|
|
517
939
|
description: string;
|
|
940
|
+
/** Coupon description alias */
|
|
518
941
|
description_alias: string;
|
|
942
|
+
/** Applying plus details */
|
|
519
943
|
applying_plus: IApplying<string>;
|
|
944
|
+
/** Applying user tags details */
|
|
520
945
|
applying_user_tags: IApplying<string>;
|
|
946
|
+
/** Applying user groups details */
|
|
521
947
|
applying_user_groups: IApplying<number>;
|
|
948
|
+
/** Discount calculation type */
|
|
522
949
|
discount_calc_type: number;
|
|
950
|
+
/** Discount amount */
|
|
523
951
|
discount_amount: number;
|
|
952
|
+
/** Discount percent */
|
|
524
953
|
discount_percent: number;
|
|
954
|
+
/** Coupon duration */
|
|
525
955
|
duration: number;
|
|
956
|
+
/** Usage count */
|
|
526
957
|
usage_count: number;
|
|
958
|
+
/** Usage limit per invoice */
|
|
527
959
|
usage_limit_per_invoice: number;
|
|
960
|
+
/** Minimum invoice amount for coupon applicability */
|
|
528
961
|
above_invoice_amount: number;
|
|
962
|
+
/** Maximum invoice amount for coupon applicability */
|
|
529
963
|
below_invoice_amount: number;
|
|
964
|
+
/** Flag for free delivery */
|
|
530
965
|
is_delivery_free: boolean;
|
|
966
|
+
/** Flag for individual use */
|
|
531
967
|
is_individual_use: boolean;
|
|
968
|
+
/** Price in points */
|
|
532
969
|
price_in_points: number;
|
|
970
|
+
/** Styles (specify the type if known) */
|
|
533
971
|
styles: any;
|
|
972
|
+
/** Expiry date of the coupon */
|
|
534
973
|
expired_at: string;
|
|
974
|
+
/** Flag for auto-generation */
|
|
535
975
|
auto_gen: boolean;
|
|
976
|
+
/** Flag for selling ability */
|
|
536
977
|
can_sell: boolean;
|
|
978
|
+
/** Flag for redeeming ability */
|
|
537
979
|
can_redeem: boolean;
|
|
980
|
+
/** Creation date */
|
|
538
981
|
created_at: string;
|
|
982
|
+
/** Last updated date */
|
|
539
983
|
updated_at: string;
|
|
984
|
+
/** List of errors */
|
|
540
985
|
errors: any[];
|
|
541
986
|
}
|
|
542
987
|
export class Coupon implements ICoupon {
|
|
@@ -572,17 +1017,29 @@ declare module '@wyocrm/sdk/types' {
|
|
|
572
1017
|
constructor();
|
|
573
1018
|
}
|
|
574
1019
|
export interface ICouponItem {
|
|
1020
|
+
/** Unique GUID */
|
|
575
1021
|
guid: string;
|
|
1022
|
+
/** Coupon details */
|
|
576
1023
|
coupon: ICoupon;
|
|
1024
|
+
/** Usage details (specify the type if known) */
|
|
577
1025
|
usage: any;
|
|
1026
|
+
/** Promo code */
|
|
578
1027
|
promo_code: string;
|
|
1028
|
+
/** Flag for expiry */
|
|
579
1029
|
is_expired: boolean;
|
|
1030
|
+
/** Flag for redemption */
|
|
580
1031
|
is_redeemed: boolean;
|
|
1032
|
+
/** Flag for generation */
|
|
581
1033
|
is_generated: boolean;
|
|
1034
|
+
/** Creation date */
|
|
582
1035
|
created_at: string;
|
|
1036
|
+
/** Last updated date */
|
|
583
1037
|
updated_at: string;
|
|
1038
|
+
/** Expiry date */
|
|
584
1039
|
expired_at: string;
|
|
1040
|
+
/** Version */
|
|
585
1041
|
version: string;
|
|
1042
|
+
/** List of errors */
|
|
586
1043
|
errors: any[];
|
|
587
1044
|
}
|
|
588
1045
|
export class CouponItem implements ICouponItem {
|
|
@@ -601,8 +1058,11 @@ declare module '@wyocrm/sdk/types' {
|
|
|
601
1058
|
constructor();
|
|
602
1059
|
}
|
|
603
1060
|
export interface IApiResponse<T> {
|
|
1061
|
+
/** Array of data items */
|
|
604
1062
|
data: T[];
|
|
1063
|
+
/** Array of errors */
|
|
605
1064
|
errors: string[];
|
|
1065
|
+
/** Total count of all items */
|
|
606
1066
|
count_all: number;
|
|
607
1067
|
}
|
|
608
1068
|
export class ApiResponse<T> implements IApiResponse<T> {
|
|
@@ -663,19 +1123,33 @@ declare module '@wyocrm/sdk/types' {
|
|
|
663
1123
|
"invoice" = 1
|
|
664
1124
|
}
|
|
665
1125
|
export interface IMerchant {
|
|
1126
|
+
/** Unique merchant ID */
|
|
666
1127
|
id: number;
|
|
1128
|
+
/** Merchant name */
|
|
667
1129
|
name: string;
|
|
1130
|
+
/** Merchant description */
|
|
668
1131
|
description?: string;
|
|
1132
|
+
/** License ID */
|
|
669
1133
|
license_id: number;
|
|
1134
|
+
/** Business address */
|
|
670
1135
|
address?: string;
|
|
1136
|
+
/** Contact phone number */
|
|
671
1137
|
phone_number?: string;
|
|
1138
|
+
/** Business email */
|
|
672
1139
|
email?: string;
|
|
1140
|
+
/** Website URL */
|
|
673
1141
|
website?: string;
|
|
1142
|
+
/** Logo image URL */
|
|
674
1143
|
logo_url?: string;
|
|
1144
|
+
/** Business hours in JSON format */
|
|
675
1145
|
business_hours?: string;
|
|
1146
|
+
/** Active status */
|
|
676
1147
|
is_active: boolean;
|
|
1148
|
+
/** Creation timestamp */
|
|
677
1149
|
created_at: string;
|
|
1150
|
+
/** Last update timestamp */
|
|
678
1151
|
updated_at: string;
|
|
1152
|
+
/** Error messages */
|
|
679
1153
|
errors?: string[];
|
|
680
1154
|
}
|
|
681
1155
|
export class Merchant implements IMerchant {
|
|
@@ -768,19 +1242,33 @@ declare module '@wyocrm/sdk/types' {
|
|
|
768
1242
|
'X-Response-Language'?: string;
|
|
769
1243
|
[key: string]: string | undefined;
|
|
770
1244
|
}
|
|
1245
|
+
/**
|
|
1246
|
+
* OTP request interface for requesting OTP via SMS
|
|
1247
|
+
*/
|
|
771
1248
|
export interface IOtpRequest {
|
|
1249
|
+
/** Phone number to send OTP to */
|
|
772
1250
|
phone_number: string;
|
|
773
1251
|
}
|
|
774
1252
|
export class OtpRequest implements IOtpRequest {
|
|
775
1253
|
phone_number: string;
|
|
776
1254
|
constructor();
|
|
777
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Base model interface for common database fields
|
|
1258
|
+
*/
|
|
778
1259
|
export interface IModelBase {
|
|
1260
|
+
/** When this transaction is created */
|
|
779
1261
|
created_at: string;
|
|
1262
|
+
/** Date and time of the latest update on this transaction */
|
|
780
1263
|
updated_at: string;
|
|
1264
|
+
/** Soft delete flag */
|
|
781
1265
|
is_delete: boolean;
|
|
1266
|
+
/** List of errors encountered during processing */
|
|
782
1267
|
errors: string[];
|
|
783
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* User preferences extensible data structure
|
|
1271
|
+
*/
|
|
784
1272
|
export interface IPreferences {
|
|
785
1273
|
[key: string]: any;
|
|
786
1274
|
}
|
|
@@ -788,25 +1276,48 @@ declare module '@wyocrm/sdk/types' {
|
|
|
788
1276
|
[key: string]: any;
|
|
789
1277
|
constructor();
|
|
790
1278
|
}
|
|
1279
|
+
/**
|
|
1280
|
+
* User detail interface for merchant-specific user information
|
|
1281
|
+
*/
|
|
791
1282
|
export interface IUserDetail extends IModelBase {
|
|
1283
|
+
/** Primary key identifier */
|
|
792
1284
|
id: number;
|
|
1285
|
+
/** License ID associated with the user */
|
|
793
1286
|
license_id: number;
|
|
1287
|
+
/** User ID */
|
|
794
1288
|
user_id: number;
|
|
1289
|
+
/** User alias or display name */
|
|
795
1290
|
alias?: string;
|
|
1291
|
+
/** User image URL (ignored in database operations) */
|
|
796
1292
|
image_url?: string;
|
|
1293
|
+
/** Unique membership identifier */
|
|
797
1294
|
membership_id?: string;
|
|
1295
|
+
/** User's total credit balance */
|
|
798
1296
|
credit: number;
|
|
1297
|
+
/** User's total points */
|
|
799
1298
|
point: number;
|
|
1299
|
+
/** Total transaction amount */
|
|
800
1300
|
transaction_total: number;
|
|
1301
|
+
/** Number of transactions */
|
|
801
1302
|
transaction_time: number;
|
|
1303
|
+
/** Array of tag GUIDs associated with the user */
|
|
802
1304
|
tag_guids: string[];
|
|
1305
|
+
/** User group ID */
|
|
803
1306
|
user_group_id: number;
|
|
1307
|
+
/** Name of the user group */
|
|
804
1308
|
user_group_name?: string;
|
|
1309
|
+
/** Expiration date of the group membership */
|
|
805
1310
|
group_expires_at: string;
|
|
1311
|
+
/** Merchant ID where the user was created */
|
|
806
1312
|
created_by_merchant_id: number;
|
|
1313
|
+
/** User preferences extensible data */
|
|
807
1314
|
preferences: IPreferences;
|
|
1315
|
+
/** Valid coupon count */
|
|
808
1316
|
valid_coupon_count: number;
|
|
809
1317
|
}
|
|
1318
|
+
/**
|
|
1319
|
+
* User detail class implementation
|
|
1320
|
+
*/
|
|
810
1321
|
export class UserDetail implements IUserDetail {
|
|
811
1322
|
id: number;
|
|
812
1323
|
license_id: number;
|
|
@@ -888,11 +1399,51 @@ declare module '@wyocrm/sdk/types' {
|
|
|
888
1399
|
exchange_code?: string;
|
|
889
1400
|
errors: string[];
|
|
890
1401
|
}
|
|
1402
|
+
export type CouponValidationError = 'REDEEMED' | 'EXPIRED' | 'CANNOT_REDEEM' | 'MIN_AMOUNT_NOT_MET' | 'MAX_AMOUNT_EXCEEDED' | 'ITEMS_NOT_MATCHED' | 'INDIVIDUAL_USE_CONFLICT' | 'USAGE_LIMIT_EXCEEDED';
|
|
1403
|
+
export interface ICouponValidationContext {
|
|
1404
|
+
grand_total_amount: number;
|
|
1405
|
+
item_uids: string[];
|
|
1406
|
+
selected_coupons: ICouponItem[];
|
|
1407
|
+
}
|
|
1408
|
+
export interface ICouponValidationResult {
|
|
1409
|
+
valid: boolean;
|
|
1410
|
+
error?: CouponValidationError;
|
|
1411
|
+
}
|
|
891
1412
|
export {};
|
|
892
1413
|
|
|
893
1414
|
}
|
|
894
1415
|
declare module '@wyocrm/sdk/utils' {
|
|
1416
|
+
import { ICouponItem, CouponValidationError, ICouponValidationContext, ICouponValidationResult } from '@wyocrm/sdk/types';
|
|
1417
|
+
/**
|
|
1418
|
+
* Creates a preconfigured Axios instance that unwraps `response.data`.
|
|
1419
|
+
* @param baseURL - API base URL.
|
|
1420
|
+
* @param key - API key sent as `x-api-key`.
|
|
1421
|
+
* @param uid - Device UID sent as `x-device-uid`.
|
|
1422
|
+
* @param timeout - Request timeout in ms.
|
|
1423
|
+
* @returns The Axios instance.
|
|
1424
|
+
*/
|
|
895
1425
|
export function createInstance(baseURL: string, key: string, uid: string, timeout?: number): import("axios").AxiosInstance;
|
|
1426
|
+
/**
|
|
1427
|
+
* Validates a single coupon item client-side: status, expiry, amount range, item match, individual-use and per-invoice limit.
|
|
1428
|
+
* @param item - The coupon item to validate.
|
|
1429
|
+
* @param context - Invoice grand total, item UIDs and other selected coupons; omit to check status rules only.
|
|
1430
|
+
* @returns `{ valid: true }` or `{ valid: false, error }`.
|
|
1431
|
+
*/
|
|
1432
|
+
export function validateCoupon(item: ICouponItem, context?: ICouponValidationContext): ICouponValidationResult;
|
|
1433
|
+
/**
|
|
1434
|
+
* Validates coupon items against each other; each is checked with the rest as `selected_coupons`.
|
|
1435
|
+
* @param items - The coupon items to validate together.
|
|
1436
|
+
* @param context - Invoice grand total and item UIDs; omit to check status rules only.
|
|
1437
|
+
* @returns `valid` plus an `errors` map keyed by item guid.
|
|
1438
|
+
*/
|
|
1439
|
+
export function validateCoupons(items: ICouponItem[], context?: Omit<ICouponValidationContext, 'selected_coupons'>): {
|
|
1440
|
+
valid: boolean;
|
|
1441
|
+
errors: Record<string, CouponValidationError>;
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
}
|
|
1445
|
+
declare module '@wyocrm/sdk/utils.test' {
|
|
1446
|
+
export {};
|
|
896
1447
|
|
|
897
1448
|
}
|
|
898
1449
|
declare module '@wyocrm/sdk' {
|