123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413 |
- // 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")
- }
- toSerialize["description"] = o.Description
- if o.CreateTime == nil {
- return nil, fmt.Errorf("field `CreateTime` is required and must be specified in TransactionsEntity")
- }
- toSerialize["create_time"] = o.CreateTime
- if o.OutTradeNo == nil {
- return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in TransactionsEntity")
- }
- toSerialize["out_trade_no"] = o.OutTradeNo
- if o.TransactionId != nil {
- toSerialize["transaction_id"] = o.TransactionId
- }
- if o.TradeState == nil {
- return nil, fmt.Errorf("field `TradeState` is required and must be specified in TransactionsEntity")
- }
- toSerialize["trade_state"] = o.TradeState
- if o.TradeStateDescription != nil {
- toSerialize["trade_state_description"] = o.TradeStateDescription
- }
- if o.SuccessTime != nil {
- toSerialize["success_time"] = o.SuccessTime
- }
- if o.BankType != nil {
- toSerialize["bank_type"] = o.BankType
- }
- if o.UserRepayState != nil {
- toSerialize["user_repay_state"] = o.UserRepayState
- }
- if o.RepayTransactionId != nil {
- toSerialize["repay_transaction_id"] = o.RepayTransactionId
- }
- if o.RepayTime != nil {
- toSerialize["repay_time"] = o.RepayTime
- }
- if o.Attach != nil {
- toSerialize["attach"] = o.Attach
- }
- if o.ContractId != nil {
- toSerialize["contract_id"] = o.ContractId
- }
- if o.TradeScene == nil {
- return nil, fmt.Errorf("field `TradeScene` is required and must be specified in TransactionsEntity")
- }
- toSerialize["trade_scene"] = o.TradeScene
- if o.BusInfo != nil {
- toSerialize["bus_info"] = o.BusInfo
- }
- if o.MetroInfo != nil {
- toSerialize["metro_info"] = o.MetroInfo
- }
- if o.Amount == nil {
- return nil, fmt.Errorf("field `Amount` is required and must be specified in TransactionsEntity")
- }
- toSerialize["amount"] = o.Amount
- if o.PromotionDetail != nil {
- toSerialize["promotion_detail"] = o.PromotionDetail
- }
- return json.Marshal(toSerialize)
- }
- func (o TransactionsEntity) 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.SpMchid == nil {
- ret += "SpMchid:<nil>, "
- } else {
- ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
- }
- 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.CreateTime == nil {
- ret += "CreateTime:<nil>, "
- } else {
- ret += fmt.Sprintf("CreateTime:%v, ", *o.CreateTime)
- }
- if o.OutTradeNo == nil {
- ret += "OutTradeNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
- }
- if o.TransactionId == nil {
- ret += "TransactionId:<nil>, "
- } else {
- ret += fmt.Sprintf("TransactionId:%v, ", *o.TransactionId)
- }
- if o.TradeState == nil {
- ret += "TradeState:<nil>, "
- } else {
- ret += fmt.Sprintf("TradeState:%v, ", *o.TradeState)
- }
- if o.TradeStateDescription == nil {
- ret += "TradeStateDescription:<nil>, "
- } else {
- ret += fmt.Sprintf("TradeStateDescription:%v, ", *o.TradeStateDescription)
- }
- if o.SuccessTime == nil {
- ret += "SuccessTime:<nil>, "
- } else {
- ret += fmt.Sprintf("SuccessTime:%v, ", *o.SuccessTime)
- }
- if o.BankType == nil {
- ret += "BankType:<nil>, "
- } else {
- ret += fmt.Sprintf("BankType:%v, ", *o.BankType)
- }
- if o.UserRepayState == nil {
- ret += "UserRepayState:<nil>, "
- } else {
- ret += fmt.Sprintf("UserRepayState:%v, ", *o.UserRepayState)
- }
- if o.RepayTransactionId == nil {
- ret += "RepayTransactionId:<nil>, "
- } else {
- ret += fmt.Sprintf("RepayTransactionId:%v, ", *o.RepayTransactionId)
- }
- if o.RepayTime == nil {
- ret += "RepayTime:<nil>, "
- } else {
- ret += fmt.Sprintf("RepayTime:%v, ", *o.RepayTime)
- }
- if o.Attach == nil {
- ret += "Attach:<nil>, "
- } else {
- ret += fmt.Sprintf("Attach:%v, ", *o.Attach)
- }
- if o.ContractId == nil {
- ret += "ContractId:<nil>, "
- } else {
- ret += fmt.Sprintf("ContractId:%v, ", *o.ContractId)
- }
- if o.TradeScene == nil {
- ret += "TradeScene:<nil>, "
- } else {
- ret += fmt.Sprintf("TradeScene:%v, ", *o.TradeScene)
- }
- ret += fmt.Sprintf("BusInfo:%v, ", o.BusInfo)
- ret += fmt.Sprintf("MetroInfo:%v, ", o.MetroInfo)
- ret += fmt.Sprintf("Amount:%v, ", o.Amount)
- ret += fmt.Sprintf("PromotionDetail:%v", o.PromotionDetail)
- return fmt.Sprintf("TransactionsEntity{%s}", ret)
- }
- func (o TransactionsEntity) Clone() *TransactionsEntity {
- ret := TransactionsEntity{}
- 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.SpMchid != nil {
- ret.SpMchid = new(string)
- *ret.SpMchid = *o.SpMchid
- }
- 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.CreateTime != nil {
- ret.CreateTime = new(string)
- *ret.CreateTime = *o.CreateTime
- }
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- if o.TransactionId != nil {
- ret.TransactionId = new(string)
- *ret.TransactionId = *o.TransactionId
- }
- if o.TradeState != nil {
- ret.TradeState = new(TradeState)
- *ret.TradeState = *o.TradeState
- }
- if o.TradeStateDescription != nil {
- ret.TradeStateDescription = new(string)
- *ret.TradeStateDescription = *o.TradeStateDescription
- }
- if o.SuccessTime != nil {
- ret.SuccessTime = new(string)
- *ret.SuccessTime = *o.SuccessTime
- }
- if o.BankType != nil {
- ret.BankType = new(string)
- *ret.BankType = *o.BankType
- }
- if o.UserRepayState != nil {
- ret.UserRepayState = new(UserRepayState)
- *ret.UserRepayState = *o.UserRepayState
- }
- if o.RepayTransactionId != nil {
- ret.RepayTransactionId = new(string)
- *ret.RepayTransactionId = *o.RepayTransactionId
- }
- if o.RepayTime != nil {
- ret.RepayTime = new(string)
- *ret.RepayTime = *o.RepayTime
- }
- if o.Attach != nil {
- ret.Attach = new(string)
- *ret.Attach = *o.Attach
- }
- if o.ContractId != nil {
- ret.ContractId = new(string)
- *ret.ContractId = *o.ContractId
- }
- if o.TradeScene != nil {
- ret.TradeScene = new(TradeScene)
- *ret.TradeScene = *o.TradeScene
- }
- if o.BusInfo != nil {
- ret.BusInfo = o.BusInfo.Clone()
- }
- if o.MetroInfo != nil {
- ret.MetroInfo = o.MetroInfo.Clone()
- }
- if o.Amount != nil {
- ret.Amount = o.Amount.Clone()
- }
- if o.PromotionDetail != nil {
- ret.PromotionDetail = make([]PromotionDetail, len(o.PromotionDetail))
- for i, item := range o.PromotionDetail {
- ret.PromotionDetail[i] = *item.Clone()
- }
- }
- return &ret
- }
- // UserRepayState
- type UserRepayState string
- func (e UserRepayState) Ptr() *UserRepayState {
- return &e
- }
- // Enums of UserRepayState
- const (
- USERREPAYSTATE_NOT_REPAY UserRepayState = "NOT_REPAY"
- USERREPAYSTATE_REPAID UserRepayState = "REPAID"
- USERREPAYSTATE_ALL_REFUND UserRepayState = "ALL_REFUND"
- )
- // UserServiceEntity
- type UserServiceEntity struct {
- // 签约成功后,微信返回代扣签约ID
- ContractId *string `json:"contract_id"`
- // 用户服务可用状态,枚举值有:
- UserServiceState *UserServiceStateEnum `json:"user_service_state"`
- // blocked服务状态描述,返回用户状态为BLOCKED,会返回该字段,具体描述的枚举值如下:
- BlockReason *BlockReasonEnum `json:"block_reason,omitempty"`
- }
- func (o UserServiceEntity) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.ContractId == nil {
- return nil, fmt.Errorf("field `ContractId` is required and must be specified in UserServiceEntity")
- }
- toSerialize["contract_id"] = o.ContractId
- if o.UserServiceState == nil {
- return nil, fmt.Errorf("field `UserServiceState` is required and must be specified in UserServiceEntity")
- }
- toSerialize["user_service_state"] = o.UserServiceState
- if o.BlockReason != nil {
- toSerialize["block_reason"] = o.BlockReason
- }
- return json.Marshal(toSerialize)
- }
- func (o UserServiceEntity) String() string {
- var ret string
- if o.ContractId == nil {
- ret += "ContractId:<nil>, "
- } else {
- ret += fmt.Sprintf("ContractId:%v, ", *o.ContractId)
- }
- if o.UserServiceState == nil {
- ret += "UserServiceState:<nil>, "
- } else {
- ret += fmt.Sprintf("UserServiceState:%v, ", *o.UserServiceState)
- }
- if o.BlockReason == nil {
- ret += "BlockReason:<nil>"
- } else {
- ret += fmt.Sprintf("BlockReason:%v", *o.BlockReason)
- }
- return fmt.Sprintf("UserServiceEntity{%s}", ret)
- }
- func (o UserServiceEntity) Clone() *UserServiceEntity {
- ret := UserServiceEntity{}
- if o.ContractId != nil {
- ret.ContractId = new(string)
- *ret.ContractId = *o.ContractId
- }
- if o.UserServiceState != nil {
- ret.UserServiceState = new(UserServiceStateEnum)
- *ret.UserServiceState = *o.UserServiceState
- }
- if o.BlockReason != nil {
- ret.BlockReason = new(BlockReasonEnum)
- *ret.BlockReason = *o.BlockReason
- }
- return &ret
- }
- // UserServiceStateEnum
- type UserServiceStateEnum string
- func (e UserServiceStateEnum) Ptr() *UserServiceStateEnum {
- return &e
- }
- // Enums of UserServiceStateEnum
- const (
- USERSERVICESTATEENUM_NORMAL UserServiceStateEnum = "NORMAL"
- USERSERVICESTATEENUM_BLOCKED UserServiceStateEnum = "BLOCKED"
- )
|