UNPKG

pancake-client-sdk

Version:
62 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShippingResource = void 0; const base_1 = require("./base"); class ShippingResource extends base_1.BaseResource { /** * Get list of shipping partners */ async listPartners() { return this.client.get(this.getShopPath('/shipping/partners')); } /** * Calculate shipping fee */ async calculateFee(data) { return this.client.post(this.getShopPath('/shipping/calculate'), data); } /** * Create new shipment */ async createShipment(data) { return this.client.post(this.getShopPath('/shipments'), data); } /** * Get shipment by ID */ async getShipmentById(shipmentId) { return this.client.get(this.getShopPath(`/shipments/${shipmentId}`)); } /** * List shipments */ async listShipments(params) { return this.client.get(this.getShopPath('/shipments'), params); } /** * Cancel shipment */ async cancelShipment(shipmentId, reason) { return this.client.post(this.getShopPath(`/shipments/${shipmentId}/cancel`), { reason }); } /** * Print shipping label */ async getShippingLabel(shipmentId) { return this.client.get(this.getShopPath(`/shipments/${shipmentId}/label`)); } /** * Get delivery tracking info */ async getTrackingInfo(shipmentId) { return this.client.get(this.getShopPath(`/shipments/${shipmentId}/tracking`)); } /** * Update shipment COD amount */ async updateCOD(shipmentId, codAmount) { return this.client.put(this.getShopPath(`/shipments/${shipmentId}/cod`), { cod_amount: codAmount }); } } exports.ShippingResource = ShippingResource; //# sourceMappingURL=shipping.js.map