{"action":"created","issue":{"url":"https://api.github.com/repos/beardon/mws-api/issues/75","repository_url":"https://api.github.com/repos/beardon/mws-api","labels_url":"https://api.github.com/repos/beardon/mws-api/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/beardon/mws-api/issues/75/comments","events_url":"https://api.github.com/repos/beardon/mws-api/issues/75/events","html_url":"https://github.com/beardon/mws-api/pull/75","id":226879920,"number":75,"title":"feat(lib): version 2.1.0 allow multiple messages on OrderFulfillment","user":{"login":"dciccale","id":539546,"avatar_url":"https://avatars3.githubusercontent.com/u/539546?v=3","gravatar_id":"","url":"https://api.github.com/users/dciccale","html_url":"https://github.com/dciccale","followers_url":"https://api.github.com/users/dciccale/followers","following_url":"https://api.github.com/users/dciccale/following{/other_user}","gists_url":"https://api.github.com/users/dciccale/gists{/gist_id}","starred_url":"https://api.github.com/users/dciccale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dciccale/subscriptions","organizations_url":"https://api.github.com/users/dciccale/orgs","repos_url":"https://api.github.com/users/dciccale/repos","events_url":"https://api.github.com/users/dciccale/events{/privacy}","received_events_url":"https://api.github.com/users/dciccale/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-05-07T17:55:19Z","updated_at":"2017-05-25T14:34:07Z","closed_at":"2017-05-09T15:36:40Z","pull_request":{"url":"https://api.github.com/repos/beardon/mws-api/pulls/75","html_url":"https://github.com/beardon/mws-api/pull/75","diff_url":"https://github.com/beardon/mws-api/pull/75.diff","patch_url":"https://github.com/beardon/mws-api/pull/75.patch"},"body":"Here is a description of the changes and why:\r\n\r\n**Dependencies**\r\nReplaced 2 dependencies `xml` and `xml2json`  in favor of https://npmjs.com/package/xml2js \r\n\r\nThis has several advantages\r\n- Less deps\r\n- pure JavaScript parser\r\n- does not rely on C code which in turns, gives slower installation time of mws-api since it has to compile node-expat. \r\n- super faster installation and does not require to have `make`, `gcc`, `g++` and `python` installed in the machine. (useful when building inside a Docker container and very appreciated having slim images)\r\n- xml2js has 6million downloads/mo on NPM way more than all the other dependencies combined. And it is very well maintained. It basically uses `sax` and `xmlbuilder` deps. Check them out.\r\n\r\n**Multiple messages**\r\nOther reason for this replacement, is that `xml2js` automatically recognizes arrays or simple objects, meaning we can now pass multiple messages (array of objects) or only 1 (just an object) and it will work as before.\r\n\r\nTo create multiple messages just pass an array of them like this:\r\n\r\n```js\r\nconst FeedContent = Feeds._POST_ORDER_FULFILLMENT_DATA_([{\r\n    MessageID: 1,\r\n    MerchantOrderID: 1234567,\r\n    MerchantFulfillmentID: 1234567,\r\n    FulfillmentDate: '2002-05-01T15:36:33-08:00',\r\n    CarrierCode: 'UPS',\r\n    ShippingMethod: 'Second Day',\r\n    ShipperTrackingNumber: '1234567890'\r\n}, {\r\n    MessageID: 2,\r\n    MerchantOrderID: 9876543,\r\n    MerchantFulfillmentID: 9876543,\r\n    FulfillmentDate: '2002-05-01T16:30:33-08:00',\r\n    CarrierCode: 'DHL',\r\n    ShippingMethod: 'Second Day',\r\n    ShipperTrackingNumber: '1234567890'\r\n}]);\r\n```\r\n\r\n**Breaking changes**\r\n**EDIT:** There are no breaking changes.\r\n\r\nI have also removed an unnecessary merge of data when creating the envelope to count the message id. This should be taken care of the developer when sending the data and not hidden in the implementation since it can bring confusion.\r\n\r\n**Version**\r\n~Since this is breaking, I bumped the version to 3.0.0~\r\nIs not breaking now, guess I should increase `minor` version instead.\r\n\r\nSorry for doing this many changes :)"},"comment":{"url":"https://api.github.com/repos/beardon/mws-api/issues/comments/304025510","html_url":"https://github.com/beardon/mws-api/pull/75#issuecomment-304025510","issue_url":"https://api.github.com/repos/beardon/mws-api/issues/75","id":304025510,"user":{"login":"BarryCarlyon","id":20999,"avatar_url":"https://avatars1.githubusercontent.com/u/20999?v=3","gravatar_id":"","url":"https://api.github.com/users/BarryCarlyon","html_url":"https://github.com/BarryCarlyon","followers_url":"https://api.github.com/users/BarryCarlyon/followers","following_url":"https://api.github.com/users/BarryCarlyon/following{/other_user}","gists_url":"https://api.github.com/users/BarryCarlyon/gists{/gist_id}","starred_url":"https://api.github.com/users/BarryCarlyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BarryCarlyon/subscriptions","organizations_url":"https://api.github.com/users/BarryCarlyon/orgs","repos_url":"https://api.github.com/users/BarryCarlyon/repos","events_url":"https://api.github.com/users/BarryCarlyon/events{/privacy}","received_events_url":"https://api.github.com/users/BarryCarlyon/received_events","type":"User","site_admin":false},"created_at":"2017-05-25T14:34:07Z","updated_at":"2017-05-25T14:34:07Z","body":"Currently all the tests for `_POST_ORDER_FULFILLMENT_DATA_` omit a `<MerchantIdentifer>` key, so the test passes, but when throwing this XML at amazon it rejects it becuase the `<Header>` is missing the <MerchantIdentifer>` key. (Granted this test was using a `_POST_ORDER_ACKNOWLEDGEMENT_DATA_` XML packet, but the XSD's at https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/xsd/release_1_9/amzn-header.xsd have the MerchantIdentifier as a string (and not a minOccurs 0 so it's required)"}}
{"actor":{"display_login":"BarryCarlyon"}}