123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032 |
- // Copyright 2021 Tencent Inc. All rights reserved.
- //
- // H5支付
- //
- // H5支付API
- //
- // API version: 1.2.3
- // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
- package h5
- import (
- "encoding/json"
- "fmt"
- "time"
- )
- // Amount
- type Amount struct {
- // 订单总金额,单位为分
- Total *int64 `json:"total"`
- // CNY:人民币,境内商户号仅支持人民币。
- Currency *string `json:"currency,omitempty"`
- }
- func (o Amount) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Total == nil {
- return nil, fmt.Errorf("field `Total` is required and must be specified in Amount")
- }
- toSerialize["total"] = o.Total
- if o.Currency != nil {
- toSerialize["currency"] = o.Currency
- }
- return json.Marshal(toSerialize)
- }
- func (o Amount) 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("Amount{%s}", ret)
- }
- func (o Amount) Clone() *Amount {
- ret := Amount{}
- 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
- }
- // CloseOrderRequest
- type CloseOrderRequest struct {
- OutTradeNo *string `json:"out_trade_no"`
- // 直连商户号
- Mchid *string `json:"mchid"`
- }
- func (o CloseOrderRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.OutTradeNo == nil {
- return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in CloseOrderRequest")
- }
- toSerialize["out_trade_no"] = o.OutTradeNo
- if o.Mchid == nil {
- return nil, fmt.Errorf("field `Mchid` is required and must be specified in CloseOrderRequest")
- }
- toSerialize["mchid"] = o.Mchid
- return json.Marshal(toSerialize)
- }
- func (o CloseOrderRequest) String() string {
- var ret string
- if o.OutTradeNo == nil {
- ret += "OutTradeNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
- }
- if o.Mchid == nil {
- ret += "Mchid:<nil>"
- } else {
- ret += fmt.Sprintf("Mchid:%v", *o.Mchid)
- }
- return fmt.Sprintf("CloseOrderRequest{%s}", ret)
- }
- func (o CloseOrderRequest) Clone() *CloseOrderRequest {
- ret := CloseOrderRequest{}
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- if o.Mchid != nil {
- ret.Mchid = new(string)
- *ret.Mchid = *o.Mchid
- }
- return &ret
- }
- // CloseRequest
- type CloseRequest struct {
- // 直连商户号
- Mchid *string `json:"mchid"`
- }
- func (o CloseRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Mchid == nil {
- return nil, fmt.Errorf("field `Mchid` is required and must be specified in CloseRequest")
- }
- toSerialize["mchid"] = o.Mchid
- return json.Marshal(toSerialize)
- }
- func (o CloseRequest) String() string {
- var ret string
- if o.Mchid == nil {
- ret += "Mchid:<nil>"
- } else {
- ret += fmt.Sprintf("Mchid:%v", *o.Mchid)
- }
- return fmt.Sprintf("CloseRequest{%s}", ret)
- }
- func (o CloseRequest) Clone() *CloseRequest {
- ret := CloseRequest{}
- if o.Mchid != nil {
- ret.Mchid = new(string)
- *ret.Mchid = *o.Mchid
- }
- return &ret
- }
- // Detail 优惠功能
- type Detail struct {
- // 1.商户侧一张小票订单可能被分多次支付,订单原价用于记录整张小票的交易金额。 2.当订单原价与支付金额不相等,则不享受优惠。 3.该字段主要用于防止同一张小票分多次支付,以享受多次优惠的情况,正常支付订单不必上传此参数。
- CostPrice *int64 `json:"cost_price,omitempty"`
- // 商家小票ID。
- ReceiptId *string `json:"receipt_id,omitempty"`
- GoodsDetail []GoodsDetail `json:"goods_detail,omitempty"`
- }
- func (o Detail) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.CostPrice != nil {
- toSerialize["cost_price"] = o.CostPrice
- }
- if o.ReceiptId != nil {
- toSerialize["receipt_id"] = o.ReceiptId
- }
- if o.GoodsDetail != nil {
- toSerialize["goods_detail"] = o.GoodsDetail
- }
- return json.Marshal(toSerialize)
- }
- func (o Detail) String() string {
- var ret string
- if o.CostPrice == nil {
- ret += "CostPrice:<nil>, "
- } else {
- ret += fmt.Sprintf("CostPrice:%v, ", *o.CostPrice)
- }
- if o.ReceiptId == nil {
- ret += "InvoiceId:<nil>, "
- } else {
- ret += fmt.Sprintf("InvoiceId:%v, ", *o.ReceiptId)
- }
- ret += fmt.Sprintf("GoodsDetail:%v", o.GoodsDetail)
- return fmt.Sprintf("Detail{%s}", ret)
- }
- func (o Detail) Clone() *Detail {
- ret := Detail{}
- if o.CostPrice != nil {
- ret.CostPrice = new(int64)
- *ret.CostPrice = *o.CostPrice
- }
- if o.ReceiptId != nil {
- ret.ReceiptId = new(string)
- *ret.ReceiptId = *o.ReceiptId
- }
- if o.GoodsDetail != nil {
- ret.GoodsDetail = make([]GoodsDetail, len(o.GoodsDetail))
- for i, item := range o.GoodsDetail {
- ret.GoodsDetail[i] = *item.Clone()
- }
- }
- return &ret
- }
- // GoodsDetail
- type GoodsDetail struct {
- // 由半角的大小写字母、数字、中划线、下划线中的一种或几种组成。
- GoodsId *string `json:"goods_id"`
- // 微信支付定义的统一商品编号(没有可不传)。
- WechatpayGoodsId *string `json:"wechatpay_goods_id,omitempty"`
- // 商品的实际名称。
- GoodsName *string `json:"goods_name,omitempty"`
- // 用户购买的数量。
- Quantity *int64 `json:"quantity"`
- // 商品单价,单位为分。
- UnitPrice *int64 `json:"unit_price"`
- }
- func (o GoodsDetail) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.GoodsId == nil {
- return nil, fmt.Errorf("field `MerchantGoodsId` is required and must be specified in GoodsDetail")
- }
- toSerialize["goods_id"] = o.GoodsId
- if o.WechatpayGoodsId != nil {
- toSerialize["wechatpay_goods_id"] = o.WechatpayGoodsId
- }
- if o.GoodsName != nil {
- toSerialize["goods_name"] = o.GoodsName
- }
- if o.Quantity == nil {
- return nil, fmt.Errorf("field `Quantity` is required and must be specified in GoodsDetail")
- }
- toSerialize["quantity"] = o.Quantity
- if o.UnitPrice == nil {
- return nil, fmt.Errorf("field `UnitPrice` is required and must be specified in GoodsDetail")
- }
- toSerialize["unit_price"] = o.UnitPrice
- return json.Marshal(toSerialize)
- }
- func (o GoodsDetail) String() string {
- var ret string
- if o.GoodsId == nil {
- ret += "MerchantGoodsId:<nil>, "
- } else {
- ret += fmt.Sprintf("MerchantGoodsId:%v, ", *o.GoodsId)
- }
- if o.WechatpayGoodsId == nil {
- ret += "WechatpayGoodsId:<nil>, "
- } else {
- ret += fmt.Sprintf("WechatpayGoodsId:%v, ", *o.WechatpayGoodsId)
- }
- if o.GoodsName == nil {
- ret += "GoodsName:<nil>, "
- } else {
- ret += fmt.Sprintf("GoodsName:%v, ", *o.GoodsName)
- }
- if o.Quantity == nil {
- ret += "Quantity:<nil>, "
- } else {
- ret += fmt.Sprintf("Quantity:%v, ", *o.Quantity)
- }
- if o.UnitPrice == nil {
- ret += "UnitPrice:<nil>"
- } else {
- ret += fmt.Sprintf("UnitPrice:%v", *o.UnitPrice)
- }
- return fmt.Sprintf("GoodsDetail{%s}", ret)
- }
- func (o GoodsDetail) Clone() *GoodsDetail {
- ret := GoodsDetail{}
- if o.GoodsId != nil {
- ret.GoodsId = new(string)
- *ret.GoodsId = *o.GoodsId
- }
- if o.WechatpayGoodsId != nil {
- ret.WechatpayGoodsId = new(string)
- *ret.WechatpayGoodsId = *o.WechatpayGoodsId
- }
- if o.GoodsName != nil {
- ret.GoodsName = new(string)
- *ret.GoodsName = *o.GoodsName
- }
- if o.Quantity != nil {
- ret.Quantity = new(int64)
- *ret.Quantity = *o.Quantity
- }
- if o.UnitPrice != nil {
- ret.UnitPrice = new(int64)
- *ret.UnitPrice = *o.UnitPrice
- }
- return &ret
- }
- // H5Info
- type H5Info struct {
- // 场景类型
- Type *string `json:"type"`
- // 应用名称
- AppName *string `json:"app_name,omitempty"`
- // 网站URL
- AppUrl *string `json:"app_url,omitempty"`
- // iOS平台BundleID
- BundleId *string `json:"bundle_id,omitempty"`
- // Android平台PackageName
- PackageName *string `json:"package_name,omitempty"`
- }
- func (o H5Info) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Type == nil {
- return nil, fmt.Errorf("field `Type` is required and must be specified in H5Info")
- }
- toSerialize["type"] = o.Type
- if o.AppName != nil {
- toSerialize["app_name"] = o.AppName
- }
- if o.AppUrl != nil {
- toSerialize["app_url"] = o.AppUrl
- }
- if o.BundleId != nil {
- toSerialize["bundle_id"] = o.BundleId
- }
- if o.PackageName != nil {
- toSerialize["package_name"] = o.PackageName
- }
- return json.Marshal(toSerialize)
- }
- func (o H5Info) String() string {
- var ret string
- if o.Type == nil {
- ret += "Type:<nil>, "
- } else {
- ret += fmt.Sprintf("Type:%v, ", *o.Type)
- }
- if o.AppName == nil {
- ret += "AppName:<nil>, "
- } else {
- ret += fmt.Sprintf("AppName:%v, ", *o.AppName)
- }
- if o.AppUrl == nil {
- ret += "AppUrl:<nil>, "
- } else {
- ret += fmt.Sprintf("AppUrl:%v, ", *o.AppUrl)
- }
- if o.BundleId == nil {
- ret += "BundleId:<nil>, "
- } else {
- ret += fmt.Sprintf("BundleId:%v, ", *o.BundleId)
- }
- if o.PackageName == nil {
- ret += "PackageName:<nil>"
- } else {
- ret += fmt.Sprintf("PackageName:%v", *o.PackageName)
- }
- return fmt.Sprintf("H5Info{%s}", ret)
- }
- func (o H5Info) Clone() *H5Info {
- ret := H5Info{}
- if o.Type != nil {
- ret.Type = new(string)
- *ret.Type = *o.Type
- }
- if o.AppName != nil {
- ret.AppName = new(string)
- *ret.AppName = *o.AppName
- }
- if o.AppUrl != nil {
- ret.AppUrl = new(string)
- *ret.AppUrl = *o.AppUrl
- }
- if o.BundleId != nil {
- ret.BundleId = new(string)
- *ret.BundleId = *o.BundleId
- }
- if o.PackageName != nil {
- ret.PackageName = new(string)
- *ret.PackageName = *o.PackageName
- }
- return &ret
- }
- // PrepayRequest
- type PrepayRequest struct {
- // 公众号ID
- Appid *string `json:"appid"`
- // 直连商户号
- Mchid *string `json:"mchid"`
- // 商品描述
- Description *string `json:"description"`
- // 商户订单号
- OutTradeNo *string `json:"out_trade_no"`
- // 订单失效时间,格式为rfc3339格式
- TimeExpire *time.Time `json:"time_expire,omitempty"`
- // 附加数据
- Attach *string `json:"attach,omitempty"`
- // 有效性:1. HTTPS;2. 不允许携带查询串。
- NotifyUrl *string `json:"notify_url"`
- // 商品标记,代金券或立减优惠功能的参数。
- GoodsTag *string `json:"goods_tag,omitempty"`
- // 指定支付方式
- LimitPay []string `json:"limit_pay,omitempty"`
- // 传入true时,支付成功消息和支付详情页将出现开票入口。需要在微信支付商户平台或微信公众平台开通电子发票功能,传此字段才可生效。
- SupportFapiao *bool `json:"support_fapiao,omitempty"`
- Amount *Amount `json:"amount"`
- Detail *Detail `json:"detail,omitempty"`
- SceneInfo *SceneInfo `json:"scene_info"`
- //交易类型
- TradeType *string `json:"trade_type,omitempty"`
- //商户行业编码
- MerchantCategoryCode *string `json:"merchant_category_code,omitempty"`
- }
- func (o PrepayRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Appid == nil {
- return nil, fmt.Errorf("field `Appid` is required and must be specified in PrepayRequest")
- }
- toSerialize["appid"] = o.Appid
- if o.Mchid == nil {
- return nil, fmt.Errorf("field `Mchid` is required and must be specified in PrepayRequest")
- }
- toSerialize["mchid"] = o.Mchid
- if o.Description == nil {
- return nil, fmt.Errorf("field `Description` is required and must be specified in PrepayRequest")
- }
- toSerialize["description"] = o.Description
- if o.OutTradeNo == nil {
- return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in PrepayRequest")
- }
- toSerialize["out_trade_no"] = o.OutTradeNo
- if o.TimeExpire != nil {
- toSerialize["time_expire"] = o.TimeExpire.Format(time.RFC3339)
- }
- if o.Attach != nil {
- toSerialize["attach"] = o.Attach
- }
- if o.NotifyUrl == nil {
- return nil, fmt.Errorf("field `NotifyUrl` is required and must be specified in PrepayRequest")
- }
- toSerialize["notify_url"] = o.NotifyUrl
- if o.GoodsTag != nil {
- toSerialize["goods_tag"] = o.GoodsTag
- }
- if o.LimitPay != nil {
- toSerialize["limit_pay"] = o.LimitPay
- }
- if o.SupportFapiao != nil {
- toSerialize["support_fapiao"] = o.SupportFapiao
- }
- if o.Amount == nil {
- return nil, fmt.Errorf("field `Amount` is required and must be specified in PrepayRequest")
- }
- toSerialize["amount"] = o.Amount
- if o.Detail != nil {
- toSerialize["detail"] = o.Detail
- }
- if o.SceneInfo == nil {
- return nil, fmt.Errorf("field `SceneInfo` is required and must be specified in PrepayRequest")
- }
- toSerialize["scene_info"] = o.SceneInfo
- if o.MerchantCategoryCode==nil{
- return nil, fmt.Errorf("field `MerchantCategoryCode` is required and must be specified in PrepayRequest")
- }
- toSerialize["merchant_category_code"] = o.MerchantCategoryCode
- return json.Marshal(toSerialize)
- }
- func (o PrepayRequest) String() string {
- var ret string
- if o.Appid == nil {
- ret += "Appid:<nil>, "
- } else {
- ret += fmt.Sprintf("Appid:%v, ", *o.Appid)
- }
- if o.Mchid == nil {
- ret += "Mchid:<nil>, "
- } else {
- ret += fmt.Sprintf("Mchid:%v, ", *o.Mchid)
- }
- if o.Description == nil {
- ret += "Description:<nil>, "
- } else {
- ret += fmt.Sprintf("Description:%v, ", *o.Description)
- }
- if o.OutTradeNo == nil {
- ret += "OutTradeNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
- }
- if o.TimeExpire == nil {
- ret += "TimeExpire:<nil>, "
- } else {
- ret += fmt.Sprintf("TimeExpire:%v, ", *o.TimeExpire)
- }
- if o.Attach == nil {
- ret += "Attach:<nil>, "
- } else {
- ret += fmt.Sprintf("Attach:%v, ", *o.Attach)
- }
- if o.NotifyUrl == nil {
- ret += "NotifyUrl:<nil>, "
- } else {
- ret += fmt.Sprintf("NotifyUrl:%v, ", *o.NotifyUrl)
- }
- if o.GoodsTag == nil {
- ret += "GoodsTag:<nil>, "
- } else {
- ret += fmt.Sprintf("GoodsTag:%v, ", *o.GoodsTag)
- }
- ret += fmt.Sprintf("LimitPay:%v, ", o.LimitPay)
- if o.SupportFapiao == nil {
- ret += "SupportFapiao:<nil>, "
- } else {
- ret += fmt.Sprintf("SupportFapiao:%v, ", *o.SupportFapiao)
- }
- if o.MerchantCategoryCode == nil {
- ret += "MerchantCategoryCode:<nil>, "
- } else {
- ret += fmt.Sprintf("MerchantCategoryCode:%v, ", *o.MerchantCategoryCode)
- }
- ret += fmt.Sprintf("Amount:%v, ", o.Amount)
- ret += fmt.Sprintf("Detail:%v, ", o.Detail)
- ret += fmt.Sprintf("SceneInfo:%v, ", o.SceneInfo)
- return fmt.Sprintf("PrepayRequest{%s}", ret)
- }
- func (o PrepayRequest) Clone() *PrepayRequest {
- ret := PrepayRequest{}
- if o.Appid != nil {
- ret.Appid = new(string)
- *ret.Appid = *o.Appid
- }
- if o.Mchid != nil {
- ret.Mchid = new(string)
- *ret.Mchid = *o.Mchid
- }
- if o.Description != nil {
- ret.Description = new(string)
- *ret.Description = *o.Description
- }
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- if o.TimeExpire != nil {
- ret.TimeExpire = new(time.Time)
- *ret.TimeExpire = *o.TimeExpire
- }
- if o.Attach != nil {
- ret.Attach = new(string)
- *ret.Attach = *o.Attach
- }
- if o.NotifyUrl != nil {
- ret.NotifyUrl = new(string)
- *ret.NotifyUrl = *o.NotifyUrl
- }
- if o.GoodsTag != nil {
- ret.GoodsTag = new(string)
- *ret.GoodsTag = *o.GoodsTag
- }
- if o.LimitPay != nil {
- ret.LimitPay = make([]string, len(o.LimitPay))
- for i, item := range o.LimitPay {
- ret.LimitPay[i] = item
- }
- }
- if o.SupportFapiao != nil {
- ret.SupportFapiao = new(bool)
- *ret.SupportFapiao = *o.SupportFapiao
- }
- if o.Amount != nil {
- ret.Amount = o.Amount.Clone()
- }
- if o.Detail != nil {
- ret.Detail = o.Detail.Clone()
- }
- if o.SceneInfo != nil {
- ret.SceneInfo = o.SceneInfo.Clone()
- }
- if o.MerchantCategoryCode != nil {
- ret.MerchantCategoryCode = new(string)
- *ret.MerchantCategoryCode = *o.MerchantCategoryCode
- }
- return &ret
- }
- // PrepayResponse
- type PrepayResponse struct {
- // 支付跳转链接
- H5Url *string `json:"h5_url"`
- }
- func (o PrepayResponse) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.H5Url == nil {
- return nil, fmt.Errorf("field `H5Url` is required and must be specified in PrepayResponse")
- }
- toSerialize["h5_url"] = o.H5Url
- return json.Marshal(toSerialize)
- }
- func (o PrepayResponse) String() string {
- var ret string
- if o.H5Url == nil {
- ret += "H5Url:<nil>"
- } else {
- ret += fmt.Sprintf("H5Url:%v", *o.H5Url)
- }
- return fmt.Sprintf("PrepayResponse{%s}", ret)
- }
- func (o PrepayResponse) Clone() *PrepayResponse {
- ret := PrepayResponse{}
- if o.H5Url != nil {
- ret.H5Url = new(string)
- *ret.H5Url = *o.H5Url
- }
- return &ret
- }
- // QueryOrderByIdRequest
- type QueryOrderByIdRequest struct {
- TransactionId *string `json:"transaction_id"`
- // 直连商户号
- Mchid *string `json:"mchid"`
- }
- func (o QueryOrderByIdRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.TransactionId == nil {
- return nil, fmt.Errorf("field `TransactionId` is required and must be specified in QueryOrderByIdRequest")
- }
- toSerialize["transaction_id"] = o.TransactionId
- if o.Mchid == nil {
- return nil, fmt.Errorf("field `Mchid` is required and must be specified in QueryOrderByIdRequest")
- }
- toSerialize["mchid"] = o.Mchid
- return json.Marshal(toSerialize)
- }
- func (o QueryOrderByIdRequest) String() string {
- var ret string
- if o.TransactionId == nil {
- ret += "TransactionId:<nil>, "
- } else {
- ret += fmt.Sprintf("TransactionId:%v, ", *o.TransactionId)
- }
- if o.Mchid == nil {
- ret += "Mchid:<nil>"
- } else {
- ret += fmt.Sprintf("Mchid:%v", *o.Mchid)
- }
- return fmt.Sprintf("QueryOrderByIdRequest{%s}", ret)
- }
- func (o QueryOrderByIdRequest) Clone() *QueryOrderByIdRequest {
- ret := QueryOrderByIdRequest{}
- if o.TransactionId != nil {
- ret.TransactionId = new(string)
- *ret.TransactionId = *o.TransactionId
- }
- if o.Mchid != nil {
- ret.Mchid = new(string)
- *ret.Mchid = *o.Mchid
- }
- return &ret
- }
- // QueryOrderByOutTradeNoRequest
- type QueryOrderByOutTradeNoRequest struct {
- OutTradeNo *string `json:"out_trade_no"`
- // 直连商户号
- Mchid *string `json:"mchid"`
- }
- func (o QueryOrderByOutTradeNoRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.OutTradeNo == nil {
- return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in QueryOrderByOutTradeNoRequest")
- }
- toSerialize["out_trade_no"] = o.OutTradeNo
- if o.Mchid == nil {
- return nil, fmt.Errorf("field `Mchid` is required and must be specified in QueryOrderByOutTradeNoRequest")
- }
- toSerialize["mchid"] = o.Mchid
- return json.Marshal(toSerialize)
- }
- func (o QueryOrderByOutTradeNoRequest) String() string {
- var ret string
- if o.OutTradeNo == nil {
- ret += "OutTradeNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
- }
- if o.Mchid == nil {
- ret += "Mchid:<nil>"
- } else {
- ret += fmt.Sprintf("Mchid:%v", *o.Mchid)
- }
- return fmt.Sprintf("QueryOrderByOutTradeNoRequest{%s}", ret)
- }
- func (o QueryOrderByOutTradeNoRequest) Clone() *QueryOrderByOutTradeNoRequest {
- ret := QueryOrderByOutTradeNoRequest{}
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- if o.Mchid != nil {
- ret.Mchid = new(string)
- *ret.Mchid = *o.Mchid
- }
- return &ret
- }
- // SceneInfo 支付场景描述
- type SceneInfo struct {
- // 用户终端IP
- PayerClientIp *string `json:"payer_client_ip"`
- // 商户端设备号
- DeviceId *string `json:"device_id,omitempty"`
- DeviceIp *string `json:"device_ip,omitempty"`
- StoreInfo *StoreInfo `json:"store_info,omitempty"`
- }
- func (o SceneInfo) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.PayerClientIp == nil {
- return nil, fmt.Errorf("field `PayerClientIp` is required and must be specified in SceneInfo")
- }
- toSerialize["payer_client_ip"] = o.PayerClientIp
- if o.DeviceId != nil {
- toSerialize["device_id"] = o.DeviceId
- }
- if o.DeviceIp != nil {
- toSerialize["device_ip"] = o.DeviceIp
- }
- if o.StoreInfo != nil {
- toSerialize["store_info"] = o.StoreInfo
- }
- return json.Marshal(toSerialize)
- }
- func (o SceneInfo) String() string {
- var ret string
- if o.PayerClientIp == nil {
- ret += "PayerClientIp:<nil>, "
- } else {
- ret += fmt.Sprintf("PayerClientIp:%v, ", *o.PayerClientIp)
- }
- if o.DeviceId == nil {
- ret += "DeviceId:<nil>, "
- } else {
- ret += fmt.Sprintf("DeviceId:%v, ", *o.DeviceId)
- }
- ret += fmt.Sprintf("StoreInfo:%v, ", o.StoreInfo)
- return fmt.Sprintf("SceneInfo{%s}", ret)
- }
- func (o SceneInfo) Clone() *SceneInfo {
- ret := SceneInfo{}
- if o.PayerClientIp != nil {
- ret.PayerClientIp = new(string)
- *ret.PayerClientIp = *o.PayerClientIp
- }
- if o.DeviceId != nil {
- ret.DeviceId = new(string)
- *ret.DeviceId = *o.DeviceId
- }
- if o.StoreInfo != nil {
- ret.StoreInfo = o.StoreInfo.Clone()
- }
- return &ret
- }
- // SettleInfo
- type SettleInfo struct {
- // 是否指定分账
- ProfitSharing *bool `json:"profit_sharing,omitempty"`
- }
- func (o SettleInfo) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.ProfitSharing != nil {
- toSerialize["profit_sharing"] = o.ProfitSharing
- }
- return json.Marshal(toSerialize)
- }
- func (o SettleInfo) String() string {
- var ret string
- if o.ProfitSharing == nil {
- ret += "ProfitSharing:<nil>"
- } else {
- ret += fmt.Sprintf("ProfitSharing:%v", *o.ProfitSharing)
- }
- return fmt.Sprintf("SettleInfo{%s}", ret)
- }
- func (o SettleInfo) Clone() *SettleInfo {
- ret := SettleInfo{}
- if o.ProfitSharing != nil {
- ret.ProfitSharing = new(bool)
- *ret.ProfitSharing = *o.ProfitSharing
- }
- return &ret
- }
- // StoreInfo 商户门店信息
- type StoreInfo struct {
- // 商户侧门店编号
- Id *string `json:"id"`
- // 商户侧门店名称
- Name *string `json:"name,omitempty"`
- // 详细的商户门店地址
- Address *string `json:"address,omitempty"`
- }
- func (o StoreInfo) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Id != nil {
- toSerialize["id"] = o.Id
- }
- if o.Name != nil {
- toSerialize["name"] = o.Name
- }
- if o.Address != nil {
- toSerialize["address"] = o.Address
- }
- return json.Marshal(toSerialize)
- }
- func (o StoreInfo) String() string {
- var ret string
- if o.Id == nil {
- ret += "Id:<nil>, "
- } else {
- ret += fmt.Sprintf("Id:%v, ", *o.Id)
- }
- if o.Name == nil {
- ret += "Name:<nil>, "
- } else {
- ret += fmt.Sprintf("Name:%v, ", *o.Name)
- }
- if o.Address == nil {
- ret += "Address:<nil>"
- } else {
- ret += fmt.Sprintf("Address:%v", *o.Address)
- }
- return fmt.Sprintf("StoreInfo{%s}", ret)
- }
- func (o StoreInfo) Clone() *StoreInfo {
- ret := StoreInfo{}
- if o.Id != nil {
- ret.Id = new(string)
- *ret.Id = *o.Id
- }
- if o.Name != nil {
- ret.Name = new(string)
- *ret.Name = *o.Name
- }
- if o.Address != nil {
- ret.Address = new(string)
- *ret.Address = *o.Address
- }
- return &ret
- }
|