diff --git a/CHANGELOG.md b/CHANGELOG.md index fdba0b05566a..1c290ed30420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ - Client portal: Hide "Pay now" buttons if no gateways are configured ## Fixed: -- Client portal: Showing message instead of blank page when trying to download zero quotes. +- Client portal: Showing message instead of blank page when trying to download zero quotes +- Client portal: Fixed bug with payment gateways after checking for required fields ## [v5.2.0-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.2.0-release) ## Added: diff --git a/tests/Browser/ClientPortal/PaymentsTest.php b/tests/Browser/ClientPortal/PaymentsTest.php index 835389d16506..5131ac1d218e 100644 --- a/tests/Browser/ClientPortal/PaymentsTest.php +++ b/tests/Browser/ClientPortal/PaymentsTest.php @@ -12,6 +12,8 @@ namespace Tests\Browser\ClientPortal; +use App\Models\Client; +use App\Models\CompanyGateway; use Laravel\Dusk\Browser; use Tests\Browser\Pages\ClientPortal\Login; use Tests\DuskTestCase; @@ -42,4 +44,37 @@ class PaymentsTest extends DuskTestCase ->visitRoute('client.logout'); }); } + + public function testRequiredFieldsCheck() + { + $this->disableCompanyGateways(); + + // Enable Stripe. + CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore(); + + // Stripe requires post code. + Client::first()->update(['postal_code' => null]); + + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('Credit Card') + ->assertSee('Postal Code') + ->type('client_postal_code', 10000) + ->press('Continue') + ->pause(2000) + ->type('#cardholder-name', 'John Doe') + ->withinFrame('iframe', function (Browser $browser) { + $browser + ->type('cardnumber', '4242 4242 4242 4242') + ->type('exp-date', '04/22') + ->type('cvc', '242'); + }) + ->click('#pay-now') + ->waitForText('Details of the payment', 60) + ->visitRoute('client.logout'); + }); + } }