Handling SEPA Direct Payment
This commit is contained in:
@@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\AvailablePaymentMethod;
|
||||
use App\Models\Event;
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
/**
|
||||
* Zugriff auf die Zahlungsmethoden-Instanzen des Mandanten.
|
||||
@@ -24,4 +26,22 @@ class PaymentMethodRepository
|
||||
{
|
||||
return (array) (AvailablePaymentMethod::where('slug', $slug)->first()?->configuration ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Darf bei dieser Veranstaltung mit dieser Zahlungsart angemeldet werden?
|
||||
*
|
||||
* Nur wenn sie der Veranstaltung zugewiesen ist, beim Mandanten aktiv ist und ihre Config am Event
|
||||
* vollständig und gültig ist. Sonst ließe sich über einen manipulierten Request eine Zahlungsart
|
||||
* wählen, für die die Angaben zur Zahlung fehlen -- bei der Lastschrift etwa die Gläubiger-ID.
|
||||
*/
|
||||
public function isUsableForSignUp(Event $event, string $slug): bool
|
||||
{
|
||||
$method = $event->paymentMethods()->where('available_payment_methods.slug', $slug)->first();
|
||||
|
||||
if ($method === null || !$method->active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return PaymentMethod::isConfigurationComplete($slug, (array) ($method->pivot->configuration ?? []));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user