UNPKG

pancake-client-sdk

Version:
92 lines 2.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReturnResource = void 0; const base_1 = require("./base"); class ReturnResource extends base_1.BaseResource { /** * Get list of order returns */ async list(params) { return this.client.get(this.getShopPath('/orders-returned'), params); } /** * Get return by ID */ async getById(returnId) { return this.client.get(this.getShopPath(`/orders-returned/${returnId}`)); } /** * Create new return */ async create(data) { return this.client.post(this.getShopPath('/orders-returned'), data); } /** * Update return */ async update(returnId, data) { return this.client.put(this.getShopPath(`/orders-returned/${returnId}`), data); } /** * Cancel return */ async cancel(returnId, reason) { return this.client.post(this.getShopPath(`/orders-returned/${returnId}/cancel`), { reason }); } /** * Approve return */ async approve(returnId, data) { return this.client.post(this.getShopPath(`/orders-returned/${returnId}/approve`), data || {}); } /** * Reject return */ async reject(returnId, reason) { return this.client.post(this.getShopPath(`/orders-returned/${returnId}/reject`), { reason }); } /** * Complete return */ async complete(returnId, data) { return this.client.post(this.getShopPath(`/orders-returned/${returnId}/complete`), data || {}); } /** * Get return statistics */ async getStats(params) { return this.client.get(this.getShopPath('/orders-returned/stats'), params); } /** * Get returns by order */ async getByOrder(orderId) { return this.client.get(this.getShopPath(`/orders/${orderId}/returns`)); } /** * Generate return label */ async generateLabel(returnId, data) { return this.client.post(this.getShopPath(`/orders-returned/${returnId}/label`), data); } /** * Get return shipping rates */ async getShippingRates(returnId) { return this.client.get(this.getShopPath(`/orders-returned/${returnId}/shipping-rates`)); } /** * Add note to return */ async addNote(returnId, note) { return this.client.post(this.getShopPath(`/orders-returned/${returnId}/notes`), { note }); } /** * Get return notes */ async getNotes(returnId) { return this.client.get(this.getShopPath(`/orders-returned/${returnId}/notes`)); } } exports.ReturnResource = ReturnResource; //# sourceMappingURL=return.js.map