models.go 21 KB

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