ElectronicOrderModel.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel.DataAnnotations;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Fuel.Payment.Core.Models
  8. {
  9. /// <summary>
  10. /// Host the phase 1 supported transaction info.
  11. /// </summary>
  12. public class ElectronicOrderModel
  13. {
  14. [Key]
  15. public int Id { get; set; }
  16. [Required]
  17. [MaxLength(192)]
  18. public string SiteId { get; set; }
  19. //public string CurrentBuId { get; set; }
  20. //public string ConfigurationServiceUrl { get; set; }
  21. public Object Config { get; set; }
  22. public Object Certification { get; set; }
  23. /// <summary>
  24. /// Gets or sets the time that client side create this order
  25. /// </summary>
  26. public DateTime? CreationTime { get; set; }
  27. /// <summary>
  28. /// 根据不同场景选择不同的支付方式, accepted values: WX_SCAN、ALI_SCAN、ALL_IN_SCAN
  29. /// </summary>
  30. [Required]
  31. public string Channel { get; set; }
  32. [Required]
  33. public bool IsRefund { get; set; }
  34. /// <summary>
  35. /// trade status, expected values: USERPAYING, SUCCESS, SUCCESS_CANCELLING, PAYERROR, PAYERROR_CANCELLING, CLOSED
  36. /// </summary>
  37. public TradeStatus TradeStatus { get; set; }
  38. /// <summary>
  39. /// Gets or sets the netamount for this transaction, this amount deducted all the discount, and should be the final amount would be charged from
  40. /// customer account.
  41. /// </summary>
  42. [Required]
  43. public decimal NetAmount { get; set; }
  44. /// <summary>
  45. /// Gets or sets the grossamount for this transaction, this is not the final amount to be charged from
  46. /// customer account, need substract the discount.
  47. /// </summary>
  48. public decimal GrossAmount { get; set; }
  49. public decimal TotalAmount { get; set; }
  50. /// <summary>
  51. /// Gets or sets the 商户订单号, 确保唯一
  52. /// </summary>
  53. [Required]
  54. [MaxLength(128)]
  55. public string BillNumber { get; set; }
  56. /// <summary>
  57. /// Gets or sets the 订单标题 UTF8编码格式,32个字节内,最长支持16个汉字
  58. /// </summary>
  59. [MaxLength(32)]
  60. public string Title { get; set; }
  61. /// <summary>
  62. /// Gets or sets 用户授权码, 当商户用扫码枪扫用户的条形码时得到的字符串
  63. /// </summary>
  64. [Required]
  65. public string AuthCode { get; set; }
  66. /// <summary>
  67. /// Gets or sets the operator id for who submit this order from site.
  68. /// </summary>
  69. [MaxLength(128)]
  70. public string OperatorId { get; set; }
  71. /// <summary>
  72. /// Gets or sets the terminal id for submit this order
  73. /// </summary>
  74. [MaxLength(128)]
  75. public string TerminalId { get; set; }
  76. /// <summary>
  77. /// Gets or sets the time that server received this order for processing.
  78. /// </summary>
  79. public DateTime? ReceivedTime { get; set; }
  80. /// <summary>
  81. /// Gets or set the Optional data.
  82. /// sample: {"key1":"value1","key2":"value2",...}
  83. /// 用户自定义的参数,将会在webhook通知中原样返回,该字段主要用于商户携带订单的自定义数据
  84. /// </summary>
  85. public Dictionary<string, object> Optional { get; set; } = new Dictionary<string, object>();
  86. [Required(ErrorMessage = "Need provide at least one FuelOrderDetail")]
  87. public List<FuelOrderDetailModel> FuelOrderDetails { get; set; }
  88. /// <summary>
  89. /// Gets or sets the process result which from the communication result with the 3rd party payment server
  90. /// </summary>
  91. public List<ElectronicOrderProcessResultModel> ProcessResults { get; set; }
  92. /// <summary>
  93. /// 设备公网IP
  94. /// </summary>
  95. public string IpAddress { get; set; }
  96. public object UnifiedOrderResult { get; set; }
  97. public string ToSimpleLogString()
  98. {
  99. return "SiteId: " + this.SiteId + ", BillNumber: " + this.BillNumber;
  100. }
  101. }
  102. }