webfox / laravel-xero-oauth2

A Laravel integration for Xero using the Oauth 2.0 spec
MIT License
50 stars 32 forks source link

[BUG] When using multiple tenants, the tenantId from the web hooks should be used #89

Closed mariusdatakrag closed 1 month ago

mariusdatakrag commented 7 months ago

When using multiple tenants, the tenantId from the web hooks should be used

See screenshot for the fix.

image

    public function getResource()
    {
        if ($this->getEventCategory() === 'INVOICE') {
            return $this->accountingApi
                ->getInvoice($this->getTenantId(), $this->getResourceId())
                ->getInvoices()[0];
        }
        if ($this->getEventCategory() === 'CONTACT') {
            return $this->accountingApi
                ->getContact($this->getTenantId(), $this->getResourceId())
                ->getContacts()[0];
        }
    }
hailwood commented 7 months ago

Thanks @mariusdatakrag, Well spotted!

Would you like to submit a PR so the fix is attributed to you?

JamesFreeman commented 1 month ago

I believe can be closed now @hailwood

hailwood commented 1 month ago

Will be fixed in the upcoming 6.0 release.