// 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:, " } else { ret += fmt.Sprintf("Total:%v, ", *o.Total) } if o.PayerTotal == nil { ret += "PayerTotal:, " } else { ret += fmt.Sprintf("PayerTotal:%v, ", *o.PayerTotal) } if o.Currency == nil { ret += "Currency:, " } else { ret += fmt.Sprintf("Currency:%v, ", *o.Currency) } if o.PayerCurrency == nil { ret += "PayerCurrency:" } 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:, " } else { ret += fmt.Sprintf("DonateCount:%v, ", *o.DonateCount) } if o.ConsumeCount == nil { ret += "ConsumeCount:" } 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:" } 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:, " } else { ret += fmt.Sprintf("Openid:%v, ", *o.Openid) } if o.OutTradeNo == nil { ret += "OutTradeNo:" } 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:, " } else { ret += fmt.Sprintf("Openid:%v, ", *o.Openid) } if o.BrandId == nil { ret += "BrandId:, " } else { ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId) } if o.Limit == nil { ret += "Limit:, " } else { ret += fmt.Sprintf("Limit:%v, ", *o.Limit) } if o.Offset == nil { ret += "Offset:" } 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:, " } else { ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo) } if o.Mchid == nil { ret += "Mchid:, " } else { ret += fmt.Sprintf("Mchid:%v, ", *o.Mchid) } if o.SubMchid == nil { ret += "SubMchid:, " } else { ret += fmt.Sprintf("SubMchid:%v, ", *o.SubMchid) } if o.StoreId == nil { ret += "StoreId:" } 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:, " } else { ret += fmt.Sprintf("WelfareTradeId:%v, ", *o.WelfareTradeId) } if o.Appid == nil { ret += "Appid:, " } else { ret += fmt.Sprintf("Appid:%v, ", *o.Appid) } if o.SubAppid == nil { ret += "SubAppid:, " } else { ret += fmt.Sprintf("SubAppid:%v, ", *o.SubAppid) } if o.BrandId == nil { ret += "BrandId:, " } else { ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId) } if o.DonateSource == nil { ret += "DonateSource:, " } else { ret += fmt.Sprintf("DonateSource:%v, ", *o.DonateSource) } ret += fmt.Sprintf("MerchantOrder:%v, ", o.MerchantOrder) if o.InstitutionName == nil { ret += "InstitutionName:, " } else { ret += fmt.Sprintf("InstitutionName:%v, ", *o.InstitutionName) } if o.BusinessId == nil { ret += "BusinessId:, " } else { ret += fmt.Sprintf("BusinessId:%v, ", *o.BusinessId) } if o.BusinessName == nil { ret += "BusinessName:, " } else { ret += fmt.Sprintf("BusinessName:%v, ", *o.BusinessName) } if o.SuccessTime == nil { ret += "SuccessTime:, " } 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:" } 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:, " } else { ret += fmt.Sprintf("Count:%v, ", *o.Count) } if o.Limit == nil { ret += "Limit:, " } else { ret += fmt.Sprintf("Limit:%v, ", *o.Limit) } if o.Offset == nil { ret += "Offset:, " } else { ret += fmt.Sprintf("Offset:%v, ", *o.Offset) } if o.TotalCount == nil { ret += "TotalCount:" } 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:, " } else { ret += fmt.Sprintf("Openid:%v, ", *o.Openid) } if o.SubOpenid == nil { ret += "SubOpenid:, " } else { ret += fmt.Sprintf("SubOpenid:%v, ", *o.SubOpenid) } if o.Avatar == nil { ret += "Avatar:, " } else { ret += fmt.Sprintf("Avatar:%v, ", *o.Avatar) } if o.Nickname == nil { ret += "Nickname:" } 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 }