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