-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy pathmodels.go
1413 lines (1144 loc) · 34.8 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2021 Tencent Inc. All rights reserved.
//
// 公共出行平台代扣服务对外API
//
// 公共出行平台代扣服务对外API
//
// API version: 1.0.0
// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
package weixinpayscanandride
import (
"encoding/json"
"fmt"
)
// BlockReasonEnum
type BlockReasonEnum string
func (e BlockReasonEnum) Ptr() *BlockReasonEnum {
return &e
}
// Enums of BlockReasonEnum
const (
BLOCKREASONENUM_DELETED BlockReasonEnum = "DELETED"
BLOCKREASONENUM_ACCOUNT_FROZEN BlockReasonEnum = "ACCOUNT_FROZEN"
BLOCKREASONENUM_OVERDUE BlockReasonEnum = "OVERDUE"
)
// BusSceneInfo
type BusSceneInfo struct {
// 用户乘车时间(上车),按照使用rfc3339所定义的格式,格式为yyyy-MM-DDThh:mm:ss+TIMEZONE
StartTime *string `json:"start_time"`
// 乘车路线 路线名称的展示规则:\\^[A-Za-z0-9]{1,10}路$ 如line_name符合上述的规则,扣款凭证将增加展示乘车路线的字段
LineName *string `json:"line_name,omitempty"`
// 车牌号。仅包括省份+车牌,不包括特殊字符。
PlateNumber *string `json:"plate_number,omitempty"`
}
func (o BusSceneInfo) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.StartTime == nil {
return nil, fmt.Errorf("field `StartTime` is required and must be specified in BusSceneInfo")
}
toSerialize["start_time"] = o.StartTime
if o.LineName != nil {
toSerialize["line_name"] = o.LineName
}
if o.PlateNumber != nil {
toSerialize["plate_number"] = o.PlateNumber
}
return json.Marshal(toSerialize)
}
func (o BusSceneInfo) String() string {
var ret string
if o.StartTime == nil {
ret += "StartTime:<nil>, "
} else {
ret += fmt.Sprintf("StartTime:%v, ", *o.StartTime)
}
if o.LineName == nil {
ret += "LineName:<nil>, "
} else {
ret += fmt.Sprintf("LineName:%v, ", *o.LineName)
}
if o.PlateNumber == nil {
ret += "PlateNumber:<nil>"
} else {
ret += fmt.Sprintf("PlateNumber:%v", *o.PlateNumber)
}
return fmt.Sprintf("BusSceneInfo{%s}", ret)
}
func (o BusSceneInfo) Clone() *BusSceneInfo {
ret := BusSceneInfo{}
if o.StartTime != nil {
ret.StartTime = new(string)
*ret.StartTime = *o.StartTime
}
if o.LineName != nil {
ret.LineName = new(string)
*ret.LineName = *o.LineName
}
if o.PlateNumber != nil {
ret.PlateNumber = new(string)
*ret.PlateNumber = *o.PlateNumber
}
return &ret
}
// CreateTransactionRequest
type CreateTransactionRequest struct {
// 商户在微信申请公众号或移动应用成功后分配的账号ID,登录平台为mp.weixin.qq.com或open.weixin.qq.com
Appid *string `json:"appid"`
// 子公众账号ID,服务商模式下选传,用于扣费信息的商户信息展示,
SubAppid *string `json:"sub_appid,omitempty"`
// 微信支付分配的子商户号,服务商模式下必传
SubMchid *string `json:"sub_mchid,omitempty"`
// 商户自定义字段,用于交易账单中对扣费服务的描述。该字段长度限制为字节长度限制
Description *string `json:"description"`
// 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用,该字段长度限制为字节长度限制
Attach *string `json:"attach,omitempty"`
// 商户系统内部订单号,只能是数字、大小写字母,且在同一个商户号下唯一。该字段长度限制为字节长度限制
OutTradeNo *string `json:"out_trade_no"`
// 交易场景值,现在支持公交和地铁的场景值
TradeScene *TradeScene `json:"trade_scene"`
// 代金券或立减优惠功能的参数,说明详见代金券或立减优惠
GoodsTag *string `json:"goods_tag,omitempty"`
// 签约成功后,微信返回代扣签约ID 查用户是否能继续使用乘车卡时必传,此时,才会返回签约信息,如contract_state
ContractId *string `json:"contract_id"`
// 接受扣款结果异步回调通知的URL,注意回调URL只接受HTTPS
NotifyUrl *string `json:"notify_url"`
// 订单金额信息
Amount *OrderAmount `json:"amount"`
// 请求受理扣费 tradescene为BUS时,传入该参数
BusInfo *BusSceneInfo `json:"bus_info,omitempty"`
// 请求受理扣费 tradescene为METRO时,传入该参数
MetroInfo *MetroSceneInfo `json:"metro_info,omitempty"`
}
func (o CreateTransactionRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Appid == nil {
return nil, fmt.Errorf("field `Appid` is required and must be specified in CreateTransactionRequest")
}
toSerialize["appid"] = o.Appid
if o.SubAppid != nil {
toSerialize["sub_appid"] = o.SubAppid
}
if o.SubMchid != nil {
toSerialize["sub_mchid"] = o.SubMchid
}
if o.Description == nil {
return nil, fmt.Errorf("field `Description` is required and must be specified in CreateTransactionRequest")
}
toSerialize["description"] = o.Description
if o.Attach != nil {
toSerialize["attach"] = o.Attach
}
if o.OutTradeNo == nil {
return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in CreateTransactionRequest")
}
toSerialize["out_trade_no"] = o.OutTradeNo
if o.TradeScene == nil {
return nil, fmt.Errorf("field `TradeScene` is required and must be specified in CreateTransactionRequest")
}
toSerialize["trade_scene"] = o.TradeScene
if o.GoodsTag != nil {
toSerialize["goods_tag"] = o.GoodsTag
}
if o.ContractId == nil {
return nil, fmt.Errorf("field `ContractId` is required and must be specified in CreateTransactionRequest")
}
toSerialize["contract_id"] = o.ContractId
if o.NotifyUrl == nil {
return nil, fmt.Errorf("field `NotifyUrl` is required and must be specified in CreateTransactionRequest")
}
toSerialize["notify_url"] = o.NotifyUrl
if o.Amount == nil {
return nil, fmt.Errorf("field `Amount` is required and must be specified in CreateTransactionRequest")
}
toSerialize["amount"] = o.Amount
if o.BusInfo != nil {
toSerialize["bus_info"] = o.BusInfo
}
if o.MetroInfo != nil {
toSerialize["metro_info"] = o.MetroInfo
}
return json.Marshal(toSerialize)
}
func (o CreateTransactionRequest) String() string {
var ret string
if o.Appid == nil {
ret += "Appid:<nil>, "
} else {
ret += fmt.Sprintf("Appid:%v, ", *o.Appid)
}
if o.SubAppid == nil {
ret += "SubAppid:<nil>, "
} else {
ret += fmt.Sprintf("SubAppid:%v, ", *o.SubAppid)
}
if o.SubMchid == nil {
ret += "SubMchid:<nil>, "
} else {
ret += fmt.Sprintf("SubMchid:%v, ", *o.SubMchid)
}
if o.Description == nil {
ret += "Description:<nil>, "
} else {
ret += fmt.Sprintf("Description:%v, ", *o.Description)
}
if o.Attach == nil {
ret += "Attach:<nil>, "
} else {
ret += fmt.Sprintf("Attach:%v, ", *o.Attach)
}
if o.OutTradeNo == nil {
ret += "OutTradeNo:<nil>, "
} else {
ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
}
if o.TradeScene == nil {
ret += "TradeScene:<nil>, "
} else {
ret += fmt.Sprintf("TradeScene:%v, ", *o.TradeScene)
}
if o.GoodsTag == nil {
ret += "GoodsTag:<nil>, "
} else {
ret += fmt.Sprintf("GoodsTag:%v, ", *o.GoodsTag)
}
if o.ContractId == nil {
ret += "ContractId:<nil>, "
} else {
ret += fmt.Sprintf("ContractId:%v, ", *o.ContractId)
}
if o.NotifyUrl == nil {
ret += "NotifyUrl:<nil>, "
} else {
ret += fmt.Sprintf("NotifyUrl:%v, ", *o.NotifyUrl)
}
ret += fmt.Sprintf("Amount:%v, ", o.Amount)
ret += fmt.Sprintf("BusInfo:%v, ", o.BusInfo)
ret += fmt.Sprintf("MetroInfo:%v", o.MetroInfo)
return fmt.Sprintf("CreateTransactionRequest{%s}", ret)
}
func (o CreateTransactionRequest) Clone() *CreateTransactionRequest {
ret := CreateTransactionRequest{}
if o.Appid != nil {
ret.Appid = new(string)
*ret.Appid = *o.Appid
}
if o.SubAppid != nil {
ret.SubAppid = new(string)
*ret.SubAppid = *o.SubAppid
}
if o.SubMchid != nil {
ret.SubMchid = new(string)
*ret.SubMchid = *o.SubMchid
}
if o.Description != nil {
ret.Description = new(string)
*ret.Description = *o.Description
}
if o.Attach != nil {
ret.Attach = new(string)
*ret.Attach = *o.Attach
}
if o.OutTradeNo != nil {
ret.OutTradeNo = new(string)
*ret.OutTradeNo = *o.OutTradeNo
}
if o.TradeScene != nil {
ret.TradeScene = new(TradeScene)
*ret.TradeScene = *o.TradeScene
}
if o.GoodsTag != nil {
ret.GoodsTag = new(string)
*ret.GoodsTag = *o.GoodsTag
}
if o.ContractId != nil {
ret.ContractId = new(string)
*ret.ContractId = *o.ContractId
}
if o.NotifyUrl != nil {
ret.NotifyUrl = new(string)
*ret.NotifyUrl = *o.NotifyUrl
}
if o.Amount != nil {
ret.Amount = o.Amount.Clone()
}
if o.BusInfo != nil {
ret.BusInfo = o.BusInfo.Clone()
}
if o.MetroInfo != nil {
ret.MetroInfo = o.MetroInfo.Clone()
}
return &ret
}
// MetroSceneInfo
type MetroSceneInfo struct {
// 用户乘车时间(上车),按照使用rfc3339所定义的格式,格式为yyyy-MM-DDThh:mm:ss+TIMEZONE
StartTime *string `json:"start_time"`
// 用户下车时间,按照使用rfc3339所定义的格式,格式为yyyy-MM-DDThh:mm:ss+TIMEZONE
EndTime *string `json:"end_time,omitempty"`
// 乘车起始站,该值催缴时会向微信用户进行展示
StartStation *string `json:"start_station,omitempty"`
// 乘车终点站,该值催缴时会向微信用户进行展示
EndStation *string `json:"end_station,omitempty"`
}
func (o MetroSceneInfo) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.StartTime == nil {
return nil, fmt.Errorf("field `StartTime` is required and must be specified in MetroSceneInfo")
}
toSerialize["start_time"] = o.StartTime
if o.EndTime != nil {
toSerialize["end_time"] = o.EndTime
}
if o.StartStation != nil {
toSerialize["start_station"] = o.StartStation
}
if o.EndStation != nil {
toSerialize["end_station"] = o.EndStation
}
return json.Marshal(toSerialize)
}
func (o MetroSceneInfo) String() string {
var ret string
if o.StartTime == nil {
ret += "StartTime:<nil>, "
} else {
ret += fmt.Sprintf("StartTime:%v, ", *o.StartTime)
}
if o.EndTime == nil {
ret += "EndTime:<nil>, "
} else {
ret += fmt.Sprintf("EndTime:%v, ", *o.EndTime)
}
if o.StartStation == nil {
ret += "StartStation:<nil>, "
} else {
ret += fmt.Sprintf("StartStation:%v, ", *o.StartStation)
}
if o.EndStation == nil {
ret += "EndStation:<nil>"
} else {
ret += fmt.Sprintf("EndStation:%v", *o.EndStation)
}
return fmt.Sprintf("MetroSceneInfo{%s}", ret)
}
func (o MetroSceneInfo) Clone() *MetroSceneInfo {
ret := MetroSceneInfo{}
if o.StartTime != nil {
ret.StartTime = new(string)
*ret.StartTime = *o.StartTime
}
if o.EndTime != nil {
ret.EndTime = new(string)
*ret.EndTime = *o.EndTime
}
if o.StartStation != nil {
ret.StartStation = new(string)
*ret.StartStation = *o.StartStation
}
if o.EndStation != nil {
ret.EndStation = new(string)
*ret.EndStation = *o.EndStation
}
return &ret
}
// OrderAmount
type OrderAmount struct {
// 订单总金额,单位为分,只能为整数,详见支付金额
Total *int64 `json:"total"`
// 符合ISO 4217标准的三位字母代码,目前只支持人民币:CNY
Currency *string `json:"currency,omitempty"`
}
func (o OrderAmount) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Total == nil {
return nil, fmt.Errorf("field `Total` is required and must be specified in OrderAmount")
}
toSerialize["total"] = o.Total
if o.Currency != nil {
toSerialize["currency"] = o.Currency
}
return json.Marshal(toSerialize)
}
func (o OrderAmount) String() string {
var ret string
if o.Total == nil {
ret += "Total:<nil>, "
} else {
ret += fmt.Sprintf("Total:%v, ", *o.Total)
}
if o.Currency == nil {
ret += "Currency:<nil>"
} else {
ret += fmt.Sprintf("Currency:%v", *o.Currency)
}
return fmt.Sprintf("OrderAmount{%s}", ret)
}
func (o OrderAmount) Clone() *OrderAmount {
ret := OrderAmount{}
if o.Total != nil {
ret.Total = new(int64)
*ret.Total = *o.Total
}
if o.Currency != nil {
ret.Currency = new(string)
*ret.Currency = *o.Currency
}
return &ret
}
// PromotionDetail
type PromotionDetail struct {
// 券或者立减优惠ID
CouponId *string `json:"coupon_id"`
// 优惠名称
Name *string `json:"name,omitempty"`
// GLOBAL-全场代金券,SINGLE-单品优惠
Scope *string `json:"scope,omitempty"`
// 优惠类型,枚举值有:
Type *PromotionType `json:"type,omitempty"`
// 在微信商户后台配置的批次ID
StockId *string `json:"stock_id,omitempty"`
// 用户享受优惠的金额
Amount *int64 `json:"amount"`
// 特指由微信支付商户平台创建的优惠,出资金额等于本项优惠总金额,单位为分
WechatpayContribute *int64 `json:"wechatpay_contribute,omitempty"`
// 特指商户自己创建的优惠,出资金额等于本项优惠总金额,单位为分
MerchantContribute *int64 `json:"merchant_contribute,omitempty"`
// 其他出资方出资金额,单位为分
OtherContribute *int64 `json:"other_contribute,omitempty"`
// CNY:人民币,境内商户号仅支持人民币。
Currency *string `json:"currency,omitempty"`
}
func (o PromotionDetail) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.CouponId == nil {
return nil, fmt.Errorf("field `CouponId` is required and must be specified in PromotionDetail")
}
toSerialize["coupon_id"] = o.CouponId
if o.Name != nil {
toSerialize["name"] = o.Name
}
if o.Scope != nil {
toSerialize["scope"] = o.Scope
}
if o.Type != nil {
toSerialize["type"] = o.Type
}
if o.StockId != nil {
toSerialize["stock_id"] = o.StockId
}
if o.Amount == nil {
return nil, fmt.Errorf("field `Amount` is required and must be specified in PromotionDetail")
}
toSerialize["amount"] = o.Amount
if o.WechatpayContribute != nil {
toSerialize["wechatpay_contribute"] = o.WechatpayContribute
}
if o.MerchantContribute != nil {
toSerialize["merchant_contribute"] = o.MerchantContribute
}
if o.OtherContribute != nil {
toSerialize["other_contribute"] = o.OtherContribute
}
if o.Currency != nil {
toSerialize["currency"] = o.Currency
}
return json.Marshal(toSerialize)
}
func (o PromotionDetail) String() string {
var ret string
if o.CouponId == nil {
ret += "CouponId:<nil>, "
} else {
ret += fmt.Sprintf("CouponId:%v, ", *o.CouponId)
}
if o.Name == nil {
ret += "Name:<nil>, "
} else {
ret += fmt.Sprintf("Name:%v, ", *o.Name)
}
if o.Scope == nil {
ret += "Scope:<nil>, "
} else {
ret += fmt.Sprintf("Scope:%v, ", *o.Scope)
}
if o.Type == nil {
ret += "Type:<nil>, "
} else {
ret += fmt.Sprintf("Type:%v, ", *o.Type)
}
if o.StockId == nil {
ret += "StockId:<nil>, "
} else {
ret += fmt.Sprintf("StockId:%v, ", *o.StockId)
}
if o.Amount == nil {
ret += "Amount:<nil>, "
} else {
ret += fmt.Sprintf("Amount:%v, ", *o.Amount)
}
if o.WechatpayContribute == nil {
ret += "WechatpayContribute:<nil>, "
} else {
ret += fmt.Sprintf("WechatpayContribute:%v, ", *o.WechatpayContribute)
}
if o.MerchantContribute == nil {
ret += "MerchantContribute:<nil>, "
} else {
ret += fmt.Sprintf("MerchantContribute:%v, ", *o.MerchantContribute)
}
if o.OtherContribute == nil {
ret += "OtherContribute:<nil>, "
} else {
ret += fmt.Sprintf("OtherContribute:%v, ", *o.OtherContribute)
}
if o.Currency == nil {
ret += "Currency:<nil>"
} else {
ret += fmt.Sprintf("Currency:%v", *o.Currency)
}
return fmt.Sprintf("PromotionDetail{%s}", ret)
}
func (o PromotionDetail) Clone() *PromotionDetail {
ret := PromotionDetail{}
if o.CouponId != nil {
ret.CouponId = new(string)
*ret.CouponId = *o.CouponId
}
if o.Name != nil {
ret.Name = new(string)
*ret.Name = *o.Name
}
if o.Scope != nil {
ret.Scope = new(string)
*ret.Scope = *o.Scope
}
if o.Type != nil {
ret.Type = new(PromotionType)
*ret.Type = *o.Type
}
if o.StockId != nil {
ret.StockId = new(string)
*ret.StockId = *o.StockId
}
if o.Amount != nil {
ret.Amount = new(int64)
*ret.Amount = *o.Amount
}
if o.WechatpayContribute != nil {
ret.WechatpayContribute = new(int64)
*ret.WechatpayContribute = *o.WechatpayContribute
}
if o.MerchantContribute != nil {
ret.MerchantContribute = new(int64)
*ret.MerchantContribute = *o.MerchantContribute
}
if o.OtherContribute != nil {
ret.OtherContribute = new(int64)
*ret.OtherContribute = *o.OtherContribute
}
if o.Currency != nil {
ret.Currency = new(string)
*ret.Currency = *o.Currency
}
return &ret
}
// PromotionType
type PromotionType string
func (e PromotionType) Ptr() *PromotionType {
return &e
}
// Enums of PromotionType
const (
PROMOTIONTYPE_CASH PromotionType = "CASH"
PROMOTIONTYPE_NOCASH PromotionType = "NOCASH"
)
// QueryOrderAmount
type QueryOrderAmount struct {
// 订单总金额,单位为分,只能为整数,详见支付金额
Total *int64 `json:"total,omitempty"`
// 用户实际支付金额,单位为分,只能为整数,详见支付金额
PayerTotal *int64 `json:"payer_total,omitempty"`
// CNY:人民币,境内商户号仅支持人民币。
Currency *string `json:"currency,omitempty"`
}
func (o QueryOrderAmount) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Total != nil {
toSerialize["total"] = o.Total
}
if o.PayerTotal != nil {
toSerialize["payer_total"] = o.PayerTotal
}
if o.Currency != nil {
toSerialize["currency"] = o.Currency
}
return json.Marshal(toSerialize)
}
func (o QueryOrderAmount) String() string {
var ret string
if o.Total == nil {
ret += "Total:<nil>, "
} else {
ret += fmt.Sprintf("Total:%v, ", *o.Total)
}
if o.PayerTotal == nil {
ret += "PayerTotal:<nil>, "
} else {
ret += fmt.Sprintf("PayerTotal:%v, ", *o.PayerTotal)
}
if o.Currency == nil {
ret += "Currency:<nil>"
} else {
ret += fmt.Sprintf("Currency:%v", *o.Currency)
}
return fmt.Sprintf("QueryOrderAmount{%s}", ret)
}
func (o QueryOrderAmount) Clone() *QueryOrderAmount {
ret := QueryOrderAmount{}
if o.Total != nil {
ret.Total = new(int64)
*ret.Total = *o.Total
}
if o.PayerTotal != nil {
ret.PayerTotal = new(int64)
*ret.PayerTotal = *o.PayerTotal
}
if o.Currency != nil {
ret.Currency = new(string)
*ret.Currency = *o.Currency
}
return &ret
}
// QueryTransactionRequest
type QueryTransactionRequest struct {
// 商户系统内部订单号,只能是数字、大小写字母,且在同一个商户号下唯一。该字段长度限制为字节长度限制
OutTradeNo *string `json:"out_trade_no"`
// 微信支付分配的子商户号,服务商模式下必传
SubMchid *string `json:"sub_mchid,omitempty"`
}
func (o QueryTransactionRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.OutTradeNo == nil {
return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in QueryTransactionRequest")
}
toSerialize["out_trade_no"] = o.OutTradeNo
if o.SubMchid != nil {
toSerialize["sub_mchid"] = o.SubMchid
}
return json.Marshal(toSerialize)
}
func (o QueryTransactionRequest) String() string {
var ret string
if o.OutTradeNo == nil {
ret += "OutTradeNo:<nil>, "
} else {
ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
}
if o.SubMchid == nil {
ret += "SubMchid:<nil>"
} else {
ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
}
return fmt.Sprintf("QueryTransactionRequest{%s}", ret)
}
func (o QueryTransactionRequest) Clone() *QueryTransactionRequest {
ret := QueryTransactionRequest{}
if o.OutTradeNo != nil {
ret.OutTradeNo = new(string)
*ret.OutTradeNo = *o.OutTradeNo
}
if o.SubMchid != nil {
ret.SubMchid = new(string)
*ret.SubMchid = *o.SubMchid
}
return &ret
}
// QueryUserServiceRequest
type QueryUserServiceRequest struct {
// 商户在微信申请公众号或移动应用成功后分配的账号ID,登录平台为mp.weixin.qq.com或open.weixin.qq.com
Appid *string `json:"appid"`
// 子公众账号ID,服务商模式下选传
SubAppid *string `json:"sub_appid,omitempty"`
// 微信支付分配的子商户号,服务商模式下必传
SubMchid *string `json:"sub_mchid,omitempty"`
// 签约成功后,微信返回代扣签约ID 查用户是否能继续使用乘车卡时必传
ContractId *string `json:"contract_id"`
}
func (o QueryUserServiceRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Appid == nil {
return nil, fmt.Errorf("field `Appid` is required and must be specified in QueryUserServiceRequest")
}
toSerialize["appid"] = o.Appid
if o.SubAppid != nil {
toSerialize["sub_appid"] = o.SubAppid
}
if o.SubMchid != nil {
toSerialize["sub_mchid"] = o.SubMchid
}
if o.ContractId == nil {
return nil, fmt.Errorf("field `ContractId` is required and must be specified in QueryUserServiceRequest")
}
toSerialize["contract_id"] = o.ContractId
return json.Marshal(toSerialize)
}
func (o QueryUserServiceRequest) String() string {
var ret string
if o.Appid == nil {
ret += "Appid:<nil>, "
} else {
ret += fmt.Sprintf("Appid:%v, ", *o.Appid)
}
if o.SubAppid == nil {
ret += "SubAppid:<nil>, "
} else {
ret += fmt.Sprintf("SubAppid:%v, ", *o.SubAppid)
}
if o.SubMchid == nil {
ret += "SubMchid:<nil>, "
} else {
ret += fmt.Sprintf("SubMchid:%v, ", *o.SubMchid)
}
if o.ContractId == nil {
ret += "ContractId:<nil>"
} else {
ret += fmt.Sprintf("ContractId:%v", *o.ContractId)
}
return fmt.Sprintf("QueryUserServiceRequest{%s}", ret)
}
func (o QueryUserServiceRequest) Clone() *QueryUserServiceRequest {
ret := QueryUserServiceRequest{}
if o.Appid != nil {
ret.Appid = new(string)
*ret.Appid = *o.Appid
}
if o.SubAppid != nil {
ret.SubAppid = new(string)
*ret.SubAppid = *o.SubAppid
}
if o.SubMchid != nil {
ret.SubMchid = new(string)
*ret.SubMchid = *o.SubMchid
}
if o.ContractId != nil {
ret.ContractId = new(string)
*ret.ContractId = *o.ContractId
}
return &ret
}
// TradeScene
type TradeScene string
func (e TradeScene) Ptr() *TradeScene {
return &e
}
// Enums of TradeScene
const (
TRADESCENE_BUS TradeScene = "BUS"
TRADESCENE_METRO TradeScene = "METRO"
)
// TradeState
type TradeState string
func (e TradeState) Ptr() *TradeState {
return &e
}
// Enums of TradeState
const (
TRADESTATE_SUCCESS TradeState = "SUCCESS"
TRADESTATE_ACCEPTED TradeState = "ACCEPTED"
TRADESTATE_PAY_FAIL TradeState = "PAY_FAIL"
TRADESTATE_REFUND TradeState = "REFUND"
)
// TransactionsEntity
type TransactionsEntity struct {
// 商户在微信申请公众号或移动应用成功后分配的账号ID,登录平台为mp.weixin.qq.com或open.weixin.qq.com
Appid *string `json:"appid"`
// 子商户申请的公众号或移动应用AppID,需要在服务商的商户平台为子商户绑定
SubAppid *string `json:"sub_appid,omitempty"`
// 微信支付分配的商户号
SpMchid *string `json:"sp_mchid"`
// 微信支付分配的子商户号
SubMchid *string `json:"sub_mchid,omitempty"`
// 商户自定义字段,用于交易账单中对扣费服务的描述。
Description *string `json:"description"`
// 订单成功创建时返回,按照使用rfc3339所定义的格式,格式为yyyy-MM-DDThh:mm:ss+TIMEZONE
CreateTime *string `json:"create_time"`
// 商户系统内部订单号,只能是数字、大小写字母,且在同一个商户号下唯一
OutTradeNo *string `json:"out_trade_no"`
// 微信支付订单号
TransactionId *string `json:"transaction_id,omitempty"`
// 交易状态,枚举值:
TradeState *TradeState `json:"trade_state"`
// 对当前订单状态的描述和下一步操作的指引
TradeStateDescription *string `json:"trade_state_description,omitempty"`
// 订单支付完成时间,按照使用rfc3339所定义的格式,格式为yyyy-MM-DDThh:mm:ss+TIMEZONE
SuccessTime *string `json:"success_time,omitempty"`
// 银行类型,采用字符串类型的银行标识,详细可参考 微信支付银行类型标识(https://pay.weixin.qq.com/wiki/doc/apiv3/terms_definition/chapter1_1_3.shtml)。 特殊标识 BPA:该笔订单由微信进行垫付
BankType *string `json:"bank_type,omitempty"`
// 该字段标识对应的垫资单是否已还款或者已撤销。注意,使用此字段前需先确认bank_type字段值为BPA 以及 trade_state字段值为SUCCESS或者REFUND。枚举值如下:
UserRepayState *UserRepayState `json:"user_repay_state,omitempty"`
// 用户还款成功的微信支付订单号。用户已还款会返回该字段。
RepayTransactionId *string `json:"repay_transaction_id,omitempty"`
// 垫资还款时间,该笔订单发生过垫资,并且用户还款成功后,会返回该字段信息,按照使用rfc3339所定义的格式,格式为yyyy-MM-DDThh:mm:ss+TIMEZONE
RepayTime *string `json:"repay_time,omitempty"`
// 附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用
Attach *string `json:"attach,omitempty"`
// 签约成功后,微信返回的代扣签约ID
ContractId *string `json:"contract_id,omitempty"`
// 交易场景值,枚举值:
TradeScene *TradeScene `json:"trade_scene"`
// 返回信息中的trade_scene为BUS,返回该场景信息
BusInfo *BusSceneInfo `json:"bus_info,omitempty"`
// 返回信息中的trade_scene为METRO,返回该场景信息
MetroInfo *MetroSceneInfo `json:"metro_info,omitempty"`
// 订单金额信息
Amount *QueryOrderAmount `json:"amount"`
// 优惠信息
PromotionDetail []PromotionDetail `json:"promotion_detail,omitempty"`
}
func (o TransactionsEntity) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Appid == nil {
return nil, fmt.Errorf("field `Appid` is required and must be specified in TransactionsEntity")
}
toSerialize["appid"] = o.Appid
if o.SubAppid != nil {
toSerialize["sub_appid"] = o.SubAppid
}
if o.SpMchid == nil {
return nil, fmt.Errorf("field `SpMchid` is required and must be specified in TransactionsEntity")
}
toSerialize["sp_mchid"] = o.SpMchid
if o.SubMchid != nil {
toSerialize["sub_mchid"] = o.SubMchid
}
if o.Description == nil {
return nil, fmt.Errorf("field `Description` is required and must be specified in TransactionsEntity")