-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from bhushankumarl/development
Development
- Loading branch information
Showing
21 changed files
with
2,219 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,11 +31,16 @@ export DEBUG=eBay:* | |
``` | ||
|
||
## Usage | ||
```bash | ||
``` | ||
export EBAY_CLIENT_ID=KEY | ||
export EBAY_CLIENT_SECRET=SECRET | ||
``` | ||
|
||
## Additional Parameters based on different API Call | ||
``` | ||
export EBAY_DEV_ID=DEV_ID | ||
``` | ||
|
||
## To Enable Sandbox Purpose | ||
```bash | ||
export EBAY_CLIENT_SANDBOX='true' | ||
|
@@ -425,6 +430,20 @@ Originally by [Bhushankumar L](mailto:[email protected]). | |
} | ||
``` | ||
|
||
### Finding | ||
#### Find Items By Product | ||
``` | ||
try { | ||
var content = fse.readFileSync('./sample.xml', 'UTF-8'); | ||
var response = await eBay.finding.findItemsByProduct({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
### Sell | ||
### Account | ||
#### Create Or Replace Sales Tax | ||
|
@@ -576,7 +595,7 @@ Originally by [Bhushankumar L](mailto:[email protected]). | |
``` | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var sku = '32984729384729'; | ||
var sku = '32984729384730'; | ||
try { | ||
var response = await eBay.inventory.getInventoryItem(sku); | ||
console.log('response ', response); | ||
|
@@ -937,6 +956,76 @@ Originally by [Bhushankumar L](mailto:[email protected]). | |
} | ||
``` | ||
|
||
### Shopping | ||
#### Find Products | ||
``` | ||
try { | ||
var content = fse.readFileSync('./sample.xml', 'UTF-8'); | ||
// console.log('content', content); | ||
var response = await eBay.shopping.findProducts({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
### Trading | ||
#### Add Item | ||
``` | ||
try { | ||
var content = fse.readFileSync('./sample.xml', 'UTF-8'); | ||
// console.log('content', content); | ||
var response = await eBay.trading.addItem({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
#### Get Item | ||
``` | ||
try { | ||
var content = fse.readFileSync('./sample.txt', 'UTF-8'); | ||
// console.log('content', content); | ||
var response = await eBay.trading.addItem({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
#### Get Session Id | ||
``` | ||
var devId = utils.DEV_ID; | ||
var ruName = utils.RU_NAME; | ||
eBay.setDevName(devId); | ||
const obj = { | ||
'@': { | ||
'xmlns': 'urn:ebay:apis:eBLBaseComponents' | ||
}, | ||
'ErrorLanguage': 'en_US', | ||
'WarningLevel': 'High', | ||
'RuName': ruName | ||
}; | ||
var content = js2xmlparser.parse('GetSessionIDRequest', obj, {declaration: {encoding: 'UTF-8'}}); | ||
try { | ||
var response = await eBay.trading.getSessionID({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
### User | ||
#### Get Redirect Url | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
var fse = require('fs-extra'); | ||
|
||
var eBay = require('../../../lib/eBay-node-client')(clientId, clientSecret); | ||
|
||
var findingRequest = async function () { | ||
try { | ||
var content = fse.readFileSync('./sample.xml', 'UTF-8'); | ||
|
||
var response = await eBay.finding.findItemsByProduct({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
findingRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<findItemsByProductRequest xmlns="http://www.ebay.com/marketplace/search/v1/services"> | ||
<productId type="ReferenceID">53039031</productId> | ||
<paginationInput> | ||
<entriesPerPage>2</entriesPerPage> | ||
</paginationInput> | ||
</findItemsByProductRequest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
var fse = require('fs-extra'); | ||
|
||
var eBay = require('../../../lib/eBay-node-client')(clientId, clientSecret); | ||
|
||
var shoppingRequest = async function () { | ||
try { | ||
var content = fse.readFileSync('./sample.xml', 'UTF-8'); | ||
// console.log('content', content); | ||
|
||
var response = await eBay.shopping.findProducts({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
shoppingRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FindProductsRequest xmlns="urn:ebay:apis:eBLBaseComponents"> | ||
<QueryKeywords>Harry Potter</QueryKeywords> | ||
<MaxEntries>2</MaxEntries> | ||
<AvailableItemsOnly>true</AvailableItemsOnly> | ||
</FindProductsRequest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
var fse = require('fs-extra'); | ||
|
||
var eBay = require('../../../lib/eBay-node-client')(clientId, clientSecret); | ||
|
||
var tradingRequest = async function () { | ||
try { | ||
var content = fse.readFileSync('./sample.xml', 'UTF-8'); | ||
// console.log('content', content); | ||
|
||
var response = await eBay.trading.addItem({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
tradingRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
var fse = require('fs-extra'); | ||
|
||
var eBay = require('../../../lib/eBay-node-client')(clientId, clientSecret); | ||
|
||
var tradingRequest = async function () { | ||
try { | ||
var content = fse.readFileSync('./sample.txt', 'UTF-8'); | ||
// console.log('content', content); | ||
var response = await eBay.trading.addItem({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
tradingRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<GetItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"> | ||
<!-- Call-specific Input Fields --> | ||
<IncludeItemCompatibilityList>true</IncludeItemCompatibilityList> | ||
<IncludeItemSpecifics>true</IncludeItemSpecifics> | ||
<IncludeTaxTable>true</IncludeTaxTable> | ||
<IncludeWatchCount>true</IncludeWatchCount> | ||
<ItemID>SKU</ItemID> | ||
<SKU>my-sku</SKU> | ||
<!-- Standard Input Fields --> | ||
<DetailLevel>DetailLevelCodeType</DetailLevel> | ||
<!-- ... more DetailLevel values allowed here ... --> | ||
<ErrorLanguage>en_US</ErrorLanguage> | ||
<WarningLevel>High</WarningLevel> | ||
</GetItemRequest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
var js2xmlparser = require('js2xmlparser'); | ||
|
||
var eBay = require('../../../lib/eBay-node-client')(clientId, clientSecret); | ||
var utils = require('../utils'); | ||
|
||
var tradingRequest = async function () { | ||
var devId = utils.DEV_ID; | ||
var ruName = utils.RU_NAME; | ||
|
||
eBay.setDevName(devId); | ||
|
||
const obj = { | ||
'@': { | ||
'xmlns': 'urn:ebay:apis:eBLBaseComponents' | ||
}, | ||
'ErrorLanguage': 'en_US', | ||
'WarningLevel': 'High', | ||
'RuName': ruName | ||
}; | ||
|
||
var content = js2xmlparser.parse('GetSessionIDRequest', obj, {declaration: {encoding: 'UTF-8'}}); | ||
|
||
try { | ||
var response = await eBay.trading.getSessionID({content: content}); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
tradingRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<AddItemRequest xmlns="urn:ebay:apis:eBLBaseComponents"> | ||
<RequesterCredentials> | ||
<!-- Enter proper authentication token for account --> | ||
<eBayAuthToken>AgAAAA**AQAAAA**aAAAAA**KklpXA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFk4ajC5iFpA2dj6x9nY+seQ**SLgEAA**AAMAAA**p0AS+8vv088NtpFvG5VTv9yCvI9cCKdQhru0LTJ0C3SWDQmEVYXiXjSMZc5r8xx1PsXHZP/SIQie4omWYQPJilhRNPbO6z0GH/kn184p8Fedx6VSgTLsJiskkOAs36f3KMuQuz2iRgTcsNLPw2hP3X70DcI2PjSdV3zsfOVjLxpQ8+Oe53ModvnCmdjOt7HUu4OUTugxhMTeDQ9TlZPUjHhyX3DSId0epD3GI5r44ygmAmPkoYQH9C+TAdj2KIg0OcwbRmcjl8wO1PyJ51oS2CicGL16c70+Cm738NU+6L3iGd7CQk2YxFIrrxPYBnrhRofm78BoSgVAhWDzpTiSnNsXrIqJgpEjmXcq5CoglYe6KHq3BXa6cT/Dl9cbLzZ4zoMbQn29L9UWvodkdUYvxE67zEpV2hPo/RWvot5TZId781ZYdO2i0fbuHljho/UGVTTOA5nSa7iWEUqVrBLePsVYmHBCK8/jnKZJAu4lmKXsM0/XtmWGYcEsuV9mdMxczZ9z5x9Rxz9vECg8myf/NAuxup3ipYEvkvKuhD6wIMXkBZNLeo1v7iPN4FAzhWCsrWIQ9Ctbvp0HFRDCeHxv/tKidPlTteJADi+hJy2oK7OUHsALr2Qp8HAk9CfQHPMgqymYqkypd4pAnrRl1NbfkeqIT0vcEQw/9rrk1vuMLG78jIzyBIKuC4rJUh8kz1d6ZS9jvWoZ7z8z979WtHnNSl9KTnhfkdN11qb+hBIirJdrGjteMHE20u/2/LYuezAg</eBayAuthToken> | ||
</RequesterCredentials> | ||
<ErrorLanguage>en_US</ErrorLanguage> | ||
<WarningLevel>High</WarningLevel> | ||
<Item> | ||
<Title>Harry Potter and the Philosopher's Stone</Title> | ||
<Description>This is the first book in the Harry Potter series. In excellent condition!</Description> | ||
<PrimaryCategory> | ||
<CategoryID>377</CategoryID> | ||
</PrimaryCategory> | ||
<StartPrice>1.0</StartPrice> | ||
<CategoryMappingAllowed>true</CategoryMappingAllowed> | ||
<Country>US</Country> | ||
<Currency>USD</Currency> | ||
<ConditionID>1000</ConditionID> | ||
<DispatchTimeMax>3</DispatchTimeMax> | ||
<ListingDuration>Days_7</ListingDuration> | ||
<ListingType>Chinese</ListingType> | ||
<PaymentMethods>PayPal</PaymentMethods> | ||
<!--Enter your Paypal email address--> | ||
<PayPalEmailAddress>XXXXX</PayPalEmailAddress> | ||
<PictureDetails> | ||
<PictureURL>https://mypicserver.com/myphoto.jpg</PictureURL> | ||
</PictureDetails> | ||
<PostalCode>95125</PostalCode> | ||
<Quantity>1</Quantity> | ||
<ReturnPolicy> | ||
<ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption> | ||
<RefundOption>MoneyBack</RefundOption> | ||
<ReturnsWithinOption>Days_30</ReturnsWithinOption> | ||
<ShippingCostPaidByOption>Buyer</ShippingCostPaidByOption> | ||
</ReturnPolicy> | ||
<ShippingDetails> | ||
<ShippingType>Flat</ShippingType> | ||
<ShippingServiceOptions> | ||
<ShippingServicePriority>1</ShippingServicePriority> | ||
<ShippingService>USPSMedia</ShippingService> | ||
<ShippingServiceCost>2.50</ShippingServiceCost> | ||
</ShippingServiceOptions> | ||
</ShippingDetails> | ||
<Site>US</Site> | ||
<!-- If the seller is subscribed to Business Policies, use the <SellerProfiles> Container | ||
instead of the <ShippingDetails>, <PaymentMethods> and <ReturnPolicy> containers. | ||
For help, see the API Reference for Business Policies: | ||
http://developer.ebay.com/Devzone/business-policies/CallRef/index.html --> | ||
<!--<SellerProfiles> | ||
<SellerShippingProfile> | ||
<ShippingProfileID>5001287000</ShippingProfileID> | ||
</SellerShippingProfile> | ||
<SellerReturnProfile> | ||
<ReturnProfileID>5001288000</ReturnProfileID> | ||
</SellerReturnProfile> | ||
<SellerPaymentProfile> | ||
<PaymentProfileID>5001286000</PaymentProfileID> | ||
</SellerPaymentProfile> | ||
</SellerProfiles> --> | ||
</Item> | ||
</AddItemRequest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
'use strict'; | ||
module.exports = { | ||
USER_TOKEN: process.env.EBAY_USER_TOKEN | ||
USER_TOKEN: process.env.EBAY_USER_TOKEN, | ||
DEV_ID: process.env.EBAY_DEV_ID, | ||
RU_NAME: process.env.EBAY_RU_NAME | ||
}; |
Oops, something went wrong.