mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Merge pull request #6398 from beganovich/v5-614
(v5) Force integer & minimum of 1 on ACH verification
This commit is contained in:
commit
ab7d1b096b
@ -95,8 +95,12 @@ class ACH
|
||||
return render('gateways.stripe.ach.verify', $data);
|
||||
}
|
||||
|
||||
public function processVerification($request, ClientGatewayToken $token)
|
||||
public function processVerification(Request $request, ClientGatewayToken $token)
|
||||
{
|
||||
$request->validate([
|
||||
'transactions.*' => ['integer', 'min:1'],
|
||||
]);
|
||||
|
||||
if (isset($token->meta->state) && $token->meta->state === 'authorized') {
|
||||
return redirect()
|
||||
->route('client.payment_methods.show', $token->hashed_id)
|
||||
|
@ -11,11 +11,23 @@
|
||||
<input type="hidden" name="source" value="{{ $token->token }}">
|
||||
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => '#1 ' . ctrans('texts.amount_cents')])
|
||||
<input type="text" name="transactions[]" class="w-full input" required dusk="verification-1st">
|
||||
<input type="text" name="transactions[]" class="w-full input" required dusk="verification-1st" value="{{ old('transactions.0') }}">
|
||||
|
||||
@error('transactions.0')
|
||||
<div class="validation validation-fail">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
@endcomponent
|
||||
|
||||
@component('portal.ninja2020.components.general.card-element', ['title' => '#2 ' . ctrans('texts.amount_cents')])
|
||||
<input type="text" name="transactions[]" class="w-full input" required dusk="verification-2nd">
|
||||
<input type="text" name="transactions[]" class="w-full input" required dusk="verification-2nd" value="{{ old('transactions.1') }}">
|
||||
|
||||
@error('transactions.1')
|
||||
<div class="validation validation-fail">
|
||||
{{ $message }}
|
||||
</div>
|
||||
@enderror
|
||||
@endcomponent
|
||||
|
||||
@component('portal.ninja2020.gateways.includes.pay_now', ['type' => 'submit'])
|
||||
|
@ -103,4 +103,31 @@ class ACHTest extends DuskTestCase
|
||||
->assertSee('Payment method has been successfully removed.');
|
||||
});
|
||||
}
|
||||
|
||||
public function testIntegerAndMinimumValueOnVerification()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser
|
||||
->visitRoute('client.payment_methods.index')
|
||||
->press('Add Payment Method')
|
||||
->clickLink('Bank Account')
|
||||
->type('#account-holder-name', 'John Doe')
|
||||
->select('#country', 'US')
|
||||
->select('#currency', 'USD')
|
||||
->type('#routing-number', '110000000')
|
||||
->type('#account-number', '000123456789')
|
||||
->check('#accept-terms')
|
||||
->press('Add Payment Method')
|
||||
->waitForText('ACH (Verification)', 60)
|
||||
->type('@verification-1st', '0.1')
|
||||
->type('@verification-2nd', '0')
|
||||
->press('Complete Verification')
|
||||
->assertSee('The transactions.0 must be an integer')
|
||||
->assertSee('The transactions.1 must be at least 1')
|
||||
->type('@verification-1st', '32')
|
||||
->type('@verification-2nd', '45')
|
||||
->press('Complete Verification')
|
||||
->assertSee('Bank Transfer');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user