public void TestExhaustedConfirm() { while (this.BAV.RemainingAttempts != 1) { try { this.BAV.Confirm(12, 13); } catch (BankAccountVerificationFailure) { this.BAV.Refresh(); Assert.AreEqual(BankAccountVerification.Pending, this.BAV.State); } } try { this.BAV.Confirm(12, 13); } catch (BankAccountVerificationFailure) { this.BAV.Refresh(); Assert.AreEqual(BankAccountVerification.Failed, this.BAV.State); } Assert.AreEqual(this.BAV.RemainingAttempts, 0); this.BAV = this.BackupBankAccount.Verify(); this.BAV.Confirm(1, 1); Assert.AreEqual(BankAccountVerification.Verified, this.BAV.State); }
public void TestExhaustedConfirm() { while (bav.remaining_attempts != 1) { try { bav.Confirm(12, 13); } catch (BankAccountVerificationFailure) { bav.Refresh(); Assert.AreEqual(BankAccountVerification.pending, bav.state); } } try { bav.Confirm(12, 13); } catch (BankAccountVerificationFailure) { bav.Refresh(); Assert.AreEqual(BankAccountVerification.failed, bav.state); } Assert.AreEqual(bav.remaining_attempts, 0); bav = ba.Verify(); bav.Confirm(1, 1); Assert.AreEqual(BankAccountVerification.verified, bav.state); }
public void TestExhaustedConfirm() { BankAccount ba = createBankAccount(); ba.Verify(); ba.Reload(); BankAccountVerification bav = ba.verification; while (bav.attempts_remaining != 1) { try { bav.Confirm(12, 13); } catch (APIException) { bav = BankAccountVerification.Fetch(bav.href); Assert.AreEqual("succeeded", bav.deposit_status); } } try { bav.Confirm(12, 13); } catch (APIException) { bav = BankAccountVerification.Fetch(bav.href); Assert.AreEqual(bav.verification_status, "failed"); } Assert.AreEqual(bav.attempts_remaining, 0); bav = ba.Verify(); bav.Confirm(1, 1); Assert.AreEqual("succeeded", bav.verification_status); Assert.AreEqual(ba.href, bav.bank_account.href); }
public BankAccountVerifyResult VerifyAccount(BankAccountVerification bv) { BankAccount acct = unitOfWork.BankAccounts.Get(bv.BankAccountId); ApplicationUser user = accountManager.GetUserByIdAsync(acct.UserId).Result; BankAccountVerifyResult result = new BankAccountVerifyResult(); var options = new BankAccountVerifyOptions { AmountOne = bv.Deposit1, AmountTwo = bv.Deposit2, }; var service = new BankAccountService(); CustomerBankAccount bankAccount = service.Verify( user.StripeIdCustomer, acct.StripeIdBankAccount, options ); result.IsVerified = bankAccount.Status == StripeStatuses.verified ? true : false; return(result); }
public void TestFailedConfirm() { BankAccount ba = createBankAccount(); ba.Verify(); ba.Reload(); BankAccountVerification bav = ba.verification; bav.Confirm(12, 13); }
public void TestDoubleConfirm() { BankAccount ba = createBankAccount(); ba.Verify(); ba.Reload(); BankAccountVerification bav = ba.verification; bav.Confirm(1, 1); bav.Confirm(1, 1); }
public void TestBankAccountVerify() { BankAccount ba = createBankAccount(); BankAccountVerification bav = ba.Verify(); ba.Reload(); Assert.AreEqual(ba.verification.id, bav.id); bav.Confirm(1, 1); Assert.AreEqual(bav.attempts, 1); Assert.AreEqual(bav.attempts_remaining, 2); Assert.AreEqual(bav.deposit_status, "succeeded"); Assert.AreEqual(bav.verification_status, "succeeded"); }
public void testOrderNoOverCredit() { Customer merchant = createPersonCustomer(); Order order = merchant.CreateOrder(null); BankAccount ba = createBankAccount(); ba.AssociateToCustomer(merchant); BankAccount buyerBA = createBankAccount(); BankAccountVerification verification = buyerBA.Verify(); verification.Confirm(1, 1); Dictionary <string, object> debitPayload = new Dictionary <string, object>(); debitPayload.Add("order", order.href); debitPayload.Add("description", "Debit for Order #234123"); debitPayload.Add("amount", 5000); Debit debit = buyerBA.Debit(debitPayload); order.Reload(); Assert.AreEqual(debit.order.href, order.href); Assert.AreEqual(5000, debit.amount); Assert.AreEqual(5000, order.amount); Assert.AreEqual(5000, order.amount_escrowed); Dictionary <string, object> creditPayload = new Dictionary <string, object>(); creditPayload.Add("order", order.href); creditPayload.Add("description", "Payout for Order #234123"); creditPayload.Add("amount", 6000); Credit credit = null; try { credit = ba.Credit(creditPayload); } catch (APIException e) { Assert.AreEqual(409, e.status_code); } order.Reload(); Assert.AreEqual(5000, order.amount); Assert.AreEqual(5000, order.amount_escrowed); }
public void TestDebitBankAccountUnverifiedNoCustomer() { Customer customer = new Customer(); customer.Save(); BankAccount ba = createBankAccount(); BankAccountVerification verification = ba.Verify(); verification.Confirm(1, 1); Dictionary <string, object> payload = new Dictionary <string, object>(); payload.Add("amount", 100000); Debit debit = ba.Debit(payload); Assert.AreEqual("succeeded", debit.status); Assert.AreEqual(100000, debit.amount); }
public async Task <IActionResult> Verify(string id, [FromBody] BankAccountVerificationViewModel model) { //verify current users own bankAccount; if (false) { return(Unauthorized()); } if (ModelState.IsValid) { var bv = new BankAccountVerification { Deposit1 = model.Deposit1, Deposit2 = model.Deposit2 }; BankAccountVerifyResult result = bankService.VerifyAccount(bv); return(Ok(result)); } return(BadRequest()); }
public new void Initialize() { base.Initialize(); ba = CreateBankAccount(null); bav = ba.Verify(); }
public new void Initialize() { base.Initialize(); this.BackupBankAccount = this.CreateBankAccount(null); this.BAV = this.BackupBankAccount.Verify(); }