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