
1package main
2
3import (
4 "bytes"
5 "demo/wxpay_brand_utility"
6 "encoding/json"
7 "fmt"
8 "net/http"
9 "net/url"
10 "time"
11)
12
13func main() {
14
15 config, err := wxpay_brand_utility.CreateBrandConfig(
16 "xxxxxxxx",
17 "1DDE55AD98Exxxxxxxxxx",
18 "/path/to/apiclient_key.pem",
19 "PUB_KEY_ID_xxxxxxxxxxxxx",
20 "/path/to/wxp_pub.pem",
21 )
22 if err != nil {
23 fmt.Println(err)
24 return
25 }
26
27 request := &CreateProductCouponRequest{
28 OutRequestNo: wxpay_brand_utility.String("12345_20250101_A3489"),
29 Scope: PRODUCTCOUPONSCOPE_ALL.Ptr(),
30 Type: PRODUCTCOUPONTYPE_DISCOUNT.Ptr(),
31 UsageMode: USAGEMODE_PROGRESSIVE_BUNDLE.Ptr(),
32
33 ProgressiveBundleUsageInfo: &ProgressiveBundleUsageInfo{
34 Count: wxpay_brand_utility.Int64(3),
35 IntervalDays: wxpay_brand_utility.Int64(1),
36 },
37
38 DisplayInfo: &ProductCouponDisplayInfo{
39 Name: wxpay_brand_utility.String("全场多次折扣券"),
40 ImageUrl: wxpay_brand_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
41 BackgroundUrl: wxpay_brand_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
42 DetailImageUrlList: []string{
43 "https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx",
44 },
45 },
46 OutProductNo: wxpay_brand_utility.String("Product_1234567890"),
47
48 StockBundle: &StockBundleForCreate{
49 Remark: wxpay_brand_utility.String("8月工作日有效批次"),
50 CouponCodeMode: COUPONCODEMODE_UPLOAD.Ptr(),
51 StockSendRule: &StockSendRuleForBundle{
52 MaxCount: wxpay_brand_utility.Int64(10000000),
53 MaxCountPerUser: wxpay_brand_utility.Int64(1),
54 },
55
56 ProgressiveBundleUsageRule: &StockBundleUsageRule{
57 CouponAvailablePeriod: &CouponAvailablePeriod{
58 AvailableBeginTime: wxpay_brand_utility.String("2025-08-01T00:00:00+08:00"),
59 AvailableEndTime: wxpay_brand_utility.String("2025-08-31T23:59:59+08:00"),
60 AvailableDays: wxpay_brand_utility.Int64(30),
61 WeeklyAvailablePeriod: &FixedWeekPeriod{
62 DayList: []WeekEnum{
63 WEEKENUM_MONDAY,
64 WEEKENUM_TUESDAY,
65 WEEKENUM_WEDNESDAY,
66 WEEKENUM_THURSDAY,
67 WEEKENUM_FRIDAY,
68 },
69 },
70 },
71
72 DiscountCouponList: []DiscountCouponUsageRule{
73 {
74 Threshold: wxpay_brand_utility.Int64(10000),
75 PercentOff: wxpay_brand_utility.Int64(50),
76 },
77 {
78 Threshold: wxpay_brand_utility.Int64(10000),
79 PercentOff: wxpay_brand_utility.Int64(20),
80 },
81 {
82 Threshold: wxpay_brand_utility.Int64(10000),
83 PercentOff: wxpay_brand_utility.Int64(30),
84 },
85 },
86 },
87
88 UsageRuleDisplayInfo: &UsageRuleDisplayInfo{
89 CouponUsageMethodList: []CouponUsageMethod{
90 COUPONUSAGEMETHOD_OFFLINE,
91 COUPONUSAGEMETHOD_MINI_PROGRAM,
92 COUPONUSAGEMETHOD_PAYMENT_CODE,
93 },
94 MiniProgramAppid: wxpay_brand_utility.String("wx1234567890"),
95 MiniProgramPath: wxpay_brand_utility.String("/pages/index/product"),
96 UsageDescription: wxpay_brand_utility.String("工作日可用"),
97 CouponAvailableStoreInfo: &CouponAvailableStoreInfo{
98 Description: wxpay_brand_utility.String("所有门店可用,可使用小程序查看门店列表"),
99 MiniProgramAppid: wxpay_brand_utility.String("wx1234567890"),
100 MiniProgramPath: wxpay_brand_utility.String("/pages/index/store-list"),
101 },
102 },
103
104 CouponDisplayInfo: &CouponDisplayInfo{
105 CodeDisplayMode: COUPONCODEDISPLAYMODE_QRCODE.Ptr(),
106 BackgroundColor: wxpay_brand_utility.String("Color010"),
107 EntranceMiniProgram: &EntranceMiniProgram{
108 Appid: wxpay_brand_utility.String("wx1234567890"),
109 Path: wxpay_brand_utility.String("/pages/index/product"),
110 EntranceWording: wxpay_brand_utility.String("欢迎选购"),
111 GuidanceWording: wxpay_brand_utility.String("获取更多优惠"),
112 },
113 EntranceOfficialAccount: &EntranceOfficialAccount{
114 Appid: wxpay_brand_utility.String("wx1234567890"),
115 },
116 EntranceFinder: &EntranceFinder{
117 FinderId: wxpay_brand_utility.String("gh_12345678"),
118 FinderVideoId: wxpay_brand_utility.String("UDFsdf24df34dD456Hdf34"),
119 FinderVideoCoverImageUrl: wxpay_brand_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
120 },
121 },
122 StoreScope: STOCKSTORESCOPE_NONE.Ptr(),
123 NotifyConfig: &NotifyConfig{
124 NotifyAppid: wxpay_brand_utility.String("wx4fd12345678"),
125 },
126 },
127 }
128
129 response, err := CreateProductCoupon(config, request)
130 if err != nil {
131 fmt.Printf("请求失败: %+v\n", err)
132
133 return
134 }
135
136
137 fmt.Printf("请求成功: %+v\n", response)
138}
139
140func CreateProductCoupon(config *wxpay_brand_utility.BrandConfig, request *CreateProductCouponRequest) (response *CreateProductCouponResponse, err error) {
141 const (
142 host = "https://api.mch.weixin.qq.com"
143 method = "POST"
144 path = "/brand/marketing/product-coupon/product-coupons"
145 )
146
147 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path))
148 if err != nil {
149 return nil, err
150 }
151 reqBody, err := json.Marshal(request)
152 if err != nil {
153 return nil, err
154 }
155 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody))
156 if err != nil {
157 return nil, err
158 }
159 httpRequest.Header.Set("Accept", "application/json")
160 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId())
161 httpRequest.Header.Set("Content-Type", "application/json")
162 authorization, err := wxpay_brand_utility.BuildAuthorization(config.BrandId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody)
163 if err != nil {
164 return nil, err
165 }
166 httpRequest.Header.Set("Authorization", authorization)
167
168 client := &http.Client{}
169 httpResponse, err := client.Do(httpRequest)
170 if err != nil {
171 return nil, err
172 }
173 respBody, err := wxpay_brand_utility.ExtractResponseBody(httpResponse)
174 if err != nil {
175 return nil, err
176 }
177 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 {
178
179 err = wxpay_brand_utility.ValidateResponse(
180 config.WechatPayPublicKeyId(),
181 config.WechatPayPublicKey(),
182 &httpResponse.Header,
183 respBody,
184 )
185 if err != nil {
186 return nil, err
187 }
188 response := &CreateProductCouponResponse{}
189 if err := json.Unmarshal(respBody, response); err != nil {
190 return nil, err
191 }
192
193 return response, nil
194 } else {
195 return nil, wxpay_brand_utility.NewApiException(
196 httpResponse.StatusCode,
197 httpResponse.Header,
198 respBody,
199 )
200 }
201}
202
203type CreateProductCouponRequest struct {
204 OutRequestNo *string `json:"out_request_no,omitempty"`
205 Scope *ProductCouponScope `json:"scope,omitempty"`
206 Type *ProductCouponType `json:"type,omitempty"`
207 UsageMode *UsageMode `json:"usage_mode,omitempty"`
208 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
209 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
210 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
211 OutProductNo *string `json:"out_product_no,omitempty"`
212 Stock *StockForCreate `json:"stock,omitempty"`
213 StockBundle *StockBundleForCreate `json:"stock_bundle,omitempty"`
214 ShowAsExchange *bool `json:"show_as_exchange,omitempty"`
215 AvailableProductNoList []string `json:"available_product_no_list,omitempty"`
216}
217
218type CreateProductCouponResponse struct {
219 ProductCouponId *string `json:"product_coupon_id,omitempty"`
220 Scope *ProductCouponScope `json:"scope,omitempty"`
221 Type *ProductCouponType `json:"type,omitempty"`
222 UsageMode *UsageMode `json:"usage_mode,omitempty"`
223 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
224 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
225 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
226 OutProductNo *string `json:"out_product_no,omitempty"`
227 State *ProductCouponState `json:"state,omitempty"`
228 Stock *StockEntity `json:"stock,omitempty"`
229 StockBundle *StockBundleEntity `json:"stock_bundle,omitempty"`
230 ShowAsExchange *bool `json:"show_as_exchange,omitempty"`
231 AvailableProductNoList []string `json:"available_product_no_list,omitempty"`
232}
233
234type ProductCouponScope string
235
236func (e ProductCouponScope) Ptr() *ProductCouponScope {
237 return &e
238}
239
240const (
241 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL"
242 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE"
243 PRODUCTCOUPONSCOPE_CATEGORY ProductCouponScope = "CATEGORY"
244)
245
246type ProductCouponType string
247
248func (e ProductCouponType) Ptr() *ProductCouponType {
249 return &e
250}
251
252const (
253 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL"
254 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT"
255 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE"
256)
257
258type UsageMode string
259
260func (e UsageMode) Ptr() *UsageMode {
261 return &e
262}
263
264const (
265 USAGEMODE_SINGLE UsageMode = "SINGLE"
266 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE"
267)
268
269type SingleUsageInfo struct {
270 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
271 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
272}
273
274type ProgressiveBundleUsageInfo struct {
275 Count *int64 `json:"count,omitempty"`
276 IntervalDays *int64 `json:"interval_days,omitempty"`
277}
278
279type ProductCouponDisplayInfo struct {
280 Name *string `json:"name,omitempty"`
281 ImageUrl *string `json:"image_url,omitempty"`
282 BackgroundUrl *string `json:"background_url,omitempty"`
283 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"`
284 OriginalPrice *int64 `json:"original_price,omitempty"`
285 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"`
286}
287
288type StockForCreate struct {
289 Remark *string `json:"remark,omitempty"`
290 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
291 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
292 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
293 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
294 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
295 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
296 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
297}
298
299type StockBundleForCreate struct {
300 Remark *string `json:"remark,omitempty"`
301 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
302 StockSendRule *StockSendRuleForBundle `json:"stock_send_rule,omitempty"`
303 ProgressiveBundleUsageRule *StockBundleUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
304 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
305 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
306 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
307 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
308}
309
310type ProductCouponState string
311
312func (e ProductCouponState) Ptr() *ProductCouponState {
313 return &e
314}
315
316const (
317 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING"
318 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE"
319 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED"
320)
321
322type StockEntity struct {
323 ProductCouponId *string `json:"product_coupon_id,omitempty"`
324 StockId *string `json:"stock_id,omitempty"`
325 Remark *string `json:"remark,omitempty"`
326 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
327 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
328 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
329 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
330 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
331 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
332 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
333 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
334 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
335 State *StockState `json:"state,omitempty"`
336 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
337 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
338 DeactivateReason *string `json:"deactivate_reason,omitempty"`
339}
340
341type StockBundleEntity struct {
342 StockBundleId *string `json:"stock_bundle_id,omitempty"`
343 StockList []StockEntityInBundle `json:"stock_list,omitempty"`
344}
345
346type NormalCouponUsageRule struct {
347 Threshold *int64 `json:"threshold,omitempty"`
348 DiscountAmount *int64 `json:"discount_amount,omitempty"`
349}
350
351type DiscountCouponUsageRule struct {
352 Threshold *int64 `json:"threshold,omitempty"`
353 PercentOff *int64 `json:"percent_off,omitempty"`
354}
355
356type ComboPackage struct {
357 Name *string `json:"name,omitempty"`
358 PickCount *int64 `json:"pick_count,omitempty"`
359 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"`
360}
361
362type CouponCodeMode string
363
364func (e CouponCodeMode) Ptr() *CouponCodeMode {
365 return &e
366}
367
368const (
369 COUPONCODEMODE_WECHATPAY CouponCodeMode = "WECHATPAY"
370 COUPONCODEMODE_UPLOAD CouponCodeMode = "UPLOAD"
371 COUPONCODEMODE_API_ASSIGN CouponCodeMode = "API_ASSIGN"
372)
373
374type StockSendRule struct {
375 MaxCount *int64 `json:"max_count,omitempty"`
376 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
377 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
378}
379
380type SingleUsageRule struct {
381 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
382 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
383 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
384 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
385}
386
387type UsageRuleDisplayInfo struct {
388 CouponUsageMethodList []CouponUsageMethod `json:"coupon_usage_method_list,omitempty"`
389 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
390 MiniProgramPath *string `json:"mini_program_path,omitempty"`
391 AppPath *string `json:"app_path,omitempty"`
392 UsageDescription *string `json:"usage_description,omitempty"`
393 CouponAvailableStoreInfo *CouponAvailableStoreInfo `json:"coupon_available_store_info,omitempty"`
394 AppJumpType *AppJumpType `json:"app_jump_type,omitempty"`
395 PasscodeLink *string `json:"passcode_link,omitempty"`
396}
397
398type CouponDisplayInfo struct {
399 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"`
400 BackgroundColor *string `json:"background_color,omitempty"`
401 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"`
402 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"`
403}
404
405type NotifyConfig struct {
406 NotifyAppid *string `json:"notify_appid,omitempty"`
407}
408
409type StockStoreScope string
410
411func (e StockStoreScope) Ptr() *StockStoreScope {
412 return &e
413}
414
415const (
416 STOCKSTORESCOPE_NONE StockStoreScope = "NONE"
417 STOCKSTORESCOPE_ALL StockStoreScope = "ALL"
418 STOCKSTORESCOPE_SPECIFIC StockStoreScope = "SPECIFIC"
419)
420
421type StockSendRuleForBundle struct {
422 MaxCount *int64 `json:"max_count,omitempty"`
423 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
424 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
425}
426
427type StockBundleUsageRule struct {
428 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
429 NormalCouponList []NormalCouponUsageRule `json:"normal_coupon_list,omitempty"`
430 DiscountCouponList []DiscountCouponUsageRule `json:"discount_coupon_list,omitempty"`
431 ExchangeCouponList []ExchangeCouponUsageRule `json:"exchange_coupon_list,omitempty"`
432}
433
434type CouponCodeCountInfo struct {
435 TotalCount *int64 `json:"total_count,omitempty"`
436 AvailableCount *int64 `json:"available_count,omitempty"`
437}
438
439type StockSentCountInfo struct {
440 TotalCount *int64 `json:"total_count,omitempty"`
441 TodayCount *int64 `json:"today_count,omitempty"`
442}
443
444type StockState string
445
446func (e StockState) Ptr() *StockState {
447 return &e
448}
449
450const (
451 STOCKSTATE_AUDITING StockState = "AUDITING"
452 STOCKSTATE_SENDING StockState = "SENDING"
453 STOCKSTATE_PAUSED StockState = "PAUSED"
454 STOCKSTATE_STOPPED StockState = "STOPPED"
455 STOCKSTATE_DEACTIVATED StockState = "DEACTIVATED"
456)
457
458type StockEntityInBundle struct {
459 ProductCouponId *string `json:"product_coupon_id,omitempty"`
460 StockId *string `json:"stock_id,omitempty"`
461 Remark *string `json:"remark,omitempty"`
462 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
463 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
464 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
465 ProgressiveBundleUsageRule *StockUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
466 StockBundleInfo *StockBundleInfo `json:"stock_bundle_info,omitempty"`
467 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
468 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
469 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
470 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
471 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
472 State *StockState `json:"state,omitempty"`
473 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
474 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
475 DeactivateReason *string `json:"deactivate_reason,omitempty"`
476}
477
478type ComboPackageChoice struct {
479 Name *string `json:"name,omitempty"`
480 Price *int64 `json:"price,omitempty"`
481 Count *int64 `json:"count,omitempty"`
482 ImageUrl *string `json:"image_url,omitempty"`
483 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
484 MiniProgramPath *string `json:"mini_program_path,omitempty"`
485}
486
487type CouponAvailablePeriod struct {
488 AvailableBeginTime *string `json:"available_begin_time,omitempty"`
489 AvailableEndTime *string `json:"available_end_time,omitempty"`
490 AvailableDays *int64 `json:"available_days,omitempty"`
491 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
492 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"`
493 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"`
494 AvailableSeconds *int64 `json:"available_seconds,omitempty"`
495}
496
497type ExchangeCouponUsageRule struct {
498 Threshold *int64 `json:"threshold,omitempty"`
499 ExchangePrice *int64 `json:"exchange_price,omitempty"`
500}
501
502type CouponUsageMethod string
503
504func (e CouponUsageMethod) Ptr() *CouponUsageMethod {
505 return &e
506}
507
508const (
509 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE"
510 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM"
511 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP"
512 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE"
513)
514
515type CouponAvailableStoreInfo struct {
516 Description *string `json:"description,omitempty"`
517 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
518 MiniProgramPath *string `json:"mini_program_path,omitempty"`
519}
520
521type AppJumpType string
522
523func (e AppJumpType) Ptr() *AppJumpType {
524 return &e
525}
526
527const (
528 APPJUMPTYPE_H5 AppJumpType = "H5"
529 APPJUMPTYPE_PASSCODE_LINK AppJumpType = "PASSCODE_LINK"
530 APPJUMPTYPE_USAGE_GUIDE AppJumpType = "USAGE_GUIDE"
531)
532
533type CouponCodeDisplayMode string
534
535func (e CouponCodeDisplayMode) Ptr() *CouponCodeDisplayMode {
536 return &e
537}
538
539const (
540 COUPONCODEDISPLAYMODE_INVISIBLE CouponCodeDisplayMode = "INVISIBLE"
541 COUPONCODEDISPLAYMODE_BARCODE CouponCodeDisplayMode = "BARCODE"
542 COUPONCODEDISPLAYMODE_QRCODE CouponCodeDisplayMode = "QRCODE"
543)
544
545type EntranceMiniProgram struct {
546 Appid *string `json:"appid,omitempty"`
547 Path *string `json:"path,omitempty"`
548 EntranceWording *string `json:"entrance_wording,omitempty"`
549 GuidanceWording *string `json:"guidance_wording,omitempty"`
550}
551
552type EntranceOfficialAccount struct {
553 Appid *string `json:"appid,omitempty"`
554}
555
556type StockUsageRule struct {
557 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
558 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
559 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
560 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
561}
562
563type StockBundleInfo struct {
564 StockBundleId *string `json:"stock_bundle_id,omitempty"`
565 StockBundleIndex *int64 `json:"stock_bundle_index,omitempty"`
566}
567
568type FixedWeekPeriod struct {
569 DayList []WeekEnum `json:"day_list,omitempty"`
570 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"`
571}
572
573type TimePeriod struct {
574 BeginTime *string `json:"begin_time,omitempty"`
575 EndTime *string `json:"end_time,omitempty"`
576}
577
578type WeekEnum string
579
580func (e WeekEnum) Ptr() *WeekEnum {
581 return &e
582}
583
584const (
585 WEEKENUM_MONDAY WeekEnum = "MONDAY"
586 WEEKENUM_TUESDAY WeekEnum = "TUESDAY"
587 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY"
588 WEEKENUM_THURSDAY WeekEnum = "THURSDAY"
589 WEEKENUM_FRIDAY WeekEnum = "FRIDAY"
590 WEEKENUM_SATURDAY WeekEnum = "SATURDAY"
591 WEEKENUM_SUNDAY WeekEnum = "SUNDAY"
592)
593
594type PeriodOfTheDay struct {
595 BeginTime *int64 `json:"begin_time,omitempty"`
596 EndTime *int64 `json:"end_time,omitempty"`
597}
598