hendt / ebay-api

eBay Node API in TypeScript for Node and Browser with RESTful and Traditional APIs. This library aims to implement all available eBay apis.
https://hendt.gitbook.io/ebay-api
MIT License
141 stars 38 forks source link

How to SetNotificationPreferences multiples #174

Open liberat0r opened 1 week ago

liberat0r commented 1 week ago

Describe the bug How to subscribe to multiple notifications in one call? The object key is "UserDeliveryPreferenceArray" but it contains an object.

Code

   const notifs = await thisInstance.trading.SetNotificationPreferences({
      UserDeliveryPreferenceArray: {
          // https://developer.ebay.com/Devzone/XML/docs/Reference/eBay/types/NotificationEventTypeCodeType.html
          NotificationEnable: {
              EventType: 'ItemListed',
              EventEnable: 'Enable',
          },
          //NotificationEnable: {
          //    EventType: 'ItemSold',
          //    EventEnable: 'Enable',
          //},
          // ItemMarkedPaid ItemMarkedShipped ItemRevised ItemSold
      },
  });

Would you like to work on this issue?

dantio commented 1 week ago

Good question. I'll work on that.

dantio commented 1 week ago

I have release 9.1.0

This is how it should work:

eBay.trading.SetNotificationPreferences({
  UserDeliveryPreferenceArray: [{
    NotificationEnable: {
      EventType: 'ItemListed',
      EventEnable: 'Enable',
    }
  }, {
    NotificationEnable: {
      EventType: 'ItemSold',
      EventEnable: 'Enable',
    },
  }],
}, { xmlBuilderOptions: { oneListGroup: true }})