123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872 |
- // Copyright 2021 Tencent Inc. All rights reserved.
- //
- // 爱心餐对外API
- //
- // 微信支付爱心餐公益计划旨在面向深圳市的市政一线环卫工人提供每周一餐的1分钱用餐公益服务。在受助端,微信支付联动上千家餐饮门店关爱特殊人群,通过微信支付数字化能力将人群身份认证与公益福利领用全流程线上化,实现公益福利精准到人。在捐赠端,微信支付发挥连接优势与平台能力,结合用户就餐场景通过爱心餐一块捐插件让用户可在点餐时顺手捐1元,带动更多社会力量致谢城市美容师。
- //
- // API version: 0.0.4
- // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
- package lovefeast
- import (
- "encoding/json"
- "fmt"
- )
- // Amount
- type Amount struct {
- // 订单总金额,单位为分。
- Total *int64 `json:"total"`
- // 用户支付金额,单位为分。
- PayerTotal *int64 `json:"payer_total"`
- // CNY:人民币,境内商户号仅支持人民币。
- Currency *string `json:"currency"`
- // 用户支付币种
- PayerCurrency *string `json:"payer_currency"`
- }
- 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.PayerTotal == nil {
- return nil, fmt.Errorf("field `PayerTotal` is required and must be specified in Amount")
- }
- toSerialize["payer_total"] = o.PayerTotal
- if o.Currency == nil {
- return nil, fmt.Errorf("field `Currency` is required and must be specified in Amount")
- }
- toSerialize["currency"] = o.Currency
- if o.PayerCurrency == nil {
- return nil, fmt.Errorf("field `PayerCurrency` is required and must be specified in Amount")
- }
- toSerialize["payer_currency"] = o.PayerCurrency
- 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.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)
- }
- if o.PayerCurrency == nil {
- ret += "PayerCurrency:<nil>"
- } else {
- ret += fmt.Sprintf("PayerCurrency:%v", *o.PayerCurrency)
- }
- 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.PayerTotal != nil {
- ret.PayerTotal = new(int64)
- *ret.PayerTotal = *o.PayerTotal
- }
- if o.Currency != nil {
- ret.Currency = new(string)
- *ret.Currency = *o.Currency
- }
- if o.PayerCurrency != nil {
- ret.PayerCurrency = new(string)
- *ret.PayerCurrency = *o.PayerCurrency
- }
- return &ret
- }
- // BrandEntity
- type BrandEntity struct {
- // 用户在该品牌下捐赠的总次数
- DonateCount *int64 `json:"donate_count"`
- // 仅供参品牌返回,该品牌为环卫工人供餐总量
- ConsumeCount *int64 `json:"consume_count,omitempty"`
- }
- func (o BrandEntity) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.DonateCount == nil {
- return nil, fmt.Errorf("field `DonateCount` is required and must be specified in BrandEntity")
- }
- toSerialize["donate_count"] = o.DonateCount
- if o.ConsumeCount != nil {
- toSerialize["consume_count"] = o.ConsumeCount
- }
- return json.Marshal(toSerialize)
- }
- func (o BrandEntity) String() string {
- var ret string
- if o.DonateCount == nil {
- ret += "DonateCount:<nil>, "
- } else {
- ret += fmt.Sprintf("DonateCount:%v, ", *o.DonateCount)
- }
- if o.ConsumeCount == nil {
- ret += "ConsumeCount:<nil>"
- } else {
- ret += fmt.Sprintf("ConsumeCount:%v", *o.ConsumeCount)
- }
- return fmt.Sprintf("BrandEntity{%s}", ret)
- }
- func (o BrandEntity) Clone() *BrandEntity {
- ret := BrandEntity{}
- if o.DonateCount != nil {
- ret.DonateCount = new(int64)
- *ret.DonateCount = *o.DonateCount
- }
- if o.ConsumeCount != nil {
- ret.ConsumeCount = new(int64)
- *ret.ConsumeCount = *o.ConsumeCount
- }
- return &ret
- }
- // GetBrandRequest
- type GetBrandRequest struct {
- // 品牌的品牌ID,商家进驻微信支付品牌商家后获得的品牌ID
- BrandId *int64 `json:"brand_id"`
- }
- func (o GetBrandRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.BrandId == nil {
- return nil, fmt.Errorf("field `BrandId` is required and must be specified in GetBrandRequest")
- }
- toSerialize["brand_id"] = o.BrandId
- return json.Marshal(toSerialize)
- }
- func (o GetBrandRequest) String() string {
- var ret string
- if o.BrandId == nil {
- ret += "BrandId:<nil>"
- } else {
- ret += fmt.Sprintf("BrandId:%v", *o.BrandId)
- }
- return fmt.Sprintf("GetBrandRequest{%s}", ret)
- }
- func (o GetBrandRequest) Clone() *GetBrandRequest {
- ret := GetBrandRequest{}
- if o.BrandId != nil {
- ret.BrandId = new(int64)
- *ret.BrandId = *o.BrandId
- }
- return &ret
- }
- // GetByUserRequest
- type GetByUserRequest struct {
- // 用户在商户AppID下的唯一标识
- Openid *string `json:"openid"`
- // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一
- OutTradeNo *string `json:"out_trade_no"`
- }
- func (o GetByUserRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Openid == nil {
- return nil, fmt.Errorf("field `Openid` is required and must be specified in GetByUserRequest")
- }
- toSerialize["openid"] = o.Openid
- if o.OutTradeNo == nil {
- return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in GetByUserRequest")
- }
- toSerialize["out_trade_no"] = o.OutTradeNo
- return json.Marshal(toSerialize)
- }
- func (o GetByUserRequest) String() string {
- var ret string
- if o.Openid == nil {
- ret += "Openid:<nil>, "
- } else {
- ret += fmt.Sprintf("Openid:%v, ", *o.Openid)
- }
- if o.OutTradeNo == nil {
- ret += "OutTradeNo:<nil>"
- } else {
- ret += fmt.Sprintf("OutTradeNo:%v", *o.OutTradeNo)
- }
- return fmt.Sprintf("GetByUserRequest{%s}", ret)
- }
- func (o GetByUserRequest) Clone() *GetByUserRequest {
- ret := GetByUserRequest{}
- if o.Openid != nil {
- ret.Openid = new(string)
- *ret.Openid = *o.Openid
- }
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- return &ret
- }
- // ListByUserRequest
- type ListByUserRequest struct {
- // 用户在商户AppID下的唯一标识
- Openid *string `json:"openid"`
- // 品牌的品牌ID,商家进驻微信支付品牌商家后获得的品牌ID
- BrandId *int64 `json:"brand_id"`
- // 返回的最大记录条数,默认值为10
- Limit *int64 `json:"limit"`
- // 查询起始位置,默认值为0
- Offset *int64 `json:"offset,omitempty"`
- }
- func (o ListByUserRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Openid == nil {
- return nil, fmt.Errorf("field `Openid` is required and must be specified in ListByUserRequest")
- }
- toSerialize["openid"] = o.Openid
- if o.BrandId == nil {
- return nil, fmt.Errorf("field `BrandId` is required and must be specified in ListByUserRequest")
- }
- toSerialize["brand_id"] = o.BrandId
- if o.Limit == nil {
- return nil, fmt.Errorf("field `Limit` is required and must be specified in ListByUserRequest")
- }
- toSerialize["limit"] = o.Limit
- if o.Offset != nil {
- toSerialize["offset"] = o.Offset
- }
- return json.Marshal(toSerialize)
- }
- func (o ListByUserRequest) String() string {
- var ret string
- if o.Openid == nil {
- ret += "Openid:<nil>, "
- } else {
- ret += fmt.Sprintf("Openid:%v, ", *o.Openid)
- }
- if o.BrandId == nil {
- ret += "BrandId:<nil>, "
- } else {
- ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId)
- }
- if o.Limit == nil {
- ret += "Limit:<nil>, "
- } else {
- ret += fmt.Sprintf("Limit:%v, ", *o.Limit)
- }
- if o.Offset == nil {
- ret += "Offset:<nil>"
- } else {
- ret += fmt.Sprintf("Offset:%v", *o.Offset)
- }
- return fmt.Sprintf("ListByUserRequest{%s}", ret)
- }
- func (o ListByUserRequest) Clone() *ListByUserRequest {
- ret := ListByUserRequest{}
- if o.Openid != nil {
- ret.Openid = new(string)
- *ret.Openid = *o.Openid
- }
- if o.BrandId != nil {
- ret.BrandId = new(int64)
- *ret.BrandId = *o.BrandId
- }
- if o.Limit != nil {
- ret.Limit = new(int64)
- *ret.Limit = *o.Limit
- }
- if o.Offset != nil {
- ret.Offset = new(int64)
- *ret.Offset = *o.Offset
- }
- return &ret
- }
- // MerchantOrder
- type MerchantOrder struct {
- // 商户系统内部订单号,只能是数字、大小写字母_-*且在同一个商户号下唯一。 特殊规则:最小字符长度为6
- OutTradeNo *string `json:"out_trade_no"`
- // 直连商户的商户号或服务商的商户号,由微信支付生成并下发。
- Mchid *string `json:"mchid"`
- // 子商户的商户号,由微信支付生成并下发。
- SubMchid *string `json:"sub_mchid,omitempty"`
- // 一块捐用户所在门店的商家编号。
- StoreId *string `json:"store_id"`
- }
- func (o MerchantOrder) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.OutTradeNo == nil {
- return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in MerchantOrder")
- }
- toSerialize["out_trade_no"] = o.OutTradeNo
- if o.Mchid == nil {
- return nil, fmt.Errorf("field `Mchid` is required and must be specified in MerchantOrder")
- }
- toSerialize["mchid"] = o.Mchid
- if o.SubMchid != nil {
- toSerialize["sub_mchid"] = o.SubMchid
- }
- if o.StoreId == nil {
- return nil, fmt.Errorf("field `StoreId` is required and must be specified in MerchantOrder")
- }
- toSerialize["store_id"] = o.StoreId
- return json.Marshal(toSerialize)
- }
- func (o MerchantOrder) 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)
- }
- if o.SubMchid == nil {
- ret += "SubMchid:<nil>, "
- } else {
- ret += fmt.Sprintf("SubMchid:%v, ", *o.SubMchid)
- }
- if o.StoreId == nil {
- ret += "StoreId:<nil>"
- } else {
- ret += fmt.Sprintf("StoreId:%v", *o.StoreId)
- }
- return fmt.Sprintf("MerchantOrder{%s}", ret)
- }
- func (o MerchantOrder) Clone() *MerchantOrder {
- ret := MerchantOrder{}
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- if o.Mchid != nil {
- ret.Mchid = new(string)
- *ret.Mchid = *o.Mchid
- }
- if o.SubMchid != nil {
- ret.SubMchid = new(string)
- *ret.SubMchid = *o.SubMchid
- }
- if o.StoreId != nil {
- ret.StoreId = new(string)
- *ret.StoreId = *o.StoreId
- }
- return &ret
- }
- // OrdersEntity
- type OrdersEntity struct {
- // 捐赠订单号
- WelfareTradeId *string `json:"welfare_trade_id"`
- // 直连商户或服务商申请的公众号或移动应用AppID
- Appid *string `json:"appid"`
- // 子商户申请的公众号或移动应用AppID
- SubAppid *string `json:"sub_appid,omitempty"`
- // 品牌的品牌ID,商家进驻微信支付品牌商家后获得的品牌ID
- BrandId *int64 `json:"brand_id"`
- // 捐赠来源 枚举值 MINIPROGRAM_PAY:一起捐小程序 ENTRUST_PAY:一块捐插件
- DonateSource *string `json:"donate_source"`
- // 商户订单,仅在一块捐来源回调中出现
- MerchantOrder *MerchantOrder `json:"merchant_order,omitempty"`
- // 捐赠公益机构名称。
- InstitutionName *string `json:"institution_name"`
- // 本次捐赠项目编号。
- BusinessId *string `json:"business_id"`
- // 本次捐赠活动名称。
- BusinessName *string `json:"business_name"`
- // 支付完成时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
- SuccessTime *string `json:"success_time"`
- // 支付者信息
- Payer *Payer `json:"payer"`
- // 订单金额信息
- Amount *Amount `json:"amount"`
- // 设备编号,通过物料码进入爱心餐一起捐小程序捐赠时携带的设备编号参数
- DeviceId *string `json:"device_id,omitempty"`
- }
- func (o OrdersEntity) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.WelfareTradeId == nil {
- return nil, fmt.Errorf("field `WelfareTradeId` is required and must be specified in OrdersEntity")
- }
- toSerialize["welfare_trade_id"] = o.WelfareTradeId
- if o.Appid == nil {
- return nil, fmt.Errorf("field `Appid` is required and must be specified in OrdersEntity")
- }
- toSerialize["appid"] = o.Appid
- if o.SubAppid != nil {
- toSerialize["sub_appid"] = o.SubAppid
- }
- if o.BrandId == nil {
- return nil, fmt.Errorf("field `BrandId` is required and must be specified in OrdersEntity")
- }
- toSerialize["brand_id"] = o.BrandId
- if o.DonateSource == nil {
- return nil, fmt.Errorf("field `DonateSource` is required and must be specified in OrdersEntity")
- }
- toSerialize["donate_source"] = o.DonateSource
- if o.MerchantOrder != nil {
- toSerialize["merchant_order"] = o.MerchantOrder
- }
- if o.InstitutionName == nil {
- return nil, fmt.Errorf("field `InstitutionName` is required and must be specified in OrdersEntity")
- }
- toSerialize["institution_name"] = o.InstitutionName
- if o.BusinessId == nil {
- return nil, fmt.Errorf("field `BusinessId` is required and must be specified in OrdersEntity")
- }
- toSerialize["business_id"] = o.BusinessId
- if o.BusinessName == nil {
- return nil, fmt.Errorf("field `BusinessName` is required and must be specified in OrdersEntity")
- }
- toSerialize["business_name"] = o.BusinessName
- if o.SuccessTime == nil {
- return nil, fmt.Errorf("field `SuccessTime` is required and must be specified in OrdersEntity")
- }
- toSerialize["success_time"] = o.SuccessTime
- if o.Payer == nil {
- return nil, fmt.Errorf("field `Payer` is required and must be specified in OrdersEntity")
- }
- toSerialize["payer"] = o.Payer
- if o.Amount == nil {
- return nil, fmt.Errorf("field `Amount` is required and must be specified in OrdersEntity")
- }
- toSerialize["amount"] = o.Amount
- if o.DeviceId != nil {
- toSerialize["device_id"] = o.DeviceId
- }
- return json.Marshal(toSerialize)
- }
- func (o OrdersEntity) String() string {
- var ret string
- if o.WelfareTradeId == nil {
- ret += "WelfareTradeId:<nil>, "
- } else {
- ret += fmt.Sprintf("WelfareTradeId:%v, ", *o.WelfareTradeId)
- }
- 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.BrandId == nil {
- ret += "BrandId:<nil>, "
- } else {
- ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId)
- }
- if o.DonateSource == nil {
- ret += "DonateSource:<nil>, "
- } else {
- ret += fmt.Sprintf("DonateSource:%v, ", *o.DonateSource)
- }
- ret += fmt.Sprintf("MerchantOrder:%v, ", o.MerchantOrder)
- if o.InstitutionName == nil {
- ret += "InstitutionName:<nil>, "
- } else {
- ret += fmt.Sprintf("InstitutionName:%v, ", *o.InstitutionName)
- }
- if o.BusinessId == nil {
- ret += "BusinessId:<nil>, "
- } else {
- ret += fmt.Sprintf("BusinessId:%v, ", *o.BusinessId)
- }
- if o.BusinessName == nil {
- ret += "BusinessName:<nil>, "
- } else {
- ret += fmt.Sprintf("BusinessName:%v, ", *o.BusinessName)
- }
- if o.SuccessTime == nil {
- ret += "SuccessTime:<nil>, "
- } else {
- ret += fmt.Sprintf("SuccessTime:%v, ", *o.SuccessTime)
- }
- ret += fmt.Sprintf("Payer:%v, ", o.Payer)
- ret += fmt.Sprintf("Amount:%v, ", o.Amount)
- if o.DeviceId == nil {
- ret += "DeviceId:<nil>"
- } else {
- ret += fmt.Sprintf("DeviceId:%v", *o.DeviceId)
- }
- return fmt.Sprintf("OrdersEntity{%s}", ret)
- }
- func (o OrdersEntity) Clone() *OrdersEntity {
- ret := OrdersEntity{}
- if o.WelfareTradeId != nil {
- ret.WelfareTradeId = new(string)
- *ret.WelfareTradeId = *o.WelfareTradeId
- }
- 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.BrandId != nil {
- ret.BrandId = new(int64)
- *ret.BrandId = *o.BrandId
- }
- if o.DonateSource != nil {
- ret.DonateSource = new(string)
- *ret.DonateSource = *o.DonateSource
- }
- if o.MerchantOrder != nil {
- ret.MerchantOrder = o.MerchantOrder.Clone()
- }
- if o.InstitutionName != nil {
- ret.InstitutionName = new(string)
- *ret.InstitutionName = *o.InstitutionName
- }
- if o.BusinessId != nil {
- ret.BusinessId = new(string)
- *ret.BusinessId = *o.BusinessId
- }
- if o.BusinessName != nil {
- ret.BusinessName = new(string)
- *ret.BusinessName = *o.BusinessName
- }
- if o.SuccessTime != nil {
- ret.SuccessTime = new(string)
- *ret.SuccessTime = *o.SuccessTime
- }
- if o.Payer != nil {
- ret.Payer = o.Payer.Clone()
- }
- if o.Amount != nil {
- ret.Amount = o.Amount.Clone()
- }
- if o.DeviceId != nil {
- ret.DeviceId = new(string)
- *ret.DeviceId = *o.DeviceId
- }
- return &ret
- }
- // OrdersListByUserResponse
- type OrdersListByUserResponse struct {
- // 捐赠单详情
- Data []OrdersEntity `json:"data"`
- // 该次请求返回的记录条数
- Count *int64 `json:"count"`
- // 返回的最大记录条数,默认值为10
- Limit *int64 `json:"limit"`
- // 查询起始位置。
- Offset *int64 `json:"offset"`
- // 全部记录数量
- TotalCount *int64 `json:"total_count"`
- }
- func (o OrdersListByUserResponse) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Data == nil {
- return nil, fmt.Errorf("field `Data` is required and must be specified in OrdersListByUserResponse")
- }
- toSerialize["data"] = o.Data
- if o.Count == nil {
- return nil, fmt.Errorf("field `Count` is required and must be specified in OrdersListByUserResponse")
- }
- toSerialize["count"] = o.Count
- if o.Limit == nil {
- return nil, fmt.Errorf("field `Limit` is required and must be specified in OrdersListByUserResponse")
- }
- toSerialize["limit"] = o.Limit
- if o.Offset == nil {
- return nil, fmt.Errorf("field `Offset` is required and must be specified in OrdersListByUserResponse")
- }
- toSerialize["offset"] = o.Offset
- if o.TotalCount == nil {
- return nil, fmt.Errorf("field `TotalCount` is required and must be specified in OrdersListByUserResponse")
- }
- toSerialize["total_count"] = o.TotalCount
- return json.Marshal(toSerialize)
- }
- func (o OrdersListByUserResponse) String() string {
- var ret string
- ret += fmt.Sprintf("Data:%v, ", o.Data)
- if o.Count == nil {
- ret += "Count:<nil>, "
- } else {
- ret += fmt.Sprintf("Count:%v, ", *o.Count)
- }
- if o.Limit == nil {
- ret += "Limit:<nil>, "
- } else {
- ret += fmt.Sprintf("Limit:%v, ", *o.Limit)
- }
- if o.Offset == nil {
- ret += "Offset:<nil>, "
- } else {
- ret += fmt.Sprintf("Offset:%v, ", *o.Offset)
- }
- if o.TotalCount == nil {
- ret += "TotalCount:<nil>"
- } else {
- ret += fmt.Sprintf("TotalCount:%v", *o.TotalCount)
- }
- return fmt.Sprintf("OrdersListByUserResponse{%s}", ret)
- }
- func (o OrdersListByUserResponse) Clone() *OrdersListByUserResponse {
- ret := OrdersListByUserResponse{}
- if o.Data != nil {
- ret.Data = make([]OrdersEntity, len(o.Data))
- for i, item := range o.Data {
- ret.Data[i] = *item.Clone()
- }
- }
- if o.Count != nil {
- ret.Count = new(int64)
- *ret.Count = *o.Count
- }
- if o.Limit != nil {
- ret.Limit = new(int64)
- *ret.Limit = *o.Limit
- }
- if o.Offset != nil {
- ret.Offset = new(int64)
- *ret.Offset = *o.Offset
- }
- if o.TotalCount != nil {
- ret.TotalCount = new(int64)
- *ret.TotalCount = *o.TotalCount
- }
- return &ret
- }
- // Payer
- type Payer struct {
- // 用户在AppID下的唯一标识。在【一块捐】场景下按照商家下单时AppID生成;在【一起捐】场景下按照商户登记AppID生成。
- Openid *string `json:"openid"`
- // 用户在子AppID下的唯一标识。在【一块捐】场景下按照商家下单时子AppID生成;在【一起捐】场景下按照商户登记子AppID生成。
- SubOpenid *string `json:"sub_openid,omitempty"`
- // 用户在爱心餐小程序授权头像的URL
- Avatar *string `json:"avatar,omitempty"`
- // 用户在爱心餐小程序授权昵称
- Nickname *string `json:"nickname,omitempty"`
- }
- func (o Payer) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Openid == nil {
- return nil, fmt.Errorf("field `Openid` is required and must be specified in Payer")
- }
- toSerialize["openid"] = o.Openid
- if o.SubOpenid != nil {
- toSerialize["sub_openid"] = o.SubOpenid
- }
- if o.Avatar != nil {
- toSerialize["avatar"] = o.Avatar
- }
- if o.Nickname != nil {
- toSerialize["nickname"] = o.Nickname
- }
- return json.Marshal(toSerialize)
- }
- func (o Payer) String() string {
- var ret string
- if o.Openid == nil {
- ret += "Openid:<nil>, "
- } else {
- ret += fmt.Sprintf("Openid:%v, ", *o.Openid)
- }
- if o.SubOpenid == nil {
- ret += "SubOpenid:<nil>, "
- } else {
- ret += fmt.Sprintf("SubOpenid:%v, ", *o.SubOpenid)
- }
- if o.Avatar == nil {
- ret += "Avatar:<nil>, "
- } else {
- ret += fmt.Sprintf("Avatar:%v, ", *o.Avatar)
- }
- if o.Nickname == nil {
- ret += "Nickname:<nil>"
- } else {
- ret += fmt.Sprintf("Nickname:%v", *o.Nickname)
- }
- return fmt.Sprintf("Payer{%s}", ret)
- }
- func (o Payer) Clone() *Payer {
- ret := Payer{}
- if o.Openid != nil {
- ret.Openid = new(string)
- *ret.Openid = *o.Openid
- }
- if o.SubOpenid != nil {
- ret.SubOpenid = new(string)
- *ret.SubOpenid = *o.SubOpenid
- }
- if o.Avatar != nil {
- ret.Avatar = new(string)
- *ret.Avatar = *o.Avatar
- }
- if o.Nickname != nil {
- ret.Nickname = new(string)
- *ret.Nickname = *o.Nickname
- }
- return &ret
- }
|