Basic implementation of payment methods
This commit is contained in:
@@ -11,6 +11,12 @@ class UpdateEventCommand {
|
||||
public function execute() : UpdateEventResponse {
|
||||
$response = new UpdateEventResponse();
|
||||
|
||||
if (count($this->request->paymentMethods) === 0) {
|
||||
$response->success = false;
|
||||
$response->message = 'Mindestens eine Zahlungsmöglichkeit muss ausgewählt sein.';
|
||||
return $response;
|
||||
}
|
||||
|
||||
$this->request->event->name = $this->request->eventName;
|
||||
$this->request->event->location = $this->request->eventLocation;
|
||||
$this->request->event->postal_code = $this->request->postalCode;
|
||||
@@ -26,6 +32,7 @@ class UpdateEventCommand {
|
||||
|
||||
$this->request->event->resetAllowedEatingHabits();
|
||||
$this->request->event->resetContributingLocalGroups();
|
||||
$this->request->event->resetPaymentMethods();
|
||||
|
||||
foreach($this->request->eatingHabits as $eatingHabit) {
|
||||
$this->request->event->eatingHabits()->attach($eatingHabit);
|
||||
@@ -35,6 +42,10 @@ class UpdateEventCommand {
|
||||
$this->request->event->localGroups()->attach($contributingLocalGroup);
|
||||
}
|
||||
|
||||
foreach($this->request->paymentMethods as $paymentMethod) {
|
||||
$this->request->event->paymentMethods()->attach($paymentMethod);
|
||||
}
|
||||
|
||||
$this->request->event->save();
|
||||
$response->success = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user