Request.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections.Generic;
  2. using PaySharp.Core.Response;
  3. using PaySharp.Core.Utils;
  4. namespace PaySharp.Core.Request
  5. {
  6. public abstract class Request<TModel, TResponse> where TResponse : IResponse
  7. {
  8. protected Request()
  9. {
  10. GatewayData = new GatewayData();
  11. }
  12. protected Request(IComparer<string> comparer)
  13. {
  14. GatewayData = new GatewayData(comparer);
  15. }
  16. /// <summary>
  17. /// 请求地址
  18. /// </summary>
  19. public string RequestUrl { get; set; }
  20. /// <summary>
  21. /// 异步通知地址
  22. /// </summary>
  23. public string NotifyUrl { get; set; }
  24. /// <summary>
  25. /// 同步通知地址
  26. /// </summary>
  27. public string ReturnUrl { get; set; }
  28. /// <summary>
  29. /// 网关数据
  30. /// </summary>
  31. /// <returns></returns>
  32. public GatewayData GatewayData { get; }
  33. /// <summary>
  34. /// 模型
  35. /// </summary>
  36. /// <returns></returns>
  37. public TModel Model { get; private set; }
  38. /// <summary>
  39. /// 添加网关数据
  40. /// </summary>
  41. /// <param name="model">模型</param>
  42. public virtual void AddGatewayData(TModel model)
  43. {
  44. Model = model;
  45. ValidateUtil.Validate(model, null);
  46. }
  47. }
  48. }