Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Practice manager - Looking for feedback #760

Merged
merged 10 commits into from
Jan 31, 2022

Conversation

bretto36
Copy link
Contributor

Hi All

We use the Xero API but also the Xero Practice Manager API, we've recently had to move to OAUTH2 and am hoping to use the calcinai package so i don't have to reinvent the wheel.

Is it possible to get some feedback on this so i don't go too far down the rabbit hole doing it the wrong way.

@bretto36
Copy link
Contributor Author

@calcinai Hi! Thank you for the great package. Hoping i could get some of your time to review a Pull Request and tell me if i'm on the right track to add Practice Management support

@calcinai
Copy link
Owner

@bretto36 looking great! Are you using this in your application currently?

@bretto36
Copy link
Contributor Author

bretto36 commented Sep 25, 2020

@calcinai - Yes currently using it in a staging environment. About to go live with it. It's not the full API, but it does handle the features we needed to bring across now that the switch to OAUTH2.0 is on.

These are some of the ways we are using it.

// Invoices
$query = $this->getApi($account)->load(\XeroPHP\Models\PracticeManager\Invoice::class)
                      ->setParameter('detailed', 'true')
                      ->setParameter('from', $dateFrom)
                      ->setParameter('to', $dateTo);

/** @var \XeroPHP\Models\PracticeManager\Invoice[] $invoices */
$invoices = $query->execute();

// Custom Fields
/** @var \XeroPHP\Models\PracticeManager\CustomField[] $customFields */
        $customFields = $this->getApi($account)->load(\XeroPHP\Models\PracticeManager\CustomField::class)->execute();

// Clients
$query = $this->getApi($account)->load(\XeroPHP\Models\PracticeManager\Client::class);

if (!$force) {
    $query->setParameter('modifiedsince', $now->subDays(7)->format('Y-m-d\TH:i:s'));
}

/** @var \XeroPHP\Models\PracticeManager\Client[] $clients */
$clients = $query->execute();

// Loop through clients and can get the sub fields
foreach ($clients as $client) {
    foreach ($client->getCustomFieldValues() as $customFieldValue) {
        // DO something here
    }
}

@bretto36
Copy link
Contributor Author

Just thought i'd update here. Have been using this in production for over 18 months now. Working well.

*/
if ($this->hasGUID() === false) {
throw new Exception(
'Attachments are only available to objects that exist remotely.'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you fix this exception text I'd be happy to merge!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calcinai Have updated the message. Thanks for spotting it

@calcinai
Copy link
Owner

Nice work @bretto36

@calcinai calcinai merged commit f628a86 into calcinai:master Jan 31, 2022
@bretto36
Copy link
Contributor Author

@calcinai Thanks mate. Appreciate the work you've done on the package so far. Come in very handy for me personally. Especially when Xero retired the oauth1a.

@bretto36 bretto36 deleted the practice-manager branch July 25, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants