We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
[email protected]
Add support for STAGING
Here is the diff that solved my problem:
diff --git a/node_modules/ebay-oauth-nodejs-client/demo/ebay-config-sample.json b/node_modules/ebay-oauth-nodejs-client/demo/ebay-config-sample.json index 87cb57e..8106cac 100644 --- a/node_modules/ebay-oauth-nodejs-client/demo/ebay-config-sample.json +++ b/node_modules/ebay-oauth-nodejs-client/demo/ebay-config-sample.json @@ -12,5 +12,13 @@ "devid": "-- dev id ---", "redirectUri": "-- redirect uri ---", "baseUrl": "api.ebay.com" + }, + "STAGING": { + "clientId": "---Client Id---", + "clientSecret": "--- client secret---", + "devid": "-- dev id ---", + "redirectUri": "-- redirect uri ---", + "baseUrl": "apima.qa.ebay.com" } } + diff --git a/node_modules/ebay-oauth-nodejs-client/src/constants.js b/node_modules/ebay-oauth-nodejs-client/src/constants.js index f00c96c..391f57e 100644 --- a/node_modules/ebay-oauth-nodejs-client/src/constants.js +++ b/node_modules/ebay-oauth-nodejs-client/src/constants.js @@ -18,6 +18,7 @@ module.exports.OAUTHENVIRONMENT_WEBENDPOINT_PRODUCTION = 'https://auth.ebay.com/ module.exports.OAUTHENVIRONMENT_WEBENDPOINT_SANDBOX = 'https://auth.sandbox.ebay.com/oauth2/authorize'; // API End Point +module.exports.OAUTHENVIRONMENT_APIENDPOINT_STAGING = 'https://apima.qa.ebay.com/identity/v1/oauth2/token'; module.exports.OAUTHENVIRONMENT_APIENDPOINT_SANDBOX = 'https://api.sandbox.ebay.com/identity/v1/oauth2/token'; module.exports.OAUTHENVIRONMENT_APIENDPOINT_PRODUCTION = 'https://api.ebay.com/identity/v1/oauth2/token'; @@ -25,5 +26,6 @@ module.exports.OAUTHENVIRONMENT_APIENDPOINT_PRODUCTION = 'https://api.ebay.com/i module.exports.CLIENT_CRED_SCOPE = 'https://api.ebay.com/oauth/api_scope'; // Environments +module.exports.STAGING_ENV = 'STAGING'; module.exports.PROD_ENV = 'PRODUCTION'; module.exports.SANDBOX_ENV = 'SANDBOX'; diff --git a/node_modules/ebay-oauth-nodejs-client/src/request.js b/node_modules/ebay-oauth-nodejs-client/src/request.js index f0100b6..9615cb7 100644 --- a/node_modules/ebay-oauth-nodejs-client/src/request.js +++ b/node_modules/ebay-oauth-nodejs-client/src/request.js @@ -27,6 +27,7 @@ const base64Encode = (encodeData) => { const postRequest = (data, ebayAuthToken) => { const encodedStr = base64Encode(`${ebayAuthToken.clientId}:${ebayAuthToken.clientSecret}`); const auth = `Basic ${encodedStr}`; + return new Promise((resolve, reject) => { const request = https.request({ headers: { diff --git a/node_modules/ebay-oauth-nodejs-client/src/utils.js b/node_modules/ebay-oauth-nodejs-client/src/utils.js index bd4da71..b41d41e 100644 --- a/node_modules/ebay-oauth-nodejs-client/src/utils.js +++ b/node_modules/ebay-oauth-nodejs-client/src/utils.js @@ -20,6 +20,7 @@ const fs = require('fs'); const path = require('path'); const sandboxBaseUrl = 'api.sandbox.ebay.com'; const prodBaseUrl = 'api.ebay.com'; +const stagingBaseUrl = 'apima.qa.ebay.com'; const readJSONFile = (fileName) => { try { @@ -32,7 +33,7 @@ const readJSONFile = (fileName) => { }; const validateParams = (environment, scopes, credentials) => { - if (!environment) throw new Error('Kindly provide the environment - PRODUCTION/SANDBOX'); + if (!environment) throw new Error('Kindly provide the environment - PRODUCTION/SANDBOX/STAGING'); if (!scopes) throw new Error('scopes is required'); if (!credentials) throw new Error('credentials configured incorrectly'); }; @@ -40,7 +41,17 @@ const validateParams = (environment, scopes, credentials) => { const readOptions = (options) => { const credentials = {}; if (!options.env) options.env = 'PRODUCTION'; - options.baseUrl = options.env === 'PRODUCTION' ? prodBaseUrl : sandboxBaseUrl; + switch (options.env) { + case 'SANDBOX': + options.baseUrl = sandboxBaseUrl; + break; + case 'STAGING': + options.baseUrl = stagingBaseUrl; + break; + default: + options.baseUrl = prodBaseUrl; + break; + } credentials[options.env] = { ...options }; return credentials; };
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.Add support for STAGING
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: