UNPKG

@congminh1254/shopee-sdk

Version:
231 lines (230 loc) 12 kB
import { ShopeeConfig } from "../sdk.js"; import { BaseManager } from "./base.manager.js"; import { GetReturnListParams, GetReturnListResponse, GetReturnDetailParams, GetReturnDetailResponse, ConfirmParams, ConfirmResponse, DisputeParams, DisputeResponse, OfferParams, OfferResponse, AcceptOfferParams, AcceptOfferResponse, GetAvailableSolutionsParams, GetAvailableSolutionsResponse, CancelDisputeParams, CancelDisputeResponse, GetReturnDisputeReasonParams, GetReturnDisputeReasonResponse, ConvertImageParams, ConvertImageResponse, UploadProofParams, UploadProofResponse, QueryProofParams, QueryProofResponse, GetShippingCarrierParams, GetShippingCarrierResponse, UploadShippingProofParams, UploadShippingProofResponse, GetReverseTrackingInfoParams, GetReverseTrackingInfoResponse } from "../schemas/returns.js"; export declare class ReturnsManager extends BaseManager { constructor(config: ShopeeConfig); /** * Use this API to get detail information of many returns by shop ID. * * @param params - Parameters for getting return list * @param params.page_no - Page number (required) * @param params.page_size - Page size, max 100 (required) * @param params.create_time_from - Filter by create time from (timestamp) * @param params.create_time_to - Filter by create time to (timestamp) * @param params.update_time_from - Filter by update time from (timestamp) * @param params.update_time_to - Filter by update time to (timestamp) * @param params.status - Filter by return status * @param params.negotiation_status - Filter by negotiation status * @param params.seller_proof_status - Filter by seller proof status * @param params.seller_compensation_status - Filter by seller compensation status * * @returns A promise that resolves to the return list response containing: * - more: Whether there are more pages * - return: List of return details * * @throws {Error} When the API request fails or returns an error */ getReturnList(params: GetReturnListParams): Promise<GetReturnListResponse>; /** * Use this API to get detail information of a return by return serial number. * * @param params - Parameters for getting return detail * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the return detail response containing: * - Complete return information including items, user, status, etc. * * @throws {Error} When the API request fails or returns an error */ getReturnDetail(params: GetReturnDetailParams): Promise<GetReturnDetailResponse>; /** * Confirm refund for a return request. * * @param params - Parameters for confirming return * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the confirm response containing: * - return_sn: The confirmed return serial number * * @throws {Error} When the API request fails or returns an error */ confirm(params: ConfirmParams): Promise<ConfirmResponse>; /** * Dispute a return request. Support raising dispute when return_status is REQUESTED/PROCESSING/ACCEPTED. * * @param params - Parameters for disputing return * @param params.return_sn - Return serial number (required) * @param params.email - Email for contact (required) * @param params.dispute_reason - Dispute reason ID (required) * @param params.dispute_text_reason - Text explanation for dispute * @param params.images - Image URLs for dispute evidence * * @returns A promise that resolves to the dispute response containing: * - return_sn: The disputed return serial number * * @throws {Error} When the API request fails or returns an error */ dispute(params: DisputeParams): Promise<DisputeResponse>; /** * Offer a solution to the buyer during negotiation. * * @param params - Parameters for offering solution * @param params.return_sn - Return serial number (required) * @param params.solution - Solution to offer (required) * @param params.refund_amount - Refund amount (if applicable) * * @returns A promise that resolves to the offer response containing: * - return_sn: The return serial number * * @throws {Error} When the API request fails or returns an error */ offer(params: OfferParams): Promise<OfferResponse>; /** * Accept an offer from the buyer. * * @param params - Parameters for accepting offer * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the accept offer response containing: * - return_sn: The return serial number * * @throws {Error} When the API request fails or returns an error */ acceptOffer(params: AcceptOfferParams): Promise<AcceptOfferResponse>; /** * Get the available solutions offered to buyers. * * @param params - Parameters for getting available solutions * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the available solutions response containing: * - solution: List of available solution options with max refund amounts * * @throws {Error} When the API request fails or returns an error */ getAvailableSolutions(params: GetAvailableSolutionsParams): Promise<GetAvailableSolutionsResponse>; /** * Cancel a compensation dispute. Sellers can only cancel compensation disputes, not normal disputes. * This means sellers can only cancel disputes when return_status is ACCEPTED and compensation_status is COMPENSATION_REQUESTED. * * @param params - Parameters for cancelling dispute * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the cancel dispute response containing: * - return_sn: The return serial number * * @throws {Error} When the API request fails or returns an error */ cancelDispute(params: CancelDisputeParams): Promise<CancelDisputeResponse>; /** * Get the dispute return reasons available for a return. * * @param params - Parameters for getting dispute reasons * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the dispute reason response containing: * - dispute_reason: List of available dispute reasons with IDs and text * * @throws {Error} When the API request fails or returns an error */ getReturnDisputeReason(params: GetReturnDisputeReasonParams): Promise<GetReturnDisputeReasonResponse>; /** * Convert image files to URLs. Supports specific formats and pictures within 10MB. * * @param params - Parameters for converting images * @param params.images - Array of images to convert (required) * * @returns A promise that resolves to the convert image response containing: * - images: Array of converted image URLs * * @throws {Error} When the API request fails or returns an error */ convertImage(params: ConvertImageParams): Promise<ConvertImageResponse>; /** * Upload evidence for a return, including text, pictures, and videos. * * @param params - Parameters for uploading proof * @param params.return_sn - Return serial number (required) * @param params.proof_text - Array of text evidence * @param params.proof_image - Array of image URLs as evidence * @param params.proof_video - Array of video URLs as evidence * * @returns A promise that resolves to the upload proof response containing: * - return_sn: The return serial number * * @throws {Error} When the API request fails or returns an error */ uploadProof(params: UploadProofParams): Promise<UploadProofResponse>; /** * Query the evidence uploaded through the upload evidence API. * * @param params - Parameters for querying proof * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the query proof response containing: * - proof_text: Uploaded text evidence * - proof_image: Uploaded image evidence * - proof_video: Uploaded video evidence * * @throws {Error} When the API request fails or returns an error */ queryProof(params: QueryProofParams): Promise<QueryProofResponse>; /** * Get the list of shipping carriers and required parameters for uploading shipping proof. * Only for TW and BR returns with is_seller_arrange = true. * * @param params - Parameters for getting shipping carriers * @param params.return_sn - Return serial number (required) * * @returns A promise that resolves to the shipping carrier response containing: * - carrier_list: List of available shipping carriers with required fields * * @throws {Error} When the API request fails or returns an error */ getShippingCarrier(params: GetShippingCarrierParams): Promise<GetShippingCarrierResponse>; /** * Upload shipping proof for seller-arranged returns. * Only for TW and BR returns with is_seller_arrange = true. This is not to upload evidence for disputes. * * @param params - Parameters for uploading shipping proof * @param params.return_sn - Return serial number (required) * @param params.carrier_id - Carrier ID (required) * @param params.tracking_number - Tracking number (required) * * @returns A promise that resolves to the upload shipping proof response containing: * - return_sn: The return serial number * * @throws {Error} When the API request fails or returns an error */ uploadShippingProof(params: UploadShippingProofParams): Promise<UploadShippingProofResponse>; /** * Get reverse and post-return logistics information of return request. * * For Normal RR, returns complete reverse logistics information. For In-transit RR and Return-on-the-Spot, * only returns latest reverse logistics status without providing complete reverse logistics information. * * For seller_validation, only one segment of reverse (buyer to seller), use tracking_info. * For warehouse_validation, two segments of reverse (buyer to warehouse and warehouse to seller), * use post_return_logistics_tracking_info for the second segment. * * @param params - Parameters for getting reverse tracking info * @param params.return_sn - Shopee's unique identifier for a return/refund request (required) * * @returns A promise that resolves to the reverse tracking info response containing: * - return_sn: Return serial number * - return_refund_request_type: Type of return refund request (0=Normal RR, 1=In-transit RR, 2=Return-on-the-Spot) * - validation_type: Whether seller or warehouse validates (seller_validation/warehouse_validation) * - reverse_logistics_status: Latest reverse logistic status * - reverse_logistics_update_time: Last update time of reverse logistics status * - estimated_delivery_date_max/min: Estimated delivery dates (for Normal RR with integrated reverse logistics) * - tracking_number: Tracking number for reverse logistics * - tracking_info: Detailed tracking information list * - post_return_logistics_status: Status for warehouse to seller logistics (warehouse_validation only) * - post_return_logistics_update_time: Update time for post-return logistics * - rts_tracking_number: Return to Seller tracking number * - post_return_logistics_tracking_info: Tracking info for warehouse to seller logistics * * @throws {Error} When the API request fails or returns an error */ getReverseTrackingInfo(params: GetReverseTrackingInfoParams): Promise<GetReverseTrackingInfoResponse>; }