import { EventDefinition } from '@wix/sdk-types'; /** WalletAction is the main entity of WalletActionService that can be used for lorem ipsum dolor */ export interface WalletAction { /** * WalletAction ID * @readonly */ _id?: string | null; /** * Represents the current state of an item. Each time the item is modified, its `revision` changes. For an update operation to succeed, you MUST pass the latest revision * @readonly */ revision?: string | null; /** * Represents the time this WalletAction was created * @readonly */ _createdDate?: Date; /** * Represents the time this WalletAction was last updated * @readonly */ _updatedDate?: Date; /** Wallet ID */ walletId?: string; /** Represents the time when the walletAction's amount will be added to the account */ startDate?: Date; /** Represents the time when the unused balance will be deducted from the account */ expirationDate?: Date; /** * Represents the time when the walletAction was manually disabled * @readonly */ disableDate?: Date; /** The amount to be added to the Wallet */ amount?: string; /** Free text comment regarding the WalletAction context */ note?: string | null; /** Indicates the kind of the specific walletAction */ type?: WalletActionType; /** @readonly */ walletActionStarted?: WalletActionExecutionDetails; /** @readonly */ walletActionEnded?: WalletActionExecutionDetails; /** @readonly */ status?: WalletActionStatus; /** @readonly */ source?: WalletActionSource; context?: WalletActionContext; notifications?: Notifications; liability?: boolean | null; } export interface EmailParams { skipEmailDispatch?: boolean | null; overrideTemplateId?: string | null; } export declare enum SourceType { UNKNOWN_SOURCE = "UNKNOWN_SOURCE", APP = "APP", USER = "USER" } export declare enum ContextType { UNKNOWN_CONTEXT = "UNKNOWN_CONTEXT", WORKFLOW = "WORKFLOW" } export interface WorkflowPayload { _id?: string; name?: string; } export declare enum WalletActionType { UNKNOWN = "UNKNOWN", REWARD = "REWARD", REFUND = "REFUND" } export interface WalletActionExecutionDetails { /** @readonly */ transactionId?: string | null; /** @readonly */ executionDate?: Date; } export declare enum WalletActionStatus { PENDING = "PENDING", ACTIVE = "ACTIVE", DISABLED = "DISABLED", EXPIRED = "EXPIRED" } export interface WalletActionSource { type?: SourceType; _id?: string | null; } export interface WalletActionContext extends WalletActionContextPayloadOneOf { /** Workflow payload */ workflowPayload?: WorkflowPayload; type?: ContextType; } /** @oneof */ export interface WalletActionContextPayloadOneOf { /** Workflow payload */ workflowPayload?: WorkflowPayload; } export interface Notifications { emailParams?: EmailParams; } export interface CreateWalletActionRequest { /** WalletAction to be created */ walletAction: WalletAction; } export interface CreateWalletActionResponse { /** The created WalletAction */ walletAction?: WalletAction; } export interface WalletActionCreationExpirationDateInThePastDetails { /** The date when the walletAction expires. */ expirationDate?: Date; /** The date when the walletAction was tried to be created. */ currentDate?: Date; } export interface WalletActionCreationStartLaterThanExpirationDetails { /** The start date of the walletAction. */ startDate?: Date; /** The date when the walletAction expires. */ expirationDate?: Date; } export interface WalletActionCreationDisabledAtDateSetDetails { /** Represents the time when the walletAction was disabled. */ disableDate?: Date; } export interface GetWalletActionRequest { /** ID of the WalletAction to retrieve */ walletActionId: string; } export interface GetWalletActionResponse { /** The retrieved WalletAction */ walletAction?: WalletAction; } export interface UpdateWalletActionRequest { /** WalletAction to be updated, may be partial */ walletAction: WalletAction; } export interface UpdateWalletActionResponse { /** The updated WalletAction */ walletAction?: WalletAction; } export interface InvalidWalletActionDetails { /** WalletAction ID. */ walletActionId?: string; } export interface WalletActionUpdateStartDateInThePastDetails { /** WalletAction ID. */ walletActionId?: string; /** The date when the walletAction expires. */ newStartDate?: Date; /** The date when the walletAction was tried to be updated. */ currentDate?: Date; } export interface WalletActionUpdateExpirationDateInThePastDetails { /** WalletAction ID. */ walletActionId?: string; /** The date when the walletAction expires. */ newExpirationDate?: Date; /** The date when the walletAction was tried to be updated. */ currentDate?: Date; } export interface WalletActionUpdateStartLaterThanExpirationDetails { /** WalletAction ID. */ walletActionId?: string; /** The start date of the walletAction. */ startDate?: Date; /** The date when the walletAction expires. */ expirationDate?: Date; } export interface DisableWalletActionRequest { /** ID of the WalletAction to delete */ walletActionId: string; /** The revision of the WalletAction */ revision: string; } export interface DisableWalletActionResponse { /** The expired WalletAction */ walletAction?: WalletAction; } export interface WalletActionDisabled { walletAction?: WalletAction; } export interface DeleteWalletActionRequest { /** ID of the WalletAction to delete */ walletActionId?: string; /** The revision of the WalletAction */ revision?: string; } export interface DeleteWalletActionResponse { } export interface QueryWalletActionRequest { /** WQL expression */ query: QueryV2; } export interface QueryV2 extends QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; /** * Filter object in the following format: * `"filter" : { * "fieldName1": "value1", * "fieldName2":{"$operator":"value2"} * }` * Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains` */ filter?: Record | null; /** * Sort object in the following format: * `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` */ sort?: Sorting[]; /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */ fields?: string[]; /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */ fieldsets?: string[]; } /** @oneof */ export interface QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } export declare enum SortOrder { ASC = "ASC", DESC = "DESC" } export interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } export interface CursorPaging { /** Number of items to load. */ limit?: number | null; /** * Pointer to the next or previous page in the list of results. * * You can get the relevant cursor token * from the `pagingMetadata` object in the previous call's response. * Not relevant for the first request. */ cursor?: string | null; } export interface QueryWalletActionResponse { /** The retrieved WalletActions */ walletActions?: WalletAction[]; pagingMetadata?: PagingMetadataV2; } export interface PagingMetadataV2 { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */ cursors?: Cursors; } export interface Cursors { /** Cursor pointing to next page in the list of results. */ next?: string | null; /** Cursor pointing to previous page in the list of results. */ prev?: string | null; } export interface QueryWalletActionBalancesRequest { /** WQL expression */ query: QueryV2; } export interface QueryWalletActionBalancesResponse { /** The retrieved WalletActions with their balance */ walletActions?: WalletActionWithBalance[]; pagingMetadata?: PagingMetadataV2; } export interface WalletActionWithBalance { /** WalletAction */ walletAction?: WalletAction; /** WalletAction balance */ balance?: string | null; } export interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ _id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * Example: created/updated/deleted/started/completed/email_opened */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp. */ eventTime?: Date; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } export interface DomainCreatedEvent extends Omit, 'deletedEvent' | 'updatedEvent' | 'actionEvent'> { } export interface DomainDeletedEvent extends Omit, 'createdEvent' | 'updatedEvent' | 'actionEvent'> { } export interface DomainUpdatedEvent extends Omit, 'createdEvent' | 'deletedEvent' | 'actionEvent'> { } export interface DomainActionEvent extends Omit, 'createdEvent' | 'deletedEvent' | 'updatedEvent'> { } /** @oneof */ export interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } export interface EntityCreatedEvent { entity?: T; } export interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: T; } export interface EntityDeletedEvent { /** Entity that was deleted */ deletedEntity?: T | null; } export interface ActionEvent { body?: T; } export interface Empty { } export interface CreateMigrationWalletActionRequest { /** WalletAction to be created */ walletAction?: WalletAction; } export interface CreateMigrationWalletActionResponse { /** The created WalletAction */ walletAction?: WalletAction; } export interface CreateWalletActionResponseNonNullableFields { walletAction?: { walletId: string; amount: string; type: WalletActionType; status: WalletActionStatus; source?: { type: SourceType; }; context?: { workflowPayload?: { _id: string; name: string; }; type: ContextType; }; }; } export interface GetWalletActionResponseNonNullableFields { walletAction?: { walletId: string; amount: string; type: WalletActionType; status: WalletActionStatus; source?: { type: SourceType; }; context?: { workflowPayload?: { _id: string; name: string; }; type: ContextType; }; }; } export interface UpdateWalletActionResponseNonNullableFields { walletAction?: { walletId: string; amount: string; type: WalletActionType; status: WalletActionStatus; source?: { type: SourceType; }; context?: { workflowPayload?: { _id: string; name: string; }; type: ContextType; }; }; } export interface DisableWalletActionResponseNonNullableFields { walletAction?: { walletId: string; amount: string; type: WalletActionType; status: WalletActionStatus; source?: { type: SourceType; }; context?: { workflowPayload?: { _id: string; name: string; }; type: ContextType; }; }; } export interface QueryWalletActionResponseNonNullableFields { walletActions: { walletId: string; amount: string; type: WalletActionType; status: WalletActionStatus; source?: { type: SourceType; }; context?: { workflowPayload?: { _id: string; name: string; }; type: ContextType; }; }[]; } export interface QueryWalletActionBalancesResponseNonNullableFields { walletActions: { walletAction?: { walletId: string; amount: string; type: WalletActionType; status: WalletActionStatus; source?: { type: SourceType; }; context?: { workflowPayload?: { _id: string; name: string; }; type: ContextType; }; }; }[]; } export declare const onWalletActionCreated: EventDefinition, "wix.rise.v1.wallet_action_created">; export declare const onWalletActionUpdated: EventDefinition, "wix.rise.v1.wallet_action_updated">; export declare const onWalletActionDisabled: EventDefinition, "wix.rise.v1.wallet_action_disabled">; /** * Creates a new WalletAction * @param walletAction - WalletAction to be created * @public * @documentationMaturity preview * @requiredField walletAction * @requiredField walletAction.amount * @requiredField walletAction.type * @requiredField walletAction.walletId */ export declare function createWalletAction(walletAction: WalletAction): Promise; /** * Get an WalletAction by ID * @param walletActionId - ID of the WalletAction to retrieve * @public * @documentationMaturity preview * @requiredField walletActionId * @returns The retrieved WalletAction */ export declare function getWalletAction(walletActionId: string): Promise['walletAction']>; /** * Update an WalletAction, supports partial update * Pass the latest `revision` for a successful update * @param _id - WalletAction ID * @public * @documentationMaturity preview * @requiredField _id * @requiredField walletAction * @requiredField walletAction.revision * @returns The updated WalletAction */ export declare function updateWalletAction(_id: string | null, walletAction: UpdateWalletAction): Promise['walletAction']>; export interface UpdateWalletAction { /** * WalletAction ID * @readonly */ _id?: string | null; /** * Represents the current state of an item. Each time the item is modified, its `revision` changes. For an update operation to succeed, you MUST pass the latest revision * @readonly */ revision?: string | null; /** * Represents the time this WalletAction was created * @readonly */ _createdDate?: Date; /** * Represents the time this WalletAction was last updated * @readonly */ _updatedDate?: Date; /** Wallet ID */ walletId?: string; /** Represents the time when the walletAction's amount will be added to the account */ startDate?: Date; /** Represents the time when the unused balance will be deducted from the account */ expirationDate?: Date; /** * Represents the time when the walletAction was manually disabled * @readonly */ disableDate?: Date; /** The amount to be added to the Wallet */ amount?: string; /** Free text comment regarding the WalletAction context */ note?: string | null; /** Indicates the kind of the specific walletAction */ type?: WalletActionType; /** @readonly */ walletActionStarted?: WalletActionExecutionDetails; /** @readonly */ walletActionEnded?: WalletActionExecutionDetails; /** @readonly */ status?: WalletActionStatus; /** @readonly */ source?: WalletActionSource; context?: WalletActionContext; notifications?: Notifications; liability?: boolean | null; } /** * Expire an WalletAction immediately and deducting the remaining balance from the gift card * @param walletActionId - ID of the WalletAction to delete * @param revision - The revision of the WalletAction * @public * @documentationMaturity preview * @requiredField revision * @requiredField walletActionId */ export declare function disableWalletAction(walletActionId: string, revision: string): Promise; /** * Query WalletActions using [WQL - Wix Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) * @public * @documentationMaturity preview */ export declare function queryWalletActions(): WalletActionsQueryBuilder; interface QueryOffsetResult { currentPage: number | undefined; totalPages: number | undefined; totalCount: number | undefined; hasNext: () => boolean; hasPrev: () => boolean; length: number; pageSize: number; } export interface WalletActionsQueryResult extends QueryOffsetResult { items: WalletAction[]; query: WalletActionsQueryBuilder; next: () => Promise; prev: () => Promise; } export interface WalletActionsQueryBuilder { /** @param limit - Number of items to return, which is also the `pageSize` of the results object. * @documentationMaturity preview */ limit: (limit: number) => WalletActionsQueryBuilder; /** @param skip - Number of items to skip in the query results before returning the results. * @documentationMaturity preview */ skip: (skip: number) => WalletActionsQueryBuilder; /** @documentationMaturity preview */ find: () => Promise; } /** * Query WalletActions using [WQL - Wix Query Language](https://dev.wix.com/api/rest/getting-started/api-query-language) * Results will be enriched with calculated balances * @param query - WQL expression * @public * @documentationMaturity preview * @requiredField query */ export declare function queryWalletActionsBalances(query: QueryV2): Promise; export {};