Пример #1
0
 public OrderCardTokenResponse PostTrustedOrder(OrderRequest order, TrustedMerchant trustedMerchant)
 {
     return(this.Process <OrderCardTokenResponse>(
                PayUClientUrlBuilder.BuildPostOrderUrl(this.settings.Url, this.settings.ApiVersion),
                HttpMethod.Post,
                order,
                trustedMerchant));
 }
Пример #2
0
 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));
 }
Пример #3
0
 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;
     }
 }
Пример #4
0
        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;
            }
        }
Пример #5
0
 public Rs TrustedCustomRequest <Rq, Rs>(Uri url, Rq rq, HttpMethod method, TrustedMerchant trustedMerchant)
     where Rs : class
 {
     return(this.Process <Rs>(url, method, rq, trustedMerchant));
 }
Пример #6
0
 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));
 }