2021-07-12 13:42:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Tests\Browser\ClientPortal\Gateways\WePay;
|
|
|
|
|
2021-07-13 14:43:51 +02:00
|
|
|
use App\DataMapper\FeesAndLimits;
|
2021-07-12 13:42:16 +02:00
|
|
|
use App\Models\CompanyGateway;
|
2021-07-13 14:43:51 +02:00
|
|
|
use App\Models\GatewayType;
|
2021-07-12 13:42:16 +02:00
|
|
|
use Laravel\Dusk\Browser;
|
|
|
|
use Tests\Browser\Pages\ClientPortal\Login;
|
|
|
|
use Tests\DuskTestCase;
|
|
|
|
|
2021-07-13 14:43:51 +02:00
|
|
|
class ACHTest extends DuskTestCase
|
2021-07-12 13:42:16 +02:00
|
|
|
{
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
foreach (static::$browsers as $browser) {
|
|
|
|
$browser->driver->manage()->deleteAllCookies();
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->disableCompanyGateways();
|
|
|
|
|
|
|
|
CompanyGateway::where('gateway_key', '8fdeed552015b3c7b44ed6c8ebd9e992')->restore();
|
|
|
|
|
2021-07-13 14:43:51 +02:00
|
|
|
// Enable ACH.
|
|
|
|
$cg = CompanyGateway::where('gateway_key', '8fdeed552015b3c7b44ed6c8ebd9e992')->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();
|
|
|
|
|
2021-07-12 13:42:16 +02:00
|
|
|
$this->browse(function (Browser $browser) {
|
|
|
|
$browser
|
|
|
|
->visit(new Login())
|
|
|
|
->auth();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testPayingWithNoPreauthorizedIsntPossible()
|
|
|
|
{
|
|
|
|
$this->browse(function (Browser $browser) {
|
|
|
|
$browser
|
|
|
|
->visitRoute('client.invoices.index')
|
|
|
|
->click('@pay-now')
|
|
|
|
->press('Pay Now')
|
|
|
|
->clickLink('Bank Transfer')
|
|
|
|
->assertSee('To pay with a bank account, first you have to add it as payment method.');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|