Tests: Failed/canceled payments

This commit is contained in:
Benjamin Beganović 2021-09-24 23:51:39 +02:00
parent 79637d18d2
commit 29e006f950
2 changed files with 46 additions and 1 deletions

View File

@ -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]);
}

View File

@ -53,4 +53,50 @@ class BancontactTest extends DuskTestCase
->assertSee('Completed');
});
}
public function testOpenPayments(): void
{
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.invoices.index')
->click('@pay-now')
->press('Pay Now')
->clickLink('Undefined.')
->waitForText('Test profile')
->radio('final_state', 'open')
->press('Continue')
->waitForText('Details of the payment')
->assertSee('Pending');
});
}
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')
->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')
->radio('final_state', 'canceled')
->press('Continue')
->waitForText('Cancelled.');
});
}
}