XeroAPI / xero-node

Xero Node SDK for OAuth 2.0 generated from XeroAPI/Xero-OpenAPI
http://developer.xero.com/
MIT License
205 stars 162 forks source link

CreateBrandingThemePaymentServices should expect an array of payment services, not a single payment service #605

Closed applecran closed 2 years ago

applecran commented 2 years ago

Describe the bug The api docs, and my testing show that this function should be posting an object with an array of Payment Services in it, and not a single payment service. (https://developer.xero.com/documentation/api/accounting/brandingthemes#post-paymentservices)

The api is expecting the body to be:

{
"PaymentServices": [{
  "PaymentServiceID": "de5c978d-3cbf-4ebb-9ca9-20d7cb196ab1"
  }]
}

But it's currently sending:

{
"PaymentService": {
  "PaymentServiceID": "de5c978d-3cbf-4ebb-9ca9-20d7cb196ab1"
  }
}

line 966 of accountingApi.ts should be changed from body: ObjectSerializer.serialize(paymentService, "PaymentService") to body: ObjectSerializer.serialize(paymentService, "PaymentServices")

Ideally we'd change the parameter name to paymentServices and line 966 to body: ObjectSerializer.serialize(paymentServices, "PaymentServices").

RettBehrens commented 2 years ago

Hey @applecran good catch. I've just tested this in the sample app and confirmed the API accepts both formats 🤔

We'll look to update the SDK method so it reflects the docs and accepts an array of PaymentServices.

I just want to confirm with the API team regarding expected behavior before releasing the change

RettBehrens commented 2 years ago

Sorry, github auto closed this issue. Will update/close once the updated SDK has been released