@wyocrm/sdk 5.5.39 → 5.5.41
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 +573 -0
- package/build/index.js +1 -1
- package/build/index.js.LICENSE.txt +1 -1
- package/package.json +1 -2
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,49 +179,269 @@ 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;
|
|
111
421
|
}>, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<ICouponItem>>;
|
|
422
|
+
/**
|
|
423
|
+
* Gets the coupons that can be sold or redeemed in a merchant's coupon store
|
|
424
|
+
* @param merchantGuid - The merchant GUID
|
|
425
|
+
* @param axiosConfig - Axios request configuration
|
|
426
|
+
* @returns Promise resolving to the store coupons
|
|
427
|
+
*/
|
|
428
|
+
getCouponStore(merchantGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IApiResponse<ICoupon>>;
|
|
429
|
+
/**
|
|
430
|
+
* Buys a coupon with the user's points; rejects with HTTP 402 when points are insufficient
|
|
431
|
+
* @param merchantGuid - The merchant GUID
|
|
432
|
+
* @param couponGuid - The coupon GUID
|
|
433
|
+
* @param axiosConfig - Axios request configuration
|
|
434
|
+
* @returns Promise resolving to all of the user's valid coupon items for the merchant
|
|
435
|
+
*/
|
|
436
|
+
buyCoupon(merchantGuid: string, couponGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IApiResponse<ICouponItem>>;
|
|
437
|
+
/**
|
|
438
|
+
* Queries coupons for a specific merchant
|
|
439
|
+
* @param merchantGuid - The merchant GUID
|
|
440
|
+
* @param builder - Query builder for filtering and pagination
|
|
441
|
+
* @param axiosConfig - Axios request configuration
|
|
442
|
+
* @returns A promise that resolves to a QueryResponse containing coupons
|
|
443
|
+
*/
|
|
444
|
+
queryCoupons(merchantGuid: string, builder: QueryBuilder<ICoupon>, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<ICoupon>>;
|
|
112
445
|
}
|
|
113
446
|
export class ClientService implements IClientService {
|
|
114
447
|
exchangePasswordGrant(request: IPasswordGrantRequest, headers?: ICustomHeaders, axiosConfig?: AxiosRequestConfig): Promise<ITokenResponse>;
|
|
@@ -154,6 +487,9 @@ declare module '@wyocrm/sdk/services' {
|
|
|
154
487
|
is_redeemed?: boolean;
|
|
155
488
|
is_expired?: boolean;
|
|
156
489
|
}>, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<ICouponItem>>;
|
|
490
|
+
getCouponStore(merchantGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IApiResponse<ICoupon>>;
|
|
491
|
+
buyCoupon(merchantGuid: string, couponGuid: string, axiosConfig?: AxiosRequestConfig): Promise<IApiResponse<ICouponItem>>;
|
|
492
|
+
queryCoupons(merchantGuid: string, builder: QueryBuilder<ICoupon>, axiosConfig?: AxiosRequestConfig): Promise<IQueryResponse<ICoupon>>;
|
|
157
493
|
}
|
|
158
494
|
|
|
159
495
|
}
|
|
@@ -168,7 +504,9 @@ declare module '@wyocrm/sdk/types' {
|
|
|
168
504
|
delivery?: Delivery | undefined;
|
|
169
505
|
}
|
|
170
506
|
export interface Delivery {
|
|
507
|
+
/** When this transaction is created */
|
|
171
508
|
created_at?: Date;
|
|
509
|
+
/** Date and time of the latest update on this transaction */
|
|
172
510
|
updated_at?: Date;
|
|
173
511
|
errors?: string[] | undefined;
|
|
174
512
|
id?: number;
|
|
@@ -184,7 +522,9 @@ declare module '@wyocrm/sdk/types' {
|
|
|
184
522
|
to_address1?: Address | undefined;
|
|
185
523
|
}
|
|
186
524
|
export interface Address {
|
|
525
|
+
/** When this transaction is created */
|
|
187
526
|
created_at?: Date;
|
|
527
|
+
/** Date and time of the latest update on this transaction */
|
|
188
528
|
updated_at?: Date;
|
|
189
529
|
errors?: string[] | undefined;
|
|
190
530
|
id?: number;
|
|
@@ -213,43 +553,81 @@ declare module '@wyocrm/sdk/types' {
|
|
|
213
553
|
};
|
|
214
554
|
}
|
|
215
555
|
export interface ICustomer {
|
|
556
|
+
/** Unique membership ID */
|
|
216
557
|
membership_id: string;
|
|
558
|
+
/** Merchant Identifier */
|
|
217
559
|
license_id: number;
|
|
560
|
+
/** User's total credit */
|
|
218
561
|
credit: number;
|
|
562
|
+
/** User's total points */
|
|
219
563
|
point: number;
|
|
564
|
+
/** Total transaction amount */
|
|
220
565
|
transaction_total: number;
|
|
566
|
+
/** Number of transactions */
|
|
221
567
|
transaction_time: number;
|
|
568
|
+
/** User's tier */
|
|
222
569
|
tier: any | null;
|
|
570
|
+
/** Array of tag GUIDs */
|
|
223
571
|
tag_guids: string[] | null;
|
|
572
|
+
/** User's Group ID */
|
|
224
573
|
user_group_id: number;
|
|
574
|
+
/** Name of the User's Group */
|
|
225
575
|
user_group_name: string | null;
|
|
576
|
+
/** Expiration date of the group */
|
|
226
577
|
group_expires_at: string;
|
|
578
|
+
/** Error message */
|
|
227
579
|
error: string | null;
|
|
580
|
+
/** User's ID */
|
|
228
581
|
id: number;
|
|
582
|
+
/** Reference ID */
|
|
229
583
|
ref_id: string;
|
|
584
|
+
/** Image URL */
|
|
230
585
|
image_url: string | null;
|
|
586
|
+
/** Stripe token */
|
|
231
587
|
stripe_token: string | null;
|
|
588
|
+
/** Stripe customer ID */
|
|
232
589
|
stripe_customer_id: string | null;
|
|
590
|
+
/** Username */
|
|
233
591
|
username: string;
|
|
592
|
+
/** Company name */
|
|
234
593
|
company: string | null;
|
|
594
|
+
/** Identification number */
|
|
235
595
|
ic: string | null;
|
|
596
|
+
/** Display name */
|
|
236
597
|
display_name: string;
|
|
598
|
+
/** Full name */
|
|
237
599
|
full_name: string;
|
|
600
|
+
/** Birth date */
|
|
238
601
|
birth_date: string | null;
|
|
602
|
+
/** Gender */
|
|
239
603
|
gender: string | null;
|
|
604
|
+
/** Address */
|
|
240
605
|
address: string | null;
|
|
606
|
+
/** Postcode */
|
|
241
607
|
postcode: string | null;
|
|
608
|
+
/** Additional notes */
|
|
242
609
|
note: string | null;
|
|
610
|
+
/** Preferred language */
|
|
243
611
|
language: string | null;
|
|
612
|
+
/** Time zone */
|
|
244
613
|
time_zone: string | null;
|
|
614
|
+
/** Creation date and time */
|
|
245
615
|
created_at: string;
|
|
616
|
+
/** Last update date and time */
|
|
246
617
|
updated_at: string;
|
|
618
|
+
/** Comma-separated list of license IDs */
|
|
247
619
|
license_ids: string;
|
|
620
|
+
/** Security stamp */
|
|
248
621
|
security_stamp: string;
|
|
622
|
+
/** Phone number */
|
|
249
623
|
phone_number: string;
|
|
624
|
+
/** Email address */
|
|
250
625
|
email: string | null;
|
|
626
|
+
/** Whether the email is confirmed */
|
|
251
627
|
email_confirmed: boolean;
|
|
628
|
+
/** Whether the phone number is confirmed */
|
|
252
629
|
phone_number_confirmed: boolean;
|
|
630
|
+
/** Date and time of agreeing to PDPA */
|
|
253
631
|
agree_pdpa_at: string | null;
|
|
254
632
|
}
|
|
255
633
|
export class Customer implements ICustomer {
|
|
@@ -293,14 +671,23 @@ declare module '@wyocrm/sdk/types' {
|
|
|
293
671
|
agree_pdpa_at: any;
|
|
294
672
|
}
|
|
295
673
|
export type ICustomerOptions = {
|
|
674
|
+
/** Reference ID */
|
|
296
675
|
ref_id: string;
|
|
676
|
+
/** IC */
|
|
297
677
|
ic: string;
|
|
678
|
+
/** Display name of the user */
|
|
298
679
|
display_name: string;
|
|
680
|
+
/** URL of the user's image */
|
|
299
681
|
image_url: string;
|
|
682
|
+
/** Birth date of the user */
|
|
300
683
|
birth_date: string;
|
|
684
|
+
/** Gender of the user */
|
|
301
685
|
gender: string;
|
|
686
|
+
/** Language of the user */
|
|
302
687
|
language: string;
|
|
688
|
+
/** Phone number of the user */
|
|
303
689
|
phone_number: string;
|
|
690
|
+
/** Email of the user */
|
|
304
691
|
email: string;
|
|
305
692
|
};
|
|
306
693
|
export class CustomerOptions implements ICustomerOptions {
|
|
@@ -340,38 +727,67 @@ declare module '@wyocrm/sdk/types' {
|
|
|
340
727
|
At = "StartsWith"
|
|
341
728
|
}
|
|
342
729
|
export interface ITransactionMerchant {
|
|
730
|
+
/** Merchant name */
|
|
343
731
|
name?: string;
|
|
732
|
+
/** Merchant logo URL */
|
|
344
733
|
logo_url?: string;
|
|
345
734
|
}
|
|
346
735
|
export interface ITransactionMeta {
|
|
736
|
+
/** List of coupon IDs to redeem */
|
|
347
737
|
coupon_ids_to_redeem: string[];
|
|
348
738
|
}
|
|
349
739
|
export interface ITransaction {
|
|
740
|
+
/** Unique identifier for the order */
|
|
350
741
|
id: number;
|
|
742
|
+
/** Associated invoice ID, 0 if not applicable */
|
|
351
743
|
invoice_id: number;
|
|
744
|
+
/** Type of the order, e.g., 'revopos' */
|
|
352
745
|
type: string;
|
|
746
|
+
/** Primary license ID associated with the order */
|
|
353
747
|
primary_license_id: number;
|
|
748
|
+
/** License ID associated with the order */
|
|
354
749
|
license_id: number;
|
|
750
|
+
/** Reference ID for the order */
|
|
355
751
|
ref_id: string;
|
|
752
|
+
/** User ID who placed the order */
|
|
356
753
|
user_id: number;
|
|
754
|
+
/** Credit added to the order, default is 0.00 */
|
|
357
755
|
add_credit: number;
|
|
756
|
+
/** Credit subtracted from the order, default is 0.00 */
|
|
358
757
|
minus_credit: number;
|
|
758
|
+
/** Points added to the order, default is 0.00 */
|
|
359
759
|
add_point: number;
|
|
760
|
+
/** Points subtracted from the order, default is 0.00 */
|
|
360
761
|
minus_point: number;
|
|
762
|
+
/** Current status of the order, e.g., 'paid' */
|
|
361
763
|
status: string;
|
|
764
|
+
/** Grand total amount of the order */
|
|
362
765
|
grand_total: number;
|
|
766
|
+
/** Whether the order belongs to this shop */
|
|
363
767
|
is_local: boolean;
|
|
768
|
+
/** Timestamp when the order was closed */
|
|
364
769
|
closed_at: Date;
|
|
770
|
+
/** Timestamp when the order was created */
|
|
365
771
|
created_at: Date;
|
|
772
|
+
/** Timestamp when the order was last updated */
|
|
366
773
|
updated_at: Date;
|
|
774
|
+
/** List of errors, if any, during order processing */
|
|
367
775
|
errors: string[];
|
|
776
|
+
/** The complete invoice object */
|
|
368
777
|
invoice?: any;
|
|
778
|
+
/** The complete invoice configuration object */
|
|
369
779
|
config?: any;
|
|
780
|
+
/** Merchant information */
|
|
370
781
|
merchant?: ITransactionMerchant;
|
|
782
|
+
/** The complete coupon redemption object snapshot at the time of redemption */
|
|
371
783
|
coupon?: any;
|
|
784
|
+
/** The amount of credit which is used within expiry date */
|
|
372
785
|
used_credit: number;
|
|
786
|
+
/** The amount of credit which is expired */
|
|
373
787
|
expired_credit: number;
|
|
788
|
+
/** The credit expiry date and time */
|
|
374
789
|
expired_at: string | null;
|
|
790
|
+
/** The transaction meta data */
|
|
375
791
|
meta: ITransactionMeta;
|
|
376
792
|
}
|
|
377
793
|
export class Transaction implements ITransaction {
|
|
@@ -420,31 +836,55 @@ declare module '@wyocrm/sdk/types' {
|
|
|
420
836
|
PaymentDeclined = "Payment Declined"
|
|
421
837
|
}
|
|
422
838
|
export interface IMeta {
|
|
839
|
+
/** Date and time when the order was placed */
|
|
423
840
|
placed_at: string;
|
|
841
|
+
/** Current status of the order */
|
|
424
842
|
current_status: string;
|
|
843
|
+
/** Date and time when the order preparation started */
|
|
425
844
|
prepare_at: string;
|
|
845
|
+
/** Status of the order before the current status */
|
|
426
846
|
previous_status: string;
|
|
847
|
+
/** Date and time when the order is expected to be delivered */
|
|
427
848
|
deliver_at: string;
|
|
849
|
+
/** Date and time when the order was actually delivered */
|
|
428
850
|
delivered_at: string;
|
|
429
851
|
}
|
|
430
852
|
export interface IOrder {
|
|
853
|
+
/** Unique identifier for the order */
|
|
431
854
|
id: number;
|
|
855
|
+
/** Reference identifier for the order */
|
|
432
856
|
order_ref: string;
|
|
857
|
+
/** Table ID associated with the order (0 if not applicable) */
|
|
433
858
|
table_id: number;
|
|
859
|
+
/** Invoice ID associated with the order */
|
|
434
860
|
invoice_id: number;
|
|
861
|
+
/** Call number associated with the order (0 if not applicable) */
|
|
435
862
|
call_num: number;
|
|
863
|
+
/** User ID of the person who placed the order */
|
|
436
864
|
user_id: number;
|
|
865
|
+
/** License ID associated with the order */
|
|
437
866
|
license_id: number;
|
|
867
|
+
/** Charge ID associated with the order */
|
|
438
868
|
charge_id: number;
|
|
869
|
+
/** Delivery ID associated with the order */
|
|
439
870
|
delivery_id: number;
|
|
871
|
+
/** Type of the order (e.g., Delivery, Pickup) */
|
|
440
872
|
order_type: string;
|
|
873
|
+
/** Payment source ID used for the order */
|
|
441
874
|
payment_source_id: number;
|
|
875
|
+
/** Current status of the order (e.g., Delivered, Pending) */
|
|
442
876
|
status: OrderStatus;
|
|
877
|
+
/** Name of the customer */
|
|
443
878
|
customer_name: string;
|
|
879
|
+
/** Phone number of the customer */
|
|
444
880
|
customer_phone_number: string;
|
|
881
|
+
/** Metadata associated with the order */
|
|
445
882
|
meta: IMeta;
|
|
883
|
+
/** Date and time when the order was created */
|
|
446
884
|
created_at: string;
|
|
885
|
+
/** Date and time when the order was last updated */
|
|
447
886
|
updated_at: string;
|
|
887
|
+
/** List of errors encountered (if any) */
|
|
448
888
|
errors: string[];
|
|
449
889
|
}
|
|
450
890
|
export class Order implements IOrder {
|
|
@@ -500,7 +940,9 @@ declare module '@wyocrm/sdk/types' {
|
|
|
500
940
|
EXCLUSIVE = 3
|
|
501
941
|
}
|
|
502
942
|
export interface IApplying<T> {
|
|
943
|
+
/** Applying type */
|
|
503
944
|
applying_type: ApplyingType;
|
|
945
|
+
/** List of applying items */
|
|
504
946
|
applying_items: T[];
|
|
505
947
|
}
|
|
506
948
|
export class Applying<T> implements IApplying<T> {
|
|
@@ -509,34 +951,63 @@ declare module '@wyocrm/sdk/types' {
|
|
|
509
951
|
constructor();
|
|
510
952
|
}
|
|
511
953
|
export interface ICoupon {
|
|
954
|
+
/** Coupon GUID */
|
|
512
955
|
guid: string;
|
|
956
|
+
/** Promo code */
|
|
513
957
|
promo_code: string;
|
|
958
|
+
/** Flag for multi-store applicability */
|
|
514
959
|
is_multi_stores: boolean;
|
|
960
|
+
/** Name of the coupon */
|
|
515
961
|
name: string;
|
|
962
|
+
/** Alias of the coupon */
|
|
516
963
|
alias: string;
|
|
964
|
+
/** Coupon description */
|
|
517
965
|
description: string;
|
|
966
|
+
/** Coupon description alias */
|
|
518
967
|
description_alias: string;
|
|
968
|
+
/** Applying plus details */
|
|
519
969
|
applying_plus: IApplying<string>;
|
|
970
|
+
/** Applying user tags details */
|
|
520
971
|
applying_user_tags: IApplying<string>;
|
|
972
|
+
/** Applying user groups details */
|
|
521
973
|
applying_user_groups: IApplying<number>;
|
|
974
|
+
/** Discount calculation type */
|
|
522
975
|
discount_calc_type: number;
|
|
976
|
+
/** Discount amount */
|
|
523
977
|
discount_amount: number;
|
|
978
|
+
/** Discount percent */
|
|
524
979
|
discount_percent: number;
|
|
980
|
+
/** Coupon duration */
|
|
525
981
|
duration: number;
|
|
982
|
+
/** Usage count */
|
|
526
983
|
usage_count: number;
|
|
984
|
+
/** Usage limit per invoice */
|
|
527
985
|
usage_limit_per_invoice: number;
|
|
986
|
+
/** Minimum invoice amount for coupon applicability */
|
|
528
987
|
above_invoice_amount: number;
|
|
988
|
+
/** Maximum invoice amount for coupon applicability */
|
|
529
989
|
below_invoice_amount: number;
|
|
990
|
+
/** Flag for free delivery */
|
|
530
991
|
is_delivery_free: boolean;
|
|
992
|
+
/** Flag for individual use */
|
|
531
993
|
is_individual_use: boolean;
|
|
994
|
+
/** Price in points */
|
|
532
995
|
price_in_points: number;
|
|
996
|
+
/** Styles (specify the type if known) */
|
|
533
997
|
styles: any;
|
|
998
|
+
/** Expiry date of the coupon */
|
|
534
999
|
expired_at: string;
|
|
1000
|
+
/** Flag for auto-generation */
|
|
535
1001
|
auto_gen: boolean;
|
|
1002
|
+
/** Flag for selling ability */
|
|
536
1003
|
can_sell: boolean;
|
|
1004
|
+
/** Flag for redeeming ability */
|
|
537
1005
|
can_redeem: boolean;
|
|
1006
|
+
/** Creation date */
|
|
538
1007
|
created_at: string;
|
|
1008
|
+
/** Last updated date */
|
|
539
1009
|
updated_at: string;
|
|
1010
|
+
/** List of errors */
|
|
540
1011
|
errors: any[];
|
|
541
1012
|
}
|
|
542
1013
|
export class Coupon implements ICoupon {
|
|
@@ -572,17 +1043,29 @@ declare module '@wyocrm/sdk/types' {
|
|
|
572
1043
|
constructor();
|
|
573
1044
|
}
|
|
574
1045
|
export interface ICouponItem {
|
|
1046
|
+
/** Unique GUID */
|
|
575
1047
|
guid: string;
|
|
1048
|
+
/** Coupon details */
|
|
576
1049
|
coupon: ICoupon;
|
|
1050
|
+
/** Usage details (specify the type if known) */
|
|
577
1051
|
usage: any;
|
|
1052
|
+
/** Promo code */
|
|
578
1053
|
promo_code: string;
|
|
1054
|
+
/** Flag for expiry */
|
|
579
1055
|
is_expired: boolean;
|
|
1056
|
+
/** Flag for redemption */
|
|
580
1057
|
is_redeemed: boolean;
|
|
1058
|
+
/** Flag for generation */
|
|
581
1059
|
is_generated: boolean;
|
|
1060
|
+
/** Creation date */
|
|
582
1061
|
created_at: string;
|
|
1062
|
+
/** Last updated date */
|
|
583
1063
|
updated_at: string;
|
|
1064
|
+
/** Expiry date */
|
|
584
1065
|
expired_at: string;
|
|
1066
|
+
/** Version */
|
|
585
1067
|
version: string;
|
|
1068
|
+
/** List of errors */
|
|
586
1069
|
errors: any[];
|
|
587
1070
|
}
|
|
588
1071
|
export class CouponItem implements ICouponItem {
|
|
@@ -601,8 +1084,11 @@ declare module '@wyocrm/sdk/types' {
|
|
|
601
1084
|
constructor();
|
|
602
1085
|
}
|
|
603
1086
|
export interface IApiResponse<T> {
|
|
1087
|
+
/** Array of data items */
|
|
604
1088
|
data: T[];
|
|
1089
|
+
/** Array of errors */
|
|
605
1090
|
errors: string[];
|
|
1091
|
+
/** Total count of all items */
|
|
606
1092
|
count_all: number;
|
|
607
1093
|
}
|
|
608
1094
|
export class ApiResponse<T> implements IApiResponse<T> {
|
|
@@ -663,19 +1149,33 @@ declare module '@wyocrm/sdk/types' {
|
|
|
663
1149
|
"invoice" = 1
|
|
664
1150
|
}
|
|
665
1151
|
export interface IMerchant {
|
|
1152
|
+
/** Unique merchant ID */
|
|
666
1153
|
id: number;
|
|
1154
|
+
/** Merchant name */
|
|
667
1155
|
name: string;
|
|
1156
|
+
/** Merchant description */
|
|
668
1157
|
description?: string;
|
|
1158
|
+
/** License ID */
|
|
669
1159
|
license_id: number;
|
|
1160
|
+
/** Business address */
|
|
670
1161
|
address?: string;
|
|
1162
|
+
/** Contact phone number */
|
|
671
1163
|
phone_number?: string;
|
|
1164
|
+
/** Business email */
|
|
672
1165
|
email?: string;
|
|
1166
|
+
/** Website URL */
|
|
673
1167
|
website?: string;
|
|
1168
|
+
/** Logo image URL */
|
|
674
1169
|
logo_url?: string;
|
|
1170
|
+
/** Business hours in JSON format */
|
|
675
1171
|
business_hours?: string;
|
|
1172
|
+
/** Active status */
|
|
676
1173
|
is_active: boolean;
|
|
1174
|
+
/** Creation timestamp */
|
|
677
1175
|
created_at: string;
|
|
1176
|
+
/** Last update timestamp */
|
|
678
1177
|
updated_at: string;
|
|
1178
|
+
/** Error messages */
|
|
679
1179
|
errors?: string[];
|
|
680
1180
|
}
|
|
681
1181
|
export class Merchant implements IMerchant {
|
|
@@ -768,19 +1268,33 @@ declare module '@wyocrm/sdk/types' {
|
|
|
768
1268
|
'X-Response-Language'?: string;
|
|
769
1269
|
[key: string]: string | undefined;
|
|
770
1270
|
}
|
|
1271
|
+
/**
|
|
1272
|
+
* OTP request interface for requesting OTP via SMS
|
|
1273
|
+
*/
|
|
771
1274
|
export interface IOtpRequest {
|
|
1275
|
+
/** Phone number to send OTP to */
|
|
772
1276
|
phone_number: string;
|
|
773
1277
|
}
|
|
774
1278
|
export class OtpRequest implements IOtpRequest {
|
|
775
1279
|
phone_number: string;
|
|
776
1280
|
constructor();
|
|
777
1281
|
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Base model interface for common database fields
|
|
1284
|
+
*/
|
|
778
1285
|
export interface IModelBase {
|
|
1286
|
+
/** When this transaction is created */
|
|
779
1287
|
created_at: string;
|
|
1288
|
+
/** Date and time of the latest update on this transaction */
|
|
780
1289
|
updated_at: string;
|
|
1290
|
+
/** Soft delete flag */
|
|
781
1291
|
is_delete: boolean;
|
|
1292
|
+
/** List of errors encountered during processing */
|
|
782
1293
|
errors: string[];
|
|
783
1294
|
}
|
|
1295
|
+
/**
|
|
1296
|
+
* User preferences extensible data structure
|
|
1297
|
+
*/
|
|
784
1298
|
export interface IPreferences {
|
|
785
1299
|
[key: string]: any;
|
|
786
1300
|
}
|
|
@@ -788,25 +1302,48 @@ declare module '@wyocrm/sdk/types' {
|
|
|
788
1302
|
[key: string]: any;
|
|
789
1303
|
constructor();
|
|
790
1304
|
}
|
|
1305
|
+
/**
|
|
1306
|
+
* User detail interface for merchant-specific user information
|
|
1307
|
+
*/
|
|
791
1308
|
export interface IUserDetail extends IModelBase {
|
|
1309
|
+
/** Primary key identifier */
|
|
792
1310
|
id: number;
|
|
1311
|
+
/** License ID associated with the user */
|
|
793
1312
|
license_id: number;
|
|
1313
|
+
/** User ID */
|
|
794
1314
|
user_id: number;
|
|
1315
|
+
/** User alias or display name */
|
|
795
1316
|
alias?: string;
|
|
1317
|
+
/** User image URL (ignored in database operations) */
|
|
796
1318
|
image_url?: string;
|
|
1319
|
+
/** Unique membership identifier */
|
|
797
1320
|
membership_id?: string;
|
|
1321
|
+
/** User's total credit balance */
|
|
798
1322
|
credit: number;
|
|
1323
|
+
/** User's total points */
|
|
799
1324
|
point: number;
|
|
1325
|
+
/** Total transaction amount */
|
|
800
1326
|
transaction_total: number;
|
|
1327
|
+
/** Number of transactions */
|
|
801
1328
|
transaction_time: number;
|
|
1329
|
+
/** Array of tag GUIDs associated with the user */
|
|
802
1330
|
tag_guids: string[];
|
|
1331
|
+
/** User group ID */
|
|
803
1332
|
user_group_id: number;
|
|
1333
|
+
/** Name of the user group */
|
|
804
1334
|
user_group_name?: string;
|
|
1335
|
+
/** Expiration date of the group membership */
|
|
805
1336
|
group_expires_at: string;
|
|
1337
|
+
/** Merchant ID where the user was created */
|
|
806
1338
|
created_by_merchant_id: number;
|
|
1339
|
+
/** User preferences extensible data */
|
|
807
1340
|
preferences: IPreferences;
|
|
1341
|
+
/** Valid coupon count */
|
|
808
1342
|
valid_coupon_count: number;
|
|
809
1343
|
}
|
|
1344
|
+
/**
|
|
1345
|
+
* User detail class implementation
|
|
1346
|
+
*/
|
|
810
1347
|
export class UserDetail implements IUserDetail {
|
|
811
1348
|
id: number;
|
|
812
1349
|
license_id: number;
|
|
@@ -888,11 +1425,47 @@ declare module '@wyocrm/sdk/types' {
|
|
|
888
1425
|
exchange_code?: string;
|
|
889
1426
|
errors: string[];
|
|
890
1427
|
}
|
|
1428
|
+
export type CouponValidationError = 'REDEEMED' | 'EXPIRED' | 'CANNOT_REDEEM' | 'MIN_AMOUNT_NOT_MET' | 'MAX_AMOUNT_EXCEEDED' | 'ITEMS_NOT_MATCHED' | 'INDIVIDUAL_USE_CONFLICT' | 'USAGE_LIMIT_EXCEEDED';
|
|
1429
|
+
export interface ICouponValidationContext {
|
|
1430
|
+
grand_total_amount: number;
|
|
1431
|
+
item_uids: string[];
|
|
1432
|
+
selected_coupons: ICouponItem[];
|
|
1433
|
+
}
|
|
1434
|
+
export interface ICouponValidationResult {
|
|
1435
|
+
valid: boolean;
|
|
1436
|
+
error?: CouponValidationError;
|
|
1437
|
+
}
|
|
891
1438
|
export {};
|
|
892
1439
|
|
|
893
1440
|
}
|
|
894
1441
|
declare module '@wyocrm/sdk/utils' {
|
|
1442
|
+
import { ICouponItem, CouponValidationError, ICouponValidationContext, ICouponValidationResult } from '@wyocrm/sdk/types';
|
|
1443
|
+
/**
|
|
1444
|
+
* Creates a preconfigured Axios instance that unwraps `response.data`.
|
|
1445
|
+
* @param baseURL - API base URL.
|
|
1446
|
+
* @param key - API key sent as `x-api-key`.
|
|
1447
|
+
* @param uid - Device UID sent as `x-device-uid`.
|
|
1448
|
+
* @param timeout - Request timeout in ms.
|
|
1449
|
+
* @returns The Axios instance.
|
|
1450
|
+
*/
|
|
895
1451
|
export function createInstance(baseURL: string, key: string, uid: string, timeout?: number): import("axios").AxiosInstance;
|
|
1452
|
+
/**
|
|
1453
|
+
* Validates a single coupon item client-side: status, expiry, amount range, item match, individual-use and per-invoice limit.
|
|
1454
|
+
* @param item - The coupon item to validate.
|
|
1455
|
+
* @param context - Invoice grand total, item UIDs and other selected coupons; omit to check status rules only.
|
|
1456
|
+
* @returns `{ valid: true }` or `{ valid: false, error }`.
|
|
1457
|
+
*/
|
|
1458
|
+
export function validateCoupon(item: ICouponItem, context?: ICouponValidationContext): ICouponValidationResult;
|
|
1459
|
+
/**
|
|
1460
|
+
* Validates coupon items against each other; each is checked with the rest as `selected_coupons`.
|
|
1461
|
+
* @param items - The coupon items to validate together.
|
|
1462
|
+
* @param context - Invoice grand total and item UIDs; omit to check status rules only.
|
|
1463
|
+
* @returns `valid` plus an `errors` map keyed by item guid.
|
|
1464
|
+
*/
|
|
1465
|
+
export function validateCoupons(items: ICouponItem[], context?: Omit<ICouponValidationContext, 'selected_coupons'>): {
|
|
1466
|
+
valid: boolean;
|
|
1467
|
+
errors: Record<string, CouponValidationError>;
|
|
1468
|
+
};
|
|
896
1469
|
|
|
897
1470
|
}
|
|
898
1471
|
declare module '@wyocrm/sdk' {
|