ebay-api
Version:
eBay API for Node and Browser
131 lines (130 loc) • 4.61 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const index_js_1 = __importDefault(require("../../index.js"));
/**
* Post-Order Inquiry API
*/
class Inquiry extends index_js_1.default {
get basePath() {
return '/post-order/v2';
}
get useIaf() {
return true;
}
/**
* Check if a buyer is eligible to open an inquiry on an order.
*
* @param payload the CheckInquiryEligibilityRequest
*/
checkInquiryEligibility(payload) {
return this.post(`/inquiry/check_eligibility`, payload);
}
/**
* Close an inquiry for the buyer
*
* @param inquiryId The unique ID of the inquiry to be closed.
* @param payload the BuyerCloseInquiryRequest
*/
closeInquiry(inquiryId, payload) {
inquiryId = encodeURIComponent(inquiryId);
if (typeof payload?.closeReason === 'string') {
payload.closeReason = payload.closeReason.trim();
}
return this.post(`/inquiry/${inquiryId}/close`, payload);
}
/**
* Buyer confirms the refund from an inquiry was received
*
* @param inquiryId The unique identifier of a case.
*/
confirmInquiryRefund(inquiryId) {
inquiryId = encodeURIComponent(inquiryId);
return this.post(`/inquiry/${inquiryId}/confirm_refund`);
}
/**
* Create an inquiry for the buyer.
*
* @param payload the CreateInquiryRequest
*/
createInquiry(payload) {
if (typeof payload.desiredOutcome === 'string') {
payload.desiredOutcome = payload.desiredOutcome.trim();
}
return this.post(`/inquiry`, payload);
}
/**
* Escalate an inquiry to an INR case.
*
* @param inquiryId the unique identifier of the inquiry to be escalated.
* @param payload the EscalateInquiryRequest
*/
escalateInquiry(inquiryId, payload) {
inquiryId = encodeURIComponent(inquiryId);
payload.escalateInquiryReason = payload.escalateInquiryReason.trim();
return this.post(`/inquiry/${inquiryId}/escalate`, payload);
}
/**
* Retrieve the history and details related to a specific inquiry.
*
* @param inquiryId the unique ID of the inquiry for which details and history are to be retrieved.
*/
getInquiry(inquiryId) {
inquiryId = encodeURIComponent(inquiryId);
return this.get(`/inquiry/${inquiryId}`);
}
/**
* Issue a refund for an inquiry.
*
* @param inquiryId the unique ID of the inquiry for which a refund is to be issued.
* @param payload the InquiryVoluntaryRefundRequest
*/
issueInquiryRefund(inquiryId, payload) {
inquiryId = encodeURIComponent(inquiryId);
return this.post(`/inquiry/${inquiryId}/issue_refund`, payload);
}
/**
* Provide refund information about an inquiry to the buyer.
*
* @param inquiryId The unique ID of the inquiry for which to provide refund information.
* @param payload the InquiryVoluntaryRefundRequest
*/
provideInquiryRefundInfo(inquiryId, payload) {
inquiryId = encodeURIComponent(inquiryId);
return this.post(`/inquiry/${inquiryId}/provide_refund_info`, payload);
}
/**
* Provide shipment information for an inquiry.
*
* @param inquiryId The unique ID of the inquiry for which to provide shipment information.
* @param payload the ShipmentInfoRequest
*/
provideInquiryShipmentInfo(inquiryId, payload) {
inquiryId = encodeURIComponent(inquiryId);
return this.post(`/inquiry/${inquiryId}/provide_shipment_info`, payload);
}
/**
* This call is used to search for inquiries using multiple filter types.
*
* @param params the InquirySearchParams
*/
search(params) {
return this.get(`/inquiry/search`, {
params
});
}
/**
* Contact the buyer or seller about an inquiry.
*
* @param inquiryId The unique ID of the inquiry being discussed.
* @param payload the SendMessageRequest
*/
sendInquiryMessage(inquiryId, payload) {
inquiryId = encodeURIComponent(inquiryId);
return this.post(`/inquiry/${inquiryId}/send_message`, payload);
}
}
exports.default = Inquiry;
Inquiry.id = 'Inquiry';
;