Ejemplo n.º 1
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;
     }
 }
Ejemplo n.º 2
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;
            }
        }