public Task <AchResponse> PostAchAsync(AchRequest postRequest) { var request = new RestRequest(Urls.AchApiV1Post, Method.POST); request.AddJsonBody(postRequest); return(MakeRestRequest <AchResponse>(request)); }
public async Task MakesAndFindsATxn_Test() { var ach = new AchRequest { Amount = 1000, Mid = _merchantId, Terminal = new Terminal { EntryType = EntryType.Keypad, TerminalId = _terminalId, TerminalType = TerminalType.ECommerce }, Account = new BankAccountInformation { Aba = "031000503", AccountNumber = "1412423", BankName = "No bank", AccountVerification = new AccountVerification { AccountHolderName = "john doe" } } }; var response = await _client.PostAchAsync(ach); Assert.IsNotNull(response); var inq = await _client.InquireAchAsync(_merchantId, _terminalId, response.TransactionReference); Assert.AreEqual("Queued for Capture", inq.Status); }
public async Task ValidAchPosts_Test() { var ach = new AchRequest { Amount = 1000, Mid = _merchantId, Terminal = new Terminal { EntryType = EntryType.Keypad, TerminalId = _terminalId, TerminalType = TerminalType.ECommerce }, Account = new BankAccountInformation { Aba = "031000503", AccountNumber = "1412423", BankName = "A bank", AccountVerification = new AccountVerification { AccountHolderName = "john doe" } } }; var response = await _client.PostAchAsync(ach); Assert.IsNotNull(response.TransactionReference); Assert.IsNotNull(response.AuthCode); }
public async Task ThrowsGP01OnBadMid_Test() { var ach = new AchRequest { Amount = 1000, Mid = _merchantId + "0", Terminal = new Terminal { EntryType = EntryType.Keypad, TerminalId = _terminalId, TerminalType = TerminalType.ECommerce }, Account = new BankAccountInformation { Aba = "031000503", AccountNumber = "1412423", BankName = "No bank", AccountVerification = new AccountVerification { AccountHolderName = "john doe" } } }; var ex = await Assert.ThrowsExceptionAsync <AchTransactionException>(async() => { var response = await _client.PostAchAsync(ach); }); Assert.AreEqual("GP01", ex.Code); }
//[TestMethod] public async Task DoABunchOfAch_Test() { var ach = new AchRequest { Amount = 1000, Mid = _merchantId, Terminal = new Terminal { EntryType = EntryType.Keypad, TerminalId = _terminalId, TerminalType = TerminalType.ECommerce }, Account = new BankAccountInformation { Aba = "131000503", AccountNumber = "1412423", BankName = "A bank", AccountVerification = new AccountVerification { AccountHolderName = "john doe" } } }; try { await _client.PostAchAsync(ach); } catch { } var tasks = Enumerable.Range(0, 500).Select(n => _client.PostAchAsync(ach)); var stopwatch = new Stopwatch(); stopwatch.Start(); try { await Task.WhenAll(tasks); } catch { } stopwatch.Stop(); Console.WriteLine($"{stopwatch.Elapsed}"); }