BaseRequest.cs 860 B

12345678910111213141516171819202122232425262728293031323334
  1. using PaySharp.Core.Request;
  2. using PaySharp.Core.Response;
  3. using PaySharp.Core.Utils;
  4. namespace PaySharp.Wechatpay.Request
  5. {
  6. public class BaseRequest<TModel, TResponse> : Request<TModel, TResponse> where TResponse : IResponse
  7. {
  8. public BaseRequest()
  9. {
  10. RequestUrl = "/pay/unifiedorder";
  11. }
  12. public override void AddGatewayData(TModel model)
  13. {
  14. base.AddGatewayData(model);
  15. GatewayData.Add(model, StringCase.Snake);
  16. }
  17. /// <summary>
  18. /// 是否需要使用证书
  19. /// </summary>
  20. internal bool IsUseCert { get; set; }
  21. internal virtual void Execute(Merchant merchant)
  22. {
  23. if (!string.IsNullOrEmpty(NotifyUrl))
  24. {
  25. GatewayData.Add("notify_url", NotifyUrl);
  26. }
  27. }
  28. }
  29. }