Skip to content

Commit 26d9362

Browse files
authored
Feature: Allow order creators to edit order and attendee details (#970)
1 parent e66a994 commit 26d9362

File tree

119 files changed

+9885
-2186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+9885
-2186
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace HiEvents\DomainObjects\Enums;
4+
5+
enum OrderAuditAction: string
6+
{
7+
use BaseEnum;
8+
9+
case ATTENDEE_UPDATED = 'ATTENDEE_UPDATED';
10+
case ORDER_UPDATED = 'ORDER_UPDATED';
11+
case ATTENDEE_EMAIL_RESENT = 'ATTENDEE_EMAIL_RESENT';
12+
case ORDER_EMAIL_RESENT = 'ORDER_EMAIL_RESENT';
13+
}

backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
6363
final public const SHOW_MARKETING_OPT_IN = 'show_marketing_opt_in';
6464
final public const HOMEPAGE_THEME_SETTINGS = 'homepage_theme_settings';
6565
final public const PASS_PLATFORM_FEE_TO_BUYER = 'pass_platform_fee_to_buyer';
66+
final public const ALLOW_ATTENDEE_SELF_EDIT = 'allow_attendee_self_edit';
6667

6768
protected int $id;
6869
protected int $event_id;
@@ -117,6 +118,7 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
117118
protected bool $show_marketing_opt_in = true;
118119
protected array|string|null $homepage_theme_settings = null;
119120
protected bool $pass_platform_fee_to_buyer = false;
121+
protected bool $allow_attendee_self_edit = true;
120122

121123
public function toArray(): array
122124
{
@@ -174,6 +176,7 @@ public function toArray(): array
174176
'show_marketing_opt_in' => $this->show_marketing_opt_in ?? null,
175177
'homepage_theme_settings' => $this->homepage_theme_settings ?? null,
176178
'pass_platform_fee_to_buyer' => $this->pass_platform_fee_to_buyer ?? null,
179+
'allow_attendee_self_edit' => $this->allow_attendee_self_edit ?? null,
177180
];
178181
}
179182

@@ -760,4 +763,15 @@ public function getPassPlatformFeeToBuyer(): bool
760763
{
761764
return $this->pass_platform_fee_to_buyer;
762765
}
766+
767+
public function setAllowAttendeeSelfEdit(bool $allow_attendee_self_edit): self
768+
{
769+
$this->allow_attendee_self_edit = $allow_attendee_self_edit;
770+
return $this;
771+
}
772+
773+
public function getAllowAttendeeSelfEdit(): bool
774+
{
775+
return $this->allow_attendee_self_edit;
776+
}
763777
}
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
<?php
2+
3+
namespace HiEvents\DomainObjects\Generated;
4+
5+
/**
6+
* THIS FILE IS AUTOGENERATED - DO NOT EDIT IT DIRECTLY.
7+
* @package HiEvents\DomainObjects\Generated
8+
*/
9+
abstract class OrderAuditLogDomainObjectAbstract extends \HiEvents\DomainObjects\AbstractDomainObject
10+
{
11+
final public const SINGULAR_NAME = 'order_audit_log';
12+
final public const PLURAL_NAME = 'order_audit_logs';
13+
final public const ID = 'id';
14+
final public const EVENT_ID = 'event_id';
15+
final public const ORDER_ID = 'order_id';
16+
final public const ATTENDEE_ID = 'attendee_id';
17+
final public const ACTION = 'action';
18+
final public const OLD_VALUES = 'old_values';
19+
final public const NEW_VALUES = 'new_values';
20+
final public const CHANGED_FIELDS = 'changed_fields';
21+
final public const IP_ADDRESS = 'ip_address';
22+
final public const USER_AGENT = 'user_agent';
23+
final public const CREATED_AT = 'created_at';
24+
final public const UPDATED_AT = 'updated_at';
25+
26+
protected int $id;
27+
protected int $event_id;
28+
protected int $order_id;
29+
protected ?int $attendee_id = null;
30+
protected string $action;
31+
protected array|string|null $old_values = null;
32+
protected array|string|null $new_values = null;
33+
protected ?string $changed_fields = null;
34+
protected ?string $ip_address = null;
35+
protected ?string $user_agent = null;
36+
protected ?string $created_at = null;
37+
protected ?string $updated_at = null;
38+
39+
public function toArray(): array
40+
{
41+
return [
42+
'id' => $this->id ?? null,
43+
'event_id' => $this->event_id ?? null,
44+
'order_id' => $this->order_id ?? null,
45+
'attendee_id' => $this->attendee_id ?? null,
46+
'action' => $this->action ?? null,
47+
'old_values' => $this->old_values ?? null,
48+
'new_values' => $this->new_values ?? null,
49+
'changed_fields' => $this->changed_fields ?? null,
50+
'ip_address' => $this->ip_address ?? null,
51+
'user_agent' => $this->user_agent ?? null,
52+
'created_at' => $this->created_at ?? null,
53+
'updated_at' => $this->updated_at ?? null,
54+
];
55+
}
56+
57+
public function setId(int $id): self
58+
{
59+
$this->id = $id;
60+
return $this;
61+
}
62+
63+
public function getId(): int
64+
{
65+
return $this->id;
66+
}
67+
68+
public function setEventId(int $event_id): self
69+
{
70+
$this->event_id = $event_id;
71+
return $this;
72+
}
73+
74+
public function getEventId(): int
75+
{
76+
return $this->event_id;
77+
}
78+
79+
public function setOrderId(int $order_id): self
80+
{
81+
$this->order_id = $order_id;
82+
return $this;
83+
}
84+
85+
public function getOrderId(): int
86+
{
87+
return $this->order_id;
88+
}
89+
90+
public function setAttendeeId(?int $attendee_id): self
91+
{
92+
$this->attendee_id = $attendee_id;
93+
return $this;
94+
}
95+
96+
public function getAttendeeId(): ?int
97+
{
98+
return $this->attendee_id;
99+
}
100+
101+
public function setAction(string $action): self
102+
{
103+
$this->action = $action;
104+
return $this;
105+
}
106+
107+
public function getAction(): string
108+
{
109+
return $this->action;
110+
}
111+
112+
public function setOldValues(array|string|null $old_values): self
113+
{
114+
$this->old_values = $old_values;
115+
return $this;
116+
}
117+
118+
public function getOldValues(): array|string|null
119+
{
120+
return $this->old_values;
121+
}
122+
123+
public function setNewValues(array|string|null $new_values): self
124+
{
125+
$this->new_values = $new_values;
126+
return $this;
127+
}
128+
129+
public function getNewValues(): array|string|null
130+
{
131+
return $this->new_values;
132+
}
133+
134+
public function setChangedFields(?string $changed_fields): self
135+
{
136+
$this->changed_fields = $changed_fields;
137+
return $this;
138+
}
139+
140+
public function getChangedFields(): ?string
141+
{
142+
return $this->changed_fields;
143+
}
144+
145+
public function setIpAddress(?string $ip_address): self
146+
{
147+
$this->ip_address = $ip_address;
148+
return $this;
149+
}
150+
151+
public function getIpAddress(): ?string
152+
{
153+
return $this->ip_address;
154+
}
155+
156+
public function setUserAgent(?string $user_agent): self
157+
{
158+
$this->user_agent = $user_agent;
159+
return $this;
160+
}
161+
162+
public function getUserAgent(): ?string
163+
{
164+
return $this->user_agent;
165+
}
166+
167+
public function setCreatedAt(?string $created_at): self
168+
{
169+
$this->created_at = $created_at;
170+
return $this;
171+
}
172+
173+
public function getCreatedAt(): ?string
174+
{
175+
return $this->created_at;
176+
}
177+
178+
public function setUpdatedAt(?string $updated_at): self
179+
{
180+
$this->updated_at = $updated_at;
181+
return $this;
182+
}
183+
184+
public function getUpdatedAt(): ?string
185+
{
186+
return $this->updated_at;
187+
}
188+
}

backend/app/DomainObjects/Generated/OrganizerSettingDomainObjectAbstract.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ abstract class OrganizerSettingDomainObjectAbstract extends \HiEvents\DomainObje
2828
final public const DEFAULT_ATTENDEE_DETAILS_COLLECTION_METHOD = 'default_attendee_details_collection_method';
2929
final public const DEFAULT_SHOW_MARKETING_OPT_IN = 'default_show_marketing_opt_in';
3030
final public const DEFAULT_PASS_PLATFORM_FEE_TO_BUYER = 'default_pass_platform_fee_to_buyer';
31+
final public const DEFAULT_ALLOW_ATTENDEE_SELF_EDIT = 'default_allow_attendee_self_edit';
3132

3233
protected int $id;
3334
protected int $organizer_id;
@@ -47,6 +48,7 @@ abstract class OrganizerSettingDomainObjectAbstract extends \HiEvents\DomainObje
4748
protected string $default_attendee_details_collection_method = 'PER_TICKET';
4849
protected bool $default_show_marketing_opt_in = true;
4950
protected bool $default_pass_platform_fee_to_buyer = false;
51+
protected bool $default_allow_attendee_self_edit = true;
5052

5153
public function toArray(): array
5254
{
@@ -69,6 +71,7 @@ public function toArray(): array
6971
'default_attendee_details_collection_method' => $this->default_attendee_details_collection_method ?? null,
7072
'default_show_marketing_opt_in' => $this->default_show_marketing_opt_in ?? null,
7173
'default_pass_platform_fee_to_buyer' => $this->default_pass_platform_fee_to_buyer ?? null,
74+
'default_allow_attendee_self_edit' => $this->default_allow_attendee_self_edit ?? null,
7275
];
7376
}
7477

@@ -270,4 +273,15 @@ public function getDefaultPassPlatformFeeToBuyer(): bool
270273
{
271274
return $this->default_pass_platform_fee_to_buyer;
272275
}
276+
277+
public function setDefaultAllowAttendeeSelfEdit(bool $default_allow_attendee_self_edit): self
278+
{
279+
$this->default_allow_attendee_self_edit = $default_allow_attendee_self_edit;
280+
return $this;
281+
}
282+
283+
public function getDefaultAllowAttendeeSelfEdit(): bool
284+
{
285+
return $this->default_allow_attendee_self_edit;
286+
}
273287
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace HiEvents\DomainObjects;
4+
5+
class OrderAuditLogDomainObject extends Generated\OrderAuditLogDomainObjectAbstract
6+
{
7+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace HiEvents\Exceptions;
6+
7+
use Exception;
8+
9+
class SelfServiceDisabledException extends Exception
10+
{
11+
public function __construct(
12+
string $message = 'Self-service management is disabled for this event',
13+
int $code = 403,
14+
?Exception $previous = null
15+
) {
16+
parent::__construct($message, $code, $previous);
17+
}
18+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace HiEvents\Http\Actions\SelfService;
4+
5+
use HiEvents\Exceptions\SelfServiceDisabledException;
6+
use HiEvents\Http\Actions\BaseAction;
7+
use HiEvents\Http\Request\SelfService\EditAttendeePublicRequest;
8+
use HiEvents\Services\Application\Handlers\SelfService\DTO\EditAttendeePublicDTO;
9+
use HiEvents\Services\Application\Handlers\SelfService\EditAttendeePublicHandler;
10+
use Illuminate\Http\JsonResponse;
11+
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
12+
13+
class EditAttendeePublicAction extends BaseAction
14+
{
15+
public function __construct(
16+
private readonly EditAttendeePublicHandler $handler
17+
) {
18+
}
19+
20+
public function __invoke(
21+
EditAttendeePublicRequest $request,
22+
int $eventId,
23+
string $orderShortId,
24+
string $attendeeShortId
25+
): JsonResponse {
26+
try {
27+
$result = $this->handler->handle(EditAttendeePublicDTO::from([
28+
'eventId' => $eventId,
29+
'orderShortId' => $orderShortId,
30+
'attendeeShortId' => $attendeeShortId,
31+
'firstName' => $request->input('first_name'),
32+
'lastName' => $request->input('last_name'),
33+
'email' => $request->input('email'),
34+
'ipAddress' => $this->getClientIp($request),
35+
'userAgent' => $request->userAgent(),
36+
]));
37+
38+
$response = [
39+
'message' => __('Attendee updated successfully'),
40+
];
41+
42+
if ($result->shortIdChanged && $result->newShortId) {
43+
$response['new_short_id'] = $result->newShortId;
44+
}
45+
46+
return $this->jsonResponse($response);
47+
} catch (SelfServiceDisabledException $e) {
48+
return $this->errorResponse($e->getMessage(), $e->getCode());
49+
} catch (ResourceNotFoundException $e) {
50+
return $this->errorResponse($e->getMessage(), 404);
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)