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