From 1ec2630c6c6c6d649f48a6e89afbcf2ca7f177d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 7 Jul 2021 14:18:36 +0200 Subject: [PATCH] Gateways: Stripe: ACH: Adding ACH account and verifying it --- .../gateways/stripe/ach/verify.blade.php | 4 +- .../ClientPortal/Gateways/Stripe/ACHTest.php | 74 +++++++++++++++++++ 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 tests/Browser/ClientPortal/Gateways/Stripe/ACHTest.php diff --git a/resources/views/portal/ninja2020/gateways/stripe/ach/verify.blade.php b/resources/views/portal/ninja2020/gateways/stripe/ach/verify.blade.php index e173a2dd84a9..46afb0bd3d9a 100644 --- a/resources/views/portal/ninja2020/gateways/stripe/ach/verify.blade.php +++ b/resources/views/portal/ninja2020/gateways/stripe/ach/verify.blade.php @@ -11,11 +11,11 @@ @component('portal.ninja2020.components.general.card-element', ['title' => '#1 ' . ctrans('texts.amount_cents')]) - + @endcomponent @component('portal.ninja2020.components.general.card-element', ['title' => '#2 ' . ctrans('texts.amount_cents')]) - + @endcomponent @component('portal.ninja2020.gateways.includes.pay_now', ['type' => 'submit']) diff --git a/tests/Browser/ClientPortal/Gateways/Stripe/ACHTest.php b/tests/Browser/ClientPortal/Gateways/Stripe/ACHTest.php new file mode 100644 index 000000000000..fd55a6eaad0d --- /dev/null +++ b/tests/Browser/ClientPortal/Gateways/Stripe/ACHTest.php @@ -0,0 +1,74 @@ +driver->manage()->deleteAllCookies(); + } + + $this->browse(function (Browser $browser) { + $browser + ->visit(new Login()) + ->auth(); + }); + + // Enable ACH. + $cg = CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->firstOrFail(); + $fees_and_limits = $cg->fees_and_limits; + $fees_and_limits->{GatewayType::BANK_TRANSFER} = new FeesAndLimits(); + $cg->fees_and_limits = $fees_and_limits; + $cg->save(); + + // ACH required US to be billing country. + $client = Client::first(); + $client->country_id = 840; + $client->save(); + } + + public function testAddingACHAccountAndVerifyingIt() + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.payment_methods.index') + ->press('Add Payment Method') + ->clickLink('Bank Account') + ->type('#account-holder-name', 'John Doe') + ->select('#country', 'US') + ->select('#currency', 'USD') + ->type('#routing-number', '110000000') + ->type('#account-number', '000123456789') + ->check('#accept-terms') + ->press('Add Payment Method') + ->waitForText('ACH (Verification)') + ->type('@verification-1st', '32') + ->type('@verification-2nd', '45') + ->press('Complete Verification') + ->assertSee('Verification completed successfully') + ->assertSee('Bank Transfer'); + }); + } +}