models.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029
  1. // Copyright 2021 Tencent Inc. All rights reserved.
  2. //
  3. // Native支付
  4. //
  5. // Native支付API
  6. //
  7. // API version: 1.2.3
  8. // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
  9. package native
  10. import (
  11. "encoding/json"
  12. "fmt"
  13. "time"
  14. )
  15. // Amount
  16. type Amount struct {
  17. // 订单总金额,单位为分
  18. Total *int64 `json:"total"`
  19. // CNY:人民币,境内商户号仅支持人民币。
  20. Currency *string `json:"currency,omitempty"`
  21. }
  22. func (o Amount) MarshalJSON() ([]byte, error) {
  23. toSerialize := map[string]interface{}{}
  24. if o.Total == nil {
  25. return nil, fmt.Errorf("field `Total` is required and must be specified in Amount")
  26. }
  27. toSerialize["total"] = o.Total
  28. if o.Currency != nil {
  29. toSerialize["currency"] = o.Currency
  30. }
  31. return json.Marshal(toSerialize)
  32. }
  33. func (o Amount) String() string {
  34. var ret string
  35. if o.Total == nil {
  36. ret += "Total:<nil>, "
  37. } else {
  38. ret += fmt.Sprintf("Total:%v, ", *o.Total)
  39. }
  40. if o.Currency == nil {
  41. ret += "Currency:<nil>"
  42. } else {
  43. ret += fmt.Sprintf("Currency:%v", *o.Currency)
  44. }
  45. return fmt.Sprintf("Amount{%s}", ret)
  46. }
  47. func (o Amount) Clone() *Amount {
  48. ret := Amount{}
  49. if o.Total != nil {
  50. ret.Total = new(int64)
  51. *ret.Total = *o.Total
  52. }
  53. if o.Currency != nil {
  54. ret.Currency = new(string)
  55. *ret.Currency = *o.Currency
  56. }
  57. return &ret
  58. }
  59. // CloseOrderRequest
  60. type CloseOrderRequest struct {
  61. // 商户订单号
  62. OutTradeNo *string `json:"out_trade_no"`
  63. // 服务商户号,由微信支付生成并下发
  64. SpMchid *string `json:"sp_mchid"`
  65. // 子商户的商户号,由微信支付生成并下发
  66. SubMchid *string `json:"sub_mchid"`
  67. }
  68. func (o CloseOrderRequest) MarshalJSON() ([]byte, error) {
  69. toSerialize := map[string]interface{}{}
  70. if o.OutTradeNo == nil {
  71. return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in CloseOrderRequest")
  72. }
  73. toSerialize["out_trade_no"] = o.OutTradeNo
  74. if o.SpMchid == nil {
  75. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in CloseOrderRequest")
  76. }
  77. toSerialize["sp_mchid"] = o.SpMchid
  78. if o.SubMchid == nil {
  79. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in CloseOrderRequest")
  80. }
  81. toSerialize["sub_mchid"] = o.SubMchid
  82. return json.Marshal(toSerialize)
  83. }
  84. func (o CloseOrderRequest) String() string {
  85. var ret string
  86. if o.OutTradeNo == nil {
  87. ret += "OutTradeNo:<nil>, "
  88. } else {
  89. ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
  90. }
  91. if o.SpMchid == nil {
  92. ret += "SpMchid:<nil>, "
  93. } else {
  94. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  95. }
  96. if o.SubMchid == nil {
  97. ret += "SubMchid:<nil>"
  98. } else {
  99. ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
  100. }
  101. return fmt.Sprintf("CloseOrderRequest{%s}", ret)
  102. }
  103. func (o CloseOrderRequest) Clone() *CloseOrderRequest {
  104. ret := CloseOrderRequest{}
  105. if o.OutTradeNo != nil {
  106. ret.OutTradeNo = new(string)
  107. *ret.OutTradeNo = *o.OutTradeNo
  108. }
  109. if o.SpMchid != nil {
  110. ret.SpMchid = new(string)
  111. *ret.SpMchid = *o.SpMchid
  112. }
  113. if o.SubMchid != nil {
  114. ret.SubMchid = new(string)
  115. *ret.SubMchid = *o.SubMchid
  116. }
  117. return &ret
  118. }
  119. // CloseRequest
  120. type CloseRequest struct {
  121. // 服务商户号,由微信支付生成并下发
  122. SpMchid *string `json:"sp_mchid"`
  123. // 子商户的商户号,由微信支付生成并下发
  124. SubMchid *string `json:"sub_mchid"`
  125. }
  126. func (o CloseRequest) MarshalJSON() ([]byte, error) {
  127. toSerialize := map[string]interface{}{}
  128. if o.SpMchid == nil {
  129. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in CloseRequest")
  130. }
  131. toSerialize["sp_mchid"] = o.SpMchid
  132. if o.SubMchid == nil {
  133. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in CloseRequest")
  134. }
  135. toSerialize["sub_mchid"] = o.SubMchid
  136. return json.Marshal(toSerialize)
  137. }
  138. func (o CloseRequest) String() string {
  139. var ret string
  140. if o.SpMchid == nil {
  141. ret += "SpMchid:<nil>, "
  142. } else {
  143. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  144. }
  145. if o.SubMchid == nil {
  146. ret += "SubMchid:<nil>"
  147. } else {
  148. ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
  149. }
  150. return fmt.Sprintf("CloseRequest{%s}", ret)
  151. }
  152. func (o CloseRequest) Clone() *CloseRequest {
  153. ret := CloseRequest{}
  154. if o.SpMchid != nil {
  155. ret.SpMchid = new(string)
  156. *ret.SpMchid = *o.SpMchid
  157. }
  158. if o.SubMchid != nil {
  159. ret.SubMchid = new(string)
  160. *ret.SubMchid = *o.SubMchid
  161. }
  162. return &ret
  163. }
  164. // Detail 优惠功能
  165. type Detail struct {
  166. // 1.商户侧一张小票订单可能被分多次支付,订单原价用于记录整张小票的交易金额。 2.当订单原价与支付金额不相等,则不享受优惠。 3.该字段主要用于防止同一张小票分多次支付,以享受多次优惠的情况,正常支付订单不必上传此参数。
  167. CostPrice *int64 `json:"cost_price,omitempty"`
  168. // 商家小票ID。
  169. InvoiceId *string `json:"invoice_id,omitempty"`
  170. GoodsDetail []GoodsDetail `json:"goods_detail,omitempty"`
  171. }
  172. func (o Detail) MarshalJSON() ([]byte, error) {
  173. toSerialize := map[string]interface{}{}
  174. if o.CostPrice != nil {
  175. toSerialize["cost_price"] = o.CostPrice
  176. }
  177. if o.InvoiceId != nil {
  178. toSerialize["invoice_id"] = o.InvoiceId
  179. }
  180. if o.GoodsDetail != nil {
  181. toSerialize["goods_detail"] = o.GoodsDetail
  182. }
  183. return json.Marshal(toSerialize)
  184. }
  185. func (o Detail) String() string {
  186. var ret string
  187. if o.CostPrice == nil {
  188. ret += "CostPrice:<nil>, "
  189. } else {
  190. ret += fmt.Sprintf("CostPrice:%v, ", *o.CostPrice)
  191. }
  192. if o.InvoiceId == nil {
  193. ret += "InvoiceId:<nil>, "
  194. } else {
  195. ret += fmt.Sprintf("InvoiceId:%v, ", *o.InvoiceId)
  196. }
  197. ret += fmt.Sprintf("GoodsDetail:%v", o.GoodsDetail)
  198. return fmt.Sprintf("Detail{%s}", ret)
  199. }
  200. func (o Detail) Clone() *Detail {
  201. ret := Detail{}
  202. if o.CostPrice != nil {
  203. ret.CostPrice = new(int64)
  204. *ret.CostPrice = *o.CostPrice
  205. }
  206. if o.InvoiceId != nil {
  207. ret.InvoiceId = new(string)
  208. *ret.InvoiceId = *o.InvoiceId
  209. }
  210. if o.GoodsDetail != nil {
  211. ret.GoodsDetail = make([]GoodsDetail, len(o.GoodsDetail))
  212. for i, item := range o.GoodsDetail {
  213. ret.GoodsDetail[i] = *item.Clone()
  214. }
  215. }
  216. return &ret
  217. }
  218. // GoodsDetail
  219. type GoodsDetail struct {
  220. // 由半角的大小写字母、数字、中划线、下划线中的一种或几种组成。
  221. MerchantGoodsId *string `json:"merchant_goods_id"`
  222. // 微信支付定义的统一商品编号(没有可不传)。
  223. WechatpayGoodsId *string `json:"wechatpay_goods_id,omitempty"`
  224. // 商品的实际名称。
  225. GoodsName *string `json:"goods_name,omitempty"`
  226. // 用户购买的数量。
  227. Quantity *int64 `json:"quantity"`
  228. // 商品单价,单位为分。
  229. UnitPrice *int64 `json:"unit_price"`
  230. }
  231. func (o GoodsDetail) MarshalJSON() ([]byte, error) {
  232. toSerialize := map[string]interface{}{}
  233. if o.MerchantGoodsId == nil {
  234. return nil, fmt.Errorf("field `MerchantGoodsId` is required and must be specified in GoodsDetail")
  235. }
  236. toSerialize["merchant_goods_id"] = o.MerchantGoodsId
  237. if o.WechatpayGoodsId != nil {
  238. toSerialize["wechatpay_goods_id"] = o.WechatpayGoodsId
  239. }
  240. if o.GoodsName != nil {
  241. toSerialize["goods_name"] = o.GoodsName
  242. }
  243. if o.Quantity == nil {
  244. return nil, fmt.Errorf("field `Quantity` is required and must be specified in GoodsDetail")
  245. }
  246. toSerialize["quantity"] = o.Quantity
  247. if o.UnitPrice == nil {
  248. return nil, fmt.Errorf("field `UnitPrice` is required and must be specified in GoodsDetail")
  249. }
  250. toSerialize["unit_price"] = o.UnitPrice
  251. return json.Marshal(toSerialize)
  252. }
  253. func (o GoodsDetail) String() string {
  254. var ret string
  255. if o.MerchantGoodsId == nil {
  256. ret += "MerchantGoodsId:<nil>, "
  257. } else {
  258. ret += fmt.Sprintf("MerchantGoodsId:%v, ", *o.MerchantGoodsId)
  259. }
  260. if o.WechatpayGoodsId == nil {
  261. ret += "WechatpayGoodsId:<nil>, "
  262. } else {
  263. ret += fmt.Sprintf("WechatpayGoodsId:%v, ", *o.WechatpayGoodsId)
  264. }
  265. if o.GoodsName == nil {
  266. ret += "GoodsName:<nil>, "
  267. } else {
  268. ret += fmt.Sprintf("GoodsName:%v, ", *o.GoodsName)
  269. }
  270. if o.Quantity == nil {
  271. ret += "Quantity:<nil>, "
  272. } else {
  273. ret += fmt.Sprintf("Quantity:%v, ", *o.Quantity)
  274. }
  275. if o.UnitPrice == nil {
  276. ret += "UnitPrice:<nil>"
  277. } else {
  278. ret += fmt.Sprintf("UnitPrice:%v", *o.UnitPrice)
  279. }
  280. return fmt.Sprintf("GoodsDetail{%s}", ret)
  281. }
  282. func (o GoodsDetail) Clone() *GoodsDetail {
  283. ret := GoodsDetail{}
  284. if o.MerchantGoodsId != nil {
  285. ret.MerchantGoodsId = new(string)
  286. *ret.MerchantGoodsId = *o.MerchantGoodsId
  287. }
  288. if o.WechatpayGoodsId != nil {
  289. ret.WechatpayGoodsId = new(string)
  290. *ret.WechatpayGoodsId = *o.WechatpayGoodsId
  291. }
  292. if o.GoodsName != nil {
  293. ret.GoodsName = new(string)
  294. *ret.GoodsName = *o.GoodsName
  295. }
  296. if o.Quantity != nil {
  297. ret.Quantity = new(int64)
  298. *ret.Quantity = *o.Quantity
  299. }
  300. if o.UnitPrice != nil {
  301. ret.UnitPrice = new(int64)
  302. *ret.UnitPrice = *o.UnitPrice
  303. }
  304. return &ret
  305. }
  306. // PrepayRequest
  307. type PrepayRequest struct {
  308. // 服务商申请的公众号appid
  309. SpAppid *string `json:"sp_appid"`
  310. // 服务商户号,由微信支付生成并下发
  311. SpMchid *string `json:"sp_mchid"`
  312. // 子商户申请的公众号appid
  313. SubAppid *string `json:"sub_appid,omitempty"`
  314. // 子商户的商户号,由微信支付生成并下发
  315. SubMchid *string `json:"sub_mchid"`
  316. // 商品描述
  317. Description *string `json:"description"`
  318. // 商户订单号
  319. OutTradeNo *string `json:"out_trade_no"`
  320. // 订单失效时间,格式为rfc3339格式
  321. TimeExpire *time.Time `json:"time_expire,omitempty"`
  322. // 附加数据
  323. Attach *string `json:"attach,omitempty"`
  324. // 有效性:1. HTTPS;2. 不允许携带查询串。
  325. NotifyUrl *string `json:"notify_url"`
  326. // 商品标记,代金券或立减优惠功能的参数。
  327. GoodsTag *string `json:"goods_tag,omitempty"`
  328. // 指定支付方式
  329. LimitPay []string `json:"limit_pay,omitempty"`
  330. // 传入true时,支付成功消息和支付详情页将出现开票入口。需要在微信支付商户平台或微信公众平台开通电子发票功能,传此字段才可生效。
  331. SupportFapiao *bool `json:"support_fapiao,omitempty"`
  332. Amount *Amount `json:"amount"`
  333. Detail *Detail `json:"detail,omitempty"`
  334. SettleInfo *SettleInfo `json:"settle_info,omitempty"`
  335. SceneInfo *SceneInfo `json:"scene_info,omitempty"`
  336. }
  337. func (o PrepayRequest) MarshalJSON() ([]byte, error) {
  338. toSerialize := map[string]interface{}{}
  339. if o.SpAppid == nil {
  340. return nil, fmt.Errorf("field `SpAppid` is required and must be specified in PrepayRequest")
  341. }
  342. toSerialize["sp_appid"] = o.SpAppid
  343. if o.SpMchid == nil {
  344. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in PrepayRequest")
  345. }
  346. toSerialize["sp_mchid"] = o.SpMchid
  347. if o.SubAppid != nil {
  348. toSerialize["sub_appid"] = o.SubAppid
  349. }
  350. if o.SubMchid == nil {
  351. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in PrepayRequest")
  352. }
  353. toSerialize["sub_mchid"] = o.SubMchid
  354. if o.Description == nil {
  355. return nil, fmt.Errorf("field `Description` is required and must be specified in PrepayRequest")
  356. }
  357. toSerialize["description"] = o.Description
  358. if o.OutTradeNo == nil {
  359. return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in PrepayRequest")
  360. }
  361. toSerialize["out_trade_no"] = o.OutTradeNo
  362. if o.TimeExpire != nil {
  363. toSerialize["time_expire"] = o.TimeExpire.Format(time.RFC3339)
  364. }
  365. if o.Attach != nil {
  366. toSerialize["attach"] = o.Attach
  367. }
  368. if o.NotifyUrl == nil {
  369. return nil, fmt.Errorf("field `NotifyUrl` is required and must be specified in PrepayRequest")
  370. }
  371. toSerialize["notify_url"] = o.NotifyUrl
  372. if o.GoodsTag != nil {
  373. toSerialize["goods_tag"] = o.GoodsTag
  374. }
  375. if o.LimitPay != nil {
  376. toSerialize["limit_pay"] = o.LimitPay
  377. }
  378. if o.SupportFapiao != nil {
  379. toSerialize["support_fapiao"] = o.SupportFapiao
  380. }
  381. if o.Amount == nil {
  382. return nil, fmt.Errorf("field `Amount` is required and must be specified in PrepayRequest")
  383. }
  384. toSerialize["amount"] = o.Amount
  385. if o.Detail != nil {
  386. toSerialize["detail"] = o.Detail
  387. }
  388. if o.SettleInfo != nil {
  389. toSerialize["settle_info"] = o.SettleInfo
  390. }
  391. if o.SceneInfo != nil {
  392. toSerialize["scene_info"] = o.SceneInfo
  393. }
  394. return json.Marshal(toSerialize)
  395. }
  396. func (o PrepayRequest) String() string {
  397. var ret string
  398. if o.SpAppid == nil {
  399. ret += "SpAppid:<nil>, "
  400. } else {
  401. ret += fmt.Sprintf("SpAppid:%v, ", *o.SpAppid)
  402. }
  403. if o.SpMchid == nil {
  404. ret += "SpMchid:<nil>, "
  405. } else {
  406. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  407. }
  408. if o.SubAppid == nil {
  409. ret += "SubAppid:<nil>, "
  410. } else {
  411. ret += fmt.Sprintf("SubAppid:%v, ", *o.SubAppid)
  412. }
  413. if o.SubMchid == nil {
  414. ret += "SubMchid:<nil>, "
  415. } else {
  416. ret += fmt.Sprintf("SubMchid:%v, ", *o.SubMchid)
  417. }
  418. if o.Description == nil {
  419. ret += "Description:<nil>, "
  420. } else {
  421. ret += fmt.Sprintf("Description:%v, ", *o.Description)
  422. }
  423. if o.OutTradeNo == nil {
  424. ret += "OutTradeNo:<nil>, "
  425. } else {
  426. ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
  427. }
  428. if o.TimeExpire == nil {
  429. ret += "TimeExpire:<nil>, "
  430. } else {
  431. ret += fmt.Sprintf("TimeExpire:%v, ", *o.TimeExpire)
  432. }
  433. if o.Attach == nil {
  434. ret += "Attach:<nil>, "
  435. } else {
  436. ret += fmt.Sprintf("Attach:%v, ", *o.Attach)
  437. }
  438. if o.NotifyUrl == nil {
  439. ret += "NotifyUrl:<nil>, "
  440. } else {
  441. ret += fmt.Sprintf("NotifyUrl:%v, ", *o.NotifyUrl)
  442. }
  443. if o.GoodsTag == nil {
  444. ret += "GoodsTag:<nil>, "
  445. } else {
  446. ret += fmt.Sprintf("GoodsTag:%v, ", *o.GoodsTag)
  447. }
  448. ret += fmt.Sprintf("LimitPay:%v, ", o.LimitPay)
  449. if o.SupportFapiao == nil {
  450. ret += "SupportFapiao:<nil>, "
  451. } else {
  452. ret += fmt.Sprintf("SupportFapiao:%v, ", *o.SupportFapiao)
  453. }
  454. ret += fmt.Sprintf("Amount:%v, ", o.Amount)
  455. ret += fmt.Sprintf("Detail:%v, ", o.Detail)
  456. ret += fmt.Sprintf("SettleInfo:%v, ", o.SettleInfo)
  457. ret += fmt.Sprintf("SceneInfo:%v", o.SceneInfo)
  458. return fmt.Sprintf("PrepayRequest{%s}", ret)
  459. }
  460. func (o PrepayRequest) Clone() *PrepayRequest {
  461. ret := PrepayRequest{}
  462. if o.SpAppid != nil {
  463. ret.SpAppid = new(string)
  464. *ret.SpAppid = *o.SpAppid
  465. }
  466. if o.SpMchid != nil {
  467. ret.SpMchid = new(string)
  468. *ret.SpMchid = *o.SpMchid
  469. }
  470. if o.SubAppid != nil {
  471. ret.SubAppid = new(string)
  472. *ret.SubAppid = *o.SubAppid
  473. }
  474. if o.SubMchid != nil {
  475. ret.SubMchid = new(string)
  476. *ret.SubMchid = *o.SubMchid
  477. }
  478. if o.Description != nil {
  479. ret.Description = new(string)
  480. *ret.Description = *o.Description
  481. }
  482. if o.OutTradeNo != nil {
  483. ret.OutTradeNo = new(string)
  484. *ret.OutTradeNo = *o.OutTradeNo
  485. }
  486. if o.TimeExpire != nil {
  487. ret.TimeExpire = new(time.Time)
  488. *ret.TimeExpire = *o.TimeExpire
  489. }
  490. if o.Attach != nil {
  491. ret.Attach = new(string)
  492. *ret.Attach = *o.Attach
  493. }
  494. if o.NotifyUrl != nil {
  495. ret.NotifyUrl = new(string)
  496. *ret.NotifyUrl = *o.NotifyUrl
  497. }
  498. if o.GoodsTag != nil {
  499. ret.GoodsTag = new(string)
  500. *ret.GoodsTag = *o.GoodsTag
  501. }
  502. if o.LimitPay != nil {
  503. ret.LimitPay = make([]string, len(o.LimitPay))
  504. for i, item := range o.LimitPay {
  505. ret.LimitPay[i] = item
  506. }
  507. }
  508. if o.SupportFapiao != nil {
  509. ret.SupportFapiao = new(bool)
  510. *ret.SupportFapiao = *o.SupportFapiao
  511. }
  512. if o.Amount != nil {
  513. ret.Amount = o.Amount.Clone()
  514. }
  515. if o.Detail != nil {
  516. ret.Detail = o.Detail.Clone()
  517. }
  518. if o.SettleInfo != nil {
  519. ret.SettleInfo = o.SettleInfo.Clone()
  520. }
  521. if o.SceneInfo != nil {
  522. ret.SceneInfo = o.SceneInfo.Clone()
  523. }
  524. return &ret
  525. }
  526. // PrepayResponse
  527. type PrepayResponse struct {
  528. // 二维码链接
  529. CodeUrl *string `json:"code_url"`
  530. }
  531. func (o PrepayResponse) MarshalJSON() ([]byte, error) {
  532. toSerialize := map[string]interface{}{}
  533. if o.CodeUrl == nil {
  534. return nil, fmt.Errorf("field `CodeUrl` is required and must be specified in PrepayResponse")
  535. }
  536. toSerialize["code_url"] = o.CodeUrl
  537. return json.Marshal(toSerialize)
  538. }
  539. func (o PrepayResponse) String() string {
  540. var ret string
  541. if o.CodeUrl == nil {
  542. ret += "CodeUrl:<nil>"
  543. } else {
  544. ret += fmt.Sprintf("CodeUrl:%v", *o.CodeUrl)
  545. }
  546. return fmt.Sprintf("PrepayResponse{%s}", ret)
  547. }
  548. func (o PrepayResponse) Clone() *PrepayResponse {
  549. ret := PrepayResponse{}
  550. if o.CodeUrl != nil {
  551. ret.CodeUrl = new(string)
  552. *ret.CodeUrl = *o.CodeUrl
  553. }
  554. return &ret
  555. }
  556. // QueryOrderByIdRequest
  557. type QueryOrderByIdRequest struct {
  558. // 微信支付订单号
  559. TransactionId *string `json:"transaction_id"`
  560. // 服务商户号
  561. SpMchid *string `json:"sp_mchid"`
  562. // 子商户号
  563. SubMchid *string `json:"sub_mchid"`
  564. }
  565. func (o QueryOrderByIdRequest) MarshalJSON() ([]byte, error) {
  566. toSerialize := map[string]interface{}{}
  567. if o.TransactionId == nil {
  568. return nil, fmt.Errorf("field `TransactionId` is required and must be specified in QueryOrderByIdRequest")
  569. }
  570. toSerialize["transaction_id"] = o.TransactionId
  571. if o.SpMchid == nil {
  572. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in QueryOrderByIdRequest")
  573. }
  574. toSerialize["sp_mchid"] = o.SpMchid
  575. if o.SubMchid == nil {
  576. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in QueryOrderByIdRequest")
  577. }
  578. toSerialize["sub_mchid"] = o.SubMchid
  579. return json.Marshal(toSerialize)
  580. }
  581. func (o QueryOrderByIdRequest) String() string {
  582. var ret string
  583. if o.TransactionId == nil {
  584. ret += "TransactionId:<nil>, "
  585. } else {
  586. ret += fmt.Sprintf("TransactionId:%v, ", *o.TransactionId)
  587. }
  588. if o.SpMchid == nil {
  589. ret += "SpMchid:<nil>, "
  590. } else {
  591. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  592. }
  593. if o.SubMchid == nil {
  594. ret += "SubMchid:<nil>"
  595. } else {
  596. ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
  597. }
  598. return fmt.Sprintf("QueryOrderByIdRequest{%s}", ret)
  599. }
  600. func (o QueryOrderByIdRequest) Clone() *QueryOrderByIdRequest {
  601. ret := QueryOrderByIdRequest{}
  602. if o.TransactionId != nil {
  603. ret.TransactionId = new(string)
  604. *ret.TransactionId = *o.TransactionId
  605. }
  606. if o.SpMchid != nil {
  607. ret.SpMchid = new(string)
  608. *ret.SpMchid = *o.SpMchid
  609. }
  610. if o.SubMchid != nil {
  611. ret.SubMchid = new(string)
  612. *ret.SubMchid = *o.SubMchid
  613. }
  614. return &ret
  615. }
  616. // QueryOrderByOutTradeNoRequest
  617. type QueryOrderByOutTradeNoRequest struct {
  618. // 商户订单号
  619. OutTradeNo *string `json:"out_trade_no"`
  620. // 服务商户号
  621. SpMchid *string `json:"sp_mchid"`
  622. // 子商户号
  623. SubMchid *string `json:"sub_mchid"`
  624. }
  625. func (o QueryOrderByOutTradeNoRequest) MarshalJSON() ([]byte, error) {
  626. toSerialize := map[string]interface{}{}
  627. if o.OutTradeNo == nil {
  628. return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in QueryOrderByOutTradeNoRequest")
  629. }
  630. toSerialize["out_trade_no"] = o.OutTradeNo
  631. if o.SpMchid == nil {
  632. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in QueryOrderByOutTradeNoRequest")
  633. }
  634. toSerialize["sp_mchid"] = o.SpMchid
  635. if o.SubMchid == nil {
  636. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in QueryOrderByOutTradeNoRequest")
  637. }
  638. toSerialize["sub_mchid"] = o.SubMchid
  639. return json.Marshal(toSerialize)
  640. }
  641. func (o QueryOrderByOutTradeNoRequest) String() string {
  642. var ret string
  643. if o.OutTradeNo == nil {
  644. ret += "OutTradeNo:<nil>, "
  645. } else {
  646. ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
  647. }
  648. if o.SpMchid == nil {
  649. ret += "SpMchid:<nil>, "
  650. } else {
  651. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  652. }
  653. if o.SubMchid == nil {
  654. ret += "SubMchid:<nil>"
  655. } else {
  656. ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
  657. }
  658. return fmt.Sprintf("QueryOrderByOutTradeNoRequest{%s}", ret)
  659. }
  660. func (o QueryOrderByOutTradeNoRequest) Clone() *QueryOrderByOutTradeNoRequest {
  661. ret := QueryOrderByOutTradeNoRequest{}
  662. if o.OutTradeNo != nil {
  663. ret.OutTradeNo = new(string)
  664. *ret.OutTradeNo = *o.OutTradeNo
  665. }
  666. if o.SpMchid != nil {
  667. ret.SpMchid = new(string)
  668. *ret.SpMchid = *o.SpMchid
  669. }
  670. if o.SubMchid != nil {
  671. ret.SubMchid = new(string)
  672. *ret.SubMchid = *o.SubMchid
  673. }
  674. return &ret
  675. }
  676. // SceneInfo 支付场景描述
  677. type SceneInfo struct {
  678. // 用户终端IP
  679. PayerClientIp *string `json:"payer_client_ip"`
  680. // 商户端设备号
  681. DeviceId *string `json:"device_id,omitempty"`
  682. StoreInfo *StoreInfo `json:"store_info,omitempty"`
  683. }
  684. func (o SceneInfo) MarshalJSON() ([]byte, error) {
  685. toSerialize := map[string]interface{}{}
  686. if o.PayerClientIp == nil {
  687. return nil, fmt.Errorf("field `PayerClientIp` is required and must be specified in SceneInfo")
  688. }
  689. toSerialize["payer_client_ip"] = o.PayerClientIp
  690. if o.DeviceId != nil {
  691. toSerialize["device_id"] = o.DeviceId
  692. }
  693. if o.StoreInfo != nil {
  694. toSerialize["store_info"] = o.StoreInfo
  695. }
  696. return json.Marshal(toSerialize)
  697. }
  698. func (o SceneInfo) String() string {
  699. var ret string
  700. if o.PayerClientIp == nil {
  701. ret += "PayerClientIp:<nil>, "
  702. } else {
  703. ret += fmt.Sprintf("PayerClientIp:%v, ", *o.PayerClientIp)
  704. }
  705. if o.DeviceId == nil {
  706. ret += "DeviceId:<nil>, "
  707. } else {
  708. ret += fmt.Sprintf("DeviceId:%v, ", *o.DeviceId)
  709. }
  710. ret += fmt.Sprintf("StoreInfo:%v", o.StoreInfo)
  711. return fmt.Sprintf("SceneInfo{%s}", ret)
  712. }
  713. func (o SceneInfo) Clone() *SceneInfo {
  714. ret := SceneInfo{}
  715. if o.PayerClientIp != nil {
  716. ret.PayerClientIp = new(string)
  717. *ret.PayerClientIp = *o.PayerClientIp
  718. }
  719. if o.DeviceId != nil {
  720. ret.DeviceId = new(string)
  721. *ret.DeviceId = *o.DeviceId
  722. }
  723. if o.StoreInfo != nil {
  724. ret.StoreInfo = o.StoreInfo.Clone()
  725. }
  726. return &ret
  727. }
  728. // SettleInfo
  729. type SettleInfo struct {
  730. // 是否指定分账
  731. ProfitSharing *bool `json:"profit_sharing,omitempty"`
  732. }
  733. func (o SettleInfo) MarshalJSON() ([]byte, error) {
  734. toSerialize := map[string]interface{}{}
  735. if o.ProfitSharing != nil {
  736. toSerialize["profit_sharing"] = o.ProfitSharing
  737. }
  738. return json.Marshal(toSerialize)
  739. }
  740. func (o SettleInfo) String() string {
  741. var ret string
  742. if o.ProfitSharing == nil {
  743. ret += "ProfitSharing:<nil>"
  744. } else {
  745. ret += fmt.Sprintf("ProfitSharing:%v", *o.ProfitSharing)
  746. }
  747. return fmt.Sprintf("SettleInfo{%s}", ret)
  748. }
  749. func (o SettleInfo) Clone() *SettleInfo {
  750. ret := SettleInfo{}
  751. if o.ProfitSharing != nil {
  752. ret.ProfitSharing = new(bool)
  753. *ret.ProfitSharing = *o.ProfitSharing
  754. }
  755. return &ret
  756. }
  757. // StoreInfo 商户门店信息
  758. type StoreInfo struct {
  759. // 商户侧门店编号
  760. Id *string `json:"id"`
  761. // 商户侧门店名称
  762. Name *string `json:"name,omitempty"`
  763. // 地区编码,详细请见微信支付提供的文档
  764. AreaCode *string `json:"area_code,omitempty"`
  765. // 详细的商户门店地址
  766. Address *string `json:"address,omitempty"`
  767. }
  768. func (o StoreInfo) MarshalJSON() ([]byte, error) {
  769. toSerialize := map[string]interface{}{}
  770. if o.Id == nil {
  771. return nil, fmt.Errorf("field `Id` is required and must be specified in StoreInfo")
  772. }
  773. toSerialize["id"] = o.Id
  774. if o.Name != nil {
  775. toSerialize["name"] = o.Name
  776. }
  777. if o.AreaCode != nil {
  778. toSerialize["area_code"] = o.AreaCode
  779. }
  780. if o.Address != nil {
  781. toSerialize["address"] = o.Address
  782. }
  783. return json.Marshal(toSerialize)
  784. }
  785. func (o StoreInfo) String() string {
  786. var ret string
  787. if o.Id == nil {
  788. ret += "Id:<nil>, "
  789. } else {
  790. ret += fmt.Sprintf("Id:%v, ", *o.Id)
  791. }
  792. if o.Name == nil {
  793. ret += "Name:<nil>, "
  794. } else {
  795. ret += fmt.Sprintf("Name:%v, ", *o.Name)
  796. }
  797. if o.AreaCode == nil {
  798. ret += "AreaCode:<nil>, "
  799. } else {
  800. ret += fmt.Sprintf("AreaCode:%v, ", *o.AreaCode)
  801. }
  802. if o.Address == nil {
  803. ret += "Address:<nil>"
  804. } else {
  805. ret += fmt.Sprintf("Address:%v", *o.Address)
  806. }
  807. return fmt.Sprintf("StoreInfo{%s}", ret)
  808. }
  809. func (o StoreInfo) Clone() *StoreInfo {
  810. ret := StoreInfo{}
  811. if o.Id != nil {
  812. ret.Id = new(string)
  813. *ret.Id = *o.Id
  814. }
  815. if o.Name != nil {
  816. ret.Name = new(string)
  817. *ret.Name = *o.Name
  818. }
  819. if o.AreaCode != nil {
  820. ret.AreaCode = new(string)
  821. *ret.AreaCode = *o.AreaCode
  822. }
  823. if o.Address != nil {
  824. ret.Address = new(string)
  825. *ret.Address = *o.Address
  826. }
  827. return &ret
  828. }