Moved bank transfer logic to special module

This commit is contained in:
2026-08-05 10:00:02 +02:00
parent d1ef092bc3
commit e55cdd1988
22 changed files with 669 additions and 165 deletions
+10 -12
View File
@@ -2,8 +2,8 @@
namespace App\Http\Controllers;
use App\EventPaymentModules\ProvidesGiroCode;
use App\Models\EventParticipant;
use App\Providers\GiroCodeProvider;
use Illuminate\Http\Request;
class GiroCodeGetController {
@@ -14,18 +14,16 @@ class GiroCodeGetController {
return response()->json(['message' => 'Participant not found'], 404);
}
$amount = $participant->amount;
$amount->subtractAmount($participant->amount_paid);
// Die GiroCode-Erzeugung gehört zum Zahlungsmodul; ohne diese Fähigkeit (z.B. Barzahlung) -> 404.
$module = $participant->paymentModule();
$girocode = $module instanceof ProvidesGiroCode
? $module->giroCode($participant, $participant->paymentConfiguration())
: null;
$girocodeProvider = new GiroCodeProvider(
$participant->event()->first()->account_owner,
$participant->event()->first()->account_iban,
$participant->amount->getAmount(),
$participant->payment_purpose
);
if ($girocode === null) {
return response()->json(['message' => 'No giro code for this payment method'], 404);
}
return response($girocodeProvider->create(), 200,
['Content-Type' => 'image/png']
);
return response($girocode, 200, ['Content-Type' => 'image/png']);
}
}