Skip to content

Commit a1fe429

Browse files
committed
Add support for offline payments and invoice generation
1 parent 0b8ea8a commit a1fe429

File tree

78 files changed

+2327
-293
lines changed

Some content is hidden

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

78 files changed

+2327
-293
lines changed

backend/app/DomainObjects/Enums/PaymentProviders.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44

55
enum PaymentProviders: string
66
{
7-
case STRIPE = 'Stripe';
7+
use BaseEnum;
8+
9+
case STRIPE = 'STRIPE';
10+
case OFFLINE = 'OFFLINE';
811
}

backend/app/DomainObjects/EventSettingDomainObject.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace HiEvents\DomainObjects;
44

55
use HiEvents\DataTransferObjects\AddressDTO;
6+
use HiEvents\Helper\AddressHelper;
67

78
class EventSettingDomainObject extends Generated\EventSettingDomainObjectAbstract
89
{
@@ -25,25 +26,7 @@ public function getGetEmailFooterHtml(): string
2526

2627
public function getAddressString(): string
2728
{
28-
$locationDetails = $this->getLocationDetails();
29-
30-
if (is_null($locationDetails)) {
31-
return '';
32-
}
33-
34-
$addressParts = [
35-
$locationDetails['venue_name'] ?? null,
36-
$locationDetails['address_line_1'] ?? null,
37-
$locationDetails['address_line_2'] ?? null,
38-
$locationDetails['city'] ?? null,
39-
$locationDetails['state_or_region'] ?? null,
40-
$locationDetails['zip_or_postal_code'] ?? null,
41-
$locationDetails['country'] ?? null
42-
];
43-
44-
$filteredAddressParts = array_filter($addressParts, static fn($part) => !is_null($part) && $part !== '');
45-
46-
return implode(', ', $filteredAddressParts);
29+
return AddressHelper::formatAddress($this->getLocationDetails());
4730
}
4831

4932
public function getAddress(): AddressDTO

backend/app/DomainObjects/Generated/EventSettingDomainObjectAbstract.php

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
4545
final public const SHOW_SHARE_BUTTONS = 'show_share_buttons';
4646
final public const HOMEPAGE_BODY_BACKGROUND_COLOR = 'homepage_body_background_color';
4747
final public const HOMEPAGE_BACKGROUND_TYPE = 'homepage_background_type';
48+
final public const ENABLE_INVOICING = 'enable_invoicing';
49+
final public const INVOICE_LABEL = 'invoice_label';
50+
final public const INVOICE_PREFIX = 'invoice_prefix';
51+
final public const INVOICE_START_NUMBER = 'invoice_start_number';
52+
final public const REQUIRE_BILLING_ADDRESS = 'require_billing_address';
53+
final public const ORGANIZATION_NAME = 'organization_name';
54+
final public const ORGANIZATION_ADDRESS = 'organization_address';
55+
final public const TAX_DETAILS = 'tax_details';
56+
final public const PAYMENT_PROVIDERS = 'payment_providers';
57+
final public const OFFLINE_PAYMENT_INSTRUCTIONS = 'offline_payment_instructions';
4858

4959
protected int $id;
5060
protected int $event_id;
@@ -81,6 +91,16 @@ abstract class EventSettingDomainObjectAbstract extends \HiEvents\DomainObjects\
8191
protected bool $show_share_buttons = true;
8292
protected ?string $homepage_body_background_color = null;
8393
protected string $homepage_background_type = 'COLOR';
94+
protected bool $enable_invoicing = false;
95+
protected ?string $invoice_label = null;
96+
protected ?string $invoice_prefix = null;
97+
protected int $invoice_start_number = 1;
98+
protected bool $require_billing_address = true;
99+
protected ?string $organization_name = null;
100+
protected ?string $organization_address = null;
101+
protected ?string $tax_details = null;
102+
protected array|string|null $payment_providers = null;
103+
protected ?string $offline_payment_instructions = null;
84104

85105
public function toArray(): array
86106
{
@@ -120,6 +140,16 @@ public function toArray(): array
120140
'show_share_buttons' => $this->show_share_buttons ?? null,
121141
'homepage_body_background_color' => $this->homepage_body_background_color ?? null,
122142
'homepage_background_type' => $this->homepage_background_type ?? null,
143+
'enable_invoicing' => $this->enable_invoicing ?? null,
144+
'invoice_label' => $this->invoice_label ?? null,
145+
'invoice_prefix' => $this->invoice_prefix ?? null,
146+
'invoice_start_number' => $this->invoice_start_number ?? null,
147+
'require_billing_address' => $this->require_billing_address ?? null,
148+
'organization_name' => $this->organization_name ?? null,
149+
'organization_address' => $this->organization_address ?? null,
150+
'tax_details' => $this->tax_details ?? null,
151+
'payment_providers' => $this->payment_providers ?? null,
152+
'offline_payment_instructions' => $this->offline_payment_instructions ?? null,
123153
];
124154
}
125155

@@ -507,4 +537,114 @@ public function getHomepageBackgroundType(): string
507537
{
508538
return $this->homepage_background_type;
509539
}
540+
541+
public function setEnableInvoicing(bool $enable_invoicing): self
542+
{
543+
$this->enable_invoicing = $enable_invoicing;
544+
return $this;
545+
}
546+
547+
public function getEnableInvoicing(): bool
548+
{
549+
return $this->enable_invoicing;
550+
}
551+
552+
public function setInvoiceLabel(?string $invoice_label): self
553+
{
554+
$this->invoice_label = $invoice_label;
555+
return $this;
556+
}
557+
558+
public function getInvoiceLabel(): ?string
559+
{
560+
return $this->invoice_label;
561+
}
562+
563+
public function setInvoicePrefix(?string $invoice_prefix): self
564+
{
565+
$this->invoice_prefix = $invoice_prefix;
566+
return $this;
567+
}
568+
569+
public function getInvoicePrefix(): ?string
570+
{
571+
return $this->invoice_prefix;
572+
}
573+
574+
public function setInvoiceStartNumber(int $invoice_start_number): self
575+
{
576+
$this->invoice_start_number = $invoice_start_number;
577+
return $this;
578+
}
579+
580+
public function getInvoiceStartNumber(): int
581+
{
582+
return $this->invoice_start_number;
583+
}
584+
585+
public function setRequireBillingAddress(bool $require_billing_address): self
586+
{
587+
$this->require_billing_address = $require_billing_address;
588+
return $this;
589+
}
590+
591+
public function getRequireBillingAddress(): bool
592+
{
593+
return $this->require_billing_address;
594+
}
595+
596+
public function setOrganizationName(?string $organization_name): self
597+
{
598+
$this->organization_name = $organization_name;
599+
return $this;
600+
}
601+
602+
public function getOrganizationName(): ?string
603+
{
604+
return $this->organization_name;
605+
}
606+
607+
public function setOrganizationAddress(?string $organization_address): self
608+
{
609+
$this->organization_address = $organization_address;
610+
return $this;
611+
}
612+
613+
public function getOrganizationAddress(): ?string
614+
{
615+
return $this->organization_address;
616+
}
617+
618+
public function setTaxDetails(?string $tax_details): self
619+
{
620+
$this->tax_details = $tax_details;
621+
return $this;
622+
}
623+
624+
public function getTaxDetails(): ?string
625+
{
626+
return $this->tax_details;
627+
}
628+
629+
public function setPaymentProviders(array|string|null $payment_providers): self
630+
{
631+
$this->payment_providers = $payment_providers;
632+
return $this;
633+
}
634+
635+
public function getPaymentProviders(): array|string|null
636+
{
637+
return $this->payment_providers;
638+
}
639+
640+
public function setOfflinePaymentInstructions(?string $offline_payment_instructions): self
641+
{
642+
$this->offline_payment_instructions = $offline_payment_instructions;
643+
return $this;
644+
}
645+
646+
public function getOfflinePaymentInstructions(): ?string
647+
{
648+
return $this->offline_payment_instructions;
649+
}
510650
}

0 commit comments

Comments
 (0)