Skip to content

Commit 6d2a678

Browse files
authored
Feat/applicaiton fee updates (#373)
* Application fee updates * Remove env * Update .env.example
1 parent fc5d6ad commit 6d2a678

File tree

51 files changed

+1694
-258
lines changed

Some content is hidden

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

51 files changed

+1694
-258
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace HiEvents\DomainObjects;
4+
5+
class AccountConfigurationDomainObject extends Generated\AccountConfigurationDomainObjectAbstract
6+
{
7+
public function getFixedApplicationFee(): float
8+
{
9+
return $this->getApplicationFees()['fixed'] ?? config('app.default_application_fee_fixed');
10+
}
11+
12+
public function getPercentageApplicationFee(): float
13+
{
14+
return $this->getApplicationFees()['percentage'] ?? config('app.default_application_fee_percentage');
15+
}
16+
}

backend/app/DomainObjects/AccountDomainObject.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,26 @@
66

77
class AccountDomainObject extends Generated\AccountDomainObjectAbstract
88
{
9+
private ?AccountConfigurationDomainObject $configuration = null;
10+
911
public function getApplicationFee(): AccountApplicationFeeDTO
1012
{
11-
$applicationFee = $this->getConfiguration()['application_fee'];
13+
/** @var AccountConfigurationDomainObject $applicationFee */
14+
$applicationFee = $this->getConfiguration();
1215

1316
return new AccountApplicationFeeDTO(
14-
$applicationFee['percentage'],
15-
$applicationFee['fixed']
17+
$applicationFee->getPercentageApplicationFee(),
18+
$applicationFee->getFixedApplicationFee()
1619
);
1720
}
21+
22+
public function getConfiguration(): ?AccountConfigurationDomainObject
23+
{
24+
return $this->configuration;
25+
}
26+
27+
public function setConfiguration(AccountConfigurationDomainObject $configuration): void
28+
{
29+
$this->configuration = $configuration;
30+
}
1831
}
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 ApplicationFeeDomainObject extends Generated\ApplicationFeeDomainObjectAbstract
6+
{
7+
}

backend/app/DomainObjects/EventDomainObject.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class EventDomainObject extends Generated\EventDomainObjectAbstract implements I
3434

3535
private ?EventStatisticDomainObject $eventStatistics = null;
3636

37+
private ?AccountDomainObject $account = null;
38+
3739
public static function getAllowedFilterFields(): array
3840
{
3941
return [
@@ -143,6 +145,17 @@ public function setOrganizer(?OrganizerDomainObject $organizer): self
143145
return $this;
144146
}
145147

148+
public function getAccount(): ?AccountDomainObject
149+
{
150+
return $this->account;
151+
}
152+
153+
public function setAccount(?AccountDomainObject $account): self
154+
{
155+
$this->account = $account;
156+
return $this;
157+
}
158+
146159
public function getEventUrl(): string
147160
{
148161
return sprintf(
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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 AccountConfigurationDomainObjectAbstract extends \HiEvents\DomainObjects\AbstractDomainObject
10+
{
11+
final public const SINGULAR_NAME = 'account_configuration';
12+
final public const PLURAL_NAME = 'account_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 CREATED_AT = 'created_at';
18+
final public const UPDATED_AT = 'updated_at';
19+
final public const DELETED_AT = 'deleted_at';
20+
21+
protected int $id;
22+
protected string $name;
23+
protected bool $is_system_default = false;
24+
protected array|string|null $application_fees = null;
25+
protected ?string $created_at = null;
26+
protected ?string $updated_at = null;
27+
protected ?string $deleted_at = null;
28+
29+
public function toArray(): array
30+
{
31+
return [
32+
'id' => $this->id ?? null,
33+
'name' => $this->name ?? null,
34+
'is_system_default' => $this->is_system_default ?? null,
35+
'application_fees' => $this->application_fees ?? null,
36+
'created_at' => $this->created_at ?? null,
37+
'updated_at' => $this->updated_at ?? null,
38+
'deleted_at' => $this->deleted_at ?? null,
39+
];
40+
}
41+
42+
public function setId(int $id): self
43+
{
44+
$this->id = $id;
45+
return $this;
46+
}
47+
48+
public function getId(): int
49+
{
50+
return $this->id;
51+
}
52+
53+
public function setName(string $name): self
54+
{
55+
$this->name = $name;
56+
return $this;
57+
}
58+
59+
public function getName(): string
60+
{
61+
return $this->name;
62+
}
63+
64+
public function setIsSystemDefault(bool $is_system_default): self
65+
{
66+
$this->is_system_default = $is_system_default;
67+
return $this;
68+
}
69+
70+
public function getIsSystemDefault(): bool
71+
{
72+
return $this->is_system_default;
73+
}
74+
75+
public function setApplicationFees(array|string|null $application_fees): self
76+
{
77+
$this->application_fees = $application_fees;
78+
return $this;
79+
}
80+
81+
public function getApplicationFees(): array|string|null
82+
{
83+
return $this->application_fees;
84+
}
85+
86+
public function setCreatedAt(?string $created_at): self
87+
{
88+
$this->created_at = $created_at;
89+
return $this;
90+
}
91+
92+
public function getCreatedAt(): ?string
93+
{
94+
return $this->created_at;
95+
}
96+
97+
public function setUpdatedAt(?string $updated_at): self
98+
{
99+
$this->updated_at = $updated_at;
100+
return $this;
101+
}
102+
103+
public function getUpdatedAt(): ?string
104+
{
105+
return $this->updated_at;
106+
}
107+
108+
public function setDeletedAt(?string $deleted_at): self
109+
{
110+
$this->deleted_at = $deleted_at;
111+
return $this;
112+
}
113+
114+
public function getDeletedAt(): ?string
115+
{
116+
return $this->deleted_at;
117+
}
118+
}

backend/app/DomainObjects/Generated/AccountDomainObjectAbstract.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ abstract class AccountDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
1111
final public const SINGULAR_NAME = 'account';
1212
final public const PLURAL_NAME = 'accounts';
1313
final public const ID = 'id';
14+
final public const ACCOUNT_CONFIGURATION_ID = 'account_configuration_id';
1415
final public const CURRENCY_CODE = 'currency_code';
1516
final public const TIMEZONE = 'timezone';
1617
final public const CREATED_AT = 'created_at';
@@ -22,10 +23,10 @@ abstract class AccountDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
2223
final public const SHORT_ID = 'short_id';
2324
final public const STRIPE_CONNECT_SETUP_COMPLETE = 'stripe_connect_setup_complete';
2425
final public const ACCOUNT_VERIFIED_AT = 'account_verified_at';
25-
final public const CONFIGURATION = 'configuration';
2626
final public const STRIPE_CONNECT_ACCOUNT_TYPE = 'stripe_connect_account_type';
2727

2828
protected int $id;
29+
protected ?int $account_configuration_id = null;
2930
protected string $currency_code = 'USD';
3031
protected ?string $timezone = null;
3132
protected ?string $created_at = null;
@@ -37,13 +38,13 @@ abstract class AccountDomainObjectAbstract extends \HiEvents\DomainObjects\Abstr
3738
protected string $short_id;
3839
protected ?bool $stripe_connect_setup_complete = false;
3940
protected ?string $account_verified_at = null;
40-
protected array|string|null $configuration = null;
4141
protected ?string $stripe_connect_account_type = null;
4242

4343
public function toArray(): array
4444
{
4545
return [
4646
'id' => $this->id ?? null,
47+
'account_configuration_id' => $this->account_configuration_id ?? null,
4748
'currency_code' => $this->currency_code ?? null,
4849
'timezone' => $this->timezone ?? null,
4950
'created_at' => $this->created_at ?? null,
@@ -55,7 +56,6 @@ public function toArray(): array
5556
'short_id' => $this->short_id ?? null,
5657
'stripe_connect_setup_complete' => $this->stripe_connect_setup_complete ?? null,
5758
'account_verified_at' => $this->account_verified_at ?? null,
58-
'configuration' => $this->configuration ?? null,
5959
'stripe_connect_account_type' => $this->stripe_connect_account_type ?? null,
6060
];
6161
}
@@ -71,6 +71,17 @@ public function getId(): int
7171
return $this->id;
7272
}
7373

74+
public function setAccountConfigurationId(?int $account_configuration_id): self
75+
{
76+
$this->account_configuration_id = $account_configuration_id;
77+
return $this;
78+
}
79+
80+
public function getAccountConfigurationId(): ?int
81+
{
82+
return $this->account_configuration_id;
83+
}
84+
7485
public function setCurrencyCode(string $currency_code): self
7586
{
7687
$this->currency_code = $currency_code;
@@ -192,17 +203,6 @@ public function getAccountVerifiedAt(): ?string
192203
return $this->account_verified_at;
193204
}
194205

195-
public function setConfiguration(array|string|null $configuration): self
196-
{
197-
$this->configuration = $configuration;
198-
return $this;
199-
}
200-
201-
public function getConfiguration(): array|string|null
202-
{
203-
return $this->configuration;
204-
}
205-
206206
public function setStripeConnectAccountType(?string $stripe_connect_account_type): self
207207
{
208208
$this->stripe_connect_account_type = $stripe_connect_account_type;

0 commit comments

Comments
 (0)