OAuthRequest.cs 780 B

123456789101112131415161718192021222324252627
  1. using PaySharp.Core.Exceptions;
  2. using PaySharp.Wechatpay.Domain;
  3. using PaySharp.Wechatpay.Response;
  4. namespace PaySharp.Wechatpay.Request
  5. {
  6. public class OAuthRequest : BaseRequest<OAuthModel, OAuthResponse>
  7. {
  8. public OAuthRequest()
  9. {
  10. RequestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token";
  11. }
  12. internal override void Execute(Merchant merchant)
  13. {
  14. if (string.IsNullOrEmpty(merchant.AppSecret))
  15. {
  16. throw new GatewayException("请设置AppSecret");
  17. }
  18. GatewayData.Add("secret", merchant.AppSecret);
  19. GatewayData.Remove("notify_url");
  20. GatewayData.Remove("sign_type");
  21. GatewayData.Remove("mch_id");
  22. }
  23. }
  24. }