private T SendRequest <T>(Func <cnpOnlineResponse, T> getResponse, transactionRequest transaction) { var request = CreateRequest(transaction); cnpOnlineResponse response = SendToCnp(request); return(getResponse(response)); }
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)); }
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); } }