public async Task <T> ExecuteAsync <T>(IWeChatPayGetRequest <T> request, WeChatPayOptions options) where T : WeChatPayResponse { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (string.IsNullOrEmpty(options.MchId)) { throw new WeChatPayException($"options.{nameof(WeChatPayOptions.MchId)} is Empty!"); } if (string.IsNullOrEmpty(options.Certificate)) { throw new WeChatPayException($"options.{nameof(WeChatPayOptions.Certificate)} is Empty!"); } if (string.IsNullOrEmpty(options.APIv3Key)) { throw new WeChatPayException($"options.{nameof(WeChatPayOptions.APIv3Key)} is Empty!"); } var client = _httpClientFactory.CreateClient(Name); var(headers, body, statusCode) = await client.GetAsync(request, options); var parser = new WeChatPayResponseJsonParser <T>(); var response = parser.Parse(body, statusCode); if (request.GetNeedCheckSign()) { if (!response.IsError) { await CheckResponseSignAsync(headers, body, options); } } return(response); }
public static async Task <(WeChatPayHeaders headers, string body, int statusCode)> GetAsync <T>(this HttpClient client, IWeChatPayGetRequest <T> request, WeChatPayOptions options) where T : WeChatPayResponse