public OrderCardTokenResponse PostTrustedOrder(OrderRequest order, TrustedMerchant trustedMerchant) { return(this.Process <OrderCardTokenResponse>( PayUClientUrlBuilder.BuildPostOrderUrl(this.settings.Url, this.settings.ApiVersion), HttpMethod.Post, order, trustedMerchant)); }
public async Task <OrderCardTokenResponse> PostTrustedOrderAsync(OrderRequest order, TrustedMerchant trustedMerchant, CancellationToken ct = default(CancellationToken)) { return(await this.ProcessAsync <OrderCardTokenResponse>( PayUClientUrlBuilder.BuildPostOrderUrl(this.settings.Url, this.settings.ApiVersion), HttpMethod.Post, ct, order, trustedMerchant)); }
protected T Process <T>(Uri requestUrl, HttpMethod httpMethod, object content = default(HttpContent), TrustedMerchant trustedMerchant = null) where T : class { try { var token = this.cache.GetTokenFromCache <PayUToken>(this.settings, this.clientFactory, trustedMerchant); var request = PayUClientRequestBuilder.BuildRequestMessage(requestUrl, httpMethod, token.AccessToken, content); var communicator = new PayUApiHttpCommunicator <T>(this.clientFactory, this.settings); return(communicator.Send(request)); } catch { throw; } }
protected async Task <T> ProcessAsync <T>(Uri requestUrl, HttpMethod httpMethod, CancellationToken ct, object content = default(HttpContent), TrustedMerchant trustedMerchant = null) where T : class { try { var token = await this.cache.GetTokenFromCacheAsync <PayUToken>(this.settings, this.clientFactory, trustedMerchant, ct); var request = PayUClientRequestBuilder.BuildRequestMessage(requestUrl, httpMethod, token.AccessToken, content); var communicator = new PayUApiHttpCommunicator <T>(this.clientFactory, this.settings); return(await communicator.SendAsync(request, ct)); } catch { throw; } }
public Rs TrustedCustomRequest <Rq, Rs>(Uri url, Rq rq, HttpMethod method, TrustedMerchant trustedMerchant) where Rs : class { return(this.Process <Rs>(url, method, rq, trustedMerchant)); }
public async Task <Rs> TrustedCustomRequestAsync <Rq, Rs>(Uri url, Rq rq, HttpMethod method, TrustedMerchant trustedMerchant, CancellationToken ct) where Rs : class { return(await this.ProcessAsync <Rs>(url, method, ct, rq, trustedMerchant)); }