If one retrieves a CreditNote with an Allocation, adds a second one to it with CreditNote::addAllocation, and then saves it, a Request object is built which calls a PUT with the following body which includes the original Allocation.
which errors out with XeroPHP\Remote\Exception\BadRequestException: A validation exception occurred (Credit Note cannot be allocated as the allocation amount is greater than the amount remaining on the Credit Note)
I believe the problem is that the API only expects new Allocations and tries to recreate the existing one erroring out, which fits with the above error message since twice the original allocation + the new allocation is indeed larger that the total amount of the credit note.
If one retrieves a
CreditNote
with anAllocation
, adds a second one to it withCreditNote::addAllocation
, and then saves it, aRequest
object is built which calls a PUT with the following body which includes the original Allocation.which errors out with
XeroPHP\Remote\Exception\BadRequestException: A validation exception occurred (Credit Note cannot be allocated as the allocation amount is greater than the amount remaining on the Credit Note)
I believe the problem is that the API only expects new Allocations and tries to recreate the existing one erroring out, which fits with the above error message since twice the original allocation + the new allocation is indeed larger that the total amount of the credit note.