ElectronicOrderModel.cs 3.9 KB

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