import { LineItem, DiscountCampaign, CancelOrder, MemberDiscount, CampaignPromotion, OrderQuery, ShippingAddress, CustomerInfo } from "../../types/order"; import { Service } from "../serviceSDK"; /** * Represents a service for managing orders. */ export declare class OrderService extends Service { /** * Constructs a new OrderService instance. * @param endpoint - The endpoint URL for the service. * @param orgId - The organization ID. * @param storeId - The store ID. */ constructor(endpoint: string, orgId: string, storeId: string, environment?: "dev" | "live"); setToken(token: string): void; /** * Override restApiCallWithToken to use default token if no token is set */ protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise; /** * Creates a new order. * @param orderData - The data for the order. * @param platform - The platform for the order. * @param createDraft - Indicates whether to create a draft order. * @returns A promise that resolves with the created order. * @throws If an error occurs while creating the order. */ createOrder(orderData: any, platform: string, createDraft: boolean, created_by: string): Promise; /** * Creates a temporary order. * * @param orderData - The data for the order. * @param platform - The platform for the order. * @returns A promise that resolves to the response from the server. * @throws If an error occurs during the API call. */ createOrderTemp(orderData: any, platform: string): Promise; /** * Completes multiple orders. * @param orderIds - The IDs of the orders to complete. * @returns A promise that resolves when the orders are completed. * @throws If an error occurs while completing the orders. */ completeOrder(orderIds: string[]): Promise; /** * Adds a voucher to an order. * @param orderId - The ID of the order. * @param voucherCode - The voucher code. * @returns A promise that resolves when the voucher is added. * @throws If an error occurs while adding the voucher. */ addVoucher(orderId: string, voucherCode: string): Promise; /** * Removes a voucher from an order. * @param orderId - The ID of the order. * @param voucherCode - The voucher code. * @returns A promise that resolves when the voucher is removed. * @throws If an error occurs while removing the voucher. */ removeVoucher(orderId: string, voucherCode: string): Promise; /** * Updates the VAT (Value Added Tax) for an order. * @param orderId - The ID of the order. * @param vatFee - The VAT fee. * @param vatType - The VAT type. (e.g., VALUE_GOODS, PRODUCT, etc. ) * @returns A promise that resolves when the VAT is updated. * @throws If an error occurs while updating the VAT. */ updateVAT(orderId: string, vatFee: number, vatType: string): Promise; /** * Updates the customer and shipping address for an order. * @param orderId - The ID of the order. * @param customerId - The data for the customer. * @param shippingAddress - The shipping address. * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateCustomerAndShippingAddress(orderId: string, customerId: string, shippingAddress: string): Promise; /** * Retrieves the order line items for a specific order. * @param partnerId - The partner ID. * @returns A promise that resolves with the order line items. * @throws If an error occurs while retrieving the order line items. */ /** * Adds order line items to an order. * @param orderId - The ID of the order. * @param lineItems - The line items to add. * @returns A promise that resolves when the line items are added. * @throws If an error occurs while adding the line items. */ addOrderLineItems(orderId: string, lineItems: LineItem[]): Promise; /** * Update Quantity in an order * @param orderId - The id of the order . * @param orderItemId - The id of order item. * @param quantity - Quantity of profuct in order. * @returns A promise that resolves with the created order. * @throws If an error occurs while creating the order. */ updateQuantityProductInOrder(orderId: string, orderItemId: string, quantity: number): Promise; /** *Updates sale Employee * @param orderId - The ID of the order. * @param saleId - The Id of saler. * @param updatedBy - Who update. * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateSaleEmployee(orderId: string, saleId: string, updatedBy: string): Promise; /** *Update type of order * @param orderId - The ID of the order. * @param orderType - The type of order. * @param updatedBy - Id of person update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateOrderType(orderId: string, orderType: string, updatedBy: string): Promise; /** * Update new price in order * @param orderId - The ID of the order. * @param orderItemId - The id of order. * @param priceNew - the new price after update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updatePriceInOrder(orderId: string, orderItemId: string, priceNew: number, reason: string): Promise; /** * Update discount price in order * @param orderId - The ID of the order. * @param orderItemId - The id of order. * @param requestData - The request data * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateDiscountPriceInOrder(orderId: string, orderItemId: string, requestData: DiscountCampaign): Promise; /** * Update cancel order * @param orderId - The ID of the order. * @param requestData * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateCancelOrder(orderId: string, requestData: CancelOrder): Promise; /** * Update status of return order * @param orderId - The ID of the order. * @param statusNew - the new status of order * @param updatedBy - Id of person update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateStatusReturnOrder(orderId: string, statusNew: string, updatedBy: string): Promise; /** * Update Shipping service * @param orderId - The ID of the order. * @param shippingServiceId - the id of shipping service * @param updatedBy - Id of person update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateShippingService(orderId: string, shippingServiceId: string, updatedBy: string): Promise; /** * Update shipping order * @param orderId - The ID of the order. * @param shippingId - the id of shipping * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateShippingOrder(orderId: string, shippingId: string): Promise; /** * Update shipping fee * @param orderId - The ID of the order. * @param shippingFee - the fee of shipping * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateShippingFee(orderId: string, shipingFee: Number): Promise; /** * Update Financial Status after payment success * @param orderId - The ID of the order. * @param financialStatus - the status of financial * @param updatedBy - Id of person update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateFinancialStatus(orderId: string, financialStatus: string, updatedBy: string): Promise; /** * Update warehouse of order * @param orderId - The ID of the order. * @param warehouseId - the status of warehouse * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateWareHouseOrder(orderId: String, warehouseId: string): Promise; /** * Update voucher * @param orderId - The ID of the order. * @param voucherCode - the code of voucher * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateVoucher(orderId: string, voucherCode: string): Promise; /** * Update Vat * @param orderId - The ID of the order. * @param vatFee - The fee of VAT * @param vatType - The type of vat * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateVat(orderId: string, vatFee: number, vatType: string): Promise; /** * Update Status of l order * @param orderId - The ID of the order. * @param status - The status of sell order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateStatusSellOrder(orderId: string, status: string): Promise; /** * Update date remain in total price * @param orderId - The ID of the order. * @param updatedBy - Id of person update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateRemainToTalPrice(orderId: string, updatedBy: string): Promise; /** * Update date create order * @param orderId - The ID of the order. * @param orderDate - The date of order * @param updatedBy - Id of person update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateDateCreateOrder(orderId: string, orderDate: number, updatedBy: string): Promise; /** * Update membership discount * @param orderId - The ID of the order. * @param requestData * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateMemberDiscount(orderId: string, requestData: MemberDiscount): Promise; /** * Update status editable order * @param orderId - The ID of the order. * @param editable - The editable of * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateEditableOrder(orderId: string, editable: boolean): Promise; /** * Update discount * @param orderId - The ID of the order. * @param requestData * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateDiscount(orderId: string, updated_by: string, requestData: any): Promise; /** * Update info campaign promotion * @param orderId - The ID of the order. * @param requestData * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateInfoCampaignPromotion(orderId: string, requestData: CampaignPromotion): Promise; /** * Get list shipping service * @param shippingCarrierId - The ID of the campaign * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getShippingService(shippingCarrierId: string): Promise; /** * Get info sell order * @param orderId - The ID of the order. * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getInfoSellOrder(orderId: string): Promise; /** * Get info return order * @param orderId - The ID of the order. * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getInfoReturnOrder(orderId: string): Promise; /** * Get list type order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListTypeOrder(): Promise; /** * GEt list shipping carrier * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListShippingCarrier(): Promise; /** * Get list sell order * @param orderId * @param requestData * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListSellOrder(requestData: OrderQuery): Promise; getListSellOrderV2(requestData: OrderQuery, storeId: string): Promise; getListSellOrderAll(requestData: OrderQuery): Promise; getDiaries(requestData: OrderQuery): Promise; /** * Get list sale order status * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListSaleOrderStatus(): Promise; /** * Get list return order * @param orderId - The id of the order * @param requestData * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListReturnOrder(requestData: OrderQuery): Promise; getListReturnOrderV2(requestData: OrderQuery, storeId: string): Promise; /** * Get list return order status * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListReturnOrderStatus(): Promise; /** * remove draft order * @param orderId - The id of order * @param updatedBy - Thi id of person update * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ removeDraftOrder(orderId: string, updatedBy: string): Promise; /** * Cancel product in order * @param orderId - The id of order * @param orderItemId - Thi id of item order * @param reason - The reason of cancel product in order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ cancelProductInOrder(orderId: string, orderItemId: string, reason: string): Promise; /** * Remove Product in order * @param orderId - The id of order * @param orderItemId - Thi id of item order * @param reason - The reason of cancel product in order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ removeProductInOrder(orderId: string, orderItemId: string, reason: string): Promise; /** * Print order pdf * @param orderId - The id of order * @param paymentMethod - Thi id of item order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ printOrderPdf(orderId: string, paymentMethod: string): Promise; /** * Print order HTML * @param orderId - The id of order * @param paymentMethod - Thi id of item order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ printOrderHtml(orderId: string, paymentMethod?: string, paymentUrl?: string): Promise; /** * Create an orderReturn * @param orderData - The id of order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ createOrderReturn(orderData: any, created_by: any): Promise; /** * Caculate the order * @param orderData - The data from the order * @returns A promise that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ calculateOrder(orderData: any): Promise; /** * get amount product able order * @param productIds - The id of product * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getQuantityAbleOrder(productIds: string[]): Promise; /** * updatee note without login * @param orderId - The id of the order * @param noteId - The id of the note * @param note - The content of the note * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ updateNoteWithoutLogin(orderId: string, noteId: string, note: string): Promise; /** * add voucher without login * @param orderId - The id of the order * @param voucherCode - The code of voucher * @param updatedBy * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ addVoucherWithoutLogin(orderId: string, voucherCode: string, updatedBy: "SYSTEM"): Promise; /** * delete voucher without login * @param orderId - The id of the order * @param voucherCode - The code of voucher * @param updatedBy * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ deleteVoucherLogin(orderId: string, voucherCode: string, updatedBy: "SYSTEM"): Promise; /** * get list note without login * @param orderId - The id of the order * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListNoteWithoutLogin(orderId: string): Promise; /** * create note without login * @param orderId - The id of the order * @param createdBy * @param note * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ createNoteWithoutLogin(orderId: string, createdBy: string, note: string): Promise; /** * get list order realation * @param orderIds * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ getListOrderRelationsWithoutLogin(orderIds: string[]): Promise; getOrderPromotion(level: string): Promise; /** * get list order realation * @param orderId - The id of order * @param noteId - The id of note * @param deletedBy - The id of person delete * @returns A prom that resolves when the customer and shipping address are updated. * @throws If an error occurs while updating the customer and shipping address. */ deleteNoteWithoutLogin(orderId: string, noteId: string, deletedBy: string): Promise; getOrderByIdNoLogin(partnerId: string, storeId: string, orderId: string): Promise; updateOrderDescription(orderId: string, description: string): Promise; getOrderDetail(orderId: string): Promise; createInfoReceiver(ownerId: string, dataRequest: ShippingAddress): Promise; getInfoReceiver(ownerId: string): Promise; updateInfoReceiver(ownerId: string, receiverId: string, updatedBy: string, dataRequest: ShippingAddress): Promise; deleteInfoReceiver(ownerId: string, receiverId: string, deletedBy: string): Promise; enableProductDiary(orderId: string, orderItemId: string): Promise; removeMemberDiscount(orderId: string): Promise; getInfoChatApp(attributesName: string): Promise; validatePhoneNumber(phoneNumer: string): boolean; /** *report by date month year * @param employee_assign * @param type_view * @param date_from * @param date_to * @returns A promise that resolves with the created order. * @throws If an error occurs while creating the order. */ reportDateMonthYear(employee_assign: string, type_view: string, date_from: number, date_to: number): Promise; /** * report by sale employee * @param employee_assign * @param date_from * @param date_to * @returns A promise that resolves with the created order. * @throws If an error occurs while creating the order. */ reportBySaleEmployee(employee_assign: string, date_from: number, date_to: number): Promise; /** * report by sale employee * @param employee_assign * @param date_from * @param date_to * @returns A promise that resolves with the created order. * @throws If an error occurs while creating the order. */ reportByPaymentMethod(employee_assign: string, date_from: number, date_to: number): Promise; /** * report by detail * @param employee_assign * @param type_view * @param date_from * @param date_to * @returns A promise that resolves with the created order. * @throws If an error occurs while creating the order. */ reportByDetail(employee_assign: string, type_view: string, date_from: number, date_to: number): Promise; reportByDetailV2(employee_assign: string, type_view: string, date_from: number, date_to: number, storeId: string): Promise; /** * report by store * @param date_from * @param date_to * @returns A promise that resolves with the created order. * @throws If an error occurs while creating the order. */ reporByStores(date_from: number, date_to: number): Promise; reporByStoresV2(date_from: number, date_to: number, storeId: string): Promise; updateExchangeOrder(exchangeOrder: string, returnOrder: string, sellOrder: string): Promise; removeShippingAddress(orderId: string, updateBy: string): Promise; removeShippingInfo(orderId: string, updateBy: string): Promise; updateVatInorder(orderId: string, orderItemId: string, vatRate: string): Promise; /** * Updates VAT for an order item by VAT rate name * @param orderId - The ID of the order * @param orderItemId - The ID of the order item * @param vatRateName - The VAT rate name to update * @returns A promise that resolves when the VAT is updated * @throws If an error occurs while updating the VAT */ updateVatByRateName(orderId: string, orderItemId: string, vatRateName: string): Promise; /** * Updates the referral code for an order * @param orderId - The ID of the order * @param referralCode - The referral code to update * @returns A promise that resolves when the referral code is updated * @throws If an error occurs while updating the referral code */ updateReferralCode(orderId: string, referralCode: string): Promise; /** * Updates customer information for an order in front-end context * @param orderId - The ID of the order * @param customerInfo - The customer information to update * @returns A promise that resolves when the customer information is updated * @throws If an error occurs while updating the customer information */ updateCustomerInfoFront(orderId: string, customerInfo: CustomerInfo): Promise; removeGiftQuantity(orderId: string, orderItemId: string): Promise; removeGiftInOrder(orderId: string, orderItemId: string): Promise; tooglePaymentMethod(methodCode: string, status: boolean): Promise; choosePaymentGatewayForPaymentMethod(methodCode: string, gatewayId: string): Promise; addCustomerToOder(orderId: string, customerData: any): Promise; updateShippingAddressWithoutLogin(orderId: string, shippingData: { name: string; phone: string; address: string; province: string; district: string; ward: string; province_code: string; district_code: string; ward_code: string; }): Promise; addEmployeeToStore(employeeId: string): Promise; deleteEmployeeToStore(employeeId: string): Promise; checkNewCustomer(customerId: string, orderId: string): Promise; }