Skip to content

Commit f5c6ef0

Browse files
authored
Feature: SDK - API Sync include customer id in address and business entities (#45)
1 parent 3066721 commit f5c6ef0

File tree

12 files changed

+18
-0
lines changed

12 files changed

+18
-0
lines changed

src/Entities/Address.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Address implements Entity
2020
{
2121
private function __construct(
2222
public string $id,
23+
public string $customerId,
2324
public string|null $description,
2425
public string|null $firstLine,
2526
public string|null $secondLine,
@@ -39,6 +40,7 @@ public static function from(array $data): self
3940
{
4041
return new self(
4142
id: $data['id'],
43+
customerId: $data['customer_id'],
4244
description: $data['description'] ?? null,
4345
firstLine: $data['first_line'] ?? null,
4446
secondLine: $data['second_line'] ?? null,

src/Entities/Business.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Business implements Entity
2424
private function __construct(
2525
public string $id,
2626
public string $name,
27+
public string $customerId,
2728
public string|null $companyNumber,
2829
public string|null $taxIdentifier,
2930
public Status $status,
@@ -40,6 +41,7 @@ public static function from(array $data): self
4041
return new self(
4142
id: $data['id'],
4243
name: $data['name'],
44+
customerId: $data['customer_id'],
4345
companyNumber: $data['company_number'] ?? null,
4446
taxIdentifier: $data['tax_identifier'] ?? null,
4547
status: Status::from($data['status']),

src/Notifications/Entities/Address.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ private function __construct(
3232
public \DateTimeInterface $createdAt,
3333
public \DateTimeInterface $updatedAt,
3434
public ImportMeta|null $importMeta,
35+
public string|null $customerId,
3536
) {
3637
}
3738

@@ -51,6 +52,7 @@ public static function from(array $data): self
5152
createdAt: DateTime::from($data['created_at']),
5253
updatedAt: DateTime::from($data['updated_at']),
5354
importMeta: isset($data['import_meta']) ? ImportMeta::from($data['import_meta']) : null,
55+
customerId: $data['customer_id'] ?? null,
5456
);
5557
}
5658
}

src/Notifications/Entities/Business.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ private function __construct(
3232
public \DateTimeInterface $updatedAt,
3333
public CustomData|null $customData,
3434
public ImportMeta|null $importMeta,
35+
public string|null $customerId,
3536
) {
3637
}
3738

@@ -48,6 +49,7 @@ public static function from(array $data): self
4849
updatedAt: DateTime::from($data['updated_at']),
4950
customData: isset($data['custom_data']) ? new CustomData($data['custom_data']) : null,
5051
importMeta: isset($data['import_meta']) ? ImportMeta::from($data['import_meta']) : null,
52+
customerId: $data['customer_id'] ?? null,
5153
);
5254
}
5355
}

tests/Functional/Resources/Addresses/_fixtures/response/full_entity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"data": {
33
"id": "add_01h848pep46enq8y372x7maj0p",
4+
"customer_id": "ctm_01h844p3h41s12zs5mn4axja51",
45
"status": "active",
56
"description": "Head Office",
67
"first_line": "4050 Jefferson Plaza, 41st Floor",

tests/Functional/Resources/Addresses/_fixtures/response/list_default.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"data": [
33
{
44
"id": "add_01h848pep46enq8y372x7maj0p",
5+
"customer_id": "ctm_01h844p3h41s12zs5mn4axja51",
56
"status": "active",
67
"description": "Head Office",
78
"first_line": "4050 Jefferson Plaza, 41st Floor",
@@ -16,6 +17,7 @@
1617
},
1718
{
1819
"id": "add_01h8494f4w5rwfp8b12yqh8fp1",
20+
"customer_id": "ctm_01h844p3h41s12zs5mn4axja51",
1921
"status": "active",
2022
"description": "London Office",
2123
"first_line": "81 Richmond Road",

tests/Functional/Resources/Addresses/_fixtures/response/minimal_entity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"data": {
33
"id": "add_01he8brnckeq87t52hajkgfrg5",
4+
"customer_id": "ctm_01h844p3h41s12zs5mn4axja51",
45
"status": "active",
56
"description": null,
67
"first_line": null,

tests/Functional/Resources/Businesses/_fixtures/response/full_entity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"data": {
33
"id": "biz_01h84a7hr4pzhsajkm8tev89ev",
4+
"customer_id": "ctm_01h844p3h41s12zs5mn4axja51",
45
"status": "active",
56
"name": "ChatApp Inc.",
67
"company_number": "555775291485",

tests/Functional/Resources/Businesses/_fixtures/response/list_default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"data": [
33
{
44
"id": "biz_01h84a7hr4pzhsajkm8tev89ev",
5+
"customer_id": "ctm_01h844p3h41s12zs5mn4axja51",
56
"status": "active",
67
"name": "ChatApp Inc.",
78
"company_number": "555775291485",

tests/Functional/Resources/Businesses/_fixtures/response/minimal_entity.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"data": {
33
"id": "biz_01h84a7hr4pzhsajkm8tev89ev",
4+
"customer_id": "ctm_01h844p3h41s12zs5mn4axja51",
45
"status": "active",
56
"name": "ChatApp Inc.",
67
"company_number": null,

0 commit comments

Comments
 (0)