Exemplo n.º 1
0
        public Response <PaymentResponse> FinishTransaction(SecureMessageRequest request)
        {
            RestRequest restsharpRequest;
            RestClient  restClient;

            PrepareRestClient(request, out restsharpRequest, out restClient);

            IRestResponse response = restClient.Execute(restsharpRequest);

            return(HandleResponse <PaymentResponse>(response));
        }
Exemplo n.º 2
0
 private void PrepareRestClient(SecureMessageRequest request, out RestRequest restsharpRequest, out RestClient restClient)
 {
     restsharpRequest = new RestRequest
     {
         Method        = Method.POST,
         Resource      = "/pares",
         XmlSerializer = new RestSharp.Serializers.DotNetXmlSerializer(),
         RequestFormat = DataFormat.Xml
     };
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
     restsharpRequest.AddBody(request);
     restClient = new RestClient(rootUrl);
 }
Exemplo n.º 3
0
        public Task <Response <PaymentResponse> > FinishTransactionAsync(SecureMessageRequest request)
        {
            RestRequest restsharpRequest;
            RestClient  restClient;

            PrepareRestClient(request, out restsharpRequest, out restClient);

            IRestResponse response             = restClient.Execute(restsharpRequest);
            var           taskCompletionSource = new TaskCompletionSource <Response <PaymentResponse> >();

            restClient.ExecuteAsync(restsharpRequest, (r) =>

                                    taskCompletionSource.SetResult(HandleResponse <PaymentResponse>(r))
                                    );
            return(taskCompletionSource.Task);
        }
Exemplo n.º 4
0
 private void PrepareRequest()
 {
     smRequest       = new SecureMessageRequest();
     smRequest.MD    = _secureMessage.AuthenticityToken;
     smRequest.PaRes = _secureMessage.Pareq;
 }