public async Task <PaymentRequestResult> CreatePaymentAsync( PaymentRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (string.IsNullOrWhiteSpace(request.MerchantId)) { request.MerchantId = this.MerchantId; } var zarinpalRequest = request.ToZarinpalRequest(); var result = await _httpClient .PostAsync <ZarinpalPaymentRequest, ZarinpalPaymentRequestResult>( zarinpalRequest, ZarinpalApiHelper .GetPaymentRequestUrl(SandboxMode) ); return(await Task.FromResult(result.ToResult())); }
public async Task <IActionResult> Callback([FromQuery(Name = "auth_code")] string authCode) { var url = "https://ad.toutiao.com/open_api/oauth2/access_token/"; var request = new AuthRequest { AppId = _setting.AppId, Secret = _setting.Secret, AuthCode = authCode }; var response = await _restClient.PostAsync <AuthResponse>(url, request); response.EnsureSuccess(); _cache.Set(ToutiaoCacheKey.AccessToken, response.Data.AccessToken); return(Redirect("/swagger/index.html")); }
public async Task PostAsync_forwards_to_IHttpRestClient(IHttpRestClient client, string path, IQueryString queryString) { await client.PostAsync(path, queryString); Mock.Get(client).Verify(p => p.SendAsync(HttpMethod.Post, path, queryString)); }
public async Task PostAsync_forwards_to_IHttpRestClient(IHttpRestClient client, string path, Request request, IQueryString queryString, Response _) { _ = await client.PostAsync <Request, Response>(path, request, queryString); Mock.Get(client).Verify(p => p.SendAsync <Request, Response>(HttpMethod.Post, path, request, queryString)); }