123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170 |
- package refunddomestic
- import (
- "encoding/json"
- "fmt"
- "time"
- )
- type Account string
- func (e Account) Ptr() *Account {
- return &e
- }
- const (
- ACCOUNT_AVAILABLE Account = "AVAILABLE"
- ACCOUNT_UNAVAILABLE Account = "UNAVAILABLE"
- )
- type Amount struct {
-
- Total *int64 `json:"total"`
-
- Refund *int64 `json:"refund"`
-
- From []FundsFromItem `json:"from,omitempty"`
-
- PayerTotal *int64 `json:"payer_total"`
-
- PayerRefund *int64 `json:"payer_refund"`
-
- SettlementRefund *int64 `json:"settlement_refund"`
-
- SettlementTotal *int64 `json:"settlement_total"`
-
- DiscountRefund *int64 `json:"discount_refund"`
-
- Currency *string `json:"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.Refund == nil {
- return nil, fmt.Errorf("field `Refund` is required and must be specified in Amount")
- }
- toSerialize["refund"] = o.Refund
- if o.From != nil {
- toSerialize["from"] = o.From
- }
- 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.PayerRefund == nil {
- return nil, fmt.Errorf("field `PayerRefund` is required and must be specified in Amount")
- }
- toSerialize["payer_refund"] = o.PayerRefund
- if o.SettlementRefund == nil {
- return nil, fmt.Errorf("field `SettlementRefund` is required and must be specified in Amount")
- }
- toSerialize["settlement_refund"] = o.SettlementRefund
- if o.SettlementTotal == nil {
- return nil, fmt.Errorf("field `SettlementTotal` is required and must be specified in Amount")
- }
- toSerialize["settlement_total"] = o.SettlementTotal
- if o.DiscountRefund == nil {
- return nil, fmt.Errorf("field `DiscountRefund` is required and must be specified in Amount")
- }
- toSerialize["discount_refund"] = o.DiscountRefund
- if o.Currency == nil {
- return nil, fmt.Errorf("field `Currency` is required and must be specified in Amount")
- }
- 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.Refund == nil {
- ret += "Refund:<nil>, "
- } else {
- ret += fmt.Sprintf("Refund:%v, ", *o.Refund)
- }
- ret += fmt.Sprintf("From:%v, ", o.From)
- if o.PayerTotal == nil {
- ret += "PayerTotal:<nil>, "
- } else {
- ret += fmt.Sprintf("PayerTotal:%v, ", *o.PayerTotal)
- }
- if o.PayerRefund == nil {
- ret += "PayerRefund:<nil>, "
- } else {
- ret += fmt.Sprintf("PayerRefund:%v, ", *o.PayerRefund)
- }
- if o.SettlementRefund == nil {
- ret += "SettlementRefund:<nil>, "
- } else {
- ret += fmt.Sprintf("SettlementRefund:%v, ", *o.SettlementRefund)
- }
- if o.SettlementTotal == nil {
- ret += "SettlementTotal:<nil>, "
- } else {
- ret += fmt.Sprintf("SettlementTotal:%v, ", *o.SettlementTotal)
- }
- if o.DiscountRefund == nil {
- ret += "DiscountRefund:<nil>, "
- } else {
- ret += fmt.Sprintf("DiscountRefund:%v, ", *o.DiscountRefund)
- }
- 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.Refund != nil {
- ret.Refund = new(int64)
- *ret.Refund = *o.Refund
- }
- if o.From != nil {
- ret.From = make([]FundsFromItem, len(o.From))
- for i, item := range o.From {
- ret.From[i] = *item.Clone()
- }
- }
- if o.PayerTotal != nil {
- ret.PayerTotal = new(int64)
- *ret.PayerTotal = *o.PayerTotal
- }
- if o.PayerRefund != nil {
- ret.PayerRefund = new(int64)
- *ret.PayerRefund = *o.PayerRefund
- }
- if o.SettlementRefund != nil {
- ret.SettlementRefund = new(int64)
- *ret.SettlementRefund = *o.SettlementRefund
- }
- if o.SettlementTotal != nil {
- ret.SettlementTotal = new(int64)
- *ret.SettlementTotal = *o.SettlementTotal
- }
- if o.DiscountRefund != nil {
- ret.DiscountRefund = new(int64)
- *ret.DiscountRefund = *o.DiscountRefund
- }
- if o.Currency != nil {
- ret.Currency = new(string)
- *ret.Currency = *o.Currency
- }
- return &ret
- }
- type AmountReq struct {
-
- Refund *int64 `json:"refund"`
-
- From []FundsFromItem `json:"from,omitempty"`
-
- Total *int64 `json:"total"`
-
- Currency *string `json:"currency"`
- }
- func (o AmountReq) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Refund == nil {
- return nil, fmt.Errorf("field `Refund` is required and must be specified in AmountReq")
- }
- toSerialize["refund"] = o.Refund
- if o.From != nil {
- toSerialize["from"] = o.From
- }
- if o.Total == nil {
- return nil, fmt.Errorf("field `Total` is required and must be specified in AmountReq")
- }
- toSerialize["total"] = o.Total
- if o.Currency == nil {
- return nil, fmt.Errorf("field `Currency` is required and must be specified in AmountReq")
- }
- toSerialize["currency"] = o.Currency
- return json.Marshal(toSerialize)
- }
- func (o AmountReq) String() string {
- var ret string
- if o.Refund == nil {
- ret += "Refund:<nil>, "
- } else {
- ret += fmt.Sprintf("Refund:%v, ", *o.Refund)
- }
- ret += fmt.Sprintf("From:%v, ", o.From)
- 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("AmountReq{%s}", ret)
- }
- func (o AmountReq) Clone() *AmountReq {
- ret := AmountReq{}
- if o.Refund != nil {
- ret.Refund = new(int64)
- *ret.Refund = *o.Refund
- }
- if o.From != nil {
- ret.From = make([]FundsFromItem, len(o.From))
- for i, item := range o.From {
- ret.From[i] = *item.Clone()
- }
- }
- 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
- }
- type Channel string
- func (e Channel) Ptr() *Channel {
- return &e
- }
- const (
- CHANNEL_ORIGINAL Channel = "ORIGINAL"
- CHANNEL_BALANCE Channel = "BALANCE"
- CHANNEL_OTHER_BALANCE Channel = "OTHER_BALANCE"
- CHANNEL_OTHER_BANKCARD Channel = "OTHER_BANKCARD"
- )
- type CreateRequest struct {
-
- SubMchid *string `json:"sub_mchid,omitempty"`
-
- TransactionId *string `json:"transaction_id,omitempty"`
-
- OutTradeNo *string `json:"out_trade_no,omitempty"`
-
- OutRefundNo *string `json:"out_refund_no"`
-
- Reason *string `json:"reason,omitempty"`
-
- NotifyUrl *string `json:"notify_url,omitempty"`
-
- FundsAccount *ReqFundsAccount `json:"funds_account,omitempty"`
-
- Amount *AmountReq `json:"amount"`
-
- GoodsDetail []GoodsDetail `json:"goods_detail,omitempty"`
-
- MchId *string `json:"mchid,omitempty"`
- AppId *string `json:"appid,omitempty"`
- }
- func (o CreateRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.MchId != nil {
- toSerialize["mchid"] = o.MchId
- }
- if o.AppId != nil {
- toSerialize["appid"] = o.AppId
- }
- if o.SubMchid != nil {
- toSerialize["sub_mchid"] = o.SubMchid
- }
- if o.TransactionId != nil {
- toSerialize["transaction_id"] = o.TransactionId
- }
- if o.OutTradeNo != nil {
- toSerialize["out_trade_no"] = o.OutTradeNo
- }
- if o.OutRefundNo == nil {
- return nil, fmt.Errorf("field `OutRefundNo` is required and must be specified in CreateRequest")
- }
- toSerialize["out_refund_no"] = o.OutRefundNo
- if o.Reason != nil {
- toSerialize["reason"] = o.Reason
- }
- if o.NotifyUrl != nil {
- toSerialize["notify_url"] = o.NotifyUrl
- }
- if o.FundsAccount != nil {
- toSerialize["funds_account"] = o.FundsAccount
- }
- if o.Amount == nil {
- return nil, fmt.Errorf("field `Amount` is required and must be specified in CreateRequest")
- }
- toSerialize["amount"] = o.Amount
- if o.GoodsDetail != nil {
- toSerialize["goods_detail"] = o.GoodsDetail
- }
- return json.Marshal(toSerialize)
- }
- func (o CreateRequest) String() string {
- var ret string
- if o.SubMchid == nil {
- ret += "SubMchid:<nil>, "
- } else {
- ret += fmt.Sprintf("SubMchid:%v, ", *o.SubMchid)
- }
- 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.TransactionId == nil {
- ret += "TransactionId:<nil>, "
- } else {
- ret += fmt.Sprintf("TransactionId:%v, ", *o.TransactionId)
- }
- if o.OutTradeNo == nil {
- ret += "OutTradeNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
- }
- if o.OutRefundNo == nil {
- ret += "OutRefundNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutRefundNo:%v, ", *o.OutRefundNo)
- }
- if o.Reason == nil {
- ret += "Reason:<nil>, "
- } else {
- ret += fmt.Sprintf("Reason:%v, ", *o.Reason)
- }
- if o.NotifyUrl == nil {
- ret += "NotifyUrl:<nil>, "
- } else {
- ret += fmt.Sprintf("NotifyUrl:%v, ", *o.NotifyUrl)
- }
- if o.FundsAccount == nil {
- ret += "FundsAccount:<nil>, "
- } else {
- ret += fmt.Sprintf("FundsAccount:%v, ", *o.FundsAccount)
- }
- ret += fmt.Sprintf("Amount:%v, ", o.Amount)
- ret += fmt.Sprintf("GoodsDetail:%v", o.GoodsDetail)
- return fmt.Sprintf("CreateRequest{%s}", ret)
- }
- func (o CreateRequest) Clone() *CreateRequest {
- ret := CreateRequest{}
- if o.MchId != nil {
- ret.MchId = new(string)
- *ret.MchId = *o.MchId
- }
- if o.AppId != nil {
- ret.AppId = new(string)
- *ret.AppId = *o.AppId
- }
- if o.SubMchid != nil {
- ret.SubMchid = new(string)
- *ret.SubMchid = *o.SubMchid
- }
- if o.TransactionId != nil {
- ret.TransactionId = new(string)
- *ret.TransactionId = *o.TransactionId
- }
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- if o.OutRefundNo != nil {
- ret.OutRefundNo = new(string)
- *ret.OutRefundNo = *o.OutRefundNo
- }
- if o.Reason != nil {
- ret.Reason = new(string)
- *ret.Reason = *o.Reason
- }
- if o.NotifyUrl != nil {
- ret.NotifyUrl = new(string)
- *ret.NotifyUrl = *o.NotifyUrl
- }
- if o.FundsAccount != nil {
- ret.FundsAccount = new(ReqFundsAccount)
- *ret.FundsAccount = *o.FundsAccount
- }
- if o.Amount != nil {
- ret.Amount = o.Amount.Clone()
- }
- if o.GoodsDetail != nil {
- ret.GoodsDetail = make([]GoodsDetail, len(o.GoodsDetail))
- for i, item := range o.GoodsDetail {
- ret.GoodsDetail[i] = *item.Clone()
- }
- }
- return &ret
- }
- type FundsAccount string
- func (e FundsAccount) Ptr() *FundsAccount {
- return &e
- }
- const (
- FUNDSACCOUNT_UNSETTLED FundsAccount = "UNSETTLED"
- FUNDSACCOUNT_AVAILABLE FundsAccount = "AVAILABLE"
- FUNDSACCOUNT_UNAVAILABLE FundsAccount = "UNAVAILABLE"
- FUNDSACCOUNT_OPERATION FundsAccount = "OPERATION"
- FUNDSACCOUNT_BASIC FundsAccount = "BASIC"
- )
- type FundsFromItem struct {
-
- Account *Account `json:"account"`
-
- Amount *int64 `json:"amount"`
- }
- func (o FundsFromItem) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.Account == nil {
- return nil, fmt.Errorf("field `Account` is required and must be specified in FundsFromItem")
- }
- toSerialize["account"] = o.Account
- if o.Amount == nil {
- return nil, fmt.Errorf("field `Amount` is required and must be specified in FundsFromItem")
- }
- toSerialize["amount"] = o.Amount
- return json.Marshal(toSerialize)
- }
- func (o FundsFromItem) String() string {
- var ret string
- if o.Account == nil {
- ret += "Account:<nil>, "
- } else {
- ret += fmt.Sprintf("Account:%v, ", *o.Account)
- }
- if o.Amount == nil {
- ret += "Amount:<nil>"
- } else {
- ret += fmt.Sprintf("Amount:%v", *o.Amount)
- }
- return fmt.Sprintf("FundsFromItem{%s}", ret)
- }
- func (o FundsFromItem) Clone() *FundsFromItem {
- ret := FundsFromItem{}
- if o.Account != nil {
- ret.Account = new(Account)
- *ret.Account = *o.Account
- }
- if o.Amount != nil {
- ret.Amount = new(int64)
- *ret.Amount = *o.Amount
- }
- return &ret
- }
- type GoodsDetail struct {
-
- MerchantGoodsId *string `json:"merchant_goods_id"`
-
- WechatpayGoodsId *string `json:"wechatpay_goods_id,omitempty"`
-
- GoodsName *string `json:"goods_name,omitempty"`
-
- UnitPrice *int64 `json:"unit_price"`
-
- RefundAmount *int64 `json:"refund_amount"`
-
- RefundQuantity *int64 `json:"refund_quantity"`
- }
- func (o GoodsDetail) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.MerchantGoodsId == nil {
- return nil, fmt.Errorf("field `MerchantGoodsId` is required and must be specified in GoodsDetail")
- }
- toSerialize["merchant_goods_id"] = o.MerchantGoodsId
- if o.WechatpayGoodsId != nil {
- toSerialize["wechatpay_goods_id"] = o.WechatpayGoodsId
- }
- if o.GoodsName != nil {
- toSerialize["goods_name"] = o.GoodsName
- }
- if o.UnitPrice == nil {
- return nil, fmt.Errorf("field `UnitPrice` is required and must be specified in GoodsDetail")
- }
- toSerialize["unit_price"] = o.UnitPrice
- if o.RefundAmount == nil {
- return nil, fmt.Errorf("field `RefundAmount` is required and must be specified in GoodsDetail")
- }
- toSerialize["refund_amount"] = o.RefundAmount
- if o.RefundQuantity == nil {
- return nil, fmt.Errorf("field `RefundQuantity` is required and must be specified in GoodsDetail")
- }
- toSerialize["refund_quantity"] = o.RefundQuantity
- return json.Marshal(toSerialize)
- }
- func (o GoodsDetail) String() string {
- var ret string
- if o.MerchantGoodsId == nil {
- ret += "MerchantGoodsId:<nil>, "
- } else {
- ret += fmt.Sprintf("MerchantGoodsId:%v, ", *o.MerchantGoodsId)
- }
- 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.UnitPrice == nil {
- ret += "UnitPrice:<nil>, "
- } else {
- ret += fmt.Sprintf("UnitPrice:%v, ", *o.UnitPrice)
- }
- if o.RefundAmount == nil {
- ret += "RefundAmount:<nil>, "
- } else {
- ret += fmt.Sprintf("RefundAmount:%v, ", *o.RefundAmount)
- }
- if o.RefundQuantity == nil {
- ret += "RefundQuantity:<nil>"
- } else {
- ret += fmt.Sprintf("RefundQuantity:%v", *o.RefundQuantity)
- }
- return fmt.Sprintf("GoodsDetail{%s}", ret)
- }
- func (o GoodsDetail) Clone() *GoodsDetail {
- ret := GoodsDetail{}
- if o.MerchantGoodsId != nil {
- ret.MerchantGoodsId = new(string)
- *ret.MerchantGoodsId = *o.MerchantGoodsId
- }
- 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.UnitPrice != nil {
- ret.UnitPrice = new(int64)
- *ret.UnitPrice = *o.UnitPrice
- }
- if o.RefundAmount != nil {
- ret.RefundAmount = new(int64)
- *ret.RefundAmount = *o.RefundAmount
- }
- if o.RefundQuantity != nil {
- ret.RefundQuantity = new(int64)
- *ret.RefundQuantity = *o.RefundQuantity
- }
- return &ret
- }
- type Promotion struct {
-
- PromotionId *string `json:"promotion_id"`
-
- Scope *Scope `json:"scope"`
-
- Type *Type `json:"type"`
-
- Amount *int64 `json:"amount"`
-
- RefundAmount *int64 `json:"refund_amount"`
-
- GoodsDetail []GoodsDetail `json:"goods_detail,omitempty"`
- }
- func (o Promotion) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.PromotionId == nil {
- return nil, fmt.Errorf("field `PromotionId` is required and must be specified in Promotion")
- }
- toSerialize["promotion_id"] = o.PromotionId
- if o.Scope == nil {
- return nil, fmt.Errorf("field `Scope` is required and must be specified in Promotion")
- }
- toSerialize["scope"] = o.Scope
- if o.Type == nil {
- return nil, fmt.Errorf("field `Type` is required and must be specified in Promotion")
- }
- toSerialize["type"] = o.Type
- if o.Amount == nil {
- return nil, fmt.Errorf("field `Amount` is required and must be specified in Promotion")
- }
- toSerialize["amount"] = o.Amount
- if o.RefundAmount == nil {
- return nil, fmt.Errorf("field `RefundAmount` is required and must be specified in Promotion")
- }
- toSerialize["refund_amount"] = o.RefundAmount
- if o.GoodsDetail != nil {
- toSerialize["goods_detail"] = o.GoodsDetail
- }
- return json.Marshal(toSerialize)
- }
- func (o Promotion) String() string {
- var ret string
- if o.PromotionId == nil {
- ret += "PromotionId:<nil>, "
- } else {
- ret += fmt.Sprintf("PromotionId:%v, ", *o.PromotionId)
- }
- 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.Amount == nil {
- ret += "Amount:<nil>, "
- } else {
- ret += fmt.Sprintf("Amount:%v, ", *o.Amount)
- }
- if o.RefundAmount == nil {
- ret += "RefundAmount:<nil>, "
- } else {
- ret += fmt.Sprintf("RefundAmount:%v, ", *o.RefundAmount)
- }
- ret += fmt.Sprintf("GoodsDetail:%v", o.GoodsDetail)
- return fmt.Sprintf("Promotion{%s}", ret)
- }
- func (o Promotion) Clone() *Promotion {
- ret := Promotion{}
- if o.PromotionId != nil {
- ret.PromotionId = new(string)
- *ret.PromotionId = *o.PromotionId
- }
- if o.Scope != nil {
- ret.Scope = new(Scope)
- *ret.Scope = *o.Scope
- }
- if o.Type != nil {
- ret.Type = new(Type)
- *ret.Type = *o.Type
- }
- if o.Amount != nil {
- ret.Amount = new(int64)
- *ret.Amount = *o.Amount
- }
- if o.RefundAmount != nil {
- ret.RefundAmount = new(int64)
- *ret.RefundAmount = *o.RefundAmount
- }
- if o.GoodsDetail != nil {
- ret.GoodsDetail = make([]GoodsDetail, len(o.GoodsDetail))
- for i, item := range o.GoodsDetail {
- ret.GoodsDetail[i] = *item.Clone()
- }
- }
- return &ret
- }
- type QueryByOutRefundNoRequest struct {
-
- OutRefundNo *string `json:"out_refund_no"`
-
- SubMchid *string `json:"sub_mchid,omitempty"`
- }
- func (o QueryByOutRefundNoRequest) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.OutRefundNo == nil {
- return nil, fmt.Errorf("field `OutRefundNo` is required and must be specified in QueryByOutRefundNoRequest")
- }
- toSerialize["out_refund_no"] = o.OutRefundNo
- if o.SubMchid != nil {
- toSerialize["sub_mchid"] = o.SubMchid
- }
- return json.Marshal(toSerialize)
- }
- func (o QueryByOutRefundNoRequest) String() string {
- var ret string
- if o.OutRefundNo == nil {
- ret += "OutRefundNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutRefundNo:%v, ", *o.OutRefundNo)
- }
- if o.SubMchid == nil {
- ret += "SubMchid:<nil>"
- } else {
- ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
- }
- return fmt.Sprintf("QueryByOutRefundNoRequest{%s}", ret)
- }
- func (o QueryByOutRefundNoRequest) Clone() *QueryByOutRefundNoRequest {
- ret := QueryByOutRefundNoRequest{}
- if o.OutRefundNo != nil {
- ret.OutRefundNo = new(string)
- *ret.OutRefundNo = *o.OutRefundNo
- }
- if o.SubMchid != nil {
- ret.SubMchid = new(string)
- *ret.SubMchid = *o.SubMchid
- }
- return &ret
- }
- type Refund struct {
-
- RefundId *string `json:"refund_id"`
-
- OutRefundNo *string `json:"out_refund_no"`
-
- TransactionId *string `json:"transaction_id"`
-
- OutTradeNo *string `json:"out_trade_no"`
-
- Channel *Channel `json:"channel"`
-
- UserReceivedAccount *string `json:"user_received_account"`
-
- SuccessTime *time.Time `json:"success_time,omitempty"`
-
- CreateTime *time.Time `json:"create_time"`
-
- Status *Status `json:"status"`
-
- FundsAccount *FundsAccount `json:"funds_account,omitempty"`
-
- Amount *Amount `json:"amount"`
-
- PromotionDetail []Promotion `json:"promotion_detail,omitempty"`
- }
- func (o Refund) MarshalJSON() ([]byte, error) {
- toSerialize := map[string]interface{}{}
- if o.RefundId == nil {
- return nil, fmt.Errorf("field `RefundId` is required and must be specified in Refund")
- }
- toSerialize["refund_id"] = o.RefundId
- if o.OutRefundNo == nil {
- return nil, fmt.Errorf("field `OutRefundNo` is required and must be specified in Refund")
- }
- toSerialize["out_refund_no"] = o.OutRefundNo
- if o.TransactionId == nil {
- return nil, fmt.Errorf("field `TransactionId` is required and must be specified in Refund")
- }
- toSerialize["transaction_id"] = o.TransactionId
- if o.OutTradeNo == nil {
- return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in Refund")
- }
- toSerialize["out_trade_no"] = o.OutTradeNo
- if o.Channel == nil {
- return nil, fmt.Errorf("field `Channel` is required and must be specified in Refund")
- }
- toSerialize["channel"] = o.Channel
- if o.UserReceivedAccount == nil {
- return nil, fmt.Errorf("field `UserReceivedAccount` is required and must be specified in Refund")
- }
- toSerialize["user_received_account"] = o.UserReceivedAccount
- if o.SuccessTime != nil {
- toSerialize["success_time"] = o.SuccessTime.Format(time.RFC3339)
- }
- if o.CreateTime == nil {
- return nil, fmt.Errorf("field `CreateTime` is required and must be specified in Refund")
- }
- toSerialize["create_time"] = o.CreateTime.Format(time.RFC3339)
- if o.Status == nil {
- return nil, fmt.Errorf("field `Status` is required and must be specified in Refund")
- }
- toSerialize["status"] = o.Status
- if o.FundsAccount != nil {
- toSerialize["funds_account"] = o.FundsAccount
- }
- if o.Amount == nil {
- return nil, fmt.Errorf("field `Amount` is required and must be specified in Refund")
- }
- toSerialize["amount"] = o.Amount
- if o.PromotionDetail != nil {
- toSerialize["promotion_detail"] = o.PromotionDetail
- }
- return json.Marshal(toSerialize)
- }
- func (o Refund) String() string {
- var ret string
- if o.RefundId == nil {
- ret += "RefundId:<nil>, "
- } else {
- ret += fmt.Sprintf("RefundId:%v, ", *o.RefundId)
- }
- if o.OutRefundNo == nil {
- ret += "OutRefundNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutRefundNo:%v, ", *o.OutRefundNo)
- }
- if o.TransactionId == nil {
- ret += "TransactionId:<nil>, "
- } else {
- ret += fmt.Sprintf("TransactionId:%v, ", *o.TransactionId)
- }
- if o.OutTradeNo == nil {
- ret += "OutTradeNo:<nil>, "
- } else {
- ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
- }
- if o.Channel == nil {
- ret += "Channel:<nil>, "
- } else {
- ret += fmt.Sprintf("Channel:%v, ", *o.Channel)
- }
- if o.UserReceivedAccount == nil {
- ret += "UserReceivedAccount:<nil>, "
- } else {
- ret += fmt.Sprintf("UserReceivedAccount:%v, ", *o.UserReceivedAccount)
- }
- if o.SuccessTime == nil {
- ret += "SuccessTime:<nil>, "
- } else {
- ret += fmt.Sprintf("SuccessTime:%v, ", *o.SuccessTime)
- }
- if o.CreateTime == nil {
- ret += "CreateTime:<nil>, "
- } else {
- ret += fmt.Sprintf("CreateTime:%v, ", *o.CreateTime)
- }
- if o.Status == nil {
- ret += "Status:<nil>, "
- } else {
- ret += fmt.Sprintf("Status:%v, ", *o.Status)
- }
- if o.FundsAccount == nil {
- ret += "FundsAccount:<nil>, "
- } else {
- ret += fmt.Sprintf("FundsAccount:%v, ", *o.FundsAccount)
- }
- ret += fmt.Sprintf("Amount:%v, ", o.Amount)
- ret += fmt.Sprintf("PromotionDetail:%v", o.PromotionDetail)
- return fmt.Sprintf("Refund{%s}", ret)
- }
- func (o Refund) Clone() *Refund {
- ret := Refund{}
- if o.RefundId != nil {
- ret.RefundId = new(string)
- *ret.RefundId = *o.RefundId
- }
- if o.OutRefundNo != nil {
- ret.OutRefundNo = new(string)
- *ret.OutRefundNo = *o.OutRefundNo
- }
- if o.TransactionId != nil {
- ret.TransactionId = new(string)
- *ret.TransactionId = *o.TransactionId
- }
- if o.OutTradeNo != nil {
- ret.OutTradeNo = new(string)
- *ret.OutTradeNo = *o.OutTradeNo
- }
- if o.Channel != nil {
- ret.Channel = new(Channel)
- *ret.Channel = *o.Channel
- }
- if o.UserReceivedAccount != nil {
- ret.UserReceivedAccount = new(string)
- *ret.UserReceivedAccount = *o.UserReceivedAccount
- }
- if o.SuccessTime != nil {
- ret.SuccessTime = new(time.Time)
- *ret.SuccessTime = *o.SuccessTime
- }
- if o.CreateTime != nil {
- ret.CreateTime = new(time.Time)
- *ret.CreateTime = *o.CreateTime
- }
- if o.Status != nil {
- ret.Status = new(Status)
- *ret.Status = *o.Status
- }
- if o.FundsAccount != nil {
- ret.FundsAccount = new(FundsAccount)
- *ret.FundsAccount = *o.FundsAccount
- }
- if o.Amount != nil {
- ret.Amount = o.Amount.Clone()
- }
- if o.PromotionDetail != nil {
- ret.PromotionDetail = make([]Promotion, len(o.PromotionDetail))
- for i, item := range o.PromotionDetail {
- ret.PromotionDetail[i] = *item.Clone()
- }
- }
- return &ret
- }
- type ReqFundsAccount string
- func (e ReqFundsAccount) Ptr() *ReqFundsAccount {
- return &e
- }
- const (
- REQFUNDSACCOUNT_AVAILABLE ReqFundsAccount = "AVAILABLE"
- )
- type Scope string
- func (e Scope) Ptr() *Scope {
- return &e
- }
- const (
- SCOPE_GLOBAL Scope = "GLOBAL"
- SCOPE_SINGLE Scope = "SINGLE"
- )
- type Status string
- func (e Status) Ptr() *Status {
- return &e
- }
- const (
- STATUS_SUCCESS Status = "SUCCESS"
- STATUS_CLOSED Status = "CLOSED"
- STATUS_PROCESSING Status = "PROCESSING"
- STATUS_ABNORMAL Status = "ABNORMAL"
- )
- type Type string
- func (e Type) Ptr() *Type {
- return &e
- }
- const (
- TYPE_COUPON Type = "COUPON"
- TYPE_DISCOUNT Type = "DISCOUNT"
- )
|