import IDiscountRule, { ResultActionEnum } from '../Rules/IDiscountRule'; import ITax from '../Tax'; import { IFilledDimensionUnits, IPriceListOption, IShippingInfo } from '../Declination'; import { IExpeditionInfo } from '../Customer'; import { IPredefinedBox } from '../Space'; import { IWarehouseAvailability } from '../Inventory'; import IPaypalPayload from './IPaypalPayload'; import IStripePayload from './IStripePayload'; import IPandaPayload from './IPandaPayload'; import ITranslation from '../Translation'; import { IProductEquivalent, IProductRecommendation } from '../Product'; import { IPaysafePayload } from './IPaysafePayload'; import { IImageInfo } from '../../utils/file'; import { MarketplaceTypeEnum } from '../MarketplacePublication'; import IMarketplaceOrderData from '../MarketplacePublication/MarketplaceOrderData'; import IPayment from '../Payment'; import IBaseClass from '../BaseClass'; import { IBank } from '../PromiseToPurchase'; import { IG2OrderExternalValues, IG2ProductExternalValues } from '../G2'; import { ExternalServiceSlugEnum } from '../Space/IExternalService'; import { IElavonPayload } from './IElavonPayload'; import { IMarketPayload } from './IMarketPayload'; export declare enum PaymentTypeEnum { CREDIT = "credit", DEBIT = "debit", CASH = "cash", CHECK = "check", TOBERECEIVED = "to_be_received", PAYPAL = "paypal", PA = "promise_to_purchase", MULTIPLE = "multiple", CREDITED = "credited_to_account", REMAININGCREDIT = "remaining_credit", DEPOT = "depot", ONEXPEDITION = "on_expedition", INTERACTRANSFER = "interac_transfer", STORE_CREDITS = "store_credits", EXTERNAL_MARKET = "external_market" } export declare enum CustomPaymentTypeEnum { DEPOT = "depot", INCENTIVE = "payment_incentive" } export interface IPaymentServicePayload { type?: ExternalServiceSlugEnum; payload?: IStripePayload | IElavonPayload | IPandaPayload | IPaysafePayload | IMarketPayload; error?: CartErrorEnum | string; } export declare enum CartPromoAppliesToEnum { ITEMS = "items", SHIPPING = "shipping", PRODUCT = "product", TOTAL_AFTER_TAXES = "total_after_taxes", SUBTOTAL = "subtotal" } export interface ICartPromoApplied { readonly promo_name: string; readonly applies_to: CartPromoAppliesToEnum; readonly amount_removed?: number; readonly amount_unit?: ResultActionEnum; readonly item_given?: string | string[]; readonly item_given_amount?: number; readonly free_shipping: boolean; readonly flatrate_shipping?: number; readonly promo_code?: string; readonly stackable?: boolean; readonly discount_id?: string; readonly applied_product_map?: { readonly before: number; readonly after: number; }; readonly exclude_services_and_fees?: boolean; readonly exclude_discounted_products?: boolean; readonly refunded?: boolean; } export default interface ICart extends IBaseClass { readonly id?: string; readonly cart_type: CartTypeEnum; readonly current_store_id?: string | null; readonly customer_id?: string; readonly user_email?: string; readonly customer_info?: ICartCustomerData; readonly discount_rules: IDiscountRule[]; readonly error?: string; readonly errors?: CartErrorEnum[]; readonly message?: string; readonly items: ICartItem[]; readonly subtotalWithoutPromotions?: number | null; readonly subtotal: number; readonly shipping: number; readonly shipping_selected?: IShippingQuote; readonly shipping_message: string; readonly free_shipping?: boolean; readonly taxes: ITax[]; readonly promo_after_taxes_amount?: number | null; readonly total: number; readonly clerk_id?: string; readonly total_taxes?: number; readonly cart_promo_applied?: ICartPromoApplied | null; readonly cart_promos_applied?: ICartPromoApplied[] | null; readonly billing_address?: IExpeditionInfo; readonly shipping_address?: IExpeditionInfo; readonly is_pickup?: boolean; readonly is_booking?: false | string; readonly is_booking_beton?: boolean; readonly status: CartStatusEnum; readonly paid_by?: PaymentTypeEnum | null; readonly custom_payment_type?: { method: CustomPaymentTypeEnum; amount?: number; } | null; readonly payment_details?: IPayment[]; readonly paid_at?: Date; readonly payment_reference?: string; readonly invoice_access_token?: string; readonly paypal_secure_token?: string; readonly boxes: IBoxItem[]; readonly shipping_payload?: any; readonly stripe_payload?: IStripePayload; readonly pandapay_payload?: IPandaPayload; readonly paysafe_payload?: IPaysafePayload; readonly paypal_payload?: IPaypalPayload; readonly elavon_payload?: IElavonPayload; readonly market_payload?: IMarketPayload; readonly refund_payload?: any; readonly ref?: string; readonly invoice_ref?: string; readonly currency?: string; readonly locale: string; readonly comfirmation_email_sent?: Date; readonly receip_sent?: Date; readonly shipping_comfirmation_sent?: Date; readonly pickup_ready_sent?: Date; readonly is_test?: boolean; readonly no_email_receipt?: boolean; readonly check_marketing_emails?: boolean; readonly check_sms_to_send?: boolean; readonly check_retarget_marketing_emails?: boolean; readonly other_emails_sent?: { readonly photo_shoot_admin_email?: Date; readonly photo_shoot_client_email?: Date; readonly sms_survey_sent?: Date; readonly retarget_marketing_email?: Date; readonly billing_invoice_email?: Date; }; readonly is?: string[]; readonly assigned_to?: ICartAssignedUser[]; readonly created_by?: ICartAssignedUser; readonly processed_by?: ICartAssignedUser; readonly completed_by?: ICartAssignedUser; readonly from_marketplace?: MarketplaceTypeEnum; readonly marketplace_data?: IMarketplaceOrderData; readonly promise_to_purchase?: ICartPromiseToPurchase | null; readonly cart_content_type?: CartContentTypeEnum; readonly is_from_web?: boolean; readonly updated_by?: ICartAssignedUser[]; readonly canceled_by?: ICartAssignedUser; readonly external_values?: IG2OrderExternalValues; readonly has_transfers?: boolean; readonly to_be_verified_by_clerk?: boolean; readonly on_hold?: { date: Date; by_user: string; by_user_name: string; note?: string; } | null; readonly marketplace?: { readonly service: ExternalServiceSlugEnum; readonly origin: string; readonly order_id?: string; readonly cancel_requested?: boolean; }; } export interface ICartCustomerData { readonly customer_type?: string; readonly pro_title?: string; readonly pro_proof_doc?: string; readonly customer_default_email?: string; readonly customer_external_code?: string; readonly customer_external_group?: string; readonly terms_code?: string; readonly previous_terms_code?: string; readonly company_name?: string; readonly customer_external_class?: string; readonly customer_prefered_lang?: string; } export interface ICartPromiseToPurchase { ids: string[]; banks_used: IBankUsed[]; } export interface IBankUsed { promise_id: string; promise_unique_id: string; bank_type_id: string; amount: number; } export interface IApplicablePromiseBank { bank: IBank; promise_id: string; promise_unique_id: string; pa_is_active: boolean; } export declare enum CartErrorEnum { GENERAL_ERROR = "CGEGLOBAL0", GENERAL_ERROR_USER = "CGEUSER0", PAY_INCOMPLETE_CART = "CPAYINCOMPLETECART0", PAY_ALREADY_PAID = "CPAYPAID0", PAY_NO_PAYMENTS_PROVIDED = "CPAYNOPAYMENTS0", PAY_STORECREDIT_MISSING_CUSTOMER = "CPAYCREDNOCUSTOMER0", PAY_PAYPAL_MISSING_PAYLOAD = "CPAYPAYPALNOPAYLOAD0", PAY_MISSING_SERVICE = "CPAYNOPAYSERVICE0", PAY_SERVICE_NOT_SUPPORTED = "CPAYSERVNOTSUPPORTED0", PAY_GENERAL_ERROR = "CPAYGENERIC0", PAY_BAD_CREDITCARD_INFO = "CPBADCARD0", STORECREDIT_NOT_SUPPORTED = "SCNOSUPPORT0", STORECREDIT_NO_CUSTOMER_ID = "SCNOCUSTOMER0", STORECREDIT_MISSING_FUNDS = "SCMISSFUNDS0", STORECREDIT_COULD_NOT_UPDATE = "SCUPDATEERROR0", STORECREDIT_GENERAL_ERROR = "SCGENERIC0", FREE_SHIPPING_NOT_ELIGIBLE = "CSHIP0", FREE_SHIPPING_NOT_ELIGIBLE_BECAUSE_OF_SHIPPING_ADDRESS = "CSHIPADD0", FREE_SHIPPING_NOT_ELIGIBLE_BECAUSE_OF_ITEM = "CSHIPITEM0", PROMO_CODE_WRONG_CODE = "CPCWRONG0", PROMO_CODE_USED = "CPCUSED0", PROMO_CODE_ALREADY_IN_CART = "CPINCART0", PROMO_CODE_CART_ALREADY_DISCOUNTED = "CPCDISCOUNTED0", PROMO_CODE_FREE_SHIPPING = "CPCSHIP0", PROMO_CODE_NO_SHIPPING_SELECTED = "CPCCHOOSESHIP", PROMO_CODE_NOT_ELIGIBLE = "CPCNOTOK0", CART_DISCOUNT_CANT_APPLY = "CDNOTOK0", CART_DISCOUNT_NOT_STACKABLE = "CDCANTSTACK0" } export declare enum CartContentTypeEnum { MIXED = "mixte" } export declare enum CartCustomerEnum { GUEST = "guest", PRO = "pro", CONNECTED = "connected" } export interface IBoxItem extends IPredefinedBox { readonly item_ids: string[]; readonly occupied_volume: number; readonly weight: number; readonly confirm_weight?: boolean; } export interface IShippingQuote { readonly method?: 'shipping' | 'pickup'; readonly quote_id?: string; readonly carrier?: string; readonly service?: string; readonly service_code?: string; readonly provider?: string; readonly base_fee?: number; readonly surcharges?: { amount: number; name: string; }[]; readonly totalBeforeTaxes?: number; readonly taxes?: { amount: number; name: string; }[]; readonly merchant_shipping_fee?: number; readonly total?: number; readonly details?: any; readonly transit_days?: number; readonly estimatedShippingDate?: Date; readonly is_lowest?: boolean; readonly is_fastest?: boolean; readonly surcharge_to_be_added_to_cart?: number; } export declare enum CartTypeEnum { WEB = "web", POS = "pos", POS_TRANSACTIONNAL = "pos_transactionnal" } export declare enum CartStatusEnum { EMPTY = 0, CART = 1, CHECKOUT_SHIPPING = 2, CHECKOUT_PICKUP = 3, CHECKOUT_PAYMENT_FAILED = 4, CHECKOUT_PAYMENT_SUCCESS = 5, CART_READY_TO_PROCESS = 6, SHIPPING_AWAITING_OR_PICKUP_READY = 7, DELIVERING = 8, DELIVERED = 9, COMPLETED = 10, REFUND = 11, CANCELLED = 12, EXT_REFUND = 13 } export interface ICartItemPrices { readonly currency: string; readonly amount: number; readonly exchange_rate_date?: Date; readonly exchange_from?: string; readonly exchange_rate?: number; readonly date_range?: { readonly from: Date; readonly to: Date; }; readonly price_type?: string; } export interface ICartItemCustomPrices extends ICartItemPrices { readonly overridden?: boolean; readonly original_amount?: number | null; readonly authorization?: { readonly date: Date; readonly note: string; }; readonly percent_applied?: number; } export interface IIndexedTierPrincing { readonly from: string; readonly to: string; readonly price: ICartItemPrices; readonly check_attribute_value: string; readonly check_other_items_category: string; readonly name: ITranslation[]; } export interface IIndexedDeclination { readonly id?: string; readonly sku: string; readonly supplier_code?: string; readonly slug?: string; readonly upc?: string; readonly name: ITranslation[]; readonly description: ITranslation[]; readonly images_path: IImageInfo[]; readonly tax_exemption?: boolean; readonly regular_price: ICartItemPrices; readonly booking_price?: ICartItemPrices | null; readonly discount_price?: ICartItemCustomPrices | null; readonly promo_price?: ICartItemCustomPrices | null; readonly cost_price?: ICartItemPrices | null; readonly exclude_from_cost_calculations?: boolean; readonly prices_list?: IPriceListOption[]; readonly tax_family_id: string; readonly attributes: { readonly [key: string]: string[]; }; readonly overriden_attributes?: { readonly slug: string; readonly id: string; readonly overriden_values: string; }[]; readonly parent_product_id: string; readonly parent_slug?: string; readonly category_name?: ITranslation[]; readonly brand_name?: ITranslation[]; readonly parent_name?: ITranslation[]; readonly disabled?: boolean; readonly tier_pricing?: IIndexedTierPrincing[]; readonly shipping_info: IShippingInfo; readonly restrict_sale?: { readonly restrict_values: string[]; readonly restrict_message: string; }; readonly restrict_shipping?: { readonly restrict_values: string[]; readonly restrict_message: string; }; readonly exclude_from_free_shipping?: boolean; readonly stock_level?: { readonly store_warehouse_availability: IWarehouseAvailability[]; readonly to_be_receptioned: number; readonly is_infinite_stock?: boolean; }; readonly other_units?: IFilledDimensionUnits[]; readonly is_sample?: boolean; readonly sample_sku?: string; readonly is_service?: boolean; readonly is_other_type?: string; readonly hide_inventory?: boolean; readonly external_values?: IG2ProductExternalValues; readonly promise_to_purchase_association_ids?: string[]; readonly created_from_external_service?: ExternalServiceSlugEnum; } export interface IProductUpsell extends IIndexedDeclination { readonly recommended_qte: number; readonly recommended_sku: string; readonly matching_qte?: boolean; readonly actual_qte?: number; readonly use_parent?: boolean; readonly is_recommendation?: boolean; readonly show_recommendation_msg?: boolean; readonly auto_add?: boolean; } export interface ICartItem extends IIndexedDeclination { readonly qte: number; readonly qte_reserved?: number; readonly qte_bypass_inventory_check?: number; readonly state_after_verification?: 'out_of_stock' | 'modified_qty' | null; readonly price_override?: boolean; readonly qte_override?: boolean; readonly parent_slug?: string; readonly is_upsell_of_sku?: string; readonly product_upsells?: IProductRecommendation[]; readonly is_temp_prod?: boolean; readonly product_equivalents?: IProductEquivalent[]; readonly categories?: { readonly [key: string]: string; }; readonly bank_type_id?: string; readonly refunded_qty?: number; readonly refunded?: boolean; } export interface IActionDoneOnCart { readonly sku: string; readonly itemName: ITranslation[]; readonly action: ActionDoneOnCartEnum; } export interface ICartAssignedUser { readonly user_name: string; readonly user_email: string; readonly user_id: string; readonly user_external_id?: string; readonly date: Date; readonly is_active: boolean; readonly at_store_id?: string; readonly at_store_number?: string; readonly took_payment?: boolean; readonly update_type?: UpdateTypeEnum; } export declare enum UpdateTypeEnum { CART_CONTENT = "cart_content", PROCESSING_STORE = "processing_store", CART_PAYMENT = "cart_payment" } export declare enum ActionDoneOnCartEnum { DELETED = 0, MODIFIED_QTE = 1, MODIFIED_REGULAR_PRICE = 2, MODIFIED_DISCOUNT_PRICE = 3, OUT_OF_STOCK_OR_NOT_FOUND = 4 } export interface ICartItemWithSubItem extends ICartItem { readonly sub_items: ICartItemWithSubItem[] | undefined; readonly hide_from_summary?: boolean; } export interface ICartPaymentPayloadOptions { paypal_payload?: IPaypalPayload; stripe_payload?: IStripePayload; pandapay_payload?: IPandaPayload; elavon_payload?: IElavonPayload; paysafe_payload?: IPaysafePayload; charge_credit?: boolean; to_be_received?: boolean; other_payment_method?: { method: string; amount?: number; payment_ref: string; }; multi_payment_methods?: IPayment[]; } export declare enum CustomPromoType { UNIT_PRICE = "unit_price", EXTRA_PROMO = "extra_promo" } export declare const getCartDiscountError: (errCode: CartErrorEnum, locale?: string) => string; export declare const getPromoCodeError: (errCode: string, locale?: string) => string; /** * Returns translated error string for given Payment or StoreCredit error code. If error code not in cases, defaults to generic cart error message. * @param errCode * @param locale */ export declare const getCartPaymentError: (errCode: CartErrorEnum, locale?: string) => string; export declare const getDefaultCart: (cartType?: CartTypeEnum) => ICart; export declare const getDefaultCartItem: () => ICartItem;