- The original code has ebay api coupled into the code, which makes it hard to do unit test.
- Make it a seperate package also help us to reuse it.
- Decouple the code will help
ebay.js
looks more clear.
A singleton in the application. It takes appId
, devId
and certId
secret to construct. Provide the following functions:
It is like eBay seller. It takes token
to construct. There are two authentication methods provided by
eBay, i.e OAuth
and Auth'nAuth
which you have to specify when you create it.
Parse info from the recieved ebay notification
General flow of calling eBay API:
- Build XML request by API name and authentication type.
xml-builder
- Send the request to ebay endpoint.
- Parse the response into json.
xpath
is a good way
Use mocha as the unit test.