Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

GetNotificationPreferences doesn't properly convert xml to json #37

Open
1mike12 opened this issue Oct 3, 2016 · 4 comments
Open

GetNotificationPreferences doesn't properly convert xml to json #37

1mike12 opened this issue Oct 3, 2016 · 4 comments

Comments

@1mike12
Copy link

1mike12 commented Oct 3, 2016

I put a breakpoint on xml-converter.js, and the xmlBody is passed in correctly, but somewhere it will drop all the notificationEnable entries

raw xml received from ebay

<?xml version="1.0" encoding="UTF-8"?>
<GetNotificationPreferencesResponse xmlns="urn:ebay:apis:eBLBaseComponents">
   <Timestamp>2016-10-03T03:22:21.880Z</Timestamp>
   <Ack>Success</Ack>
   <Version>967</Version>
   <Build>E967_CORE_APINOTIFY_18003059_R1</Build>
   <UserDeliveryPreferenceArray>
      <NotificationEnable>
         <EventType>EndOfAuction</EventType>
         <EventEnable>Disable</EventEnable>
      </NotificationEnable>
      <NotificationEnable>
         <EventType>AuctionCheckoutComplete</EventType>
         <EventEnable>Enable</EventEnable>
      </NotificationEnable>
      <NotificationEnable>
         <EventType>Feedback</EventType>
         <EventEnable>Disable</EventEnable>
      </NotificationEnable>
      <NotificationEnable>
         <EventType>FixedPriceTransaction</EventType>
         <EventEnable>Enable</EventEnable>
      </NotificationEnable>
      <NotificationEnable>
         <EventType>ItemListed</EventType>
         <EventEnable>Disable</EventEnable>
      </NotificationEnable>
      <NotificationEnable>
         <EventType>MyMessagesM2MMessage</EventType>
         <EventEnable>Disable</EventEnable>
      </NotificationEnable>
      <NotificationEnable>
         <EventType>BidReceived</EventType>
         <EventEnable>Disable</EventEnable>
      </NotificationEnable>
      <NotificationEnable>
         <EventType>FeedbackReceived</EventType>
         <EventEnable>Enable</EventEnable>
      </NotificationEnable>
   </UserDeliveryPreferenceArray>
</GetNotificationPreferencesResponse>

after conversion

{
  "$": {
    "xmlns": "urn:ebay:apis:eBLBaseComponents"
  },
  "Timestamp": "2016-10-03T03:22:21.880Z",
  "Ack": "Success",
  "Version": "967",
  "Build": "E967_CORE_APINOTIFY_18003059_R1",
  "UserDeliveryPreferences": []
}
@1mike12
Copy link
Author

1mike12 commented Oct 3, 2016

so looks like the culprit is inside the default json parser in json-parser.js. There's a flattening function that destroys the data inside the UserDeliveryPreferences array.

@1mike12
Copy link
Author

1mike12 commented Oct 3, 2016

made a fix that now FINALLY gets this api call working. #38 . hopefully the maintainer can get this in there

Also PS , if this call also doesn't work if you're in sandbox mode, go figure...... #justebaythings

{
  "$": {
    "xmlns": "urn:ebay:apis:eBLBaseComponents"
  },
  "Timestamp": "2016-10-03T03:58:53.722Z",
  "Ack": "Success",
  "Version": "967",
  "Build": "E967_CORE_APINOTIFY_18003059_R1",
  "UserDeliveryPreferences": [
    {
      "EventType": "EndOfAuction",
      "EventEnable": "Disable"
    },
    {
      "EventType": "AuctionCheckoutComplete",
      "EventEnable": "Enable"
    },
    {
      "EventType": "Feedback",
      "EventEnable": "Disable"
    },
    {
      "EventType": "FixedPriceTransaction",
      "EventEnable": "Enable"
    },
    {
      "EventType": "ItemListed",
      "EventEnable": "Disable"
    },
    {
      "EventType": "MyMessagesM2MMessage",
      "EventEnable": "Disable"
    },
    {
      "EventType": "BidReceived",
      "EventEnable": "Disable"
    },
    {
      "EventType": "FeedbackReceived",
      "EventEnable": "Enable"
    }
  ]
}

@benbuckman
Copy link
Owner

Thank you @1mike12 , I left some comments on the PR.

@benbuckman
Copy link
Owner

#38

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants