XeroAPI/xero-ruby

Error when fetching Earnings Rates from some UK Payroll companies

CyberFerret opened this issue · 5 comments

When making the call:

api = get_api(@xero_client, <UK company organisation details>)
response = api.get_earnings_rates(tenantId).earnings_rates

The xero-ruby gem immediately returns with this error:

/xero-ruby/models/payroll_uk/earnings_rate.rb:231:in `earnings_type=': invalid value for "earnings_type", must be one of ["Allowance", "Backpay", "Bonus", "Commission", "LumpSum", "OtherEarnings", "OvertimeEarnings", "RegularEarnings", "StatutoryAdoptionPay", "StatutoryAdoptionPayNonPensionable", "StatutoryBereavementPay", "StatutoryMaternityPay", "StatutoryMaternityPayNonPensionable", "StatutoryPaternityPay", "StatutoryPaternityPayNonPensionable", "StatutoryParentalBereavementPayNonPensionable", "StatutorySharedParentalPay", "StatutorySharedParentalPayNonPensionable", "StatutorySickPay", "StatutorySickPayNonPensionable", "Tips(Direct)", "Tips(Non-Direct)"]. (ArgumentError)

Not all UK payroll companies, but one or two are returning this and I am wondering if it is a bug within the gem or perhaps a misconfiguration on the customer's part?

Hey @CyberFerret - can you check the corresponding log in your api history?

This should show us the raw response. I think this is a data issue where we will need to add the missing enum to the open api spec. There might have been some payroll related orgs that have unexpected values.

Unfortunately, not a lot of useful info in the Xero API History @SerKnight - it shows as a 'successful' call there, but it must be while parsing the response that it fails.

CleanShot 2021-06-16 at 09 13 07@2x

Ah yes those are redacted :/ can you share the id at top. That’s just the Xero correlation I’d and will let me look up specific log in backend to view the enums in ref.

Nothing security related about it, so fine to post here.

No problem. I re-ran a refresh on one of our customer companies, and the id is 1c69aa98-1c62-407e-a174-b9948b525755

3.1.2 added the missing UK payroll earnings type!

- TerminationPay