models.go 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  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. // 商户订单号
  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. // Payer
  307. type Payer struct {
  308. // 用户在服务商AppID下的唯一标识。
  309. SpOpenid *string `json:"sp_openid,omitempty"`
  310. // 用户在子商户AppID下的唯一标识。
  311. SubOpenid *string `json:"sub_openid,omitempty"`
  312. }
  313. func (o Payer) MarshalJSON() ([]byte, error) {
  314. toSerialize := map[string]interface{}{}
  315. if o.SpOpenid != nil {
  316. toSerialize["sp_openid"] = o.SpOpenid
  317. }
  318. if o.SubOpenid != nil {
  319. toSerialize["sub_openid"] = o.SubOpenid
  320. }
  321. return json.Marshal(toSerialize)
  322. }
  323. func (o Payer) String() string {
  324. var ret string
  325. if o.SpOpenid == nil {
  326. ret += "SpOpenid:<nil>, "
  327. } else {
  328. ret += fmt.Sprintf("SpOpenid:%v, ", *o.SpOpenid)
  329. }
  330. if o.SubOpenid == nil {
  331. ret += "SubOpenid:<nil>"
  332. } else {
  333. ret += fmt.Sprintf("SubOpenid:%v", *o.SubOpenid)
  334. }
  335. return fmt.Sprintf("Payer{%s}", ret)
  336. }
  337. func (o Payer) Clone() *Payer {
  338. ret := Payer{}
  339. if o.SpOpenid != nil {
  340. ret.SpOpenid = new(string)
  341. *ret.SpOpenid = *o.SpOpenid
  342. }
  343. if o.SubOpenid != nil {
  344. ret.SubOpenid = new(string)
  345. *ret.SubOpenid = *o.SubOpenid
  346. }
  347. return &ret
  348. }
  349. // PrepayRequest
  350. type PrepayRequest struct {
  351. // 服务商申请的公众号appid
  352. SpAppid *string `json:"sp_appid"`
  353. // 服务商户号,由微信支付生成并下发
  354. SpMchid *string `json:"sp_mchid"`
  355. // 子商户申请的公众号appid
  356. SubAppid *string `json:"sub_appid,omitempty"`
  357. // 子商户的商户号,由微信支付生成并下发
  358. SubMchid *string `json:"sub_mchid"`
  359. // 商品描述
  360. Description *string `json:"description"`
  361. // 商户订单号
  362. OutTradeNo *string `json:"out_trade_no"`
  363. // 订单失效时间,格式为rfc3339格式
  364. TimeExpire *time.Time `json:"time_expire,omitempty"`
  365. // 附加数据
  366. Attach *string `json:"attach,omitempty"`
  367. // 有效性:1. HTTPS;2. 不允许携带查询串。
  368. NotifyUrl *string `json:"notify_url"`
  369. // 商品标记,代金券或立减优惠功能的参数。
  370. GoodsTag *string `json:"goods_tag,omitempty"`
  371. // 指定支付方式
  372. LimitPay []string `json:"limit_pay,omitempty"`
  373. // 传入true时,支付成功消息和支付详情页将出现开票入口。需要在微信支付商户平台或微信公众平台开通电子发票功能,传此字段才可生效。
  374. SupportFapiao *bool `json:"support_fapiao,omitempty"`
  375. Amount *Amount `json:"amount"`
  376. Payer *Payer `json:"payer"`
  377. Detail *Detail `json:"detail,omitempty"`
  378. SceneInfo *SceneInfo `json:"scene_info,omitempty"`
  379. SettleInfo *SettleInfo `json:"settle_info,omitempty"`
  380. }
  381. func (o PrepayRequest) MarshalJSON() ([]byte, error) {
  382. toSerialize := map[string]interface{}{}
  383. if o.SpAppid == nil {
  384. return nil, fmt.Errorf("field `SpAppid` is required and must be specified in PrepayRequest")
  385. }
  386. toSerialize["sp_appid"] = o.SpAppid
  387. if o.SpMchid == nil {
  388. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in PrepayRequest")
  389. }
  390. toSerialize["sp_mchid"] = o.SpMchid
  391. if o.SubAppid != nil {
  392. toSerialize["sub_appid"] = o.SubAppid
  393. }
  394. if o.SubMchid == nil {
  395. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in PrepayRequest")
  396. }
  397. toSerialize["sub_mchid"] = o.SubMchid
  398. if o.Description == nil {
  399. return nil, fmt.Errorf("field `Description` is required and must be specified in PrepayRequest")
  400. }
  401. toSerialize["description"] = o.Description
  402. if o.OutTradeNo == nil {
  403. return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in PrepayRequest")
  404. }
  405. toSerialize["out_trade_no"] = o.OutTradeNo
  406. if o.TimeExpire != nil {
  407. toSerialize["time_expire"] = o.TimeExpire.Format(time.RFC3339)
  408. }
  409. if o.Attach != nil {
  410. toSerialize["attach"] = o.Attach
  411. }
  412. if o.NotifyUrl == nil {
  413. return nil, fmt.Errorf("field `NotifyUrl` is required and must be specified in PrepayRequest")
  414. }
  415. toSerialize["notify_url"] = o.NotifyUrl
  416. if o.GoodsTag != nil {
  417. toSerialize["goods_tag"] = o.GoodsTag
  418. }
  419. if o.LimitPay != nil {
  420. toSerialize["limit_pay"] = o.LimitPay
  421. }
  422. if o.SupportFapiao != nil {
  423. toSerialize["support_fapiao"] = o.SupportFapiao
  424. }
  425. if o.Amount == nil {
  426. return nil, fmt.Errorf("field `Amount` is required and must be specified in PrepayRequest")
  427. }
  428. toSerialize["amount"] = o.Amount
  429. if o.Payer == nil {
  430. return nil, fmt.Errorf("field `Payer` is required and must be specified in PrepayRequest")
  431. }
  432. toSerialize["payer"] = o.Payer
  433. if o.Detail != nil {
  434. toSerialize["detail"] = o.Detail
  435. }
  436. if o.SceneInfo != nil {
  437. toSerialize["scene_info"] = o.SceneInfo
  438. }
  439. if o.SettleInfo != nil {
  440. toSerialize["settle_info"] = o.SettleInfo
  441. }
  442. return json.Marshal(toSerialize)
  443. }
  444. func (o PrepayRequest) String() string {
  445. var ret string
  446. if o.SpAppid == nil {
  447. ret += "SpAppid:<nil>, "
  448. } else {
  449. ret += fmt.Sprintf("SpAppid:%v, ", *o.SpAppid)
  450. }
  451. if o.SpMchid == nil {
  452. ret += "SpMchid:<nil>, "
  453. } else {
  454. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  455. }
  456. if o.SubAppid == nil {
  457. ret += "SubAppid:<nil>, "
  458. } else {
  459. ret += fmt.Sprintf("SubAppid:%v, ", *o.SubAppid)
  460. }
  461. if o.SubMchid == nil {
  462. ret += "SubMchid:<nil>, "
  463. } else {
  464. ret += fmt.Sprintf("SubMchid:%v, ", *o.SubMchid)
  465. }
  466. if o.Description == nil {
  467. ret += "Description:<nil>, "
  468. } else {
  469. ret += fmt.Sprintf("Description:%v, ", *o.Description)
  470. }
  471. if o.OutTradeNo == nil {
  472. ret += "OutTradeNo:<nil>, "
  473. } else {
  474. ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
  475. }
  476. if o.TimeExpire == nil {
  477. ret += "TimeExpire:<nil>, "
  478. } else {
  479. ret += fmt.Sprintf("TimeExpire:%v, ", *o.TimeExpire)
  480. }
  481. if o.Attach == nil {
  482. ret += "Attach:<nil>, "
  483. } else {
  484. ret += fmt.Sprintf("Attach:%v, ", *o.Attach)
  485. }
  486. if o.NotifyUrl == nil {
  487. ret += "NotifyUrl:<nil>, "
  488. } else {
  489. ret += fmt.Sprintf("NotifyUrl:%v, ", *o.NotifyUrl)
  490. }
  491. if o.GoodsTag == nil {
  492. ret += "GoodsTag:<nil>, "
  493. } else {
  494. ret += fmt.Sprintf("GoodsTag:%v, ", *o.GoodsTag)
  495. }
  496. ret += fmt.Sprintf("LimitPay:%v, ", o.LimitPay)
  497. if o.SupportFapiao == nil {
  498. ret += "SupportFapiao:<nil>, "
  499. } else {
  500. ret += fmt.Sprintf("SupportFapiao:%v, ", *o.SupportFapiao)
  501. }
  502. ret += fmt.Sprintf("Amount:%v, ", o.Amount)
  503. ret += fmt.Sprintf("Payer:%v, ", o.Payer)
  504. ret += fmt.Sprintf("Detail:%v, ", o.Detail)
  505. ret += fmt.Sprintf("SceneInfo:%v, ", o.SceneInfo)
  506. ret += fmt.Sprintf("SettleInfo:%v", o.SettleInfo)
  507. return fmt.Sprintf("PrepayRequest{%s}", ret)
  508. }
  509. func (o PrepayRequest) Clone() *PrepayRequest {
  510. ret := PrepayRequest{}
  511. if o.SpAppid != nil {
  512. ret.SpAppid = new(string)
  513. *ret.SpAppid = *o.SpAppid
  514. }
  515. if o.SpMchid != nil {
  516. ret.SpMchid = new(string)
  517. *ret.SpMchid = *o.SpMchid
  518. }
  519. if o.SubAppid != nil {
  520. ret.SubAppid = new(string)
  521. *ret.SubAppid = *o.SubAppid
  522. }
  523. if o.SubMchid != nil {
  524. ret.SubMchid = new(string)
  525. *ret.SubMchid = *o.SubMchid
  526. }
  527. if o.Description != nil {
  528. ret.Description = new(string)
  529. *ret.Description = *o.Description
  530. }
  531. if o.OutTradeNo != nil {
  532. ret.OutTradeNo = new(string)
  533. *ret.OutTradeNo = *o.OutTradeNo
  534. }
  535. if o.TimeExpire != nil {
  536. ret.TimeExpire = new(time.Time)
  537. *ret.TimeExpire = *o.TimeExpire
  538. }
  539. if o.Attach != nil {
  540. ret.Attach = new(string)
  541. *ret.Attach = *o.Attach
  542. }
  543. if o.NotifyUrl != nil {
  544. ret.NotifyUrl = new(string)
  545. *ret.NotifyUrl = *o.NotifyUrl
  546. }
  547. if o.GoodsTag != nil {
  548. ret.GoodsTag = new(string)
  549. *ret.GoodsTag = *o.GoodsTag
  550. }
  551. if o.LimitPay != nil {
  552. ret.LimitPay = make([]string, len(o.LimitPay))
  553. for i, item := range o.LimitPay {
  554. ret.LimitPay[i] = item
  555. }
  556. }
  557. if o.SupportFapiao != nil {
  558. ret.SupportFapiao = new(bool)
  559. *ret.SupportFapiao = *o.SupportFapiao
  560. }
  561. if o.Amount != nil {
  562. ret.Amount = o.Amount.Clone()
  563. }
  564. if o.Payer != nil {
  565. ret.Payer = o.Payer.Clone()
  566. }
  567. if o.Detail != nil {
  568. ret.Detail = o.Detail.Clone()
  569. }
  570. if o.SceneInfo != nil {
  571. ret.SceneInfo = o.SceneInfo.Clone()
  572. }
  573. if o.SettleInfo != nil {
  574. ret.SettleInfo = o.SettleInfo.Clone()
  575. }
  576. return &ret
  577. }
  578. // PrepayResponse
  579. type PrepayResponse struct {
  580. // 预支付交易会话标识
  581. PrepayId *string `json:"prepay_id"`
  582. }
  583. func (o PrepayResponse) MarshalJSON() ([]byte, error) {
  584. toSerialize := map[string]interface{}{}
  585. if o.PrepayId == nil {
  586. return nil, fmt.Errorf("field `PrepayId` is required and must be specified in PrepayResponse")
  587. }
  588. toSerialize["prepay_id"] = o.PrepayId
  589. return json.Marshal(toSerialize)
  590. }
  591. func (o PrepayResponse) String() string {
  592. var ret string
  593. if o.PrepayId == nil {
  594. ret += "PrepayId:<nil>"
  595. } else {
  596. ret += fmt.Sprintf("PrepayId:%v", *o.PrepayId)
  597. }
  598. return fmt.Sprintf("PrepayResponse{%s}", ret)
  599. }
  600. func (o PrepayResponse) Clone() *PrepayResponse {
  601. ret := PrepayResponse{}
  602. if o.PrepayId != nil {
  603. ret.PrepayId = new(string)
  604. *ret.PrepayId = *o.PrepayId
  605. }
  606. return &ret
  607. }
  608. // QueryOrderByIdRequest
  609. type QueryOrderByIdRequest struct {
  610. // 微信支付订单号
  611. TransactionId *string `json:"transaction_id"`
  612. // 服务商户号
  613. SpMchid *string `json:"sp_mchid"`
  614. // 子商户号
  615. SubMchid *string `json:"sub_mchid"`
  616. }
  617. func (o QueryOrderByIdRequest) MarshalJSON() ([]byte, error) {
  618. toSerialize := map[string]interface{}{}
  619. if o.TransactionId == nil {
  620. return nil, fmt.Errorf("field `TransactionId` is required and must be specified in QueryOrderByIdRequest")
  621. }
  622. toSerialize["transaction_id"] = o.TransactionId
  623. if o.SpMchid == nil {
  624. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in QueryOrderByIdRequest")
  625. }
  626. toSerialize["sp_mchid"] = o.SpMchid
  627. if o.SubMchid == nil {
  628. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in QueryOrderByIdRequest")
  629. }
  630. toSerialize["sub_mchid"] = o.SubMchid
  631. return json.Marshal(toSerialize)
  632. }
  633. func (o QueryOrderByIdRequest) String() string {
  634. var ret string
  635. if o.TransactionId == nil {
  636. ret += "TransactionId:<nil>, "
  637. } else {
  638. ret += fmt.Sprintf("TransactionId:%v, ", *o.TransactionId)
  639. }
  640. if o.SpMchid == nil {
  641. ret += "SpMchid:<nil>, "
  642. } else {
  643. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  644. }
  645. if o.SubMchid == nil {
  646. ret += "SubMchid:<nil>"
  647. } else {
  648. ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
  649. }
  650. return fmt.Sprintf("QueryOrderByIdRequest{%s}", ret)
  651. }
  652. func (o QueryOrderByIdRequest) Clone() *QueryOrderByIdRequest {
  653. ret := QueryOrderByIdRequest{}
  654. if o.TransactionId != nil {
  655. ret.TransactionId = new(string)
  656. *ret.TransactionId = *o.TransactionId
  657. }
  658. if o.SpMchid != nil {
  659. ret.SpMchid = new(string)
  660. *ret.SpMchid = *o.SpMchid
  661. }
  662. if o.SubMchid != nil {
  663. ret.SubMchid = new(string)
  664. *ret.SubMchid = *o.SubMchid
  665. }
  666. return &ret
  667. }
  668. // QueryOrderByOutTradeNoRequest
  669. type QueryOrderByOutTradeNoRequest struct {
  670. // 商户订单号
  671. OutTradeNo *string `json:"out_trade_no"`
  672. // 服务商户号
  673. SpMchid *string `json:"sp_mchid"`
  674. // 子商户号
  675. SubMchid *string `json:"sub_mchid"`
  676. }
  677. func (o QueryOrderByOutTradeNoRequest) MarshalJSON() ([]byte, error) {
  678. toSerialize := map[string]interface{}{}
  679. if o.OutTradeNo == nil {
  680. return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in QueryOrderByOutTradeNoRequest")
  681. }
  682. toSerialize["out_trade_no"] = o.OutTradeNo
  683. if o.SpMchid == nil {
  684. return nil, fmt.Errorf("field `SpMchid` is required and must be specified in QueryOrderByOutTradeNoRequest")
  685. }
  686. toSerialize["sp_mchid"] = o.SpMchid
  687. if o.SubMchid == nil {
  688. return nil, fmt.Errorf("field `SubMchid` is required and must be specified in QueryOrderByOutTradeNoRequest")
  689. }
  690. toSerialize["sub_mchid"] = o.SubMchid
  691. return json.Marshal(toSerialize)
  692. }
  693. func (o QueryOrderByOutTradeNoRequest) String() string {
  694. var ret string
  695. if o.OutTradeNo == nil {
  696. ret += "OutTradeNo:<nil>, "
  697. } else {
  698. ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
  699. }
  700. if o.SpMchid == nil {
  701. ret += "SpMchid:<nil>, "
  702. } else {
  703. ret += fmt.Sprintf("SpMchid:%v, ", *o.SpMchid)
  704. }
  705. if o.SubMchid == nil {
  706. ret += "SubMchid:<nil>"
  707. } else {
  708. ret += fmt.Sprintf("SubMchid:%v", *o.SubMchid)
  709. }
  710. return fmt.Sprintf("QueryOrderByOutTradeNoRequest{%s}", ret)
  711. }
  712. func (o QueryOrderByOutTradeNoRequest) Clone() *QueryOrderByOutTradeNoRequest {
  713. ret := QueryOrderByOutTradeNoRequest{}
  714. if o.OutTradeNo != nil {
  715. ret.OutTradeNo = new(string)
  716. *ret.OutTradeNo = *o.OutTradeNo
  717. }
  718. if o.SpMchid != nil {
  719. ret.SpMchid = new(string)
  720. *ret.SpMchid = *o.SpMchid
  721. }
  722. if o.SubMchid != nil {
  723. ret.SubMchid = new(string)
  724. *ret.SubMchid = *o.SubMchid
  725. }
  726. return &ret
  727. }
  728. // SceneInfo 支付场景描述
  729. type SceneInfo struct {
  730. // 用户终端IP
  731. PayerClientIp *string `json:"payer_client_ip"`
  732. // 商户端设备号
  733. DeviceId *string `json:"device_id,omitempty"`
  734. StoreInfo *StoreInfo `json:"store_info,omitempty"`
  735. }
  736. func (o SceneInfo) MarshalJSON() ([]byte, error) {
  737. toSerialize := map[string]interface{}{}
  738. if o.PayerClientIp == nil {
  739. return nil, fmt.Errorf("field `PayerClientIp` is required and must be specified in SceneInfo")
  740. }
  741. toSerialize["payer_client_ip"] = o.PayerClientIp
  742. if o.DeviceId != nil {
  743. toSerialize["device_id"] = o.DeviceId
  744. }
  745. if o.StoreInfo != nil {
  746. toSerialize["store_info"] = o.StoreInfo
  747. }
  748. return json.Marshal(toSerialize)
  749. }
  750. func (o SceneInfo) String() string {
  751. var ret string
  752. if o.PayerClientIp == nil {
  753. ret += "PayerClientIp:<nil>, "
  754. } else {
  755. ret += fmt.Sprintf("PayerClientIp:%v, ", *o.PayerClientIp)
  756. }
  757. if o.DeviceId == nil {
  758. ret += "DeviceId:<nil>, "
  759. } else {
  760. ret += fmt.Sprintf("DeviceId:%v, ", *o.DeviceId)
  761. }
  762. ret += fmt.Sprintf("StoreInfo:%v", o.StoreInfo)
  763. return fmt.Sprintf("SceneInfo{%s}", ret)
  764. }
  765. func (o SceneInfo) Clone() *SceneInfo {
  766. ret := SceneInfo{}
  767. if o.PayerClientIp != nil {
  768. ret.PayerClientIp = new(string)
  769. *ret.PayerClientIp = *o.PayerClientIp
  770. }
  771. if o.DeviceId != nil {
  772. ret.DeviceId = new(string)
  773. *ret.DeviceId = *o.DeviceId
  774. }
  775. if o.StoreInfo != nil {
  776. ret.StoreInfo = o.StoreInfo.Clone()
  777. }
  778. return &ret
  779. }
  780. // SettleInfo
  781. type SettleInfo struct {
  782. // 是否指定分账
  783. ProfitSharing *bool `json:"profit_sharing,omitempty"`
  784. }
  785. func (o SettleInfo) MarshalJSON() ([]byte, error) {
  786. toSerialize := map[string]interface{}{}
  787. if o.ProfitSharing != nil {
  788. toSerialize["profit_sharing"] = o.ProfitSharing
  789. }
  790. return json.Marshal(toSerialize)
  791. }
  792. func (o SettleInfo) String() string {
  793. var ret string
  794. if o.ProfitSharing == nil {
  795. ret += "ProfitSharing:<nil>"
  796. } else {
  797. ret += fmt.Sprintf("ProfitSharing:%v", *o.ProfitSharing)
  798. }
  799. return fmt.Sprintf("SettleInfo{%s}", ret)
  800. }
  801. func (o SettleInfo) Clone() *SettleInfo {
  802. ret := SettleInfo{}
  803. if o.ProfitSharing != nil {
  804. ret.ProfitSharing = new(bool)
  805. *ret.ProfitSharing = *o.ProfitSharing
  806. }
  807. return &ret
  808. }
  809. // StoreInfo 商户门店信息
  810. type StoreInfo struct {
  811. // 商户侧门店编号
  812. Id *string `json:"id"`
  813. // 商户侧门店名称
  814. Name *string `json:"name,omitempty"`
  815. // 地区编码,详细请见微信支付提供的文档
  816. AreaCode *string `json:"area_code,omitempty"`
  817. // 详细的商户门店地址
  818. Address *string `json:"address,omitempty"`
  819. }
  820. func (o StoreInfo) MarshalJSON() ([]byte, error) {
  821. toSerialize := map[string]interface{}{}
  822. if o.Id == nil {
  823. return nil, fmt.Errorf("field `Id` is required and must be specified in StoreInfo")
  824. }
  825. toSerialize["id"] = o.Id
  826. if o.Name != nil {
  827. toSerialize["name"] = o.Name
  828. }
  829. if o.AreaCode != nil {
  830. toSerialize["area_code"] = o.AreaCode
  831. }
  832. if o.Address != nil {
  833. toSerialize["address"] = o.Address
  834. }
  835. return json.Marshal(toSerialize)
  836. }
  837. func (o StoreInfo) String() string {
  838. var ret string
  839. if o.Id == nil {
  840. ret += "Id:<nil>, "
  841. } else {
  842. ret += fmt.Sprintf("Id:%v, ", *o.Id)
  843. }
  844. if o.Name == nil {
  845. ret += "Name:<nil>, "
  846. } else {
  847. ret += fmt.Sprintf("Name:%v, ", *o.Name)
  848. }
  849. if o.AreaCode == nil {
  850. ret += "AreaCode:<nil>, "
  851. } else {
  852. ret += fmt.Sprintf("AreaCode:%v, ", *o.AreaCode)
  853. }
  854. if o.Address == nil {
  855. ret += "Address:<nil>"
  856. } else {
  857. ret += fmt.Sprintf("Address:%v", *o.Address)
  858. }
  859. return fmt.Sprintf("StoreInfo{%s}", ret)
  860. }
  861. func (o StoreInfo) Clone() *StoreInfo {
  862. ret := StoreInfo{}
  863. if o.Id != nil {
  864. ret.Id = new(string)
  865. *ret.Id = *o.Id
  866. }
  867. if o.Name != nil {
  868. ret.Name = new(string)
  869. *ret.Name = *o.Name
  870. }
  871. if o.AreaCode != nil {
  872. ret.AreaCode = new(string)
  873. *ret.AreaCode = *o.AreaCode
  874. }
  875. if o.Address != nil {
  876. ret.Address = new(string)
  877. *ret.Address = *o.Address
  878. }
  879. return &ret
  880. }