
1package main
2
3import (
4 "bytes"
5 "demo/wxpay_utility"
6 "encoding/json"
7 "fmt"
8 "net/http"
9 "net/url"
10 "time"
11)
12
13func main() {
14
15 config, err := wxpay_utility.CreateMchConfig(
16 "19xxxxxxxx",
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_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_utility.Int64(3),
35 IntervalDays: wxpay_utility.Int64(1),
36 },
37
38 DisplayInfo: &ProductCouponDisplayInfo{
39 Name: wxpay_utility.String("全场多次折扣券"),
40 ImageUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
41 BackgroundUrl: wxpay_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_utility.String("Product_1234567890"),
47
48 StockBundle: &StockBundleForCreate{
49 Remark: wxpay_utility.String("8月工作日有效批次"),
50 CouponCodeMode: COUPONCODEMODE_UPLOAD.Ptr(),
51 StockSendRule: &StockSendRuleForBundle{
52 MaxCount: wxpay_utility.Int64(10000000),
53 MaxCountPerUser: wxpay_utility.Int64(1),
54 },
55
56 ProgressiveBundleUsageRule: &StockBundleUsageRule{
57 CouponAvailablePeriod: &CouponAvailablePeriod{
58 AvailableBeginTime: wxpay_utility.String("2025-08-01T00:00:00+08:00"),
59 AvailableEndTime: wxpay_utility.String("2025-08-31T23:59:59+08:00"),
60 AvailableDays: wxpay_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_utility.Int64(10000),
75 PercentOff: wxpay_utility.Int64(50),
76 },
77 {
78 Threshold: wxpay_utility.Int64(10000),
79 PercentOff: wxpay_utility.Int64(20),
80 },
81 {
82 Threshold: wxpay_utility.Int64(10000),
83 PercentOff: wxpay_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_utility.String("wx1234567890"),
95 MiniProgramPath: wxpay_utility.String("/pages/index/product"),
96 UsageDescription: wxpay_utility.String("工作日可用"),
97 CouponAvailableStoreInfo: &CouponAvailableStoreInfo{
98 Description: wxpay_utility.String("所有门店可用,可使用小程序查看门店列表"),
99 MiniProgramAppid: wxpay_utility.String("wx1234567890"),
100 MiniProgramPath: wxpay_utility.String("/pages/index/store-list"),
101 },
102 },
103
104 CouponDisplayInfo: &CouponDisplayInfo{
105 CodeDisplayMode: COUPONCODEDISPLAYMODE_QRCODE.Ptr(),
106 BackgroundColor: wxpay_utility.String("Color010"),
107 EntranceMiniProgram: &EntranceMiniProgram{
108 Appid: wxpay_utility.String("wx1234567890"),
109 Path: wxpay_utility.String("/pages/index/product"),
110 EntranceWording: wxpay_utility.String("欢迎选购"),
111 GuidanceWording: wxpay_utility.String("获取更多优惠"),
112 },
113 EntranceOfficialAccount: &EntranceOfficialAccount{
114 Appid: wxpay_utility.String("wx1234567890"),
115 },
116 EntranceFinder: &EntranceFinder{
117 FinderId: wxpay_utility.String("gh_12345678"),
118 FinderVideoId: wxpay_utility.String("UDFsdf24df34dD456Hdf34"),
119 FinderVideoCoverImageUrl: wxpay_utility.String("https://wxpaylogo.qpic.cn/wxpaylogo/xxxxx/xxx"),
120 },
121 },
122 StoreScope: STOCKSTORESCOPE_NONE.Ptr(),
123 NotifyConfig: &NotifyConfig{
124 NotifyAppid: wxpay_utility.String("wx4fd12345678"),
125 },
126 },
127 BrandId: wxpay_utility.String("120344"),
128 }
129
130 response, err := CreateProductCoupon(config, request)
131 if err != nil {
132 fmt.Printf("请求失败: %+v\n", err)
133
134 return
135 }
136
137
138 fmt.Printf("请求成功: %+v\n", response)
139}
140
141func CreateProductCoupon(config *wxpay_utility.MchConfig, request *CreateProductCouponRequest) (response *CreateProductCouponResponse, err error) {
142 const (
143 host = "https://api.mch.weixin.qq.com"
144 method = "POST"
145 path = "/v3/marketing/partner/product-coupon/product-coupons"
146 )
147
148 reqUrl, err := url.Parse(fmt.Sprintf("%s%s", host, path))
149 if err != nil {
150 return nil, err
151 }
152 reqBody, err := json.Marshal(request)
153 if err != nil {
154 return nil, err
155 }
156 httpRequest, err := http.NewRequest(method, reqUrl.String(), bytes.NewReader(reqBody))
157 if err != nil {
158 return nil, err
159 }
160 httpRequest.Header.Set("Accept", "application/json")
161 httpRequest.Header.Set("Wechatpay-Serial", config.WechatPayPublicKeyId())
162 httpRequest.Header.Set("Content-Type", "application/json")
163 authorization, err := wxpay_utility.BuildAuthorization(config.MchId(), config.CertificateSerialNo(), config.PrivateKey(), method, reqUrl.RequestURI(), reqBody)
164 if err != nil {
165 return nil, err
166 }
167 httpRequest.Header.Set("Authorization", authorization)
168
169 client := &http.Client{}
170 httpResponse, err := client.Do(httpRequest)
171 if err != nil {
172 return nil, err
173 }
174 respBody, err := wxpay_utility.ExtractResponseBody(httpResponse)
175 if err != nil {
176 return nil, err
177 }
178 if httpResponse.StatusCode >= 200 && httpResponse.StatusCode < 300 {
179
180 err = wxpay_utility.ValidateResponse(
181 config.WechatPayPublicKeyId(),
182 config.WechatPayPublicKey(),
183 &httpResponse.Header,
184 respBody,
185 )
186 if err != nil {
187 return nil, err
188 }
189 response := &CreateProductCouponResponse{}
190 if err := json.Unmarshal(respBody, response); err != nil {
191 return nil, err
192 }
193
194 return response, nil
195 } else {
196 return nil, wxpay_utility.NewApiException(
197 httpResponse.StatusCode,
198 httpResponse.Header,
199 respBody,
200 )
201 }
202}
203
204type CreateProductCouponRequest struct {
205 OutRequestNo *string `json:"out_request_no,omitempty"`
206 Scope *ProductCouponScope `json:"scope,omitempty"`
207 Type *ProductCouponType `json:"type,omitempty"`
208 UsageMode *UsageMode `json:"usage_mode,omitempty"`
209 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
210 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
211 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
212 OutProductNo *string `json:"out_product_no,omitempty"`
213 Stock *StockForCreate `json:"stock,omitempty"`
214 StockBundle *StockBundleForCreate `json:"stock_bundle,omitempty"`
215 BrandId *string `json:"brand_id,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 BrandId *string `json:"brand_id,omitempty"`
231}
232
233type ProductCouponScope string
234
235func (e ProductCouponScope) Ptr() *ProductCouponScope {
236 return &e
237}
238
239const (
240 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL"
241 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE"
242)
243
244type ProductCouponType string
245
246func (e ProductCouponType) Ptr() *ProductCouponType {
247 return &e
248}
249
250const (
251 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL"
252 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT"
253 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE"
254)
255
256type UsageMode string
257
258func (e UsageMode) Ptr() *UsageMode {
259 return &e
260}
261
262const (
263 USAGEMODE_SINGLE UsageMode = "SINGLE"
264 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE"
265)
266
267type SingleUsageInfo struct {
268 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
269 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
270}
271
272type ProgressiveBundleUsageInfo struct {
273 Count *int64 `json:"count,omitempty"`
274 IntervalDays *int64 `json:"interval_days,omitempty"`
275}
276
277type ProductCouponDisplayInfo struct {
278 Name *string `json:"name,omitempty"`
279 ImageUrl *string `json:"image_url,omitempty"`
280 BackgroundUrl *string `json:"background_url,omitempty"`
281 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"`
282 OriginalPrice *int64 `json:"original_price,omitempty"`
283 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"`
284}
285
286type StockForCreate struct {
287 Remark *string `json:"remark,omitempty"`
288 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
289 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
290 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
291 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
292 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
293 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
294 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
295}
296
297type StockBundleForCreate struct {
298 Remark *string `json:"remark,omitempty"`
299 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
300 StockSendRule *StockSendRuleForBundle `json:"stock_send_rule,omitempty"`
301 ProgressiveBundleUsageRule *StockBundleUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
302 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
303 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
304 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
305 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
306}
307
308type ProductCouponState string
309
310func (e ProductCouponState) Ptr() *ProductCouponState {
311 return &e
312}
313
314const (
315 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING"
316 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE"
317 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED"
318)
319
320type StockEntity struct {
321 ProductCouponId *string `json:"product_coupon_id,omitempty"`
322 StockId *string `json:"stock_id,omitempty"`
323 Remark *string `json:"remark,omitempty"`
324 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
325 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
326 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
327 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
328 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
329 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
330 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
331 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
332 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
333 State *StockState `json:"state,omitempty"`
334 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
335 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
336 DeactivateReason *string `json:"deactivate_reason,omitempty"`
337 BrandId *string `json:"brand_id,omitempty"`
338}
339
340type StockBundleEntity struct {
341 StockBundleId *string `json:"stock_bundle_id,omitempty"`
342 StockList []StockEntityInBundle `json:"stock_list,omitempty"`
343}
344
345type NormalCouponUsageRule struct {
346 Threshold *int64 `json:"threshold,omitempty"`
347 DiscountAmount *int64 `json:"discount_amount,omitempty"`
348}
349
350type DiscountCouponUsageRule struct {
351 Threshold *int64 `json:"threshold,omitempty"`
352 PercentOff *int64 `json:"percent_off,omitempty"`
353}
354
355type ComboPackage struct {
356 Name *string `json:"name,omitempty"`
357 PickCount *int64 `json:"pick_count,omitempty"`
358 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"`
359}
360
361type CouponCodeMode string
362
363func (e CouponCodeMode) Ptr() *CouponCodeMode {
364 return &e
365}
366
367const (
368 COUPONCODEMODE_WECHATPAY CouponCodeMode = "WECHATPAY"
369 COUPONCODEMODE_UPLOAD CouponCodeMode = "UPLOAD"
370 COUPONCODEMODE_API_ASSIGN CouponCodeMode = "API_ASSIGN"
371)
372
373type StockSendRule struct {
374 MaxCount *int64 `json:"max_count,omitempty"`
375 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
376 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
377}
378
379type SingleUsageRule struct {
380 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
381 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
382 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
383 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
384}
385
386type UsageRuleDisplayInfo struct {
387 CouponUsageMethodList []CouponUsageMethod `json:"coupon_usage_method_list,omitempty"`
388 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
389 MiniProgramPath *string `json:"mini_program_path,omitempty"`
390 AppPath *string `json:"app_path,omitempty"`
391 UsageDescription *string `json:"usage_description,omitempty"`
392 CouponAvailableStoreInfo *CouponAvailableStoreInfo `json:"coupon_available_store_info,omitempty"`
393 AppJumpType *AppJumpType `json:"app_jump_type,omitempty"`
394 PasscodeLink *string `json:"passcode_link,omitempty"`
395}
396
397type CouponDisplayInfo struct {
398 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"`
399 BackgroundColor *string `json:"background_color,omitempty"`
400 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"`
401 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"`
402 EntranceFinder *EntranceFinder `json:"entrance_finder,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 BrandId *string `json:"brand_id,omitempty"`
477}
478
479type ComboPackageChoice struct {
480 Name *string `json:"name,omitempty"`
481 Price *int64 `json:"price,omitempty"`
482 Count *int64 `json:"count,omitempty"`
483 ImageUrl *string `json:"image_url,omitempty"`
484 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
485 MiniProgramPath *string `json:"mini_program_path,omitempty"`
486}
487
488type CouponAvailablePeriod struct {
489 AvailableBeginTime *string `json:"available_begin_time,omitempty"`
490 AvailableEndTime *string `json:"available_end_time,omitempty"`
491 AvailableDays *int64 `json:"available_days,omitempty"`
492 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
493 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"`
494 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"`
495 AvailableSeconds *int64 `json:"available_seconds,omitempty"`
496}
497
498type ExchangeCouponUsageRule struct {
499 Threshold *int64 `json:"threshold,omitempty"`
500 ExchangePrice *int64 `json:"exchange_price,omitempty"`
501}
502
503type CouponUsageMethod string
504
505func (e CouponUsageMethod) Ptr() *CouponUsageMethod {
506 return &e
507}
508
509const (
510 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE"
511 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM"
512 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP"
513 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE"
514)
515
516type CouponAvailableStoreInfo struct {
517 Description *string `json:"description,omitempty"`
518 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
519 MiniProgramPath *string `json:"mini_program_path,omitempty"`
520}
521
522type AppJumpType string
523
524func (e AppJumpType) Ptr() *AppJumpType {
525 return &e
526}
527
528const (
529 APPJUMPTYPE_H5 AppJumpType = "H5"
530 APPJUMPTYPE_PASSCODE_LINK AppJumpType = "PASSCODE_LINK"
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 EntranceFinder struct {
557 FinderId *string `json:"finder_id,omitempty"`
558 FinderVideoId *string `json:"finder_video_id,omitempty"`
559 FinderVideoCoverImageUrl *string `json:"finder_video_cover_image_url,omitempty"`
560}
561
562type StockUsageRule struct {
563 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
564 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
565 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
566 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
567}
568
569type StockBundleInfo struct {
570 StockBundleId *string `json:"stock_bundle_id,omitempty"`
571 StockBundleIndex *int64 `json:"stock_bundle_index,omitempty"`
572}
573
574type FixedWeekPeriod struct {
575 DayList []WeekEnum `json:"day_list,omitempty"`
576 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"`
577}
578
579type TimePeriod struct {
580 BeginTime *string `json:"begin_time,omitempty"`
581 EndTime *string `json:"end_time,omitempty"`
582}
583
584type WeekEnum string
585
586func (e WeekEnum) Ptr() *WeekEnum {
587 return &e
588}
589
590const (
591 WEEKENUM_MONDAY WeekEnum = "MONDAY"
592 WEEKENUM_TUESDAY WeekEnum = "TUESDAY"
593 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY"
594 WEEKENUM_THURSDAY WeekEnum = "THURSDAY"
595 WEEKENUM_FRIDAY WeekEnum = "FRIDAY"
596 WEEKENUM_SATURDAY WeekEnum = "SATURDAY"
597 WEEKENUM_SUNDAY WeekEnum = "SUNDAY"
598)
599
600type PeriodOfTheDay struct {
601 BeginTime *int64 `json:"begin_time,omitempty"`
602 EndTime *int64 `json:"end_time,omitempty"`
603}