Giter Club home page Giter Club logo

Comments (18)

ghiculescu avatar ghiculescu commented on June 29, 2024 1

Hi @waynerobinson - just wondering if you had a chance to take a look at this?

from xeroizer.

ghiculescu avatar ghiculescu commented on June 29, 2024

fyi, the PHP and .NET APIs have been updated - https://community.xero.com/developer/discussion/1636240

Can I help with anything on the implementation of this? I'm keen to see it up and running as soon as possible!

from xeroizer.

waynerobinson avatar waynerobinson commented on June 29, 2024

Happy to have some help on this as I have been swamped with other things.

You can look in the payroll branch.

Ultimately, because they've changed the API endpoint and there are some clashes in the namespaces, payroll has had to be implemented almost as a separate API.

I have done this via extending the existing record base classes to be payroll-specific and created a way to return a payroll endpint from an existing Xero one.

For example:

require "pp"
require "logger"
require File.dirname(__FILE__) + "/../lib/xeroizer"

xero = Xeroizer::PrivateApplication.new(
          XERO_AUTH,
          XERO_KEY,
          XERO_PK_FILE
       )
xero.logger = Logger.new(STDOUT)

payroll = xero.payroll
employees = payroll.Employee.all

I have created Employee, BankAccount and HomeAddress models so far (the easy ones), but there are a lot of object types in the new API that are mixed together that may also require underlying changes to the way the associations work, although maybe I was reading into this too much when I first read through the API at http://developer.xero.com/payroll-api

from xeroizer.

ghiculescu avatar ghiculescu commented on June 29, 2024

You were right, there are a few schema changes. I started with Timesheets since that's the model I need most. The timesheet model has many "timesheet lines" (http://developer.xero.com/payroll-api/Timesheets/#TimesheetLines), each of which seems to have one "number of units". This is then made up of several "NumberOfUnit" elements.

I ended up adding another association type - has_array - to go with has_many and belongs_to. That's because I couldn't figure out any way of representing this association using existing associations. My changes and tests are committed at https://github.com/ghiculescu/xeroizer/commit/779d014c3388c320d18110a1d39919726afd38d2 - can you please take a look and let me know what you think.

Annoyingly, the only official Xero library - the .NET one - has the tests for new timesheets incomplete and commented out (see https://github.com/XeroAPI/XeroAPI.Net/blob/payroll/source/XeroApi.ConsoleTests/Payroll/PayrollApiWrite.cs#L17). So I didn't have much to go by. I'm going to email them and ask if there will be more examples.

from xeroizer.

ghiculescu avatar ghiculescu commented on June 29, 2024

I've added PayItems (and LeaveApplications, though that's still a work in progress): https://github.com/ghiculescu/xeroizer/commit/27af99ff82bf31a4a45d5dd6ef978ef10ee0b283 I added a new class_inheritable_attributes - all_children_are_subtypes - to handle the PayItems schema. See comments on line 70 of base_model.rb for more info. As usual, any feedback is very welcome.

One thing I wanted to ask you; there are quite a few tests that fail on code that says:

parent.mark_dirty(self) if parent

With error:

NoMethodError: undefined method `mark_dirty' for #<Xeroizer::PublicApplication:0x007ffe82b60750>

These tests fail on the master branch too. I haven't attempted to fix them yet; just wanted to know if you were aware of this?

from xeroizer.

layby42 avatar layby42 commented on June 29, 2024

Hi @waynerobinson, I've tried the payroll branch, read of Employee, BankAccount and HomeAddress works, attempt to write crashes. Do you plan to continue Xero Payroll API implementation?

from xeroizer.

ghiculescu avatar ghiculescu commented on June 29, 2024

Hi @layby42, I wasn't aware of a crash on writes. Can you please give some example code and I will look into it. I've been using the payroll branch in production but currently we only write Timesheets (which explains why the wrapper isn't complete - I would like to see it done one day!)

from xeroizer.

layby42 avatar layby42 commented on June 29, 2024

yes, here it is (the data is valid employee from Demo Company):

  1. payroll = xero.payroll
  2. xero_employee = payroll.Employee.find('9fc6fabc-d9b2-4ee6-96c7-b417f101e2e7')
  3. xero_employee.first_name = 'AAA'
  4. xero_employee.save <-- Net::HTTPBadRequest 400 Bad Request readbody=true

here is the trace:
method - post
endpoint - "/payroll.xro/1.0/Employees"
data:
"\n 9fc6fabc-d9b2-4ee6-96c7-b417f101e2e7\n Oliver\n Gray\n ACTIVE\n [email protected]\n 1966-05-28\n M\n \n Melbourne\n VIC\n 3000\n AUSTRALIA\n \n 0401 123 456\n 2012-12-02\n 893b9b0d-9352-4580-9ec8-09607ba72dc1\n 1de0197b-68cf-4ca2-bc30-2bd65eab13dc\n false\n \n \n Salary \n O Gray\n 234567\n 123451222\n true\n \n \n\n"

from xeroizer.

layby42 avatar layby42 commented on June 29, 2024

Create employee seem to be OK (first & last name); trying to find out how to add HomeAddress and BankAccount

update: BankAccount: add_bank_account (just like add_line_item to invoice); create with BankAccount results into Net::HTTPBadRequest 400 Bad Request readbody=true

so the problem is with posting employee with nested elements like bank account(s) or home address

from xeroizer.

waynerobinson avatar waynerobinson commented on June 29, 2024

This branch is an extremely early version of payroll support and no where
near ready for use.

I will definitely be supporting Payroll in the future, but I've not had any
time in the past few months to do so. Xeroizer is something I volunteer my
time for.

I'm always happy to review and merge pull requests. The best people to
write implementations are those making active use of the features.

On Thursday, September 5, 2013, Oxana Goutnik wrote:

Hi @waynerobinson https://github.com/waynerobinson, I've tried the
payroll branch, read of Employee, BankAccount and HomeAddress works,
attempt to write crashes. Do you plan to continue Xero Payroll API
implementation?


Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-23811611
.

from xeroizer.

layby42 avatar layby42 commented on June 29, 2024

Hi @waynerobinson, I'm working on update for payroll branch.

from xeroizer.

waynerobinson avatar waynerobinson commented on June 29, 2024

Cool.

On 5 September 2013 10:39, Oxana Goutnik [email protected] wrote:

Hi @waynerobinson https://github.com/waynerobinson, I'm working on
update for payroll branch.


Reply to this email directly or view it on GitHubhttps://github.com//issues/76#issuecomment-23836696
.

from xeroizer.

ghiculescu avatar ghiculescu commented on June 29, 2024

Hi @layby42, had any luck? I was going to have a look into it otherwise. It looks like the issue is only coming when loading belongs_to associations from the API, but I didn't quite figure out why last time I looked.

from xeroizer.

layby42 avatar layby42 commented on June 29, 2024

yes, there were 3 issues:

  • Bsb to BSB in xml ; this is the easiest part;
  • belongs_to.. I've changed it to has_one for home address, which looks more appropriate (belongs_to generated wrong parent note when submitting xml), and implemented handlers for has_one; and set_home_address for has_one instead of add_home_address, since we want to have only one home address;
  • address_line_1 & String.underscore: better name address_line1, address_line2, etc. to use underscore

current status: create & update data works; everything goes to Xero without issues; have to finish with reading has_one (home_address) from Xero API properly and implement tests.

If you'd like to look into it yourself as well, please do -)

from xeroizer.

layby42 avatar layby42 commented on June 29, 2024

https://github.com/syreclabs/xeroizer, payroll branch is relatively OK, we are using it on production. Fixed several bugs in my last pull request that was committed to waynerobinson/xeroizer payroll, has bank_account, tax_declaration, super funds, superannuation memberships. Also rebased on current waynerobinson/xeroizer master.
Pay templates are in progress in https://github.com/syreclabs/xeroizer.

from xeroizer.

waynerobinson avatar waynerobinson commented on June 29, 2024

Feel free to submit these back to here if you like.

from xeroizer.

rept avatar rept commented on June 29, 2024

What's the status on the payroll branch? Could I use that branch and support both Accounting and Payroll ?

from xeroizer.

CloCkWeRX avatar CloCkWeRX commented on June 29, 2024

So, I tentatively merged some of the payroll work to master; stuck a 3.0.0-beta on the version and prepped a PR (wildly untested) in #492.

from xeroizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.