Closed madison890000 closed 1 year ago
As described in issue 649, in the xero-node 4.36.0 version, the optional parameter idempotencyKey has been added to all APIs (This allows you to safely retry requests without the risk of duplicate processing. 128 character max.). However, the order of adding idempotencyKey in different APIs is not consistent, and not all APIs have added the idempotencyKey parameter as the last optional parameter. This resulted in a break change when upgrading from xero-node 4.35.0 to 4.36.0, which was not reflected in https://github.com/XeroAPI/xero-node/pull/648. This may have been an oversight.
Based on the following two reasons, I am trying to submit this Pull Request to fix the issue:
My proposed solution in this Pull Request is to not adjust the existing order of the idempotencyKey parameter, but to check for null values and then include the value in the header, in accordance with the definition of optional.
Please note that I have not fixed all APIs currently, but I have only fixed the updateOrCreateInvoices function. If you accept this solution, I will synchronize the fix for all APIs and add corresponding unit tests.
Resolves https://github.com/XeroAPI/xero-node/issues/649