-
-
Notifications
You must be signed in to change notification settings - Fork 66
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 #31 from bhushankumarl/development
Development
- Loading branch information
Showing
21 changed files
with
503 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,4 +64,5 @@ typings/ | |
.idea | ||
|
||
#Temp Directory | ||
temp/* | ||
temp/* | ||
.DS_Store |
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,5 +1,5 @@ | ||
node_modules | ||
node_modules/* | ||
.npm-debug.log | ||
tags | ||
package-lock.json | ||
.idea |
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 |
---|---|---|
|
@@ -6,4 +6,7 @@ node_js: | |
- "7" | ||
- "8" | ||
- "9" | ||
- "10" | ||
- "11" | ||
- "12" | ||
sudo: false |
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 |
---|---|---|
|
@@ -59,6 +59,26 @@ const eBay = new eBay(); | |
eBay.setApiKey('YOUR_KEY', 'YOUR_SECRET'); | ||
``` | ||
|
||
## Set Application Access Token | ||
```js | ||
eBay.setToken(token.access_token); | ||
``` | ||
|
||
## Set User Token | ||
```js | ||
eBay.setUserToken(userToken); | ||
``` | ||
|
||
## Set Content Language (Default is en-US) | ||
```js | ||
eBay.setContentLanguage('en-GB'); | ||
``` | ||
|
||
## Set MarketplaceId | ||
```js | ||
eBay.setMarketplaceId('EBAY_US'); | ||
``` | ||
|
||
## Pull Request | ||
- Contributors can send their Pull Request to `development` branch. | ||
- Kindly validate test cases & linting before opening new PR. | ||
|
@@ -134,6 +154,24 @@ Originally by [Bhushankumar L](mailto:[email protected]). | |
} | ||
``` | ||
|
||
#### Search By Image | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var base64Content = base64_encode('sample-image.jpg'); | ||
// console.log('base64Content ', base64Content); | ||
var data = { | ||
image: base64Content | ||
}; | ||
try { | ||
var response = await eBay.browse.searchByImage(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
### Commerce | ||
### Catalog | ||
#### Create Change Request | ||
|
@@ -480,6 +518,23 @@ Originally by [Bhushankumar L](mailto:[email protected]). | |
} | ||
``` | ||
|
||
### Fulfillment Policy | ||
#### Get Fulfillment Policies | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
marketplace_id: 'EBAY_US' | ||
}; | ||
try { | ||
var response = await eBay.fulfillmentPolicy.getFulfillmentPolicies(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
#### Get Sales Tax | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
|
@@ -511,7 +566,98 @@ Originally by [Bhushankumar L](mailto:[email protected]). | |
} | ||
``` | ||
|
||
### Payment Policy | ||
#### Get Payment Policies | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
marketplace_id: 'EBAY_US' | ||
}; | ||
try { | ||
var response = await eBay.paymentPolicy.getPaymentPolicies(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
### Return Policy | ||
#### Get Return Policies | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
marketplace_id: 'EBAY_US' | ||
}; | ||
try { | ||
var response = await eBay.returnPolicy.getReturnPolicies(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
### Inventory | ||
#### Bulk Create Or Replace Inventory Item | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
'requests': [ | ||
{ | ||
'sku': '13465446' | ||
}, | ||
{ | ||
'sku': '132165496' | ||
} | ||
] | ||
}; | ||
try { | ||
var response = await eBay.inventory.bulkCreateOrReplaceInventoryItem(data); | ||
console.log('response ', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
#### Bulk Update Price Quantity | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { /* BulkPriceQuantity */ | ||
'requests': [ | ||
{ /* PriceQuantity */ | ||
'offers': [ | ||
{ /* OfferPriceQuantity */ | ||
'availableQuantity': 'integer', | ||
'offerId': 'string', | ||
'price': { /* Amount */ | ||
'currency': 'string', | ||
'value': 'string' | ||
} | ||
} | ||
], | ||
'shipToLocationAvailability': { | ||
/* ShipToLocationAvailability */ | ||
'quantity': 'integer' | ||
}, | ||
'sku': 'string' | ||
} | ||
] | ||
} | ||
try { | ||
var response = await eBay.inventory.bulkUpdatePriceQuantity(sku, data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
``` | ||
|
||
#### Create Or Replace Inventory Item | ||
``` | ||
var userToken = utils.USER_TOKEN; | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 eBay = require('../../../../lib/eBay-node-client')(clientId, clientSecret); | ||
var utils = require('../../../javaScript/utils'); | ||
|
||
var fs = require('fs'); | ||
|
||
// function to encode file data to base64 encoded string | ||
function base64_encode (file) { | ||
// read binary data | ||
var bitmap = fs.readFileSync(file); | ||
// convert binary data to base64 encoded string | ||
return new Buffer(bitmap).toString('base64'); | ||
} | ||
|
||
var browseRequest = async function () { | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var base64Content = base64_encode('sample-image.jpg'); | ||
// console.log('base64Content ', base64Content); | ||
var data = { | ||
image: base64Content | ||
}; | ||
try { | ||
var response = await eBay.browse.searchByImage(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
browseRequest(); |
24 changes: 24 additions & 0 deletions
24
examples/javaScript/sell/account/fulfillmentPolicy/getFulfillmentPolicies.js
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,24 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
|
||
var eBay = require('../../../../../lib/eBay-node-client')(clientId, clientSecret); | ||
var utils = require('../../../../javaScript/utils'); | ||
|
||
var accountRequest = async function () { | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
marketplace_id: 'EBAY_US' | ||
}; | ||
try { | ||
var response = await eBay.fulfillmentPolicy.getFulfillmentPolicies(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
accountRequest(); |
24 changes: 24 additions & 0 deletions
24
examples/javaScript/sell/account/paymentPolicy/getPaymentPolicies.js
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,24 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
|
||
var eBay = require('../../../../../lib/eBay-node-client')(clientId, clientSecret); | ||
var utils = require('../../../utils'); | ||
|
||
var accountRequest = async function () { | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
marketplace_id: 'EBAY_US' | ||
}; | ||
try { | ||
var response = await eBay.paymentPolicy.getPaymentPolicies(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
accountRequest(); |
24 changes: 24 additions & 0 deletions
24
examples/javaScript/sell/account/returnPolicy/getReturnPolicies.js
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,24 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
|
||
var eBay = require('../../../../../lib/eBay-node-client')(clientId, clientSecret); | ||
var utils = require('../../../utils'); | ||
|
||
var accountRequest = async function () { | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
marketplace_id: 'EBAY_US' | ||
}; | ||
try { | ||
var response = await eBay.returnPolicy.getReturnPolicies(data); | ||
console.log('response', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
accountRequest(); |
31 changes: 31 additions & 0 deletions
31
examples/javaScript/sell/inventory/bulkCreateOrReplaceInventoryItem.js
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,31 @@ | ||
'use strict'; | ||
|
||
var clientId = process.env.EBAY_CLIENT_ID || 'YOUR_KEY'; | ||
var clientSecret = process.env.EBAY_CLIENT_SECRET || 'YOUR_SECRET'; | ||
|
||
var eBay = require('../../../../lib/eBay-node-client')(clientId, clientSecret); | ||
var utils = require('../../utils'); | ||
|
||
var inventoryRequest = async function () { | ||
var userToken = utils.USER_TOKEN; | ||
eBay.setUserToken(userToken); | ||
var data = { | ||
'requests': [ | ||
{ | ||
'sku': '13465446' | ||
}, | ||
{ | ||
'sku': '132165496' | ||
} | ||
] | ||
}; | ||
try { | ||
var response = await eBay.inventory.bulkCreateOrReplaceInventoryItem(data); | ||
console.log('response ', response); | ||
} catch (error) { | ||
console.log('error ', error); | ||
return; | ||
} | ||
}; | ||
|
||
inventoryRequest(); |
Oops, something went wrong.