public async Task <ApiResponse <bool> > CancelPreauth(string transId, string ComGateAPIEndpointUrl) { using (var httpClient = HttpClientFactory.CreateHttpClient(Core.Domain.Enums.ComGateHttpClient.HttpClient)) { CancelPreAuthRequest cancelPreauthRequest = new CancelPreAuthRequest() .SetMerchant(this.Merchant) .SetSecret(this.Secret) .SetTransactionID(transId); var content = _serializer.Serialize <CancelPreAuthRequest>(cancelPreauthRequest); httpClient.BaseAddress = new Uri(ComGateAPIEndpointUrl); var response = await httpClient.PostAsync("cancelPreauth", content); if (response.IsSuccessStatusCode) { var responseContent = await response.Content.ReadAsStringAsync(); return(_serializer.Deserialize <bool>(responseContent)); } else { throw new Exception("Cannot create method list"); } } }
private IEnumerable <KeyValuePair <string, string> > CreateCancelPreauthMandatoryParams(CancelPreAuthRequest request) { List <KeyValuePair <string, string> > mandatoryParameters = new List <KeyValuePair <string, string> >(); mandatoryParameters.Add(new KeyValuePair <string, string>("merchant", request.Merchant)); mandatoryParameters.Add(new KeyValuePair <string, string>("secret", request.Secret)); mandatoryParameters.Add(new KeyValuePair <string, string>("transId", request.TransactionID)); return(mandatoryParameters); }