diff --git a/app/Pdf/PdfRepository.php b/app/Pdf/PdfRepository.php index b3de60bc..2454a53c 100644 --- a/app/Pdf/PdfRepository.php +++ b/app/Pdf/PdfRepository.php @@ -3,6 +3,7 @@ namespace App\Pdf; use App\Member\Member; +use Carbon\Carbon; use Illuminate\Support\Collection; interface PdfRepository @@ -32,4 +33,6 @@ interface PdfRepository public function linkLabel(): string; + public function getUntil(): Carbon; + } diff --git a/app/Pdf/Repository.php b/app/Pdf/Repository.php index 8ac2e2a0..1308c70e 100644 --- a/app/Pdf/Repository.php +++ b/app/Pdf/Repository.php @@ -2,6 +2,8 @@ namespace App\Pdf; +use Carbon\Carbon; + abstract class Repository { @@ -10,4 +12,9 @@ abstract class Repository return number_format($number / 100, 2, '.', ''); } + public function getUntil(): Carbon + { + return now()->addWeeks(2); + } + } diff --git a/resources/views/tex/bill.tex b/resources/views/tex/bill.tex index 57532996..cbb48c0a 100644 --- a/resources/views/tex/bill.tex +++ b/resources/views/tex/bill.tex @@ -21,7 +21,7 @@ \end{tabular} \end{center} - Somit bitten wir Sie, den ausstehenden Betrag von \totalttc bis zum 18.07.2021 auf folgendes Konto zu überweisen: + Somit bitten wir Sie, den ausstehenden Betrag von \totalttc bis zum \textbf{<<< $data->getUntil()->format('d.m.Y') >>>} auf folgendes Konto zu überweisen: \begin{tabular}{ll} Kontoinhaber: & DPSG Stamm Silva \\ diff --git a/tests/Feature/Pdf/GenerateTest.php b/tests/Feature/Pdf/GenerateTest.php index 537a41e9..d4186923 100644 --- a/tests/Feature/Pdf/GenerateTest.php +++ b/tests/Feature/Pdf/GenerateTest.php @@ -7,18 +7,17 @@ use App\Fee; use App\Group; use App\Member\Member; use App\Nationality; -use App\Payment\Payment; use App\Payment\Subscription; use App\Pdf\BillType; use App\Pdf\PdfGenerator; use App\Pdf\PdfRepositoryFactory; +use Carbon\Carbon; use Database\Factories\Member\MemberFactory; use Database\Factories\Payment\PaymentFactory; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Collection; use Storage; use Tests\TestCase; -use Tests\Traits\FakesTex; class GenerateTest extends TestCase { @@ -29,6 +28,8 @@ class GenerateTest extends TestCase { parent::setUp(); + Carbon::setTestNow(Carbon::parse('2021-04-15 00:00:00')); + Storage::fake('temp'); } @@ -75,6 +76,27 @@ class GenerateTest extends TestCase 'Familie ::lastname::\\\\::street::\\\\::zip:: ::location::', ], ], + 'bill_has_deadline' => [ + 'members' => [ + [ + 'factory' => fn (MemberFactory $member): MemberFactory => $member + ->state([ + 'firstname' => '::firstname::', + 'lastname' => '::lastname::', + ]), + 'payments' => [ + fn (PaymentFactory $payment): PaymentFactory => $payment + ->nr('A')->notPaid()->subscription('::subName::', 1500), + ], + ], + ], + 'urlCallable' => fn (Collection $members): int => $members->first()->id, + 'type' => BillType::class, + 'filename' => 'rechnung-fur-firstname-lastname.pdf', + 'output' => [ + '29.04.2021', + ], + ], ]; }