ebay-api-simple
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -60,5 +60,5 @@ "use strict"; | ||
this.scope = scope; | ||
console.log('clientID ', this.clientID); | ||
console.log('clientSecret ', this.clientSecret); | ||
console.log('base64 encoded auth ' + base64.encode(this.clientID + ':' + this.clientSecret)); | ||
// console.log('clientID ', this.clientID); | ||
// console.log('clientSecret ', this.clientSecret); | ||
// console.log('base64 encoded auth ' + base64.encode(this.clientID + ':' + this.clientSecret)); | ||
axios_1.default | ||
@@ -78,8 +78,8 @@ .post('https://api.ebay.com/identity/v1/oauth2/token', {}, { | ||
.then(function (response) { | ||
console.log('response ', response); | ||
// console.log('response ', response); | ||
//Save values | ||
_this.accessToken = response.accessToken; | ||
console.log('TCL: EbayAPI -> generateAccessToken -> this.accessToken', _this.accessToken); | ||
// console.log('TCL: EbayAPI -> generateAccessToken -> this.accessToken', this.accessToken); | ||
_this.refreshToken = response.refresh_token; | ||
console.log('TCL: EbayAPI -> generateAccessToken -> this.refreshToken', _this.refreshToken); | ||
// console.log('TCL: EbayAPI -> generateAccessToken -> this.refreshToken', this.refreshToken); | ||
}) | ||
@@ -105,6 +105,6 @@ .catch(function (error) { | ||
.then(function (response) { | ||
console.log('response ', response); | ||
// console.log('response ', response); | ||
//Save values | ||
_this.accessToken = response.data.access_token; | ||
console.log('TCL: EbayAPI -> renewAccessToken -> this.accessToken', _this.accessToken); | ||
// console.log('TCL: EbayAPI -> renewAccessToken -> this.accessToken', this.accessToken); | ||
return _this.accessToken; | ||
@@ -111,0 +111,0 @@ }) |
@@ -9,2 +9,4 @@ export declare class Fulfillment { | ||
getOrders(accessToken: string, createdAfter?: string, limit?: string, offset?: string): any; | ||
getOrdersByStatus(accessToken: string, orderfulfillmentstatus?: string, orderPaymentStatus?: string, limit?: string, offset?: string): any; | ||
fulfillOrder(accessToken: string, orderId: string, lineItems: object[], trackingNumber: string, shippingCarrier: string, date: Date): any; | ||
} |
@@ -59,2 +59,48 @@ "use strict"; | ||
}; | ||
Fulfillment.prototype.getOrdersByStatus = function (accessToken, orderfulfillmentstatus, orderPaymentStatus, limit, offset) { | ||
if (orderfulfillmentstatus === void 0) { orderfulfillmentstatus = 'NOT_STARTED'; } | ||
if (orderPaymentStatus === void 0) { orderPaymentStatus = 'PAID'; } | ||
if (limit === void 0) { limit = '200'; } | ||
if (offset === void 0) { offset = '0'; } | ||
this.accessToken = accessToken; | ||
var url = "https://api.ebay.com/sell/fulfillment/v1/order?filter=orderfulfillmentstatus:%7B" + orderfulfillmentstatus + "%7C&limit=" + limit + "&offset=" + offset; | ||
return axios_1.default | ||
.get(url, { | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
Authorization: 'Bearer ' + this.accessToken, | ||
}, | ||
}) | ||
.then(function (response) { | ||
return response.data; | ||
}) | ||
.catch(function (error) { | ||
console.log('TCL: Fulfillment -> error', error); | ||
return error; | ||
}); | ||
}; | ||
Fulfillment.prototype.fulfillOrder = function (accessToken, orderId, lineItems, trackingNumber, shippingCarrier, date) { | ||
this.accessToken = accessToken; | ||
var url = "https://api.ebay.com/sell/fulfillment/v1/order/" + orderId + "/shipping_fulfillment"; | ||
var body = { | ||
lineItems: lineItems, | ||
shippedDate: date, | ||
shippingCarrierCode: shippingCarrier, | ||
trackingNumber: trackingNumber, | ||
}; | ||
return axios_1.default | ||
.post(url, body, { | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
Authorization: 'Bearer ' + this.accessToken, | ||
}, | ||
}) | ||
.then(function (response) { | ||
return response.data; | ||
}) | ||
.catch(function (error) { | ||
console.log('TCL: Fulfillment -> error', error); | ||
return error; | ||
}); | ||
}; | ||
return Fulfillment; | ||
@@ -61,0 +107,0 @@ }()); |
{ | ||
"name": "ebay-api-simple", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Interface with the eBay API", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13981
278