From dec33daae37d23389d89860f1f949abe37a6cbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Fri, 24 Sep 2021 23:26:36 +0200 Subject: [PATCH] Tests: Canceled payments --- app/Models/CompanyGateway.php | 1 - .../ClientPortal/Gateways/Mollie/KBCTest.php | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index 90f15049f7aa..5be23f8a6a6d 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -377,7 +377,6 @@ class CompanyGateway extends BaseModel public function webhookUrl() { - return 'https://invoiceninja.com'; return route('payment_webhook', ['company_key' => $this->company->company_key, 'company_gateway_id' => $this->hashed_id]); } diff --git a/tests/Browser/ClientPortal/Gateways/Mollie/KBCTest.php b/tests/Browser/ClientPortal/Gateways/Mollie/KBCTest.php index 584f5a286885..a8be7b6cbf9f 100644 --- a/tests/Browser/ClientPortal/Gateways/Mollie/KBCTest.php +++ b/tests/Browser/ClientPortal/Gateways/Mollie/KBCTest.php @@ -54,4 +54,36 @@ class KBCTest extends DuskTestCase ->assertSee('Completed'); }); } + + public function testFailedPayment(): void + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('Undefined.') + ->waitForText('Test profile') + ->press('CBC') + ->radio('final_state', 'failed') + ->press('Continue') + ->waitForText('Failed.'); + }); + } + + public function testCancelledTest(): void + { + $this->browse(function (Browser $browser) { + $browser + ->visitRoute('client.invoices.index') + ->click('@pay-now') + ->press('Pay Now') + ->clickLink('Undefined.') + ->waitForText('Test profile') + ->press('CBC') + ->radio('final_state', 'canceled') + ->press('Continue') + ->waitForText('Cancelled.'); + }); + } } \ No newline at end of file