static void Main(string[] args) { const string username = "******"; const string apikey = "54a533717fcb1be4577e96ea7a02c1ca9c6e802a56a670379085582ca3c118a7"; const string productName = "coolproduct"; decimal amount = 150M; string currencyCode = "KES"; Dictionary <string, string> metadata = new Dictionary <string, string> { { "what this is", "cool stuff" } }; var gw = new AfricasTalkingGateway(username, apikey); try { Console.WriteLine("Hello World!"); StashResponse res = gw.TopupStash(productName, currencyCode, amount, metadata); Console.WriteLine(res.ToString()); } catch (AfricasTalkingGatewayException e) { Console.WriteLine("We had an errror: " + e); } Console.ReadLine(); }
private void FindBobo(StashResponse stashResponse) { var allAccounts = stashResponse.stashes.Where(s => s.accountName != null).Select(s => s.accountName).ToList(); var boboExists = allAccounts.Any(s => s.Equals("ldbob")); if (boboExists) { Console.WriteLine("Found bobo!"); } }
private void FindHeadhunter(StashResponse stashResponse) { var a = stashResponse.stashes .Where(s => s.items.Where(i => i.name.Equals("Headhunter")).Any()) .ToList(); foreach (var stash in a) { Console.WriteLine("Headhunter sold by " + stash.lastCharacterName); } }
public void DoTopupStash() { const string productName = "coolproduct"; decimal amount = 150M; string currencyCode = "KES"; Dictionary <string, string> metadata = new Dictionary <string, string> { { "what this is", "cool stuff" } }; StashResponse stashResponse = _atGWInstance.TopupStash(productName, currencyCode, amount, metadata); var success = stashResponse.Status == "Success"; Assert.IsTrue(success, "Should successfully topup product stash"); }
public void DoWalletTransfer() { const int productCode = 1234; const string productName = "coolproduct"; decimal amount = 150M; string currencyCode = "KES"; Dictionary <string, string> metadata = new Dictionary <string, string> { { "mode", "transfer" } }; StashResponse stashResponse = _atGWInstance.WalletTransfer(productName, productCode, currencyCode, amount, metadata); var success = stashResponse.Status == "Success"; Assert.IsTrue(success, "Should transfer amounts between wallets"); }
public void DelegateMethod(StashResponse stashResponse) { Console.WriteLine("Fetched " + stashResponse.stashes.Count + " stashes."); FindBobo(stashResponse); FindHeadhunter(stashResponse); }