Lettopia eBay API
- 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.jslooks more clear.
A singleton in the application. It takes
certId secret to construct. Provide the following functions:
GetOAuthToken: For OAuth
GetRefreshToken: For OAuth renew
GetSessionId: For Auth'nAuth
It is like eBay seller. It takes
token to construct. There are two authentication methods provided by
Auth'nAuth which you have to specify when you create it.
GetOrders: For getting ebay order
GetSellerList: For getting ebay seller products
GetUser: Get account when create ebay user
CompleleSale: Update tracking number
SetNotificationPreferences: Set the user notification
AddFixedPriceItem: List item to ebay
GetUserPreferences: Get user preference including its listing limit
GetMyeBaySelling: Get seller's selling
SetUserPreferences: Set the user's preference, including Out-of-Stock feature
ReviseInventoryStatus: Used for inventory sync
ReviseFixedPriceItem: Set the item to GTC listing for out-of-stock feature
Parse info from the recieved ebay notification
General flow of calling eBay API:
- Build XML request by API name and authentication type.
- Send the request to ebay endpoint.
- Parse the response into json.
xpathis a good way
Use mocha as the unit test.