public dynamic MobileB2B(string productName, string provider, string transferType, string currencyCode, int amount, string destinationChannel, string destinationAccount) { var b2BData = new B2BData() { Username = _username, ProductName = productName, Provider = provider, TransferType = transferType, CurrencyCode = currencyCode, Amount = amount, DestinationChannel = destinationChannel, DestinationAccount = destinationAccount }; try { string b2Bresponse = PostB2BJson(b2BData, PAYMENTS_B2B_URLString); return(b2Bresponse); } catch (Exception ex) { throw new AfricasTalkingGatewayException(ex); } }
public string PostB2BJson(B2BData dataMap, string url) { var client = new HttpClient(); client.DefaultRequestHeaders.Add("apiKey", _apiKey); var result = client.PostAsJsonAsync <B2BData>(url, dataMap).Result; result.EnsureSuccessStatusCode(); var stringResult = result.Content.ReadAsStringAsync().Result; return(stringResult); }