using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Fuel.Infrastructure.Payment.Models
{
public class ElectronicOrderModel
{
[Key]
public int Id { get; set; }
[Required]
[MaxLength(192)]
public string SiteId { get; set; }
//public string CurrentBuId { get; set; }
//public string ConfigurationServiceUrl { get; set; }
public Object Config { get; set; }
public Object Certification { get; set; }
///
/// Gets or sets the time that client side create this order
///
public DateTime? CreationTime { get; set; }
///
/// 根据不同场景选择不同的支付方式, accepted values: WX_SCAN、ALI_SCAN、ALL_IN_SCAN
///
[Required]
public string Channel { get; set; }
[Required]
public bool IsRefund { get; set; }
///
/// trade status, expected values: USERPAYING, SUCCESS, SUCCESS_CANCELLING, PAYERROR, PAYERROR_CANCELLING, CLOSED
///
public TradeStatus TradeStatus { get; set; }
///
/// Gets or sets the netamount for this transaction, this amount deducted all the discount, and should be the final amount would be charged from
/// customer account.
///
[Required]
public decimal NetAmount { get; set; }
///
/// Gets or sets the grossamount for this transaction, this is not the final amount to be charged from
/// customer account, need substract the discount.
///
public decimal GrossAmount { get; set; }
public decimal TotalAmount { get; set; }
///
/// Gets or sets the 商户订单号, 确保唯一
///
[Required]
[MaxLength(128)]
public string BillNumber { get; set; }
///
/// Gets or sets the 订单标题 UTF8编码格式,32个字节内,最长支持16个汉字
///
[MaxLength(32)]
public string Title { get; set; }
///
/// Gets or sets 用户授权码, 当商户用扫码枪扫用户的条形码时得到的字符串
///
[Required]
public string AuthCode { get; set; }
///
/// Gets or sets the operator id for who submit this order from site.
///
[MaxLength(128)]
public string OperatorId { get; set; }
///
/// Gets or sets the terminal id for submit this order
///
[MaxLength(128)]
public string TerminalId { get; set; }
///
/// Gets or sets the time that server received this order for processing.
///
public DateTime? ReceivedTime { get; set; }
///
/// Gets or set the Optional data.
/// sample: {"key1":"value1","key2":"value2",...}
/// 用户自定义的参数,将会在webhook通知中原样返回,该字段主要用于商户携带订单的自定义数据
///
public Dictionary Optional { get; set; } = new Dictionary();
[Required(ErrorMessage = "Need provide at least one FuelOrderDetail")]
public List FuelOrderDetails { get; set; }
///
/// Gets or sets the process result which from the communication result with the 3rd party payment server
///
public List ProcessResults { get; set; }
public string ToSimpleLogString()
{
return "SiteId: " + this.SiteId + ", BillNumber: " + this.BillNumber;
}
}
}