Skip to content

Commit 08a5e87

Browse files
authored
feat: move Stripe Connect, VAT, and platform fees to the organizer level (#1192)
1 parent 624d4c9 commit 08a5e87

206 files changed

Lines changed: 11178 additions & 14947 deletions

File tree

Some content is hidden

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

backend/app/DataTransferObjects/UpdateAdminAccountVatSettingDTO.php renamed to backend/app/DataTransferObjects/UpdateAdminOrganizerVatSettingDTO.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace HiEvents\DataTransferObjects;
44

5-
class UpdateAdminAccountVatSettingDTO extends BaseDataObject
5+
class UpdateAdminOrganizerVatSettingDTO extends BaseDataObject
66
{
77
public function __construct(
8-
public readonly int $accountId,
9-
public readonly bool $vatRegistered,
8+
public readonly int $organizerId,
9+
public readonly bool $vatRegistered,
1010
public readonly ?string $vatNumber = null,
11-
public readonly ?bool $vatValidated = null,
11+
public readonly ?bool $vatValidated = null,
1212
public readonly ?string $businessName = null,
1313
public readonly ?string $businessAddress = null,
1414
public readonly ?string $vatCountryCode = null,

backend/app/DataTransferObjects/UpdateAccountConfigurationDTO.php renamed to backend/app/DataTransferObjects/UpdateOrganizerConfigurationDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace HiEvents\DataTransferObjects;
44

5-
class UpdateAccountConfigurationDTO extends BaseDataObject
5+
class UpdateOrganizerConfigurationDTO extends BaseDataObject
66
{
77
public function __construct(
8-
public readonly int $accountId,
8+
public readonly int $organizerId,
99
public readonly array $applicationFees,
1010
)
1111
{

backend/app/DomainObjects/AccountDomainObject.php

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,10 @@
22

33
namespace HiEvents\DomainObjects;
44

5-
use HiEvents\DomainObjects\DTO\AccountApplicationFeeDTO;
6-
use HiEvents\DomainObjects\Enums\StripePlatform;
7-
use Illuminate\Support\Collection;
8-
95
class AccountDomainObject extends Generated\AccountDomainObjectAbstract
106
{
11-
private ?AccountConfigurationDomainObject $configuration = null;
12-
13-
/** @var Collection<int, AccountStripePlatformDomainObject>|null */
14-
private ?Collection $stripePlatforms = null;
15-
16-
private ?AccountVatSettingDomainObject $accountVatSetting = null;
17-
187
private ?AccountMessagingTierDomainObject $messagingTier = null;
198

20-
public function getApplicationFee(): AccountApplicationFeeDTO
21-
{
22-
/** @var AccountConfigurationDomainObject $applicationFee */
23-
$applicationFee = $this->getConfiguration();
24-
25-
return new AccountApplicationFeeDTO(
26-
$applicationFee->getPercentageApplicationFee(),
27-
$applicationFee->getFixedApplicationFee()
28-
);
29-
}
30-
31-
public function getConfiguration(): ?AccountConfigurationDomainObject
32-
{
33-
return $this->configuration;
34-
}
35-
36-
public function setConfiguration(AccountConfigurationDomainObject $configuration): void
37-
{
38-
$this->configuration = $configuration;
39-
}
40-
41-
public function getAccountStripePlatforms(): ?Collection
42-
{
43-
return $this->stripePlatforms;
44-
}
45-
46-
public function setAccountStripePlatforms(Collection $stripePlatforms): void
47-
{
48-
$this->stripePlatforms = $stripePlatforms;
49-
}
50-
51-
public function getAccountVatSetting(): ?AccountVatSettingDomainObject
52-
{
53-
return $this->accountVatSetting;
54-
}
55-
56-
public function setAccountVatSetting(AccountVatSettingDomainObject $accountVatSetting): void
57-
{
58-
$this->accountVatSetting = $accountVatSetting;
59-
}
60-
619
public function getMessagingTier(): ?AccountMessagingTierDomainObject
6210
{
6311
return $this->messagingTier;
@@ -67,58 +15,4 @@ public function setMessagingTier(AccountMessagingTierDomainObject $messagingTier
6715
{
6816
$this->messagingTier = $messagingTier;
6917
}
70-
71-
/**
72-
* Get the primary active Stripe platform for this account
73-
* Returns the platform with setup completed, preferring the most recent
74-
*/
75-
public function getPrimaryStripePlatform(): ?AccountStripePlatformDomainObject
76-
{
77-
if (!$this->stripePlatforms || $this->stripePlatforms->isEmpty()) {
78-
return null;
79-
}
80-
81-
return $this->stripePlatforms
82-
->filter(fn($platform) => $platform->getStripeSetupCompletedAt() !== null)
83-
->sortByDesc(fn($platform) => $platform->getCreatedAt())
84-
->first();
85-
}
86-
87-
/**
88-
* Get the Stripe platform for a specific platform type
89-
* Handles null platform for open-source installations
90-
*/
91-
public function getStripePlatformByType(?StripePlatform $platformType): ?AccountStripePlatformDomainObject
92-
{
93-
if (!$this->stripePlatforms || $this->stripePlatforms->isEmpty()) {
94-
return null;
95-
}
96-
97-
return $this->stripePlatforms
98-
->filter(fn($platform) => $platform->getStripeConnectPlatform() === $platformType?->value)
99-
->first();
100-
}
101-
102-
public function getActiveStripeAccountId(): ?string
103-
{
104-
return $this->getPrimaryStripePlatform()?->getStripeAccountId();
105-
}
106-
107-
public function getActiveStripePlatform(): ?StripePlatform
108-
{
109-
$primaryPlatform = $this->getPrimaryStripePlatform();
110-
if (!$primaryPlatform || !$primaryPlatform->getStripeConnectPlatform()) {
111-
return null;
112-
}
113-
114-
return StripePlatform::fromString($primaryPlatform->getStripeConnectPlatform());
115-
}
116-
117-
/**
118-
* Check if Stripe is set up and ready for payments
119-
*/
120-
public function isStripeSetupComplete(): bool
121-
{
122-
return $this->getPrimaryStripePlatform() !== null;
123-
}
12418
}

backend/app/DomainObjects/DTO/AccountApplicationFeeDTO.php

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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 OrganizerConfigurationDomainObjectAbstract extends \HiEvents\DomainObjects\AbstractDomainObject
10+
{
11+
final public const SINGULAR_NAME = 'organizer_configuration';
12+
final public const PLURAL_NAME = 'organizer_configurations';
13+
final public const ID = 'id';
14+
final public const NAME = 'name';
15+
final public const IS_SYSTEM_DEFAULT = 'is_system_default';
16+
final public const APPLICATION_FEES = 'application_fees';
17+
final public const BYPASS_APPLICATION_FEES = 'bypass_application_fees';
18+
final public const LEGACY_ACCOUNT_CONFIGURATION_ID = 'legacy_account_configuration_id';
19+
final public const CREATED_AT = 'created_at';
20+
final public const UPDATED_AT = 'updated_at';
21+
final public const DELETED_AT = 'deleted_at';
22+
23+
protected int $id;
24+
protected string $name;
25+
protected bool $is_system_default = false;
26+
protected array|string|null $application_fees = null;
27+
protected bool $bypass_application_fees = false;
28+
protected ?int $legacy_account_configuration_id = null;
29+
protected ?string $created_at = null;
30+
protected ?string $updated_at = null;
31+
protected ?string $deleted_at = null;
32+
33+
public function toArray(): array
34+
{
35+
return [
36+
'id' => $this->id ?? null,
37+
'name' => $this->name ?? null,
38+
'is_system_default' => $this->is_system_default ?? null,
39+
'application_fees' => $this->application_fees ?? null,
40+
'bypass_application_fees' => $this->bypass_application_fees ?? null,
41+
'legacy_account_configuration_id' => $this->legacy_account_configuration_id ?? null,
42+
'created_at' => $this->created_at ?? null,
43+
'updated_at' => $this->updated_at ?? null,
44+
'deleted_at' => $this->deleted_at ?? null,
45+
];
46+
}
47+
48+
public function setId(int $id): self
49+
{
50+
$this->id = $id;
51+
return $this;
52+
}
53+
54+
public function getId(): int
55+
{
56+
return $this->id;
57+
}
58+
59+
public function setName(string $name): self
60+
{
61+
$this->name = $name;
62+
return $this;
63+
}
64+
65+
public function getName(): string
66+
{
67+
return $this->name;
68+
}
69+
70+
public function setIsSystemDefault(bool $is_system_default): self
71+
{
72+
$this->is_system_default = $is_system_default;
73+
return $this;
74+
}
75+
76+
public function getIsSystemDefault(): bool
77+
{
78+
return $this->is_system_default;
79+
}
80+
81+
public function setApplicationFees(array|string|null $application_fees): self
82+
{
83+
$this->application_fees = $application_fees;
84+
return $this;
85+
}
86+
87+
public function getApplicationFees(): array|string|null
88+
{
89+
return $this->application_fees;
90+
}
91+
92+
public function setBypassApplicationFees(bool $bypass_application_fees): self
93+
{
94+
$this->bypass_application_fees = $bypass_application_fees;
95+
return $this;
96+
}
97+
98+
public function getBypassApplicationFees(): bool
99+
{
100+
return $this->bypass_application_fees;
101+
}
102+
103+
public function setLegacyAccountConfigurationId(?int $legacy_account_configuration_id): self
104+
{
105+
$this->legacy_account_configuration_id = $legacy_account_configuration_id;
106+
return $this;
107+
}
108+
109+
public function getLegacyAccountConfigurationId(): ?int
110+
{
111+
return $this->legacy_account_configuration_id;
112+
}
113+
114+
public function setCreatedAt(?string $created_at): self
115+
{
116+
$this->created_at = $created_at;
117+
return $this;
118+
}
119+
120+
public function getCreatedAt(): ?string
121+
{
122+
return $this->created_at;
123+
}
124+
125+
public function setUpdatedAt(?string $updated_at): self
126+
{
127+
$this->updated_at = $updated_at;
128+
return $this;
129+
}
130+
131+
public function getUpdatedAt(): ?string
132+
{
133+
return $this->updated_at;
134+
}
135+
136+
public function setDeletedAt(?string $deleted_at): self
137+
{
138+
$this->deleted_at = $deleted_at;
139+
return $this;
140+
}
141+
142+
public function getDeletedAt(): ?string
143+
{
144+
return $this->deleted_at;
145+
}
146+
}

backend/app/DomainObjects/Generated/OrganizerDomainObjectAbstract.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ abstract class OrganizerDomainObjectAbstract extends \HiEvents\DomainObjects\Abs
1212
final public const PLURAL_NAME = 'organizers';
1313
final public const ID = 'id';
1414
final public const ACCOUNT_ID = 'account_id';
15+
final public const ORGANIZER_CONFIGURATION_ID = 'organizer_configuration_id';
1516
final public const NAME = 'name';
1617
final public const EMAIL = 'email';
1718
final public const PHONE = 'phone';
@@ -26,6 +27,7 @@ abstract class OrganizerDomainObjectAbstract extends \HiEvents\DomainObjects\Abs
2627

2728
protected int $id;
2829
protected int $account_id;
30+
protected ?int $organizer_configuration_id = null;
2931
protected string $name;
3032
protected string $email;
3133
protected ?string $phone = null;
@@ -43,6 +45,7 @@ public function toArray(): array
4345
return [
4446
'id' => $this->id ?? null,
4547
'account_id' => $this->account_id ?? null,
48+
'organizer_configuration_id' => $this->organizer_configuration_id ?? null,
4649
'name' => $this->name ?? null,
4750
'email' => $this->email ?? null,
4851
'phone' => $this->phone ?? null,
@@ -79,6 +82,17 @@ public function getAccountId(): int
7982
return $this->account_id;
8083
}
8184

85+
public function setOrganizerConfigurationId(?int $organizer_configuration_id): self
86+
{
87+
$this->organizer_configuration_id = $organizer_configuration_id;
88+
return $this;
89+
}
90+
91+
public function getOrganizerConfigurationId(): ?int
92+
{
93+
return $this->organizer_configuration_id;
94+
}
95+
8296
public function setName(string $name): self
8397
{
8498
$this->name = $name;

0 commit comments

Comments
 (0)