Merge pull request #6271 from beganovich/v5-572

Hide "Pay now" button if no gateways are configured
This commit is contained in:
Benjamin Beganović 2021-07-14 14:56:19 +02:00 committed by GitHub
commit a0914c825d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 7 deletions

View File

@ -4,6 +4,7 @@
## Added:
- Client portal: Show message when trying to approve non-approvable quotes
- Client portal: Remove "Approve" button from single quote page if quote is non-approvable
- Client portal: Hide "Pay now" buttons if no gateways are configured
## Fixed:
- Client portal: Showing message instead of blank page when trying to download zero quotes.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"/livewire.js":"/livewire.js?id=54d078b2ce39327a1702"}
{"/livewire.js":"/livewire.js?id=b09cb328e689f1bb8d77"}

View File

@ -94,7 +94,7 @@
{!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
</td>
<td class="flex items-center justify-end px-6 py-4 text-sm font-medium leading-5 whitespace-no-wrap">
@if($invoice->isPayable() && $invoice->balance > 0)
@if($invoice->isPayable() && $invoice->balance > 0 && !empty(auth()->user()->client->service()->getPaymentMethods(0)))
<form action="{{ route('client.invoices.bulk') }}" method="post">
@csrf
<input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">

View File

@ -16,7 +16,10 @@
<form action="{{ route('client.invoices.bulk') }}" method="post" id="bulkActions">
@csrf
<button type="submit" class="button button-primary bg-primary" name="action" value="download">{{ ctrans('texts.download') }}</button>
<button type="submit" class="button button-primary bg-primary" name="action" value="payment">{{ ctrans('texts.pay_now') }}</button>
@if(!empty(auth()->user()->client->service()->getPaymentMethods(0)))
<button type="submit" class="button button-primary bg-primary" name="action" value="payment">{{ ctrans('texts.pay_now') }}</button>
@endif
</form>
</div>
<div class="flex flex-col mt-4">

View File

@ -12,6 +12,7 @@
namespace Tests\Browser\ClientPortal;
use App\Models\CompanyGateway;
use Laravel\Dusk\Browser;
use Tests\Browser\Pages\ClientPortal\Login;
use Tests\DuskTestCase;
@ -76,4 +77,25 @@ class InvoicesTest extends DuskTestCase
->visitRoute('client.logout');
});
}
public function testPayNowButtonIsntShowingWhenNoGatewaysConfigured()
{
$this->disableCompanyGateways();
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.invoices.index')
->assertDontSee('Pay Now');
});
// Enable Stripe.
CompanyGateway::where('gateway_key', 'd14dd26a37cecc30fdd65700bfb55b23')->restore();
$this->browse(function (Browser $browser) {
$browser
->visitRoute('client.invoices.index')
->assertSee('Pay Now')
->visitRoute('client.logout');
});
}
}