
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 *ProductCouponDisplayInfoForCreate `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 BusinessMode *ProductCouponBusinessMode `json:"business_mode,omitempty"`
217}
218
219type CreateProductCouponResponse struct {
220 ProductCouponId *string `json:"product_coupon_id,omitempty"`
221 Scope *ProductCouponScope `json:"scope,omitempty"`
222 Type *ProductCouponType `json:"type,omitempty"`
223 UsageMode *UsageMode `json:"usage_mode,omitempty"`
224 SingleUsageInfo *SingleUsageInfo `json:"single_usage_info,omitempty"`
225 ProgressiveBundleUsageInfo *ProgressiveBundleUsageInfo `json:"progressive_bundle_usage_info,omitempty"`
226 DisplayInfo *ProductCouponDisplayInfo `json:"display_info,omitempty"`
227 OutProductNo *string `json:"out_product_no,omitempty"`
228 State *ProductCouponState `json:"state,omitempty"`
229 Stock *StockEntity `json:"stock,omitempty"`
230 StockBundle *StockBundleEntity `json:"stock_bundle,omitempty"`
231 ShowAsExchange *bool `json:"show_as_exchange,omitempty"`
232 AvailableProductNoList []string `json:"available_product_no_list,omitempty"`
233 BusinessMode *ProductCouponBusinessMode `json:"business_mode,omitempty"`
234}
235
236type ProductCouponScope string
237
238func (e ProductCouponScope) Ptr() *ProductCouponScope {
239 return &e
240}
241
242const (
243 PRODUCTCOUPONSCOPE_ALL ProductCouponScope = "ALL"
244 PRODUCTCOUPONSCOPE_SINGLE ProductCouponScope = "SINGLE"
245 PRODUCTCOUPONSCOPE_CATEGORY ProductCouponScope = "CATEGORY"
246)
247
248type ProductCouponType string
249
250func (e ProductCouponType) Ptr() *ProductCouponType {
251 return &e
252}
253
254const (
255 PRODUCTCOUPONTYPE_NORMAL ProductCouponType = "NORMAL"
256 PRODUCTCOUPONTYPE_DISCOUNT ProductCouponType = "DISCOUNT"
257 PRODUCTCOUPONTYPE_EXCHANGE ProductCouponType = "EXCHANGE"
258)
259
260type UsageMode string
261
262func (e UsageMode) Ptr() *UsageMode {
263 return &e
264}
265
266const (
267 USAGEMODE_SINGLE UsageMode = "SINGLE"
268 USAGEMODE_PROGRESSIVE_BUNDLE UsageMode = "PROGRESSIVE_BUNDLE"
269)
270
271type SingleUsageInfo struct {
272 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
273 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
274}
275
276type ProgressiveBundleUsageInfo struct {
277 Count *int64 `json:"count,omitempty"`
278 IntervalDays *int64 `json:"interval_days,omitempty"`
279}
280
281type ProductCouponDisplayInfoForCreate struct {
282 Name *string `json:"name,omitempty"`
283 ImageUrl *string `json:"image_url,omitempty"`
284 BackgroundUrl *string `json:"background_url,omitempty"`
285 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"`
286 OriginalPrice *int64 `json:"original_price,omitempty"`
287 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"`
288}
289
290type StockForCreate struct {
291 Remark *string `json:"remark,omitempty"`
292 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
293 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
294 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
295 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
296 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
297 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
298 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
299}
300
301type StockBundleForCreate struct {
302 Remark *string `json:"remark,omitempty"`
303 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
304 StockSendRule *StockSendRuleForBundle `json:"stock_send_rule,omitempty"`
305 ProgressiveBundleUsageRule *StockBundleUsageRule `json:"progressive_bundle_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}
311
312type ProductCouponBusinessMode string
313
314func (e ProductCouponBusinessMode) Ptr() *ProductCouponBusinessMode {
315 return &e
316}
317
318const (
319 PRODUCTCOUPONBUSINESSMODE_FREE ProductCouponBusinessMode = "FREE"
320)
321
322type ProductCouponDisplayInfo struct {
323 Name *string `json:"name,omitempty"`
324 ImageUrl *string `json:"image_url,omitempty"`
325 BackgroundUrl *string `json:"background_url,omitempty"`
326 DetailImageUrlList []string `json:"detail_image_url_list,omitempty"`
327 OriginalPrice *int64 `json:"original_price,omitempty"`
328 ComboPackageList []ComboPackage `json:"combo_package_list,omitempty"`
329}
330
331type ProductCouponState string
332
333func (e ProductCouponState) Ptr() *ProductCouponState {
334 return &e
335}
336
337const (
338 PRODUCTCOUPONSTATE_AUDITING ProductCouponState = "AUDITING"
339 PRODUCTCOUPONSTATE_EFFECTIVE ProductCouponState = "EFFECTIVE"
340 PRODUCTCOUPONSTATE_DEACTIVATED ProductCouponState = "DEACTIVATED"
341)
342
343type StockEntity struct {
344 ProductCouponId *string `json:"product_coupon_id,omitempty"`
345 StockId *string `json:"stock_id,omitempty"`
346 Remark *string `json:"remark,omitempty"`
347 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
348 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
349 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
350 SingleUsageRule *SingleUsageRule `json:"single_usage_rule,omitempty"`
351 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
352 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
353 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
354 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
355 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
356 State *StockState `json:"state,omitempty"`
357 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
358 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
359 DeactivateReason *string `json:"deactivate_reason,omitempty"`
360}
361
362type StockBundleEntity struct {
363 StockBundleId *string `json:"stock_bundle_id,omitempty"`
364 StockList []StockEntityInBundle `json:"stock_list,omitempty"`
365}
366
367type NormalCouponUsageRule struct {
368 Threshold *int64 `json:"threshold,omitempty"`
369 DiscountAmount *int64 `json:"discount_amount,omitempty"`
370}
371
372type DiscountCouponUsageRule struct {
373 Threshold *int64 `json:"threshold,omitempty"`
374 PercentOff *int64 `json:"percent_off,omitempty"`
375}
376
377type ComboPackage struct {
378 Name *string `json:"name,omitempty"`
379 PickCount *int64 `json:"pick_count,omitempty"`
380 ChoiceList []ComboPackageChoice `json:"choice_list,omitempty"`
381}
382
383type CouponCodeMode string
384
385func (e CouponCodeMode) Ptr() *CouponCodeMode {
386 return &e
387}
388
389const (
390 COUPONCODEMODE_WECHATPAY CouponCodeMode = "WECHATPAY"
391 COUPONCODEMODE_UPLOAD CouponCodeMode = "UPLOAD"
392 COUPONCODEMODE_API_ASSIGN CouponCodeMode = "API_ASSIGN"
393)
394
395type StockSendRule struct {
396 MaxCount *int64 `json:"max_count,omitempty"`
397 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
398 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
399}
400
401type SingleUsageRule struct {
402 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
403 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
404 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
405 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
406}
407
408type UsageRuleDisplayInfo struct {
409 CouponUsageMethodList []CouponUsageMethod `json:"coupon_usage_method_list,omitempty"`
410 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
411 MiniProgramPath *string `json:"mini_program_path,omitempty"`
412 AppPath *string `json:"app_path,omitempty"`
413 UsageDescription *string `json:"usage_description,omitempty"`
414 CouponAvailableStoreInfo *CouponAvailableStoreInfo `json:"coupon_available_store_info,omitempty"`
415 AppJumpType *AppJumpType `json:"app_jump_type,omitempty"`
416 PasscodeLink *string `json:"passcode_link,omitempty"`
417}
418
419type CouponDisplayInfo struct {
420 CodeDisplayMode *CouponCodeDisplayMode `json:"code_display_mode,omitempty"`
421 BackgroundColor *string `json:"background_color,omitempty"`
422 EntranceMiniProgram *EntranceMiniProgram `json:"entrance_mini_program,omitempty"`
423 EntranceOfficialAccount *EntranceOfficialAccount `json:"entrance_official_account,omitempty"`
424}
425
426type NotifyConfig struct {
427 NotifyAppid *string `json:"notify_appid,omitempty"`
428}
429
430type StockStoreScope string
431
432func (e StockStoreScope) Ptr() *StockStoreScope {
433 return &e
434}
435
436const (
437 STOCKSTORESCOPE_NONE StockStoreScope = "NONE"
438 STOCKSTORESCOPE_ALL StockStoreScope = "ALL"
439 STOCKSTORESCOPE_SPECIFIC StockStoreScope = "SPECIFIC"
440)
441
442type StockSendRuleForBundle struct {
443 MaxCount *int64 `json:"max_count,omitempty"`
444 MaxCountPerDay *int64 `json:"max_count_per_day,omitempty"`
445 MaxCountPerUser *int64 `json:"max_count_per_user,omitempty"`
446}
447
448type StockBundleUsageRule struct {
449 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
450 NormalCouponList []NormalCouponUsageRule `json:"normal_coupon_list,omitempty"`
451 DiscountCouponList []DiscountCouponUsageRule `json:"discount_coupon_list,omitempty"`
452 ExchangeCouponList []ExchangeCouponUsageRule `json:"exchange_coupon_list,omitempty"`
453}
454
455type CouponCodeCountInfo struct {
456 TotalCount *int64 `json:"total_count,omitempty"`
457 AvailableCount *int64 `json:"available_count,omitempty"`
458}
459
460type StockSentCountInfo struct {
461 TotalCount *int64 `json:"total_count,omitempty"`
462 TodayCount *int64 `json:"today_count,omitempty"`
463}
464
465type StockState string
466
467func (e StockState) Ptr() *StockState {
468 return &e
469}
470
471const (
472 STOCKSTATE_AUDITING StockState = "AUDITING"
473 STOCKSTATE_SENDING StockState = "SENDING"
474 STOCKSTATE_PAUSED StockState = "PAUSED"
475 STOCKSTATE_STOPPED StockState = "STOPPED"
476 STOCKSTATE_DEACTIVATED StockState = "DEACTIVATED"
477)
478
479type StockEntityInBundle struct {
480 ProductCouponId *string `json:"product_coupon_id,omitempty"`
481 StockId *string `json:"stock_id,omitempty"`
482 Remark *string `json:"remark,omitempty"`
483 CouponCodeMode *CouponCodeMode `json:"coupon_code_mode,omitempty"`
484 CouponCodeCountInfo *CouponCodeCountInfo `json:"coupon_code_count_info,omitempty"`
485 StockSendRule *StockSendRule `json:"stock_send_rule,omitempty"`
486 ProgressiveBundleUsageRule *StockUsageRule `json:"progressive_bundle_usage_rule,omitempty"`
487 StockBundleInfo *StockBundleInfo `json:"stock_bundle_info,omitempty"`
488 UsageRuleDisplayInfo *UsageRuleDisplayInfo `json:"usage_rule_display_info,omitempty"`
489 CouponDisplayInfo *CouponDisplayInfo `json:"coupon_display_info,omitempty"`
490 NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
491 StoreScope *StockStoreScope `json:"store_scope,omitempty"`
492 SentCountInfo *StockSentCountInfo `json:"sent_count_info,omitempty"`
493 State *StockState `json:"state,omitempty"`
494 DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
495 DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
496 DeactivateReason *string `json:"deactivate_reason,omitempty"`
497}
498
499type ComboPackageChoice struct {
500 Name *string `json:"name,omitempty"`
501 Price *int64 `json:"price,omitempty"`
502 Count *int64 `json:"count,omitempty"`
503 ImageUrl *string `json:"image_url,omitempty"`
504 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
505 MiniProgramPath *string `json:"mini_program_path,omitempty"`
506}
507
508type CouponAvailablePeriod struct {
509 AvailableBeginTime *string `json:"available_begin_time,omitempty"`
510 AvailableEndTime *string `json:"available_end_time,omitempty"`
511 AvailableDays *int64 `json:"available_days,omitempty"`
512 WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
513 WeeklyAvailablePeriod *FixedWeekPeriod `json:"weekly_available_period,omitempty"`
514 IrregularAvailablePeriodList []TimePeriod `json:"irregular_available_period_list,omitempty"`
515 AvailableSeconds *int64 `json:"available_seconds,omitempty"`
516}
517
518type ExchangeCouponUsageRule struct {
519 Threshold *int64 `json:"threshold,omitempty"`
520 ExchangePrice *int64 `json:"exchange_price,omitempty"`
521}
522
523type CouponUsageMethod string
524
525func (e CouponUsageMethod) Ptr() *CouponUsageMethod {
526 return &e
527}
528
529const (
530 COUPONUSAGEMETHOD_OFFLINE CouponUsageMethod = "OFFLINE"
531 COUPONUSAGEMETHOD_MINI_PROGRAM CouponUsageMethod = "MINI_PROGRAM"
532 COUPONUSAGEMETHOD_APP CouponUsageMethod = "APP"
533 COUPONUSAGEMETHOD_PAYMENT_CODE CouponUsageMethod = "PAYMENT_CODE"
534)
535
536type CouponAvailableStoreInfo struct {
537 Description *string `json:"description,omitempty"`
538 MiniProgramAppid *string `json:"mini_program_appid,omitempty"`
539 MiniProgramPath *string `json:"mini_program_path,omitempty"`
540}
541
542type AppJumpType string
543
544func (e AppJumpType) Ptr() *AppJumpType {
545 return &e
546}
547
548const (
549 APPJUMPTYPE_H5 AppJumpType = "H5"
550 APPJUMPTYPE_PASSCODE_LINK AppJumpType = "PASSCODE_LINK"
551 APPJUMPTYPE_USAGE_GUIDE AppJumpType = "USAGE_GUIDE"
552)
553
554type CouponCodeDisplayMode string
555
556func (e CouponCodeDisplayMode) Ptr() *CouponCodeDisplayMode {
557 return &e
558}
559
560const (
561 COUPONCODEDISPLAYMODE_INVISIBLE CouponCodeDisplayMode = "INVISIBLE"
562 COUPONCODEDISPLAYMODE_BARCODE CouponCodeDisplayMode = "BARCODE"
563 COUPONCODEDISPLAYMODE_QRCODE CouponCodeDisplayMode = "QRCODE"
564)
565
566type EntranceMiniProgram struct {
567 Appid *string `json:"appid,omitempty"`
568 Path *string `json:"path,omitempty"`
569 EntranceWording *string `json:"entrance_wording,omitempty"`
570 GuidanceWording *string `json:"guidance_wording,omitempty"`
571}
572
573type EntranceOfficialAccount struct {
574 Appid *string `json:"appid,omitempty"`
575}
576
577type StockUsageRule struct {
578 CouponAvailablePeriod *CouponAvailablePeriod `json:"coupon_available_period,omitempty"`
579 NormalCoupon *NormalCouponUsageRule `json:"normal_coupon,omitempty"`
580 DiscountCoupon *DiscountCouponUsageRule `json:"discount_coupon,omitempty"`
581 ExchangeCoupon *ExchangeCouponUsageRule `json:"exchange_coupon,omitempty"`
582}
583
584type StockBundleInfo struct {
585 StockBundleId *string `json:"stock_bundle_id,omitempty"`
586 StockBundleIndex *int64 `json:"stock_bundle_index,omitempty"`
587}
588
589type FixedWeekPeriod struct {
590 DayList []WeekEnum `json:"day_list,omitempty"`
591 DayPeriodList []PeriodOfTheDay `json:"day_period_list,omitempty"`
592}
593
594type TimePeriod struct {
595 BeginTime *string `json:"begin_time,omitempty"`
596 EndTime *string `json:"end_time,omitempty"`
597}
598
599type WeekEnum string
600
601func (e WeekEnum) Ptr() *WeekEnum {
602 return &e
603}
604
605const (
606 WEEKENUM_MONDAY WeekEnum = "MONDAY"
607 WEEKENUM_TUESDAY WeekEnum = "TUESDAY"
608 WEEKENUM_WEDNESDAY WeekEnum = "WEDNESDAY"
609 WEEKENUM_THURSDAY WeekEnum = "THURSDAY"
610 WEEKENUM_FRIDAY WeekEnum = "FRIDAY"
611 WEEKENUM_SATURDAY WeekEnum = "SATURDAY"
612 WEEKENUM_SUNDAY WeekEnum = "SUNDAY"
613)
614
615type PeriodOfTheDay struct {
616 BeginTime *int64 `json:"begin_time,omitempty"`
617 EndTime *int64 `json:"end_time,omitempty"`
618}