mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enable underpayments for Braintree Credit Card
This commit is contained in:
parent
9e42c5f980
commit
9e1559b8da
@ -13,8 +13,10 @@
|
||||
namespace Tests\Browser\ClientPortal\Gateways\Braintree;
|
||||
|
||||
use App\DataMapper\FeesAndLimits;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Invoice;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\Browser\Pages\ClientPortal\Login;
|
||||
use Tests\DuskTestCase;
|
||||
@ -44,6 +46,15 @@ class CreditCardTest extends DuskTestCase
|
||||
$fees_and_limits->{GatewayType::CREDIT_CARD} = new FeesAndLimits();
|
||||
$cg->fees_and_limits = $fees_and_limits;
|
||||
$cg->save();
|
||||
|
||||
$company = Company::first();
|
||||
$settings = $company->settings;
|
||||
|
||||
$settings->client_portal_allow_under_payment = true;
|
||||
$settings->client_portal_allow_over_payment = true;
|
||||
|
||||
$company->settings = $settings;
|
||||
$company->save();
|
||||
}
|
||||
|
||||
public function testPayWithNewCard()
|
||||
@ -52,6 +63,7 @@ class CreditCardTest extends DuskTestCase
|
||||
$browser
|
||||
->visitRoute('client.invoices.index')
|
||||
->click('@pay-now')
|
||||
->type('@underpayment-input', '100')
|
||||
->press('Pay Now')
|
||||
->clickLink('Credit Card')
|
||||
->waitFor('#braintree-hosted-field-number', 60)
|
||||
@ -72,30 +84,34 @@ class CreditCardTest extends DuskTestCase
|
||||
$browser
|
||||
->visitRoute('client.invoices.index')
|
||||
->click('@pay-now')
|
||||
->type('@underpayment-input', '100')
|
||||
->press('Pay Now')
|
||||
->clickLink('Credit Card')
|
||||
->waitFor('#braintree-hosted-field-number', 60)
|
||||
->withinFrame('#braintree-hosted-field-number', function (Browser $browser) {
|
||||
$browser->type('credit-card-number', '4111111111111111');
|
||||
$browser->typeSlowly('credit-card-number', '4005519200000004');
|
||||
})
|
||||
->withinFrame('#braintree-hosted-field-expirationDate', function (Browser $browser) {
|
||||
$browser->type('expiration', '04/25');
|
||||
$browser->typeSlowly('expiration', '04/25');
|
||||
})
|
||||
->radio('#proxy_is_default', true)
|
||||
->press('Pay Now')
|
||||
->waitForText('Details of the payment', 60)
|
||||
->visitRoute('client.payment_methods.index')
|
||||
->clickLink('View')
|
||||
->assertSee('1111');
|
||||
->assertSee('0004');
|
||||
});
|
||||
}
|
||||
|
||||
public function testPayWithSavedCard()
|
||||
{
|
||||
$this->markTestSkipped('Works in "real" browser, otherwise giving error code 0.');
|
||||
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser
|
||||
->visitRoute('client.invoices.index')
|
||||
->click('@pay-now')
|
||||
->type('@underpayment-input', '100')
|
||||
->press('Pay Now')
|
||||
->clickLink('Credit Card')
|
||||
->click('.toggle-payment-with-token')
|
||||
|
Loading…
x
Reference in New Issue
Block a user