using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace LifePayment.Domain.Shared { public class WxPayPostBaseModel { /// /// 应用ID /// [JsonProperty("appid")] [Required] public string Appid { get; set; } /// /// 直连商户号 /// [JsonProperty("mchid")] [Required] public string Mchid { get; set; } } public class CertificatesReponse { [JsonProperty("data")] public List Data { get; set; } } public class CertificatesReponseDetail { [JsonProperty("serial_no")] public string SerialNo { get; set; } [JsonProperty("effective_time")] public string EffectiveTime { get; set; } [JsonProperty("expire_time")] public string ExpireTime { get; set; } [JsonProperty("encrypt_certificate")] public EncryptCertificate EncryptCertificate { get; set; } } public class EncryptCertificate { [JsonProperty("algorithm")] public string Algorithm { get; set; } [JsonProperty("nonce")] public string Nonce { get; set; } [JsonProperty("associated_data")] public string AssociatedData { get; set; } [JsonProperty("ciphertext")] public string Ciphertext { get; set; } } public class WxPayGetBaseModel { /// /// 直连商户号 /// [JsonProperty("mchid")] [Required] [Query] public string Mchid { get; set; } } public class PayTransactionsNativeInput : WxPayPostBaseModel { /// /// 商品描述 /// [JsonProperty("description")] [Required] public string Description { get; set; } /// /// 商户订单号 /// [JsonProperty("out_trade_no")] [Required] public string OutTradeNo { get; set; } /// /// 交易结束时间 /// [JsonProperty("time_expire", NullValueHandling = NullValueHandling.Ignore)] public string TimeExpire { get; set; } /// /// 附加数据 /// [JsonProperty("attach", NullValueHandling = NullValueHandling.Ignore)] public string Attach { get; set; } /// /// 通知地址 /// [JsonProperty("notify_url")] [Required] public string NotifyUrl { get; set; } /// /// 订单优惠标记 /// [JsonProperty("goods_tag", NullValueHandling = NullValueHandling.Ignore)] public string GoodsTag { get; set; } /// /// 订单金额 /// [JsonProperty("amount")] [Required] public PayAmount Amount { get; set; } } public class PayTransactionsNativeH5 : WxPayPostBaseModel { /// /// 商品描述 /// [JsonProperty("description")] [Required] public string Description { get; set; } /// /// 商户订单号 /// [JsonProperty("out_trade_no")] [Required] public string OutTradeNo { get; set; } /// /// 交易结束时间 /// [JsonProperty("time_expire", NullValueHandling = NullValueHandling.Ignore)] public string TimeExpire { get; set; } /// /// 附加数据 /// [JsonProperty("attach", NullValueHandling = NullValueHandling.Ignore)] public string Attach { get; set; } /// /// 通知地址 /// [JsonProperty("notify_url")] [Required] public string NotifyUrl { get; set; } /// /// 订单优惠标记 /// [JsonProperty("goods_tag", NullValueHandling = NullValueHandling.Ignore)] public string GoodsTag { get; set; } /// /// 订单金额 /// [JsonProperty("amount")] [Required] public PayAmount Amount { get; set; } [JsonProperty("scene_info")] public H5SceneInfo SceneInfo { get; set; } } public class PayAmount { /// /// 订单总金额,单位为分。 /// [JsonProperty("total")] [Required] public int Total { get; set; } /// /// 货币类型 CNY:人民币,境内商户号仅支持人民币。 /// [JsonProperty("currency")] public string Currency { get; set; } = "CNY"; } public class H5SceneInfo { /// /// 用户终端IP /// [JsonProperty("payer_client_ip")] public string PayerClientIp { get; set; } [JsonProperty("h5_info")] public H5Info H5Info { get; set; } } public class H5Info { /// /// 场景类型 /// [JsonProperty("type")] public string Type { get; set; } } public class PayTransactionsNativeReponse { /// /// 二维码链接 /// [JsonProperty("code_url")] public string CodeUrl { get; set; } /// /// 错误码 /// [JsonProperty("code")] public string Code { get; set; } /// /// 说明信息 /// [JsonProperty("message")] public string Message { get; set; } } public class PayTransactionsH5Reponse { /// /// 二维码链接 /// [JsonProperty("h5_url")] public string H5Url { get; set; } /// /// 错误码 /// [JsonProperty("code")] public string Code { get; set; } /// /// 说明信息 /// [JsonProperty("message")] public string Message { get; set; } } public class PayTransactionsInput : WxPayGetBaseModel { /// /// 商户订单号 /// [JsonProperty("out-trade-no")] [Required] [Path] public string OutTradeNo { get; set; } } public class PayTransactionsReponse { /// /// 应用ID /// [JsonProperty("appid")] public string Appid { get; set; } /// /// 直连商户号 /// [JsonProperty("mchid")] public string Mchid { get; set; } /// /// 商户订单号 /// [JsonProperty("out_trade_no")] public string OutTradeNo { get; set; } /// /// 微信支付订单号 /// [JsonProperty("transaction_id")] public string TransactionId { get; set; } /// /// 交易类型 /// [JsonProperty("trade_type")] public string TradeType { get; set; } /// /// 交易状态 /// [JsonProperty("trade_state")] public string TradeState { get; set; } /// /// 交易状态描述 /// [JsonProperty("trade_state_desc")] public string TradeStateDesc { get; set; } /// /// 付款银行 /// [JsonProperty("bank_type")] public string BankType { get; set; } /// /// 附加数据 /// [JsonProperty("attach")] public string Attach { get; set; } /// /// 支付完成时间 /// [JsonProperty("success_time")] public string SuccessTime { get; set; } /// /// 支付者 /// [JsonProperty("payer")] public Payer Payer { get; set; } /// /// 订单金额 /// [JsonProperty("amount")] public Amount Amount { get; set; } /// /// 场景信息 /// [JsonProperty("scene_info")] public SceneInfo SceneInfo { get; set; } /// /// 优惠功能 /// [JsonProperty("promotion_detail")] public List PromotionDetail { get; set; } } public class Payer { /// /// 用户标识 /// [JsonProperty("openid")] [Required] public string Openid { get; set; } } public class Amount { /// /// 总金额 /// [JsonProperty("total", NullValueHandling = NullValueHandling.Ignore)] [Required] public int Total { get; set; } /// /// 用户支付金额 /// [JsonProperty("payer_total", NullValueHandling = NullValueHandling.Ignore)] [Required] public int PayerTotal { get; set; } /// /// 货币类型 /// [JsonProperty("currency", NullValueHandling = NullValueHandling.Ignore)] [Required] public string Currency { get; set; } /// /// 用户支付币种 /// [JsonProperty("payer_currency", NullValueHandling = NullValueHandling.Ignore)] [Required] public string PayerCurrency { get; set; } } public class SceneInfo { /// /// 商户端设备号 /// [JsonProperty("device_id", NullValueHandling = NullValueHandling.Ignore)] [Required] public string DeviceId { get; set; } } public class PromotionDetail { /// /// 券ID /// [JsonProperty("coupon_id")] public string CouponId { get; set; } /// /// 优惠名称 /// [JsonProperty("name")] public string Name { get; set; } /// /// 优惠范围 /// [JsonProperty("scope")] public string Scope { get; set; } /// /// 优惠类型 /// [JsonProperty("type")] public string Type { get; set; } /// /// 优惠券面额 /// [JsonProperty("amount")] public int Amount { get; set; } /// /// 活动ID /// [JsonProperty("stock_id")] public string StockId { get; set; } /// /// 微信出资 /// [JsonProperty("wechatpay_contribute")] public int WechatpayContribute { get; set; } /// /// 商户出资 /// [JsonProperty("merchant_contribute")] public int MerchantContribute { get; set; } /// /// 其他出资 /// [JsonProperty("other_contribute")] public int OtherContribute { get; set; } /// /// 优惠币种 /// [JsonProperty("currency")] public string Currency { get; set; } /// /// 单品列表 /// [JsonProperty("goods_detail")] public GoodsDetail GoodsDetail { get; set; } } public class GoodsDetail { /// /// 商品编码 /// [JsonProperty("goods_id")] public string GoodsId { get; set; } /// /// 商品数量 /// [JsonProperty("quantity")] public int Quantity { get; set; } /// /// 商品单价 /// [JsonProperty("unit_price")] public int UnitPrice { get; set; } /// /// 商品优惠金额 /// [JsonProperty("discount_amount")] public int DiscountAmount { get; set; } /// /// 商品备注 /// [JsonProperty("goods_remark")] public string GoodsRemark { get; set; } } public class QueryAttribute : Attribute { } public class PathAttribute : Attribute { } public class ModelPaymentMiniPay { public string NonceStr { get; set; } public string Package { get; set; } public string SignType { get; set; } public string PaySign { get; set; } public string Timestamp { get; set; } /// /// 订单失效时间 /// public string TimeExpire { get; set; } /// /// 错误信息 /// public string Message { get; set; } } /// /// 小程序支付请求 /// public class ModelMiniPayRequest : WxPayPostBaseModel { [JsonProperty("out_trade_no")] public string OutTradeNo { get; set; } [JsonProperty("description")] public string Description { get; set; } [JsonProperty("notify_url")] public string NotifyUrl { get; set; } [JsonProperty("attach")] public string Attach { get; set; } [JsonProperty("time_expire")] public string TimeExpire { get; set; } [JsonProperty("amount")] public Model_MiniPay_Amount Amount { get; set; } [JsonProperty("payer")] public Model_MiniPay_Payer Payer { get; set; } } /// /// 订单金额信息 /// public class Model_MiniPay_Amount { [JsonProperty("total")] public int Total { get; set; } [JsonProperty("currency")] public string Currency { get; set; } } /// /// 支付者信息 /// public class Model_MiniPay_Payer { [JsonProperty("openid")] public string OpenId { get; set; } } public class ModelPayPrePayId { [JsonProperty("prepay_id")] public string PrepayId { get; set; } [JsonProperty("code")] public string Code { get; set; } [JsonProperty("message")] public string Message { get; set; } } public class LifePayJsAPIRequest { public string OpenId { get; set; } public string Attach { get; set; } } /// /// 申请退款 /// public class WxPayDomesticRefundsRequest { /// /// 商户订单号 和out_trade_no必须二选一进行传参 /// [JsonProperty("out_trade_no")] public string OutTradeNo { get; set; } /// /// 商户退款单号 必填 /// [JsonProperty("out_refund_no")] public string OutRefundNo { get; set; } ///// ///// 退款原因 ///// //[JsonProperty("reason")] //public string Reason { get; set; } /// /// 退款结果回调url /// [JsonProperty("notify_url")] public string NotifyUrl { get; set; } /// /// 金额信息 必填 /// [JsonProperty("amount")] public Model_WxPayDomesticRefunds_Amount Amount { get; set; } } public class Model_WxPayDomesticRefunds_Amount { /// /// 退款金额,单位为分,只能为整数 /// [JsonProperty("refund")] public int Refund { get; set; } /// /// 原订单金额 /// [JsonProperty("total")] public int Total { get; set; } /// /// 退款币种 /// [JsonProperty("currency")] public string Currency { get; set; } = "CNY"; } public class WxPayDomesticRefundsReponse { /// /// 微信支付退款单号 /// [JsonProperty("refund_id")] public string RefundId { get; set; } /// /// 商户退款单号 /// [JsonProperty("out_refund_no")] public string OutRefundNo { get; set; } /// /// 微信支付订单号 /// [JsonProperty("transaction_id")] public string TransactionId { get; set; } /// /// 商户订单号 /// [JsonProperty("out_trade_no")] public string OutTradeNo { get; set; } /// /// 退款渠道 ORIGINAL: 原路退款 BALANCE: 退回到余额 OTHER_BALANCE: 原账户异常退到其他余额账户 OTHER_BANKCARD: 原银行卡异常退到其他银行卡(发起异常退款成功后返回) /// [JsonProperty("channel")] public string Channel { get; set; } /// /// 退款入账账户 /// [JsonProperty("user_received_account")] public string UserReceivedAccount { get; set; } /// /// 退款成功时间 /// [JsonProperty("success_time")] public string SuccessTime { get; set; } /// /// 退款创建时间 /// [JsonProperty("create_time")] public string CreateTime { get; set; } /// /// 退款状态 /// [JsonProperty("status")] public string Status { get; set; } /// /// 资金账户 /// [JsonProperty("funds_account")] public string FundsAccount { get; set; } /// /// 金额信息 /// [JsonProperty("amount")] public Model_WxPayRetuenDomesticRefunds_Amount Amount { get; set; } /// /// 返回信息 /// [JsonProperty("message")] public string Message { get; set; } [JsonProperty("code")] public string Code { get; set; } } public class Model_WxPayRetuenDomesticRefunds_Amount: Model_WxPayDomesticRefunds_Amount { /// /// 用户实际支付金额 /// [JsonProperty("payer_total")] public int PayerTotal { get; set; } /// /// 用户退款金额 /// [JsonProperty("payer_refund")] public int PayerRefund { get; set; } /// /// 应结退款金额 /// [JsonProperty("settlement_refund")] public int SettlementRefund { get; set; } /// /// 应结订单金额 /// [JsonProperty("settlement_total")] public int SettlementTotal { get; set; } /// /// 优惠退款金额 /// [JsonProperty("discount_refund")] public int DiscountRefund { get; set; } /// /// 手续费退款金额 /// [JsonProperty("refund_fee")] public int RefundFee { get; set; } } public class WxPayTradeBillApplyRequest { /// /// 微信支付订单号 /// [JsonProperty("out_bill_no")] public string OutBillNo { get; set; } } public class WxPayTradeBillApplyReponse { /// /// 微信支付订单号 /// [JsonProperty("transfer_bill_no")] public string TransferBillNo { get; set; } } public class WxPayTradeBillQueryRequest { /// /// 微信支付订单号 /// [JsonProperty("transfer_bill_no")] public string TransferBillNo { get; set; } } public class WxPayTradeBillQueryReponse { [JsonProperty("download_url")] public string DownloadUrl { get; set; } } public class WxPayDomesticRefundsQueryReponse { /// /// 返回结果 /// [JsonProperty("code")] public string Code { get; set; } /// /// 返回信息 /// [JsonProperty("message")] public string Message { get; set; } /// /// 微信支付退款单号 /// [JsonProperty("refund_id ")] public string RefundId { get; set; } /// /// 微信支付退款状态 /// [JsonProperty("refund_status ")] public string RefundStatus { get; set; } /// /// 商户退款单号 /// [JsonProperty("out_refund_no")] public string DownloadUrl { get; set; } /// /// 微信支付订单号 /// [JsonProperty("transaction_id ")] public string TransactionId { get; set; } /// /// 商户订单号 /// [JsonProperty("out_trade_no")] public string OutTradeNo { get; set; } /// /// 退款渠道 ORIGINAL: 原路退款 BALANCE: 退回到余额 OTHER_BALANCE: 原账户异常退到其他余额账户 OTHER_BANKCARD: 原银行卡异常退到其他银行卡(发起异常退款成功后返回) /// [JsonProperty("channel")] public string Channel { get; set; } /// /// 退款入账账户 /// [JsonProperty("user_received_account")] public string UserReceivedAccount { get; set; } /// /// 退款成功时间 /// [JsonProperty("success_time")] public string SuccessTime { get; set; } /// /// 退款创建时间 /// [JsonProperty("create_time")] public string CreateTime { get; set; } /// /// 退款状态 SUCCESS: 退款成功 CLOSED: 退款关闭 PROCESSING: 退款处理中 ABNORMAL: 退款异常 /// [JsonProperty("status")] public string Status { get; set; } /// /// 金额信息 /// [JsonProperty("amount")] public Model_WxPayDomesticRefunds_Amount Amount { get; set; } } public class WxPayTradeQueryReponse { /// /// 返回结果 /// [JsonProperty("code")] public string Code { get; set; } /// /// 返回信息 /// [JsonProperty("message")] public string Message { get; set; } /// /// 商户订单号 /// [JsonProperty("out_trade_no")] public string OutTradeNo { get; set; } /// /// 微信支付订单号 /// [JsonProperty("transaction_id")] public string TransactionId { get; set; } /// /// 交易类型 /// [JsonProperty("trade_type")] public string TradeType { get; set; } /// /// 交易状态 /// [JsonProperty("trade_state")] public string TradeState { get; set; } /// /// 交易状态描述 /// [JsonProperty("trade_state_desc")] public string TradeStateDesc { get; set; } [JsonProperty("success_time")] public string? SuccessTime { get; set; } // /// 金额信息 /// [JsonProperty("amount")] public Model_WxPayDomesticRefunds_Amount Amount { get; set; } } }