Basic signup for events
This commit is contained in:
31
app/Http/Controllers/GiroCodeGetController.php
Normal file
31
app/Http/Controllers/GiroCodeGetController.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\EventParticipant;
|
||||
use App\Providers\GiroCodeProvider;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GiroCodeGetController {
|
||||
public function __invoke(string $participantToken, Request $request)
|
||||
{
|
||||
$participant = EventParticipant::where(['identifier' => $participantToken])->first();
|
||||
if (null === $participant) {
|
||||
return response()->json(['message' => 'Participant not found'], 404);
|
||||
}
|
||||
|
||||
$amount = $participant->amount;
|
||||
$amount->subtractAmount($participant->amount_paid);
|
||||
|
||||
$girocodeProvider = new GiroCodeProvider(
|
||||
$participant->event()->first()->account_owner,
|
||||
$participant->event()->first()->account_iban,
|
||||
$participant->amount->getAmount(),
|
||||
$participant->payment_purpose
|
||||
);
|
||||
|
||||
return response($girocodeProvider->create(), 200,
|
||||
['Content-Type' => 'image/png']
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user