UNPKG

ebay-api

Version:

eBay API for Node and Browser

89 lines (88 loc) 2.91 kB
import Restful from '../../index.js'; /** * Post-Order Cancellation API */ export default class Cancellation extends Restful { get basePath() { return '/post-order/v2'; } get useIaf() { return true; } /** * Seller approves a cancellation request * * @param cancelId The unique eBay-assigned identifier of the cancellation request to be approved. */ approveCancellationRequest(cancelId) { cancelId = encodeURIComponent(cancelId); return this.post(`/cancellation/${cancelId}/approve`); } /** * Check the eligibility of an order cancellation * * @param legacyOrderId The unique ID of the order being canceled or the order being considered for cancellation. */ checkCancellationEligibility(legacyOrderId) { return this.post(`/cancellation/check_eligibility`, { legacyOrderId }); } /** * Buyer confirms the refund from a cancellation was received * * @param cancelId The unique eBay-assigned identifier of the cancellation/refund being confirmed. * @param payload the ConfirmRefundReceivedPayload */ confirmRefundReceived(cancelId, payload) { cancelId = encodeURIComponent(cancelId); return this.post(`/cancellation/${cancelId}/confirm`, payload); } /** * Request or perform an order cancellation. * * @param payload the CreateCancelRequest */ createCancellation(payload) { return this.post(`/cancellation`, payload); } /** * Retrieve the details of an order cancellation. * * @param cancelId Supply in this path parameter the unique eBay-assigned ID of the cancellation request to * retrieve. * @param fieldGroups The value set in this query parameter controls the level of detail that is returned in the * response. */ getCancellation(cancelId, fieldGroups) { cancelId = encodeURIComponent(cancelId); return this.get(`/cancellation/${cancelId}`, { params: { fieldgroups: fieldGroups } }); } /** * Seller rejects a cancellation request. * * @param cancelId The unique eBay-assigned identifier of the cancellation request to be rejected. * @param payload the RejectCancelRequest */ rejectCancellationRequest(cancelId, payload) { cancelId = encodeURIComponent(cancelId); return this.post(`/cancellation/${cancelId}/reject`, payload); } /** * Search for cancellations. * * @param params the SearchParams */ search(params) { return this.get(`/cancellation/search`, { params: { params } }); } } Cancellation.id = 'Cancellation';