Skip to content

Fix contacts array when creating or updating client#67

Merged
mehwoot merged 2 commits intomasterfrom
contacts-add-fix
Sep 6, 2021
Merged

Fix contacts array when creating or updating client#67
mehwoot merged 2 commits intomasterfrom
contacts-add-fix

Conversation

@mehwoot
Copy link
Contributor

@mehwoot mehwoot commented Sep 6, 2021

The XPM API expects xml of the form

  <Contacts>
    <Contact>
      <Name>Jo Bloggs</Name>

inside a Client for creating contacts when updating. The code appeared to specify this, but actually .to_xml on a Hash works differently to expected, where an array type called Contacts will automatically have each entry wrapped with Contact. So the generated XML was looking like

<Client>
  <Name>Bob Bobus 2</Name>
  <Email>bob@hotmail.com</Email>
  <Phone></Phone>
  <GSTRegistered></GSTRegistered>
  <JobManagerID>1000237</JobManagerID>
  <Contacts type="array">
    <Contact>
      <Contact>
        <Name>bob bobus</Name>

Which meant it didn't work. This was only for creating contacts during client creation, which I gather nobody had used before.

@mehwoot mehwoot requested a review from a team as a code owner September 6, 2021 05:39
Copy link
Contributor

@abreckner abreckner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah interesting. I did not know that...

@mehwoot mehwoot merged commit 1c088f3 into master Sep 6, 2021
@mehwoot mehwoot deleted the contacts-add-fix branch September 6, 2021 05:43
lankz pushed a commit that referenced this pull request Jun 10, 2025
* Fix contacts array when creating or updating client

* Fix specs
lankz pushed a commit that referenced this pull request Jun 10, 2025
* Fix contacts array when creating or updating client

* Fix specs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants