InvoicePlatformData.cs 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. /*----------------------------------------------------------------
  2. Copyright (C) 2019 Senparc
  3. 文件名:InvoicePlatformData.cs
  4. 文件功能描述:开票平台接口post数据
  5. 创建标识:Senparc - 20180930
  6. ----------------------------------------------------------------*/
  7. using System.Collections.Generic;
  8. using Senparc.Weixin.MP.AdvancedAPIs.GroupMessage;
  9. namespace Senparc.Weixin.MP.AdvancedAPIs
  10. {
  11. /// <summary>
  12. /// 发票模板对象
  13. /// </summary>
  14. public class InvoiceInfo
  15. {
  16. /// <summary>
  17. /// 发票卡券模板基础信息
  18. /// </summary>
  19. public InvoiceBaseInfo base_info { get; set; }
  20. /// <summary>
  21. /// 收款方(开票方)全称,显示在发票详情内。故建议一个收款方对应一个发票卡券模板
  22. /// </summary>
  23. public string payee { get; set; }
  24. /// <summary>
  25. /// 发票类型
  26. /// </summary>
  27. public string type { get; set; }
  28. }
  29. /// <summary>
  30. /// 发票卡券模板基础信息
  31. /// </summary>
  32. public class InvoiceBaseInfo
  33. {
  34. /// <summary>
  35. /// 发票商家 LOGO
  36. /// </summary>
  37. public string logo_url { get; set; }
  38. /// <summary>
  39. /// 收款方(显示在列表),上限为 9 个汉字,建议填入商户简称
  40. /// </summary>
  41. public string title { get; set; }
  42. /// <summary>
  43. /// 开票平台自定义入口名称,与 custom_url 字段共同使用,长度限制在 5 个汉字内
  44. /// </summary>
  45. public string custom_url_name { get; set; }
  46. /// <summary>
  47. /// 开票平台自定义入口跳转外链的地址链接 , 发票外跳的链接会带有发票参数,用于标识是从哪张发票跳出的链接
  48. /// </summary>
  49. public string custom_url { get; set; }
  50. /// <summary>
  51. /// 显示在入口右侧的 tips ,长度限制在 6 个汉字内
  52. /// </summary>
  53. public string custom_url_sub_title { get; set; }
  54. /// <summary>
  55. /// 营销场景的自定义入口
  56. /// </summary>
  57. public string promotion_url_name { get; set; }
  58. /// <summary>
  59. /// 入口跳转外链的地址链接,发票外跳的链接会带有发票参数,用于标识是从那张发票跳出的链接
  60. /// </summary>
  61. public string promotion_url { get; set; }
  62. /// <summary>
  63. /// 显示在入口右侧的 tips ,长度限制在 6 个汉字内
  64. /// </summary>
  65. public string promotion_url_sub_title { get; set; }
  66. }
  67. /// <summary>
  68. /// 将电子发票卡券插入用户卡包数据
  69. /// </summary>
  70. public class InsertCardToBagData
  71. {
  72. /// <summary>
  73. /// 发票order_id,既商户给用户授权开票的订单号
  74. /// </summary>
  75. public string order_id { get; set; }
  76. /// <summary>
  77. /// 发票card_id
  78. /// </summary>
  79. public string card_id { get; set; }
  80. /// <summary>
  81. /// 该订单号授权时使用的appid,一般为商户appid
  82. /// </summary>
  83. public string appid { get; set; }
  84. /// <summary>
  85. /// 发票具体内容
  86. /// </summary>
  87. public CardExtInfo card_ext { get; set; }
  88. }
  89. /// <summary>
  90. /// 发票具体内容
  91. /// </summary>
  92. public class CardExtInfo
  93. {
  94. /// <summary>
  95. /// 随机字符串,防止重复
  96. /// </summary>
  97. public string nonce_str { get; set; }
  98. /// <summary>
  99. /// 用户信息结构体
  100. /// </summary>
  101. public UserCard user_card { get; set; }
  102. }
  103. /// <summary>
  104. /// 用户信息结构体
  105. /// </summary>
  106. public class UserCard
  107. {
  108. public InvoicePlatformUserData invoice_user_data { get; set; }
  109. }
  110. /// <summary>
  111. /// 发票信息基础公用信息(开票平台,报销方)
  112. /// </summary>
  113. public abstract class InvoiceBaseUseData
  114. {
  115. /// <summary>
  116. /// 发票的金额,以分为单位
  117. /// </summary>
  118. public int fee { get; set; }
  119. /// <summary>
  120. /// 发票的抬头
  121. /// </summary>
  122. public string title { get; set; }
  123. /// <summary>
  124. /// 发票的开票时间,为10位时间戳
  125. /// </summary>
  126. public int billing_time { get; set; }
  127. /// <summary>
  128. /// 发票的发票代码
  129. /// </summary>
  130. public string billing_no { get; set; }
  131. /// <summary>
  132. /// 发票的发票号码
  133. /// </summary>
  134. public string billing_code { get; set; }
  135. /// <summary>
  136. /// 商品详情结构
  137. /// </summary>
  138. public List<ProjectInfo> info { get; set; }
  139. /// <summary>
  140. /// 不含税金额,以分为单位
  141. /// </summary>
  142. public int fee_without_tax { get; set; }
  143. /// <summary>
  144. /// 税额,以分为单位
  145. /// </summary>
  146. public int tax { get; set; }
  147. /// <summary>
  148. /// 校验码,发票pdf右上角,开票日期下的校验码
  149. /// </summary>
  150. public string check_code { get; set; }
  151. /// <summary>
  152. /// 购买方纳税人识别号
  153. /// </summary>
  154. public string buyer_number { get; set; }
  155. /// <summary>
  156. /// 购买方地址、电话
  157. /// </summary>
  158. public string buyer_address_and_phone { get; set; }
  159. /// <summary>
  160. /// 购买方开户行及账号
  161. /// </summary>
  162. public string buyer_bank_account { get; set; }
  163. /// <summary>
  164. /// 销售方纳税人识别号
  165. /// </summary>
  166. public string seller_number { get; set; }
  167. /// <summary>
  168. /// 销售方地址、电话
  169. /// </summary>
  170. public string seller_address_and_phone { get; set; }
  171. /// <summary>
  172. /// 销售方开户行及账号
  173. /// </summary>
  174. public string seller_bank_account { get; set; }
  175. /// <summary>
  176. /// 备注,发票右下角处
  177. /// </summary>
  178. public string remarks { get; set; }
  179. /// <summary>
  180. /// 收款人,发票左下角处
  181. /// </summary>
  182. public string cashier { get; set; }
  183. /// <summary>
  184. /// 开票人,发票下方处
  185. /// </summary>
  186. public string maker { get; set; }
  187. }
  188. /// <summary>
  189. /// 开票平台将电子发票卡券插入用户卡包时的发票信息
  190. /// </summary>
  191. public class InvoicePlatformUserData: InvoiceBaseUseData
  192. {
  193. /// <summary>
  194. /// 发票pdf文件上传到微信发票平台后,会生成一个发票
  195. /// </summary>
  196. public string s_pdf_media_id { get; set; }
  197. /// <summary>
  198. /// 其它消费附件的PDF
  199. /// </summary>
  200. public string s_trip_pdf_media_id { get; set; }
  201. }
  202. /// <summary>
  203. /// 报销方查询报销发票时的发票信息
  204. /// </summary>
  205. public class InvoiceReimburseUserData : InvoiceBaseUseData
  206. {
  207. /// <summary>
  208. /// 这张发票对应的PDF_URL
  209. /// </summary>
  210. public string pdf_url { get; set; }
  211. /// <summary>
  212. /// 其它消费凭证附件对应的URL,如行程单、水单等
  213. /// </summary>
  214. public string trip_pdf_url { get; set; }
  215. /// <summary>
  216. /// 发票报销状态,与<see cref="Reimburse_Status"/>对应
  217. /// </summary>
  218. public string reimburse_status { get; set; }
  219. /// <summary>
  220. /// 尝试转换<see cref="reimburse_status"/>为对应枚举,如果转换失败,则返回null
  221. /// </summary>
  222. public Reimburse_Status? Status
  223. {
  224. get
  225. {
  226. #if !NET35
  227. if (System.Enum.TryParse(this.reimburse_status, out Reimburse_Status status))
  228. {
  229. return status;
  230. }
  231. #else
  232. try
  233. {
  234. return (Reimburse_Status)System.Enum.Parse(typeof(Reimburse_Status), this.reimburse_status);
  235. }
  236. catch { }
  237. #endif
  238. return null;
  239. }
  240. }
  241. }
  242. /// <summary>
  243. /// 商品详情结构
  244. /// </summary>
  245. public class ProjectInfo
  246. {
  247. /// <summary>
  248. /// 项目的名称
  249. /// </summary>
  250. public string name { get; set; }
  251. /// <summary>
  252. /// 项目的数量
  253. /// </summary>
  254. public int num { get; set; }
  255. /// <summary>
  256. /// 项目的单位
  257. /// </summary>
  258. public string unit { get; set; }
  259. /// <summary>
  260. /// 项目的单价
  261. /// </summary>
  262. public int price { get; set; }
  263. }
  264. /// <summary>
  265. /// 单张发票
  266. /// </summary>
  267. public class InvoiceItem
  268. {
  269. /// <summary>
  270. /// 发票卡券的 card_id
  271. /// </summary>
  272. public string card_id { get; set; }
  273. /// <summary>
  274. /// 发票卡券的加密 code ,和 card_id 共同构成一张发票卡券的唯一标识
  275. /// </summary>
  276. public string encrypt_code { get; set; }
  277. }
  278. }