models.go 22 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012
  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. ReceiptId *string `json:"receipt_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.ReceiptId != nil {
  147. toSerialize["receipt_id"] = o.ReceiptId
  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.ReceiptId == nil {
  162. ret += "ReceiptId:<nil>, "
  163. } else {
  164. ret += fmt.Sprintf("ReceiptId:%v, ", *o.ReceiptId)
  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.ReceiptId != nil {
  176. ret.ReceiptId = new(string)
  177. *ret.ReceiptId = *o.ReceiptId
  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. TradeType *string `json:"trade_type,omitempty"`
  333. //商户行业编码
  334. MerchantCategoryCode *string `json:"merchant_category_code,omitempty"`
  335. }
  336. func (o PrepayRequest) MarshalJSON() ([]byte, error) {
  337. toSerialize := map[string]interface{}{}
  338. if o.Appid == nil {
  339. return nil, fmt.Errorf("field `Appid` is required and must be specified in PrepayRequest")
  340. }
  341. toSerialize["appid"] = o.Appid
  342. if o.TradeType==nil {
  343. return nil, fmt.Errorf("field `TradeType` is required and must be specified in PrepayRequest")
  344. }
  345. toSerialize["trade_type"] = o.TradeType
  346. if o.MerchantCategoryCode == nil {
  347. return nil, fmt.Errorf("field `MerchantCategoryCode` is required and must be specified in PrepayRequest")
  348. }
  349. toSerialize["merchant_category_code"] = o.MerchantCategoryCode
  350. if o.Mchid == nil {
  351. return nil, fmt.Errorf("field `Mchid` is required and must be specified in PrepayRequest")
  352. }
  353. toSerialize["mchid"] = o.Mchid
  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.Payer == nil {
  386. return nil, fmt.Errorf("field `Payer` is required and must be specified in PrepayRequest")
  387. }
  388. toSerialize["payer"] = o.Payer
  389. if o.Detail != nil {
  390. toSerialize["detail"] = o.Detail
  391. }
  392. if o.SceneInfo != nil {
  393. toSerialize["scene_info"] = o.SceneInfo
  394. }
  395. if o.SettleInfo != nil {
  396. toSerialize["settle_info"] = o.SettleInfo
  397. }
  398. return json.Marshal(toSerialize)
  399. }
  400. func (o PrepayRequest) String() string {
  401. var ret string
  402. if o.Appid == nil {
  403. ret += "Appid:<nil>, "
  404. } else {
  405. ret += fmt.Sprintf("Appid:%v, ", *o.Appid)
  406. }
  407. if o.Mchid == nil {
  408. ret += "Mchid:<nil>, "
  409. } else {
  410. ret += fmt.Sprintf("Mchid:%v, ", *o.Mchid)
  411. }
  412. if o.Description == nil {
  413. ret += "Description:<nil>, "
  414. } else {
  415. ret += fmt.Sprintf("Description:%v, ", *o.Description)
  416. }
  417. if o.OutTradeNo == nil {
  418. ret += "OutTradeNo:<nil>, "
  419. } else {
  420. ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
  421. }
  422. if o.TimeExpire == nil {
  423. ret += "TimeExpire:<nil>, "
  424. } else {
  425. ret += fmt.Sprintf("TimeExpire:%v, ", *o.TimeExpire)
  426. }
  427. if o.Attach == nil {
  428. ret += "Attach:<nil>, "
  429. } else {
  430. ret += fmt.Sprintf("Attach:%v, ", *o.Attach)
  431. }
  432. if o.NotifyUrl == nil {
  433. ret += "NotifyUrl:<nil>, "
  434. } else {
  435. ret += fmt.Sprintf("NotifyUrl:%v, ", *o.NotifyUrl)
  436. }
  437. if o.GoodsTag == nil {
  438. ret += "GoodsTag:<nil>, "
  439. } else {
  440. ret += fmt.Sprintf("GoodsTag:%v, ", *o.GoodsTag)
  441. }
  442. ret += fmt.Sprintf("LimitPay:%v, ", o.LimitPay)
  443. if o.TradeType == nil {
  444. ret += "TradeType:<nil>, "
  445. } else {
  446. ret += fmt.Sprintf("TradeType:%v, ", *o.TradeType)
  447. }
  448. if o.MerchantCategoryCode == nil {
  449. ret += "MerchantCategoryCode:<nil>, "
  450. } else {
  451. ret += fmt.Sprintf("MerchantCategoryCode:%v, ", *o.MerchantCategoryCode)
  452. }
  453. if o.SupportFapiao == nil {
  454. ret += "SupportFapiao:<nil>, "
  455. } else {
  456. ret += fmt.Sprintf("SupportFapiao:%v, ", *o.SupportFapiao)
  457. }
  458. ret += fmt.Sprintf("Amount:%v, ", o.Amount)
  459. ret += fmt.Sprintf("Payer:%v, ", o.Payer)
  460. ret += fmt.Sprintf("Detail:%v, ", o.Detail)
  461. ret += fmt.Sprintf("SceneInfo:%v, ", o.SceneInfo)
  462. ret += fmt.Sprintf("SettleInfo:%v", o.SettleInfo)
  463. return fmt.Sprintf("PrepayRequest{%s}", ret)
  464. }
  465. func (o PrepayRequest) Clone() *PrepayRequest {
  466. ret := PrepayRequest{}
  467. if o.Appid != nil {
  468. ret.Appid = new(string)
  469. *ret.Appid = *o.Appid
  470. }
  471. if o.Mchid != nil {
  472. ret.Mchid = new(string)
  473. *ret.Mchid = *o.Mchid
  474. }
  475. if o.TradeType != nil {
  476. ret.TradeType = new(string)
  477. *ret.TradeType = *o.TradeType
  478. }
  479. if o.MerchantCategoryCode != nil {
  480. ret.MerchantCategoryCode = new(string)
  481. *ret.MerchantCategoryCode = *o.MerchantCategoryCode
  482. }
  483. if o.Description != nil {
  484. ret.Description = new(string)
  485. *ret.Description = *o.Description
  486. }
  487. if o.OutTradeNo != nil {
  488. ret.OutTradeNo = new(string)
  489. *ret.OutTradeNo = *o.OutTradeNo
  490. }
  491. if o.TimeExpire != nil {
  492. ret.TimeExpire = new(time.Time)
  493. *ret.TimeExpire = *o.TimeExpire
  494. }
  495. if o.Attach != nil {
  496. ret.Attach = new(string)
  497. *ret.Attach = *o.Attach
  498. }
  499. if o.NotifyUrl != nil {
  500. ret.NotifyUrl = new(string)
  501. *ret.NotifyUrl = *o.NotifyUrl
  502. }
  503. if o.GoodsTag != nil {
  504. ret.GoodsTag = new(string)
  505. *ret.GoodsTag = *o.GoodsTag
  506. }
  507. if o.LimitPay != nil {
  508. ret.LimitPay = make([]string, len(o.LimitPay))
  509. for i, item := range o.LimitPay {
  510. ret.LimitPay[i] = item
  511. }
  512. }
  513. if o.SupportFapiao != nil {
  514. ret.SupportFapiao = new(bool)
  515. *ret.SupportFapiao = *o.SupportFapiao
  516. }
  517. if o.Amount != nil {
  518. ret.Amount = o.Amount.Clone()
  519. }
  520. if o.Payer != nil {
  521. ret.Payer = o.Payer.Clone()
  522. }
  523. if o.Detail != nil {
  524. ret.Detail = o.Detail.Clone()
  525. }
  526. if o.SceneInfo != nil {
  527. ret.SceneInfo = o.SceneInfo.Clone()
  528. }
  529. if o.SettleInfo != nil {
  530. ret.SettleInfo = o.SettleInfo.Clone()
  531. }
  532. return &ret
  533. }
  534. // PrepayResponse
  535. type PrepayResponse struct {
  536. // 预支付交易会话标识
  537. PrepayId *string `json:"prepay_id"`
  538. }
  539. func (o PrepayResponse) MarshalJSON() ([]byte, error) {
  540. toSerialize := map[string]interface{}{}
  541. if o.PrepayId == nil {
  542. return nil, fmt.Errorf("field `PrepayId` is required and must be specified in PrepayResponse")
  543. }
  544. toSerialize["prepay_id"] = o.PrepayId
  545. return json.Marshal(toSerialize)
  546. }
  547. func (o PrepayResponse) String() string {
  548. var ret string
  549. if o.PrepayId == nil {
  550. ret += "PrepayId:<nil>"
  551. } else {
  552. ret += fmt.Sprintf("PrepayId:%v", *o.PrepayId)
  553. }
  554. return fmt.Sprintf("PrepayResponse{%s}", ret)
  555. }
  556. func (o PrepayResponse) Clone() *PrepayResponse {
  557. ret := PrepayResponse{}
  558. if o.PrepayId != nil {
  559. ret.PrepayId = new(string)
  560. *ret.PrepayId = *o.PrepayId
  561. }
  562. return &ret
  563. }
  564. // QueryOrderByIdRequest
  565. type QueryOrderByIdRequest struct {
  566. TransactionId *string `json:"transaction_id"`
  567. // 直连商户号
  568. Mchid *string `json:"mchid"`
  569. }
  570. func (o QueryOrderByIdRequest) MarshalJSON() ([]byte, error) {
  571. toSerialize := map[string]interface{}{}
  572. if o.TransactionId == nil {
  573. return nil, fmt.Errorf("field `TransactionId` is required and must be specified in QueryOrderByIdRequest")
  574. }
  575. toSerialize["transaction_id"] = o.TransactionId
  576. if o.Mchid == nil {
  577. return nil, fmt.Errorf("field `Mchid` is required and must be specified in QueryOrderByIdRequest")
  578. }
  579. toSerialize["mchid"] = o.Mchid
  580. return json.Marshal(toSerialize)
  581. }
  582. func (o QueryOrderByIdRequest) String() string {
  583. var ret string
  584. if o.TransactionId == nil {
  585. ret += "TransactionId:<nil>, "
  586. } else {
  587. ret += fmt.Sprintf("TransactionId:%v, ", *o.TransactionId)
  588. }
  589. if o.Mchid == nil {
  590. ret += "Mchid:<nil>"
  591. } else {
  592. ret += fmt.Sprintf("Mchid:%v", *o.Mchid)
  593. }
  594. return fmt.Sprintf("QueryOrderByIdRequest{%s}", ret)
  595. }
  596. func (o QueryOrderByIdRequest) Clone() *QueryOrderByIdRequest {
  597. ret := QueryOrderByIdRequest{}
  598. if o.TransactionId != nil {
  599. ret.TransactionId = new(string)
  600. *ret.TransactionId = *o.TransactionId
  601. }
  602. if o.Mchid != nil {
  603. ret.Mchid = new(string)
  604. *ret.Mchid = *o.Mchid
  605. }
  606. return &ret
  607. }
  608. // QueryOrderByOutTradeNoRequest
  609. type QueryOrderByOutTradeNoRequest struct {
  610. OutTradeNo *string `json:"out_trade_no"`
  611. // 直连商户号
  612. Mchid *string `json:"mchid"`
  613. }
  614. func (o QueryOrderByOutTradeNoRequest) MarshalJSON() ([]byte, error) {
  615. toSerialize := map[string]interface{}{}
  616. if o.OutTradeNo == nil {
  617. return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in QueryOrderByOutTradeNoRequest")
  618. }
  619. toSerialize["out_trade_no"] = o.OutTradeNo
  620. if o.Mchid == nil {
  621. return nil, fmt.Errorf("field `Mchid` is required and must be specified in QueryOrderByOutTradeNoRequest")
  622. }
  623. toSerialize["mchid"] = o.Mchid
  624. return json.Marshal(toSerialize)
  625. }
  626. func (o QueryOrderByOutTradeNoRequest) String() string {
  627. var ret string
  628. if o.OutTradeNo == nil {
  629. ret += "OutTradeNo:<nil>, "
  630. } else {
  631. ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo)
  632. }
  633. if o.Mchid == nil {
  634. ret += "Mchid:<nil>"
  635. } else {
  636. ret += fmt.Sprintf("Mchid:%v", *o.Mchid)
  637. }
  638. return fmt.Sprintf("QueryOrderByOutTradeNoRequest{%s}", ret)
  639. }
  640. func (o QueryOrderByOutTradeNoRequest) Clone() *QueryOrderByOutTradeNoRequest {
  641. ret := QueryOrderByOutTradeNoRequest{}
  642. if o.OutTradeNo != nil {
  643. ret.OutTradeNo = new(string)
  644. *ret.OutTradeNo = *o.OutTradeNo
  645. }
  646. if o.Mchid != nil {
  647. ret.Mchid = new(string)
  648. *ret.Mchid = *o.Mchid
  649. }
  650. return &ret
  651. }
  652. // SceneInfo 支付场景描述
  653. type SceneInfo struct {
  654. // 用户终端IP
  655. PayerClientIp *string `json:"payer_client_ip"`
  656. // 商户端设备号
  657. DeviceId *string `json:"device_id,omitempty"`
  658. DeviceIp *string `json:"device_ip,omitempty"`
  659. OperatorId *string `json:"operator_id,omitempty"`
  660. StoreInfo *StoreInfo `json:"store_info,omitempty"`
  661. }
  662. func (o SceneInfo) MarshalJSON() ([]byte, error) {
  663. toSerialize := map[string]interface{}{}
  664. if o.PayerClientIp == nil {
  665. return nil, fmt.Errorf("field `PayerClientIp` is required and must be specified in SceneInfo")
  666. }
  667. if o.DeviceIp != nil {
  668. toSerialize["device_ip"] = o.DeviceIp
  669. }
  670. if o.OperatorId != nil {
  671. toSerialize["operator_id"] = o.OperatorId
  672. }
  673. toSerialize["payer_client_ip"] = o.PayerClientIp
  674. if o.DeviceId != nil {
  675. toSerialize["device_id"] = o.DeviceId
  676. }
  677. if o.StoreInfo != nil {
  678. toSerialize["store_info"] = o.StoreInfo
  679. }
  680. return json.Marshal(toSerialize)
  681. }
  682. func (o SceneInfo) String() string {
  683. var ret string
  684. if o.PayerClientIp == nil {
  685. ret += "PayerClientIp:<nil>, "
  686. } else {
  687. ret += fmt.Sprintf("PayerClientIp:%v, ", *o.PayerClientIp)
  688. }
  689. if o.DeviceIp != nil {
  690. ret += fmt.Sprintf("DeviceIp:%v, ", *o.DeviceIp)
  691. }
  692. if o.OperatorId != nil {
  693. ret += fmt.Sprintf("OperatorId:%v, ", *o.OperatorId)
  694. }
  695. if o.DeviceId == nil {
  696. ret += "DeviceId:<nil>, "
  697. } else {
  698. ret += fmt.Sprintf("DeviceId:%v, ", *o.DeviceId)
  699. }
  700. ret += fmt.Sprintf("StoreInfo:%v", o.StoreInfo)
  701. return fmt.Sprintf("SceneInfo{%s}", ret)
  702. }
  703. func (o SceneInfo) Clone() *SceneInfo {
  704. ret := SceneInfo{}
  705. if o.PayerClientIp != nil {
  706. ret.PayerClientIp = new(string)
  707. *ret.PayerClientIp = *o.PayerClientIp
  708. }
  709. if o.DeviceId != nil {
  710. ret.DeviceId = new(string)
  711. *ret.DeviceId = *o.DeviceId
  712. }
  713. if o.StoreInfo != nil {
  714. ret.StoreInfo = o.StoreInfo.Clone()
  715. }
  716. return &ret
  717. }
  718. // SettleInfo
  719. type SettleInfo struct {
  720. // 是否指定分账
  721. ProfitSharing *bool `json:"profit_sharing,omitempty"`
  722. }
  723. func (o SettleInfo) MarshalJSON() ([]byte, error) {
  724. toSerialize := map[string]interface{}{}
  725. if o.ProfitSharing != nil {
  726. toSerialize["profit_sharing"] = o.ProfitSharing
  727. }
  728. return json.Marshal(toSerialize)
  729. }
  730. func (o SettleInfo) String() string {
  731. var ret string
  732. if o.ProfitSharing == nil {
  733. ret += "ProfitSharing:<nil>"
  734. } else {
  735. ret += fmt.Sprintf("ProfitSharing:%v", *o.ProfitSharing)
  736. }
  737. return fmt.Sprintf("SettleInfo{%s}", ret)
  738. }
  739. func (o SettleInfo) Clone() *SettleInfo {
  740. ret := SettleInfo{}
  741. if o.ProfitSharing != nil {
  742. ret.ProfitSharing = new(bool)
  743. *ret.ProfitSharing = *o.ProfitSharing
  744. }
  745. return &ret
  746. }
  747. // StoreInfo 商户门店信息
  748. type StoreInfo struct {
  749. // 商户侧门店编号
  750. Id *string `json:"id"`
  751. // 商户侧门店名称
  752. Name *string `json:"name,omitempty"`
  753. // 详细的商户门店地址
  754. Address *string `json:"address,omitempty"`
  755. }
  756. func (o StoreInfo) MarshalJSON() ([]byte, error) {
  757. toSerialize := map[string]interface{}{}
  758. if o.Id == nil {
  759. return nil, fmt.Errorf("field `Id` is required and must be specified in StoreInfo")
  760. }
  761. toSerialize["id"] = o.Id
  762. if o.Name != nil {
  763. toSerialize["name"] = o.Name
  764. }
  765. if o.Address != nil {
  766. toSerialize["address"] = o.Address
  767. }
  768. return json.Marshal(toSerialize)
  769. }
  770. func (o StoreInfo) String() string {
  771. var ret string
  772. if o.Id == nil {
  773. ret += "Id:<nil>, "
  774. } else {
  775. ret += fmt.Sprintf("Id:%v, ", *o.Id)
  776. }
  777. if o.Name == nil {
  778. ret += "Name:<nil>, "
  779. } else {
  780. ret += fmt.Sprintf("Name:%v, ", *o.Name)
  781. }
  782. if o.Address == nil {
  783. ret += "Address:<nil>"
  784. } else {
  785. ret += fmt.Sprintf("Address:%v", *o.Address)
  786. }
  787. return fmt.Sprintf("StoreInfo{%s}", ret)
  788. }
  789. func (o StoreInfo) Clone() *StoreInfo {
  790. ret := StoreInfo{}
  791. if o.Id != nil {
  792. ret.Id = new(string)
  793. *ret.Id = *o.Id
  794. }
  795. if o.Name != nil {
  796. ret.Name = new(string)
  797. *ret.Name = *o.Name
  798. }
  799. if o.Address != nil {
  800. ret.Address = new(string)
  801. *ret.Address = *o.Address
  802. }
  803. return &ret
  804. }