Skip to content

Commit eda3f6e

Browse files
authored
Merge pull request #98 from diazsasak/main
Refactor Xero class methods to set tenant ID for resource instances
2 parents 4e0e547 + 7e074d0 commit eda3f6e

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/Xero.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,34 @@ public function accounts(): Accounts
9292

9393
public function contacts(): Contacts
9494
{
95-
return new Contacts;
95+
$resource = new Contacts;
96+
$resource->setTenantId($this->tenant_id);
97+
98+
return $resource;
9699
}
97100

98101
public function creditnotes(): CreditNotes
99102
{
100-
return new CreditNotes;
103+
$resource = new CreditNotes;
104+
$resource->setTenantId($this->tenant_id);
105+
106+
return $resource;
101107
}
102108

103109
public function invoices(): Invoices
104110
{
105-
return new Invoices;
111+
$resource = new Invoices;
112+
$resource->setTenantId($this->tenant_id);
113+
114+
return $resource;
106115
}
107116

108117
public function webhooks(): Webhooks
109118
{
110-
return new Webhooks;
119+
$resource = new Webhooks;
120+
$resource->setTenantId($this->tenant_id);
121+
122+
return $resource;
111123
}
112124

113125
public function isTokenValid(): bool

0 commit comments

Comments
 (0)