More improvements
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\EventPaymentModules\Modules;
|
||||
|
||||
use App\EventPaymentModules\AbstractEventPaymentModule;
|
||||
use App\EventPaymentModules\DTO\CreateInvoiceRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationRenderContext;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryRequest;
|
||||
use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
||||
use App\EventPaymentModules\ProvidesGiroCode;
|
||||
@@ -45,15 +46,32 @@ class AccountTransferPaymentModule extends AbstractEventPaymentModule implements
|
||||
$amountLeft->subtractAmount($participant->amount_paid);
|
||||
}
|
||||
|
||||
$hasPaymentInformation = $amountLeft->getAmount() > 0;
|
||||
|
||||
// GiroCode nur bei offenem Betrag; Bildquelle je Render-Kontext (Web-Endpoint vs. Mail-CID).
|
||||
$giroCodeSrc = null;
|
||||
if ($hasPaymentInformation) {
|
||||
$giroCodeSrc = $request->context === RegistrationRenderContext::Mail
|
||||
? 'cid:girocode.png'
|
||||
: '/print-girocode/' . $participant->identifier;
|
||||
}
|
||||
|
||||
// Medien-gerechtes Template je Render-Kontext (Web: SPA-Klassen, Mail: E-Mail-tauglich).
|
||||
$view = $request->context === RegistrationRenderContext::Mail
|
||||
? 'payment-modules.account-transfer.mail'
|
||||
: 'payment-modules.account-transfer.web';
|
||||
|
||||
$response = new RegistrationSummaryResponse();
|
||||
$response->hasPaymentInformation = $amountLeft->getAmount() > 0;
|
||||
$response->showGiroCode = $response->hasPaymentInformation;
|
||||
$response->lines = [
|
||||
['label' => 'Kontoinhaber', 'value' => (string)($config['account_owner'] ?? '')],
|
||||
['label' => 'IBAN', 'value' => (string)($config['iban'] ?? '')],
|
||||
['label' => 'Verwendungszweck', 'value' => (string)$participant->payment_purpose],
|
||||
['label' => 'Betrag', 'value' => $amountLeft->toString()],
|
||||
];
|
||||
$response->hasPaymentInformation = $hasPaymentInformation;
|
||||
$response->html = view($view, [
|
||||
'accountOwner' => (string)($config['account_owner'] ?? ''),
|
||||
'iban' => (string)($config['iban'] ?? ''),
|
||||
'paymentPurpose' => (string)$participant->payment_purpose,
|
||||
'amount' => $amountLeft->toString(),
|
||||
'giroCodeSrc' => $giroCodeSrc,
|
||||
'reminderUrl' => url('/api/v1/event/participant/' . $participant->identifier . '/ical-payment'),
|
||||
'paymentDeadline' => $participant->event?->registration_final_end?->format('d.m.Y'),
|
||||
])->render();
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user