コード例 #1
0
        private T SendRequest <T>(Func <cnpOnlineResponse, T> getResponse, transactionRequest transaction)
        {
            var request = CreateRequest(transaction);
            cnpOnlineResponse response = SendToCnp(request);

            return(getResponse(response));
        }
コード例 #2
0
        private async Task <T> SendRequestAsync <T>(Func <cnpOnlineResponse, T> getResponse, transactionRequest transaction, CancellationToken cancellationToken)
        {
            var request = CreateRequest(transaction);

            cnpOnlineResponse response = await SendToCnpAsync(request, cancellationToken).ConfigureAwait(false);

            return(getResponse(response));
        }
コード例 #3
0
 private cnpOnlineResponse DeserializeResponse(string xmlResponse)
 {
     try
     {
         cnpOnlineResponse cnpOnlineResponse = DeserializeObject(xmlResponse);
         if ("1".Equals(cnpOnlineResponse.response))
         {
             throw new CnpOnlineException(cnpOnlineResponse.message);
         }
         return(cnpOnlineResponse);
     }
     catch (InvalidOperationException ioe)
     {
         throw new CnpOnlineException("Error validating xml data against the schema", ioe);
     }
 }