1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
| import { getApiEndpoint } from '../config/api.uts'
| import { request, HttpError, resolveApiUrl } from './http.uts'
|
| // Public portal data is intentionally separate from authenticated talent services.
| export const getAppHome = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appHome'), method: 'GET', skipAuth: true }, onSuccess, onError)
| }
|
| export const getNews = (page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appNews'), method: 'GET', skipAuth: true, data: { page: page, size: size } }, onSuccess, onError)
| }
|
| export const getNewsDetail = (newsId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appNewsDetail') + encodeURIComponent(newsId), method: 'GET', skipAuth: true }, onSuccess, onError)
| }
|
| export const getPolicies = (page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appPolicies'), method: 'GET', skipAuth: true, data: { page: page, size: size } }, onSuccess, onError)
| }
|
| export const getPolicyDetail = (policyId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appPolicyDetail') + encodeURIComponent(policyId), method: 'GET', skipAuth: true }, onSuccess, onError)
| }
|
| export const getMerchants = (page: number, size: number, keyword: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appMerchants'), method: 'GET', skipAuth: true, data: { page: page, size: size, keyword: keyword } }, onSuccess, onError)
| }
|
| export const getFoodTopic = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appFoodTopic'), method: 'GET', skipAuth: true }, onSuccess, onError)
| }
|
| export const getFoodTopicMerchants = (page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appFoodTopicMerchants'), method: 'GET', skipAuth: true, data: { page: page, size: size } }, onSuccess, onError)
| }
|
| export const getTravelTopic = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appTravelTopic'), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getTravelTopicMerchants = (page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appTravelTopicMerchants'), method: 'GET', skipAuth: true, data: { page: page, size: size } }, onSuccess, onError)
| export const getStayTopic = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appStayTopic'), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getStayTopicMerchants = (type: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appStayTopicMerchants'), method: 'GET', skipAuth: true, data: { type: type, page: page, size: size } }, onSuccess, onError)
| export const getEntertainmentTopic = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appEntertainmentTopic'), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getEntertainmentTopicMerchants = (page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appEntertainmentTopicMerchants'), method: 'GET', skipAuth: true, data: { page: page, size: size } }, onSuccess, onError)
| export const getTransportTopic = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appTransportTopic'), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getTransportTopicMerchants = (type: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appTransportTopicMerchants'), method: 'GET', skipAuth: true, data: { type: type, page: page, size: size } }, onSuccess, onError)
| export const getShoppingTopic = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appShoppingTopic'), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getShoppingTopicMerchants = (categoryId: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appShoppingTopicMerchants'), method: 'GET', skipAuth: true, data: { categoryId: categoryId, page: page, size: size } }, onSuccess, onError)
| export const getPremiumTopic = (onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appPremiumTopic'), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getPremiumTopicServices = (categoryId: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appPremiumTopicServices'), method: 'GET', skipAuth: true, data: { categoryId: categoryId, page: page, size: size } }, onSuccess, onError)
| export const getSpouseEmploymentBenefit = (serviceId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appSpouseEmploymentBenefit') + encodeURIComponent(serviceId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const submitSpouseEmploymentApplication = (serviceId: string, payload: any, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appSpouseEmploymentBenefit') + encodeURIComponent(serviceId) + '/applications', method: 'POST', skipAuth: true, data: payload, idempotencyKey: idempotencyKey }, onSuccess, onError)
| export const getAdminApprovalBenefit = (serviceId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appAdminApprovalBenefit') + encodeURIComponent(serviceId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getFinanceMerchantDetail = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFinanceMerchantDetail') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getChildrenEntrustmentBenefit = (serviceId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appChildrenEntrustmentBenefit') + encodeURIComponent(serviceId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getChildrenEntrustmentSchools = (serviceId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appChildrenEntrustmentBenefit') + encodeURIComponent(serviceId) + '/schools', method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getChildrenEntrustmentSchool = (schoolId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appChildrenEntrustmentSchool') + encodeURIComponent(schoolId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getChildren = (talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appChildren'), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const getChild = (childId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appChildren') + '/' + encodeURIComponent(childId), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const createChild = (payload: any, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appChildren'), method: 'POST', skipAuth: true, data: payload, idempotencyKey: idempotencyKey }, onSuccess, onError)
| export const resubmitChild = (childId: string, payload: any, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appChildren') + '/' + encodeURIComponent(childId), method: 'PUT', skipAuth: true, data: payload, idempotencyKey: idempotencyKey }, onSuccess, onError)
| export const getMedicalPackages = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appMedicalMerchantPackages') + encodeURIComponent(merchantId) + '/packages', method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getMedicalPackage = (packageId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appMedicalPackages') + encodeURIComponent(packageId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getMedicalPackageItems = (packageId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appMedicalPackages') + encodeURIComponent(packageId) + '/items', method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getFuelMerchantDetail = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFuelMerchantDetail') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const submitFuelMobileRegistration = (merchantId: string, talentId: string, benefitId: string, mobile: string, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFuelMerchantDetail') + encodeURIComponent(merchantId) + '/registrations', method: 'POST', skipAuth: true, data: { talentId: Number(talentId), benefitId: Number(benefitId), mobile: mobile }, idempotencyKey: idempotencyKey }, onSuccess, onError)
| export const getParkingMerchantDetail = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appParkingMerchantDetail') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getCarWashMerchantDetail = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appCarWashMerchantDetail') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const submitCarWashCredential = (merchantId: string, talentId: string, cardId: string, phone: string, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { talentId: Number(talentId), cardId: Number(cardId), proofFiles: [], description: '手机号:' + phone }
| return request<any>({ path: getApiEndpoint('appCarWashMerchantDetail') + encodeURIComponent(merchantId) + '/credentials', method: 'POST', skipAuth: true, data: data, idempotencyKey: idempotencyKey }, onSuccess, onError)
| }
| export const getShoppingMerchantDetail = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appShoppingMerchantDetail') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const searchParkingLots = (merchantId: string, keyword: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appParkingMerchantDetail') + encodeURIComponent(merchantId) + '/parking-lots', method: 'GET', skipAuth: true, data: { keyword: keyword, page: page, size: size } }, onSuccess, onError)
| export const submitParkingPlateRegistration = (merchantId: string, talentId: string, benefitId: string, parkingLotId: string, plateNumber: string, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { talentId: Number(talentId), benefitId: Number(benefitId), plateNumber: plateNumber }
| if (parkingLotId != '') data.parkingLotId = Number(parkingLotId)
| return request<any>({ path: getApiEndpoint('appParkingMerchantDetail') + encodeURIComponent(merchantId) + '/registrations', method: 'POST', skipAuth: true, data: data, idempotencyKey: idempotencyKey }, onSuccess, onError)
| }
| export const getCinemaMerchant = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appCinemaMerchants') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getCinemaCoupons = (merchantId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appCinemaMerchants') + encodeURIComponent(merchantId) + '/coupons', method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const claimCinemaCoupon = (merchantId: string, couponId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appCinemaMerchants') + encodeURIComponent(merchantId) + '/coupons/' + encodeURIComponent(couponId) + '/claims', method: 'POST', skipAuth: true, data: { talentId: Number(talentId) }, idempotencyKey: 'cinema-claim-' + merchantId + '-' + couponId + '-' + talentId }, onSuccess, onError)
|
| export const issueBenefitVerificationCode = (benefitType: string, talentId: string, cardId: string, merchantId: string, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { benefitType: benefitType, merchantId: Number(merchantId) }
| if (talentId != '') data.talentId = Number(talentId)
| if (cardId != '') data.cardId = Number(cardId)
| return request<any>({ path: getApiEndpoint('appBenefitVerificationCodes'), method: 'POST', data: data, idempotencyKey: idempotencyKey }, onSuccess, onError)
| }
| export const getBenefitQuota = (benefitType: string, talentId: string, cardId: string, merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { benefitType: benefitType, merchantId: Number(merchantId) }
| if (talentId != '') data.talentId = Number(talentId)
| if (cardId != '') data.cardId = Number(cardId)
| return request<any>({ path: getApiEndpoint('appBenefitVerificationCodes') + '/quota', method: 'GET', data: data }, onSuccess, onError)
| }
| export const getCinemaCouponClaim = (claimId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appCinemaCouponClaims') + encodeURIComponent(claimId), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const getCinemaCodeImageUrl = (claimId: string): string => resolveApiUrl(getApiEndpoint('appBenefitVerificationCodes') + '/' + encodeURIComponent(claimId) + '/image')
|
| export const searchMerchants = (keyword: string, categoryId: string, mode: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({
| path: getApiEndpoint('appMerchants'),
| method: 'GET',
| skipAuth: true,
| data: { keyword: keyword, categoryId: categoryId, mode: mode, page: page, size: size, sortField: 'sort', sortOrder: 'asc' }
| }, onSuccess, onError)
| }
|
| export const getMerchantDetail = (merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appMerchantDetail') + encodeURIComponent(merchantId), method: 'GET', skipAuth: true }, onSuccess, onError)
| }
|
| export const getProducts = (merchantId: string, talentId: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { merchantId: merchantId, page: page, size: size }
| if (talentId != '') data.talentId = Number(talentId)
| return request<any>({ path: getApiEndpoint('appProducts'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
|
| export const getProductDetail = (productId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = {}
| if (talentId != '') data.talentId = Number(talentId)
| return request<any>({ path: getApiEndpoint('appProductDetail') + encodeURIComponent(productId), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
|
| export const getOrderCoupons = (merchantId: string, productId: string, orderId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({
| path: getApiEndpoint('appOrderCoupons'),
| method: 'GET',
| skipAuth: true,
| data: { merchantId: merchantId, productId: productId, orderId: orderId, talentId: talentId }
| }, onSuccess, onError)
| }
|
| export const getOrderCouponQuote = (merchantId: string, productId: string, orderId: string, couponId: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { merchantId: merchantId, productId: productId, orderId: orderId, talentId: talentId }
| if (couponId != '') data.couponId = couponId
| return request<any>({ path: getApiEndpoint('appOrderCouponQuote'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
|
| export const createAppOrder = (merchantId: string, productId: string, couponId: string, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { merchantId: Number(merchantId), productId: Number(productId) }
| if (couponId != '') data.couponId = Number(couponId)
| return request<any>({ path: getApiEndpoint('appOrders'), method: 'POST', data: data, idempotencyKey: idempotencyKey }, onSuccess, onError)
| }
|
| export const getTalentCardProfile = (talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = {}
| if (talentId != '') data.talentId = talentId
| return request<any>({ path: getApiEndpoint('appTalentCardProfile'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
| export const getFamilyCardAccess = (talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = {}
| if (talentId != '') data.talentId = talentId
| return request<any>({ path: getApiEndpoint('appFamilyCardAccess'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
| export const getAgreement = (type: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appAgreements') + encodeURIComponent(type), method: 'GET', skipAuth: true }, onSuccess, onError)
| export const getTicketPackages = (talentId: string, cardId: string, merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = {}
| if (talentId != '') data.talentId = Number(talentId)
| if (cardId != '') data.cardId = Number(cardId)
| if (merchantId != '') data.merchantId = Number(merchantId)
| return request<any>({ path: getApiEndpoint('appTicketPackages'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
| export const claimTicketPackage = (packageId: string, talentId: string, cardId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { talentId: Number(talentId) }
| if (cardId != '') data.cardId = Number(cardId)
| return request<any>({ path: getApiEndpoint('appTicketPackages') + '/' + encodeURIComponent(packageId) + '/claims', method: 'POST', skipAuth: true, data: data, idempotencyKey: 'ticket-package-claim-' + packageId + '-' + talentId + '-' + Date.now() }, onSuccess, onError)
| }
| export const getDisplayMerchantPolicies = (talentId: string, cardId: string, merchantType: string, keyword: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { page: page, size: size }
| if (talentId != '') data.talentId = Number(talentId)
| if (cardId != '') data.cardId = Number(cardId)
| if (merchantType != '') data.merchantType = merchantType
| if (keyword != '') data.keyword = keyword
| return request<any>({ path: getApiEndpoint('appDisplayMerchantPolicies'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
| export const getDisplayMerchantPolicyDetail = (merchantId: string, talentId: string, cardId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = {}
| if (talentId != '') data.talentId = Number(talentId)
| if (cardId != '') data.cardId = Number(cardId)
| return request<any>({ path: getApiEndpoint('appDisplayMerchantPolicies') + '/' + encodeURIComponent(merchantId), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
| export const recordDisplayMerchantPolicyEvent = (merchantId: string, talentId: string, cardId: string, eventType: string, remark: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { eventType: eventType }
| if (talentId != '') data.talentId = Number(talentId)
| if (cardId != '') data.cardId = Number(cardId)
| if (remark != '') data.remark = remark
| return request<any>({ path: getApiEndpoint('appDisplayMerchantPolicies') + '/' + encodeURIComponent(merchantId) + '/events', method: 'POST', skipAuth: true, data: data }, onSuccess, onError)
| }
|
| export const issueTalentDynamicCode = (talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({
| path: getApiEndpoint('appTalentDynamicCode') + encodeURIComponent(talentId) + '/dynamic-codes',
| method: 'POST',
| skipAuth: true
| }, onSuccess, onError)
| }
| export const issueTalentDynamicCodeForScene = (talentId: string, scene: string, merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { scene: scene }
| if (/^\d+$/.test(merchantId)) data.merchantId = Number(merchantId)
| return request<any>({ path: getApiEndpoint('appTalentDynamicCode') + encodeURIComponent(talentId) + '/dynamic-codes', method: 'POST', data: data }, onSuccess, onError)
| }
|
| export const getCardUpgrade = (talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appCardUpgrades'), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| }
|
| export const submitCardUpgrade = (payload: any, idempotencyKey: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appCardUpgrades'), method: 'POST', skipAuth: true, data: payload, idempotencyKey: idempotencyKey }, onSuccess, onError)
| }
|
| export const getUsageRecords = (talentId: string, status: string, page: number, size: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { talentId: talentId, page: page, size: size }
| if (status.length > 0) data.status = status
| return request<any>({ path: getApiEndpoint('appUsageRecords'), method: 'GET', skipAuth: true, data: data }, onSuccess, onError)
| }
|
| export const getPendingOrder = (orderNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appPendingOrders') + encodeURIComponent(orderNo), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| }
|
| export const getPendingOrderCoupons = (orderNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appPendingOrders') + encodeURIComponent(orderNo) + '/coupons', method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| }
|
| export const selectPendingOrderCoupon = (orderNo: string, talentId: string, couponId: string, priceVersion: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appPendingOrders') + encodeURIComponent(orderNo) + '/coupon', method: 'POST', skipAuth: true, data: { talentId: Number(talentId), couponId: Number(couponId), priceVersion: priceVersion } }, onSuccess, onError)
| }
|
| export const cancelPendingOrder = (orderNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({ path: getApiEndpoint('appPendingOrders') + encodeURIComponent(orderNo) + '/cancel', method: 'POST', data: { talentId: Number(talentId) } }, onSuccess, onError)
| }
|
| export const createPendingOrderPayment = (orderNo: string, talentId: string, priceVersion: number, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| return request<any>({
| path: getApiEndpoint('appPendingOrders') + encodeURIComponent(orderNo) + '/payment',
| method: 'POST',
| data: { talentId: Number(talentId), priceVersion: priceVersion },
| idempotencyKey: 'pending-payment-' + orderNo + '-' + priceVersion
| }, onSuccess, onError)
| }
|
| export const getPendingOrderPaymentStatus = (orderNo: string, talentId: string, paymentNo: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| const data: any = { talentId: talentId }
| if (paymentNo != '') data.paymentNo = paymentNo
| return request<any>({ path: getApiEndpoint('appPendingOrders') + encodeURIComponent(orderNo) + '/payment', method: 'GET', data: data }, onSuccess, onError)
| }
|
| export const getPendingUseOrder = (orderNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appPendingUseOrders') + encodeURIComponent(orderNo), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const getCompletedOrder = (orderNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appCompletedOrders') + encodeURIComponent(orderNo), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const getCancelledOrder = (orderNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appCancelledOrders') + encodeURIComponent(orderNo), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const getProcessingApplication = (applicationNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appProcessingApplications') + encodeURIComponent(applicationNo), method: 'GET', skipAuth: true, data: { talentId: talentId } }, onSuccess, onError)
| export const getFamilyCards = (talentCardId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFamilyCards'), method: 'GET', skipAuth: true, data: { talentCardId: Number(talentCardId) } }, onSuccess, onError)
| export const getFreeBenefit = (talentId: string, merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFreeBenefits'), method: 'GET', skipAuth: true, data: { talentId: talentId, merchantId: merchantId } }, onSuccess, onError)
| export const issueFreeBenefitCode = (talentId: string, merchantId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFreeBenefits') + '/dynamic-code', method: 'POST', skipAuth: true, data: { talentId: Number(talentId), merchantId: Number(merchantId) } }, onSuccess, onError)
| export const createFamilyCardApplication = (talentCardId: string, dependentName: string, dependentIdCardNo: string, dependentMobile: string, relation: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFamilyCards'), method: 'POST', skipAuth: true, data: { talentCardId: Number(talentCardId), dependentName: dependentName, dependentIdCardNo: dependentIdCardNo, dependentMobile: dependentMobile, relation: relation }, idempotencyKey: 'family-card-apply-' + talentCardId + '-' + Date.now() }, onSuccess, onError)
| export const unbindFamilyCard = (applicationId: string, talentCardId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appFamilyCards') + '/' + encodeURIComponent(applicationId) + '/unbind', method: 'POST', skipAuth: true, data: { talentCardId: Number(talentCardId) }, idempotencyKey: 'family-card-unbind-' + applicationId }, onSuccess, onError)
| export const unbindFamilyCards = (applicationIds: string[], talentCardId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => {
| let index = 0
| const runNext = (): void => {
| if (index >= applicationIds.length) { onSuccess(null); return }
| const id = applicationIds[index]
| index = index + 1
| unbindFamilyCard(id, talentCardId, () => runNext(), onError)
| }
| runNext()
| return () => {}
| }
| export const issueOrderVerificationCode = (orderNo: string, talentId: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appPendingUseOrders') + encodeURIComponent(orderNo) + '/verification-code', method: 'POST', skipAuth: true, data: { talentId: Number(talentId) } }, onSuccess, onError)
| export const refundPendingUseOrder = (orderNo: string, talentId: string, reason: string, onSuccess: (data: any) => void, onError: (error: HttpError) => void): (() => void) => request<any>({ path: getApiEndpoint('appPendingUseOrders') + encodeURIComponent(orderNo) + '/refund', method: 'POST', skipAuth: true, data: { talentId: Number(talentId), reason: reason }, idempotencyKey: 'refund-' + orderNo }, onSuccess, onError)
|
|